source: fact/BIASctrl/Crate.h@ 15563

Last change on this file since 15563 was 11915, checked in by ogrimm, 13 years ago
Ramping also for decreasing voltage
File size: 1.6 KB
Line 
1#ifndef HV_H_SEEN
2#define HV_H_SEEN
3
4#include <termios.h> // POSIX terminal control definitions
5#include <fcntl.h> // File control definitions => fcntl() in fcn OpenPort()
6#include <errno.h>
7#include <stdio.h>
8#include <unistd.h>
9#include <sys/ioctl.h>
10#include <string>
11#include <vector>
12#include <map>
13
14#include "dis.hxx"
15
16const unsigned int MAX_NUM_BOARDS = 13; // Maximum number of boards per crate
17const unsigned int NUM_CHANNELS = 32; // Channels per bias board
18const float RESISTOR = 2000; // Resistance in Ohm for voltage correction
19const int MAX_ERR_COUNT = 10; // Maximum number of errors before reporting stopped
20class User;
21
22class Crate {
23
24 class User *m;
25 int fDescriptor;
26 FILE *File;
27 DimService *NameService;
28 DimService *BiasVolt;
29 DimService *BiasCurrent;
30
31 double Volt[MAX_NUM_BOARDS*NUM_CHANNELS]; // Voltage
32 float Current[MAX_NUM_BOARDS*NUM_CHANNELS];
33 time_t LastReset;
34
35 std::vector<unsigned char> Communicate(std::string);
36 void ClearVoltageArrays();
37
38 public:
39 Crate(std::string, int, class User *);
40 ~Crate();
41
42 char *Name;
43
44 bool OC[MAX_NUM_BOARDS*NUM_CHANNELS];
45 bool Present[MAX_NUM_BOARDS*NUM_CHANNELS];
46 bool ResetHit;
47 bool WrapOK;
48 int WrapCount;
49 int ErrorCount;
50 bool Disabled;
51
52 float RefCurrent[MAX_NUM_BOARDS*NUM_CHANNELS];
53 double RefVolt[MAX_NUM_BOARDS*NUM_CHANNELS];
54
55 bool InitOK;
56
57 bool SetChannels(std::map<unsigned int, double>);
58 bool ReadAll();
59 bool SystemReset();
60 bool GlobalSet(double);
61 bool Synch();
62 double GetVoltage(unsigned int);
63 unsigned int GetDAC(unsigned int);
64 float GetCurrent(unsigned int);
65 void UpdateDIM();
66 void SetRefCurrent();
67 void AdaptVoltages();
68};
69
70#endif
Note: See TracBrowser for help on using the repository browser.