- Timestamp:
- 05/13/09 10:42:59 (16 years ago)
- Location:
- hvcontrol
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
hvcontrol/HV.conf
r35 r39 1 # Main configuration file for the HV control program V1.0, 2009 0 4 23, 17:13:361 # Main configuration file for the HV control program V1.0, 2009 05 13, 11:37:07 2 2 # Note: this file will be updated at program exit 3 3 -
hvcontrol/Makefile
r35 r39 3 3 # 4 4 5 SOURCES = hvcontrol.cpp src/CCCommand.cc src/ConsoleCommand.cc src/HV.cc src/HVConfig.cc src/HVCalib.cc src/HVMonitor.cc src/HVStatus.cc src/Log.cc src/ProcessIO.cc src/ReadCard.cc src/Utilities.cc ../ ../fact_repos.svn/pixelmap/Pixel.cc ../../fact_repos.svn/pixelmap/PixelMap.cc5 SOURCES = hvcontrol.cpp src/CCCommand.cc src/ConsoleCommand.cc src/HV.cc src/HVConfig.cc src/HVCalib.cc src/HVMonitor.cc src/HVStatus.cc src/Log.cc src/ProcessIO.cc src/ReadCard.cc src/Utilities.cc ../fact_repos.svn/pixelmap/Pixel.cc ../fact_repos.svn/pixelmap/PixelMap.cc 6 6 7 7 OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) -
hvcontrol/src/CCCommand.cc
r35 r39 29 29 return; 30 30 } 31 31 32 // Allows immediate reuse of socket after closing (circumvents TIME_WAIT) 33 int Value=1; 34 if (setsockopt(ServerSocket, SOL_SOCKET, SO_REUSEADDR, (char *) &Value, sizeof (Value)) == -1) { 35 sprintf(str,"Warning: Could not set server socket option SO_REUSEADDR (%s).\n",strerror(errno)); 36 m->PrintMessage(str); 37 } 38 32 39 SocketAddress.sin_family = PF_INET; 33 40 SocketAddress.sin_port = htons((unsigned short) m->config->fCCPort); -
hvcontrol/src/HVStatus.cc
r35 r39 53 53 status->OC[i][j] = FALSE; 54 54 55 for (int k=0;k<MAX_NUM_CHANNELS;k++) 55 for (int k=0;k<MAX_NUM_CHANNELS;k++){ 56 56 status->HV[i][j][k] = 0; 57 status->HVV[i][j][k] = 0.0; 58 } 57 59 } 58 60 } -
hvcontrol/src/HVStatus.h
r14 r39 50 50 51 51 unsigned int VRef[MAX_NUM_HVBOARDS][MAX_NUM_CHAINS]; 52 unsigned int HV[MAX_NUM_HVBOARDS][MAX_NUM_CHAINS][MAX_NUM_CHANNELS]; 52 unsigned int HV[MAX_NUM_HVBOARDS][MAX_NUM_CHAINS][MAX_NUM_CHANNELS]; // HV value in DAC 53 float HVV[MAX_NUM_HVBOARDS][MAX_NUM_CHAINS][MAX_NUM_CHANNELS]; // HV value in volts 53 54 54 55 float fTimeOut; -
hvcontrol/src/ProcessIO.cc
r35 r39 349 349 if (!allchannels) { 350 350 // Convert from HV to DAC values 351 if (!(config->IsDAC)) 351 if (!(config->IsDAC)){ 352 status->HVV[i][j][channel]=hvoltageV; 352 353 hvoltage = calib->HVToDAC(hvoltageV,i,j,channel); 354 printf("HV = %f, dac hv = %d .\n",hvoltageV,hvoltage); 355 } 353 356 if ((hv->GetHVBoard(i))->SetHV(stdout,j,channel,hvoltage,rbuf,status->Verbose)==1){ 354 357 status->HV[i][j][channel]=hvoltage; 355 358 UpdateStatus(i,rbuf); 356 359 357 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X \n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage);360 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(i)->GetBoardNumber(),j,channel)); 358 361 DoPrompt(str); 359 362 if (status->Verbose) { … … 376 379 for (int k=0;k<MAX_NUM_CHANNELS;k++) { 377 380 // Convert from HV to DAC values 378 if (!(config->IsDAC)) 381 if (!(config->IsDAC)){ 382 status->HVV[i][j][channel]=hvoltageV; 379 383 hvoltage = calib->HVToDAC(hvoltageV,i,j,k); 384 } 380 385 if ((hv->GetHVBoard(i))->SetHV(stdout,j,k,hvoltage,rbuf,status->Verbose)==1) { 381 386 status->HV[i][j][k]=hvoltage; … … 383 388 384 389 if (status->Verbose) { 385 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X\n",hv->GetHVBoard(i)->GetBoardNumber(),j,k,hvoltage,hvoltage); 390 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(i)->GetBoardNumber(),j,channel)); 391 //sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X\n",hv->GetHVBoard(i)->GetBoardNumber(),j,k,hvoltage,hvoltage); 386 392 DoPrompt(str); 387 393 sPrintStatus(status,str,i); … … 455 461 // std::cout << "Channel: " << channel << std::endl; 456 462 457 /* if (IsNoDigit(status->Param[1]))458 channel = atoi(status->Param[1]);459 else if(status->Param[1][0] == 'a')460 allchannels = TRUE;461 else {462 DoPrompt("error: wrong input format - usage: hvdiff <channel>|<all> <hv difference>\n");463 return 0;464 }*/465 466 463 // Binary input 467 464 if (tolower(status->Param[2][0])=='x' && strlen(status->Param[2])>2) { … … 506 503 //Convert from HV to DAC values 507 504 if (!(config->IsDAC)){ 508 hvoltage = status->HV[board][chain][channel]; 509 hvoltageV = calib->DACToHV(hvoltage,board,chain,channel); 510 hvoltageV = hvoltageV + hvdiffV; 511 hvdiff = calib->HVToDAC(hvoltageV,board,chain,channel) - hvoltage; 505 hvoltageV = status->HVV[board][chain][channel]+hvdiffV; 506 status->HVV[board][chain][channel] = hvoltageV; 507 printf("hv+diff = %f .\n",hvoltageV); 508 hvdiff = calib->HVToDAC(hvoltageV,board,chain,channel) - status->HV[board][chain][channel]; 509 printf("dac new = %d, dac old = %d.\n",calib->HVToDAC(hvoltageV,board,chain,channel),status->HV[board][chain][channel]); 510 printf("dac diff = %d .\n",hvdiff); 512 511 } 513 512 StopMonitor(); … … 516 515 517 516 hvoltage = status->HV[board][chain][channel]; 517 // printf("dac hv = %d .\n",hvoltage); 518 518 for (int k=0;k<=abs((int)(hvdiff/config->fHVMaxDiff));k++){ 519 519 if (k<abs((int)(hvdiff/config->fHVMaxDiff))){ … … 526 526 527 527 status->HV[board][chain][channel]=hvoltage; 528 printf("dac hv rampingup= %d .\n",hvoltage); 528 529 if ((hv->GetHVBoard(board))->SetHV(stdout,chain,channel,hvoltage,rbuf,status->Verbose)==1) { 529 530 UpdateStatus(board,rbuf); 530 if (k==(int)(abs((int)(hvdiff/config->fHVMaxDiff)))){ 531 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X\n",hv->GetHVBoard(board)->GetBoardNumber(),chain,channel,hvoltage,hvoltage); 531 if (k==(abs((int)(hvdiff/config->fHVMaxDiff)))){ 532 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(board)->GetBoardNumber(),chain,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(board)->GetBoardNumber(),chain,channel)); 533 //sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X\n",hv->GetHVBoard(board)->GetBoardNumber(),chain,channel,hvoltage,hvoltage); 532 534 DoPrompt(str); 533 535 sPrintStatus(status,str,board); // Print status only to socket … … 540 542 } 541 543 } // for loop over k 542 // Sleep(1);543 544 if (status->Verbose) { 544 545 sPrintStatus(status,str,board);
Note:
See TracChangeset
for help on using the changeset viewer.