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