temp_threshold, temp_control, temp_event done

This commit is contained in:
Dhanya Maliakal
2018-01-11 15:37:24 +01:00
parent a87687199f
commit 2d6e4c95a2
15 changed files with 725 additions and 6 deletions

View File

@ -958,6 +958,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
- \ref settingssett "Settings and Threshold": commands to configure settings and threshold of detector
- \ref settingsdacs "DACs": commands to configure DACs of detector
- \ref settingsadcs "ADCs": commands to readout ADCs of detector
- \ref settingstmp "Temp Control": commands to monitor and handle temperature overshoot (only JUNGFRAU)
*/
/* trim/cal directories */
@ -1562,6 +1563,33 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
/* temperature control */
/*! \page settings
\section settingsadcs Temp Control
commands to monitor and handle temperature overshoot (only JUNGFRAU)
*/
/*! \page settings
- <b>temp_threshold</b> Sets/gets the threshold temperature. JUNGFRAU ONLY. \c Returns \c (double"°C")
*/
descrToFuncMap[i].m_pFuncName="temp_threshold"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTempControl;
++i;
/*! \page settings
- <b>temp_control</b> Enables/Disables the temperature control. 1 enables, 0 disables. JUNGFRAU ONLY. \c Returns \c int
*/
descrToFuncMap[i].m_pFuncName="temp_control"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTempControl;
++i;
/*! \page settings
- <b>temp_event</b> Resets/gets over-temperative event. Put only with option 0 to clear event. Gets 1 if temperature went over threshold and control is enabled, else 0. /Disables the temperature control. JUNGFRAU ONLY. \c Returns \c int
*/
descrToFuncMap[i].m_pFuncName="temp_event"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTempControl;
++i;
/* file name */
@ -5287,6 +5315,80 @@ string slsDetectorCommand::helpADC(int narg, char *args[], int action) {
return os.str();
}
string slsDetectorCommand::cmdTempControl(int narg, char *args[], int action) {
char answer[1000]="";
int val = -1;
if (action==HELP_ACTION)
return helpTempControl(narg, args, action);
myDet->setOnline(ONLINE_FLAG);
if (cmd == "temp_threshold") {
if (action==PUT_ACTION) {
double fval=0.0;
if (!sscanf(args[1],"%lf", &fval))
return string("cannot scan temp control value ")+string(args[1]);
val = fval * 1000;
myDet->setThresholdTemperature(val);
}
val = myDet->setThresholdTemperature();
if (val == -1)
sprintf(answer,"%d",val);
else
sprintf(answer,"%.2f°C", (double)val/1000.000);
}
else if (cmd == "temp_control") {
if (action==PUT_ACTION) {
if (!sscanf(args[1],"%d", &val))
return string("cannot scan temp control value ")+string(args[1]);
if ((val!=0) && (val!=1))
return string ("temp_control option must be 0 or 1");
myDet->setTemperatureControl(val);
}
sprintf(answer,"%d", myDet->setTemperatureControl());
}
else if (cmd == "temp_event") {
if (action==PUT_ACTION) {
if (!sscanf(args[1],"%d", &val))
return string("cannot scan temp control value ")+string(args[1]);
if (val!=0)
return string ("temp_event option must be 0 to clear event");
myDet->setTemperatureEvent(val);
}
sprintf(answer,"%d", myDet->setTemperatureEvent());
}
else
return string ("cannot scan command " + cmd);
return string(answer);
}
string slsDetectorCommand::helpTempControl(int narg, char *args[], int action) {
ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) {
os << "temp_threshold t \t sets the threshold temperature. Jungfrau only" << std::endl;
os << "temp_control t \t Enables/Disables the temperature control. 1 enables, 0 disables. JUNGFRAU ONLY" << std::endl;
os << "temp_event t \t Resets over-temperative event. Put only with option 0 to clear event. JUNGFRAU ONLY." << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION) {
os << "temp_threshold \t gets the threshold temperature. Jungfrau only." << std::endl;
os << "temp_control \t gets temperature control enable. 1 enabled, 0 disabled. JUNGFRAU ONLY" << std::endl;
os << "temp_event \t gets over-temperative event. Gets 1 if temperature went over threshold and control is enabled, else 0. /Disables the temperature control. JUNGFRAU ONLY." << std::endl;
}
return os.str();
}
string slsDetectorCommand::cmdTiming(int narg, char *args[], int action){
#ifdef VERBOSE
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");