Changeset 10070 for fact/BIASctrl
- Timestamp:
- 12/16/10 08:08:04 (14 years ago)
- Location:
- fact/BIASctrl
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/BIASctrl/BIASctrl.cc
r10052 r10070 17 17 18 18 #define LOCKFILE "/tmp/CTX_HV_LOCK" 19 const char READLINE_HIST_FILE[] = "/tmp/.history.BIASctrl"; 19 20 20 21 // … … 51 52 char str[MAX_COM_SIZE], *Command; 52 53 int Lock; 54 std::string LastHist; 53 55 54 56 // Assure only one instance runs … … 72 74 73 75 // Install signal handler and set signal SIGUSR1 to interrupt blocking system calls 74 //signal(SIGUSR1, &DummyHandler);75 //siginterrupt (SIGUSR1, true);76 signal(SIGUSR1, &DummyHandler); 77 siginterrupt (SIGUSR1, true); 76 78 77 79 // Assure lock file is deleted in case of a program crash or call to exit() … … 92 94 signal(SIGTERM, &CrashHandler); 93 95 96 // Load history buffer 97 read_history(READLINE_HIST_FILE); 98 94 99 // Handle command-line input 95 100 while (!M.ExitRequest) { … … 98 103 // NULL returned if interrupted by signal 99 104 if (Command == NULL) continue; 100 if (strlen(Command) > 0) add_history(Command); 105 106 // Add command to history 107 if(strlen(Command) > 0 && LastHist != Command) { 108 add_history(Command); 109 LastHist = Command; 110 } 101 111 102 112 // Process command (via DIM gives automatic thread serialisation) … … 104 114 free(Command); 105 115 } 116 117 // Save history buffer 118 int Ret = write_history(READLINE_HIST_FILE); 119 if (Ret != 0 ) printf("Error writing history file to '%s' (%s)\n", READLINE_HIST_FILE, strerror(Ret)); 106 120 } -
fact/BIASctrl/Crate.cc
r10059 r10070 32 32 Present[i][j] = false; 33 33 Current[i][j] = 0; 34 CurrentOffset[i][j] = 0; 34 35 } 35 36 } … … 45 46 NameService = new DimService ((SERVER_NAME"/NAME/ID"+ID.str()).c_str(), Name); 46 47 BiasVolt = new DimService ((char *) (SERVER_NAME"/VOLT/ID"+ID.str()).c_str(), (char *) "D", Volt, MAX_NUM_BOARDS*NUM_CHANNELS*sizeof(double)); 48 BiasDAC = new DimService ((char *) (SERVER_NAME"/DAC/ID"+ID.str()).c_str(), (char *) "I", DAC, MAX_NUM_BOARDS*NUM_CHANNELS*sizeof(int)); 49 BiasCurrent = new DimService ((char *) (SERVER_NAME"/MICROAMP/ID"+ID.str()).c_str(), (char *) "F", Current, MAX_NUM_BOARDS*NUM_CHANNELS*sizeof(float)); 47 50 48 51 ClearVoltageArrays(); … … 97 100 delete NameService; 98 101 delete BiasVolt; 102 delete BiasDAC; 103 delete BiasCurrent; 99 104 delete[] Name; 100 105 } … … 104 109 // 105 110 // Returns: 0 error, 1 success, -1 time-out exceeded 106 vector< char> Crate::Communicate(string Buf) {111 vector<unsigned char> Crate::Communicate(string Buf) { 107 112 108 113 int N; … … 110 115 struct timeval WaitTime = {(long) m->fTimeOut, (long) ((m->fTimeOut-(long) m->fTimeOut)*1e6)}; 111 116 char Buffer[10000]; 112 vector< char> Data;117 vector<unsigned char> Data; 113 118 114 119 // === Lock device === … … 133 138 // Time-out expired? 134 139 if (!FD_ISSET(fDescriptor, &SelectDescriptor)) { 135 Data.push_back(-1);136 140 goto ExitCommunicate; 137 141 } … … 177 181 int Crate::SystemReset() { 178 182 179 vector< char> Data = Communicate(string(3, 0));183 vector<unsigned char> Data = Communicate(string(3, 0)); 180 184 181 185 if (Data.size() == 3) { … … 183 187 return 1; 184 188 } 185 return Data[0];189 return 0; 186 190 } 187 191 … … 201 205 202 206 // Execute command 203 vector< char> Data = Communicate(Buf);207 vector<unsigned char> Data = Communicate(Buf); 204 208 205 if (Data.size() != Buf.size()) return Data[0];209 if (Data.size() != Buf.size()) return 0; 206 210 207 211 // Evaluate data returned from crate 208 212 int Count = 0; 209 213 for (int i=0; i<MAX_NUM_BOARDS; i++) for (int j=0; j<NUM_CHANNELS; j++) { 210 Current[i][j] = Data[Count+1] + (Data[Count]&15)*256;214 Current[i][j] = (Data[Count+1] + (Data[Count] & 0x0f)*256) * 1.22; 211 215 OC[i][j] = Data[Count] & 128; 212 216 Present[i][j] = Data[Count+2] & 0x70 ? false : true; … … 220 224 221 225 // ***** Global set ***** 222 int Crate::GlobalSet(unsigned int SetPoint) { 223 224 // Check limit 225 if (SetPoint > 0x0FFF) { 226 m->PrintMessage("Error: Voltage DAC value above 0x0FFF\n"); 227 return 0; 228 } 229 226 int Crate::GlobalSet(double Voltage) { 227 228 unsigned int SetPoint = (unsigned int) (Voltage/90.0*0x0fff); 229 230 230 // Execute command 231 231 string Buf; 232 232 Buf = (((Buf + char(1<<6)) + char(SetPoint>>8)) + char(SetPoint)); 233 vector< char> Data = Communicate(Buf);233 vector<unsigned char> Data = Communicate(Buf); 234 234 235 235 if (Data.size() == 3) { 236 236 for (int i=0; i<MAX_NUM_BOARDS; i++) for (int j=0; j<NUM_CHANNELS; j++) { 237 237 DAC[i][j] = SetPoint; 238 Volt[i][j] = (double) SetPoint / 0xfff * 90; 238 Volt[i][j] = Voltage; 239 RefVolt[i][j] = Voltage; 239 240 } 240 241 return 1; 241 242 } 242 return Data[0];243 return 0; 243 244 } 244 245 245 246 246 247 // ***** Set channel voltages ***** 247 int Crate::SetChannels(map<unsigned int, unsigned int> V) {248 int Crate::SetChannels(map<unsigned int, double> V) { 248 249 249 250 string Buf; … … 252 253 253 254 // Build and execute commands 254 for (map<unsigned int, unsigned int>::const_iterator it = V.begin(); it != V.end(); ++it) { 255 for (map<unsigned int, double>::const_iterator it = V.begin(); it != V.end(); ++it) { 256 // If DAC value unchanged, do not send command 257 if (DAC[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] == it->second/90.0*0x0fff) continue; 258 259 // Add command to buffer 255 260 Buf += char(3<<5) | char(it->first/NUM_CHANNELS<<1 & 0x0f) | char((it->first%NUM_CHANNELS&16)>>4 & 1); 256 Buf += char(it->first%NUM_CHANNELS<<4) | (( it->second>>8) & 0x0f);257 Buf += char(it->second );258 } 259 vector< char> Data = Communicate(Buf);261 Buf += char(it->first%NUM_CHANNELS<<4) | ((((unsigned int) (it->second/90.0*0x0fff))>>8) & 0x0f); 262 Buf += char(it->second/90.0*0x0fff); 263 } 264 vector<unsigned char> Data = Communicate(Buf); 260 265 261 266 // Store new voltage values of successful 262 267 if (Data.size() == Buf.size()) { 263 for (map<unsigned int, unsigned int>::const_iterator it = V.begin(); it != V.end(); ++it) { 264 DAC[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] = it->second; 265 Volt[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] = 90.0*it->second/0x0fff; 268 for (map<unsigned int, double>::const_iterator it = V.begin(); it != V.end(); ++it) { 269 DAC[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] = (unsigned int) (it->second/90.0*0x0fff); 270 Volt[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] = it->second; 271 RefVolt[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] = it->second; 266 272 } 267 273 return 1; 268 274 } 269 return Data[0];275 return 0; 270 276 } 271 277 … … 275 281 276 282 int Trial = 0; 277 vector< char> Data;283 vector<unsigned char> Data; 278 284 279 285 while(++Trial <= 3) { 280 286 Data = Communicate(string(1, 0)); 281 287 if (Data.size() == 3) return true; 282 if (Data[0] == 0) break;283 288 } 284 289 return false; … … 306 311 void Crate::ClearVoltageArrays() { 307 312 308 for (int i=0; i<MAX_NUM_BOARDS; i++) { 309 for (int j=0; j<NUM_CHANNELS; j++){ 310 DAC[i][j] = 0; 311 Volt[i][j] = 0.0; 312 } 313 } 314 // Update DIM services 313 for (int i=0; i<MAX_NUM_BOARDS; i++) for (int j=0; j<NUM_CHANNELS; j++) { 314 DAC[i][j] = 0; 315 Volt[i][j] = 0; 316 RefVolt[i][j] = 0; 317 } 318 319 UpdateDIM(); 320 } 321 322 323 // ***** Return calibrated voltage of given channel ***** 324 double Crate::GetVoltage(unsigned int Channel) { 325 326 if (Channel >= MAX_NUM_BOARDS*NUM_CHANNELS) return 0; 327 else return Volt[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS]; 328 } 329 330 331 // ***** Return DAC value of given channel ***** 332 unsigned int Crate::GetDAC(unsigned int Channel) { 333 334 if (Channel >= MAX_NUM_BOARDS*NUM_CHANNELS) return 0; 335 else return DAC[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS]; 336 } 337 338 339 // ***** Return current of given channel ***** 340 float Crate::GetCurrent(unsigned int Channel) { 341 342 if (Channel >= MAX_NUM_BOARDS*NUM_CHANNELS) return 0; 343 else return Current[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS]-CurrentOffset[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS]; 344 } 345 346 347 // ***** Update DIM services ***** 348 void Crate::UpdateDIM() { 349 315 350 BiasVolt->updateService(); 316 } 351 BiasDAC->updateService(); 352 } 353 354 355 // ***** Set reference current for dynamic mode ***** 356 void Crate::SetRefCurrent() { 357 358 for (int i=0; i<MAX_NUM_BOARDS; i++) for (int j=0; j<NUM_CHANNELS; j++) { 359 RefCurrent[i][j] = Current[i][j]; 360 } 361 } 362 363 364 // ***** Correct voltages according to current ***** 365 void Crate::AdaptVoltages() { 366 367 static int LastUpdate = 0; 368 369 map<unsigned int, double> Voltages; 370 371 for (int i=0; i<MAX_NUM_BOARDS; i++) for (int j=0; j<NUM_CHANNELS; j++) { 372 if (RefVolt[i][j] == 0) continue; 373 Voltages[i*NUM_CHANNELS+j] = RefVolt[i][j] + (RefCurrent[i][j]-Current[i][j])*RESISTOR/1e6; 374 } 375 SetChannels(Voltages); 376 377 if (time(NULL)-LastUpdate > 5) { 378 LastUpdate = time(NULL); 379 UpdateDIM(); 380 } 381 } -
fact/BIASctrl/Crate.h
r10059 r10070 17 17 #define NUM_CHANNELS 32 // Channels per bias board 18 18 #define BAUDRATE B115200 19 const float RESISTOR = 1000; // Resistance in Ohm for voltage correction 19 20 20 21 class User; … … 27 28 FILE *File; 28 29 DimService *NameService; 30 DimService *BiasVolt; 31 DimService *BiasDAC; 32 DimService *BiasCurrent; 29 33 30 std::vector<char> Communicate(std::string); 34 int DAC[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in DAC units 35 double Volt[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in Volt 36 float Current[MAX_NUM_BOARDS][NUM_CHANNELS]; 37 float CurrentOffset[MAX_NUM_BOARDS][NUM_CHANNELS]; // Offset for current measurement 38 39 std::vector<unsigned char> Communicate(std::string); 31 40 void ClearVoltageArrays(); 32 41 … … 36 45 37 46 char *Name; 38 DimService *BiasVolt;39 47 40 int Current[MAX_NUM_BOARDS][NUM_CHANNELS];41 48 bool OC[MAX_NUM_BOARDS][NUM_CHANNELS]; 42 49 bool Present[MAX_NUM_BOARDS][NUM_CHANNELS]; … … 46 53 int ErrorCount; 47 54 48 unsigned int DAC[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in DAC units 49 double Volt[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in Volt 50 int CurrentOffset[MAX_NUM_BOARDS][NUM_CHANNELS]; // Offset for current measurement 55 float RefCurrent[MAX_NUM_BOARDS][NUM_CHANNELS]; 56 double RefVolt[MAX_NUM_BOARDS][NUM_CHANNELS]; 51 57 52 58 bool InitOK; 53 59 54 int SetChannels(std::map<unsigned int, unsigned int>);60 int SetChannels(std::map<unsigned int, double>); 55 61 int ReadAll(); 56 62 int SystemReset(); 57 int GlobalSet( unsigned int);63 int GlobalSet(double); 58 64 bool Synch(); 59 65 bool CurrentCalib(double); 66 double GetVoltage(unsigned int); 67 unsigned int GetDAC(unsigned int); 68 float GetCurrent(unsigned int); 69 void UpdateDIM(); 70 void SetRefCurrent(); 71 void AdaptVoltages(); 60 72 }; 61 73 -
fact/BIASctrl/History.txt
r10059 r10070 4 4 17/11/2010 Added possibility for bulk transfers (ReadAll(), SetChannels()) 5 5 24/11/2010 Ramping for many channels possible with bulk transfers 6 7/12/2010 Added dynamic mode. -
fact/BIASctrl/User.cc
r10059 r10070 20 20 {"status", &User::cmd_status, 0, "[dac|current]", "Show status information (DAC values if requested)"}, 21 21 {"ccal", &User::cmd_ccal, 1, "<volt>", "Calibrate current measurement at given voltage"}, 22 {"mode", &User::cmd_mode, 1, "<static|dynamic>", "Set voltage stabilization mode"}, 22 23 {"load", &User::cmd_load, 1, "<file>", "Load and set bias settings from file"}, 23 24 {"save", &User::cmd_save, 1, "<file>", "Save current bias settings to file"}, … … 43 44 fTimeOut = atof(GetConfig("TimeOut").c_str()); 44 45 fStatusRefreshRate = atof(GetConfig("StatusRefreshRate").c_str()); 45 fMaxDiff = ato i(GetConfig("HVMaxDiff").c_str());46 fMaxDiff = atof(GetConfig("HVMaxDiffNew").c_str()); 46 47 47 48 if (fStatusRefreshRate < MIN_RATE || fStatusRefreshRate > MAX_RATE) fStatusRefreshRate = 1; … … 158 159 void User::cmd_hv() { 159 160 160 unsigned int DACValue, Errors=0, B, C;161 unsigned int Errors=0; 161 162 double Double; 162 163 struct Range Crt, Chan; 163 vector< map<unsigned int, unsigned int> > Voltages (Crates.size());164 vector< map<unsigned int, double> > Voltages (Crates.size()); 164 165 165 166 // Loop over all parameters … … 178 179 Chan.Max = MAX_NUM_BOARDS*NUM_CHANNELS-1; 179 180 181 if (Parameter[n] == "-") continue; 182 180 183 if (T.size() == 2) { 181 184 if(!ConvertToRange(T[0], Crt) || !ConvertToRange(T[1], Chan)) { … … 201 204 // Loop over given crates and channels 202 205 for (int i=Crt.Min; i<=Crt.Max; i++) for (int j=Chan.Min; j<=Chan.Max; j++) { 203 // Board and channel number204 B = j / NUM_CHANNELS;205 C = j % NUM_CHANNELS;206 207 206 // Voltage change (number starts with + oder -) ignored if current DAC value is zero 208 if (isdigit(Parameter[n+1][0])==0 && Crates[i]-> DAC[B][C]== 0) continue;207 if (isdigit(Parameter[n+1][0])==0 && Crates[i]->GetDAC(j) == 0) continue; 209 208 210 209 // Relative or absolute change? 211 if (isdigit(Parameter[n+1][0]) == 0) DACValue = Crates[i]->DAC[B][C] + (unsigned int) (Double/90*0x0fff); 212 else DACValue = (unsigned int) (Double/90*0x0fff); 213 214 Voltages[i][j] = DACValue; 210 if (isdigit(Parameter[n+1][0]) == 0) Voltages[i][j] = Crates[i]->GetVoltage(j) + Double; 211 else Voltages[i][j] = Double; 215 212 } // Channels 216 213 } // Loop over command argument … … 219 216 for (unsigned int i=0; i<Voltages.size(); i++) { 220 217 Errors += RampVoltages(i, Voltages[i]); 221 Crates[i]-> BiasVolt->updateService();218 Crates[i]->UpdateDIM(); 222 219 } 223 220 … … 231 228 232 229 char Buffer[MAX_COM_SIZE]; 233 int Errors = 0, Board, Channel; 234 unsigned int DACValue, NBoards = 0; 230 int Errors = 0, Channel; 231 unsigned int NBoards = 0; 232 double Value; 235 233 FILE *File; 236 map<unsigned int, unsigned int> Voltages;234 map<unsigned int, double> Voltages; 237 235 238 236 // Open file … … 249 247 250 248 Voltages.clear(); 251 Board = 0; Channel = 0; 252 while (fscanf(File, "%u", &DACValue)==1 && Board<MAX_NUM_BOARDS) { 253 Voltages[Board*NUM_CHANNELS+Channel] = DACValue; 254 255 // Ramp channel to new voltage 256 /*if (!RampVoltage(DACValue, Crate, Board, Channel)) { 257 Errors++; 258 PrintMessage("Error: Could not ramp board %d, channel %d\n", Board, Channel); 259 } 260 else { 261 PrintMessage("Ramped board %d, channel %d to %u (%.2f V) \r", 262 Board, Channel, DACValue, (double) DACValue/0x0fff*90); 263 }*/ 264 265 if(++Channel == NUM_CHANNELS) { 266 Board++; 267 Channel = 0; 268 } 249 Channel = 0; 250 while (fscanf(File, "%lf", &Value)==1 && Channel<MAX_NUM_BOARDS*NUM_CHANNELS) { 251 Voltages[Channel++] = Value; 269 252 } 270 253 … … 273 256 274 257 // Update DIM service 275 Crates[Crate]-> BiasVolt->updateService();258 Crates[Crate]->UpdateDIM(); 276 259 277 260 if (ferror(File) != 0) { … … 342 325 if (!ConvertToDouble(Parameter[1], &Voltage)) return; 343 326 344 if (Crates[0]->GlobalSet( (int) (Voltage/90*0xfff)) != 1) {327 if (Crates[0]->GlobalSet(Voltage) != 1) { 345 328 PrintMessage("Error: Could not global set board %d\n", 0); 346 329 } … … 386 369 fprintf(File, "%s\n\n", Crates[i]->Name); 387 370 388 for (int j=0; j<MAX_NUM_BOARDS; j++) { 389 for (int k=0; k<NUM_CHANNELS; k++) fprintf(File,"%5d ",Crates[i]->DAC[j][k]); 390 } 371 for (int j=0; j<MAX_NUM_BOARDS*NUM_CHANNELS; j++) fprintf(File,"%.3f ",Crates[i]->GetVoltage(j)); 391 372 fprintf(File, "\n"); 392 373 } … … 396 377 } 397 378 } 379 380 // 381 // Set operation mode 382 // 383 void User::cmd_mode() { 384 385 if (Match(Parameter[1], "static")) Mode = mode_static; 386 else { 387 Mode = mode_dynamic; 388 for (unsigned int i=0; i<Crates.size(); i++) { 389 Crates[i]->SetRefCurrent(); 390 } 391 } 392 } 398 393 399 394 // … … 419 414 if (j%12 == 0) PrintMessage("\n%3.1d: ", j); 420 415 if (!Crates[i]->Present[j/NUM_CHANNELS][j%NUM_CHANNELS]) PrintMessage(" - "); 421 else if (Parameter.size() == 1) PrintMessage("%#5.2f ",Crates[i]-> Volt[j/NUM_CHANNELS][j%NUM_CHANNELS]);422 else if (Match(Parameter[1], "dac")) PrintMessage("%5d ", Crates[i]-> DAC[j/NUM_CHANNELS][j%NUM_CHANNELS]);423 else PrintMessage("%#5.2f %s ", (Crates[i]->Current[j/NUM_CHANNELS][j%NUM_CHANNELS]-Crates[i]->CurrentOffset[j/NUM_CHANNELS][j%NUM_CHANNELS])*1.2, Crates[i]->OC[j/NUM_CHANNELS][j%NUM_CHANNELS] ? "OC":"");416 else if (Parameter.size() == 1) PrintMessage("%#5.2f ",Crates[i]->GetVoltage(j)); 417 else if (Match(Parameter[1], "dac")) PrintMessage("%5d ", Crates[i]->GetDAC(j)); 418 else PrintMessage("%#5.2f %s ", Crates[i]->GetCurrent(j), Crates[i]->OC[j/NUM_CHANNELS][j%NUM_CHANNELS] ? "OC":""); 424 419 } 425 420 PrintMessage("\n"); … … 449 444 450 445 ExitRequest = true; 451 //pthread_kill(Thread, SIGUSR1); 452 //pthread_cancel(Thread); 446 pthread_kill(Thread, SIGUSR1); // Make tjread return from usleep() 453 447 } 454 448 … … 484 478 // Ramp to new voltage with maximum step size given in fMaxDiff 485 479 // No ramping when decreasing voltage 486 unsigned int User::RampVoltages(int Crate, map<unsigned int, unsigned int> Voltages) {487 488 map<unsigned int, unsigned int> Target;480 unsigned int User::RampVoltages(int Crate, map<unsigned int, double> Voltages) { 481 482 map<unsigned int, double> Target; 489 483 unsigned int Errors = 0; 490 484 491 485 // Ramp until all channels at desired value 492 486 while (!Voltages.empty()) { 493 // Remove channels already at target 494 for (map<unsigned int, unsigned int>::iterator it = Voltages.begin(); it != Voltages.end(); ++it) { 495 if (Crates[Crate]->DAC[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] == it->second) Voltages.erase(it); 487 // Remove channels already at target (check for DAC, not for floating-point voltage) 488 for (map<unsigned int, double>::iterator it = Voltages.begin(); it != Voltages.end(); ++it) { 489 //if (Crates[Crate]->GetDAC(it->first) == (unsigned int ) (it->second/90.0*0x0fff)) Voltages.erase(it); 490 if (fabs(Crates[Crate]->GetVoltage(it->first)-it->second) < 0.001) Voltages.erase(it); 496 491 } 497 492 498 493 // Limit voltage changes to fMaxDiff 499 494 Target = Voltages; 500 for (map<unsigned int, unsigned int>::iterator it = Target.begin(); it != Target.end(); ++it) {501 if (Crates[Crate]-> DAC[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] + fMaxDiff/2< it->second) {502 it->second = Crates[Crate]-> DAC[it->first/NUM_CHANNELS][it->first%NUM_CHANNELS] + fMaxDiff/2;495 for (map<unsigned int, double>::iterator it = Target.begin(); it != Target.end(); ++it) { 496 if (Crates[Crate]->GetVoltage(it->first) + fMaxDiff < it->second) { 497 it->second = Crates[Crate]->GetVoltage(it->first) + fMaxDiff; 503 498 } 504 499 } … … 545 540 } 546 541 547 map<unsigned int, unsigned int> Voltages;542 map<unsigned int, double> Voltages; 548 543 549 544 for (int j=0; j<MAX_NUM_BOARDS*NUM_CHANNELS; j++) { … … 551 546 Message(WARN, "Overcurrent on crate %d, board %d, channel %d, setting voltage to zero", i, j/NUM_CHANNELS, j%NUM_CHANNELS); 552 547 Voltages[j] = 0; 553 //Crates[i]->ChannelSet(j/NUM_CHANNELS, j%NUM_CHANNELS, 0);554 548 } 555 549 } … … 558 552 Crates[i]->SystemReset(); 559 553 } 554 555 if (Mode == mode_dynamic) Crates[i]->AdaptVoltages(); 560 556 } // for 561 557 -
fact/BIASctrl/User.h
r10059 r10070 24 24 class User: public EvidenceServer { 25 25 26 enum RunMode {mode_static, mode_dynamic}; 27 26 28 PixelMap *pm; 27 29 DimCommand *DIMCommand; … … 30 32 pthread_t Thread; 31 33 std::vector<std::string> Parameter; 34 RunMode Mode; 32 35 33 36 std::vector<class Crate *> Crates; … … 48 51 double fTimeOut; 49 52 float fStatusRefreshRate; 50 unsigned intfMaxDiff;53 double fMaxDiff; 51 54 52 55 User(); … … 54 57 55 58 void PrintMessage(const char *, ...); 56 unsigned int RampVoltages(int, std::map<unsigned int, unsigned int>);59 unsigned int RampVoltages(int, std::map<unsigned int, double>); 57 60 void Monitor(); 58 61 static void LaunchMonitor(User *); … … 64 67 void cmd_timeout(); void cmd_reset(); 65 68 void cmd_help(); void cmd_ccal(); 69 void cmd_mode(); 66 70 }; 67 71
Note:
See TracChangeset
for help on using the changeset viewer.