ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdcsCLDC.hpp
Go to the documentation of this file.
1
8#ifndef ngcdcsCLDC_H
9#define ngcdcsCLDC_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16#include <ngc/core/ngcbAddr.h>
17#include <ngc/core/ngcbMOD.hpp>
19
23#define ngcdcsCLDC_LBNL 0x00010000 //< CLDC with HV-circuit for LBNL CCD
24
28#define ngcdcsCLDC_ERR_PROTECTION 0x1
29
30
34#define ngcdcsCLDC_BUFSIZE (1024 * 128)
35
39#define ngcdcsCLDC_DCLK 2
40
44#define ngcdcsCLDC_CAL_MAX 0.2
45
49#define ngcdcsCLDC_VDIFF_MAX 1.0
50
54#define ngcdcsCLDC_MAX_CHAN ((ngcbCLDC_MAX_CLK * 2) + ngcbCLDC_MAX_DC)
55
59#define ngcdcsCLDC_MAX_TEL 80
60
65 double volt; //< Setup value (V)
66 double range[2]; //< Valid range (V)
67 double dacCorr; //< Correction factor (gain)
68 double telGain; //< Telemetry gain
69 double comp; //< Error compensation (V)
70 double margin; //< Telemetry check margin (V, absolute value)
71 int voltReg; //< Actual register value
72 int dacChan; //< DAC channel
73 int telChan; //< Telemetry channel
74 char name[64]; //< Name (string)
75 int connected; //< Connected flag
76 int directReg; //< Setup register value
77 int set; //< Flag indicating that voltage has been set
78 char unit[4]; //< Optional unit
79
82 volt = 0.0;
83 range[0] = -20.0;
84 range[1] = 20.0;
85 dacCorr = 1.0;
86 telGain = 1.0;
87 comp = 0.0;
88 margin = -1.0; // -> use global value
89 voltReg = 0x0;
90 memset(name, 0, sizeof(name));
91 name[0] = '\0';
92 dacChan = 0;
93 telChan = 0;
94 connected = 1;
95 directReg = 0;
96 set = 0;
97 unit[0] = '\0';
98 }
99};
100
105 ngcdcs_dc_t level[ngcdcsCLDC_DCLK]; //< Voltage structure
106 int connected; //< Connected flag
107
110};
111
116 double volt[ngcdcsCLDC_DCLK]; //< Voltage for each level (V)
117
120 int i;
121 for (i=0;i<ngcdcsCLDC_DCLK;i++) volt[i] = 0.0;
122 }
123};
124
128class ngcdcsCLDC0: public ngcbMOD
129{
130public:
132 int vstat;
133
136
139
141 int ilck;
142
145
148
151
154
156 double calMax;
157
160
162 int numClk;
163
166
168 int numDc;
169
172
174 double *dcTel;
175
178
180 double margin;
181
183 double dacTime;
184
186 char voltageInitFile[256];
187
189 char cfgFile[256];
190
193
196
198 double cvg1;
199
201 double cvg2;
202
204 double cvOffset;
205
207 char serNoBoard[32];
208
210 char serNoTrans[32];
211
213 ngcdcsCLDC0(const ngcb_route_t &r, int nc, int nb)
214 : ngcbMOD(r) {
215 numClk = nc;
216 numDc = nb;
217 Init_();
218 }
219
224 ngcdcsCLDC0(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb)
225 : ngcbMOD(ifc, r) {
226 numClk = nc; numDc = nb;
227 Init_();
228 }
229
231 virtual ~ngcdcsCLDC0() {
232 if (clk != NULL) delete[] clk;
233 if (clkTel != NULL) delete[] clkTel;
234 if (dc != NULL) delete[] dc;
235 if (dcTel != NULL) delete[] dcTel;
236 }
237
239 virtual int AtOnline() {
240 return (Success());
241 }
242
244 virtual int Selftest() {
245 Verbose("ngcdcsCLDC%d: selftest\n", Instance()+1);
246 return (Success());
247 }
248
250 virtual int VSetup(int autoCtrl = 0) {
251 USE (autoCtrl);
252 return (Success());
253 }
254
256 virtual int Check() {return (Success());}
257
259 virtual int OutputEnable() {
261 strcpy(statStr_, "enabled");
262 return (Success());
263 }
264
266 virtual int OutputDisable() {
268 strcpy(statStr_, "disabled");
269 return (Success());
270 }
271
273 virtual int OutputEnabled() {return (vstat == ngcbCLDC_STAT_ENABLED);}
274
276 virtual int Protection(int flag) {
277 protectionOn = flag;
278 return (Success());
279 }
280
282 virtual int Calibrate(int noSetup = 0) {
283 USE(noSetup);
284 calibrated_ = 1;
285 return (Success());
286 }
287
289 virtual void ClearCalibration() {calibrated_ = 0;}
290
292 virtual int Calibrated() {return (calibrated_);}
293
295 virtual int Zero() {
296 int i;
297 for (i=0;numClk;i++)
298 {
299 ngcdcs_clkv_t cv; // this is initialized with 0.0
300 if (VoltageClk(i, cv, 0) != Success())
301 {
302 return (ngcbMOD_ERR);
303 }
304 }
305 for (i=0;numDc;i++)
306 {
307 if (VoltageDC(i, 0.0, 0) != Success())
308 {
309 return (ngcbMOD_ERR);
310 }
311 }
312 telFlag = 1;
313 return (Success());
314 }
315
317 virtual int VoltageDC(int num, double volt, int rangeCheck = 1) {
318 USE(rangeCheck);
319 if ((num < 0) || (num >= numDc))
320 {
321 sprintf(ErrMsg(), "bias channel number out of range");
322 return (ngcbMOD_ERR);
323 }
324 dc[num].volt = volt;
325 return (Success());
326 }
327
329 virtual int VoltageClk(int num, int l, double volt, int rangeCheck = 1) {
330 USE(rangeCheck);
331 if ((num < 0) || (num >= numClk))
332 {
333 sprintf(ErrMsg(), "clock channel number out of range");
334 return (ngcbMOD_ERR);
335 }
336 clk[num].level[l].volt = volt;
337 return (Success());
338 }
339
341 virtual int VoltageClk(int num, ngcdcs_clkv_t cv, int rangeCheck = 1) {
342 int j;
343 for (j=0;j<ngcdcsCLDC_DCLK;j++)
344 {
345 if (VoltageClk(num, j, cv.volt[j], rangeCheck) != Success())
346 {
347 return (ngcbMOD_ERR);
348 }
349 }
350 return (Success());
351 }
352
354 virtual int VoltageRegDC(int num, int value, int rangeCheck = 1) {
355 USE(rangeCheck);
356 if ((num < 0) || (num >= numDc))
357 {
358 sprintf(ErrMsg(), "bias channel number out of range");
359 return (ngcbMOD_ERR);
360 }
361 dc[num].voltReg = value;
362 return (Success());
363 }
364
366 virtual int VoltageRegClk(int num, int l, int value, int rangeCheck = 1) {
367 USE(rangeCheck);
368 if ((num < 0) || (num >= numClk))
369 {
370 sprintf(ErrMsg(), "clock channel number out of range");
371 return (ngcbMOD_ERR);
372 }
373 clk[num].level[l].voltReg = value;
374 return (Success());
375 }
376
378 virtual int VoltageErrDC(int num, double volt) {
379 if ((num < 0) || (num >= numDc))
380 {
381 sprintf(ErrMsg(), "bias channel number out of range");
382 return (ngcbMOD_ERR);
383 }
384 dc[num].comp = volt;
385 return (Success());
386 }
387
389 virtual int VoltageErrClk(int num, int l, double volt) {
390 if ((num < 0) || (num >= numClk))
391 {
392 sprintf(ErrMsg(), "clock channel number out of range");
393 return (ngcbMOD_ERR);
394 }
395 clk[num].level[l].comp = volt;
396 return (Success());
397 }
398
400 virtual double TelCurrent(int chan) {
401 USE(chan);
402 return (0.0);
403 }
404
406 virtual int TelDC(int num, double *volt) {
407 if ((num < 0) || (num >= numDc))
408 {
409 sprintf(ErrMsg(), "bias channel number out of range");
410 return (ngcbMOD_ERR);
411 }
412 *volt = dc[num].volt;
413 return (Success());
414 }
415
417 virtual int TelClk(int num, int l, double *volt) {
418 if ((num < 0) || (num >= numClk))
419 {
420 sprintf(ErrMsg(), "clock channel number out of range");
421 return (ngcbMOD_ERR);
422 }
423 *volt = clk[num].level[l].volt;
424 return (Success());
425 }
426
428 virtual int TelClk(int num, ngcdcs_clkv_t *cv) {
429 int j;
430 for (j=0;j<ngcdcsCLDC_DCLK;j++)
431 {
432 double volt;
433 if (TelClk(num, j, &volt) != Success())
434 {
435 return (ngcbMOD_ERR);
436 }
437 else
438 {
439 cv->volt[j] = volt;
440 }
441 }
442 return (Success());
443 }
444
446 virtual int Snapshot() {return (Success());}
447
449 virtual char *VStatusString() {return statStr_;}
450
452 virtual int VStatus(int *s) {*s = 0x0; return (Success());}
453
455 virtual int LoadCfgFile(const char *fileName = NULL) {
456 if (fileName != NULL)
457 {
458 if (strlen(fileName) > 0)
459 {
460 strcpy(cfgFile, fileName);
462 toggle = (toggle + 1) % 2; // to trace update
463 }
464 else
465 {
466 cfgFile[0] = '\0';
467 toggle = (toggle + 1) % 2; // to trace update
468 }
469 }
470 return (Success());
471 }
472
474 virtual int SaveCfgFile(const char *fileName) {
475 USE(fileName);
476 return (Success());
477 }
478
480 virtual int SaveErrFile(const char *fileName) {
481 USE(fileName);
482 return (Success());
483 }
484
486 virtual int Restore(const char *keyword) {
487 USE(keyword);
488 return (Success());
489 }
490
492 virtual int SetupKey(const char *key, const int *idx, const char *value,
493 int *status = NULL);
494
496 virtual int StatusKey(const char *key, const int *idx, char *value,
497 int *status = NULL);
498
499protected:
500private:
502 char statStr_[32];
503
505 int calibrated_;
506
508 void Init_() {
509 int i;
511 memset(statStr_, 0, sizeof(statStr_));
512 strcpy(statStr_, "disabled");
513 autoEnable = 0;
514 autoDisable = 0;
515 ilck = 0; ilckOn = 0; protection = 0; protectionOn = 1;
516 autoCal = 0;
518 calibrated_ = 0;
519
520 clk = NULL;
521 clkTel = NULL;
522 dc = NULL;
523 dcTel = NULL;
525 dacTime = 10.0;
526 cvg1 = 1.0;
527 cvg2 = 1.0;
528 cvOffset = 0.0;
529 haveCurrentTel = 0;
530
531 serNoBoard[0] = '\0';
532 serNoTrans[0] = '\0';
533
534 if (numClk < 0) numClk = 0;
536 if (numDc < 0) numDc = 0;
538 if (numClk > 0)
539 {
542 if ((clk == NULL) || (clkTel == NULL))
543 {
544 numClk = 0;
545 }
546 else
547 {
548 /*
549 * Set default clock values
550 */
551 for (i=0;i<numClk;i++)
552 {
553 int j;
554 for (j=0;j<ngcdcsCLDC_DCLK;j++)
555 {
556 sprintf(clk[i].level[j].name, "CLOCK_%d_L%d", i + 1, j);
557 clkTel[i].volt[j] = 0.0;
558 }
559 }
560 }
561 }
562 if (numDc > 0)
563 {
564 dc = new ngcdcs_dc_t[ngcbCLDC_MAX_DC];
565 dcTel = new double[ngcbCLDC_MAX_DC];
566 if ((dc == NULL) || (dcTel == NULL))
567 {
568 numDc = 0;
569 }
570 else
571 {
572 /*
573 * Set default bias values
574 */
575 for (i=0;i<numDc;i++)
576 {
577 sprintf(dc[i].name, "DC-%d", i + 1);
578 dcTel[i] = 0.0;
579 }
580 }
581 }
582 memset(cfgFile, 0, sizeof(cfgFile));
583 voltageInitFile[0] = '\0';
584 cfgFile[0] = '\0';
585 toggle = 0;
586 telFlag = 1;
587 }
588
589};
590
595{
596public:
598 ngcdcsCLDC(const ngcb_route_t &r, int nc, int nb);
599
604 ngcdcsCLDC(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb);
605
607 virtual ~ngcdcsCLDC();
608
610 double offsetClk;
611
613 double offsetDC;
614
617
620
623
625 double diodeBias;
626
628 double lbnlGain;
629
632
635
638
640 double dacDelay;
641
644
647
650
653
655 void BoardType(int b);
656
658 virtual void ClkMap(ngcdcs_clk_t *cv);
659
661 virtual void DcMap(ngcdcs_dc_t *dv);
662
664 void Reset();
665
667 int Enable(int check = 1);
668
670 int Disable();
671
673 int Selftest();
674
676 void TimeStamp(int chan);
677
679 int VSetup(int autoCtrl = 0);
680
682 int Check();
683
685 int Calibrate(int noSetup = 0);
686
688 void ClearCalibration();
689
691 int Calibrated();
692
694 virtual int Adjust(int chan);
695
697 int DacChan(int chan, double volt);
698
700 int VoltageDC(int num, double volt, int rangeCheck = 1);
701
703 int VoltageClk(int num, int l, double volt, int rangeCheck = 1);
704
706 int VoltageClk(int num, ngcdcs_clkv_t cv, int rangeCheck = 1);
707
709 int VoltageRegDC(int num, int value, int rangeCheck = 1);
710
712 int VoltageRegClk(int num, int l, int value, int rangeCheck = 1);
713
715 int VoltageErrDC(int num, double volt);
716
718 int VoltageErrClk(int num, int l, double volt);
719
721 int TelChan(int chan);
722
724 int TelChan();
725
727 virtual int TelChan(int chan, double *volt);
728
730 int TelData(double *volt);
731
733 virtual int TelIntern(int sel = -1);
734
736 int TelDC(int num, double *volt);
737
739 int TelClk(int num, ngcdcs_clkv_t *cv);
740
742 int TelClk(int num, int l, double *volt);
743
745 int Snapshot();
746
748 char *VStatusString();
749
751 int VStatus(int *hwStat);
752
754 int OutputEnable();
755
757 int OutputDisable();
758
760 int OutputEnabled();
761
763 int Protection(int flag);
764
766 int Zero();
767
769 virtual int Monitor(int num, int clkChan);
770
772 virtual int OffsetClk(double volt);
773
775 virtual int OffsetDC(double volt);
776
778 virtual int PreampOffset(double volt);
779
781 virtual int VideoOffset(double *volt);
782
784 virtual int DiodeBias(double volt);
785
787 virtual double OffsetClk();
788
790 virtual double OffsetDC();
791
793 int LoadCfgFile(const char *fileName = NULL);
794
796 int SaveCfgFile(const char *fileName);
797
799 int SaveErrFile(const char *fileName);
800
802 int Restore(const char *keyWord);
803
805 virtual double ConvertTel(int value);
806
808 virtual int Volt2Reg(double *volt, int chan, double corr = 1.0);
809
811 virtual double Reg2Volt(int reg, int chan, double corr = 1.0);
812
814 virtual int DacReg(int value, int chan);
815
817 virtual void DefaultSetup(const char *keyWord = NULL);
818
820 int SetupKey(const char *key, const int *idx, const char *value,
821 int *status = NULL);
822
824 int StatusKey(const char *key, const int *idx, char *value,
825 int *status = NULL);
826
827protected:
829 int GetTelCfg(size_t start);
830
831private:
833 void Init_();
834
836 int DAC_(int value, int chan);
837
839 int havePreampDac_;
840
842 int ilck_;
843
845 int ctrlReg_;
846
848 void NewStatus_(int newStatus);
849
851 char statStr_[32];
852
854 ngcbALARM *alarm_;
855
857 int revision_;
858
860 ngcdcs_clkv_t *clkv_;
861
863 double *dcv_;
864
866 double offsetClk_;
867
869 int offsetRegClk_;
870
872 double offsetDC_;
873
875 int offsetRegDC_;
876
878 int fileBufferLen_;
879
881 char fileBuffer_[ngcdcsCLDC_BUFSIZE];
882
884 int telChan_;
885
887 double *errVec_;
888
890 double *dac_;
891
893 struct timeval *dacTime_;
894
896 int btype_;
897
899 int clkChan_;
900
902 int calibrated_;
903
905 double videoOffset_;
906
908 int LoadCfg_(const char *restoreKey, const char *tmpFile);
909
911 int VoltDiff_(double *volt, int chan1, int chan2, double corr = 1.0);
912
914 int AutoOffsetClk_(double *off, ngcdcs_clk_t *v);
915
917 int AutoOffsetDC_(double *off, ngcdcs_clk_t *vc, ngcdcs_dc_t *v);
918};
919
920#endif
Definition ngcbALARM.hpp:100
Definition ngcbIFC.hpp:760
ngcbMOD(const ngcbMOD &other)
Copy constructor.
Definition ngcbMOD.cpp:43
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:68
int Instance()
Get instance.
Definition ngcbOBJ.cpp:58
virtual void Verbose(int level, const char *format,...) __attribute__((format(printf
Verbose message if verbose level exceeds level.
Definition ngcbOBJ.cpp:74
virtual char * ErrMsg()
Error message.
Definition ngcbOBJ.cpp:66
virtual int Selftest()
Execute self-test.
Definition ngcdcsCLDC.hpp:244
virtual int VoltageClk(int num, ngcdcs_clkv_t cv, int rangeCheck=1)
Set all levels of clock.
Definition ngcdcsCLDC.hpp:341
virtual int Restore(const char *keyword)
Restore keyword from the last loaded file.
Definition ngcdcsCLDC.hpp:486
int telFlag
Flag to update telemetry.
Definition ngcdcsCLDC.hpp:195
virtual int Protection(int flag)
Enable/disable protection circuit.
Definition ngcdcsCLDC.hpp:276
virtual int VoltageClk(int num, int l, double volt, int rangeCheck=1)
Set clock level.
Definition ngcdcsCLDC.hpp:329
int vstat
Soft-status (enabled, disabled)
Definition ngcdcsCLDC.hpp:132
virtual int TelDC(int num, double *volt)
Telemetry for DC-bias.
Definition ngcdcsCLDC.hpp:406
char cfgFile[256]
Voltage configuration file.
Definition ngcdcsCLDC.hpp:189
ngcdcsCLDC0(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.hpp:213
virtual int Calibrated()
Check if calibration has been done.
Definition ngcdcsCLDC.hpp:292
virtual void ClearCalibration()
Clear calibration.
Definition ngcdcsCLDC.hpp:289
virtual int VoltageErrDC(int num, double volt)
Set DC voltage error.
Definition ngcdcsCLDC.hpp:378
virtual int LoadCfgFile(const char *fileName=NULL)
Load voltage configuration.
Definition ngcdcsCLDC.hpp:455
int ilck
Flag to enable/disable the external interlock.
Definition ngcdcsCLDC.hpp:141
int numDc
Number of bias voltages.
Definition ngcdcsCLDC.hpp:168
virtual ~ngcdcsCLDC0()
Destructor.
Definition ngcdcsCLDC.hpp:231
virtual int VoltageDC(int num, double volt, int rangeCheck=1)
Set DC voltage.
Definition ngcdcsCLDC.hpp:317
virtual int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (all levels)
Definition ngcdcsCLDC.hpp:428
ngcdcs_clkv_t * clkTel
Saved clock voltages telemetry values.
Definition ngcdcsCLDC.hpp:171
int toggle
Toggle new configuration.
Definition ngcdcsCLDC.hpp:192
int haveCurrentTel
Flag, indicating whether current-telemetry is available.
Definition ngcdcsCLDC.hpp:177
virtual int Zero()
Set all voltages to zero.
Definition ngcdcsCLDC.hpp:295
virtual int Check()
Check telemetry against current setup.
Definition ngcdcsCLDC.hpp:256
virtual int VoltageRegDC(int num, int value, int rangeCheck=1)
Set DC hex-voltage.
Definition ngcdcsCLDC.hpp:354
double cvg1
Voltage conversion formula gain-1.
Definition ngcdcsCLDC.hpp:198
double cvg2
Voltage conversion formula gain-2.
Definition ngcdcsCLDC.hpp:201
virtual int Snapshot()
Telemetry snapshot.
Definition ngcdcsCLDC.hpp:446
double cvOffset
Voltage conversion formula offset.
Definition ngcdcsCLDC.hpp:204
virtual double TelCurrent(int chan)
Return value of last current-telemetry.
Definition ngcdcsCLDC.hpp:400
int protection
Flag indicating whether protection has triggered.
Definition ngcdcsCLDC.hpp:147
virtual char * VStatusString()
Get voltage status string.
Definition ngcdcsCLDC.hpp:449
virtual int OutputEnable()
Enable output.
Definition ngcdcsCLDC.hpp:259
double * dcTel
Saved bias voltages telemetry values.
Definition ngcdcsCLDC.hpp:174
double calMax
Voltage calibration limit (in Volts)
Definition ngcdcsCLDC.hpp:156
virtual int SaveErrFile(const char *fileName)
Save error calibration.
Definition ngcdcsCLDC.hpp:480
virtual int VoltageRegClk(int num, int l, int value, int rangeCheck=1)
Set clock hex-level.
Definition ngcdcsCLDC.hpp:366
virtual int OutputDisable()
Disable output.
Definition ngcdcsCLDC.hpp:266
virtual int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsCldcSetup.cpp:26
virtual int VSetup(int autoCtrl=0)
Apply voltage setup.
Definition ngcdcsCLDC.hpp:250
virtual int OutputEnabled()
Check if output is enabled.
Definition ngcdcsCLDC.hpp:273
double dacTime
DAC settling time (in seconds)
Definition ngcdcsCLDC.hpp:183
virtual int VStatus(int *s)
Get voltage HW-status.
Definition ngcdcsCLDC.hpp:452
int ilckOn
Flag indicating whether interlock is enabled.
Definition ngcdcsCLDC.hpp:144
virtual int VoltageErrClk(int num, int l, double volt)
Set clock level voltage error.
Definition ngcdcsCLDC.hpp:389
int numClk
Number of clock voltages.
Definition ngcdcsCLDC.hpp:162
char serNoBoard[32]
Serial number.
Definition ngcdcsCLDC.hpp:207
virtual int TelClk(int num, int l, double *volt)
Telemetry for clock level.
Definition ngcdcsCLDC.hpp:417
virtual int Calibrate(int noSetup=0)
Calibrate (offset compensation)
Definition ngcdcsCLDC.hpp:282
int autoCal
Calibrate at online.
Definition ngcdcsCLDC.hpp:153
int protectionOn
Flag indicating whether protection is enabled.
Definition ngcdcsCLDC.hpp:150
ngcdcs_dc_t * dc
Bias voltages.
Definition ngcdcsCLDC.hpp:165
virtual int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsCldcStatus.cpp:26
char voltageInitFile[256]
Voltage initialization file.
Definition ngcdcsCLDC.hpp:186
ngcdcs_clk_t * clk
Clock voltages.
Definition ngcdcsCLDC.hpp:159
ngcdcsCLDC0(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb)
Definition ngcdcsCLDC.hpp:224
char serNoTrans[32]
Transition board serial number.
Definition ngcdcsCLDC.hpp:210
virtual int SaveCfgFile(const char *fileName)
Save voltage configuration.
Definition ngcdcsCLDC.hpp:474
virtual int AtOnline()
At online hook.
Definition ngcdcsCLDC.hpp:239
double margin
Margin for voltage check (in Volts)
Definition ngcdcsCLDC.hpp:180
int autoEnable
Enable at online.
Definition ngcdcsCLDC.hpp:135
int autoDisable
Disable when (re-)configuring.
Definition ngcdcsCLDC.hpp:138
double offsetClk
Offset for clock voltages.
Definition ngcdcsCLDC.hpp:610
int Selftest()
Execute self-test.
Definition ngcdcsCldcSelftest.cpp:27
int SaveCfgFile(const char *fileName)
Save voltage configuration.
Definition ngcdcsCldcCfg.cpp:1062
int Restore(const char *keyWord)
Restore keyword from the last loaded file.
Definition ngcdcsCldcCfg.cpp:153
int Snapshot()
Telemetry snapshot.
Definition ngcdcsCldcTel.cpp:283
double offsetDC
Offset for bias voltages.
Definition ngcdcsCLDC.hpp:613
virtual void ClkMap(ngcdcs_clk_t *cv)
Clock channel mapping.
Definition ngcdcsCLDC.cpp:573
void BoardType(int b)
Enforce specific board type.
Definition ngcdcsCLDC.cpp:468
virtual int DiodeBias(double volt)
Set diode bias.
Definition ngcdcsCldcOffset.cpp:217
virtual ~ngcdcsCLDC()
Destructor.
Definition ngcdcsCLDC.cpp:48
virtual int VideoOffset(double *volt)
Set video offset.
Definition ngcdcsCldcOffset.cpp:252
virtual void DefaultSetup(const char *keyWord=NULL)
Default setup.
Definition ngcdcsCldcCfg.cpp:27
int clkMon1
Clock on monitor 1.
Definition ngcdcsCLDC.hpp:616
int DacChan(int chan, double volt)
Set voltage on DAC channel.
Definition ngcdcsCLDC.cpp:1331
int SaveErrFile(const char *fileName)
Save error calibration.
Definition ngcdcsCldcCfg.cpp:1606
int LoadCfgFile(const char *fileName=NULL)
Load voltage configuration.
Definition ngcdcsCldcCfg.cpp:148
double preampOffset
Preamplifier offset.
Definition ngcdcsCLDC.hpp:622
int OutputEnabled()
Check if output is enabled.
Definition ngcdcsCLDC.cpp:1178
int VStatus(int *hwStat)
Get voltage HW-status.
Definition ngcdcsCLDC.cpp:254
int VoltageRegDC(int num, int value, int rangeCheck=1)
Set DC hex-voltage.
Definition ngcdcsCLDC.cpp:1637
int OutputDisable()
Disable output.
Definition ngcdcsCLDC.cpp:1270
ngcbMOD * vcm[ngcdcsCLDC_MAX_CHAN]
Voltage Callbacks.
Definition ngcdcsCLDC.hpp:646
virtual int TelIntern(int sel=-1)
Update internal telemetry.
Definition ngcdcsCldcTel.cpp:134
int VoltageErrDC(int num, double volt)
Set DC voltage error.
Definition ngcdcsCldcCalib.cpp:200
double lbnlOffset
LBNL high voltage offset.
Definition ngcdcsCLDC.hpp:631
int Calibrated()
Check if calibration has been done.
Definition ngcdcsCldcCalib.cpp:195
int OutputEnable()
Enable output.
Definition ngcdcsCLDC.cpp:1183
double lbnlGain
LBNL high voltage gain.
Definition ngcdcsCLDC.hpp:628
int TelData(double *volt)
Read telemetry data.
Definition ngcdcsCldcTel.cpp:83
int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (all levels)
Definition ngcdcsCldcTel.cpp:263
virtual double OffsetClk()
Return Offset for clocks.
Definition ngcdcsCldcOffset.cpp:26
virtual int Monitor(int num, int clkChan)
Set channel for clock-monitor.
Definition ngcdcsCldcMon.cpp:26
virtual double OffsetDC()
Return Offset for DC-biases.
Definition ngcdcsCldcOffset.cpp:31
void Reset()
Align soft-states after reset.
Definition ngcdcsCLDC.cpp:476
double lbnlTelOffset
LBNL high voltage offset (telemetry)
Definition ngcdcsCLDC.hpp:637
int VoltageErrClk(int num, int l, double volt)
Set clock level voltage error.
Definition ngcdcsCldcCalib.cpp:230
int Check()
Check telemetry against current setup.
Definition ngcdcsCLDC.cpp:866
int dcSetupMap[ngcbCLDC_MAX_DC]
Map specifying the setup order of the biases.
Definition ngcdcsCLDC.hpp:652
int TelChan()
Return actual telemetry channel.
Definition ngcdcsCldcTel.cpp:81
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsCldcSetup.cpp:585
int VoltageDC(int num, double volt, int rangeCheck=1)
Set DC voltage.
Definition ngcdcsCLDC.cpp:1450
int Protection(int flag)
Enable/disable protection circuit.
Definition ngcdcsCLDC.cpp:1302
int clkMon2
Clock on monitor 2.
Definition ngcdcsCLDC.hpp:619
int Disable()
Call-back at transition to not operational state.
Definition ngcdcsCLDC.cpp:834
virtual double Reg2Volt(int reg, int chan, double corr=1.0)
Convert register value to voltage.
Definition ngcdcsCLDC.cpp:1920
double dacDelay
DAC delay (seconds)
Definition ngcdcsCLDC.hpp:640
int VoltageClk(int num, int l, double volt, int rangeCheck=1)
Set clock level.
Definition ngcdcsCLDC.cpp:1532
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsCldcStatus.cpp:451
int Enable(int check=1)
Call-back at transition to operational state.
Definition ngcdcsCLDC.cpp:608
int VoltageRegClk(int num, int l, int value, int rangeCheck=1)
Set clock hex-level.
Definition ngcdcsCLDC.cpp:1718
ngcdcs_tel_t tel[ngcdcsCLDC_MAX_TEL]
Internal telemetry.
Definition ngcdcsCLDC.hpp:643
virtual void DcMap(ngcdcs_dc_t *dv)
Bias channel mapping.
Definition ngcdcsCLDC.cpp:541
int Zero()
Set all voltages to zero.
Definition ngcdcsCLDC.cpp:1807
int Calibrate(int noSetup=0)
Calibrate (offset compensation)
Definition ngcdcsCldcCalib.cpp:26
void ClearCalibration()
Clear calibration.
Definition ngcdcsCldcCalib.cpp:176
char * VStatusString()
Get voltage status string.
Definition ngcdcsCLDC.cpp:249
int clkSetupMap[ngcbCLDC_MAX_CLK]
Map specifying the setup order of the clocks.
Definition ngcdcsCLDC.hpp:649
virtual int Volt2Reg(double *volt, int chan, double corr=1.0)
Convert voltage to register value.
Definition ngcdcsCLDC.cpp:1863
int TelDC(int num, double *volt)
Telemetry for DC-bias.
Definition ngcdcsCldcTel.cpp:155
double diodeBias
DiodeBias.
Definition ngcdcsCLDC.hpp:625
virtual int Adjust(int chan)
Voltage setup adjustement for channel.
Definition ngcdcsCLDC.cpp:1325
int GetTelCfg(size_t start)
Get internal telemetry configurarion (NGCII only)
Definition ngcdcsCldcTel.cpp:312
virtual int DacReg(int value, int chan)
Map value on DAC register channel.
Definition ngcdcsCLDC.cpp:1953
void TimeStamp(int chan)
Timstamp DAC channel (last setup)
Definition ngcdcsCLDC.cpp:860
virtual double ConvertTel(int value)
Convert telemetry register value.
Definition ngcdcsCldcTel.cpp:26
ngcdcsCLDC(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.cpp:29
virtual int PreampOffset(double volt)
Set preamplifier offset.
Definition ngcdcsCldcOffset.cpp:182
double lbnlTelGain
LBNL high voltage gain (telemetry)
Definition ngcdcsCLDC.hpp:634
int VSetup(int autoCtrl=0)
Apply voltage setup.
Definition ngcdcsCLDC.cpp:1002
#define ngcbCLDC_MAX_DC
Definition ngcbAddr.h:334
#define ngcbCLDC_STAT_ENABLED
Definition ngcbAddr.h:328
#define ngcbCLDC_MAX_CLK
Definition ngcbAddr.h:333
#define ngcbCLDC_STAT_DISABLED
Definition ngcbAddr.h:327
#define ngcbMOD_ERR
Definition ngcbOBJ.hpp:23
void ngcbCleanPath(char *name)
Definition ngcbFile.c:597
#define USE(x)
Definition ngcb.h:29
#define ngcdcsCLDC_CAL_MAX
Definition ngcdcsCLDC.hpp:44
#define ngcdcsCLDC_DCLK
Definition ngcdcsCLDC.hpp:39
#define ngcdcsCLDC_MAX_CHAN
Definition ngcdcsCLDC.hpp:54
#define ngcdcsCLDC_BUFSIZE
Definition ngcdcsCLDC.hpp:34
#define ngcdcsCLDC_VDIFF_MAX
Definition ngcdcsCLDC.hpp:49
#define ngcdcsCLDC_MAX_TEL
Definition ngcdcsCLDC.hpp:59
Definition ngcbIFC.hpp:78
Definition ngcdcsCLDC.hpp:104
int connected
Definition ngcdcsCLDC.hpp:106
ngcdcs_clk_t()
Constructor.
Definition ngcdcsCLDC.hpp:109
ngcdcs_dc_t level[ngcdcsCLDC_DCLK]
Definition ngcdcsCLDC.hpp:105
Definition ngcdcsCLDC.hpp:115
ngcdcs_clkv_t()
Constructor.
Definition ngcdcsCLDC.hpp:119
double volt[ngcdcsCLDC_DCLK]
Definition ngcdcsCLDC.hpp:116
Definition ngcdcsCLDC.hpp:64
char name[64]
Definition ngcdcsCLDC.hpp:74
double volt
Definition ngcdcsCLDC.hpp:65
int voltReg
Definition ngcdcsCLDC.hpp:71
int telChan
Definition ngcdcsCLDC.hpp:73
double telGain
Definition ngcdcsCLDC.hpp:68
double comp
Definition ngcdcsCLDC.hpp:69
double margin
Definition ngcdcsCLDC.hpp:70
char unit[4]
Definition ngcdcsCLDC.hpp:78
int connected
Definition ngcdcsCLDC.hpp:75
ngcdcs_dc_t()
Constructor.
Definition ngcdcsCLDC.hpp:81
double dacCorr
Definition ngcdcsCLDC.hpp:67
int dacChan
Definition ngcdcsCLDC.hpp:72
int directReg
Definition ngcdcsCLDC.hpp:76
double range[2]
Definition ngcdcsCLDC.hpp:66
int set
Definition ngcdcsCLDC.hpp:77
Definition ngcdcsTypes.hpp:45