ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsAOBIAS.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsAOBIAS_H
8#define ngcdcsAOBIAS_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 ngcdcsAOBIAS_ERR_PROTECTION 0x1
21
26{
27public:
29 ngcdcsAOBIAS(const ngcb_route_t &r, int nb);
30
32 ngcdcsAOBIAS(ngcbIFC *ifc, const ngcb_route_t &r, int nb);
33
35 virtual ~ngcdcsAOBIAS();
36
39
42
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 Volt2Reg(double *volt, int chan, double corr = 1.0);
60
62 double Reg2Volt(int reg, int chan, double corr = 1.0);
63
65 int Adjust(int chan);
66
68 int DacReg(int value, int chan);
69
71 int Monitor(int num, int clkChan) {
72 USE(num); USE(clkChan);
73 return (Success());
74 }
75
77 int OffsetClk(double volt) {
78 USE(volt);
79 return (Success());
80 }
81
83 int OffsetDC(double volt) {
84 USE(volt);
85 return (Success());
86 }
87
89 int PreampOffset(double volt) {
90 USE(volt);
91 return (Success());
92 }
93
95 int VideoOffset(double * volt) {
96 USE(volt);
97 return (Success());
98 }
99
101 int DiodeBias(double volt) {
102 USE(volt);
103 return (Success());
104 }
105
107 double OffsetClk() {return (0.0);}
108
110 double OffsetDC() {return (0.0);}
111
113 int TelIntern(int sel = -1) {USE(sel); return (Success());}
114
116 int TelChan(int num, double *volt) {
117 if ((num < 0) || (num >= numDc))
118 {
119 sprintf(ErrMsg(), "bias channel number out of range");
120 return (ngcbMOD_ERR);
121 }
122 *volt = dc[num].volt;
123 dcTel[num] = *volt;
124 return (Success());
125 }
126
128 int TelDC(int num, double *volt) {
129 if ((num < 0) || (num >= numDc))
130 {
131 sprintf(ErrMsg(), "bias channel number out of range");
132 return (ngcbMOD_ERR);
133 }
134 *volt = dc[num].volt;
135 dcTel[num] = *volt;
136 return (Success());
137 }
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 Zero() {return (Success());}
171
173 int Calibrate(int noSetup = 0) {
174 USE(noSetup);
175 return (Success());
176 }
177
180
182 int Calibrated() {return (1);}
183
185 int SetupKey(const char *key, const int *idx, const char *value,
186 int *status = NULL);
187
189 int StatusKey(const char *key, const int *idx, char *value,
190 int *status = NULL);
191
192protected:
193
194private:
196 void Init_();
197
199 void AdjustV_(int num);
200
202 int AdjustR_(int num);
203
205 double G1_;
206
208 double G2_;
209
211 double G3_;
212
214 double G4_;
215
217 double G5_;
218
220 double dcSave_[ngcbCLDC_MAX_DC];
221};
222
223#endif
Definition ngcbIFC.hpp:754
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:67
virtual char * ErrMsg()
Error message.
Definition ngcbOBJ.cpp:65
void ClkMap(ngcdcs_clk_t *cv)
Clock channel mapping.
Definition ngcdcsAOBIAS.cpp:222
double Reg2Volt(int reg, int chan, double corr=1.0)
Convert register value to voltage.
Definition ngcdcsAOBIAS.cpp:687
int Zero()
Set all voltages to zero.
Definition ngcdcsAOBIAS.hpp:170
int DiodeBias(double volt)
Diode bias dummy function.
Definition ngcdcsAOBIAS.hpp:101
int VStatus(int *s)
Get voltage HW-status.
Definition ngcdcsAOBIAS.cpp:108
int Monitor(int num, int clkChan)
Clock-monitor dummy function.
Definition ngcdcsAOBIAS.hpp:71
int TelClk(int num, int l, double *volt)
Telemetry for clock level (dummy)
Definition ngcdcsAOBIAS.hpp:140
double OffsetDC()
Return offset for DC-biases.
Definition ngcdcsAOBIAS.hpp:110
int OffsetClk(double volt)
Clock offset dummy function.
Definition ngcdcsAOBIAS.hpp:77
int Calibrate(int noSetup=0)
Calibrate.
Definition ngcdcsAOBIAS.hpp:173
int VideoOffset(double *volt)
Video offset dummy function.
Definition ngcdcsAOBIAS.hpp:95
int Volt2Reg(double *volt, int chan, double corr=1.0)
Convert voltage to register value.
Definition ngcdcsAOBIAS.cpp:495
int PreampOffset(double volt)
Preamplifier offset dummy function.
Definition ngcdcsAOBIAS.hpp:89
ngcdcsAOBIAS(const ngcb_route_t &r, int nb)
Constructor with route and number of biases.
Definition ngcdcsAOBIAS.cpp:29
int TelDC(int num, double *volt)
Telemetry for DC-bias (dummy)
Definition ngcdcsAOBIAS.hpp:128
int OffsetDC(double volt)
Bias offset dummy function.
Definition ngcdcsAOBIAS.hpp:83
int Calibrated()
Check if calibration has been done.
Definition ngcdcsAOBIAS.hpp:182
void DcMap(ngcdcs_dc_t *dv)
Bias channel mapping.
Definition ngcdcsAOBIAS.cpp:187
virtual ~ngcdcsAOBIAS()
Destructor.
Definition ngcdcsAOBIAS.cpp:44
double OffsetClk()
Return offset for clocks.
Definition ngcdcsAOBIAS.hpp:107
int autoAdjust
Auto voltage register adjustment.
Definition ngcdcsAOBIAS.hpp:38
void DefaultSetup(const char *keyWord=NULL)
Default setup.
Definition ngcdcsAOBIAS.cpp:246
int DacReg(int value, int chan)
Map value on DAC register channel.
Definition ngcdcsAOBIAS.cpp:1022
int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (dummy, all levels)
Definition ngcdcsAOBIAS.hpp:152
int TelIntern(int sel=-1)
Update internal telemetry.
Definition ngcdcsAOBIAS.hpp:113
void ClearCalibration()
Clear calibration.
Definition ngcdcsAOBIAS.hpp:179
double hvGainUpperRail
Gain of high voltage clock upper rail.
Definition ngcdcsAOBIAS.hpp:41
double hvGainLowerRail
Gain of high voltage clock lower rail.
Definition ngcdcsAOBIAS.hpp:44
int Adjust(int chan)
Voltage setup adjustement for channel.
Definition ngcdcsAOBIAS.cpp:869
int TelChan(int num, double *volt)
Telemetry for channel.
Definition ngcdcsAOBIAS.hpp:116
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsAOBIAS.cpp:1097
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsAOBIAS.cpp:1056
int numDc
Number of bias voltages.
Definition ngcdcsCLDC.hpp:167
ngcdcs_clkv_t * clkTel
Saved clock voltages telemetry values.
Definition ngcdcsCLDC.hpp:170
double * dcTel
Saved bias voltages telemetry values.
Definition ngcdcsCLDC.hpp:173
int numClk
Number of clock voltages.
Definition ngcdcsCLDC.hpp:161
ngcdcs_dc_t * dc
Bias voltages.
Definition ngcdcsCLDC.hpp:164
ngcdcs_clk_t * clk
Clock voltages.
Definition ngcdcsCLDC.hpp:158
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