Changeset 126 for hvcontrol/src


Ignore:
Timestamp:
12/08/09 13:29:04 (15 years ago)
Author:
ogrimm
Message:
Implemented DIM servers
Location:
hvcontrol/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • hvcontrol/src/HV.cc

    r113 r126  
    2626  BoardName = DeviceName;
    2727 
    28   for (int i=0; i<NUM_CHAINS; i++) Overcurrent[i] = false;
     28  // Create DIM services
     29  snprintf(Buffer, sizeof(Buffer), SERVER_NAME"/NAME/ID%.2d", BoardNumber);
     30  Name = new DimService (Buffer, BoardName);
     31
     32  for (int i=0; i<NUM_CHAINS; i++) {
     33    for (int j=0; j<NUM_CHANNELS; j++) {
     34      snprintf(Buffer, sizeof(Buffer), SERVER_NAME"/VOLT/ID%.2d/%.2d-%.3d", BoardNumber, i, j);
     35      BiasVolt[i][j] = new DimService (Buffer, HVV[i][j]);
     36      snprintf(Buffer, sizeof(Buffer), SERVER_NAME"/DAC/ID%.2d/%.2d-%.3d", BoardNumber, i, j);
     37      BiasDAC[i][j] = new DimService (Buffer, HV[i][j]);
     38    }
     39    Overcurrent[i] = false;
     40  }
    2941  ResetButton = false;
    3042  WrapOK = true;
     
    7486    Reset();
    7587    close(fDescriptor);
     88  }
     89
     90  delete Name;
     91  for (int i=0; i<NUM_CHAINS; i++) {
     92    for (int j=0; j<NUM_CHANNELS; j++) {
     93      delete BiasVolt[i][j];
     94      delete BiasDAC[i][j];
     95    }
    7696  }
    7797}
     
    194214      HV[j][k] = 0;
    195215      HVV[j][k] = 0.0;
     216     
     217      // Update DIM services
     218      BiasVolt[j][k]->updateService();
     219      BiasDAC[j][k]->updateService();
    196220    }
    197221  }
  • hvcontrol/src/HV.h

    r113 r126  
    1010
    1111#include "HVConfig.h"
     12#include "dis.hxx"
    1213
    1314#define BAUDRATE B115200
     
    5253   double HVV[NUM_CHAINS][NUM_CHANNELS];  // HV value in volts
    5354
     55   DimService *Name;
     56   DimService *BiasVolt[NUM_CHAINS][NUM_CHANNELS];
     57   DimService *BiasDAC[NUM_CHAINS][NUM_CHANNELS];
     58
    5459   void ClearVoltageArrays();
    5560   int Reset();
  • hvcontrol/src/ProcessIO.cc

    r113 r126  
    1515
    1616
    17 ProcessIO::ProcessIO(const char *ConfigFile) {
     17ProcessIO::ProcessIO(const char *ConfigFile): EvidenceServer(SERVER_NAME) {
    1818
    1919  // Get program start time
     
    268268         
    269269          // Set new voltage (if DAC value, update calibrated value)
    270           if(!RampVoltage(DACValue, i, j, k)) Errors++;
    271           if(SetDac) fHVBoard[i]->HVV[j][k] = calib->DACToHV(fHVBoard[i]->HV[j][k], i, j, k);
     270          if (!RampVoltage(DACValue, i, j, k)) Errors++;
     271          if (SetDac) fHVBoard[i]->HVV[j][k] = calib->DACToHV(fHVBoard[i]->HV[j][k], i, j, k);
     272
     273          // Update DIM services
     274          fHVBoard[i]->BiasVolt[j][k]->updateService();
    272275
    273276        } // Channels   
     
    316319            }
    317320            fHVBoard[Board]->HVV[Chain][Channel] = calib->DACToHV(fHVBoard[Board]->HV[Chain][Channel], Board, Chain, Channel);
     321
     322            // Update DIM services
     323            fHVBoard[Board]->BiasVolt[Chain][Channel]->updateService();
     324
    318325            if(++Channel == NUM_CHANNELS) {
    319326              Chain++;
     
    625632  SlowDataClass->NewEntry("Value");
    626633  SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
     634
     635  // Update DIM service
     636  fHVBoard[Board]->BiasDAC[Chain][Channel]->updateService();
     637 
    627638  return true;
    628639}
  • hvcontrol/src/ProcessIO.h

    r113 r126  
    77#include <math.h>
    88#include <signal.h>
     9
     10#define SERVER_NAME "BIAS"       // Name to use in DIM
     11#include "../../Evidence/Evidence.h"
    912
    1013#include "HVConfig.h"
     
    2225typedef enum stateenum { active, stopped, na } state_enum;
    2326
    24 class ProcessIO {
     27class ProcessIO: public EvidenceServer {
    2528
    2629  time_t StartTime;
Note: See TracChangeset for help on using the changeset viewer.