Last change
on this file since 11406 was 11361, checked in by ogrimm, 13 years ago |
Default voltages taken from configuration data
|
File size:
1.7 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 |
|
---|
16 | #define MAX_NUM_BOARDS 13 // Maximum number of boards per crate
|
---|
17 | #define NUM_CHANNELS 32 // Channels per bias board
|
---|
18 | #define BAUDRATE B115200
|
---|
19 | const float RESISTOR = 1000; // Resistance in Ohm for voltage correction
|
---|
20 | const int MAX_ERR_COUNT = 10; // Maximum number of errors before reporting stopped
|
---|
21 | class User;
|
---|
22 |
|
---|
23 | class Crate {
|
---|
24 |
|
---|
25 | class User *m;
|
---|
26 | int CrateNumber;
|
---|
27 | int fDescriptor;
|
---|
28 | FILE *File;
|
---|
29 | DimService *NameService;
|
---|
30 | DimService *BiasVolt;
|
---|
31 | DimService *BiasDAC;
|
---|
32 | DimService *BiasCurrent;
|
---|
33 |
|
---|
34 |
|
---|
35 | int DAC[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in DAC units
|
---|
36 | double Volt[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in Volt
|
---|
37 | float Current[MAX_NUM_BOARDS][NUM_CHANNELS];
|
---|
38 | std::vector<unsigned char> Communicate(std::string);
|
---|
39 | void ClearVoltageArrays();
|
---|
40 |
|
---|
41 | public:
|
---|
42 | Crate(std::string, int, class User *);
|
---|
43 | ~Crate();
|
---|
44 |
|
---|
45 | char *Name;
|
---|
46 |
|
---|
47 | bool OC[MAX_NUM_BOARDS][NUM_CHANNELS];
|
---|
48 | bool Present[MAX_NUM_BOARDS][NUM_CHANNELS];
|
---|
49 | bool ResetHit;
|
---|
50 | bool WrapOK;
|
---|
51 | int WrapCount;
|
---|
52 | int ErrorCount;
|
---|
53 |
|
---|
54 | float RefCurrent[MAX_NUM_BOARDS][NUM_CHANNELS];
|
---|
55 | double RefVolt[MAX_NUM_BOARDS][NUM_CHANNELS];
|
---|
56 |
|
---|
57 | bool InitOK;
|
---|
58 |
|
---|
59 | int SetChannels(std::map<unsigned int, double>);
|
---|
60 | int ReadAll();
|
---|
61 | int SystemReset();
|
---|
62 | int GlobalSet(double);
|
---|
63 | bool Synch();
|
---|
64 | double GetVoltage(unsigned int);
|
---|
65 | unsigned int GetDAC(unsigned int);
|
---|
66 | float GetCurrent(unsigned int);
|
---|
67 | void UpdateDIM();
|
---|
68 | void SetRefCurrent();
|
---|
69 | void AdaptVoltages();
|
---|
70 | };
|
---|
71 |
|
---|
72 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.