ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdcsALBIAS.hpp
Go to the documentation of this file.
1
8#ifndef ngcdcsALBIAS_H
9#define ngcdcsALBIAS_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
17
21#define ngcdcsALBIAS_ERR_PROTECTION 0x1
22
27{
28public:
30 ngcdcsALBIAS(const ngcb_route_t &r, int nb);
31
33 ngcdcsALBIAS(ngcbIFC *ifc, const ngcb_route_t &r, int nb);
34
36 virtual ~ngcdcsALBIAS();
37
40
43
45 int Disable();
46
48 void ClkMap(ngcdcs_clk_t *cv);
49
51 void DcMap(ngcdcs_dc_t *dv);
52
54 int VStatus(int *s);
55
57 void DefaultSetup(const char *keyWord = NULL);
58
60 int VoltageClk(int num, int l, double volt, int rangeCheck = 1);
61
63 int VoltageDC(int num, double volt, int rangeCheck = 1);
64
66 int VoltageRegDC(int num, int value, int rangeCheck = 1) {
67 USE(num); USE(value); USE(rangeCheck);
68 strcpy(ErrMsg(), "function not available");
69 return (ngcbMOD_ERR);
70 }
71
73 int VoltageRegClk(int num, int l, int value, int rangeCheck = 1) {
74 USE(num); USE(l); USE(value); USE(rangeCheck);
75 strcpy(ErrMsg(), "function not available");
76 return (ngcbMOD_ERR);
77 }
78
80 int OutputEnable();
81
83 int OutputDisable();
84
86 char *VStatusString() {return statStr_;}
87
89 int Monitor(int num, int clkChan) {
90 USE(num); USE(clkChan);
91 return (Success());
92 }
93
95 int OffsetClk(double volt) {
96 USE(volt);
97 return (Success());
98 }
99
101 int OffsetDC(double volt) {
102 USE(volt);
103 return (Success());
104 }
105
107 int PreampOffset(double volt) {
108 USE(volt);
109 return (Success());
110 }
111
113 int VideoOffset(double * volt) {
114 USE(volt);
115 return (Success());
116 }
117
119 int DiodeBias(double volt) {
120 USE(volt);
121 return (Success());
122 }
123
125 double OffsetClk() {return (0.0);}
126
128 double OffsetDC() {return (0.0);}
129
131 int TelIntern(int sel = -1);
132
134 int TelChan(int num, double *volt);
135
137 int TelDC(int num, double *volt);
138
140 int TelClk(int num, int l, double *volt) {
141 if ((num < 0) || (num >= numClk))
142 {
143 sprintf(ErrMsg(), "clock channel number out of range");
144 return (ngcbMOD_ERR);
145 }
146 *volt = clk[num].level[l].volt;
147 clkTel[num].volt[l] = *volt;
148 return (Success());
149 }
150
152 int TelClk(int num, ngcdcs_clkv_t *cv) {
153 int j;
154 for (j=0;j<ngcdcsCLDC_DCLK;j++)
155 {
156 double volt;
157 if (TelClk(num, j, &volt) != Success())
158 {
159 return (ngcbMOD_ERR);
160 }
161 else
162 {
163 cv->volt[j] = volt;
164 }
165 }
166 return (Success());
167 }
168
170 int Protection(int flag) {
171 protectionOn = flag;
172 return (Success());
173 }
174
176 int Zero();
177
179 int Calibrate(int noSetup = 0) {
180 USE(noSetup);
181 return (Success());
182 }
183
186
188 int Calibrated() {return (1);}
189
191 int SetupKey(const char *key, const int *idx, const char *value,
192 int *status = NULL);
193
195 int StatusKey(const char *key, const int *idx, char *value,
196 int *status = NULL);
197
198protected:
199
200private:
202 double dcSave_[ngcbCLDC_MAX_DC];
203
205 char statStr_[32];
206
208 void Init_();
209
211 int VoltageDC_(int num, double volt, int rangeCheck);
212
214 void Span_(double v, int *code, double *range, double *gnd);
215
217 int Chan2_(int chan);
218
220 int DacData_(int chan);
221
223 int DacCtrl_(int chan);
224
226 int Convert_(int adcBase, int cmd, double *volt);
227};
228
229#endif
230
Definition ngcbIFC.hpp:760
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:68
virtual char * ErrMsg()
Error message.
Definition ngcbOBJ.cpp:66
int OffsetDC(double volt)
Bias offset dummy function.
Definition ngcdcsALBIAS.hpp:101
int Monitor(int num, int clkChan)
Clock-monitor dummy function.
Definition ngcdcsALBIAS.hpp:89
int VoltageDC(int num, double volt, int rangeCheck=1)
Bias setup.
Definition ngcdcsALBIAS.cpp:773
double OffsetDC()
Return offset for DC-biases.
Definition ngcdcsALBIAS.hpp:128
int VoltageClk(int num, int l, double volt, int rangeCheck=1)
Clock setup.
Definition ngcdcsALBIAS.cpp:688
int TelDC(int num, double *volt)
Telemetry for DC-bias.
Definition ngcdcsALBIAS.cpp:1059
int OutputEnable()
Enable output.
Definition ngcdcsALBIAS.cpp:117
int OffsetClk(double volt)
Clock offset dummy function.
Definition ngcdcsALBIAS.hpp:95
int Disable()
Disable call back.
Definition ngcdcsALBIAS.cpp:102
int VoltageRegClk(int num, int l, int value, int rangeCheck=1)
Direct clock register setup (not applicable)
Definition ngcdcsALBIAS.hpp:73
int Zero()
Set all voltages to zero.
Definition ngcdcsALBIAS.cpp:133
void ClearCalibration()
Clear calibration.
Definition ngcdcsALBIAS.hpp:185
int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (dummy, all levels)
Definition ngcdcsALBIAS.hpp:152
int Protection(int flag)
Enable/disable protection circuit.
Definition ngcdcsALBIAS.hpp:170
int VideoOffset(double *volt)
Video offset dummy function.
Definition ngcdcsALBIAS.hpp:113
int VoltageRegDC(int num, int value, int rangeCheck=1)
Direct bias register setup (not applicable)
Definition ngcdcsALBIAS.hpp:66
int PreampOffset(double volt)
Preamplifier offset dummy function.
Definition ngcdcsALBIAS.hpp:107
int TelClk(int num, int l, double *volt)
Telemetry for clock level (dummy)
Definition ngcdcsALBIAS.hpp:140
int TelIntern(int sel=-1)
Update internal telemetry.
Definition ngcdcsALBIAS.cpp:1078
double OffsetClk()
Return offset for clocks.
Definition ngcdcsALBIAS.hpp:125
int Calibrate(int noSetup=0)
Calibrate.
Definition ngcdcsALBIAS.hpp:179
int OutputDisable()
Disable output.
Definition ngcdcsALBIAS.cpp:125
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsALBIAS.cpp:786
ngcdcsALBIAS(const ngcb_route_t &r, int nb)
Constructor with route and number of biases.
Definition ngcdcsALBIAS.cpp:30
void ClkMap(ngcdcs_clk_t *cv)
Clock channel mapping.
Definition ngcdcsALBIAS.cpp:187
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsALBIAS.cpp:827
virtual ~ngcdcsALBIAS()
Destructor.
Definition ngcdcsALBIAS.cpp:45
void DefaultSetup(const char *keyWord=NULL)
Default setup.
Definition ngcdcsALBIAS.cpp:211
double hvGainLowerRail
Gain of high voltage clock lower rail.
Definition ngcdcsALBIAS.hpp:42
int DiodeBias(double volt)
Diode bias dummy function.
Definition ngcdcsALBIAS.hpp:119
char * VStatusString()
Get voltage status string.
Definition ngcdcsALBIAS.hpp:86
void DcMap(ngcdcs_dc_t *dv)
Bias channel mapping.
Definition ngcdcsALBIAS.cpp:157
int VStatus(int *s)
Get voltage HW-status.
Definition ngcdcsALBIAS.cpp:151
double hvGainUpperRail
Gain of high voltage clock upper rail.
Definition ngcdcsALBIAS.hpp:39
int Calibrated()
Check if calibration has been done.
Definition ngcdcsALBIAS.hpp:188
ngcdcs_clkv_t * clkTel
Saved clock voltages telemetry values.
Definition ngcdcsCLDC.hpp:171
int numClk
Number of clock voltages.
Definition ngcdcsCLDC.hpp:162
int protectionOn
Flag indicating whether protection is enabled.
Definition ngcdcsCLDC.hpp:150
ngcdcs_clk_t * clk
Clock voltages.
Definition ngcdcsCLDC.hpp:159
int TelChan()
Return actual telemetry channel.
Definition ngcdcsCldcTel.cpp:81
ngcdcsCLDC(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.cpp:29
#define ngcbCLDC_MAX_DC
Definition ngcbAddr.h:334
#define ngcbMOD_ERR
Definition ngcbOBJ.hpp:23
#define USE(x)
Definition ngcb.h:29
#define ngcdcsCLDC_DCLK
Definition ngcdcsCLDC.hpp:39
Definition ngcbIFC.hpp:78
Definition ngcdcsCLDC.hpp:104
Definition ngcdcsCLDC.hpp:115
double volt[ngcdcsCLDC_DCLK]
Definition ngcdcsCLDC.hpp:116
Definition ngcdcsCLDC.hpp:64