ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdcsAOBIAS.hpp
Go to the documentation of this file.
1
8#ifndef ngcdcsAOBIAS_H
9#define ngcdcsAOBIAS_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 ngcdcsAOBIAS_ERR_PROTECTION 0x1
22
27{
28public:
30 ngcdcsAOBIAS(const ngcb_route_t &r, int nb);
31
33 ngcdcsAOBIAS(ngcbIFC *ifc, const ngcb_route_t &r, int nb);
34
36 virtual ~ngcdcsAOBIAS();
37
40
43
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 Volt2Reg(double *volt, int chan, double corr = 1.0);
61
63 double Reg2Volt(int reg, int chan, double corr = 1.0);
64
66 int Adjust(int chan);
67
69 int DacReg(int value, int chan);
70
72 int Monitor(int num, int clkChan) {
73 USE(num); USE(clkChan);
74 return (Success());
75 }
76
78 int OffsetClk(double volt) {
79 USE(volt);
80 return (Success());
81 }
82
84 int OffsetDC(double volt) {
85 USE(volt);
86 return (Success());
87 }
88
90 int PreampOffset(double volt) {
91 USE(volt);
92 return (Success());
93 }
94
96 int VideoOffset(double * volt) {
97 USE(volt);
98 return (Success());
99 }
100
102 int DiodeBias(double volt) {
103 USE(volt);
104 return (Success());
105 }
106
108 double OffsetClk() {return (0.0);}
109
111 double OffsetDC() {return (0.0);}
112
114 int TelIntern(int sel = -1) {USE(sel); return (Success());}
115
117 int TelChan(int num, double *volt) {
118 if ((num < 0) || (num >= numDc))
119 {
120 sprintf(ErrMsg(), "bias channel number out of range");
121 return (ngcbMOD_ERR);
122 }
123 *volt = dc[num].volt;
124 dcTel[num] = *volt;
125 return (Success());
126 }
127
129 int TelDC(int num, double *volt) {
130 if ((num < 0) || (num >= numDc))
131 {
132 sprintf(ErrMsg(), "bias channel number out of range");
133 return (ngcbMOD_ERR);
134 }
135 *volt = dc[num].volt;
136 dcTel[num] = *volt;
137 return (Success());
138 }
139
141 int TelClk(int num, int l, double *volt) {
142 if ((num < 0) || (num >= numClk))
143 {
144 sprintf(ErrMsg(), "clock channel number out of range");
145 return (ngcbMOD_ERR);
146 }
147 *volt = clk[num].level[l].volt;
148 clkTel[num].volt[l] = *volt;
149 return (Success());
150 }
151
153 int TelClk(int num, ngcdcs_clkv_t *cv) {
154 int j;
155 for (j=0;j<ngcdcsCLDC_DCLK;j++)
156 {
157 double volt;
158 if (TelClk(num, j, &volt) != Success())
159 {
160 return (ngcbMOD_ERR);
161 }
162 else
163 {
164 cv->volt[j] = volt;
165 }
166 }
167 return (Success());
168 }
169
171 int Zero() {return (Success());}
172
174 int Calibrate(int noSetup = 0) {
175 USE(noSetup);
176 return (Success());
177 }
178
181
183 int Calibrated() {return (1);}
184
186 int SetupKey(const char *key, const int *idx, const char *value,
187 int *status = NULL);
188
190 int StatusKey(const char *key, const int *idx, char *value,
191 int *status = NULL);
192
193protected:
194
195private:
197 void Init_();
198
200 void AdjustV_(int num);
201
203 int AdjustR_(int num);
204
206 double G1_;
207
209 double G2_;
210
212 double G3_;
213
215 double G4_;
216
218 double G5_;
219
221 double dcSave_[ngcbCLDC_MAX_DC];
222};
223
224#endif
Definition ngcbIFC.hpp:760
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:68
virtual char * ErrMsg()
Error message.
Definition ngcbOBJ.cpp:66
void ClkMap(ngcdcs_clk_t *cv)
Clock channel mapping.
Definition ngcdcsAOBIAS.cpp:223
double Reg2Volt(int reg, int chan, double corr=1.0)
Convert register value to voltage.
Definition ngcdcsAOBIAS.cpp:688
int Zero()
Set all voltages to zero.
Definition ngcdcsAOBIAS.hpp:171
int DiodeBias(double volt)
Diode bias dummy function.
Definition ngcdcsAOBIAS.hpp:102
int VStatus(int *s)
Get voltage HW-status.
Definition ngcdcsAOBIAS.cpp:109
int Monitor(int num, int clkChan)
Clock-monitor dummy function.
Definition ngcdcsAOBIAS.hpp:72
int TelClk(int num, int l, double *volt)
Telemetry for clock level (dummy)
Definition ngcdcsAOBIAS.hpp:141
double OffsetDC()
Return offset for DC-biases.
Definition ngcdcsAOBIAS.hpp:111
int OffsetClk(double volt)
Clock offset dummy function.
Definition ngcdcsAOBIAS.hpp:78
int Calibrate(int noSetup=0)
Calibrate.
Definition ngcdcsAOBIAS.hpp:174
int VideoOffset(double *volt)
Video offset dummy function.
Definition ngcdcsAOBIAS.hpp:96
int Volt2Reg(double *volt, int chan, double corr=1.0)
Convert voltage to register value.
Definition ngcdcsAOBIAS.cpp:496
int PreampOffset(double volt)
Preamplifier offset dummy function.
Definition ngcdcsAOBIAS.hpp:90
ngcdcsAOBIAS(const ngcb_route_t &r, int nb)
Constructor with route and number of biases.
Definition ngcdcsAOBIAS.cpp:30
int TelDC(int num, double *volt)
Telemetry for DC-bias (dummy)
Definition ngcdcsAOBIAS.hpp:129
int OffsetDC(double volt)
Bias offset dummy function.
Definition ngcdcsAOBIAS.hpp:84
int Calibrated()
Check if calibration has been done.
Definition ngcdcsAOBIAS.hpp:183
void DcMap(ngcdcs_dc_t *dv)
Bias channel mapping.
Definition ngcdcsAOBIAS.cpp:188
virtual ~ngcdcsAOBIAS()
Destructor.
Definition ngcdcsAOBIAS.cpp:45
double OffsetClk()
Return offset for clocks.
Definition ngcdcsAOBIAS.hpp:108
int autoAdjust
Auto voltage register adjustment.
Definition ngcdcsAOBIAS.hpp:39
void DefaultSetup(const char *keyWord=NULL)
Default setup.
Definition ngcdcsAOBIAS.cpp:247
int DacReg(int value, int chan)
Map value on DAC register channel.
Definition ngcdcsAOBIAS.cpp:1023
int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (dummy, all levels)
Definition ngcdcsAOBIAS.hpp:153
int TelIntern(int sel=-1)
Update internal telemetry.
Definition ngcdcsAOBIAS.hpp:114
void ClearCalibration()
Clear calibration.
Definition ngcdcsAOBIAS.hpp:180
double hvGainUpperRail
Gain of high voltage clock upper rail.
Definition ngcdcsAOBIAS.hpp:42
double hvGainLowerRail
Gain of high voltage clock lower rail.
Definition ngcdcsAOBIAS.hpp:45
int Adjust(int chan)
Voltage setup adjustement for channel.
Definition ngcdcsAOBIAS.cpp:870
int TelChan(int num, double *volt)
Telemetry for channel.
Definition ngcdcsAOBIAS.hpp:117
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsAOBIAS.cpp:1098
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsAOBIAS.cpp:1057
int numDc
Number of bias voltages.
Definition ngcdcsCLDC.hpp:168
ngcdcs_clkv_t * clkTel
Saved clock voltages telemetry values.
Definition ngcdcsCLDC.hpp:171
double * dcTel
Saved bias voltages telemetry values.
Definition ngcdcsCLDC.hpp:174
int numClk
Number of clock voltages.
Definition ngcdcsCLDC.hpp:162
ngcdcs_dc_t * dc
Bias voltages.
Definition ngcdcsCLDC.hpp:165
ngcdcs_clk_t * clk
Clock voltages.
Definition ngcdcsCLDC.hpp:159
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