ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsALBIAS.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsALBIAS_H
8#define ngcdcsALBIAS_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
16
20#define ngcdcsALBIAS_ERR_PROTECTION 0x1
21
26{
27public:
29 ngcdcsALBIAS(const ngcb_route_t &r, int nb);
30
32 ngcdcsALBIAS(ngcbIFC *ifc, const ngcb_route_t &r, int nb);
33
35 virtual ~ngcdcsALBIAS();
36
39
42
44 int Disable();
45
47 void ClkMap(ngcdcs_clk_t *cv);
48
50 void DcMap(ngcdcs_dc_t *dv);
51
53 int VStatus(int *s);
54
56 void DefaultSetup(const char *keyWord = NULL);
57
59 int VoltageClk(int num, int l, double volt, int rangeCheck = 1);
60
62 int VoltageDC(int num, double volt, int rangeCheck = 1);
63
65 int VoltageRegDC(int num, int value, int rangeCheck = 1) {
66 USE(num); USE(value); USE(rangeCheck);
67 strcpy(ErrMsg(), "function not available");
68 return (ngcbMOD_ERR);
69 }
70
72 int VoltageRegClk(int num, int l, int value, int rangeCheck = 1) {
73 USE(num); USE(l); USE(value); USE(rangeCheck);
74 strcpy(ErrMsg(), "function not available");
75 return (ngcbMOD_ERR);
76 }
77
79 int OutputEnable();
80
82 int OutputDisable();
83
85 char *VStatusString() {return statStr_;}
86
88 int Monitor(int num, int clkChan) {
89 USE(num); USE(clkChan);
90 return (Success());
91 }
92
94 int OffsetClk(double volt) {
95 USE(volt);
96 return (Success());
97 }
98
100 int OffsetDC(double volt) {
101 USE(volt);
102 return (Success());
103 }
104
106 int PreampOffset(double volt) {
107 USE(volt);
108 return (Success());
109 }
110
112 int VideoOffset(double * volt) {
113 USE(volt);
114 return (Success());
115 }
116
118 int DiodeBias(double volt) {
119 USE(volt);
120 return (Success());
121 }
122
124 double OffsetClk() {return (0.0);}
125
127 double OffsetDC() {return (0.0);}
128
130 int TelIntern(int sel = -1);
131
133 int TelChan(int num, double *volt);
134
136 int TelDC(int num, double *volt);
137
139 int TelClk(int num, int l, double *volt) {
140 if ((num < 0) || (num >= numClk))
141 {
142 sprintf(ErrMsg(), "clock channel number out of range");
143 return (ngcbMOD_ERR);
144 }
145 *volt = clk[num].level[l].volt;
146 clkTel[num].volt[l] = *volt;
147 return (Success());
148 }
149
151 int TelClk(int num, ngcdcs_clkv_t *cv) {
152 int j;
153 for (j=0;j<ngcdcsCLDC_DCLK;j++)
154 {
155 double volt;
156 if (TelClk(num, j, &volt) != Success())
157 {
158 return (ngcbMOD_ERR);
159 }
160 else
161 {
162 cv->volt[j] = volt;
163 }
164 }
165 return (Success());
166 }
167
169 int Protection(int flag) {
170 protectionOn = flag;
171 return (Success());
172 }
173
175 int Zero();
176
178 int Calibrate(int noSetup = 0) {
179 USE(noSetup);
180 return (Success());
181 }
182
185
187 int Calibrated() {return (1);}
188
190 int SetupKey(const char *key, const int *idx, const char *value,
191 int *status = NULL);
192
194 int StatusKey(const char *key, const int *idx, char *value,
195 int *status = NULL);
196
197protected:
198
199private:
201 double dcSave_[ngcbCLDC_MAX_DC];
202
204 char statStr_[32];
205
207 void Init_();
208
210 int VoltageDC_(int num, double volt, int rangeCheck);
211
213 void Span_(double v, int *code, double *range, double *gnd);
214
216 int Chan2_(int chan);
217
219 int DacData_(int chan);
220
222 int DacCtrl_(int chan);
223
225 int Convert_(int adcBase, int cmd, double *volt);
226};
227
228#endif
229
Definition ngcbIFC.hpp:754
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:67
virtual char * ErrMsg()
Error message.
Definition ngcbOBJ.cpp:65
int OffsetDC(double volt)
Bias offset dummy function.
Definition ngcdcsALBIAS.hpp:100
int Monitor(int num, int clkChan)
Clock-monitor dummy function.
Definition ngcdcsALBIAS.hpp:88
int VoltageDC(int num, double volt, int rangeCheck=1)
Bias setup.
Definition ngcdcsALBIAS.cpp:772
double OffsetDC()
Return offset for DC-biases.
Definition ngcdcsALBIAS.hpp:127
int VoltageClk(int num, int l, double volt, int rangeCheck=1)
Clock setup.
Definition ngcdcsALBIAS.cpp:687
int TelDC(int num, double *volt)
Telemetry for DC-bias.
Definition ngcdcsALBIAS.cpp:1058
int OutputEnable()
Enable output.
Definition ngcdcsALBIAS.cpp:116
int OffsetClk(double volt)
Clock offset dummy function.
Definition ngcdcsALBIAS.hpp:94
int Disable()
Disable call back.
Definition ngcdcsALBIAS.cpp:101
int VoltageRegClk(int num, int l, int value, int rangeCheck=1)
Direct clock register setup (not applicable)
Definition ngcdcsALBIAS.hpp:72
int Zero()
Set all voltages to zero.
Definition ngcdcsALBIAS.cpp:132
void ClearCalibration()
Clear calibration.
Definition ngcdcsALBIAS.hpp:184
int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (dummy, all levels)
Definition ngcdcsALBIAS.hpp:151
int Protection(int flag)
Enable/disable protection circuit.
Definition ngcdcsALBIAS.hpp:169
int VideoOffset(double *volt)
Video offset dummy function.
Definition ngcdcsALBIAS.hpp:112
int VoltageRegDC(int num, int value, int rangeCheck=1)
Direct bias register setup (not applicable)
Definition ngcdcsALBIAS.hpp:65
int PreampOffset(double volt)
Preamplifier offset dummy function.
Definition ngcdcsALBIAS.hpp:106
int TelClk(int num, int l, double *volt)
Telemetry for clock level (dummy)
Definition ngcdcsALBIAS.hpp:139
int TelIntern(int sel=-1)
Update internal telemetry.
Definition ngcdcsALBIAS.cpp:1077
double OffsetClk()
Return offset for clocks.
Definition ngcdcsALBIAS.hpp:124
int Calibrate(int noSetup=0)
Calibrate.
Definition ngcdcsALBIAS.hpp:178
int OutputDisable()
Disable output.
Definition ngcdcsALBIAS.cpp:124
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsALBIAS.cpp:785
ngcdcsALBIAS(const ngcb_route_t &r, int nb)
Constructor with route and number of biases.
Definition ngcdcsALBIAS.cpp:29
void ClkMap(ngcdcs_clk_t *cv)
Clock channel mapping.
Definition ngcdcsALBIAS.cpp:186
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsALBIAS.cpp:826
virtual ~ngcdcsALBIAS()
Destructor.
Definition ngcdcsALBIAS.cpp:44
void DefaultSetup(const char *keyWord=NULL)
Default setup.
Definition ngcdcsALBIAS.cpp:210
double hvGainLowerRail
Gain of high voltage clock lower rail.
Definition ngcdcsALBIAS.hpp:41
int DiodeBias(double volt)
Diode bias dummy function.
Definition ngcdcsALBIAS.hpp:118
char * VStatusString()
Get voltage status string.
Definition ngcdcsALBIAS.hpp:85
void DcMap(ngcdcs_dc_t *dv)
Bias channel mapping.
Definition ngcdcsALBIAS.cpp:156
int VStatus(int *s)
Get voltage HW-status.
Definition ngcdcsALBIAS.cpp:150
double hvGainUpperRail
Gain of high voltage clock upper rail.
Definition ngcdcsALBIAS.hpp:38
int Calibrated()
Check if calibration has been done.
Definition ngcdcsALBIAS.hpp:187
ngcdcs_clkv_t * clkTel
Saved clock voltages telemetry values.
Definition ngcdcsCLDC.hpp:170
int numClk
Number of clock voltages.
Definition ngcdcsCLDC.hpp:161
int protectionOn
Flag indicating whether protection is enabled.
Definition ngcdcsCLDC.hpp:149
ngcdcs_clk_t * clk
Clock voltages.
Definition ngcdcsCLDC.hpp:158
int TelChan()
Return actual telemetry channel.
Definition ngcdcsCldcTel.cpp:80
ngcdcsCLDC(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.cpp:28
#define ngcbCLDC_MAX_DC
Definition ngcbAddr.h:333
#define ngcbMOD_ERR
Definition ngcbOBJ.hpp:22
#define USE(x)
Definition ngcb.h:28
#define ngcdcsCLDC_DCLK
Definition ngcdcsCLDC.hpp:38
Definition ngcbIFC.hpp:72
Definition ngcdcsCLDC.hpp:103
Definition ngcdcsCLDC.hpp:114
double volt[ngcdcsCLDC_DCLK]
Definition ngcdcsCLDC.hpp:115
Definition ngcdcsCLDC.hpp:63