ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsCLDC.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsCLDC_H
8#define ngcdcsCLDC_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcbAddr.h>
16#include <ngc/core/ngcbMOD.hpp>
18
22#define ngcdcsCLDC_LBNL 0x00010000 //< CLDC with HV-circuit for LBNL CCD
23
27#define ngcdcsCLDC_ERR_PROTECTION 0x1
28
29
33#define ngcdcsCLDC_BUFSIZE (1024 * 128)
34
38#define ngcdcsCLDC_DCLK 2
39
43#define ngcdcsCLDC_CAL_MAX 0.2
44
48#define ngcdcsCLDC_VDIFF_MAX 1.0
49
53#define ngcdcsCLDC_MAX_CHAN ((ngcbCLDC_MAX_CLK * 2) + ngcbCLDC_MAX_DC)
54
58#define ngcdcsCLDC_MAX_TEL 80
59
64 double volt; //< Setup value (V)
65 double range[2]; //< Valid range (V)
66 double dacCorr; //< Correction factor (gain)
67 double telGain; //< Telemetry gain
68 double comp; //< Error compensation (V)
69 double margin; //< Telemetry check margin (V, absolute value)
70 int voltReg; //< Actual register value
71 int dacChan; //< DAC channel
72 int telChan; //< Telemetry channel
73 char name[64]; //< Name (string)
74 int connected; //< Connected flag
75 int directReg; //< Setup register value
76 int set; //< Flag indicating that voltage has been set
77 char unit[4]; //< Optional unit
78
81 volt = 0.0;
82 range[0] = -20.0;
83 range[1] = 20.0;
84 dacCorr = 1.0;
85 telGain = 1.0;
86 comp = 0.0;
87 margin = -1.0; // -> use global value
88 voltReg = 0x0;
89 memset(name, 0, sizeof(name));
90 name[0] = '\0';
91 dacChan = 0;
92 telChan = 0;
93 connected = 1;
94 directReg = 0;
95 set = 0;
96 unit[0] = '\0';
97 }
98};
99
104 ngcdcs_dc_t level[ngcdcsCLDC_DCLK]; //< Voltage structure
105 int connected; //< Connected flag
106
109};
110
115 double volt[ngcdcsCLDC_DCLK]; //< Voltage for each level (V)
116
119 int i;
120 for (i=0;i<ngcdcsCLDC_DCLK;i++) volt[i] = 0.0;
121 }
122};
123
127class ngcdcsCLDC0: public ngcbMOD
128{
129public:
131 int vstat;
132
135
138
140 int ilck;
141
144
147
150
153
155 double calMax;
156
159
161 int numClk;
162
165
167 int numDc;
168
171
173 double *dcTel;
174
177
179 double margin;
180
182 double dacTime;
183
185 char voltageInitFile[256];
186
188 char cfgFile[256];
189
192
195
197 double cvg1;
198
200 double cvg2;
201
203 double cvOffset;
204
206 char serNoBoard[32];
207
209 char serNoTrans[32];
210
212 ngcdcsCLDC0(const ngcb_route_t &r, int nc, int nb)
213 : ngcbMOD(r) {
214 numClk = nc;
215 numDc = nb;
216 Init_();
217 }
218
223 ngcdcsCLDC0(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb)
224 : ngcbMOD(ifc, r) {
225 numClk = nc; numDc = nb;
226 Init_();
227 }
228
230 virtual ~ngcdcsCLDC0() {
231 if (clk != NULL) delete[] clk;
232 if (clkTel != NULL) delete[] clkTel;
233 if (dc != NULL) delete[] dc;
234 if (dcTel != NULL) delete[] dcTel;
235 }
236
238 virtual int AtOnline() {
239 return (Success());
240 }
241
243 virtual int Selftest() {
244 Verbose("ngcdcsCLDC%d: selftest\n", Instance()+1);
245 return (Success());
246 }
247
249 virtual int VSetup(int autoCtrl = 0) {
250 USE (autoCtrl);
251 return (Success());
252 }
253
255 virtual int Check() {return (Success());}
256
258 virtual int OutputEnable() {
260 strcpy(statStr_, "enabled");
261 return (Success());
262 }
263
265 virtual int OutputDisable() {
267 strcpy(statStr_, "disabled");
268 return (Success());
269 }
270
272 virtual int OutputEnabled() {return (vstat == ngcbCLDC_STAT_ENABLED);}
273
275 virtual int Protection(int flag) {
276 protectionOn = flag;
277 return (Success());
278 }
279
281 virtual int Calibrate(int noSetup = 0) {
282 USE(noSetup);
283 calibrated_ = 1;
284 return (Success());
285 }
286
288 virtual void ClearCalibration() {calibrated_ = 0;}
289
291 virtual int Calibrated() {return (calibrated_);}
292
294 virtual int Zero() {
295 int i;
296 for (i=0;numClk;i++)
297 {
298 ngcdcs_clkv_t cv; // this is initialized with 0.0
299 if (VoltageClk(i, cv, 0) != Success())
300 {
301 return (ngcbMOD_ERR);
302 }
303 }
304 for (i=0;numDc;i++)
305 {
306 if (VoltageDC(i, 0.0, 0) != Success())
307 {
308 return (ngcbMOD_ERR);
309 }
310 }
311 telFlag = 1;
312 return (Success());
313 }
314
316 virtual int VoltageDC(int num, double volt, int rangeCheck = 1) {
317 USE(rangeCheck);
318 if ((num < 0) || (num >= numDc))
319 {
320 sprintf(ErrMsg(), "bias channel number out of range");
321 return (ngcbMOD_ERR);
322 }
323 dc[num].volt = volt;
324 return (Success());
325 }
326
328 virtual int VoltageClk(int num, int l, double volt, int rangeCheck = 1) {
329 USE(rangeCheck);
330 if ((num < 0) || (num >= numClk))
331 {
332 sprintf(ErrMsg(), "clock channel number out of range");
333 return (ngcbMOD_ERR);
334 }
335 clk[num].level[l].volt = volt;
336 return (Success());
337 }
338
340 virtual int VoltageClk(int num, ngcdcs_clkv_t cv, int rangeCheck = 1) {
341 int j;
342 for (j=0;j<ngcdcsCLDC_DCLK;j++)
343 {
344 if (VoltageClk(num, j, cv.volt[j], rangeCheck) != Success())
345 {
346 return (ngcbMOD_ERR);
347 }
348 }
349 return (Success());
350 }
351
353 virtual int VoltageRegDC(int num, int value, int rangeCheck = 1) {
354 USE(rangeCheck);
355 if ((num < 0) || (num >= numDc))
356 {
357 sprintf(ErrMsg(), "bias channel number out of range");
358 return (ngcbMOD_ERR);
359 }
360 dc[num].voltReg = value;
361 return (Success());
362 }
363
365 virtual int VoltageRegClk(int num, int l, int value, int rangeCheck = 1) {
366 USE(rangeCheck);
367 if ((num < 0) || (num >= numClk))
368 {
369 sprintf(ErrMsg(), "clock channel number out of range");
370 return (ngcbMOD_ERR);
371 }
372 clk[num].level[l].voltReg = value;
373 return (Success());
374 }
375
377 virtual int VoltageErrDC(int num, double volt) {
378 if ((num < 0) || (num >= numDc))
379 {
380 sprintf(ErrMsg(), "bias channel number out of range");
381 return (ngcbMOD_ERR);
382 }
383 dc[num].comp = volt;
384 return (Success());
385 }
386
388 virtual int VoltageErrClk(int num, int l, double volt) {
389 if ((num < 0) || (num >= numClk))
390 {
391 sprintf(ErrMsg(), "clock channel number out of range");
392 return (ngcbMOD_ERR);
393 }
394 clk[num].level[l].comp = volt;
395 return (Success());
396 }
397
399 virtual double TelCurrent(int chan) {
400 USE(chan);
401 return (0.0);
402 }
403
405 virtual int TelDC(int num, double *volt) {
406 if ((num < 0) || (num >= numDc))
407 {
408 sprintf(ErrMsg(), "bias channel number out of range");
409 return (ngcbMOD_ERR);
410 }
411 *volt = dc[num].volt;
412 return (Success());
413 }
414
416 virtual int TelClk(int num, int l, double *volt) {
417 if ((num < 0) || (num >= numClk))
418 {
419 sprintf(ErrMsg(), "clock channel number out of range");
420 return (ngcbMOD_ERR);
421 }
422 *volt = clk[num].level[l].volt;
423 return (Success());
424 }
425
427 virtual int TelClk(int num, ngcdcs_clkv_t *cv) {
428 int j;
429 for (j=0;j<ngcdcsCLDC_DCLK;j++)
430 {
431 double volt;
432 if (TelClk(num, j, &volt) != Success())
433 {
434 return (ngcbMOD_ERR);
435 }
436 else
437 {
438 cv->volt[j] = volt;
439 }
440 }
441 return (Success());
442 }
443
445 virtual int Snapshot() {return (Success());}
446
448 virtual char *VStatusString() {return statStr_;}
449
451 virtual int VStatus(int *s) {*s = 0x0; return (Success());}
452
454 virtual int LoadCfgFile(const char *fileName = NULL) {
455 if (fileName != NULL)
456 {
457 if (strlen(fileName) > 0)
458 {
459 strcpy(cfgFile, fileName);
461 toggle = (toggle + 1) % 2; // to trace update
462 }
463 else
464 {
465 cfgFile[0] = '\0';
466 toggle = (toggle + 1) % 2; // to trace update
467 }
468 }
469 return (Success());
470 }
471
473 virtual int SaveCfgFile(const char *fileName) {
474 USE(fileName);
475 return (Success());
476 }
477
479 virtual int SaveErrFile(const char *fileName) {
480 USE(fileName);
481 return (Success());
482 }
483
485 virtual int Restore(const char *keyword) {
486 USE(keyword);
487 return (Success());
488 }
489
491 virtual int SetupKey(const char *key, const int *idx, const char *value,
492 int *status = NULL);
493
495 virtual int StatusKey(const char *key, const int *idx, char *value,
496 int *status = NULL);
497
498protected:
499private:
501 char statStr_[32];
502
504 int calibrated_;
505
507 void Init_() {
508 int i;
510 memset(statStr_, 0, sizeof(statStr_));
511 strcpy(statStr_, "disabled");
512 autoEnable = 0;
513 autoDisable = 0;
514 ilck = 0; ilckOn = 0; protection = 0; protectionOn = 1;
515 autoCal = 0;
517 calibrated_ = 0;
518
519 clk = NULL;
520 clkTel = NULL;
521 dc = NULL;
522 dcTel = NULL;
524 dacTime = 10.0;
525 cvg1 = 1.0;
526 cvg2 = 1.0;
527 cvOffset = 0.0;
528 haveCurrentTel = 0;
529
530 serNoBoard[0] = '\0';
531 serNoTrans[0] = '\0';
532
533 if (numClk < 0) numClk = 0;
535 if (numDc < 0) numDc = 0;
537 if (numClk > 0)
538 {
541 if ((clk == NULL) || (clkTel == NULL))
542 {
543 numClk = 0;
544 }
545 else
546 {
547 /*
548 * Set default clock values
549 */
550 for (i=0;i<numClk;i++)
551 {
552 int j;
553 for (j=0;j<ngcdcsCLDC_DCLK;j++)
554 {
555 sprintf(clk[i].level[j].name, "CLOCK_%d_L%d", i + 1, j);
556 clkTel[i].volt[j] = 0.0;
557 }
558 }
559 }
560 }
561 if (numDc > 0)
562 {
563 dc = new ngcdcs_dc_t[ngcbCLDC_MAX_DC];
564 dcTel = new double[ngcbCLDC_MAX_DC];
565 if ((dc == NULL) || (dcTel == NULL))
566 {
567 numDc = 0;
568 }
569 else
570 {
571 /*
572 * Set default bias values
573 */
574 for (i=0;i<numDc;i++)
575 {
576 sprintf(dc[i].name, "DC-%d", i + 1);
577 dcTel[i] = 0.0;
578 }
579 }
580 }
581 memset(cfgFile, 0, sizeof(cfgFile));
582 voltageInitFile[0] = '\0';
583 cfgFile[0] = '\0';
584 toggle = 0;
585 telFlag = 1;
586 }
587
588};
589
594{
595public:
597 ngcdcsCLDC(const ngcb_route_t &r, int nc, int nb);
598
603 ngcdcsCLDC(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb);
604
606 virtual ~ngcdcsCLDC();
607
609 double offsetClk;
610
612 double offsetDC;
613
616
619
622
624 double diodeBias;
625
627 double lbnlGain;
628
631
634
637
639 double dacDelay;
640
643
646
649
652
654 void BoardType(int b);
655
657 virtual void ClkMap(ngcdcs_clk_t *cv);
658
660 virtual void DcMap(ngcdcs_dc_t *dv);
661
663 void Reset();
664
666 int Enable(int check = 1);
667
669 int Disable();
670
672 int Selftest();
673
675 void TimeStamp(int chan);
676
678 int VSetup(int autoCtrl = 0);
679
681 int Check();
682
684 int Calibrate(int noSetup = 0);
685
687 void ClearCalibration();
688
690 int Calibrated();
691
693 virtual int Adjust(int chan);
694
696 int DacChan(int chan, double volt);
697
699 int VoltageDC(int num, double volt, int rangeCheck = 1);
700
702 int VoltageClk(int num, int l, double volt, int rangeCheck = 1);
703
705 int VoltageClk(int num, ngcdcs_clkv_t cv, int rangeCheck = 1);
706
708 int VoltageRegDC(int num, int value, int rangeCheck = 1);
709
711 int VoltageRegClk(int num, int l, int value, int rangeCheck = 1);
712
714 int VoltageErrDC(int num, double volt);
715
717 int VoltageErrClk(int num, int l, double volt);
718
720 int TelChan(int chan);
721
723 int TelChan();
724
726 virtual int TelChan(int chan, double *volt);
727
729 int TelData(double *volt);
730
732 virtual int TelIntern(int sel = -1);
733
735 int TelDC(int num, double *volt);
736
738 int TelClk(int num, ngcdcs_clkv_t *cv);
739
741 int TelClk(int num, int l, double *volt);
742
744 int Snapshot();
745
747 char *VStatusString();
748
750 int VStatus(int *hwStat);
751
753 int OutputEnable();
754
756 int OutputDisable();
757
759 int OutputEnabled();
760
762 int Protection(int flag);
763
765 int Zero();
766
768 virtual int Monitor(int num, int clkChan);
769
771 virtual int OffsetClk(double volt);
772
774 virtual int OffsetDC(double volt);
775
777 virtual int PreampOffset(double volt);
778
780 virtual int VideoOffset(double *volt);
781
783 virtual int DiodeBias(double volt);
784
786 virtual double OffsetClk();
787
789 virtual double OffsetDC();
790
792 int LoadCfgFile(const char *fileName = NULL);
793
795 int SaveCfgFile(const char *fileName);
796
798 int SaveErrFile(const char *fileName);
799
801 int Restore(const char *keyWord);
802
804 virtual double ConvertTel(int value);
805
807 virtual int Volt2Reg(double *volt, int chan, double corr = 1.0);
808
810 virtual double Reg2Volt(int reg, int chan, double corr = 1.0);
811
813 virtual int DacReg(int value, int chan);
814
816 virtual void DefaultSetup(const char *keyWord = NULL);
817
819 int SetupKey(const char *key, const int *idx, const char *value,
820 int *status = NULL);
821
823 int StatusKey(const char *key, const int *idx, char *value,
824 int *status = NULL);
825
826protected:
828 int GetTelCfg(size_t start);
829
830private:
832 void Init_();
833
835 int DAC_(int value, int chan);
836
838 int havePreampDac_;
839
841 int ilck_;
842
844 int ctrlReg_;
845
847 void NewStatus_(int newStatus);
848
850 char statStr_[32];
851
853 ngcbALARM *alarm_;
854
856 int revision_;
857
859 ngcdcs_clkv_t *clkv_;
860
862 double *dcv_;
863
865 double offsetClk_;
866
868 int offsetRegClk_;
869
871 double offsetDC_;
872
874 int offsetRegDC_;
875
877 int fileBufferLen_;
878
880 char fileBuffer_[ngcdcsCLDC_BUFSIZE];
881
883 int telChan_;
884
886 double *errVec_;
887
889 double *dac_;
890
892 struct timeval *dacTime_;
893
895 int btype_;
896
898 int clkChan_;
899
901 int calibrated_;
902
904 double videoOffset_;
905
907 int LoadCfg_(const char *restoreKey, const char *tmpFile);
908
910 int VoltDiff_(double *volt, int chan1, int chan2, double corr = 1.0);
911
913 int AutoOffsetClk_(double *off, ngcdcs_clk_t *v);
914
916 int AutoOffsetDC_(double *off, ngcdcs_clk_t *vc, ngcdcs_dc_t *v);
917};
918
919#endif
Definition ngcbALARM.hpp:99
Definition ngcbIFC.hpp:754
ngcbMOD(const ngcbMOD &other)
Copy constructor.
Definition ngcbMOD.cpp:43
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:67
int Instance()
Get instance.
Definition ngcbOBJ.cpp:57
virtual void Verbose(int level, const char *format,...) __attribute__((format(printf
Verbose message if verbose level exceeds level.
Definition ngcbOBJ.cpp:73
virtual char * ErrMsg()
Error message.
Definition ngcbOBJ.cpp:65
virtual int Selftest()
Execute self-test.
Definition ngcdcsCLDC.hpp:243
virtual int VoltageClk(int num, ngcdcs_clkv_t cv, int rangeCheck=1)
Set all levels of clock.
Definition ngcdcsCLDC.hpp:340
virtual int Restore(const char *keyword)
Restore keyword from the last loaded file.
Definition ngcdcsCLDC.hpp:485
int telFlag
Flag to update telemetry.
Definition ngcdcsCLDC.hpp:194
virtual int Protection(int flag)
Enable/disable protection circuit.
Definition ngcdcsCLDC.hpp:275
virtual int VoltageClk(int num, int l, double volt, int rangeCheck=1)
Set clock level.
Definition ngcdcsCLDC.hpp:328
int vstat
Soft-status (enabled, disabled)
Definition ngcdcsCLDC.hpp:131
virtual int TelDC(int num, double *volt)
Telemetry for DC-bias.
Definition ngcdcsCLDC.hpp:405
char cfgFile[256]
Voltage configuration file.
Definition ngcdcsCLDC.hpp:188
ngcdcsCLDC0(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.hpp:212
virtual int Calibrated()
Check if calibration has been done.
Definition ngcdcsCLDC.hpp:291
virtual void ClearCalibration()
Clear calibration.
Definition ngcdcsCLDC.hpp:288
virtual int VoltageErrDC(int num, double volt)
Set DC voltage error.
Definition ngcdcsCLDC.hpp:377
virtual int LoadCfgFile(const char *fileName=NULL)
Load voltage configuration.
Definition ngcdcsCLDC.hpp:454
int ilck
Flag to enable/disable the external interlock.
Definition ngcdcsCLDC.hpp:140
int numDc
Number of bias voltages.
Definition ngcdcsCLDC.hpp:167
virtual ~ngcdcsCLDC0()
Destructor.
Definition ngcdcsCLDC.hpp:230
virtual int VoltageDC(int num, double volt, int rangeCheck=1)
Set DC voltage.
Definition ngcdcsCLDC.hpp:316
virtual int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (all levels)
Definition ngcdcsCLDC.hpp:427
ngcdcs_clkv_t * clkTel
Saved clock voltages telemetry values.
Definition ngcdcsCLDC.hpp:170
int toggle
Toggle new configuration.
Definition ngcdcsCLDC.hpp:191
int haveCurrentTel
Flag, indicating whether current-telemetry is available.
Definition ngcdcsCLDC.hpp:176
virtual int Zero()
Set all voltages to zero.
Definition ngcdcsCLDC.hpp:294
virtual int Check()
Check telemetry against current setup.
Definition ngcdcsCLDC.hpp:255
virtual int VoltageRegDC(int num, int value, int rangeCheck=1)
Set DC hex-voltage.
Definition ngcdcsCLDC.hpp:353
double cvg1
Voltage conversion formula gain-1.
Definition ngcdcsCLDC.hpp:197
double cvg2
Voltage conversion formula gain-2.
Definition ngcdcsCLDC.hpp:200
virtual int Snapshot()
Telemetry snapshot.
Definition ngcdcsCLDC.hpp:445
double cvOffset
Voltage conversion formula offset.
Definition ngcdcsCLDC.hpp:203
virtual double TelCurrent(int chan)
Return value of last current-telemetry.
Definition ngcdcsCLDC.hpp:399
int protection
Flag indicating whether protection has triggered.
Definition ngcdcsCLDC.hpp:146
virtual char * VStatusString()
Get voltage status string.
Definition ngcdcsCLDC.hpp:448
virtual int OutputEnable()
Enable output.
Definition ngcdcsCLDC.hpp:258
double * dcTel
Saved bias voltages telemetry values.
Definition ngcdcsCLDC.hpp:173
double calMax
Voltage calibration limit (in Volts)
Definition ngcdcsCLDC.hpp:155
virtual int SaveErrFile(const char *fileName)
Save error calibration.
Definition ngcdcsCLDC.hpp:479
virtual int VoltageRegClk(int num, int l, int value, int rangeCheck=1)
Set clock hex-level.
Definition ngcdcsCLDC.hpp:365
virtual int OutputDisable()
Disable output.
Definition ngcdcsCLDC.hpp:265
virtual int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsCldcSetup.cpp:25
virtual int VSetup(int autoCtrl=0)
Apply voltage setup.
Definition ngcdcsCLDC.hpp:249
virtual int OutputEnabled()
Check if output is enabled.
Definition ngcdcsCLDC.hpp:272
double dacTime
DAC settling time (in seconds)
Definition ngcdcsCLDC.hpp:182
virtual int VStatus(int *s)
Get voltage HW-status.
Definition ngcdcsCLDC.hpp:451
int ilckOn
Flag indicating whether interlock is enabled.
Definition ngcdcsCLDC.hpp:143
virtual int VoltageErrClk(int num, int l, double volt)
Set clock level voltage error.
Definition ngcdcsCLDC.hpp:388
int numClk
Number of clock voltages.
Definition ngcdcsCLDC.hpp:161
char serNoBoard[32]
Serial number.
Definition ngcdcsCLDC.hpp:206
virtual int TelClk(int num, int l, double *volt)
Telemetry for clock level.
Definition ngcdcsCLDC.hpp:416
virtual int Calibrate(int noSetup=0)
Calibrate (offset compensation)
Definition ngcdcsCLDC.hpp:281
int autoCal
Calibrate at online.
Definition ngcdcsCLDC.hpp:152
int protectionOn
Flag indicating whether protection is enabled.
Definition ngcdcsCLDC.hpp:149
ngcdcs_dc_t * dc
Bias voltages.
Definition ngcdcsCLDC.hpp:164
virtual int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsCldcStatus.cpp:25
char voltageInitFile[256]
Voltage initialization file.
Definition ngcdcsCLDC.hpp:185
ngcdcs_clk_t * clk
Clock voltages.
Definition ngcdcsCLDC.hpp:158
ngcdcsCLDC0(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb)
Definition ngcdcsCLDC.hpp:223
char serNoTrans[32]
Transition board serial number.
Definition ngcdcsCLDC.hpp:209
virtual int SaveCfgFile(const char *fileName)
Save voltage configuration.
Definition ngcdcsCLDC.hpp:473
virtual int AtOnline()
At online hook.
Definition ngcdcsCLDC.hpp:238
double margin
Margin for voltage check (in Volts)
Definition ngcdcsCLDC.hpp:179
int autoEnable
Enable at online.
Definition ngcdcsCLDC.hpp:134
int autoDisable
Disable when (re-)configuring.
Definition ngcdcsCLDC.hpp:137
double offsetClk
Offset for clock voltages.
Definition ngcdcsCLDC.hpp:609
int Selftest()
Execute self-test.
Definition ngcdcsCldcSelftest.cpp:26
int SaveCfgFile(const char *fileName)
Save voltage configuration.
Definition ngcdcsCldcCfg.cpp:1061
int Restore(const char *keyWord)
Restore keyword from the last loaded file.
Definition ngcdcsCldcCfg.cpp:152
int Snapshot()
Telemetry snapshot.
Definition ngcdcsCldcTel.cpp:282
double offsetDC
Offset for bias voltages.
Definition ngcdcsCLDC.hpp:612
virtual void ClkMap(ngcdcs_clk_t *cv)
Clock channel mapping.
Definition ngcdcsCLDC.cpp:572
void BoardType(int b)
Enforce specific board type.
Definition ngcdcsCLDC.cpp:467
virtual int DiodeBias(double volt)
Set diode bias.
Definition ngcdcsCldcOffset.cpp:216
virtual ~ngcdcsCLDC()
Destructor.
Definition ngcdcsCLDC.cpp:47
virtual int VideoOffset(double *volt)
Set video offset.
Definition ngcdcsCldcOffset.cpp:251
virtual void DefaultSetup(const char *keyWord=NULL)
Default setup.
Definition ngcdcsCldcCfg.cpp:26
int clkMon1
Clock on monitor 1.
Definition ngcdcsCLDC.hpp:615
int DacChan(int chan, double volt)
Set voltage on DAC channel.
Definition ngcdcsCLDC.cpp:1330
int SaveErrFile(const char *fileName)
Save error calibration.
Definition ngcdcsCldcCfg.cpp:1605
int LoadCfgFile(const char *fileName=NULL)
Load voltage configuration.
Definition ngcdcsCldcCfg.cpp:147
double preampOffset
Preamplifier offset.
Definition ngcdcsCLDC.hpp:621
int OutputEnabled()
Check if output is enabled.
Definition ngcdcsCLDC.cpp:1177
int VStatus(int *hwStat)
Get voltage HW-status.
Definition ngcdcsCLDC.cpp:253
int VoltageRegDC(int num, int value, int rangeCheck=1)
Set DC hex-voltage.
Definition ngcdcsCLDC.cpp:1636
int OutputDisable()
Disable output.
Definition ngcdcsCLDC.cpp:1269
ngcbMOD * vcm[ngcdcsCLDC_MAX_CHAN]
Voltage Callbacks.
Definition ngcdcsCLDC.hpp:645
virtual int TelIntern(int sel=-1)
Update internal telemetry.
Definition ngcdcsCldcTel.cpp:133
int VoltageErrDC(int num, double volt)
Set DC voltage error.
Definition ngcdcsCldcCalib.cpp:199
double lbnlOffset
LBNL high voltage offset.
Definition ngcdcsCLDC.hpp:630
int Calibrated()
Check if calibration has been done.
Definition ngcdcsCldcCalib.cpp:194
int OutputEnable()
Enable output.
Definition ngcdcsCLDC.cpp:1182
double lbnlGain
LBNL high voltage gain.
Definition ngcdcsCLDC.hpp:627
int TelData(double *volt)
Read telemetry data.
Definition ngcdcsCldcTel.cpp:82
int TelClk(int num, ngcdcs_clkv_t *cv)
Telemetry for clock (all levels)
Definition ngcdcsCldcTel.cpp:262
virtual double OffsetClk()
Return Offset for clocks.
Definition ngcdcsCldcOffset.cpp:25
virtual int Monitor(int num, int clkChan)
Set channel for clock-monitor.
Definition ngcdcsCldcMon.cpp:25
virtual double OffsetDC()
Return Offset for DC-biases.
Definition ngcdcsCldcOffset.cpp:30
void Reset()
Align soft-states after reset.
Definition ngcdcsCLDC.cpp:475
double lbnlTelOffset
LBNL high voltage offset (telemetry)
Definition ngcdcsCLDC.hpp:636
int VoltageErrClk(int num, int l, double volt)
Set clock level voltage error.
Definition ngcdcsCldcCalib.cpp:229
int Check()
Check telemetry against current setup.
Definition ngcdcsCLDC.cpp:865
int dcSetupMap[ngcbCLDC_MAX_DC]
Map specifying the setup order of the biases.
Definition ngcdcsCLDC.hpp:651
int TelChan()
Return actual telemetry channel.
Definition ngcdcsCldcTel.cpp:80
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsCldcSetup.cpp:584
int VoltageDC(int num, double volt, int rangeCheck=1)
Set DC voltage.
Definition ngcdcsCLDC.cpp:1449
int Protection(int flag)
Enable/disable protection circuit.
Definition ngcdcsCLDC.cpp:1301
int clkMon2
Clock on monitor 2.
Definition ngcdcsCLDC.hpp:618
int Disable()
Call-back at transition to not operational state.
Definition ngcdcsCLDC.cpp:833
virtual double Reg2Volt(int reg, int chan, double corr=1.0)
Convert register value to voltage.
Definition ngcdcsCLDC.cpp:1919
double dacDelay
DAC delay (seconds)
Definition ngcdcsCLDC.hpp:639
int VoltageClk(int num, int l, double volt, int rangeCheck=1)
Set clock level.
Definition ngcdcsCLDC.cpp:1531
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsCldcStatus.cpp:450
int Enable(int check=1)
Call-back at transition to operational state.
Definition ngcdcsCLDC.cpp:607
int VoltageRegClk(int num, int l, int value, int rangeCheck=1)
Set clock hex-level.
Definition ngcdcsCLDC.cpp:1717
ngcdcs_tel_t tel[ngcdcsCLDC_MAX_TEL]
Internal telemetry.
Definition ngcdcsCLDC.hpp:642
virtual void DcMap(ngcdcs_dc_t *dv)
Bias channel mapping.
Definition ngcdcsCLDC.cpp:540
int Zero()
Set all voltages to zero.
Definition ngcdcsCLDC.cpp:1806
int Calibrate(int noSetup=0)
Calibrate (offset compensation)
Definition ngcdcsCldcCalib.cpp:25
void ClearCalibration()
Clear calibration.
Definition ngcdcsCldcCalib.cpp:175
char * VStatusString()
Get voltage status string.
Definition ngcdcsCLDC.cpp:248
int clkSetupMap[ngcbCLDC_MAX_CLK]
Map specifying the setup order of the clocks.
Definition ngcdcsCLDC.hpp:648
virtual int Volt2Reg(double *volt, int chan, double corr=1.0)
Convert voltage to register value.
Definition ngcdcsCLDC.cpp:1862
int TelDC(int num, double *volt)
Telemetry for DC-bias.
Definition ngcdcsCldcTel.cpp:154
double diodeBias
DiodeBias.
Definition ngcdcsCLDC.hpp:624
virtual int Adjust(int chan)
Voltage setup adjustement for channel.
Definition ngcdcsCLDC.cpp:1324
int GetTelCfg(size_t start)
Get internal telemetry configurarion (NGCII only)
Definition ngcdcsCldcTel.cpp:311
virtual int DacReg(int value, int chan)
Map value on DAC register channel.
Definition ngcdcsCLDC.cpp:1952
void TimeStamp(int chan)
Timstamp DAC channel (last setup)
Definition ngcdcsCLDC.cpp:859
virtual double ConvertTel(int value)
Convert telemetry register value.
Definition ngcdcsCldcTel.cpp:25
ngcdcsCLDC(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.cpp:28
virtual int PreampOffset(double volt)
Set preamplifier offset.
Definition ngcdcsCldcOffset.cpp:181
double lbnlTelGain
LBNL high voltage gain (telemetry)
Definition ngcdcsCLDC.hpp:633
int VSetup(int autoCtrl=0)
Apply voltage setup.
Definition ngcdcsCLDC.cpp:1001
#define ngcbCLDC_MAX_DC
Definition ngcbAddr.h:333
#define ngcbCLDC_STAT_ENABLED
Definition ngcbAddr.h:327
#define ngcbCLDC_MAX_CLK
Definition ngcbAddr.h:332
#define ngcbCLDC_STAT_DISABLED
Definition ngcbAddr.h:326
#define ngcbMOD_ERR
Definition ngcbOBJ.hpp:22
void ngcbCleanPath(char *name)
Definition ngcbFile.c:596
#define USE(x)
Definition ngcb.h:28
#define ngcdcsCLDC_CAL_MAX
Definition ngcdcsCLDC.hpp:43
#define ngcdcsCLDC_DCLK
Definition ngcdcsCLDC.hpp:38
#define ngcdcsCLDC_MAX_CHAN
Definition ngcdcsCLDC.hpp:53
#define ngcdcsCLDC_BUFSIZE
Definition ngcdcsCLDC.hpp:33
#define ngcdcsCLDC_VDIFF_MAX
Definition ngcdcsCLDC.hpp:48
#define ngcdcsCLDC_MAX_TEL
Definition ngcdcsCLDC.hpp:58
Definition ngcbIFC.hpp:72
Definition ngcdcsCLDC.hpp:103
int connected
Definition ngcdcsCLDC.hpp:105
ngcdcs_clk_t()
Constructor.
Definition ngcdcsCLDC.hpp:108
ngcdcs_dc_t level[ngcdcsCLDC_DCLK]
Definition ngcdcsCLDC.hpp:104
Definition ngcdcsCLDC.hpp:114
ngcdcs_clkv_t()
Constructor.
Definition ngcdcsCLDC.hpp:118
double volt[ngcdcsCLDC_DCLK]
Definition ngcdcsCLDC.hpp:115
Definition ngcdcsCLDC.hpp:63
char name[64]
Definition ngcdcsCLDC.hpp:73
double volt
Definition ngcdcsCLDC.hpp:64
int voltReg
Definition ngcdcsCLDC.hpp:70
int telChan
Definition ngcdcsCLDC.hpp:72
double telGain
Definition ngcdcsCLDC.hpp:67
double comp
Definition ngcdcsCLDC.hpp:68
double margin
Definition ngcdcsCLDC.hpp:69
char unit[4]
Definition ngcdcsCLDC.hpp:77
int connected
Definition ngcdcsCLDC.hpp:74
ngcdcs_dc_t()
Constructor.
Definition ngcdcsCLDC.hpp:80
double dacCorr
Definition ngcdcsCLDC.hpp:66
int dacChan
Definition ngcdcsCLDC.hpp:71
int directReg
Definition ngcdcsCLDC.hpp:75
double range[2]
Definition ngcdcsCLDC.hpp:65
int set
Definition ngcdcsCLDC.hpp:76
Definition ngcdcsTypes.hpp:44