31 #include <QCoreApplication> 35 #include <QStringList> 36 #include <QMapIterator> 37 #include <QElapsedTimer> 38 #include <QXmlStreamAttributes> 39 #include <QTextStream> 49 #define CRYO_LOWTEMP 1 50 #define CRYO_OVEN_OMEGA 2 61 #define BPVX_ENABLED 0 63 #define BPVY_ENABLED 2 67 #define BPV_STATE_OPEN 5120 68 #define BPV_STATE_CLOSED 3072 69 #define BPV_STATE_LOCKED 2048 71 #define SC_VENT_ENABLED 6 76 #define LS_CTRL_ZONE 2 78 #define LS340_INPUT_CF1 0 79 #define LS340_INPUT_CF2 1 80 #define LS340_INPUT_PRESSURE 2 81 #define LS340_INPUT_HEATER 7 82 #define LS340_INPUT_SETPOINT 8 83 #define LS340_INPUT_PID_P 9 84 #define LS340_INPUT_PID_I 10 85 #define LS340_INPUT_PID_D 11 86 #define LS340_INPUT_HEATER_RANGE 12 87 #define LS340_INPUT_HEATER_MODE 13 88 #define LS340_INPUT_RAMP 14 90 #define LS340_OUTPUT_REMOTE 0 91 #define LS340_OUTPUT_SETPOINT 1 92 #define LS340_OUTPUT_PID_P 2 93 #define LS340_OUTPUT_PID_I 3 94 #define LS340_OUTPUT_PID_D 4 95 #define LS340_OUTPUT_HEATER_RANGE 5 96 #define LS340_OUTPUT_HEATER_MODE 6 97 #define LS340_OUTPUT_RAMP 7 99 #define LS336_INPUT_CF1 0 100 #define LS336_INPUT_CF2 1 101 #define LS336_INPUT_PRESSURE 4 102 #define LS336_INPUT_HEATER 8 103 #define LS336_INPUT_SETPOINT 9 104 #define LS336_INPUT_PID_P 10 105 #define LS336_INPUT_PID_I 11 106 #define LS336_INPUT_PID_D 12 107 #define LS336_INPUT_HEATER_RANGE 13 108 #define LS336_INPUT_HEATER_MODE 14 109 #define LS336_INPUT_RAMP 15 111 #define LS336_OUTPUT_SETPOINT 0 112 #define LS336_OUTPUT_PID_P 1 113 #define LS336_OUTPUT_PID_I 2 114 #define LS336_OUTPUT_PID_D 3 115 #define LS336_OUTPUT_HEATER_RANGE 4 116 #define LS336_OUTPUT_HEATER_MODE 5 117 #define LS336_OUTPUT_RAMP 6 120 #define OMEGA_OVEN_INPUT_TEMP 0 121 #define OMEGA_OVEN_INPUT_SETPOINT 6 123 #define OMEGA_OVEN_OUTPUT_SETPOINT 0 126 #define SM_INPUT_NEEDLEVALVE 0 127 // NeedleValve output 128 #define SM_OUTPUT_NEEDLEVALVE 0 129 #define SM_MODUS_NEEDLEVALVE 1 131 #define BH_INPUT_FLOW 0 132 #define BH_INPUT_VALVE 1 134 #define BH_OUTPUT_FLOW 0 135 // Danfsik Spin Rotator Magnet Current 136 #define SPINT_ROT_OUTPUT_CURRENT 2 137 #define SPINT_ROT_INPUT_CURRENT 3 139 #define DANFYSIK_INPUT_CURRENT 3 141 #define DANFYSIK_OUTPUT_CURRENT 2 143 #define WEWL_INPUT_STATUS 0 144 #define WEWL_INPUT_CURRENT 1 145 #define WEWH_INPUT_STATUS 3 146 #define WEWH_INPUT_CURRENT 4 148 #define WEWL_OUTPUT_CMD 0 149 #define WEWL_OUTPUT_CURRENT 1 150 #define WEWH_OUTPUT_CMD 2 151 #define WEWH_OUTPUT_CURRENT 3 152 #define WEW_SSP_LOCK 4 154 #define HV_FUG_MAX_TRY 5 155 #define HV_FUG_CHS 16 156 #define HV_FUG_RIGHT_RODS 0 157 #define HV_FUG_LEFT_RODS 1 158 #define HV_FUG_LEFT_PLATE 2 159 #define HV_FUG_RIGHT_PLATE 3 161 #define HV_FUG_MIRROR 8 162 #define HV_FUG_LENSE_2 9 163 #define HV_FUG_LENSE_3 10 164 #define HV_FUG_RAL 11 165 #define HV_FUG_RAR 12 166 #define HV_FUG_RAT 13 167 #define HV_FUG_RAB 14 168 #define HV_FUG_SAMPLE 15 170 #define HV_NHQ_TD_FIRST 0 171 #define HV_NHQ_TD_LAST 3 172 #define HV_NHQ_MCP1 4 174 #define FOM_CURRENT_MEASURED 0 175 #define FOM_VOLTAGE_MEASURED 1 176 #define FOM_BATTERY 2 178 #define FOM_CURRENT_DEMAND 0 179 #define FOM_STANDBY 1 180 // Beamline KV61, KV62 indices 181 #define BEAMLINE_KV61_DEMAND_CH 26 182 #define BEAMLINE_KV62_DEMAND_CH 28 187 #define HTML_RUNNING 2 189 #define HTML_ABORTED 4 191 #define HTML_WARMUP 6 192 #define HTML_STRANGE 7 193 #define HTML_PARSE_ERROR 8 197 #define TEMP_DEMAND_TEMP 0 198 #define TEMP_DELTA_T 1 199 #define TEMP_STABILITY_TIMEOUT 2 201 #define TEMP_HEATER_RANGE 4 208 #define LAR_TT_IDLE 0 209 #define LAR_TT_FINISHED 1 210 #define LAR_TT_ABORTED 2 211 #define LAR_TT_WARMUP 3 230 if (!file.open(QFile::ReadOnly | QFile::Text) || (file.size()==0))
258 fXml.setDevice(device);
260 bool expectChars =
false;
261 while (!
fXml.atEnd()) {
263 if (
fXml.isStartDocument()) {
265 }
else if (
fXml.isStartElement()) {
268 }
else if (
fXml.isCharacters() && expectChars) {
270 }
else if (
fXml.isEndElement()) {
273 }
else if (
fXml.isEndDocument()) {
277 if (
fXml.hasError()) {
279 msg = QString(
"%1 Line %2, column %3").arg(
fXml.errorString()).arg(
fXml.lineNumber()).arg(
fXml.columnNumber());
280 cm_msg(MERROR,
"lemAutoRun", msg.toLatin1().data());
309 QString qName =
fXml.name().toString();
310 QXmlStreamAttributes qAttr =
fXml.attributes();
312 if (qName ==
"xmlSchemaFln") {
314 }
else if (qName ==
"xmlAutoRunFln") {
316 }
else if (qName ==
"xmlAutoRunValidateFln") {
318 }
else if (qName ==
"xmlAutoRunHTML") {
320 }
else if (qName ==
"enable_all") {
322 }
else if (qName ==
"autoRunPath") {
324 }
else if (qName ==
"hvSettingsPath") {
326 }
else if (qName ==
"debug") {
328 }
else if (qName ==
"ignore_clients") {
330 }
else if (qName ==
"ignore_alarms") {
332 }
else if (qName ==
"fug_hv_check") {
334 }
else if (qName ==
"field_timeout") {
336 }
else if (qName ==
"field_accuracy") {
338 }
else if (qName ==
"hv_timeout") {
340 }
else if (qName ==
"hv_accuracy") {
342 }
else if (qName ==
"fom_current_accuracy") {
344 }
else if (qName ==
"wew_critical_current_ra") {
346 }
else if (qName ==
"wewl_max_current") {
348 }
else if (qName ==
"wewh_max_current") {
350 }
else if (qName ==
"danfysik_max_current") {
352 }
else if (qName ==
"trigger_events") {
355 }
else if (qName ==
"enable_on_off_mode") {
358 }
else if (qName ==
"alarms") {
361 }
else if (qName ==
"alarms_td_hv_trip") {
364 }
else if (qName ==
"run_info") {
366 }
else if (qName ==
"run_comment") {
369 }
else if (qName ==
"tof_min") {
372 }
else if (qName ==
"tof_max") {
375 }
else if (qName ==
"mod_name") {
378 }
else if (qName ==
"mod_date") {
381 }
else if (qName ==
"lem_setup") {
384 }
else if (qName ==
"sample_name") {
387 }
else if (qName ==
"spin_rot_enabled") {
390 }
else if (qName ==
"spin_rot_angle") {
393 }
else if (qName ==
"mag_param_wew") {
396 }
else if (qName ==
"mag_param_bpar") {
399 }
else if (qName ==
"setup_sample_enabled") {
402 }
else if (qName ==
"setup_wew_enabled") {
405 }
else if (qName ==
"setup_bpar_enabled") {
408 }
else if (qName ==
"sample_cryo") {
411 }
else if (qName ==
"energy_loss_param") {
414 }
else if (qName ==
"clients") {
416 }
else if (qName ==
"clients_analyzer") {
419 }
else if (qName ==
"clients_frontend") {
422 }
else if (qName ==
"clients_tfl") {
425 }
else if (qName ==
"clients_sample") {
428 }
else if (qName ==
"clients_sample_omega") {
431 }
else if (qName ==
"clients_wew") {
434 }
else if (qName ==
"clients_danfysik") {
437 }
else if (qName ==
"clients_hv") {
440 }
else if (qName ==
"clients_lemvac") {
443 }
else if (qName ==
"hv_demand") {
446 }
else if (qName ==
"hv_measured") {
449 }
else if (qName ==
"hv_current") {
452 }
else if (qName ==
"hv_detectors_demand") {
455 }
else if (qName ==
"hv_detectors_measured") {
458 }
else if (qName ==
"spin_rot_mag_input") {
461 }
else if (qName ==
"spin_rot_mag_output") {
464 }
else if (qName ==
"danfysik_input") {
467 }
else if (qName ==
"danfysik_output") {
470 }
else if (qName ==
"wew_output") {
473 }
else if (qName ==
"wew_input") {
476 }
else if (qName ==
"mag_field") {
479 }
else if (qName ==
"tfl_input") {
482 }
else if (qName ==
"tfl_output") {
485 }
else if (qName ==
"sample_ctrl_ch") {
488 }
else if (qName ==
"sample_channel") {
491 }
else if (qName ==
"sample_sensor_type") {
494 }
else if (qName ==
"sample_input") {
497 }
else if (qName ==
"sample_output") {
500 }
else if (qName ==
"sample_rawvoltage") {
503 }
else if (qName ==
"sample_bh_odb_offset_input") {
506 }
else if (qName ==
"sample_bh_odb_offset_output") {
509 }
else if (qName ==
"sample_oven_omega_input") {
512 }
else if (qName ==
"sample_oven_omega_output") {
515 }
else if (qName ==
"lemvac_input") {
518 }
else if (qName ==
"lemvac_output") {
521 }
else if (qName ==
"fom_input") {
524 }
else if (qName ==
"fom_output") {
527 }
else if (qName ==
"beamline_demand") {
558 QString str =
fXml.text().toString();
793 number = str.toInt(&ok);
798 number = str.toInt(&ok);
847 errorMsg =
"lemAutoRun: Couldn't find XML-schema path, will try hard-wired one (no warranty that it works): " +
854 errorMsg = QString(
"lemAutoRun: Couldn't find XML autorun sequence path, ") +
855 QString(
"will try hard-wired one (no warranty that it works): ") +
862 errorMsg = QString(
"lemAutoRun: Couldn't find XML validate autorun sequence path, ") +
863 QString(
"will try hard-wired one (no warranty that it works): ") +
869 fLar->
fXMLAutoRunHTML =
"/home/nemu/nemu/midas/experiment/nemu/custom_pages/lemAutoRun.html";
870 errorMsg = QString(
"lemAutoRun: Couldn't find XML autorun sequence path, ") +
871 QString(
"will try hard-wired one (no warranty that it works): ") +
878 errorMsg = QString(
"lemAutoRun: Couldn't find XML autorun sequence path, ") +
879 QString(
"will try hard-wired one (no warranty that it works): ") +
922 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the trigger events in the ODB, ") +
923 QString(
"will try hard-wired one (no warranty that it works): ") +
930 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Enable_OnOff_Mode in the ODB, ") +
931 QString(
"will try hard-wired one (no warranty that it works): ") +
938 errorMsg = QString(
"lemAutoRun: Couldn't find the path to alarms in the ODB, ") +
939 QString(
"will try hard-wired one (no warranty that it works): ") +
946 errorMsg = QString(
"lemAutoRun: Couldn't find the path to TD HV Trip flag in the ODB, ") +
947 QString(
"will try hard-wired one (no warranty that it works): ") +
954 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the run info in the ODB, ") +
955 QString(
"will try hard-wired one (no warranty that it works): ") +
962 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the run title in the ODB, ") +
963 QString(
"will try hard-wired one (no warranty that it works): ") +
970 errorMsg = QString(
"lemAutoRun: Couldn't find the path to TOF Min in the ODB, ") +
971 QString(
"will try hard-wired one (no warranty that it works): ") +
978 errorMsg = QString(
"lemAutoRun: Couldn't find the path to TOF Max in the ODB, ") +
979 QString(
"will try hard-wired one (no warranty that it works): ") +
986 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the moderator name in the ODB, ") +
987 QString(
"will try hard-wired one (no warranty that it works): ") +
994 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the moderator date in the ODB, ") +
995 QString(
"will try hard-wired one (no warranty that it works): ") +
1002 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the LEM setup in the ODB, ") +
1003 QString(
"will try hard-wired one (no warranty that it works): ") +
1010 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Sample Name in the ODB, ") +
1011 QString(
"will try hard-wired one (no warranty that it works): ") +
1018 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the spin rotation enabled flag in the ODB, ") +
1019 QString(
"will try hard-wired one (no warranty that it works): ") +
1026 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the spin rotation angle in the ODB, ") +
1027 QString(
"will try hard-wired one (no warranty that it works): ") +
1034 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the WEW magnet calibration (A->G) in the ODB, ") +
1035 QString(
"will try hard-wired one (no warranty that it works): ") +
1042 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Bpar magnet calibration (A->G) in the ODB, ") +
1043 QString(
"will try hard-wired one (no warranty that it works): ") +
1050 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the sample enable flag in the ODB, ") +
1051 QString(
"will try hard-wired one (no warranty that it works): ") +
1058 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the WEW enable flag in the ODB, ") +
1059 QString(
"will try hard-wired one (no warranty that it works): ") +
1066 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Bpar enable flag in the ODB, ") +
1067 QString(
"will try hard-wired one (no warranty that it works): ") +
1074 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Sample Cryo in the ODB, ") +
1075 QString(
"will try hard-wired one (no warranty that it works): ") +
1082 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the energy loss parameters in the ODB, ") +
1083 QString(
"will try hard-wired one (no warranty that it works): ") +
1090 errorMsg = QString(
"lemAutoRun: Couldn't find the path to clients in the ODB, ") +
1091 QString(
"will try hard-wired one (no warranty that it works): ") +
1098 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for the analyzer, ") +
1099 QString(
"will try hard-wired one (no warranty that it works): ") +
1106 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for the frontend, ") +
1107 QString(
"will try hard-wired one (no warranty that it works): ") +
1114 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for tfl_scfe, ") +
1115 QString(
"will try hard-wired one (no warranty that it works): ") +
1122 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for sample_scfe, ") +
1123 QString(
"will try hard-wired one (no warranty that it works): ") +
1130 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for Oven Omega SCFE, ") +
1131 QString(
"will try hard-wired one (no warranty that it works): ") +
1138 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for WEW SCFE, ") +
1139 QString(
"will try hard-wired one (no warranty that it works): ") +
1146 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for Danfysik SCFE, ") +
1147 QString(
"will try hard-wired one (no warranty that it works): ") +
1154 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for hv_fug_scfe, ") +
1155 QString(
"will try hard-wired one (no warranty that it works): ") +
1162 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for lemvac_scfe, ") +
1163 QString(
"will try hard-wired one (no warranty that it works): ") +
1170 errorMsg = QString(
"lemAutoRun: Couldn't find the path to HV demand values in the ODB, ") +
1171 QString(
"will try hard-wired one (no warranty that it works): ") +
1178 errorMsg = QString(
"lemAutoRun: Couldn't find the path to HV measured values in the ODB, ") +
1179 QString(
"will try hard-wired one (no warranty that it works): ") +
1186 errorMsg = QString(
"lemAutoRun: Couldn't find the path to HV current values in the ODB, ") +
1187 QString(
"will try hard-wired one (no warranty that it works): ") +
1194 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the HV Detectors demand values in the ODB, ") +
1195 QString(
"will try hard-wired one (no warranty that it works): ") +
1202 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the HV Detectors measured values in the ODB, ") +
1203 QString(
"will try hard-wired one (no warranty that it works): ") +
1210 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Danfysik Spin Rotator power supply input values in the ODB, ") +
1211 QString(
"will try hard-wired one (no warranty that it works): ") +
1218 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Danfysik Spin Rotator power supply output values in the ODB, ") +
1219 QString(
"will try hard-wired one (no warranty that it works): ") +
1226 errorMsg = QString(
"lemAutoRun: Couldn't find the path to Danfysik input values in the ODB, ") +
1227 QString(
"will try hard-wired one (no warranty that it works): ") +
1234 errorMsg = QString(
"lemAutoRun: Couldn't find the path to Danfysik output values in the ODB, ") +
1235 QString(
"will try hard-wired one (no warranty that it works): ") +
1242 errorMsg = QString(
"lemAutoRun: Couldn't find the path to WEW output values in the ODB, ") +
1243 QString(
"will try hard-wired one (no warranty that it works): ") +
1250 errorMsg = QString(
"lemAutoRun: Couldn't find the path to WEW input values in the ODB, ") +
1251 QString(
"will try hard-wired one (no warranty that it works): ") +
1258 errorMsg = QString(
"lemAutoRun: Couldn't find the path to magnet field parameters of the WEW in the ODB, ") +
1259 QString(
"will try hard-wired one (no warranty that it works): ") +
1266 errorMsg = QString(
"lemAutoRun: Couldn't find the path to tfl input values in the ODB, ") +
1267 QString(
"will try hard-wired one (no warranty that it works): ") +
1274 errorMsg = QString(
"lemAutoRun: Couldn't find the path to tfl input values in the ODB, ") +
1275 QString(
"will try hard-wired one (no warranty that it works): ") +
1281 fLar->
fSampleCtrlChPath =
"/Equipment/SampleCryo/Settings/Devices/Lake336_Sample_0/DD/Loop1/CTRL_CH";
1282 errorMsg = QString(
"lemAutoRun: Couldn't find the path to ctrl channel of the LS340 in the ODB, ") +
1283 QString(
"will try hard-wired one (no warranty that it works): ") +
1290 errorMsg = QString(
"lemAutoRun: Couldn't find the path to channel assignment of the LS340 in the ODB, ") +
1291 QString(
"will try hard-wired one (no warranty that it works): ") +
1298 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sensor type assignment of the LS340 in the ODB, ") +
1299 QString(
"will try hard-wired one (no warranty that it works): ") +
1306 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo input values in the ODB, ") +
1307 QString(
"will try hard-wired one (no warranty that it works): ") +
1314 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo output values in the ODB, ") +
1315 QString(
"will try hard-wired one (no warranty that it works): ") +
1322 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo 'RawVoltage' in the ODB, ") +
1323 QString(
"will try hard-wired one (no warranty that it works): ") +
1330 errorMsg = QString(
"lemAutoRun: Couldn't find input ODB offset for the bronkhorst flow meter, ") +
1337 errorMsg = QString(
"lemAutoRun: Couldn't find output ODB offset for the bronkhorst flow meter, ") +
1344 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample oven omega input values in the ODB, ") +
1345 QString(
"will try hard-wired one (no warranty that it works): ") +
1352 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample oven output values in the ODB, ") +
1353 QString(
"will try hard-wired one (no warranty that it works): ") +
1360 errorMsg = QString(
"lemAutoRun: Couldn't find the path to lemvac input values in the ODB, ") +
1361 QString(
"will try hard-wired one (no warranty that it works): ") +
1368 errorMsg = QString(
"lemAutoRun: Couldn't find the path to lemvac output values in the ODB, ") +
1369 QString(
"will try hard-wired one (no warranty that it works): ") +
1376 errorMsg = QString(
"lemAutoRun: Couldn't find the path to FOM input values in the ODB, ") +
1377 QString(
"will try hard-wired one (no warranty that it works): ") +
1384 errorMsg = QString(
"lemAutoRun: Couldn't find the path to FOM output values in the ODB, ") +
1385 QString(
"will try hard-wired one (no warranty that it works): ") +
1392 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Beamline demand values in the ODB, ") +
1393 QString(
"will try hard-wired one (no warranty that it works): ") +
1399 errorMsg = QString(
"lemAutoRun: Sample Cryo enabled, but access to '/Info/Sample Cryo' disabled.") +
1400 QString(
"will most likely not work!") +
1418 if (qAttr.hasAttribute(
"enabled")) {
1419 if (qAttr.value(
"enabled") ==
"yes") {
1421 }
else if (qAttr.value(
"enabled") ==
"no") {
1445 if (!file.open(QFile::ReadOnly | QFile::Text) || (file.size()==0))
1473 fXml.setDevice(device);
1475 bool expectChars =
false;
1476 while (!
fXml.atEnd()) {
1478 if (
fXml.isStartDocument()) {
1480 }
else if (
fXml.isStartElement()) {
1483 }
else if (
fXml.isCharacters() && expectChars) {
1485 }
else if (
fXml.isEndElement()) {
1487 expectChars =
false;
1488 }
else if (
fXml.isEndDocument()) {
1492 if (
fXml.hasError()) {
1494 msg = QString(
"%1 Line %2, column %3").arg(
fXml.errorString()).arg(
fXml.lineNumber()).arg(
fXml.columnNumber());
1495 cm_msg(MERROR,
"lemAutoRun", msg.toLatin1().data());
1524 QString qName =
fXml.name().toString();
1526 if (qName ==
"temp_regulation") {
1528 }
else if (qName ==
"max_temp_increase") {
1530 }
else if (qName ==
"bh_max_flow") {
1532 }
else if (qName ==
"bh_min_flow") {
1534 }
else if (qName ==
"bh_flow_p_heat_0") {
1536 }
else if (qName ==
"bh_flow_p_heat_1") {
1538 }
else if (qName ==
"bh_flow_d_heat") {
1540 }
else if (qName ==
"bh_flow_temp") {
1542 }
else if (qName ==
"bh_flow_temp_offset") {
1544 }
else if (qName ==
"bh_flow_offset") {
1546 }
else if (qName ==
"d_set_ratio") {
1548 }
else if (qName ==
"abs_max_temp_diff") {
1550 }
else if (qName ==
"rel_max_temp_diff") {
1552 }
else if (qName ==
"max_temp_trend") {
1554 }
else if (qName ==
"heater_min") {
1556 }
else if (qName ==
"heater_max") {
1558 }
else if (qName ==
"flow_factor") {
1560 }
else if (qName ==
"flow_set_ratio") {
1562 }
else if (qName ==
"flow_set_absolute") {
1564 }
else if (qName ==
"flow_timeout_reduction") {
1566 }
else if (qName ==
"timeout_flow_set") {
1568 }
else if (qName ==
"flowLowestFlowToConsider") {
1570 }
else if (qName ==
"flowMaxRelFlowDiffToConsider") {
1572 }
else if (qName ==
"dFlowDp0") {
1574 }
else if (qName ==
"dFlowDp1") {
1576 }
else if (qName ==
"dFlowDpExp") {
1578 }
else if (qName ==
"heatCapCof1") {
1580 }
else if (qName ==
"heatCapCof2") {
1582 }
else if (qName ==
"heatCapCof3") {
1584 }
else if (qName ==
"needleValveInUse") {
1586 }
else if (qName ==
"prefNeedleValveCof_1_0") {
1588 }
else if (qName ==
"prefNeedleValveCof_1_1") {
1590 }
else if (qName ==
"prefNeedleValveCof_2_0") {
1592 }
else if (qName ==
"prefNeedleValveCof_2_1") {
1594 }
else if (qName ==
"prefNeedleValveCof_3_0") {
1596 }
else if (qName ==
"prefNeedleValveCof_3_1") {
1598 }
else if (qName ==
"prefNeedleValveCof_4_0") {
1600 }
else if (qName ==
"prefNeedleValveCof_4_1") {
1602 }
else if (qName ==
"prefNeedleValveRelStep") {
1604 }
else if (qName ==
"prefNeedleValveAbsStep") {
1634 QString str =
fXml.text().toString();
1809 if (!file.open(QFile::ReadOnly | QFile::Text) || (file.size()==0))
1841 fXml.setDevice(device);
1843 bool expectChars =
false;
1844 while (!
fXml.atEnd()) {
1846 if (
fXml.isStartDocument()) {
1848 }
else if (
fXml.isStartElement()) {
1851 }
else if (
fXml.isCharacters() && expectChars) {
1853 }
else if (
fXml.isEndElement()) {
1855 expectChars =
false;
1856 }
else if (
fXml.isEndDocument()) {
1860 if (
fXml.hasError()) {
1862 msg = QString(
"%1 Line %2, column %3").arg(
fXml.errorString()).arg(
fXml.lineNumber()).arg(
fXml.columnNumber());
1863 cm_msg(MERROR,
"lemAutoRun", msg.toLatin1().data());
1894 QString qName =
fXml.name().toString();
1896 if (qName ==
"hvDeviceName") {
1898 }
else if (qName ==
"chNo") {
1900 }
else if (qName ==
"name") {
1902 }
else if (qName ==
"hvDemand") {
1904 }
else if (qName ==
"currentLimit") {
1938 QString str =
fXml.text().toString();
1950 ival = str.toInt(&ok);
1954 fErrorMsg =
"**ERROR** found HV channel '" + str +
"' at position" + QString(
"%1").arg(
fHvChNo.size()) +
" which is not an integer?!?";
1963 fval = str.toFloat(&ok);
1967 fErrorMsg =
"**ERROR** found HV demand '" + str +
"' at position" + QString(
"%1").arg(
fHvChNo.size()) +
" which is not an double?!?";
1973 fval = str.toFloat(&ok);
1977 fErrorMsg =
"**ERROR** found current limit '" + str +
"' at position" + QString(
"%1").arg(
fHvChNo.size()) +
" which is not an double?!?";
2162 fHvSettingsPath = QString(
"/home/nemu/nemu/midas/experiment/nemu/hv_settings/");
2506 QString fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun.xml";
2507 if (!QFile::exists(fln)) {
2508 QString err =
"lemAutoRun: Couldn't find XML startup file " + fln;
2515 cm_msg(MERROR,
"lemAutoRun",
"**ERROR** lemAutoRun: couldn't read lemAutoRun.xml");
2528 char str[NAME_LENGTH];
2530 QString sampleCryoName =
"";
2540 sampleCryoName = QString(str);
2542 if (sampleCryoName ==
"Konti-1") {
2543 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo1.xml";
2545 }
else if (sampleCryoName ==
"Konti-2") {
2546 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo2.xml";
2548 }
else if (sampleCryoName ==
"Konti-3") {
2549 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo3.xml";
2551 }
else if (sampleCryoName ==
"Konti-4") {
2552 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo4.xml";
2554 }
else if (sampleCryoName ==
"LowTemp-1") {
2555 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_LowTemp1.xml";
2557 }
else if (sampleCryoName ==
"LowTemp-2") {
2558 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_LowTemp2.xml";
2560 }
else if (sampleCryoName ==
"Omega") {
2561 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_Oven.xml";
2563 }
else if (sampleCryoName ==
"NoCryo") {
2568 if (!QFile::exists(fln)) {
2569 QString err =
"lemAutoRun: Couldn't find XML startup file " + fln +
" ";
2570 err +=
"Perhaps the sample cryo name (" + sampleCryoName +
") is wrong?!";
2577 QString msg = QString(
"**ERROR** lemAutoRun: Couldn't read cryo xml-file '%1'").arg(fln);
2578 cm_msg(MERROR,
"lemAutoRun", msg.toLatin1().data());
2592 fEnabled.insert(
"trigger_events_odb",
false);
2593 fEnabled.insert(
"enable_on_off_mode_odb",
false);
2594 fEnabled.insert(
"alarms_odb",
false);
2595 fEnabled.insert(
"alarms_td_hv_trip_odb",
false);
2596 fEnabled.insert(
"run_comment_odb",
false);
2597 fEnabled.insert(
"tof_min_odb",
false);
2598 fEnabled.insert(
"tof_max_odb",
false);
2599 fEnabled.insert(
"mod_name_odb",
false);
2600 fEnabled.insert(
"mod_date_odb",
false);
2601 fEnabled.insert(
"lem_setup_odb",
false);
2602 fEnabled.insert(
"energy_loss_param_odb",
false);
2603 fEnabled.insert(
"sample_cryo_info_odb",
false);
2604 fEnabled.insert(
"sample_name_info_odb",
false);
2605 fEnabled.insert(
"spin_rot_calib_odb",
false);
2606 fEnabled.insert(
"spin_rot_angle_odb",
false);
2607 fEnabled.insert(
"mag_param_wew_odb",
false);
2608 fEnabled.insert(
"mag_param_bpar_odb",
false);
2609 fEnabled.insert(
"setup_sample_odb",
false);
2610 fEnabled.insert(
"setup_wew_odb",
false);
2611 fEnabled.insert(
"setup_bpar_odb",
false);
2614 fEnabled.insert(
"analyzer_fe",
false);
2616 fEnabled.insert(
"tfl_scfe",
false);
2617 fEnabled.insert(
"sample_scfe",
false);
2618 fEnabled.insert(
"omega_scfe",
false);
2619 fEnabled.insert(
"wew_scfe",
false);
2620 fEnabled.insert(
"danfysik_scfe",
false);
2621 fEnabled.insert(
"fug_scfe",
false);
2622 fEnabled.insert(
"lemvac_scfe",
false);
2626 fEnabled.insert(
"hv_detectors_eq",
false);
2627 fEnabled.insert(
"danfysik_spin_rot_eq",
false);
2628 fEnabled.insert(
"danfysik_eq",
false);
2630 fEnabled.insert(
"magnet_field_info",
false);
2632 fEnabled.insert(
"sample_eq",
false);
2633 fEnabled.insert(
"omega_eq",
false);
2634 fEnabled.insert(
"lemvac_eq",
false);
2636 fEnabled.insert(
"beamline_eq",
false);
2649 if (!key.compare(
"all", Qt::CaseInsensitive)) {
2650 QMapIterator<QString, bool> i(
fEnabled);
2651 while (i.hasNext()) {
2672 fExp =
new PExperiment(
"lemAutoRun1");
2679 if (!
fExp->IsConnected()) {
2691 QString err = QString(
"lemAutoRun: Couldn't collect the necessary ODB keys");
2699 QString err = QString(
"lemAutoRun: **WARNING** MCP2 setup detected.");
2717 if (
fEnabled[
"enable_on_off_mode_odb"]) {
2720 if (!onOffMode->IsValid()) {
2721 QString err = QString(
"lemAutoRun: Enable_OnOff_Mode key not found.");
2724 int ival, size=
sizeof(int);
2725 onOffMode->GetData(&ival, &size, TID_BOOL);
2749 QString err = QString(
"lemAutoRun: Lost Network Connection");
2766 PKey runStateKey(
fExp,
"/AutoRun/Run State");
2767 if (runStateKey.IsValid()) {
2768 runStateKey.SetData((
void*)&runState, 1, TID_INT);
2774 err = QString(
"Autorun aborted.");
2777 err = QString(
"lemAutoRun: Received Shutdown Command");
2791 QDateTime dt = QDateTime::currentDateTime();
2794 msg =
"["+dt.toString(
"dd.MM.yy, hh:mm:ss")+
"] " + statusMsg;
2796 PKey statusMsgKey(
fExp,
"/AutoRun/Status");
2797 if (statusMsgKey.IsValid()) {
2799 memset(cmsg, 0,
sizeof(cmsg));
2800 strncpy(cmsg, msg.toLatin1().data(),
sizeof(cmsg)-1);
2801 statusMsgKey.SetData(cmsg, 1, TID_STRING);
2815 PKey key(
fExp,
"/AutoRun/Run State");
2816 if (key.IsValid()) {
2818 int size =
sizeof(ival);
2819 int status = key.GetData(&ival, &size, TID_INT);
2820 if (status == DB_SUCCESS) {
2837 PKey key(
fExp,
"/AutoRun/Run State");
2838 if (key.IsValid()) {
2839 key.SetData((
void*)&state, 1, TID_INT);
2854 PKey larSeqKey(
fExp,
"/AutoRun/Auto Run Sequence");
2855 if (larSeqKey.IsValid()) {
2856 char autoRunSequence[64];
2857 int size =
sizeof(autoRunSequence);
2858 int status = larSeqKey.GetData(autoRunSequence, &size, TID_STRING);
2859 if (status == DB_SUCCESS)
2860 fln = autoRunSequence;
2875 bool showComments =
true;
2877 PKey key(
fExp,
"/AutoRun/Show Comments");
2878 if (key.IsValid()) {
2880 int size =
sizeof(ival);
2881 int status = key.GetData(&ival, &size, TID_BOOL);
2882 if (status == DB_SUCCESS) {
2884 showComments =
false;
2888 return showComments;
2900 PKey key(
fExp,
"/AutoRun/GotoLine");
2901 if (key.IsValid()) {
2902 key.SetData((
void*)&line, 1, TID_INT);
2916 PKey key(
fExp,
"/AutoRun/GotoLine");
2917 if (key.IsValid()) {
2919 int size =
sizeof(ival);
2920 int status = key.GetData(&ival, &size, TID_INT);
2921 if (status == DB_SUCCESS) {
2935 PKey larRunStateKey(
fExp,
"/AutoRun/Run State");
2936 if (larRunStateKey.IsValid()) {
2938 int size =
sizeof(int);
2939 larRunStateKey.GetData(&state, &size, TID_INT);
2945 PKey liveDataKey(
fExp,
"/AutoRun/LiveData");
2947 if (liveDataKey.IsValid()) {
2949 PKey *errorInLineKey =
new PKey(&liveDataKey,
"ErrorInLine");
2950 if (errorInLineKey == 0) {
2951 cm_msg(MDEBUG,
"lemAutoRun",
"**ERROR** couldn't invoke errorInLineKey");
2954 if (errorInLineKey->IsValid()) {
2956 for (
int i=0; i<10; i++) {
2959 errorInLineKey->SetData((
void *)&ival[0], 10, TID_INT);
2961 delete errorInLineKey;
2964 PKey *errorMsgKey =
new PKey(&liveDataKey,
"ErrorMsg");
2965 if (errorMsgKey == 0) {
2966 cm_msg(MDEBUG,
"lemAutoRun",
"**ERROR** couldn't invoke errorMsgKey");
2969 if (errorMsgKey->IsValid()) {
2971 for (
int i=0; i<10; i++) {
2972 memset(msg[i], 0, 128);
2973 strcpy(msg[i],
"empty");
2975 errorMsgKey->SetData((
void*)msg, 10, TID_STRING);
2979 cm_msg(MINFO,
"lemAutoRun",
"try to create default /AutoRun/LiveData record.");
2982 const char *lar_live_data_settings =
2983 "ErrorInLine = INT[10] : \n\ 2994 ErrorMsg = STRING[10] : \n\ 3005 CurrentLineNo = INT : -1\n\ 3006 LoopVal = STRING : [32] empty\n\ 3007 TransitionTag = INT : 0\n\ 3008 AutoRun = STRING : [32] empty\n\ 3010 if (db_create_record(
fExp->GetHdb(), 0,
"/AutoRun/LiveData", lar_live_data_settings) != DB_SUCCESS) {
3011 cm_msg(MERROR,
"lemAutoRun",
"**ERROR** couldn't create /AutoRun/LiveData default record.");
3023 cm_msg(MDEBUG,
"lemAutoRun",
"debug> noOfErrors=%d, idx=%d, line=%d, errMsg=%s", noOfErrors, idx, line, errorMsg.toLatin1().data()); cm_yield(0);
3025 PKey errorInLineKey(
fExp,
"/AutoRun/LiveData/ErrorInLine");
3026 PKey errorMsgKey(
fExp,
"/AutoRun/LiveData/ErrorMsg");
3027 PKey transTagKey(
fExp,
"/AutoRun/LiveData/TransitionTag");
3030 transTagKey.SetData((
void*)&ival, 1, TID_INT);
3033 if (noOfErrors != 0) {
3040 if (errorInLineKey.IsValid()) {
3041 errorInLineKey.SetDataIndex((
void *)&ival, i, TID_INT);
3043 if (errorMsgKey.IsValid()) {
3045 memset(msg, 0,
sizeof(msg));
3046 strncpy(msg, errorMsg.toLatin1().data(),
sizeof(msg));
3047 errorMsgKey.SetDataIndex(msg, i, TID_STRING);
3059 QString runStatePath =
"/AutoRun/Run State";
3060 PKey key(
fExp, runStatePath);
3061 if (key.IsValid()) {
3063 int size =
sizeof(ival);
3065 key.GetData((
void*)&ival, &size, TID_INT);
3069 key.SetData((
void*)&ival, 1, TID_INT);
3091 sprintf(msg,
"**ERROR** in line no %d (errorNo: %d)", line, errorNo);
3093 sprintf(msg,
"**ERROR** errorNo: %d", errorNo);
3111 QCoreApplication::exit(0);
3129 char str[NAME_LENGTH];
3130 for (
int i=0; ; i++) {
3132 if (
fClientsKey->EnumSubKey(i, &hKey) == DB_NO_MORE_SUBKEYS)
3136 status = db_get_value(
fClientsKey->GetHdb(), hKey,
"Name", str, &size, TID_STRING, FALSE);
3137 if (status != DB_SUCCESS) {
3138 QString err = QString(
"Autorun: check clients failure ...");
3140 err = QString(
"PLemAutoRun::CheckClients(): Couldn't get value from subkey.");
3144 if (!strncmp(str,
"lemAutoRun",
sizeof(str)))
3182 if (
fEnabled[
"trigger_events_odb"]) {
3185 err = QString(
"lemAutoRun: Trigger Events key not found.");
3195 err = QString(
"lemAutoRun: Alarms key not found.");
3202 if (
fEnabled[
"alarms_td_hv_trip_odb"]) {
3205 err = QString(
"lemAutoRun: Alarm TD HV trip trigger key not found.");
3212 if (status != DB_SUCCESS) {
3213 err = QString(
"lemAutoRun: Couldn't hotlink Alarm TD HV trip trigger flag.");
3222 err = QString(
"lemAutoRun: Run info key not found.");
3231 err = QString(
"lemAutoRun: Run comment key not found.");
3241 err = QString(
"lemAutoRun: TOF Min key not found.");
3251 err = QString(
"lemAutoRun: TOF Max key not found.");
3261 err = QString(
"lemAutoRun: Moderator name key not found.");
3271 err = QString(
"lemAutoRun: Moderator date key not found.");
3281 err = QString(
"lemAutoRun: LEM setup key not found.");
3288 if (
fEnabled[
"sample_name_info_odb"]) {
3291 err = QString(
"lemAutoRun: Sample Name key not found.");
3298 if (
fEnabled[
"spin_rot_calib_odb"]) {
3301 err = QString(
"lemAutoRun: spin rotation enabled key not found.");
3308 if (
fEnabled[
"spin_rot_angle_odb"]) {
3311 err = QString(
"lemAutoRun: spin rotation angle key not found.");
3318 if (
fEnabled[
"sample_cryo_info_odb"]) {
3321 err = QString(
"lemAutoRun: Sample Cryo key not found.");
3328 if (
fEnabled[
"energy_loss_param_odb"]) {
3334 err = QString(
"lemAutoRun: Energy loss parameter p%1 key not found.").arg(i);
3338 size =
sizeof(float);
3348 err = QString(
"lemAutoRun: Clients key not found.");
3357 err = QString(
"lemAutoRun: HV demand key not found.");
3365 err = QString(
"lemAutoRun: HV measured key not found.");
3373 err = QString(
"lemAutoRun: HV current key not found.");
3383 err = QString(
"lemAutoRun: HV Detectors demand key not found.");
3391 err = QString(
"lemAutoRun: HV Detectors measured key not found.");
3397 if (
fEnabled[
"danfysik_spin_rot_eq"]) {
3401 err = QString(
"lemAutoRun: Danfysik Spin Rotator input key not found.");
3409 err = QString(
"lemAutoRun: Danfysik Spin Rotator output key not found.");
3419 err = QString(
"lemAutoRun: Danfysik input key not found.");
3427 err = QString(
"lemAutoRun: Danfysik output key not found.");
3437 err = QString(
"lemAutoRun: WEW output key not found.");
3445 err = QString(
"lemAutoRun: WEW input key not found.");
3451 if (
fEnabled[
"magnet_field_info"]) {
3455 err = QString(
"lemAutoRun: magnetic field value key not found.");
3465 err = QString(
"lemAutoRun: tfl input key not found.");
3473 err = QString(
"lemAutoRun: tfl output key not found.");
3483 err = QString(
"lemAutoRun: sample cryo LS340 ctrl channel key not found.");
3489 size =
sizeof(ctrl_ch);
3491 if (strstr(ctrl_ch,
"A")) {
3493 }
else if (strstr(ctrl_ch,
"B")) {
3496 err = QString(
"lemAutoRun: sample cryo LS340 ctrl channel neither 'A' or 'B'. Needs to be fixed first!");
3504 err = QString(
"lemAutoRun: sample cryo LS340 channel assignment key not found.");
3512 err = QString(
"lemAutoRun: sample cryo LS340 sensor type assignment key not found.");
3520 err = QString(
"lemAutoRun: sample cryo input key not found.");
3527 if (status != DB_SUCCESS) {
3528 err = QString(
"lemAutoRun: Couldn't hotlink sample input variables.");
3536 err = QString(
"lemAutoRun: sample cryo output key not found.");
3543 if (status != DB_SUCCESS) {
3544 err = QString(
"lemAutoRun: Couldn't hotlink sample output variables.");
3551 err = QString(
"lemAutoRun: sample cryo 'raw voltage key' key not found.");
3561 err = QString(
"lemAutoRun: sample oven omega output key not found.");
3568 if (status != DB_SUCCESS) {
3569 err = QString(
"lemAutoRun: Couldn't hotlink sample oven omega input variables.");
3577 err = QString(
"lemAutoRun: sample oven omega output key not found.");
3584 if (status != DB_SUCCESS) {
3585 err = QString(
"lemAutoRun: Couldn't hotlink sample oven omega output variables.");
3595 err = QString(
"lemAutoRun: lemvac input key not found.");
3603 err = QString(
"lemAutoRun: lemvac output key not found.");
3613 err = QString(
"lemAutoRun: FOM input key not found.");
3621 err = QString(
"lemAutoRun: FOM output key not found.");
3631 err = QString(
"lemAutoRun: Beamline demand key not found.");
3637 if (
fEnabled[
"mag_param_wew_odb"]) {
3641 err = QString(
"lemAutoRun: Mag. Param. WEW calibration key not found.");
3649 err = QString(
"lemAutoRun: Mag. Param. WEW calibration with linear part == 0! Something is wrong!!");
3655 if (
fEnabled[
"mag_param_bpar_odb"]) {
3659 err = QString(
"lemAutoRun: Mag. Param. Bpar calibration key not found.");
3667 err = QString(
"lemAutoRun: Mag. Param. Bpar calibration with linear part == 0! Something is wrong!!");
3673 if (
fEnabled[
"setup_sample_odb"]) {
3677 err = QString(
"lemAutoRun: Sample setup enabled key not found.");
3682 size =
sizeof(ival);
3692 err = QString(
"lemAutoRun: WEW setup enabled key not found.");
3697 size =
sizeof(ival);
3707 err = QString(
"lemAutoRun: Bpar setup enabled key not found.");
3712 size =
sizeof(ival);
3721 char cryoName[NAME_LENGTH];
3722 size =
sizeof(cryoName);
3723 if (
fEnabled[
"sample_cryo_info_odb"])
3726 strcpy(cryoName,
"cryo");
3729 QDateTime dt(QDate::currentDate(), QTime::currentTime());
3730 QString dtStr = dt.toString(
"ddMMyy-hhmm");
3747 float energy_loss = 0.0;
3749 if (!
fEnabled[
"energy_loss_param_odb"])
3752 if (hv_mod < 20.1) {
3800 for (
int i=0; ; i++) {
3802 if (
fClientsKey->EnumSubKey(i, &subKey) == DB_NO_MORE_SUBKEYS)
3806 status = db_get_value(
fClientsKey->GetHdb(), subKey,
"Name", str, &size, TID_STRING, FALSE);
3807 if (status != DB_SUCCESS) {
3808 QString err = QString(
"Autorun: check clients failure ...");
3810 err = QString(
"PLemAutoRun::CheckClients(): Couldn't get value from subkey.");
3814 name = QString(str);
3887 char trigger_first[32];
3888 char trigger_last[32];
3889 char condition[256];
3890 char alarm_class[32];
3894 for (
int i=0; ; i++) {
3895 if (
fAlarmsKey->EnumSubKey(i, &subKey) == DB_NO_MORE_SUBKEYS)
3898 size =
sizeof(alarmData);
3899 status = db_get_record(
fAlarmsKey->GetHdb(), subKey, &alarmData, &size, 0);
3900 if (status != DB_SUCCESS) {
3901 QString err = QString(
"Autorun: check alarms failure ...");
3903 err = QString(
"PLemAutoRun::CheckMidasAlarms(): Couldn't get value from subkey.");
3906 if (alarmData.triggered && strstr(alarmData.alarm_class,
"Alarm")) {
3909 QString err = QString(
"Autorun: Alarm fired ...");
3911 err = QString(
"PLemAutoRun::CheckMidasAlarms: Alarm fired! ")+
3912 QString(
" msg: %1 ").arg(alarmData.alarm_msg)+
3913 QString(
" Error too severe, will stop.");
3916 QCoreApplication::exit(0);
3938 int imonth, day, year, hour, min, sec, msec;
3939 double days = 0, result;
3940 int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
3943 status = sscanf(str,
"%d,%d,%d,%d,%d,%d,%d", &imonth, &day, &year, &hour, &min, &sec, &msec);
3949 for (
int i=2006; i<year; i++) {
3950 if ( ((i % 4) == 0 && (i % 100) != 0) || (i % 400) == 0 )
3955 if ( ((year % 4) == 0 && (year % 100) != 0) || (year % 400) == 0 ) month[1] = 29;
3957 for (
int i = 1; i<imonth; i++ ) days = days + month[i-1];
3960 result = (double)days * 86400.0 + (
double)hour * 3600.0 + (double)min * 60.0 +
3961 (
double)sec + (double)msec / 1000.0;
4069 double denominator = -s * sxx * sxxxx + s * sxxx * sxxx + sx * sx * sxxxx
4070 - 2.0 * sxxx * sx * sxx + sxx * sxx * sxx;
4072 if ( fabs( denominator ) > 0.0 ) {
4074 sT * sxx * sxxxx - sT * sxxx * sxxx) / denominator;
4076 sh * sxx * sxxxx - sh * sxxx * sxxx) / denominator;
4078 sf * sxx * sxxxx - sf * sxxx * sxxx) / denominator;
4080 sp * sxx * sxxxx - sp * sxxx * sxxx) / denominator;
4082 sxx * sxxx * sT - sx * sT * sxxxx) / denominator;
4084 sxx * sxxx * sh - sx * sh * sxxxx) / denominator;
4085 fSampleTempTrend.
flow = -(- s * sxxx * sxxf + s * sxf * sxxxx - sxf * sxx * sxx + sxx * sx * sxxf +
4086 sxx * sxxx * sf - sx * sf * sxxxx) / denominator;
4088 sxx * sxxx * sp - sx * sp * sxxxx) / denominator;
4090 sxx * sx * sxT + sxx * sxx * sT) / denominator;
4092 sxx * sx * sxh + sxx * sxx * sh) / denominator;
4094 sxx * sx * sxf + sxx * sxx * sf) / denominator;
4096 sxx * sx * sxp + sxx * sxx * sp) / denominator;
4125 std::cout << std::endl <<
"SampleTempTrend:";
4126 std::cout << std::endl <<
" fSampleTempAverage (T, heater, flow, pressure):";
4131 std::cout << std::endl <<
" fSampleTempTrend (T, heater, flow, pressure):";
4136 std::cout << std::endl <<
" fSampleTempSecond (T, heater, flow, pressure):";
4141 std::cout << std::endl <<
" fSampleTempRmsqd (T, heater, flow, pressure):";
4146 std::cout << std::endl;
4166 int hr = (int)heaterRange;
4169 std::cout << std::endl <<
"in SampleTempPrefHeaterOutput: hr = " << hr;
4198 float p_heat, d_heat, pref_heat;
4201 std::cout << std::endl <<
"in SampleTempAdjustFlow ...";
4213 std::cout << std::endl <<
"--------------------";
4215 std::cout << std::endl <<
"SampleTempAdjustFlow: p_heat = " << p_heat <<
", d_heat = " << d_heat <<
", pref_heat = " << pref_heat;
4217 std::cout << std::endl <<
"change = " << change;
4218 std::cout << std::endl <<
"SampleTempAdjustFlow: new flow value = " << value;
4246 std::cout << std::endl <<
"in SampleTempStable. maxdiff = " << maxdiff;
4254 std::cout << std::endl <<
"in SampleTempStable. stability reached.";
4270 float value = 1.0e6;
4278 std::cout << std::endl <<
"in SampleTempConsiderNeedleValve ...";
4281 size =
sizeof(modus);
4285 size =
sizeof(bh_valve);
4289 size =
sizeof(needle_valve);
4291 if (bh_valve > 0.9) {
4292 size =
sizeof(demand_flow);
4307 std::cout << std::endl <<
"in SampleTempConsiderNeedleValve: value = " << value;
4336 int size =
sizeof(float);
4339 QString err = QString(
"PLemAutoRun::SampleTempSetNeedleValve(): TFL(%1) and/or Sample(%2) equipment not available. Do nothing here.").arg(
fEnabled[
"tfl_eq"]).arg(
fEnabled[
"sample_eq"]);
4348 size =
sizeof(float);
4378 int size =
sizeof(float);
4381 cm_msg(MDEBUG,
"SampleTempConsiderFlow",
"in SampleTempConsiderFlow ...");
4394 cm_msg(MINFO,
"SampleTempConsiderFlow",
"SampleTempConsiderFlow, demand = %e", demand);
4401 cm_msg(MINFO,
"SampleTempConsiderFlow",
4402 "SampleTempConsiderFlow: skipped consideration, demand = %e, present flow = %e",
4421 if (fabs( change - 1.0 ) > 0.001 ) {
4434 cm_msg(MDEBUG,
"SampleTempConsiderFlow",
"SampleTempConsiderFlow: new flow=%f", value);
4441 cm_msg(MDEBUG,
"SampleTempConsiderFlow",
"SampleTempConsiderFlow: new flow value = %f",
fSampleTempAverage.
flow * change);
4442 cm_msg(MDEBUG,
"SampleTempConsiderFlow",
"SampleTempConsiderFlow: (change = %f, fSampleTempAverage.flow = %f)", change,
fSampleTempAverage.
flow);
4444 std::cout << std::endl <<
"SampleTempConsiderFlow: new flow value = " <<
fSampleTempAverage.
flow * change;
4445 std::cout <<
" (change = " << change <<
", fSampleTempAverage.flow = " <<
fSampleTempAverage.
flow <<
")";
4465 static int tempDeviationToHighCounter = 0;
4468 std::cout << std::endl <<
"in CheckTempStability ...";
4472 err += QString(
"Does not make any sense!");
4514 std::cout << std::endl <<
"Timedate History: " <<
fSampleHistoPos << std::endl;
4519 std::cout << datetime.toLatin1().data() <<
", ";
4521 std::cout << std::endl;
4522 std::cout << std::endl <<
"Temperature History: " <<
fSampleHistoPos << std::endl;
4528 std::cout << std::endl;
4536 tempDeviationToHighCounter++;
4544 tempDeviationToHighCounter = 0;
4599 PAutoRunCmdVector::Iterator iter;
4603 if ( !file.open( QIODevice::WriteOnly ) ) {
4604 QString err = QString(
"PLemAutoRun::UpdateWebPage(): Couldn't open %1").arg(
fXMLAutoRunHTML);
4610 QTextStream stream( &file );
4613 stream <<
"<html>" << Qt::endl;
4616 stream <<
" <head>" << Qt::endl;
4617 stream <<
"<link rel=\"stylesheet\" href=\"mhttpd.css\" type=\"text/css\" />" << Qt::endl;
4618 stream <<
" <title>LEM Autorun Parameter Page</title>" << Qt::endl;
4619 stream <<
" <meta http-equiv=\"Refresh\" content=\"30\">" << Qt::endl;
4620 stream <<
" <script type=\"text/javascript\" src=\"mhttpd.js\"></script>" << Qt::endl;
4621 stream <<
" <script type=\"text/javascript\" src=\"midas.js\"></script>" << Qt::endl;
4622 stream <<
" <script type=\"text/javascript\" src=\"obsolete.js\"></script>" << Qt::endl;
4623 stream <<
" <script type=\"text/javascript\">" << Qt::endl;
4624 stream <<
" var lar_state;" << Qt::endl;
4625 stream <<
" function lar_running()" << Qt::endl;
4626 stream <<
" {" << Qt::endl;
4627 stream <<
" var result=confirm(\"Are you sure you want to start the autorun?\")" << Qt::endl;
4628 stream <<
" if (result==true) {" << Qt::endl;
4629 stream <<
" ODBSet(\"/AutoRun/Run State\", \"2\");" << Qt::endl;
4630 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << Qt::endl;
4631 stream <<
" }" << Qt::endl;
4632 stream <<
" }" << Qt::endl;
4634 stream <<
" function lar_resume()" << Qt::endl;
4635 stream <<
" {" << Qt::endl;
4636 stream <<
" ODBSet(\"/AutoRun/Run State\", \"3\");" << Qt::endl;
4637 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << Qt::endl;
4638 stream <<
" }" << Qt::endl;
4640 stream <<
" function lar_stop()" << Qt::endl;
4641 stream <<
" {" << Qt::endl;
4642 stream <<
" var result=confirm(\"Are you sure you want to stop the autorun?\")" << Qt::endl;
4643 stream <<
" if (result==true) {" << Qt::endl;
4644 stream <<
" ODBSet(\"/AutoRun/Run State\", \"0\");" << Qt::endl;
4645 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << Qt::endl;
4646 stream <<
" }" << Qt::endl;
4647 stream <<
" }" << Qt::endl;
4649 stream <<
" function lar_pause()" << Qt::endl;
4650 stream <<
" {" << Qt::endl;
4651 stream <<
" ODBSet(\"/AutoRun/Run State\", \"1\");" << Qt::endl;
4652 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << Qt::endl;
4653 stream <<
" }" << Qt::endl;
4655 stream <<
" function lar_load()" << Qt::endl;
4656 stream <<
" {" << Qt::endl;
4657 stream <<
" ODBSet(\"/AutoRun/Run State\", \"4\");" << Qt::endl;
4658 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << Qt::endl;
4659 stream <<
" }" << Qt::endl;
4661 stream <<
" function lar_refresh()" << Qt::endl;
4662 stream <<
" {" << Qt::endl;
4663 stream <<
" window.location.reload(true);" << Qt::endl;
4664 stream <<
" }" << Qt::endl;
4665 stream <<
" function compProp(prop_odb) {" << Qt::endl;
4666 stream <<
" fetch('https://duo.psi.ch/duo/rest.php/cal/smus/lem?SECRET=change-bib-eva-grille',{method:'POST'})" << Qt::endl;
4667 stream <<
" .then( data => data.json(), console.error)" << Qt::endl;
4668 stream <<
" .then( data => {" << Qt::endl;
4669 stream <<
" console.log('propid_duo:', data.proposal);" << Qt::endl;
4670 stream <<
" if (data.proposal != prop_odb ) {" << Qt::endl;
4671 stream <<
" alert(\"The proposal number does NOT match the official schedule!\");" << Qt::endl;
4672 stream <<
" }" << Qt::endl;
4673 stream <<
" });" << Qt::endl;
4674 stream <<
" }" << Qt::endl;
4675 stream <<
" mjsonrpc_db_get_values([\"/Info/File_Header_Info/Proposal Number\"])" << Qt::endl;
4676 stream <<
" .then(function(rpc) {console.log('propid_odb:', rpc.result.data[0]);" << Qt::endl;
4677 stream <<
" compProp(rpc.result.data[0]);});" << Qt::endl;
4678 stream <<
" " << Qt::endl;
4679 stream <<
" " << Qt::endl;
4680 stream <<
" " << Qt::endl;
4681 stream <<
" </script>" << Qt::endl;
4682 stream <<
" </head>" << Qt::endl;
4685 stream <<
" <body style=\"font-size: 10pt;\">" << Qt::endl;
4686 stream <<
" <form name=\"form1\" method=\"Get\" action=\"/CS/AutoRun&\">" << Qt::endl;
4687 stream <<
" <input type=\"hidden\" name=\"exp\" value=\"" <<
fExpName.toLatin1().data() <<
"\">" << Qt::endl;
4688 stream <<
" <table border=3 cellpadding=2 class=\"genericTable\">" << Qt::endl;
4689 stream <<
" <tr><th colspan=3 class=\"subStatusTitle\">NEMU Experiment: Autorun Parameters</th></tr>" << Qt::endl;
4690 stream <<
" <tr><td colspan=3>" << Qt::endl;
4691 stream <<
" <input value=\"Status\" name=\"cmd\" type=\"submit\">" << Qt::endl;
4692 stream <<
" <input value=\"ODB\" name=\"cmd\" type=\"submit\">" << Qt::endl;
4693 stream <<
" <input value=\"Messages\" name=\"cmd\" type=\"submit\">" << Qt::endl;
4694 stream <<
" </td></tr>" << Qt::endl;
4695 stream <<
" <tr><td colspan=3 style=\"text-align:left;\">" << Qt::endl;
4696 stream <<
" <script type=\"text/javascript\">" << Qt::endl;
4697 stream <<
" lar_state = ODBGet('/AutoRun/Run State');" << Qt::endl;
4698 stream <<
" if ((lar_state == 0) || (lar_state == 2) || (lar_state == 4) || (lar_state == 5)) { // stopped or starting up" << Qt::endl;
4699 stream <<
" document.write('<input type=\"button\" value=\"Start AutoRun\" onclick=\"lar_running()\">');" << Qt::endl;
4700 stream <<
" document.write('<input type=\"button\" value=\"Load Sequence\" onclick=\"lar_load()\">');" << Qt::endl;
4701 stream <<
" } else if (lar_state == 1) { // paused" << Qt::endl;
4702 stream <<
" document.write('<input type=\"button\" value=\"Resume AutoRun\" onclick=\"lar_resume()\">');" << Qt::endl;
4703 stream <<
" } else { // running" << Qt::endl;
4704 stream <<
" document.write('<input type=\"button\" value=\"Stop AutoRun\" onclick=\"lar_stop()\">');" << Qt::endl;
4705 stream <<
" document.write(' ');" << Qt::endl;
4706 stream <<
" document.write('<input type=\"button\" value=\"Pause AutoRun\" onclick=\"lar_pause()\">');" << Qt::endl;
4707 stream <<
" }" << Qt::endl;
4708 stream <<
" </script>" << Qt::endl;
4709 stream <<
" </td></tr>" << Qt::endl;
4710 stream <<
" <tr><td class=\"ODBtableEven\" colspan=3 style=\"text-align:left;\">Sample Name: <b><odb src=\"/Info/Sample Name\" edit=2></b></td>" << Qt::endl;
4711 stream <<
" <tr><td class=\"ODBtableOdd\" colspan=2 style=\"text-align:left;\">Proposal Number: <b><odb src=\"/Info/File_Header_Info/Proposal Number\" edit=2></b></td>" << Qt::endl;
4712 stream <<
" <td class=\"ODBtableOdd\" style=\"text-align:left;\">PI: <b><odb src=\"/Info/File_Header_Info/Main Proposer\" edit=2></b></td>" << Qt::endl;
4713 stream <<
" <tr><td class=\"ODBtableOdd\" colspan=2 style=\"text-align:left;\">Sequence: <b><odb src=\"/AutoRun/Auto Run Sequence\" edit=2></b></td>" << Qt::endl;
4714 stream <<
" <td class=\"ODBtableOdd\" style=\"text-align:left;\">Show Comments: <b><odb src=\"/AutoRun/Show Comments\" edit=2></b></td></tr>" << Qt::endl;
4715 stream <<
" <tr><td class=\"ODBtableEven\" colspan=2 style=\"text-align:left;\">Goto Line: <b><odb src=\"/AutoRun/GotoLine\" edit=2></b></td>" << Qt::endl;
4716 stream <<
" <td class=\"ODBtableEven\" style=\"text-align:left;\">Next : <b><odb src=\"/AutoRun/Next\" edit=2></b></td></tr>" << Qt::endl;
4717 stream <<
" <tr><td colspan=3 style=\"text-align:left;\">Status : <b><odb src=\"/AutoRun/Status\" edit=0></b></td></tr>" << Qt::endl;
4720 stream <<
" <tr><td colspan=3 style=\"text-align:left;font-family:Fixed;line-height:1.25\" bgcolor=\"#FFFFFF\">" << Qt::endl;
4721 stream <<
" <pre>" << Qt::endl;
4724 if (errLineNo > 0) {
4729 QTextStream fstream(&f);
4733 f.open(QIODevice::ReadOnly);
4734 while (!fstream.atEnd()) {
4735 line = fstream.readLine();
4736 stream << lineNo <<
": " << line << Qt::endl;
4737 if (lineNo == errLineNo) {
4738 stream <<
"<span style=\"background-color: #FF8800;font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4745 stream <<
"<span style=\"background-color: #FF8800;font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4748 stream <<
"<span style=\"background-color: #FF8800font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4751 stream <<
"<span style=\"background-color: #FF0000font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4756 QDateTime dt = QDateTime::currentDateTime();
4757 cmd = QString(
"<span style=\"background-color: #11FF11;font-weight: bold;\">>> %1: SEQUENCE LOADED ONLY, PRESS START AUTORUN BOTTOM IF YOU WANT TO START IT <<</span>").arg(dt.toString(
"dd.MM.yy, hh:mm:ss"));
4758 stream << cmd << Qt::endl;
4762 int width = 0, count = 0;
4770 if ((iter == currentIter) && (tag !=
HTML_LOAD))
4771 cmd =
"<span style=\"background-color: #FFFF00;font-weight: bold;\">";
4776 cmd += QString(
"%1 (%2): ").arg(count, width).arg(iter->lineNo, width);
4779 if (iter->cmd ==
"comment")
4780 cmd +=
"<span style=\"color:grey;font-style:italic\">";
4782 cmd += iter->cmdString;
4784 if (iter->cmd ==
"comment")
4787 if (iter == currentIter) {
4789 if (!errMsg.isEmpty())
4790 cmd += QString(
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">%1</span></span>").arg(errMsg);
4791 cmd +=
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">AUTORUN ABORTED ...</span></span>";
4793 cmd +=
"\nEXECUTING WARMUP COMMAND ...</span>";
4795 cmd +=
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">ALARM FIRED, HENCE AUTORUN STOPPED...</span></span>";
4797 cmd +=
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">THERE IS ALREADY A RUN GOING ON. AUTORUN WILL ONLY START THE FIRST COMMAND AFTER THE CURRENT RUN WILL BE STOPPED ...</span></span>";
4803 stream << cmd << Qt::endl;
4807 cmd =
"<span style=\"background-color: #FFFF00;font-weight: bold;\">AUTORUN FINISHED ...</span>";
4808 stream << cmd << Qt::endl;
4812 stream <<
" </pre>" << Qt::endl;
4813 stream <<
" </td></tr>" << Qt::endl;
4814 stream <<
" </table>" << Qt::endl;
4815 stream <<
" </form>" << Qt::endl;
4816 stream <<
" </body>" << Qt::endl;
4819 stream <<
"</html>" << Qt::endl;
4834 INT status = db_find_key(
fExp->GetHdb(), 0,
"/AutoRun/LiveData/AutoRun", &hKey);
4835 if (status == DB_SUCCESS) {
4836 status = db_delete_key(
fExp->GetHdb(), hKey, TRUE);
4844 QTextStream fstream(&f);
4846 QVector<QString> data;
4848 f.open(QIODevice::ReadOnly);
4849 while (!fstream.atEnd()) {
4850 line = fstream.readLine();
4851 data.push_back(line);
4858 for (
int i=0; i<data.size(); i++) {
4859 memset(str, 0,
sizeof(str));
4860 strncpy(str, data[i].toLatin1(),
sizeof(str));
4861 status = db_set_value_index(
fExp->GetHdb(), 0,
"/AutoRun/LiveData/AutoRun", str,
sizeof(str), i, TID_STRING, FALSE);
4873 PAutoRunCmdVector::Iterator iter;
4876 bool aborted =
false;
4881 QString msg(
"**FATAL ERROR** no autorun commands present!!");
4915 if (iter->cmd ==
"comment")
4917 if (iter->lineNo > maxCount)
4918 maxCount = iter->lineNo;
4924 PKey transTagKey(
fExp,
"/AutoRun/LiveData/TransitionTag");
4925 if (!transTagKey.IsValid()) {
4926 QString msg(
"**FATAL ERROR** cannot get necessary key /AutoRun/LiveData/TransitionTag!");
4932 transTagKey.SetData((
void*)&ival, 1, TID_INT);
4940 QString msg(
"Loading Sequence ...");
4953 bool runningWhenStarting =
false;
4958 runningWhenStarting =
true;
4961 PKey lineNoKey(
fExp,
"/AutoRun/LiveData/CurrentLineNo");
4962 if (!lineNoKey.IsValid()) {
4963 QString msg(
"**FATAL ERROR** cannot get necessary key /AutoRun/LiveData/CurrentLineNo!");
4969 PKey loopValKey(
fExp,
"/AutoRun/LiveData/LoopVal");
4970 if (!loopValKey.IsValid()) {
4971 QString msg(
"**FATAL ERROR** cannot get necessary key /AutoRun/LiveData/LoopVal!");
4981 lineNoKey.SetData(&(iter->lineNo), 1, TID_INT);
4984 char loopValStr[32];
4985 memset(loopValStr, 0,
sizeof(loopValStr));
4986 if (iter->loopVal.isEmpty())
4987 strncpy(loopValStr,
"empty",
sizeof(loopValStr));
4989 strncpy(loopValStr, iter->loopVal.toLatin1().data(),
sizeof(loopValStr));
4990 loopValKey.SetData(loopValStr, 1, TID_STRING);
4998 !((iter->cmd ==
"setWait") || (iter->cmd ==
"runStop") ||
4999 (iter->cmd ==
"warmUp") || (iter->cmd ==
"alias") || (iter->cmd ==
"comment") ||
5000 (iter->cmd ==
"odbTag"))) {
5007 if ((iter->cmd ==
"alias") || (iter->cmd ==
"odbTag") || (iter->cmd ==
"comment")) {
5011 if ((iter->cmd ==
"alias") || (iter->cmd ==
"odbTag"))
5023 QString err(
"STOP cmd for a stopped run doesn't make any sense. Will change the STOP to a START cmd!");
5025 iter->cmd =
"runStart";
5026 iter->cmdString =
"START " + iter->param[0];
5027 if (iter->noElements == 2) {
5028 iter->cmdString +=
" sec";
5035 runningWhenStarting =
false;
5051 runningWhenStarting =
false;
5060 if (iter->cmd ==
"runStart") {
5062 }
else if (iter->cmd ==
"degaussWEW") {
5065 }
else if (iter->cmd ==
"degaussDanfysik") {
5068 }
else if (iter->cmd ==
"degaussMagnet") {
5071 }
else if (iter->cmd ==
"degaussSpinRot") {
5074 }
else if (iter->cmd ==
"ignore_alarms") {
5077 }
else if (iter->cmd ==
"ignore_clients") {
5080 }
else if (iter->cmd ==
"setBPV") {
5083 }
else if (iter->cmd ==
"setDump") {
5086 }
else if (iter->cmd ==
"setFOM") {
5089 }
else if (iter->cmd ==
"setFieldWEWL") {
5092 }
else if (iter->cmd ==
"setFieldWEWH") {
5095 }
else if (iter->cmd ==
"setFieldDanfysik") {
5098 }
else if (iter->cmd ==
"setField") {
5101 }
else if (iter->cmd ==
"setSpinRot") {
5104 }
else if (iter->cmd ==
"setLEMSetup") {
5107 }
else if (iter->cmd ==
"setModInfo") {
5110 }
else if (iter->cmd ==
"setOdbData") {
5113 }
else if (iter->cmd ==
"setOdbDataArray") {
5116 }
else if (iter->cmd ==
"setSampleHV") {
5119 }
else if (iter->cmd ==
"setRA_HV") {
5122 }
else if (iter->cmd ==
"setTransportHV") {
5125 }
else if (iter->cmd ==
"setHVOff") {
5128 }
else if (iter->cmd ==
"setTfl") {
5131 }
else if (iter->cmd ==
"setTemp") {
5134 }
else if (iter->cmd ==
"setTitle") {
5137 }
else if (iter->cmd ==
"setTOF") {
5140 }
else if (iter->cmd ==
"setWait") {
5143 }
else if (iter->cmd ==
"warmUp") {
5151 fExp->FeedMidasWatchdog();
5195 transTagKey.SetData((
void*)&ival, 1, TID_INT);
5199 transTagKey.SetData((
void*)&ival, 1, TID_INT);
5202 int size =
sizeof(ival);
5203 lineNoKey.GetData((
void*)&ival, &size, TID_INT);
5205 lineNoKey.SetData((
void*)&ival, 1, TID_INT);
5208 QString msg = QString(
"Autorun finished.");
5215 PKey nextAutoRun(
fExp,
"/AutoRun/Next");
5216 if (nextAutoRun.IsValid()) {
5218 int size =
sizeof(next);
5219 nextAutoRun.GetData(next, &size, TID_STRING);
5221 if (!strcmp(next,
"none")) {
5228 transTagKey.SetData((
void*)&ival, 1, TID_INT);
5261 QString err = msg + QString(
"PLemAutoRun::RunStart(): VME_FE(%1) and/or Analyzer(%2) not enabled. Do nothing here.").arg(
fEnabled[
"vme_fe"]).arg(
fEnabled[
"analyzer_fe"]);
5270 err = QString(
"PLemAutoRun::RunStart: ");
5275 err += QString(
"not running, will stop! Fix it first ;-)");
5279 QCoreApplication::exit(0);
5287 err = QString(
"PLemAutoRun::RunStart: BPVX still closed! Check also sample regions HV's");
5291 err = QString(
"PLemAutoRun::RunStart: BPVY still closed! Check also sample regions HV's");
5301 size =
sizeof(fval);
5302 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
5304 err = QString(
"PLemAutoRun::RunStart: RA HV's < 0.2kV! Unlikely to be correct, please check!");
5312 float wew_input[11];
5313 size =
sizeof(wew_input);
5325 size =
sizeof(fval);
5326 fWEWInputKey->GetDataIndex(&fval, &size, current_idx, TID_FLOAT);
5329 size =
sizeof(fval);
5330 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
5332 err = QString(
"PLemAutoRun::RunStart: RA HV's < 0.2kV! Unlikely to be correct, please check!");
5348 if (status != CM_SUCCESS) {
5350 err = QString(
"PLemAutoRun::RunStart: Cannot start the run.");
5360 std::cout << std::endl <<
"RunStart: Runinfo.state = " <<
fRunInfo.
state;
5363 if (t.elapsed() > 60e3) {
5364 err = QString(
"PLemAutoRun::RunStart: Didn't get run transition after run started.");
5381 msg = QString(
"Autorun running: ") + msg;
5411 QString err = msg + QString(
"PLemAutoRun::RunStop(): VME_FE(%1) and/or Analyzer(%2) not enabled. Do nothing here.").arg(
fEnabled[
"vme_fe"]).arg(
fEnabled[
"analyzer_fe"]);
5421 QString err = QString(
"PLemAutoRun::RunStop: ");
5426 err += QString(
"not running, will stop! Fix it first ;-)");
5430 QCoreApplication::exit(0);
5459 bool stopped =
false;
5472 QString err = QString(
"PLemAutoRun::RunStopCheck: ");
5477 err += QString(
"not running, will stop! Fix it first ;-)");
5480 QCoreApplication::exit(0);
5486 size =
sizeof(value);
5488 if (status != DB_SUCCESS) {
5490 err =
"PLemAutoRun::RunStopCheck: Couldn't get current number of events";
5497 if (status != CM_SUCCESS) {
5499 err = QString(
"PLemAutoRun::RunStart: Cannot stop the run.");
5503 err = QString(
"Autorun running: run stopped.");
5505 err = QString(
">> End of run; read=%1 of requested = %2").arg(value).arg(
fRunNoEventsNeeded);
5515 if (status != CM_SUCCESS) {
5517 err = QString(
"PLemAutoRun::RunStart: Cannot stop the run.");
5521 err = QString(
"Autorun running: run stopped.");
5523 err = QString(
">> End of run; read=%1 of requested = %2").arg(value).arg(
fRunNoEventsNeeded);
5553 float fval, maxField;
5559 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: WEWL current out of range (%1 A > %2 A) in line %3").arg(fval).arg(
fWEWLMaxCurrent).arg(
fAutoRunCmdVector->at(i).lineNo);
5565 if (fabs(fval) > maxField) {
5566 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: WEW field out of range (%1 G > %2 G) in line %3").arg(fval).arg(maxField).arg(
fAutoRunCmdVector->at(i).lineNo);
5575 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: WEWH current out of range (%1 A > %2 A) in line %3").arg(fval).arg(
fWEWHMaxCurrent).arg(
fAutoRunCmdVector->at(i).lineNo);
5581 if (fabs(fval) > maxField) {
5582 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: WEW field out of range (%1 G > %2 G) in line %3").arg(fval).arg(maxField).arg(
fAutoRunCmdVector->at(i).lineNo);
5597 if (fabs(fval) > maxField) {
5598 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: Bpar field out of range (%1 G > %2 G) in line %3").arg(fval).arg(maxField).arg(
fAutoRunCmdVector->at(i).lineNo);
5608 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: WEW current out of range (%1 A > %2 A) in line %3").arg(fval).arg(
fWEWHMaxCurrent).arg(
fAutoRunCmdVector->at(i).lineNo);
5614 if (fabs(fval) > maxField) {
5615 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: WEW field out of range (%1 G > %2 G) in line %3").arg(fval).arg(maxField).arg(
fAutoRunCmdVector->at(i).lineNo);
5629 if (fabs(fval) > maxField) {
5630 errMsg = QString(
"PLemAutoRun::CheckFieldCmd: Bpar field out of range (%1 G > %2 G) in line %3").arg(fval).arg(maxField).arg(
fAutoRunCmdVector->at(i).lineNo);
5657 float current_wewh[3] = {+600.0, -40.0, 0.0};
5658 float current_wewl[3] = {+50.0, -45.0, 0.0};
5683 QString err = QString(
"PLemAutoRun::DegaussWEW: WEW Slowcontrol Frontend NOT running. Error too severe, will stop.");
5686 QCoreApplication::exit(0);
5693 msg = QString(
"Autorun running: ") + msg;
5698 size =
sizeof(fval);
5702 size =
sizeof(fval);
5706 size =
sizeof(fval);
5710 size =
sizeof(fval);
5714 size =
sizeof(fval);
5727 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: RA HV down. Will wait 5 sec to settle things.");
5745 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: set WEWL/H demand current to zero");
5752 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: switch off WEWL");
5759 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: unlock WEW/SSP");
5766 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: switch on WEWH");
5769 for (
unsigned int i=0; i<3; i++) {
5770 fval = current_wewh[i];
5773 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: set current %f A via WEWH.", fval);
5779 size =
sizeof(fval);
5781 }
while (fabs(fabs(fval)-fabs(current_wewh[i])) > 2.0);
5787 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: switch WEWH off, WEWL on.");
5796 size =
sizeof(fval);
5798 timeDiff = tt.elapsed();
5799 if (timeDiff % 500 < 50)
5801 }
while ((fval != 0.0) && (timeDiff < 120000));
5802 if (timeDiff >= 120000) {
5804 QString err = QString(
"PLemAutoRun::DegaussWEW: Couldn't switch off WEWH - check. Error too severe, will stop.");
5807 QCoreApplication::exit(0);
5818 bool try_again =
false;
5820 size =
sizeof(fval);
5822 timeDiff = tt.elapsed();
5823 if (timeDiff % 500 < 50)
5825 if ((timeDiff >= 60000) && !try_again) {
5836 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: couldn't switch on the WEWL yet, will try again.");
5838 }
while ((fval != 1.0) && (timeDiff < 120000));
5839 if (timeDiff >= 120000) {
5841 QString err = QString(
"PLemAutoRun::DegaussWEW: Couldn't switch on WEWL - check. Error too severe, will stop.");
5844 QCoreApplication::exit(0);
5849 for (
unsigned int i=0; i<3; i++) {
5850 fval = current_wewl[i];
5853 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: set current %f A via WEWL.", fval);
5859 size =
sizeof(fval);
5861 }
while (fabs(fabs(fval)-fabs(current_wewl[i])) > 0.2);
5869 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: lock WEW/SSP");
5873 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: ramping back RA HV's.");
5889 size =
sizeof(fval);
5891 if (fabs(fval-hv[0]) < 0.2)
5895 size =
sizeof(fval);
5897 if (fabs(fval-hv[1]) < 0.2)
5901 size =
sizeof(fval);
5903 if (fabs(fval-hv[2]) < 0.2)
5907 size =
sizeof(fval);
5909 if (fabs(fval-hv[3]) < 0.2)
5913 size =
sizeof(fval);
5915 if (fabs(fval-hv[4]) < 0.2)
5922 if (tt.elapsed() > 300000) {
5923 QString err = QString(
"lemAutoRun: **WARNING** Sample region HV's couldn't be ramped back within 5min.");
5933 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: degauss done.");
5947 float currentFieldValue;
5963 QString err = QString(
"PLemAutoRun::DegaussDanfysik: Danfysik Slowcontrol Frontend NOT running. Error too severe, will stop.");
5966 QCoreApplication::exit(0);
5973 msg = QString(
"Autorun running: ") + msg;
5977 currentFieldValue = -8.0;
5979 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: set Bpar current to -8.0A");
5986 currentFieldValue = +8.0;
5988 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: set Bpar current to +8.0A");
5997 currentFieldValue /= -2.0;
5999 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: set Bpar current to %.2f A", currentFieldValue);
6004 }
while (fabs(currentFieldValue) > 0.1);
6007 currentFieldValue = 0.0;
6009 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: done");
6046 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6053 if (!
fEnabled[
"danfysik_spin_rot_eq"]) {
6055 msg += QString(
"PLemAutoRun::DegaussSpinRot: danfysik spin rot equipment is disabled. Will do nothing here.");
6066 QString err = QString(
"PLemAutoRun::DegaussSpinRot: Slowcontrol Frontend NOT running. Error too severe, will stop.");
6069 QCoreApplication::exit(0);
6076 msg = QString(
"Autorun running: ") + msg;
6080 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: shut down Spin Rot HV's.");
6126 if (t.elapsed() > timeout) {
6129 msg = QString(
"Couldn't shut down Spin Rot HVs within %1 sec: will give it another try in 120 sec.").arg(
fHVTimeout);
6148 msg = QString(
"Couldn't shut down the Spin Rotator HV, even after a few trials :-( .");
6154 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to 0.");
6166 size =
sizeof(value);
6169 if (fabs(value) < 0.1)
6173 if (t.elapsed() > timeout) {
6176 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6185 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to 12.0 A.");
6197 size =
sizeof(value);
6200 if (fabs(value-12.0) < 0.1)
6204 if (t.elapsed() > timeout) {
6207 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6216 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to -1.3 A.");
6228 size =
sizeof(value);
6231 if (fabs(value+1.3) < 0.1)
6235 if (t.elapsed() > timeout) {
6238 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6247 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to 0 - done.");
6259 size =
sizeof(value);
6262 if (fabs(value) < 0.1)
6266 if (t.elapsed() > timeout) {
6269 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6296 msg = QString(
"Autorun running: ") + msg;
6299 if ((arc->
param[0] ==
"yes") || (arc->
param[0] ==
"1") || (arc->
param[0] ==
"true"))
6322 msg = QString(
"Autorun running: ") + msg;
6325 if ((arc->
param[0] ==
"yes") || (arc->
param[0] ==
"1") || (arc->
param[0] ==
"true"))
6349 msg += QString(
"PLemAutoRun::SetDump: sample equipment is disabled. Will do nothing here.");
6359 msg = QString(
"Autorun running: ") + msg;
6367 fDumpFile.open(QIODevice::WriteOnly | QIODevice::Append);
6370 static bool write_header =
true;
6373 write_header =
false;
6377 int size =
sizeof(ctrl_ch);
6381 char sensor_ch[10][4];
6382 size =
sizeof(sensor_ch[0]);
6388 int sensor_type[10];
6396 stream <<
"%--------------------------------------------------------------------------" << Qt::endl;
6397 stream <<
"% Number of Entries : 21" << Qt::endl;
6398 stream <<
"% Number of Raw Data Reading : 8" << Qt::endl;
6399 stream <<
"% First Raw Data Reading Entry : 14" << Qt::endl;
6400 stream <<
"% Entry 1 : month" << Qt::endl;
6401 stream <<
"% Entry 2 : day" << Qt::endl;
6402 stream <<
"% Entry 3 : year" << Qt::endl;
6403 stream <<
"% Entry 4 : hour" << Qt::endl;
6404 stream <<
"% Entry 5 : minutes" << Qt::endl;
6405 stream <<
"% Entry 6 : seconds" << Qt::endl;
6406 stream <<
"% Entry 7 : msec" << Qt::endl;
6407 stream <<
"% Entry 8 : measured temperature of control channel = " << ctrl_ch << Qt::endl;
6408 stream <<
"% Entry 9 : pressure" << Qt::endl;
6409 stream <<
"% Entry 10 : heater output" << Qt::endl;
6410 stream <<
"% Entry 11 : setpoint temperature" << Qt::endl;
6411 stream <<
"% Entry 12 : heater range" << Qt::endl;
6412 stream <<
"% Entry 13 : BH1 flow measured" << Qt::endl;
6413 for (
int i=0; i<8; i++) {
6414 stream <<
"% Entry " << 14+i <<
" : Raw Data Reading Entry " << i <<
" : Channel " << sensor_ch[i] <<
" : Sensor Type " << sensor_type[i] << Qt::endl;
6416 stream <<
"%--------------------------------------------------------------------------" << Qt::endl;
6440 float value, demand;
6441 int size, err_count;
6448 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6462 QString err = QString(
"PLemAutoRun::SetFieldWEWL: WEW Slowcontrol Frontend NOT running.\n")+
6463 QString(
" Error too severe, will stop.");
6466 QCoreApplication::exit(0);
6474 msg = QString(
"Autorun running: ") + msg;
6479 size =
sizeof(value);
6482 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWL",
"**WARNING** WEWH still ON! Will ramp it to zero and switch it off first.");
6490 size =
sizeof(value);
6493 }
while ((value > 2.0) && (err_count++ < 120));
6500 size =
sizeof(value);
6503 }
while ((value != 0.0) && (err_count++ < 120));
6504 if (err_count >= 120) {
6505 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWL",
"**WARNING** WEWH status is still ON. Please check! EPICS Gateway Problems?");
6511 size =
sizeof(value);
6518 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWL",
"**WARNING** WEWL still OFF! Will switch it on first.");
6525 value = arc->
param[0].toFloat();
6526 if (arc->
param[1] ==
"G") {
6537 size =
sizeof(fval);
6538 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
6545 msg = QString(
"PLemAutoRun::SetFieldWEWL: demand current %1 > %2, hence RA HV's will be shut down").arg(value).arg(
fWEWCriticalCurrentRA);
6569 size =
sizeof(value);
6577 if (t.elapsed() > timeout) {
6580 msg = QString(
"Field (WEW) was not reached within %1 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand).arg(value);
6601 float value, demand;
6602 int size, err_count;
6609 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6623 QString err = QString(
"PLemAutoRun::SetFieldWEWH: WEW Slowcontrol Frontend NOT running.\n")+
6624 QString(
" Error too severe, will stop.");
6627 QCoreApplication::exit(0);
6635 msg = QString(
"Autorun running: ") + msg;
6640 size =
sizeof(value);
6643 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWH",
"**WARNING** WEWL still ON! Will ramp it to zero and switch it off first.");
6651 size =
sizeof(value);
6654 }
while ((value > 0.1) && (err_count++ < 120));
6661 size =
sizeof(value);
6664 }
while ((value != 0.0) && (err_count++ < 120));
6665 if (err_count >= 120) {
6666 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWH",
"**WARNING** WEWL status is still ON. Please check! EPICS Gateway Problems?");
6672 size =
sizeof(value);
6679 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWH",
"**WARNING** WEWH still OFF! Will switch it on first.");
6686 value = arc->
param[0].toFloat();
6687 if (arc->
param[1] ==
"G") {
6698 size =
sizeof(fval);
6699 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
6706 msg = QString(
"PLemAutoRun::SetFieldWEWH: demand current %1 > %2, hence RA HV's will be shut down").arg(value).arg(
fWEWCriticalCurrentRA);
6730 size =
sizeof(value);
6734 if (fabs(demand) < 2.0) {
6735 if (fabs(demand-value) < 2.0)
6741 if (t.elapsed() > timeout) {
6744 msg = QString(
"Field (WEW) was not reached within %1 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand).arg(value);
6766 float value, demand;
6773 msg +=
": PLemAutoRun::SetFieldDanfysik: danfysik equipment disabled in lemAutoRun. Will do nothing here.";
6788 QString err = QString(
"PLemAutoRun::SetFieldDanfysik: Danfysik Slowcontrol Frontend NOT running.\n")+
6789 QString(
" Error too severe, will stop.");
6792 QCoreApplication::exit(0);
6800 msg = QString(
"Autorun running: ") + msg;
6803 value = arc->
param[0].toFloat();
6804 if (arc->
param[1] ==
"G") {
6823 size =
sizeof(value);
6831 if (t.elapsed() > timeout) {
6834 msg = QString(
"Field (Danfysik) was not reached within %1 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand).arg(value);
6857 float value = arc->
param[0].toFloat();
6858 if (arc->
param[1] ==
"G") {
6862 if (fabs(value) < 50.0)
6871 msg +=
"PLemAutoRun::SetField: no magnet is enabled. Will do nothing here.";
6896 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6902 if (!
fEnabled[
"danfysik_spin_rot_eq"]) {
6904 msg += QString(
"PLemAutoRun::SetSpinRot: danfysik spin rot equipment disabled. Will do nothing here.");
6915 msg = QString(
"Autorun running: ") + msg;
6927 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: start Spin Rot shutdown and degauss procedure.");
6928 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: shut down Spin Rot HV's.");
6974 if (t.elapsed() > timeout) {
6977 msg = QString(
"Couldn't shut down Spin Rot HVs within %1 sec: will give it another try in 120 sec.").arg(
fHVTimeout);
6996 msg = QString(
"Couldn't shut down the Spin Rotator HV, even after a few trials :-( .");
7002 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to 0.");
7014 size =
sizeof(value);
7017 if (fabs(value) < 0.1)
7021 if (t.elapsed() > timeout) {
7024 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
7033 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to 12.0 A.");
7045 size =
sizeof(value);
7048 if (fabs(value-12.0) < 0.1)
7052 if (t.elapsed() > timeout) {
7055 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
7064 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to -1.3 A.");
7076 size =
sizeof(value);
7079 if (fabs(value+1.3) < 0.1)
7083 if (t.elapsed() > timeout) {
7086 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
7095 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to 0 - done.");
7107 size =
sizeof(value);
7110 if (fabs(value) < 0.1)
7114 if (t.elapsed() > timeout) {
7117 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
7123 if (arc->
param[0] !=
"off") {
7125 int size =
sizeof(enabled);
7127 cm_msg(MDEBUG,
"SetSpinRot",
"SetSpinRot: enabled=%d.", enabled);
7129 if (enabled == FALSE) {
7131 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: enable spin rotator.");
7137 float angle = arc->
param[0].toFloat();
7138 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set spin rotation angle to %f", angle);
7163 float standby, demand_current, measured_current;
7170 msg += QString(
"PLemAutoRun::SetFOM: fom equipment disabled. Will do nothing here.");
7181 msg = QString(
"Autorun running: ") + msg;
7185 size =
sizeof(standby);
7187 if (status != DB_SUCCESS) {
7197 demand_current = arc->
param[0].toFloat();
7199 if (demand_current == 0.0) {
7206 timeout = 300 * 1e3;
7214 size =
sizeof(measured_current);
7222 if (t.elapsed() > timeout) {
7225 msg = QString(
"Current (FOM) was not reached within 300 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand_current).arg(measured_current);
7237 if (standby != 0.0) {
7250 timeout = 300 * 1e3;
7258 size =
sizeof(measured_current);
7266 if (t.elapsed() > timeout) {
7269 msg = QString(
"Current (FOM) was not reached within 300 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand_current).arg(measured_current);
7294 msg += QString(
"PLemAutoRun::SetLEMSetup: setup info ODB entries disabled. Will do nothing here.");
7305 msg = QString(
"Autorun running: ") + msg;
7328 msg += QString(
"PLemAutoRun::SetModInfo: moderator info ODB entries disabled. Will do nothing here.");
7339 msg = QString(
"Autorun running: ") + msg;
7342 fModNameKey->SetData((
void *)arc->
param[0].toLatin1().data(), 1, TID_STRING);
7343 fModDateKey->SetData((
void *)arc->
param[1].toLatin1().data(), 1, TID_STRING);
7361 QString str(arc->
param[2]);
7366 ival = str.toInt(&ok);
7368 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_BYTE/TID_CHAR is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7372 if ((ival < 0) || (ival > 255)) {
7373 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_BYTE/TID_CHAR; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7379 ival = str.toInt(&ok);
7381 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SBYTE is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7385 if ((ival < -128) || (ival > 127)) {
7386 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SBYTE; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7392 ival = str.toInt(&ok);
7394 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_WORD is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7398 if ((ival < 0) || (ival > 65535)) {
7399 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_WORD; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7405 ival = str.toInt(&ok);
7407 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SHORT is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7411 if ((ival < -32768) || (ival > 32767)) {
7412 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SHORT; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7418 ival = str.toInt(&ok);
7420 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_DWORD is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7425 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_DWORD; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7431 ival = str.toInt(&ok);
7433 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_INT is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7439 ival = str.toInt(&ok);
7441 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_BOOL is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7445 if ((ival != 1) && (ival != 0)) {
7446 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_BOOL; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7452 fval = str.toFloat(&ok);
7454 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_FLOAT is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7460 dval = str.toDouble(&ok);
7462 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_DOUBLE is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7470 QString err = QString(
"PLemAutoRun::CheckOdbType: Do not now how to handle key type %1 of an ODB_SET_DATA cmd. See line no %2").arg(type).arg(arc->
lineNo);
7491 PAutoRunCmdVector::Iterator iter;
7496 if (iter->cmd ==
"setOdbData") {
7499 QString setPath = iter->param[0];
7500 setKey =
new PKey(
fExp, setPath);
7501 if (!setKey->IsValid()) {
7503 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: Couldn't access ODB set key %1 from the ODB_SET_DATA cmd.").arg(iter->param[0]);
7515 if (!iter->param[1].isEmpty()) {
7516 int index = iter->param[1].toInt();
7517 if (index > setKey->GetNumValues()) {
7519 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: ODB_SET_DATA set index '%1' out of range (%2)!").arg(iter->param[1]).arg(setKey->GetNumValues());
7542 if (!iter->param[3].isEmpty()) {
7545 QString readPath = iter->param[3];
7547 PKey *readKey =
new PKey(
fExp, readPath);
7548 if (!readKey->IsValid()) {
7550 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: Couldn't access ODB read key %1 from the ODB_SET_DATA cmd.").arg(iter->param[3]);
7565 if (!iter->param[4].isEmpty()) {
7566 int index = iter->param[4].toInt();
7567 if (index > readKey->GetNumValues()) {
7569 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: ODB_SET_DATA read index '%1'' out of range (%2)!").arg(index).arg(readKey->GetNumValues());
7598 if (iter->cmd ==
"setOdbDataArray") {
7601 QString setPath = iter->param[0];
7602 setKey =
new PKey(
fExp, setPath);
7603 if (!setKey->IsValid()) {
7605 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: Couldn't access ODB set key %1 from the ODB_SET_DATA_ARRAY cmd.").arg(iter->param[0]);
7619 for (
int i=1; i<iter->noElements; i++) {
7621 switch (setKey->GetType()) {
7624 if (iter->param[i].length() > 1)
7629 if (iter->param[i].length() > 1)
7634 if (iter->param[i].length() > 1)
7639 iter->param[i].toInt(&ok);
7643 iter->param[i].toInt(&ok);
7647 iter->param[i].toInt(&ok);
7651 iter->param[i].toInt(&ok);
7655 iter->param[i].toInt(&ok);
7659 iter->param[i].toFloat(&ok);
7662 type =
"TID_DOUBLE";
7663 iter->param[i].toDouble(&ok);
7666 type =
"TID_STRING";
7671 QString err = QString(
"CheckForOdbSetDataCmds: Wrong data type of element '%1', should be '%2'").arg(iter->param[i]).arg(type);
7678 if (iter->noElements-1 != setKey->GetNumValues()) {
7680 QString err = QString(
"CheckForOdbSetDataCmds: Wrong number of element '%1', should be '%2'").arg(iter->noElements-1).arg(setKey->GetNumValues());
7711 msg = QString(
"Autorun running: ") + msg;
7716 double tolerance = 0.0;
7727 QString setPath = arc->
param[0];
7729 if (!arc->
param[5].isEmpty())
7730 timeout = arc->
param[5].toInt() * 1000;
7732 if (!arc->
param[6].isEmpty())
7733 tolerance = arc->
param[6].toDouble();
7737 setKey =
new PKey(
fExp, setPath);
7738 if (!setKey->IsValid()) {
7740 QString err = QString(
"PLemAutoRun::SetOdbData: Couldn't access ODB set key %1 from the ODB_SET_DATA cmd.").arg(arc->
param[0]);
7751 switch (setKey->GetType()) {
7760 ival = arc->
param[2].toInt();
7765 fval = arc->
param[2].toFloat();
7770 dval = arc->
param[2].toDouble();
7783 if (!arc->
param[3].isEmpty()) {
7784 QString readPath = arc->
param[3];
7786 readKey =
new PKey(
fExp, readPath);
7787 if (!readKey->IsValid()) {
7789 QString err = QString(
"PLemAutoRun::SetOdbData: Couldn't access ODB read key %1 from the ODB_SET_DATA cmd.").arg(arc->
param[3]);
7805 if (arc->
param[1].isEmpty()) {
7808 setKey->SetData(&ival, 1, setKey->GetType());
7811 setKey->SetData(&fval, 1, setKey->GetType());
7814 setKey->SetData(&dval, 1, setKey->GetType());
7817 strcpy(sval, arc->
param[2].toLatin1().data());
7818 setKey->SetData(sval, 1, setKey->GetType());
7824 setIndex = arc->
param[1].toInt();
7827 setKey->SetDataIndex(&ival, setIndex, setKey->GetType());
7830 setKey->SetDataIndex(&fval, setIndex, setKey->GetType());
7833 setKey->SetDataIndex(&dval, setIndex, setKey->GetType());
7836 strcpy(sval, arc->
param[2].toLatin1().data());
7837 setKey->SetDataIndex(sval, setIndex, setKey->GetType());
7846 if (!arc->
param[4].isEmpty())
7847 readIndex = arc->
param[4].toInt();
7854 double readVal = 0.0;
7859 if (readIndex < 0) {
7860 switch (readKey->GetType()) {
7869 size =
sizeof(ival);
7870 readKey->GetData(&ival, &size, readKey->GetType());
7874 size =
sizeof(fval);
7875 readKey->GetData(&fval, &size, readKey->GetType());
7879 size =
sizeof(dval);
7880 readKey->GetData(&dval, &size, readKey->GetType());
7887 switch (readKey->GetType()) {
7896 size =
sizeof(ival);
7897 readKey->GetDataIndex(&ival, &size, readIndex, readKey->GetType());
7901 size =
sizeof(fval);
7902 readKey->GetDataIndex(&fval, &size, readIndex, readKey->GetType());
7906 size =
sizeof(dval);
7907 readKey->GetDataIndex(&dval, &size, readIndex, readKey->GetType());
7916 if (fabs(setVal-readVal) < tolerance) {
7922 }
while((time.elapsed() < timeout) && !done);
7925 QString err = QString(
"WARNING: Couldn't reach demand value: | demand = %1 - measured = %2 | > %3 after timeout of %4 (sec) was reached.").arg(setVal).arg(readVal).arg(tolerance).arg(timeout/1000.0);
7959 msg = QString(
"Autorun running: ") + msg;
7963 QString setPath = arc->
param[0];
7967 setKey =
new PKey(
fExp, setPath);
7968 if (!setKey->IsValid()) {
7970 QString err = QString(
"PLemAutoRun::SetOdbData: Couldn't access ODB set key %1 from the ODB_SET_DATA cmd.").arg(arc->
param[0]);
7983 data[i-1] = arc->
param[i].toFloat();
7986 setKey->SetData(data, arc->
noElements-1, TID_FLOAT);
8022 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8031 msg +=
"PLemAutoRun::SetSampleHV: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8042 QString err = QString(
"PLemAutoRun::SetSampleHV: Slowcontrol Frontend NOT running.\n")+
8043 QString(
" Error too severe, will stop.");
8046 QCoreApplication::exit(0);
8055 msg = QString(
"Autorun running: ") + msg;
8061 size =
sizeof(value);
8062 value = arc->
param[0].toFloat() + (-1)*(i%2)*0.001;
8078 size =
sizeof(value);
8088 if (t.elapsed() > timeout) {
8091 msg = QString(
"Sample HV of demand=%1 (kV) was not reached (measured=%2 (kV)) within %3 sec: will give it another try in 120 sec.").arg(demand).arg(value).arg(
fHVTimeout);
8110 msg = QString(
"Couldn't set Sample HV of %1 (kV), even after a few trials :-( .").arg(demand);
8139 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8148 msg +=
"PLemAutoRun::SetRA_HV: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8159 QString err = QString(
"PLemAutoRun::SetRA_HV: Slowcontrol Frontend NOT running.\n")+
8160 QString(
" Error too severe, will stop.");
8163 QCoreApplication::exit(0);
8172 msg = QString(
"Autorun running: ") + msg;
8178 size =
sizeof(float);
8179 value[0] = arc->
param[0].toFloat() + (-1)*(i%2)*0.001;
8182 size =
sizeof(float);
8183 value[1] = arc->
param[1].toFloat() + (-1)*(i%2)*0.001;
8187 size =
sizeof(float);
8188 value[2] = arc->
param[2].toFloat() + (-1)*(i%2)*0.001;
8191 size =
sizeof(float);
8192 value[3] = arc->
param[3].toFloat() + (-1)*(i%2)*0.001;
8205 demand[j] = value[j];
8213 size =
sizeof(float);
8216 size =
sizeof(float);
8220 size =
sizeof(float);
8223 size =
sizeof(float);
8245 if (t.elapsed() > timeout) {
8249 msg = QString(
"RA HV of demand=(%1/%2), measured=(%3/%4) (kV), was not reached within %5 sec: will give it another try in 120 sec.").arg(demand[0]).arg(demand[1]).arg(value[0]).arg(value[1]).arg(
fHVTimeout);
8251 msg = QString(
"RA HV of demand=(%1/%2/%3/%4), measured=(%5/%6/%7/%8) (kV), was not reached within %9 sec: will give it another try in 120 sec.").arg(demand[0]).arg(demand[1]).arg(demand[2]).arg(demand[3]).arg(value[0]).arg(value[1]).arg(value[2]).arg(value[3]).arg(
fHVTimeout);
8271 msg = QString(
"RA HV of (%1/%2) (kV), was not reached even after several trials :-( ").arg(arc->
param[0]).arg(arc->
param[1]);
8273 msg = QString(
"RA HV of (%1/%2/%3/%4) (kV), was not reached even after several trials :-( ").arg(arc->
param[0]).arg(arc->
param[1]).arg(arc->
param[2]).arg(arc->
param[3]);
8296 PAutoRunCmdVector::Iterator iter;
8299 if (iter->cmd ==
"setTransportHV") {
8302 QFileInfo fileInfo(filePath);
8303 if (!fileInfo.exists()) {
8304 QString msg = filePath + QString(
" does not exist! Fix that first!");
8309 msg = QString(
"Autorun stopped: Skript failure");
8346 if (!QFile::exists(fln)) {
8347 QString err =
"lemAutoRun: Couldn't find HV setting file: " + fln;
8354 QString err =
"lemAutoRun: Couldn't parse HV setting file: " + fln;
8359 QString errMsg =
"";
8360 if (!handler.
isValid(errMsg)) {
8363 QString err =
"lemAutoRun: Couldn't read HV setting file: " + fln;
8372 QVector<int> *hvCh = handler.
GetChNo();
8377 float *pHvDemand = (
float*)malloc(hvDemand->size()*
sizeof(float));
8378 float *pCurrentLimit = (
float*)malloc(currentLimit->size()*
sizeof(float));
8379 float *pHvMeasured = (
float*)malloc(hvDemand->size()*
sizeof(float));
8382 int size =
sizeof(float);
8383 float magFieldValue{0.0};
8384 fMagFieldKey->GetData(&magFieldValue, &size, TID_FLOAT);
8385 for (
int i=0; i<hvCh->size(); i++) {
8386 if (
fSetupWewEnabled && hvChName->at(i).startsWith(
"RA-") && (magFieldValue > 110.0)) {
8387 pHvDemand[hvCh->at(i)-1] = 0.0;
8388 if (hvChName->at(i).startsWith(
"RA-L")) {
8389 cm_msg(MINFO,
"lemAutoRun",
"The field of WEW (%0.2f G) > 110.0 G. Hence, the RA HV-values are set to 0.0kV.", magFieldValue);
8393 pHvDemand[hvCh->at(i)-1] = hvDemand->at(i);
8395 pCurrentLimit[hvCh->at(i)-1] = currentLimit->at(i);
8399 QString path = QString(
"/Equipment/HV/Settings/Current Limit");
8400 PKey currentLimitKey(
fExp, path);
8401 if (!currentLimitKey.IsValid()) {
8402 errMsg =
"**ERROR** couldn't obtain the current limit ODB key";
8406 QString err =
"lemAutoRun: Couldn't read HV setting file: " + fln;
8411 free(pCurrentLimit);
8415 currentLimitKey.SetData(pCurrentLimit, currentLimit->size(), TID_FLOAT);
8418 fHVDemandKey->SetData(pHvDemand, hvDemand->size(), TID_FLOAT);
8423 QVector<int> hv_reached;
8424 hv_reached.resize(hvDemand->size());
8425 for (
int i=0; i<hv_reached.size(); i++)
8436 size = hvDemand->size()*
sizeof(float);
8441 for (
int i=0; i<hvDemand->size(); i++) {
8442 if (fabs(pHvDemand[i]-pHvMeasured[i]) <
fHVAccuracy) {
8445 size += hv_reached[i];
8449 if (size == (
int)hvDemand->size())
8453 if (t.elapsed() > timeout) {
8456 QString msg = QString(
"HV settings could not be reached within %3 sec.").arg(
fHVTimeout);
8466 free(pCurrentLimit);
8488 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8497 msg +=
"PLemAutoRun::SetTransportHV: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8509 msg = QString(
"Autorun running: ") + msg;
8533 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8542 msg +=
"PLemAutoRun::SetHvOff: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8554 msg = QString(
"Autorun running: ") + msg;
8558 float fval[4] = {0.0, 0.0, 0.0, 0.0};
8560 float timeout = 300 * 1e3;
8562 if (arc->
param[0].contains(
"mc", Qt::CaseInsensitive)) {
8564 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down FUG HV's in the Moderator Chamber ...");
8567 fHVDemandKey->SetDataIndex((
void *)&fval[0], i, TID_FLOAT);
8569 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down MCP1 HV in the Moderator Chamber ...");
8579 size =
sizeof(float);
8582 if (fabs(fval[0]) < 0.3) {
8587 if (t.elapsed() > timeout) {
8590 msg = QString(
"HV_OFF MC: demand=0.0kV [measured=(%5/%6/%7/%8) (kV)] was not reached within 180 sec. will go to the next command.").arg(fval[0]).arg(fval[1]).arg(fval[2]).arg(fval[3]);
8594 }
else if (arc->
param[0].contains(
"tc", Qt::CaseInsensitive)) {
8596 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down FUG HV's in the Trigger Chamber ...");
8600 fHVDemandKey->SetDataIndex((
void *)&fval[0], i, TID_FLOAT);
8602 fHVDemandKey->SetDataIndex((
void *)&fval[0], i, TID_FLOAT);
8604 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down TD HV's in the Trigger Chamber ...");
8616 size =
sizeof(float);
8620 if ((fabs(fval[0]) < 0.3) && (fabs(fval[1]) < 0.3) && (fabs(fval[2]) < 0.3) && (fabs(fval[4]) < 0.3)) {
8625 if (t.elapsed() > timeout) {
8628 msg = QString(
"HV_OFF TC: demand=0.0kV [measured=(%5/%6/%7/%8) (kV)] was not reached within 180 sec. will go to the next command.").arg(fval[0]).arg(fval[1]).arg(fval[2]).arg(fval[3]);
8632 }
else if (arc->
param[0].contains(
"sc", Qt::CaseInsensitive)) {
8634 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down FUG HV's in the Trigger Chamber ...");
8637 fHVDemandKey->SetDataIndex((
void *)&fval, i, TID_FLOAT);
8659 PAutoRunCmdVector::Iterator iter;
8660 bool check_needed =
false;
8664 if (iter->cmd ==
"setTemp") {
8665 check_needed =
true;
8677 size =
sizeof(cmode);
8684 QString str = QString(
"/Equipment/SampleCryo/Settings/Devices/Lake336_Sample_0/DD/Zone/Zone");
8686 zoneKey =
new PKey(
fExp, str);
8687 if (!zoneKey->IsValid()) {
8688 QString err = QString(
"sample cryo ZONE settings key not found.");
8695 size =
sizeof(float);
8699 size =
sizeof(zone_str);
8700 float loop, zone, top_value, p_pid, i_pid, d_pid, mount_value, range;
8701 for (
int i=0; i<10; i++) {
8703 zoneKey->GetDataIndex(zone_str, &size, i, TID_STRING);
8705 status = sscanf(zone_str,
"%f,%f,%f,%f,%f,%f,%f,%f", &loop, &zone, &top_value,
8706 &p_pid, &i_pid, &d_pid, &mount_value, &range);
8708 QString err = QString(
"Couldn't extract sample cryo ZONE settings (%1/%2).").arg(status).arg(zone_str);
8712 if (temp < top_value)
8740 if ( Tset < 10.0 ) {
8744 if ( Tset < 20.0 ) {
8753 cm_msg(MDEBUG,
"NeedleValve",
"NeedleValve: demand = %e", value);
8757 if ( value > 100.0 )
8780 + (rampSpeed / 60.0) *
8789 cm_msg(MDEBUG,
"EmpircalFlow",
"EmpiricalFlow: demandflow = %e", demandflow);
8813 float rampSpeed=0.0;
8816 if (!rampParam.isEmpty()) {
8817 rampSpeed = rampParam.toFloat();
8829 }
while (t.elapsed() < 60e3);
8860 float deltaT,
float flowScale)
8864 if (rampSpeed == 0.0) {
8865 if (!flowParam.isEmpty()) {
8866 value = flowParam.toFloat();
8875 if (!flowParam.isEmpty()) {
8908 if (flowParam.isEmpty())
8911 float value = flowParam.toFloat();
8993 size =
sizeof(status);
8999 }
while (t.elapsed() < 300e3);
9020 if (rampSpeed == 0.0) {
9022 bool setpoint_readback_failure =
true;
9026 setpoint_readback_failure =
false;
9031 fvalue = setpoint + 1.0e-4 * (float)rand()/(float)RAND_MAX;
9034 }
while (t.elapsed() < 600e3);
9035 if (setpoint_readback_failure) {
9037 QString err = QString(
"setTemp: Couldn't get new setpoint readback value within 10 min!");
9062 bool setpoint_readback_failure =
true;
9066 setpoint_readback_failure =
false;
9071 fvalue = setpoint + 1.0e-4 * (float)rand()/(float)RAND_MAX;
9074 }
while (t.elapsed() < 600e3);
9075 if (setpoint_readback_failure) {
9077 QString err = QString(
"setTempOvenOmega: Couldn't get new setpoint readback value within 10 min!");
9120 msg +=
"PLemAutoRun::SetHvOff: TFL equipment disabled in lemAutoRun. Will do nothing here.";
9127 float tfl_pos = arc->
param[0].toFloat();
9128 float tfl_mode = arc->
param[1].toFloat();
9131 std::cout << std::endl <<
"in SetTfl ...";
9137 QString err = QString(
"PLemAutoRun::SetTfl: TFL Slowcontrol Frontend NOT running.\n")+
9138 QString(
" Error too severe, will stop.");
9141 QCoreApplication::exit(0);
9149 msg = QString(
"Autorun running: ") + msg;
9178 float newDemandTemp;
9179 float newDemandFlow = -1.0;
9181 float rampSpeed = 0.0;
9182 QElapsedTimer t, t_flow_set;
9188 msg +=
"PLemAutoRun::SetTemp: sample equipment disabled in lemAutoRun. Will do nothing here.";
9196 std::cout << std::endl <<
"in SetTemp ...";
9199 char cryoName[NAME_LENGTH];
9200 size =
sizeof(cryoName);
9201 if (!
fEnabled[
"sample_cryo_info_odb"]) {
9203 msg +=
"PLemAutoRun::SetTemp: '/Info/Sample Cryo' access disabled. Will do nothing here.";
9210 if (QString(cryoName).startsWith(
"omega", Qt::CaseInsensitive)) {
9228 msg += arc->
param[i];
9229 if (i<arc->noElements-1)
9243 std::cout << std::endl <<
"in SetTemp: will check clients ...";
9249 QString err = QString(
"PLemAutoRun::SetTemp: Slowcontrol Frontend NOT running.\n")+
9250 QString(
" Error too severe, will stop.");
9253 QCoreApplication::exit(0);
9275 msg = QString(
"Autorun running: ") + msg;
9279 std::cout << std::endl <<
"in SetTemp: check lemvac and BPVX/Y positions ...";
9285 QString err = QString(
"PLemAutoRun::SetTemp: Lemvac NOT running. Error too severe, will stop.");
9288 QCoreApplication::exit(0);
9295 QString err = QString(
"PLemAutoRun::SetTemp: Couldn't read BPVX/Y. Error too severe, will stop.");
9303 QString err = QString(
"PLemAutoRun::SetTemp: Couldn't close BPVX. Error too severe, will stop.");
9317 std::cout << std::endl <<
"in SetTemp: increasing temperature ..." << std::endl;
9321 std::cout << std::endl <<
"in SetTemp: check if it is necessary to shut down the hv's and to close BPVY ...";
9330 std::cout << std::endl <<
"in SetTemp: get HV's from the sample region ...";
9335 std::cout << std::endl <<
"in SetTemp: shut down the sample HV's ...";
9340 std::cout << std::endl <<
"in SetTemp: set demand temperature, ramping, flow ...";
9356 std::cout << std::endl <<
"in SetTemp: set the new bronkhorst flow and needle valve ...";
9364 std::cout << std::endl <<
"in SetTemp: set the parameters of the LS340 or LS336...";
9389 std::cout << std::endl <<
"in SetTemp: check and tweak temperature until stability is reached or timeout happend ...";
9422 if (t.elapsed() > timeout) {
9423 QString err = QString(
"PLemAutoRun::SetTemp: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9435 std::cout << std::endl <<
"in SetTemp: if HV is shut down: (i) open BPVY, than (ii) ramp sample HV's back ...";
9444 std::cout << std::endl <<
"in SetTemp: decreasing temperature ..." << std::endl;
9448 std::cout << std::endl <<
"in SetTemp: set the parameters of the LS340 or LS336 ...";
9476 size =
sizeof(value);
9487 if (newDemandTemp > 50.0)
9500 std::cout << std::endl <<
"in SetTemp: check and tweak temperature until stability is reached or timeout happend ...";
9526 value = 1.5 * newDemandFlow;
9530 value = 1.2 * newDemandFlow;
9534 value = 1.1 * newDemandFlow;
9538 value = newDemandFlow;
9577 if (t.elapsed() > timeout) {
9578 QString err = QString(
"PLemAutoRun::SetTemp: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9592 std::cout << std::endl <<
"in SetTemp: ramping enabled for cooling down or flow explicitly given ...";
9606 size =
sizeof(newDemandFlow);
9615 if ( rampSpeed == 0.0 )
9621 std::cout << std::endl <<
"in SetTemp: check and tweak temperature until stability is reached or timeout happend ...";
9629 if (rampSpeed != 0.0) {
9645 std::cout << std::endl <<
"in SetTemp: set flow and adjust the needle valve of the transferline ...";
9655 std::cout << std::endl <<
"in SetTemp: check if final setpoint is reached ...";
9659 std::cout << std::endl <<
"in SetTemp: gradually reduce the flow to steady value if flow was not given explicitly ...";
9661 float value2 = 0.3 * rampSpeed;
9666 value2 = 0.2 * rampSpeed;
9671 value2 = 0.1 * rampSpeed;
9688 std::cout << std::endl <<
"in SetTemp: check temperature stability and feed history buffer ...";
9694 std::cout << std::endl <<
"in SetTemp: see if a flow tweaking is needed ...";
9705 if (t.elapsed() > timeout) {
9706 QString err = QString(
"PLemAutoRun::SetTemp: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9721 std::cout << std::endl <<
"in SetTemp: only open the BPVX when it initially was open ...";
9726 QString err = QString(
"PLemAutoRun::SetTemp: Couldn't open BPVX. Error too severe, will stop.");
9748 float newDemandTemp;
9749 float rampSpeed = 0.0;
9756 msg +=
"PLemAutoRun::SetTempOvenOmega: omega equipment disabled in lemAutoRun. Will do nothing here.";
9770 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Slowcontrol Frontend (Omega SC) NOT running. Error too severe, will stop.");
9773 QCoreApplication::exit(0);
9782 msg = QString(
"Autorun running: ") + msg;
9786 std::cout << std::endl <<
"in SetTempOvenOmega: check lemvac and BPVX/Y positions ...";
9792 QString err = QString(
"PLemAutoRun::SetTemp: Lemvac NOT running. Error too severe, will stop.");
9795 QCoreApplication::exit(0);
9802 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Couldn't read BPVX/Y. Error too severe, will stop.");
9810 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Couldn't close BPVX. Error too severe, will stop.");
9824 std::cout << std::endl <<
"in SetTempOvenOmega: increasing temperature ..." << std::endl;
9834 std::cout << std::endl <<
"in SetTempOvenOmega: get HV's from the sample region ...";
9839 std::cout << std::endl <<
"in SetTempOvenOmega: shut down the sample HV's ...";
9844 std::cout << std::endl <<
"in SetTempOvenOmega: set demand temperature, ramping, flow ...";
9851 std::cout << std::endl <<
"in SetTempOvenOmega: set the parameters of the LS340 ...";
9863 std::cout << std::endl <<
"in SetTempOvenOmega: check and tweak temperature until stability is reached or timeout happend ...";
9866 int stabilityCounter = 0;
9875 if (t.elapsed() > timeout) {
9876 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9884 if (stabilityCounter == 60)
9887 stabilityCounter = 0;
9893 std::cout << std::endl <<
"in SetTempOvenOmega: if HV is shut down: ramp sample HV's back ...";
9900 std::cout << std::endl <<
"in SetTempOvenOmega: decreasing temperature ..." << std::endl;
9904 std::cout << std::endl <<
"in SetTempOvenOmega: set the parameters of the Omega ...";
9920 std::cout << std::endl <<
"in SetTempOvenOmega: check the temperature until stability is reached or timeout happend ...";
9923 int stabilityCounter = 0;
9932 if (t.elapsed() > timeout) {
9933 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9941 if (stabilityCounter == 60)
9944 stabilityCounter = 0;
9952 std::cout << std::endl <<
"in SetTempOvenOmega: only open the BPVX when it initially was open ...";
9957 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Couldn't open BPVX. Error too severe, will stop.");
9999 if (!
fEnabled[
"sample_name_info_odb"] || !
fEnabled[
"sample_cryo_info_odb"]) {
10001 msg +=
"PLemAutoRun::SetTitle: not all necessary ODB settings are enabled in lemAutoRun. Will do nothing here.";
10008 msg= QString(
"%1").arg(arc->
param[0]);
10011 if (arc->
param[1] ==
"true") {
10013 size =
sizeof(str);
10016 msg.replace(
"ODB_SAMPLE", str);
10018 if (arc->
param[2] ==
"true") {
10020 char cryoName[NAME_LENGTH];
10021 size =
sizeof(cryoName);
10025 if (QString(cryoName).startsWith(
"omega", Qt::CaseInsensitive)) {
10026 size =
sizeof(fvalue);
10029 dvalue = fvalue + 273.16;
10032 size =
sizeof(fvalue);
10038 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10039 msg.replace(
"ODB_TEMP", QString(
"%1").arg(valueStr));
10042 if (arc->
param[3] ==
"true") {
10045 size =
sizeof(float);
10053 msg.replace(
"ODB_FIELD", QString(
"%1").arg(valueStr));
10059 msg.replace(
"ODB_FIELD", QString(
"%1").arg(valueStr));
10062 msg.replace(
"ODB_FIELD",
"??(G)/??(A)");
10065 if (arc->
param[4] ==
"true") {
10067 size =
sizeof(fvalue);
10071 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10072 msg.replace(
"ODB_TRANSP", QString(
"%1").arg(valueStr));
10075 size =
sizeof(fvalue);
10079 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10080 msg.replace(
"ODB_TRANSP", QString(
"%1").arg(valueStr));
10084 if (arc->
param[5] ==
"true") {
10086 size =
sizeof(fvalue);
10090 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10091 msg.replace(
"ODB_HV_SAMP", QString(
"%1").arg(valueStr));
10094 size =
sizeof(fvalue);
10098 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10099 msg.replace(
"ODB_HV_SAMP", QString(
"%1").arg(valueStr));
10103 if (arc->
param[6] ==
"true") {
10106 float hv_mod, hv_samp, energy_loss;
10108 size =
sizeof(hv_mod);
10111 size =
sizeof(hv_samp);
10116 dvalue = hv_mod - energy_loss - hv_samp;
10117 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10118 msg.replace(
"ODB_ENERGY", QString(
"%1").arg(valueStr));
10122 float hv_mod, hv_samp, energy_loss;
10124 size =
sizeof(hv_mod);
10127 size =
sizeof(hv_samp);
10132 dvalue = hv_mod - energy_loss - hv_samp;
10133 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10134 msg.replace(
"ODB_ENERGY", QString(
"%1").arg(valueStr));
10138 if (arc->
param[7] ==
"true") {
10143 size =
sizeof(ral);
10146 size =
sizeof(rar);
10149 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10150 msg.replace(
"ODB_RA_DIFF_LR", QString(
"%1").arg(valueStr));
10156 size =
sizeof(ral);
10159 size =
sizeof(rar);
10162 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10163 msg.replace(
"ODB_RA_DIFF_LR", QString(
"%1").arg(valueStr));
10167 if (arc->
param[8] ==
"true") {
10172 size =
sizeof(rat);
10175 size =
sizeof(rab);
10178 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10179 msg.replace(
"ODB_RA_DIFF_TB", QString(
"%1").arg(valueStr));
10185 size =
sizeof(rat);
10188 size =
sizeof(rab);
10191 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10192 msg.replace(
"ODB_RA_DIFF_TB", QString(
"%1").arg(valueStr));
10196 if (arc->
param[9] ==
"true") {
10201 int size =
sizeof(srEnabled);
10203 size =
sizeof(srAngle);
10205 if (srEnabled == FALSE) {
10206 msg.replace(
"ODB_SPIN_ROT",
"disabled");
10208 valueStr = QString(
"%1").arg(srAngle, 0,
'f', 2);
10209 msg.replace(
"ODB_SPIN_ROT", valueStr);
10220 fRunCommentKey->SetData((
void *)msg.toLatin1().data(), 1, TID_STRING);
10226 msg = QString(
"Autorun running: ") + msg;
10243 int idx=-1, status=0, size;
10250 QString subStr(
"??");
10257 if (key->IsValid()) {
10259 cm_msg(MINFO,
"HandleOdbTitleTags",
"HandleOdbTitleTags: %s: idx=%d >= number of entries=%d, will ignore it.",
10262 }
else if ((key->GetType() != TID_BYTE) &&
10263 (key->GetType() != TID_SBYTE) &&
10264 (key->GetType() != TID_CHAR) &&
10265 (key->GetType() != TID_WORD) &&
10266 (key->GetType() != TID_SHORT) &&
10267 (key->GetType() != TID_DWORD) &&
10268 (key->GetType() != TID_INT) &&
10269 (key->GetType() != TID_BOOL) &&
10270 (key->GetType() != TID_FLOAT) &&
10271 (key->GetType() != TID_DOUBLE) &&
10272 (key->GetType() != TID_STRING)) {
10273 cm_msg(MINFO,
"HandleOdbTitleTags",
"HandleOdbTitleTags: %s: wrong data type (%d), will ignore it.",
10274 fOdbTagVector->at(i).odb_path.toLatin1().data(), key->GetType());
10278 switch (key->GetType()) {
10280 size =
sizeof(char);
10281 status = key->GetDataIndex(&bval, &size,
fOdbTagVector->at(i).idx, TID_BYTE);
10282 subStr = QString(
"%1").arg(bval);
10285 size =
sizeof(char);
10286 status = key->GetDataIndex(&bval, &size,
fOdbTagVector->at(i).idx, TID_SBYTE);
10287 subStr = QString(
"%1").arg(bval);
10290 size =
sizeof(char);
10291 status = key->GetDataIndex(&bval, &size,
fOdbTagVector->at(i).idx, TID_CHAR);
10292 subStr = QString(
"%1").arg(bval);
10295 size = 2*
sizeof(char);
10296 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_WORD);
10297 subStr = QString(
"%1").arg(ival);
10300 size =
sizeof(int);
10301 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_SHORT);
10302 subStr = QString(
"%1").arg(ival);
10305 size =
sizeof(int);
10306 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_DWORD);
10307 subStr = QString(
"%1").arg(ival);
10310 size =
sizeof(int);
10311 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_INT);
10312 subStr = QString(
"%1").arg(ival);
10315 size =
sizeof(int);
10316 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_BOOL);
10317 subStr = QString(
"%1").arg(ival);
10320 size =
sizeof(float);
10321 status = key->GetDataIndex(&fval, &size,
fOdbTagVector->at(i).idx, TID_FLOAT);
10322 subStr = QString(
"%1").arg(fval);
10325 size =
sizeof(double);
10326 status = key->GetDataIndex(&dval, &size,
fOdbTagVector->at(i).idx, TID_DOUBLE);
10327 subStr = QString(
"%1").arg(dval);
10330 size = key->GetItemSize()*
sizeof(float);
10332 status = key->GetDataIndex(&str, &size,
fOdbTagVector->at(i).idx, TID_STRING);
10341 if (status == DB_SUCCESS) {
10345 switch (key->GetType()) {
10347 size =
sizeof(char);
10348 status = key->GetData(&bval, &size, TID_BYTE);
10349 subStr = QString(
"%1").arg(bval);
10352 size =
sizeof(char);
10353 status = key->GetData(&bval, &size, TID_SBYTE);
10354 subStr = QString(
"%1").arg(bval);
10357 size =
sizeof(char);
10358 status = key->GetData(&bval, &size, TID_CHAR);
10359 subStr = QString(
"%1").arg(bval);
10362 size = 2*
sizeof(char);
10363 status = key->GetData(&ival, &size, TID_WORD);
10364 subStr = QString(
"%1").arg(ival);
10367 size =
sizeof(int);
10368 status = key->GetData(&ival, &size, TID_SHORT);
10369 subStr = QString(
"%1").arg(ival);
10372 size =
sizeof(int);
10373 status = key->GetData(&ival, &size, TID_DWORD);
10374 subStr = QString(
"%1").arg(ival);
10377 size =
sizeof(int);
10378 status = key->GetData(&ival, &size, TID_INT);
10379 subStr = QString(
"%1").arg(ival);
10382 size =
sizeof(int);
10383 status = key->GetData(&ival, &size, TID_BOOL);
10384 subStr = QString(
"%1").arg(ival);
10387 size =
sizeof(float);
10388 status = key->GetData(&fval, &size, TID_FLOAT);
10389 subStr = QString(
"%1").arg(fval);
10392 size =
sizeof(double);
10393 status = key->GetData(&dval, &size, TID_DOUBLE);
10394 subStr = QString(
"%1").arg(dval);
10397 size = key->GetItemSize()*
sizeof(char);
10399 status = key->GetData(&str, &size, TID_STRING);
10408 if (status == DB_SUCCESS) {
10419 subStr = QString(
"??");
10440 msg +=
"PLemAutoRun::SetTof: TOF ODB entires disabled in lemAutoRun. Will do nothing here.";
10452 msg = QString(
"Autorun running: ") + msg;
10456 value = arc->
param[0].toFloat();
10457 fTofMinKey->SetData((
void *)&value, 1, TID_FLOAT);
10459 value = arc->
param[1].toFloat();
10460 fTofMaxKey->SetData((
void *)&value, 1, TID_FLOAT);
10480 msg = QString(
"Autorun running: ") + msg;
10483 int wait = arc->
param[0].toInt();
10485 for (
int i=0; i<wait; i++) {
10488 if ( ((i+1) % 5) == 0 ) {
10532 PAutoRunCmdVector::Iterator iter;
10533 int yy, MM, dd, hh, mm, ss;
10538 if (iter->cmd ==
"warmUp") {
10540 sscanf(iter->param[0].toLatin1().data(),
"%d-%d-%d", &yy, &MM, &dd);
10541 d = QDate(yy, MM, dd);
10543 sscanf(iter->param[1].toLatin1().data(),
"%d:%d:%d", &hh, &mm, &ss);
10544 t = QTime(hh, mm, ss);
10546 if (iter->param[2] ==
"1")
10574 msg +=
"PLemAutoRun::WarmUp: sample equipment disabled in lemAutoRun. Will do nothing here.";
10582 msg = QString(
"PLemAutoRun::WarmUp(): warm up procedure starts. Will stop any pending runs, shutdown HV's, ...");
10592 if (status != CM_SUCCESS) {
10593 err = QString(
"PLemAutoRun::RunStart: Cannot stop the run.");
10597 err = QString(
"Autorun running: run stopped.");
10604 msg = QString(
"PLemAutoRun::WarmUp(): close KV61 and KV62");
10614 msg = QString(
"PLemAutoRun::WarmUp(): switch off all the FUG HV's");
10622 value = 0.0 + j*0.001;
10645 if (fabs(value) < 0.5) {
10651 if (t.elapsed() > 3e5) {
10653 err = QString(
"PLemAutoRun::WarmUp(): Couldn't shut down HV's. Will give it another try in 120 sec.");
10670 err = QString(
"PLemAutoRun::WarmUp(): Couldn't shut down sample region HV's. Error too severe, will stop.");
10676 msg = QString(
"PLemAutoRun::WarmUp(): disable potentially set RA pulsing.");
10679 PKey *enable_RA_pulsing =
new PKey(
fExp,
"/Equipment/Trigger/Settings/Enable_OnOff_Mode");
10680 if (!enable_RA_pulsing->IsValid()) {
10681 err = QString(
"PLemAutoRun::WarmUp(): Couldn't get the Enable_OnOff_Mode key for the RA pulsing. Please check instantly! Error too severe, will stop.");
10685 enable_RA_pulsing->SetData((
void*)&ival, 1,TID_BOOL);
10686 if (enable_RA_pulsing) {
10687 delete enable_RA_pulsing;
10688 enable_RA_pulsing = 0;
10692 msg = QString(
"PLemAutoRun::WarmUp(): close BPVX/Y");
10697 QString err = QString(
"PLemAutoRun::WarmUp(): Couldn't close BPVX. Error too severe, will stop.");
10703 QString err = QString(
"PLemAutoRun::WarmUp(): Couldn't close BPVY. Error too severe, will stop.");
10708 msg = QString(
"PLemAutoRun::WarmUp(): sample He flow set to minimum value");
10714 msg = QString(
"PLemAutoRun::WarmUp(): set demand temperature ramping to zero");
10725 }
while (t.elapsed() < 60e3);
10728 msg = QString(
"PLemAutoRun::WarmUp(): set sample cryo temperature to 300K");
10738 size =
sizeof(value);
10742 msg = QString(
"PLemAutoRun::WarmUp(): vent the sample chamber.");
10751 if (value > 250.0) {
10754 msg = QString(
"PLemAutoRun::WarmUp(): sample He flow set to zero");
10778 if (gotoLine <= max) {
10780 if (loopIter->cmd ==
"comment") {
10787 if (pos == gotoLine) {
10790 cm_msg(MINFO,
"ExecAutoRun",
"ExecAutoRun: will goto line %d", gotoLine);
10792 msg = QString(
"will go to line %1").arg(gotoLine);
10798 cm_msg(MERROR,
"ExecAutoRun",
"ExecAutoRun: goto line %d > max. line number (%d). Doesn't make sense. Will ignore it!", gotoLine, max);
10800 msg = QString(
"line number %1 > max. line number (%2). Doesn't make sense. Will ignore it.").arg(gotoLine).arg(max);
10822 size =
sizeof(demands);
10823 status =
fHVDemandKey->GetData(&demands, &size, TID_FLOAT);
10824 if (status != DB_SUCCESS) {
10826 QString err = QString(
"PLemAutoRun::GetDemandHVSampleChamber: Couldn't get demand HV's. Error too severe, will stop.");
10830 for (
int i=0; i<5; i++)
10842 int i, j, ok, size;
10858 msg = QString(
"ramp sample region HV's down.");
10865 value = 0.0 + j*0.001;
10866 for (i=0; i<5; i++)
10881 size =
sizeof(measured);
10886 for (i=0; i<5; i++) {
10893 if ((fabs(value) < 0.1) || (hv_down == 5)) {
10899 if (t.elapsed() > 3e5) {
10901 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't shut down sample region HV's. Will give it another try in 120 sec.");
10918 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't shut down sample region HV's. Error too severe, will stop.");
10920 for (
int k=0; k<5; k++) {
10922 cm_msg(MERROR,
"lemAutoRun",
"FUG channel %d should be 0.0 but found %f", k+
HV_FUG_RAL, measured[k+
HV_FUG_RAL]);
10930 msg = QString(
"ramp sample region HV's back up.");
10937 for (i=0; i<5; i++) {
10951 size =
sizeof(measured);
10956 for (i=0; i<5; i++) {
10968 if (t.elapsed() > 3e5) {
10970 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't ramp back sample region HV's. Will give it another try in 120 sec.");
10988 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't ramp back sample region HV's. Error too severe, will stop.");
11009 msg +=
"PLemAutoRun::SetBPV: lemvac equipment disabled in lemAutoRun. Will do nothing here.";
11020 msg = QString(
"Autorun running: ") + msg;
11025 if (arc->
param[0] ==
"X")
11031 if ((arc->
param[1] ==
"1") || (arc->
param[1] ==
"open"))
11064 size =
sizeof(value);
11095 size =
sizeof(value);
11109 if (t.elapsed() > 6e4) {
11138 size =
sizeof(value);
11144 fExp->FeedMidasWatchdog();
11165 float value, value1, value2, value3, value4, value5, value6;
11166 int size4 =
sizeof(value);
11169 struct timespec tp;
11170 clock_gettime(CLOCK_REALTIME, &tp);
11171 struct tm *timeinfo;
11172 timeinfo = localtime(&tp.tv_sec);
11173 char LSdateTime[32];
11174 snprintf(LSdateTime,
sizeof(LSdateTime),
"%02d,%02d,%04d,%02d,%02d,%02d,%03d",
11175 timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year + 1900,
11176 timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec,
11177 (
int)(tp.tv_nsec / 1000000));
11186 for (
int i=0; i<8; i++) {
11192 stream << LSdateTime <<
"," <<
11199 for (
int i=0; i<8; i++)
11200 stream <<
"," << rv[i];
11201 stream << Qt::endl;
11219 int count = timeout / 1000;
11221 for (
int i=0; i<count; i++) {
11223 fExp->FeedMidasWatchdog();
11227 if ((timeout % 1000) != 0) {
11228 ss_sleep(timeout % 1000);
11229 fExp->FeedMidasWatchdog();
11249 QString err = QString(
"PLemAutoRun: HV trip due to TD rate trip! Will wait until the problem is resolved.");
QString fDanfysikOutputPath
ODB path to the danfysik output variables.
#define BPV_STATE_LOCKED
BPVX/Y locked.
QVector< QString > fHvChName
void WaitUntilSampleLSReady()
QString fModDatePath
ODB path to the moderator growing date.
float fPrefNeedleValveAbsStep
absolute change in SampleTempConsiderNeedleValve
PKey * fTofMaxKey
pointer to the ODB key: TOF max
#define LS336_OUTPUT_PID_P
ODB Offset for P output L1.
ELemAutoRunKeyWords fKey
key tag for the parsing process
#define LAR_STATE_PAUSED
auto run state paused
void SampleTempConsiderFlow()
void SetOdbData(AutoRunCmd *arc)
QString fSetupBparEnabledPath
ODB path to the Bpar enabled flag.
void NetworkConnectionLost()
slot executed if the network connection is lost
PKey * fAlarmsKey
pointer to the ODB key: alarms
#define LAR_STATE_LOADING
tag needed to update the web-page without starting the run, process underway
QString fDanfysikFeName
name of the danfysik scfe in the ODB
PKey * fFOMOutputKey
pointer to the ODB key: FOM output values
QString fWEWInputPath
ODB path to the WEW input variable.
#define LAR_LOST_NETWORK_CONNECTION
lost network connection error tag
#define HTML_STOP
html stop tag
#define RUN_RUNNING
MIDAS run active tag.
void RunStart(AutoRunCmd *arc)
void SetFieldWEWL(AutoRunCmd *arc)
int fAutoRunState
autorun run state as defined under /AutoRun/Run State
void UpdateWebPage(PAutoRunCmdVector::Iterator currentIter, int tag, int lineNo=0, QString errMsg="")
#define LS_CTRL_ZONE
LS340/LS336 in table driven PID mode (zone settings)
float demand_T
setpoint to be reached
#define TEMP_HEATER_RANGE
heater range parameter tag
float fDFlowDp1
DFDP_0 + DFDP_1 * exp( DFDP_EXP * Temp )
QVector< float > * GetCurrentLimits()
void SetSampleHV(AutoRunCmd *arc)
bool fWarmUpVent
warmup with vent flag, false=no vent, true=vent
void SetGotoLine(const int line)
PLemAutoRun::SetGotoLine.
bool fNeedleValveInUse
Tag for use of electric needle valve.
QString GetUserAutoRunSeqFln()
PLemAutoRun::GetUserAutoRunSeqFln.
#define BH_INPUT_FLOW
ODB Offset for the measured flow value.
#define LAR_MIDAS_CANNOT_START_RUN
MIDAS cannot start run error tag.
#define HTML_FATAL
html fatal error, e.g. no autorun commands present
ELemHvSettingsKeyWords fKey
key tag for the parsing process
bool fSetupBparEnabled
true if the Bpar magnet is in use. This is fed with the Danfysik power supply.
QString fHVDetectorDemandPath
ODB path to the HV Detectors demand variables.
#define BEAMLINE_KV62_DEMAND_CH
ODB Index of the KV62 demand channel.
void ChangeSampleChamberHV(bool down)
bool fSampleFeRunning
flag indicating if the sample_scfe is running (LakeShore, BH)
#define TEMP_STABILITY_TIMEOUT
stability timeout parameter tag
float fBHFlowOffset
variable needed to calculate the flow if non is explicitly given (see SetTemp())
void TdHvTripFlagChanged(HNDLE, HNDLE, void *info)
#define LAR_FATAL
something unexpected really bad happend
float fHeatCapCof1
heat Capacity of cryo =
QString fSampleNamePath
ODB path to the sample name.
#define WEWL_OUTPUT_CURRENT
ODB Offset for the demand current of the WEWL.
void SetRA_HV(AutoRunCmd *arc)
PKey * fTflInputKey
pointer to the ODB key: tfl input values
PKey * fSetupWewEnabledKey
pointer to the ODB key: WEW enabled flag
#define WEW_SSP_LOCK
ODB Offset for the WEW-SSP lock.
#define RUN_PAUSED
MIDAS run paused tag.
QString fSampleOvenOmegaFeName
name of the oven omega scfe in the ODB
float GetEnergyLoss(float mod_hv)
void HandleOdbTitleTags(QString &title)
PLemAutoRun::HandleOdbTitleTags.
PKey * fClientsKey
pointer to the ODB key: running clients
#define LAR_MSG
message tag for the message/error handler
bool fTflFeRunning
flag indicating if the tfl_scfe is running
PKey * fSetupSampleEnabledKey
pointer to the ODB key: Sample enabled flag
float fPrefNeedleValveCof_4_0
NV setting = _1_0 * _1_1 * T for 15<T.
#define LS336_OUTPUT_SETPOINT
ODB Offset for the setpoint L1.
QString GetAutoRunSequence()
PLemAutoRun::GetAutoRunSequence.
void SetTemp(AutoRunCmd *arc)
#define LS336_INPUT_CF2
ODB Offset for the cold finger 2 sensor.
void SetSampleLSZoneSettings()
QVector< float > * GetHvDemands()
PKey * fModNameKey
pointer to the ODB key: moderator info
void SetFieldWEWH(AutoRunCmd *arc)
QString fTflInputPath
ODB path to the tfl input variables.
float fFlowMaxRelFlowDiffToConsider
maximum rel flow error to consider
float fBHMinFlow
min. allowed flow for the bronkhorst flow meter
#define LS336_OUTPUT_HEATER_MODE
ODB Offset for the heater control mode L1.
bool parse(QIODevice *device)
bool fSetupWewEnabled
true if the WEW magnet is in use. This is fed with the WEWL/H power supplies.
#define LS_CTRL_PID
LS340 in manual PID mode or LS336 in closed loop PID mode.
#define LS336_OUTPUT_HEATER_RANGE
ODB Offset for the heater range L1.
#define BPVX_SET
ODB offset for BPVX set cmd (output)
PLemAutoRunXMLParser(const QString fln, PLemAutoRun *lar)
bool fSetupSampleEnabled
true if the sample frontend is enabled (normal operation), otherwise MCP2 setup.
QString fLemvacOutputPath
ODB path to the lemvac output variables.
PAutoRunCmdVector::Iterator fAutoRunCurrentIter
current autorun cmd
PKey * fDanfysikInputKey
pointer to the ODB key: danfysik input variables
bool fHVFeRunning
flag indicating if the hv_fug_scfe is running
#define HV_FUG_MAX_TRY
number of HV update trials
#define LAR_FOM_CURRENT_NOT_REACHED
FOM current not reached.
#define SM_OUTPUT_NEEDLEVALVE
ODB offset for the demand value for the needlevalve.
bool fAnalyzerRunning
flag indicating if the analyzer is running
void SetFlowAndNeedleValve(QString flowParam, float &rampSpeed, float newDemandTemp, float deltaT, float flowScale)
#define HV_FUG_RIGHT_RODS
ODB Offset for the FUG HV of the right rods of the spin rotator.
QString fSpinRotAnglePath
ODB path to the spin rotation angle.
QString fMagFieldPath
ODB path to the magnetic field value.
QString fLemSetupPath
ODB path to the LEM setup info.
PKey * fDanfysikOutputKey
pointer to the ODB key: danfysik output variables
bool parse(QIODevice *device)
float fPrefNeedleValveCof_3_1
bool fRunCheckEvents
if true check number of events, otherwise check time
float fBHFlowPHeat0
see SampleTempAdjustFlow()
#define BPVX_STATE
ODB offset for BPVX state (input)
double datetime
time as obtained from the LS340 or the system
#define LAR_BPV_CLOSED_AT_RUN_START
BPVX/Y closed at run start.
float fDanfysikMaxCurrent
maximal allowed current for the danfysik power supply
#define WEWH_OUTPUT_CMD
ODB Offset for the WEWH cmd (0=off, 1=on, 2=reset, 3=reset-dsp.
#define HTML_WARMUP
html warmup tag
int fCurrentAutoRunCmd
number of the current autorun cmd
QString fFieldPwrSupply
name of the power supply to generate the magnetic field (WEWL, WEWH, danfysik)
void SetFOM(AutoRunCmd *arc)
bool fDumpInUse
flag telling if a raw data dump is going on
QString fXMLAutoRunValidateFln
path-file name of the generated XML-autorun sequence for validation
void CheckMidasAlarms(PAutoRunCmdVector::Iterator iter)
void SetTfl(AutoRunCmd *arc)
PLemAutoRun::SetTfl.
bool parse(QIODevice *device)
#define WEWH_INPUT_CURRENT
ODB Offset for the measured current of the WEWH.
SampleTempInfo fSampleTempHisto[SAMPLE_TEMP_HISTO_MAX]
array holding the sample temperature history
QString fFOMOutputPath
ODB path to the FOM output variables.
#define WEWH_OUTPUT_CURRENT
ODB Offset for the demand current of the WEWH.
void StatusMsg(const QString statusMsg)
float fAbsMaxTempDiff
absolute temperature deviation allowed in stability test
int noElements
number of parameters used for this command
float fHeaterMin
min. acceptable heater value
float flow
helium flow (read back)
#define NO_ENERGY_LOSS_PARAM
float fWEWHMaxCurrent
maximal allowed current for the WEWH power supply
QString fLemvacFeName
name of the lemvac_scfe in the ODB
#define LAR_FIELD_NOT_REACHED
field not reached within timeout error tag
float fHVDemandSampleChamber[5]
demand HV of the sample chamber
QString fAutoRunSequence
autorun sequence file name as found under /AutoRun/Auto Run Sequence
void GetDemandHVSampleChamber()
#define BH_INPUT_VALVE
ODB Offset for the measured BH valve opening.
QString param[LAR_MAX_PARAM]
parameter list of the command
#define LAR_SAMPLE_HV_NOT_REACHED
sample high voltage not reached within timeout error tag
void SetFieldDanfysik(AutoRunCmd *arc)
#define DANFYSIK_INPUT_CURRENT
ODB Offset for the measured current of the danfysik.
void SetOmegaSetpoint(float setpoint)
#define HTML_STRANGE
html strange autorun starting condition tag
void ErrorMsg(int noOfErrors, int idx, int errorNo, int line, QString errorMsg)
QString fSampleOvenOmegaInputPath
ODB path to the sample oven omega: input variables.
void SetLEMSetup(AutoRunCmd *arc)
QString fAlarmsPath
ODB path to the alarms.
float fBHFlowTemp
variable needed to calculate the flow if non is explicitly given (see SetTemp())
QString fMagParamBparPath
ODB path to the Bpar parameters (A -> G)
#define TEMP_I_PID
I (PID) parameter tag.
PKey * fSampleSensorTypeKey
pointer to the ODB key: sample cryo LakeShore sensor type assignement
QString fAutoRunPath
path to the autorun sequence directory
QString fXMLAutoRunHTML
path-file name of the HTML autorun status page
QString fBeamlineDemandPath
ODB path to the beamline demand variables.
float fDSetRatio
ratio at which the PID-D has to be switched back (for temperature increase)
int fGotoLine
address to jump to within a running autorun. Defined under /AutoRun/GotoLine
float fPrefNeedleValveCof_1_1
#define HV_FUG_SAMPLE
ODB Offset for the FUG HV of the sample.
QString fRunInfoPath
ODB path to the run info.
#define HV_FUG_RAT
ODB Offset for the FUG HV of the top ring anode.
PKey * fSpinRotMagOutputKey
pointer to the ODB key: danfysik spin rotator output variables
int state
1 = stopped, 2 = paused, 3 = running
#define LAR_LS_TEMP_NOT_STABLE
sample temperature is out of the tolerance band
#define LS336_OUTPUT_RAMP
ODB Offset for the demand temperature ramping L1.
void DegaussDanfysik(AutoRunCmd *arc)
QString fAlarmTdHvTripPath
ODB path to the TD HV trip alarm/warning.
void FeedLiveDataAutoRun()
PLemAutoRun::FeedLiveDataAutoRun.
QString fNextAutoRunSequence
next autorun sequence file name as found under /AutoRun/Next
#define LAR_MIDAS_READBACK_FAILURE
MIDAS readback verification timeout fired.
QString fSampleFeName
name of the tfl_scfe in the ODB
#define SAMPLE_CRYO_OUTPUT
#define TEMP_P_PID
P (PID) parameter tag.
float fDFlowDp0
calculates d(flow)/dP from d(flow)/dP =
double fSampleHistoTime
time stamp of the current reading in seconds since 1-1-2000
PLemAutoRun * fLar
pointer to the calling class
PKey * fHVDetectorMeasuredKey
pointer to the ODB key: HV Detector measured values
PKey * fSampleChannelKey
pointer to the ODB key: sample cryo LakeShore channel assignement
bool fEnableAll
flag telling if all watched clients and equipments will be enabled/disabled by default.
float SetDemandTempRamping(QString rampParam)
#define HTML_ABORTED
html abortion tag
QFile fDumpFile
file for dumping raw_voltage
bool ShowComments()
PLemAutoRun::ShowComments.
float fFlowTimeoutReduction
timeout between gradual flow reduction while cooling
#define BPVY_STATE
ODB offset for BPVY state (input)
float fFieldTimeout
time in which the field ramping must be accomplished (in (sec))
void UpdateRunState(const int state)
UpdateRunState.
#define BPV_CLOSE
closing command for BPVX/Y
PKey * fSpinRotAngleKey
pointer to the ODB key: spin rotation angle
float fMaxTempIncrease
maximal temperature increase without shuting down the HV
#define BEAMLINE_KV61_DEMAND_CH
ODB Index of the KV61 demand channel.
float fBHMaxFlow
max. allowed flow for the bronkhorst flow meter
#define LS336_OUTPUT_PID_I
ODB Offset for I output L1.
#define LS336_INPUT_PID_D
ODB Offset for the D value of the PID L1 (read back)
int CheckFieldCmd(QString &errMsg)
#define LAR_STATE_STOPPED
auto run state stopped, i.e. idle
PLemAutoRun(QString &host, QString &exp)
#define LAR_MIDAS_KEY_FAILURE
MIDAS key failure error tag.
#define LAR_FUG_NO_RESPONSE
FUG high voltage not responding error tag.
SampleTempInfo fSampleTempTrend
1st derivative of the quadratic model of the temperature control parameters
QString fHVMeasuredPath
ODB path to the FUG HV measured variables.
int fHvTripFlag
flag: set if the TD HV trip alarm fired
#define HV_FUG_RAL
ODB Offset for the FUG HV of the left ring anode.
QString fTofMaxPath
ODB path to the TOF max.
bool CheckForTransportHvCmd()
bool fFrontendRunning
flag indicating if the frontend is running
#define SPINT_ROT_OUTPUT_CURRENT
ODB Offset for the demand current of the Spin Rotator Magnet output.
float fFOMCurrentAccuracy
current accuracy needed before going on (in (mA))
#define HTML_PARSE_ERROR
html autorun script parse error tag
PKey * fLemvacInputKey
pointer to the ODB key: lemvac input values
#define BPVY_ENABLED
ODB offset for BPVY enabled flag (output)
#define HV_FUG_LEFT_RODS
ODB Offset for the FUG HV of the left rods of the spin rotator.
int lineNo
line number from where in the user auto run sequence the command originates
#define LS336_INPUT_SETPOINT
ODB Offset for the setpoint L1 read back.
#define HTML_RUNNING
html running tag
QString fModNamePath
ODB path to the moderator info.
#define TEMP_RAMP
ramping parameter tag
float fHeatCapCof2
HC_1 * T + HC_2 * T² + HC_3 * T³
#define LAR_XML_FILE_MISSING
XML file missing error tag.
#define HV_FUG_MOD
ODB Offset for the FUG HV of the moderator.
bool fWEWFeRunning
flag indicating if the wew_scfe is running
float fSampleOvenOmegaInput[SAMPLE_OVEN_OMEGA_INPUT]
QString fSampleCtrlChPath
ODB path to the sample cryo LakeShore control channel.
void SetBPV(AutoRunCmd *arc)
bool fWarmUpWished
warmup command present
#define HV_FUG_LENSE_2
ODB Offset for the FUG HV of the lense 2.
bool fRAPulsingEnabled
flag: if true, the RA pulsing is enabled and hence WEW can take any field values. ...
#define WEWL_INPUT_CURRENT
ODB Offset for the measured current of the WEWL.
POdbTagVector * fOdbTagVector
pointer to the ODB tag list
PKey * fEnergyLossParamKey
pointer to the ODB key: energy loss parameters
#define HV_FUG_RIGHT_PLATE
ODB Offset for the FUG HV of the right plate of the spin rotator.
QString fTriggerEventsPath
ODB path to the trigger events.
#define LS336_INPUT_PRESSURE
ODB Offset for the He pressure before the bronkhorst.
~PLemHvSettingsFileParser()
float fRunTimeout
time in sec after which the run shall be stopped.
void GotoLine(PAutoRunCmdVector::Iterator &iter, int max)
#define HTML_ALARM
html alarm tag
PKey * fSampleOvenOmegaOutputKey
pointer to the ODB key: sample oven omega output values
float fPrefNeedleValveCof_4_1
#define WEWL_OUTPUT_CMD
ODB Offset for the WEWL cmd (0=off, 1=on, 2=reset, 3=reset-dsp.
float fFlowSetAbsolute
absolute flow deviation allowed in stability test
float fFlowSetRatio
relative flow deviation allowed in stability test
QString fSampleOvenOmegaOutputPath
ODB path to the sample oven omega: output variables.
float fMaxTempTrend
max. acceptable temperature trend
QString fMagParamWewPath
ODB path to the WEW parameters (A -> G)
#define BPVX_ENABLED
ODB offset for BPVX enabled flag (output)
bool fDanfysikFeRunning
flag indicating if the danfysik_scfe is running
QString fClientsPath
ODB path to the running clients.
#define CRYO_LOWTEMP
LowTemp cryo in use.
QString fSampleSensorTypePath
ODB path to the sample cryo LakeShore sensor type assignement.
#define LAR_RA_HV_OFF_AT_RUN_START
RA HV's off at run starts.
PKey * fSpinRotEnabledKey
pointer to the ODB key: spin rotation enabled flag
void SetTitle(AutoRunCmd *arc)
~PLemSampleCryoXMLParser()
void SampleTempSetNeedleValve(float value)
PKey * fHVDetectorDemandKey
pointer to the ODB key: HV Detector demand values
void Degauss(AutoRunCmd *arc)
float SampleTempPrefHeaterOutput(float heaterRange)
#define LAR_STATE_LOAD
tag needed to update the web-page without starting the run, process starting
PKey * fBeamlineDemandKey
pointer to the ODB key: Beamline demand values
#define SPINT_ROT_INPUT_CURRENT
ODB Offset for the demand current of the Spin Rotator Magnet output.
PKey * fTofMinKey
pointer to the ODB key: TOF min
double fSampleHistoLastTime
time stamp of the previous reading in seconds since 1-1-2000
#define LAR_BPVY_NO_RESPONSE
BPVY not responding error tag.
float fHVTimeout
time in which the HV ramping must be accomplished (in (sec))
#define BH_OUTPUT_FLOW
ODB Offset for the demand flow value.
#define OMEGA_OVEN_INPUT_SETPOINT
ODB Offset for the setpoint read back.
bool fSampleTempUnstable
flag: true if the temperature is out of bound
PKey * fTflOutputKey
pointer to the ODB key: tfl output values
PKey * fHVDemandKey
pointer to the ODB key: FUG HV demand values
#define SC_VENT_CMD
ODB offset for SC vent command tag (output)
#define CRYO_OVEN_OMEGA
Oven in use, controlled by Omega Controller.
float fTimeoutFlowSet
timeout before the flow can be changed next time (see SetTemp())
QString fSpinRotEnabledPath
ODB path to the spin rotation enabled flag.
#define TEMP_D_PID
D (PID) parameter tag.
QString fAnalyzerName
name of the analyzer in the ODB
PKey * fMagParamWewKey
pointer to the ODB key: WEW magnet parameters (A -> G)
void SetIgnoreClients(AutoRunCmd *arc)
#define HV_NHQ_TD_LAST
ODB Offset for the NHQ HV of the last element of the TD.
QString fDumpFileName
file name of the raw voltage dump. It will be RawVoltageOutput-<cryo>-<datatime>.dat, e.g. RawVoltageOutput-Konti4-220316-1235.dat
float fRelMaxTempDiff
relative temperature deviation allowed in stability test
float fBHFlowDHeat
see SampleTempAdjustFlow()
PKey * fMagFieldKey
pointer to the ODB key: magnetic field value
PKey * fSampleOvenOmegaInputKey
pointer to the ODB key: sample oven omega input values
float fBHFlowTempOffset
variable needed to calculate the flow if non is explicitly given (see SetTemp())
QString fDanfysikInputPath
ODB path to the danfysik input variables.
QString fHVCurrentPath
ODB path to the FUG HV measured current variables.
void SetFlow(QString flowParam)
QString fTofMinPath
ODB path to the TOF min.
QVector< QString > * GetHvChNames()
#define TEMP_FLOW
flow parameter tag
#define LS336_INPUT_RAMP
ODB Offset for the demand temperature ramping read back.
float measured_T
measured temperature of the sample
bool CheckOdbType(INT type, AutoRunCmd *arc)
bool fLemvacFeRunning
flag indicating if the lemvac_scfe is running
#define FOM_CURRENT_DEMAND
ODB Index of the FOM current setpoint.
#define DANFYSIK_OUTPUT_CURRENT
ODB Offset for the demand current of the danfysik.
#define LS336_INPUT_HEATER_MODE
ODB Offset for the heater control mode read back.
float fFlowFactor
constant used in SampleTempConsiderFlow()
void SetLSSetpoint(float setpoint, float rampSpeed)
QVector< float > fHvDemand
QString fXMLSchemaFln
path-file name of the XML-schema for the parsing process
QString fEnergyLossParamPath
ODB path to the energy loss parameters.
SampleTempInfo fSampleTempAverage
average temperature control parameters
float heater
sample heater
#define LAR_RECIEVED_SHUTDOWN_CMD
recieved shutdown cmd tag
void SetModInfo(AutoRunCmd *arc)
QString fExpName
experiment name
void SetTempOvenOmega(AutoRunCmd *arc)
int fDumpCounter
counter of raw voltage dumps
PKey * fSampleCryoKey
pointer to the ODB key: sample cryo name
PKey * fSampleRawVoltageKey
pointer to the ODB key: sample cryo raw voltage
float fPrefNeedleValveCof_2_1
float fMagParamBpar[2]
calibration array for the Bpar
void FeedLiveDataErrors(int noOfErrors, int idx, int, int line, QString errorMsg)
int fSampleBhOdbOffsetInput
ODB offset of the bronkhorst within the ODB (input variables)
QString fXMLAutoRunFln
path-file name of the generated XML-autorun sequence
int fSampleHistoNoEntries
number of entries in the history
#define SC_VENT_ENABLED
ODB offset for SC vent enable flag (output)
#define TEMP_DELTA_T
delta T parameter tag
#define HV_NHQ_MCP1
ODB Offset for the NHQ HV of the MCP1.
#define SAMPLE_CRYO_INPUT
void UpdateStatusMsg(const QString statusMsg)
void SetTof(AutoRunCmd *arc)
void SetIgnoreAlarms(AutoRunCmd *arc)
void SetOdbDataArray(AutoRunCmd *arc)
void RunStop(AutoRunCmd *arc)
int fSampleHistoPos
index of the start of the ring buffer
#define LAR_STATE_NEXT
tag showing that a next autrun shall be executed
void SetHvOff(AutoRunCmd *arc)
#define WEWL_INPUT_STATUS
ODB Offset for the WEWL status.
#define HV_FUG_RAR
ODB Offset for the FUG HV of the right ring anode.
PLemSampleCryoXMLParser(const QString fln, PLemAutoRun *lar)
void WarmUp(PAutoRunCmdVector::Iterator iter)
PKey * fLemSetupKey
pointer to the ODB key: LEM setup info
int fSampleBhOdbOffsetOutput
ODB offset of the bronkhorst within the ODB (output variables.
void CheckForOdbSetDataCmds()
QString fSampleChannelPath
ODB path to the sample cryo LakeShore channel assignement.
#define HV_FUG_LENSE_3
ODB Offset for the FUG HV of the lense 3.
float NeedleValve(float Tset)
#define LAR_STATE_STARTING
auto run state is: starting up
void SetSpinRot(AutoRunCmd *arc)
bool fSampleTempRegulation
flag: if true temperature regulation algorithm is active, otherwise not
#define FOM_STANDBY
ODB Index of the FOM stanby flag.
#define BPV_OPEN
opening command for BPVX/Y
PKey * fSetupBparEnabledKey
pointer to the ODB key: Bpar enabled flag
int fSampleCtrlCh
index of channel A or B
friend void TdHvTripFlagChanged(HNDLE, HNDLE, void *)
float fPrefNeedleValveRelStep
relative change in SampleTempConsiderNeedleValve
#define BPV_STATE_CLOSED
BPVX/Y closed.
void SetLSHeaterRangeAndPIDs(AutoRunCmd *arc)
QMap< QString, bool > fEnabled
map holding the enable/disable info of all the clients and equipments
bool fSampleOvenOmegaFeRunning
flag indicating if the omega_scfe is running
void SetTransportHV(AutoRunCmd *arc)
bool fRunStopped
flag telling if a run is stopped
void DegaussWEW(AutoRunCmd *arc)
QDateTime fWarmUpDateTime
when the warmup shall take place
void SetFlowTweak(float flow)
ELemSampleCryoKeyWords fKey
key tag for the parsing process
PKey * fTriggerEventsKey
pointer to the ODB key: trigger event
PKey * fSampleInputKey
pointer to the ODB key: sample cryo input values
float pressure
helium pressure at cryo outlet
float fMagParamWew[2]
calibration array for the WEW
#define CRYO_KONTI
Konti cryo in use.
PKey * fModDateKey
pointer to the ODB key: moderator growing date
QString fTflOutputPath
ODB path to the tfl output variables.
QString fHVDemandPath
ODB path to the FUG HV demand variables.
QXmlStreamReader fXml
xml stream reader object
SampleTempInfo fSampleTempSecond
2nd derivative of the quadratic model of the temperature control parameters
bool LoadHvSettings(PAutoRunCmdVector::Iterator currentIter, QString fln, int lineNo, bool simulated=false)
void HandleParseError(int noOfErrors, int idx, int errorNo, int line, QString errorMsg)
#define OMEGA_OVEN_INPUT_TEMP
ODB Offset for the temperature read back.
QString fSetupWewEnabledPath
ODB path to the WEW enabled flag.
PKey * fWEWInputKey
pointer to the ODB key: WEW input values
#define LS336_INPUT_HEATER
ODB Offset for the heater L1 read back.
PKey * fAlarmTdHvTripKey
pointer to the ODB key: TD HV trip trigger flag
#define LAR_MSG_NO_LINE_NO
message tag for the message/error handler for no line number information
bool fIgnoreClients
flag: if true checking of clients will not performed: only for testing!!
void ReceivedShutdownCmd()
slot executed if a shutdown command has been received
PLemHvSettingsFileParser(const QString fln)
float EmpiricalFlow(float Tset, float rampSpeed)
QString fSampleInputPath
ODB path to the sample cryo (LakeShore, bronkhorst) input variables.
#define WEWH_INPUT_STATUS
ODB Offset for the WEWH status.
int GetRunState()
PLemAutoRun::GetRunState.
void SetLSMode(AutoRunCmd *arc)
PKey * fSampleNameKey
pointer to the ODB key: Sample Name
#define RUN_STOPPED
MIDAS run stopped tag.
#define LS336_INPUT_CF1
ODB Offset for the cold finger 1 sensor.
#define FOM_CURRENT_MEASURED
ODB Index of the FOM current reading.
QElapsedTimer fRunStarted
time stamp, when a run started
#define HV_FUG_MIRROR
ODB Offset for the FUG HV of the mirror.
QString fSampleOutputPath
ODB path to the sample cryo (LakeShore, bronkhorst) output variables.
PKey * fSampleOutputKey
pointer to the ODB key: sample cryo output values
PKey * fHVMeasuredKey
pointer to the ODB key: FUG HV measured values
QVector< float > fCurrentLimit
QString fWEWOutputPath
ODB path to the WEW output variable.
#define SAMPLE_TEMP_HISTO_MAX
PKey * fSampleNoConnectionKey
pointer to the ODB key: sample cryo no connection
QString fFOMInputPath
ODB path to the FOM input variables.
#define LAR_LS_INPUT_NONSENSE
sample lakshore readback doesn't make any sense
QString fHVDetectorMeasuredPath
ODB path to the HV Detectors measured variables.
int GetGotoLine()
PLemAutoRun::GetGotoLine.
float fSampleOutput[SAMPLE_CRYO_OUTPUT]
float fSampleOvenOmegaOutput[SAMPLE_OVEN_OMEGA_OUTPUT]
float fFlowLowestFlowToConsider
lowest demand flow to consider
float fSampleInput[SAMPLE_CRYO_INPUT]
#define CRYO_NO
no cryo in use
QXmlStreamReader fXml
xml stream reader object
double LakeShoreTime(char *str)
#define HV_FUG_RAB
ODB Offset for the FUG HV of the bottom ring anode.
float fWEWCriticalCurrentRA
critical current for the WEW. For larger currents, the RA HV's should be switched off due to the Penn...
PKey * fRunCommentKey
pointer to the ODB key: run comment
float fWEWLMaxCurrent
maximal allowed current for the WEWL power supply
float fEnergyLossParam[NO_ENERGY_LOSS_PARAM]
energy loss parameters
int fSampleCryoInUse
-1 = no cryo in use, 0 = Konti-Cryo in use, 1 = LowTemp-Cryo, 2 = Oven in use
QString fAutoRunStatusMsg
autorun status message as defined under /AutoRun/Status
void CheckTempStabilityOvenOmega()
bool fDebug
flag: if true additional messages will be sent to the stdin
bool fShowComments
flag indicating if comments shall be suppressed. Defined under /AutoRun/Shows Comments ...
int fNoOfAutoRunCmds
number of autorun cmd's
#define LS336_INPUT_HEATER_RANGE
ODB Offset for the heater range read back.
bool fLargeFlow
signaling extra large flow during cool down
#define HV_FUG_CHS
number of HV channels
void SampleTempAdjustFlow()
void SampleTempConsiderNeedleValve()
void DegaussSpinRot(AutoRunCmd *arc)
QString fHVFeName
name of the hv_fug_scfe in the ODB
PAutoRunCmdVector * fAutoRunCmdVector
pointer to the autorun cmd list
float fHVAccuracy
HV accuracy needed before going on (in (kV))
void InitEnabled()
PLemAutoRun::InitEnabled.
QString fSpinRotMagInputPath
ODB path to the danfysik spin rotator magnet power supply input variables.
QString fLemvacInputPath
ODB path to the lemvac input variables.
#define TEMP_DEMAND_TEMP
demand temperature parameter tag
PKey * fHVCurrentKey
pointer to the ODB key: FUG HV measured current values
PLemAutoRun * fLar
pointer to the calling class
QVector< int > * GetChNo()
float fPrefNeedleValveCof_3_0
NV setting = _1_0 * _1_1 * T for 10<T<15.
PKey * fWEWOutputKey
pointer to the ODB key: WEW output values
PKey * fMagParamBparKey
pointer to the ODB key: Bpar magnet parameters (A -> G)
PKey * fLemvacOutputKey
pointer to the ODB key: lemvac output values
float fFieldAccuracy
field accuracy needed before going on (in (A))
float fPrefNeedleValveCof_2_0
NV setting = _1_0 * _1_1 * T for 8<T<10.
#define LAR_MIDAS_FE_NOT_RUNNING
MIDAS frontend not running error tag.
#define LAR_MIDAS_ODB_FAILURE
MIDAS odb failure error tag.
float fBHFlowPHeat1
see SampleTempAdjustFlow()
void SetDump(AutoRunCmd *arc)
#define LAR_STOP_STOP_NONSENSE
run stopped and STOP command called: doesn't make any sense
QString fSpinRotMagOutputPath
ODB path to the danfysik spin rotator magnet power supply output variables.
PKey * fFOMInputKey
pointer to the ODB key: FOM input values
void SetField(AutoRunCmd *arc)
QString fWEWFeName
name of the WEW scfe in the ODB
QString fFrontendName
name of the frontend in the ODB
#define SM_MODUS_NEEDLEVALVE
ODB offset for the modus value for the needlevalve.
bool isValid(QString &errMsg)
PExperiment * fExp
pointer to the midas experiment
void SetWait(AutoRunCmd *arc)
#define SM_INPUT_NEEDLEVALVE
ODB offset for the read_back for the needlevalve.
bool fFugHvCheck
flag: if true demand==measured checks for the FUG HV devices will be performed, otherwise not...
float fLemVacValveInitialState[2]
states of BPVX, BPVY before set temperature
void CheckTempStability()
bool fIgnoreAlarms
flag: if true checking for any alarms will not performed: only for testing!!
#define HV_FUG_LEFT_PLATE
ODB Offset for the FUG HV of the left plate of the spin rotator.
QString fHostName
host name on which the experiment is running
#define LAR_MIDAS_NO_RUN_TRANSITION
MIDAS no run transition notification obtained within 60sec.
RunInfo fRunInfo
run info structure (mirror of the ODB /Runinfo)
#define LAR_XML_MISSING_ENTRY
XML missing entry error tag.
SampleTempInfo fSampleTempRmsqd
RMS of the quadratic model of the temperature control parameters.
float fPrefNeedleValveCof_1_0
NV setting = _1_0 * _1_1 * T for T<8.
float fHeaterMax
max. acceptable heater value
PKey * fRunInfoKey
pointer to the ODB key: run info
#define LAR_FORCED_RA_OFF
forced switch off of the RA HV's
void setAttribute(const QString key, const QXmlStreamAttributes &qAttr)
PLemAutoRunXMLParser::setAttribute.
#define BPV_STATE_OPEN
BPVX/Y open.
QString fEnableOnOffModePath
ODB path to the enable On/Off mode, e.g. red/green, pulsing RA.
#define LAR_STATE_RUNNING
auto run state running
#define LS336_OUTPUT_PID_D
ODB Offset for D output L1.
int fRunNoEventsNeeded
number of events needed to complete a run
QString fSetupSampleEnabledPath
ODB path to the sample enabled flag.
QString cmdString
untouched original lar-cmd string
QXmlStreamReader fXml
xml stream reader object
QString fSampleRawVoltagePath
ODB path to the LakeShore Raw Voltage.
#define HV_NHQ_TD_FIRST
ODB Offset for the NHQ HV of the first element of the TD.
#define BPVY_SET
ODB offset for BPVY set cmd (output)
QString fSampleCryoPath
ODB path to the sample cryo name used.
#define OMEGA_OVEN_OUTPUT_SETPOINT
ODB Offset for the setpoint.
QString fRunCommentPath
ODB path to the run comment.
void SetEnabled(const QString key, bool val)
PLemAutoRun::SetEnabled.
float fSampleTempAccuracy
temperature tolerance
PKey * fSpinRotMagInputKey
pointer to the ODB key: danfysik spin rotator input variables
PKey * fSampleCtrlChKey
pointer to the ODB key: sample cryo LakeShore control channel
#define HTML_LOAD
html load tag