31 #include <QCoreApplication>
35 #include <QStringList>
36 #include <QMapIterator>
46 #define CRYO_LOWTEMP 1
47 #define CRYO_OVEN_OMEGA 2
58 #define BPVX_ENABLED 0
60 #define BPVY_ENABLED 2
64 #define BPV_STATE_OPEN 5120
65 #define BPV_STATE_CLOSED 3072
67 #define SC_VENT_ENABLED 6
71 #define LS340_CTRL_PID 1
72 #define LS340_CTRL_ZONE 2
74 #define LS340_INPUT_CF1 0
75 #define LS340_INPUT_CF2 1
76 #define LS340_INPUT_PRESSURE 2
77 #define LS340_INPUT_HEATER 7
78 #define LS340_INPUT_SETPOINT 8
79 #define LS340_INPUT_PID_P 9
80 #define LS340_INPUT_PID_I 10
81 #define LS340_INPUT_PID_D 11
82 #define LS340_INPUT_HEATER_RANGE 12
83 #define LS340_INPUT_HEATER_MODE 13
84 #define LS340_INPUT_RAMP 14
86 #define LS340_OUTPUT_REMOTE 0
87 #define LS340_OUTPUT_SETPOINT 1
88 #define LS340_OUTPUT_PID_P 2
89 #define LS340_OUTPUT_PID_I 3
90 #define LS340_OUTPUT_PID_D 4
91 #define LS340_OUTPUT_HEATER_RANGE 5
92 #define LS340_OUTPUT_HEATER_MODE 6
93 #define LS340_OUTPUT_RAMP 7
95 #define OMEGA_OVEN_INPUT_TEMP 0
96 #define OMEGA_OVEN_INPUT_SETPOINT 6
98 #define OMEGA_OVEN_OUTPUT_SETPOINT 0
101 #define SM_INPUT_NEEDLEVALVE 0
102 // NeedleValve output
103 #define SM_OUTPUT_NEEDLEVALVE 0
104 #define SM_MODUS_NEEDLEVALVE 1
106 #define BH_INPUT_FLOW 0
107 #define BH_INPUT_VALVE 1
109 #define BH_OUTPUT_FLOW 0
110 // Danfsik Spin Rotator Magnet Current
111 #define SPINT_ROT_OUTPUT_CURRENT 2
112 #define SPINT_ROT_INPUT_CURRENT 3
114 #define DANFYSIK_INPUT_CURRENT 3
116 #define DANFYSIK_OUTPUT_CURRENT 2
118 #define WEWL_INPUT_STATUS 0
119 #define WEWL_INPUT_CURRENT 1
120 #define WEWH_INPUT_STATUS 3
121 #define WEWH_INPUT_CURRENT 4
123 #define WEWL_OUTPUT_CMD 0
124 #define WEWL_OUTPUT_CURRENT 1
125 #define WEWH_OUTPUT_CMD 2
126 #define WEWH_OUTPUT_CURRENT 3
127 #define WEW_SSP_LOCK 4
129 #define HV_FUG_MAX_TRY 5
130 #define HV_FUG_CHS 16
131 #define HV_FUG_RIGHT_RODS 0
132 #define HV_FUG_LEFT_RODS 1
133 #define HV_FUG_LEFT_PLATE 2
134 #define HV_FUG_RIGHT_PLATE 3
136 #define HV_FUG_MIRROR 8
137 #define HV_FUG_LENSE_2 9
138 #define HV_FUG_LENSE_3 10
139 #define HV_FUG_RAL 11
140 #define HV_FUG_RAR 12
141 #define HV_FUG_RAT 13
142 #define HV_FUG_RAB 14
143 #define HV_FUG_SAMPLE 15
145 #define HV_NHQ_TD_FIRST 0
146 #define HV_NHQ_TD_LAST 3
147 #define HV_NHQ_MCP1 4
149 #define FOM_CURRENT_MEASURED 0
150 #define FOM_VOLTAGE_MEASURED 1
151 #define FOM_BATTERY 2
153 #define FOM_CURRENT_DEMAND 0
154 #define FOM_STANDBY 1
155 // Beamline KV61, KV62 indices
156 #define BEAMLINE_KV61_DEMAND_CH 26
157 #define BEAMLINE_KV62_DEMAND_CH 28
162 #define HTML_RUNNING 2
164 #define HTML_ABORTED 4
166 #define HTML_WARMUP 6
167 #define HTML_STRANGE 7
168 #define HTML_PARSE_ERROR 8
172 #define TEMP_DEMAND_TEMP 0
173 #define TEMP_DELTA_T 1
174 #define TEMP_STABILITY_TIMEOUT 2
176 #define TEMP_HEATER_RANGE 4
183 #define LAR_TT_IDLE 0
184 #define LAR_TT_FINISHED 1
185 #define LAR_TT_ABORTED 2
186 #define LAR_TT_WARMUP 3
235 const QString& qName,
236 const QXmlAttributes& qAttr)
238 if (qName ==
"xmlSchemaFln") {
239 fKey = eXmlSchemaFln;
240 }
else if (qName ==
"xmlAutoRunFln") {
241 fKey = eXmlAutoRunFln;
242 }
else if (qName ==
"xmlAutoRunValidateFln") {
243 fKey = eXmlAutoRunValidateFln;
244 }
else if (qName ==
"xmlAutoRunHTML") {
245 fKey = eXmlAutoRunHTML;
246 }
else if (qName ==
"enable_all") {
248 }
else if (qName ==
"autoRunPath") {
250 }
else if (qName ==
"hvSettingsPath") {
251 fKey = eHvSettingsPath;
252 }
else if (qName ==
"debug") {
254 }
else if (qName ==
"ignore_clients") {
255 fKey = eIgnore_clients;
256 }
else if (qName ==
"ignore_alarms") {
257 fKey = eIgnore_alarms;
258 }
else if (qName ==
"fug_hv_check") {
260 }
else if (qName ==
"field_timeout") {
261 fKey = eField_timeout;
262 }
else if (qName ==
"field_accuracy") {
263 fKey = eField_accuracy;
264 }
else if (qName ==
"hv_timeout") {
266 }
else if (qName ==
"hv_accuracy") {
268 }
else if (qName ==
"fom_current_accuracy") {
269 fKey = eFOM_current_accuracy;
270 }
else if (qName ==
"wew_critical_current_ra") {
271 fKey = eWEW_critical_current_ra;
272 }
else if (qName ==
"wewl_max_current") {
273 fKey = eWEWL_max_current;
274 }
else if (qName ==
"wewh_max_current") {
275 fKey = eWEWH_max_current;
276 }
else if (qName ==
"danfysik_max_current") {
277 fKey = eDanfysik_max_current;
278 }
else if (qName ==
"trigger_events") {
279 fKey = eTrigger_events;
280 setAttribute(
"trigger_events_odb", qAttr);
281 }
else if (qName ==
"enable_on_off_mode") {
282 fKey = eEnable_OnOff_Mode;
283 setAttribute(
"enable_on_off_mode_odb", qAttr);
284 }
else if (qName ==
"alarms") {
286 setAttribute(
"alarms_odb", qAttr);
287 }
else if (qName ==
"alarms_td_hv_trip") {
288 fKey = eAlarm_td_hv_trip;
289 setAttribute(
"alarms_td_hv_trip_odb", qAttr);
290 }
else if (qName ==
"run_info") {
292 }
else if (qName ==
"run_comment") {
294 setAttribute(
"run_comment_odb", qAttr);
295 }
else if (qName ==
"tof_min") {
297 setAttribute(
"tof_min_odb", qAttr);
298 }
else if (qName ==
"tof_max") {
300 setAttribute(
"tof_max_odb", qAttr);
301 }
else if (qName ==
"mod_name") {
303 setAttribute(
"mod_name_odb", qAttr);
304 }
else if (qName ==
"mod_date") {
306 setAttribute(
"mod_date_odb", qAttr);
307 }
else if (qName ==
"lem_setup") {
309 setAttribute(
"lem_setup_odb", qAttr);
310 }
else if (qName ==
"sample_name") {
312 setAttribute(
"sample_name_info_odb", qAttr);
313 }
else if (qName ==
"spin_rot_enabled") {
314 fKey = eSpin_rot_enabled;
315 setAttribute(
"spin_rot_calib_odb", qAttr);
316 }
else if (qName ==
"spin_rot_angle") {
317 fKey = eSpin_rot_angle;
318 setAttribute(
"spin_rot_angle_odb", qAttr);
319 }
else if (qName ==
"mag_param_wew") {
320 fKey = eMag_param_wew;
321 setAttribute(
"mag_param_wew_odb", qAttr);
322 }
else if (qName ==
"mag_param_bpar") {
323 fKey = eMag_param_bpar;
324 setAttribute(
"mag_param_bpar_odb", qAttr);
325 }
else if (qName ==
"setup_sample_enabled") {
326 fKey = eSetup_sample_enabled;
327 setAttribute(
"setup_sample_odb", qAttr);
328 }
else if (qName ==
"setup_wew_enabled") {
329 fKey = eSetup_wew_enabled;
330 setAttribute(
"setup_wew_odb", qAttr);
331 }
else if (qName ==
"setup_bpar_enabled") {
332 fKey = eSetup_bpar_enabled;
333 setAttribute(
"setup_bpar_odb", qAttr);
334 }
else if (qName ==
"sample_cryo") {
336 setAttribute(
"sample_cryo_info_odb", qAttr);
337 }
else if (qName ==
"energy_loss_param") {
338 fKey = eEnergy_loss_param;
339 setAttribute(
"energy_loss_param_odb", qAttr);
340 }
else if (qName ==
"clients") {
342 }
else if (qName ==
"clients_analyzer") {
343 fKey = eClients_analyzer;
344 setAttribute(
"analyzer_fe", qAttr);
345 }
else if (qName ==
"clients_frontend") {
346 fKey = eClients_frontend;
347 setAttribute(
"vme_fe", qAttr);
348 }
else if (qName ==
"clients_tfl") {
350 setAttribute(
"tfl_scfe", qAttr);
351 }
else if (qName ==
"clients_sample") {
352 fKey = eClients_sample;
353 setAttribute(
"sample_scfe", qAttr);
354 }
else if (qName ==
"clients_sample_omega") {
355 fKey = eClients_sample_omega;
356 setAttribute(
"omega_scfe", qAttr);
357 }
else if (qName ==
"clients_wew") {
359 setAttribute(
"wew_scfe", qAttr);
360 }
else if (qName ==
"clients_danfysik") {
361 fKey = eClients_danfysik;
362 setAttribute(
"danfysik_scfe", qAttr);
363 }
else if (qName ==
"clients_hv") {
365 setAttribute(
"fug_scfe", qAttr);
366 }
else if (qName ==
"clients_lemvac") {
367 fKey = eClients_lemvac;
368 setAttribute(
"lemvac_scfe", qAttr);
369 }
else if (qName ==
"hv_demand") {
371 setAttribute(
"fug_eq", qAttr);
372 }
else if (qName ==
"hv_measured") {
374 setAttribute(
"fug_eq", qAttr);
375 }
else if (qName ==
"hv_current") {
377 setAttribute(
"fug_eq", qAttr);
378 }
else if (qName ==
"hv_detectors_demand") {
379 fKey = eHvDetector_demand;
380 setAttribute(
"hv_detectors_eq", qAttr);
381 }
else if (qName ==
"hv_detectors_measured") {
382 fKey = eHvDetector_measured;
383 setAttribute(
"hv_detectors_eq", qAttr);
384 }
else if (qName ==
"spin_rot_mag_input") {
385 fKey = eSpin_rot_mag_input;
386 setAttribute(
"danfysik_spin_rot_eq", qAttr);
387 }
else if (qName ==
"spin_rot_mag_output") {
388 fKey = eSpin_rot_mag_output;
389 setAttribute(
"danfysik_spin_rot_eq", qAttr);
390 }
else if (qName ==
"danfysik_input") {
391 fKey = eDanfysik_input;
392 setAttribute(
"danfysik_eq", qAttr);
393 }
else if (qName ==
"danfysik_output") {
394 fKey = eDanfysik_output;
395 setAttribute(
"danfysik_eq", qAttr);
396 }
else if (qName ==
"wew_output") {
398 setAttribute(
"wew_eq", qAttr);
399 }
else if (qName ==
"wew_input") {
401 setAttribute(
"wew_eq", qAttr);
402 }
else if (qName ==
"mag_field") {
404 setAttribute(
"magnet_field_info", qAttr);
405 }
else if (qName ==
"tfl_input") {
407 setAttribute(
"tfl_eq", qAttr);
408 }
else if (qName ==
"tfl_output") {
410 setAttribute(
"tfl_eq", qAttr);
411 }
else if (qName ==
"sample_ctrl_ch") {
412 fKey = eSample_ctrl_ch;
413 setAttribute(
"sample_eq", qAttr);
414 }
else if (qName ==
"sample_channel") {
415 fKey = eSample_channel;
416 setAttribute(
"sample_eq", qAttr);
417 }
else if (qName ==
"sample_sensor_type") {
418 fKey = eSample_sensor_type;
419 setAttribute(
"sample_eq", qAttr);
420 }
else if (qName ==
"sample_input") {
421 fKey = eSample_input;
422 setAttribute(
"sample_eq", qAttr);
423 }
else if (qName ==
"sample_output") {
424 fKey = eSample_output;
425 setAttribute(
"sample_eq", qAttr);
426 }
else if (qName ==
"sample_datetime") {
427 fKey = eSample_datetime;
428 setAttribute(
"sample_eq", qAttr);
429 }
else if (qName ==
"sample_rawvoltage") {
430 fKey = eSample_rawvoltage;
431 setAttribute(
"sample_eq", qAttr);
432 }
else if (qName ==
"sample_no_connection") {
433 fKey = eSample_no_connection;
434 setAttribute(
"sample_eq", qAttr);
435 }
else if (qName ==
"sample_bh_odb_offset_input") {
436 fKey = eSample_bh_odb_offset_input;
437 setAttribute(
"sample_eq", qAttr);
438 }
else if (qName ==
"sample_bh_odb_offset_output") {
439 fKey = eSample_bh_odb_offset_output;
440 setAttribute(
"sample_eq", qAttr);
441 }
else if (qName ==
"sample_oven_omega_input") {
442 fKey = eSample_oven_omega_input;
443 setAttribute(
"omega_eq", qAttr);
444 }
else if (qName ==
"sample_oven_omega_output") {
445 fKey = eSample_oven_omega_output;
446 setAttribute(
"omega_eq", qAttr);
447 }
else if (qName ==
"lemvac_input") {
448 fKey = eLemvac_input;
449 setAttribute(
"lemvac_eq", qAttr);
450 }
else if (qName ==
"lemvac_output") {
451 fKey = eLemvac_output;
452 setAttribute(
"lemvac_eq", qAttr);
453 }
else if (qName ==
"fom_input") {
455 setAttribute(
"fom_eq", qAttr);
456 }
else if (qName ==
"fom_output") {
458 setAttribute(
"fom_eq", qAttr);
459 }
else if (qName ==
"beamline_demand") {
460 fKey = eBeamline_demand;
461 setAttribute(
"beamline_eq", qAttr);
496 fLar->fXMLSchemaFln = str;
499 fLar->fXMLAutoRunFln = str;
501 case eXmlAutoRunValidateFln:
502 fLar->fXMLAutoRunValidateFln = str;
504 case eXmlAutoRunHTML:
505 fLar->fXMLAutoRunHTML = str;
509 fLar->fEnableAll =
true;
510 fLar->SetEnabled(
"all",
true);
514 fLar->fAutoRunPath = str;
516 case eHvSettingsPath:
517 fLar->fHvSettingsPath = str;
523 fLar->fDebug =
false;
525 case eIgnore_clients:
527 fLar->fIgnoreClients =
true;
529 fLar->fIgnoreClients =
false;
533 fLar->fIgnoreAlarms =
true;
535 fLar->fIgnoreAlarms =
false;
538 fLar->fFieldTimeout = str.toFloat();
542 fLar->fFugHvCheck =
false;
544 fLar->fFugHvCheck =
true;
546 case eField_accuracy:
547 fLar->fFieldAccuracy = str.toFloat();
550 fLar->fHVTimeout = str.toFloat();
553 fLar->fHVAccuracy = str.toFloat();
555 case eFOM_current_accuracy:
556 fLar->fFOMCurrentAccuracy = str.toFloat();
558 case eWEW_critical_current_ra:
559 fLar->fWEWCriticalCurrentRA = str.toFloat();
561 case eWEWL_max_current:
562 fLar->fWEWLMaxCurrent = str.toFloat();
564 case eWEWH_max_current:
565 fLar->fWEWHMaxCurrent = str.toFloat();
567 case eDanfysik_max_current:
568 fLar->fDanfysikMaxCurrent = str.toFloat();
570 case eTrigger_events:
571 fLar->fTriggerEventsPath = str;
573 case eEnable_OnOff_Mode:
574 fLar->fEnableOnOffModePath = str;
577 fLar->fAlarmsPath = str;
579 case eAlarm_td_hv_trip:
580 fLar->fAlarmTdHvTripPath = str;
583 fLar->fRunInfoPath = str;
586 fLar->fRunCommentPath = str;
589 fLar->fTofMinPath = str;
592 fLar->fTofMaxPath = str;
595 fLar->fModNamePath = str;
598 fLar->fModDatePath = str;
601 fLar->fLemSetupPath = str;
604 fLar->fSampleNamePath = str;
606 case eSpin_rot_enabled:
607 fLar->fSpinRotEnabledPath = str;
609 case eSpin_rot_angle:
610 fLar->fSpinRotAnglePath = str;
613 fLar->fMagParamWewPath = str;
615 case eMag_param_bpar:
616 fLar->fMagParamBparPath = str;
618 case eSetup_sample_enabled:
619 fLar->fSetupSampleEnabledPath = str;
621 case eSetup_wew_enabled:
622 fLar->fSetupWewEnabledPath = str;
624 case eSetup_bpar_enabled:
625 fLar->fSetupBparEnabledPath = str;
628 fLar->fSampleCryoPath = str;
630 case eEnergy_loss_param:
631 fLar->fEnergyLossParamPath = str;
634 fLar->fClientsPath = str;
636 case eClients_analyzer:
637 fLar->fAnalyzerName = str;
639 case eClients_frontend:
640 fLar->fFrontendName = str;
643 fLar->fTflFeName = str;
645 case eClients_sample:
646 fLar->fSampleFeName = str;
648 case eClients_sample_omega:
649 fLar->fSampleOvenOmegaFeName = str;
652 fLar->fWEWFeName = str;
654 case eClients_danfysik:
655 fLar->fDanfysikFeName = str;
658 fLar->fHVFeName = str;
660 case eClients_lemvac:
661 fLar->fLemvacFeName = str;
664 fLar->fHVDemandPath = str;
667 fLar->fHVMeasuredPath = str;
670 fLar->fHVCurrentPath = str;
672 case eHvDetector_demand:
673 fLar->fHVDetectorDemandPath = str;
675 case eHvDetector_measured:
676 fLar->fHVDetectorMeasuredPath = str;
678 case eSpin_rot_mag_input:
679 fLar->fSpinRotMagInputPath = str;
681 case eSpin_rot_mag_output:
682 fLar->fSpinRotMagOutputPath = str;
684 case eDanfysik_input:
685 fLar->fDanfysikInputPath = str;
687 case eDanfysik_output:
688 fLar->fDanfysikOutputPath = str;
691 fLar->fWEWOutputPath = str;
694 fLar->fWEWInputPath = str;
697 fLar->fMagFieldPath = str;
700 fLar->fTflInputPath = str;
703 fLar->fTflOutputPath = str;
705 case eSample_ctrl_ch:
706 fLar->fSampleCtrlChPath = str;
708 case eSample_channel:
709 fLar->fSampleChannelPath = str;
711 case eSample_sensor_type:
712 fLar->fSampleSensorTypePath = str;
715 fLar->fSampleInputPath = str;
718 fLar->fSampleOutputPath = str;
720 case eSample_datetime:
721 fLar->fSampleDatetimePath = str;
723 case eSample_rawvoltage:
724 fLar->fSampleRawVoltagePath = str;
726 case eSample_no_connection:
727 fLar->fSampleNoConnectionPath = str;
729 case eSample_bh_odb_offset_input:
730 number = str.toInt(&ok);
732 fLar->fSampleBhOdbOffsetInput = number;
734 case eSample_bh_odb_offset_output:
735 number = str.toInt(&ok);
737 fLar->fSampleBhOdbOffsetOutput = number;
739 case eSample_oven_omega_input:
740 fLar->fSampleOvenOmegaInputPath = str;
742 case eSample_oven_omega_output:
743 fLar->fSampleOvenOmegaOutputPath = str;
746 fLar->fLemvacInputPath = str;
749 fLar->fLemvacOutputPath = str;
752 fLar->fFOMInputPath = str;
755 fLar->fFOMOutputPath = str;
757 case eBeamline_demand:
758 fLar->fBeamlineDemandPath = str;
782 if (fLar->fXMLSchemaFln.isEmpty()) {
783 fLar->fXMLSchemaFln =
"/home/nemu/nemu/lemQt5/lemAutoRun/lemAutoRun.xsd";
784 errorMsg =
"lemAutoRun: Couldn't find XML-schema path, will try hard-wired one (no warranty that it works): " +
789 if (fLar->fXMLAutoRunFln.isEmpty()) {
790 fLar->fXMLAutoRunFln =
"/home/nemu/nemu/lemQt5/lemAutoRun/lar_seq.xml";
791 errorMsg = QString(
"lemAutoRun: Couldn't find XML autorun sequence path, ") +
792 QString(
"will try hard-wired one (no warranty that it works): ") +
793 fLar->fXMLAutoRunFln;
797 if (fLar->fXMLAutoRunValidateFln.isEmpty()) {
798 fLar->fXMLAutoRunFln =
"/home/nemu/nemu/lemQt5/lemAutoRun/lar_seq_validate.xml";
799 errorMsg = QString(
"lemAutoRun: Couldn't find XML validate autorun sequence path, ") +
800 QString(
"will try hard-wired one (no warranty that it works): ") +
801 fLar->fXMLAutoRunValidateFln;
805 if (fLar->fXMLAutoRunHTML.isEmpty()) {
806 fLar->fXMLAutoRunHTML =
"/home/nemu/nemu/midas/experiment/nemu/custom_pages/lemAutoRun.html";
807 errorMsg = QString(
"lemAutoRun: Couldn't find XML autorun sequence path, ") +
808 QString(
"will try hard-wired one (no warranty that it works): ") +
809 fLar->fXMLAutoRunHTML;
813 if (fLar->fAutoRunPath.isEmpty()) {
814 fLar->fAutoRunPath =
"/home/nemu/autoRun/";
815 errorMsg = QString(
"lemAutoRun: Couldn't find XML autorun sequence path, ") +
816 QString(
"will try hard-wired one (no warranty that it works): ") +
822 if (fLar->fFieldTimeout == 0.0)
823 fLar->fFieldTimeout = 300;
826 if (fLar->fFieldAccuracy == 0.0)
827 fLar->fFieldAccuracy = 0.01;
830 if (fLar->fHVTimeout == 0.0)
831 fLar->fHVTimeout = 300;
834 if (fLar->fHVAccuracy == 0.0)
835 fLar->fHVAccuracy = 0.02;
838 if (fLar->fFOMCurrentAccuracy == 0.0)
839 fLar->fFOMCurrentAccuracy = 1.0e-4;
842 if (fLar->fWEWCriticalCurrentRA == 0.0)
843 fLar->fWEWCriticalCurrentRA = 22.65;
846 if (fLar->fWEWLMaxCurrent == 0.0)
847 fLar->fWEWLMaxCurrent = 50.0;
850 if (fLar->fWEWHMaxCurrent == 0.0)
851 fLar->fWEWHMaxCurrent = 595.0;
854 if (fLar->fDanfysikMaxCurrent == 0.0)
855 fLar->fDanfysikMaxCurrent = 20.0;
857 if (fLar->fTriggerEventsPath.isEmpty() && fLar->fEnabled[
"trigger_events_odb"]) {
858 fLar->fTriggerEventsPath =
"/Equipment/Trigger/Statistics/Events sent";
859 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the trigger events in the ODB, ") +
860 QString(
"will try hard-wired one (no warranty that it works): ") +
861 fLar->fTriggerEventsPath;
865 if (fLar->fEnableOnOffModePath.isEmpty() && fLar->fEnabled[
"enable_on_off_mode_odb"]) {
866 fLar->fEnableOnOffModePath =
"/Equipment/Trigger/Settings/Enable_OnOff_Mode";
867 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Enable_OnOff_Mode in the ODB, ") +
868 QString(
"will try hard-wired one (no warranty that it works): ") +
869 fLar->fEnableOnOffModePath;
873 if (fLar->fAlarmsPath.isEmpty() && fLar->fEnabled[
"alarms_odb"]) {
874 fLar->fAlarmsPath =
"/Alarms/Alarms";
875 errorMsg = QString(
"lemAutoRun: Couldn't find the path to alarms in the ODB, ") +
876 QString(
"will try hard-wired one (no warranty that it works): ") +
881 if (fLar->fAlarmTdHvTripPath.isEmpty() && fLar->fEnabled[
"alarms_td_hv_trip_odb"]) {
882 fLar->fAlarmTdHvTripPath =
"/Alarms/Alarms/hv_fug_check_trip_level/Triggered";
883 errorMsg = QString(
"lemAutoRun: Couldn't find the path to TD HV Trip flag in the ODB, ") +
884 QString(
"will try hard-wired one (no warranty that it works): ") +
885 fLar->fAlarmTdHvTripPath;
889 if (fLar->fRunInfoPath.isEmpty()) {
890 fLar->fRunInfoPath =
"/Runinfo";
891 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the run info in the ODB, ") +
892 QString(
"will try hard-wired one (no warranty that it works): ") +
897 if (fLar->fRunCommentPath.isEmpty() && fLar->fEnabled[
"run_comment_odb"]) {
898 fLar->fRunCommentPath =
"/Experiment/Run Parameters/comment";
899 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the run title in the ODB, ") +
900 QString(
"will try hard-wired one (no warranty that it works): ") +
901 fLar->fRunCommentPath;
905 if (fLar->fTofMinPath.isEmpty() && fLar->fEnabled[
"tof_min_odb"]) {
906 fLar->fTofMinPath =
"/Analyzer/Parameters/MCP2AnaModule/TofM2Fmin";
907 errorMsg = QString(
"lemAutoRun: Couldn't find the path to TOF Min in the ODB, ") +
908 QString(
"will try hard-wired one (no warranty that it works): ") +
913 if (fLar->fTofMaxPath.isEmpty() && fLar->fEnabled[
"tof_max_odb"]) {
914 fLar->fTofMaxPath =
"/Analyzer/Parameters/MCP2AnaModule/TofM2Fmax";
915 errorMsg = QString(
"lemAutoRun: Couldn't find the path to TOF Max in the ODB, ") +
916 QString(
"will try hard-wired one (no warranty that it works): ") +
921 if (fLar->fModNamePath.isEmpty() && fLar->fEnabled[
"mod_name_odb"]) {
922 fLar->fModNamePath =
"/Info/Moderator";
923 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the moderator name in the ODB, ") +
924 QString(
"will try hard-wired one (no warranty that it works): ") +
929 if (fLar->fModDatePath.isEmpty() && fLar->fEnabled[
"mod_date_odb"]) {
930 fLar->fModDatePath =
"/Info/ModeratorDATE";
931 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the moderator date in the ODB, ") +
932 QString(
"will try hard-wired one (no warranty that it works): ") +
937 if (fLar->fLemSetupPath.isEmpty() && fLar->fEnabled[
"lem_setup_odb"]) {
938 fLar->fLemSetupPath =
"/Info/LEM_Setup";
939 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the LEM setup in the ODB, ") +
940 QString(
"will try hard-wired one (no warranty that it works): ") +
945 if (fLar->fSampleNamePath.isEmpty() && fLar->fEnabled[
"sample_name_info_odb"]) {
946 fLar->fSampleNamePath =
"/Info/Sample Name";
947 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Sample Name in the ODB, ") +
948 QString(
"will try hard-wired one (no warranty that it works): ") +
949 fLar->fSampleNamePath;
953 if (fLar->fSpinRotEnabledPath.isEmpty() && fLar->fEnabled[
"spin_rot_calib_odb"]) {
954 fLar->fSpinRotEnabledPath =
"/Info/SpinRot_Parameter/Enable spin rotator calibration";
955 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the spin rotation enabled flag in the ODB, ") +
956 QString(
"will try hard-wired one (no warranty that it works): ") +
957 fLar->fSpinRotEnabledPath;
961 if (fLar->fSpinRotAnglePath.isEmpty() && fLar->fEnabled[
"spin_rot_angle_odb"]) {
962 fLar->fSpinRotAnglePath =
"/Info/SpinRot_Parameter/RotationAngle";
963 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the spin rotation angle in the ODB, ") +
964 QString(
"will try hard-wired one (no warranty that it works): ") +
965 fLar->fSpinRotAnglePath;
969 if (fLar->fMagParamWewPath.isEmpty() && fLar->fEnabled[
"mag_param_wew_odb"]) {
970 fLar->fMagParamWewPath =
"/Info/Magnet_Parameter/WEW";
971 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the WEW magnet calibration (A->G) in the ODB, ") +
972 QString(
"will try hard-wired one (no warranty that it works): ") +
973 fLar->fMagParamWewPath;
977 if (fLar->fMagParamBparPath.isEmpty() && fLar->fEnabled[
"mag_param_bpar_odb"]) {
978 fLar->fMagParamBparPath =
"/Info/Magnet_Parameter/Bpar";
979 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Bpar magnet calibration (A->G) in the ODB, ") +
980 QString(
"will try hard-wired one (no warranty that it works): ") +
981 fLar->fMagParamBparPath;
985 if (fLar->fSetupSampleEnabledPath.isEmpty() && fLar->fEnabled[
"setup_sample_odb"]) {
986 fLar->fSetupSampleEnabledPath =
"/Info/LEM_Setup_Parameter/Sample";
987 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the sample enable flag in the ODB, ") +
988 QString(
"will try hard-wired one (no warranty that it works): ") +
989 fLar->fSetupSampleEnabledPath;
993 if (fLar->fSetupWewEnabledPath.isEmpty() && fLar->fEnabled[
"setup_wew_odb"]) {
994 fLar->fSetupWewEnabledPath =
"/Info/LEM_Setup_Parameter/WEW";
995 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the WEW enable flag in the ODB, ") +
996 QString(
"will try hard-wired one (no warranty that it works): ") +
997 fLar->fSetupWewEnabledPath;
1001 if (fLar->fSetupBparEnabledPath.isEmpty() && fLar->fEnabled[
"setup_bpar_odb"]) {
1002 fLar->fSetupBparEnabledPath =
"/Info/LEM_Setup_Parameter/Bpar";
1003 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Bpar enable flag in the ODB, ") +
1004 QString(
"will try hard-wired one (no warranty that it works): ") +
1005 fLar->fSetupBparEnabledPath;
1009 if (fLar->fSampleCryoPath.isEmpty() && fLar->fEnabled[
"sample_cryo_info_odb"]) {
1010 fLar->fSampleCryoPath =
"/Info/Sample Cryo";
1011 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Sample Cryo in the ODB, ") +
1012 QString(
"will try hard-wired one (no warranty that it works): ") +
1013 fLar->fSampleCryoPath;
1017 if (fLar->fEnergyLossParamPath.isEmpty() && fLar->fEnabled[
"energy_loss_param_odb"]) {
1018 fLar->fEnergyLossParamPath =
"/Info/EnergyLoss_Parameter";
1019 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the energy loss parameters in the ODB, ") +
1020 QString(
"will try hard-wired one (no warranty that it works): ") +
1021 fLar->fEnergyLossParamPath;
1025 if (fLar->fClientsPath.isEmpty()) {
1026 fLar->fClientsPath =
"/System/Clients";
1027 errorMsg = QString(
"lemAutoRun: Couldn't find the path to clients in the ODB, ") +
1028 QString(
"will try hard-wired one (no warranty that it works): ") +
1033 if (fLar->fAnalyzerName.isEmpty() && fLar->fEnabled[
"analyzer_fe"]) {
1034 fLar->fAnalyzerName =
"Analyzer";
1035 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for the analyzer, ") +
1036 QString(
"will try hard-wired one (no warranty that it works): ") +
1037 fLar->fAnalyzerName;
1041 if (fLar->fFrontendName.isEmpty() && fLar->fEnabled[
"vme_fe"]) {
1042 fLar->fFrontendName =
"VME_FE";
1043 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for the frontend, ") +
1044 QString(
"will try hard-wired one (no warranty that it works): ") +
1045 fLar->fFrontendName;
1049 if (fLar->fTflFeName.isEmpty() && fLar->fEnabled[
"tfl_scfe"]) {
1050 fLar->fTflFeName =
"TFL_SC";
1051 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for tfl_scfe, ") +
1052 QString(
"will try hard-wired one (no warranty that it works): ") +
1057 if (fLar->fSampleFeName.isEmpty() && fLar->fEnabled[
"sample_scfe"]) {
1058 fLar->fSampleFeName =
"Sample_SC";
1059 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for sample_scfe, ") +
1060 QString(
"will try hard-wired one (no warranty that it works): ") +
1061 fLar->fSampleFeName;
1065 if (fLar->fSampleOvenOmegaFeName.isEmpty() && fLar->fEnabled[
"omega_scfe"]) {
1066 fLar->fSampleOvenOmegaFeName =
"Omega SC";
1067 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for Oven Omega SCFE, ") +
1068 QString(
"will try hard-wired one (no warranty that it works): ") +
1069 fLar->fSampleOvenOmegaFeName;
1073 if (fLar->fWEWFeName.isEmpty() && fLar->fEnabled[
"wew_scfe"]) {
1074 fLar->fWEWFeName =
"WEW SC";
1075 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for WEW SCFE, ") +
1076 QString(
"will try hard-wired one (no warranty that it works): ") +
1081 if (fLar->fDanfysikFeName.isEmpty() && fLar->fEnabled[
"danfysik_scfe"]) {
1082 fLar->fDanfysikFeName =
"Danfysik_SC";
1083 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for Danfysik SCFE, ") +
1084 QString(
"will try hard-wired one (no warranty that it works): ") +
1085 fLar->fDanfysikFeName;
1089 if (fLar->fHVFeName.isEmpty() && fLar->fEnabled[
"fug_scfe"]) {
1090 fLar->fHVFeName =
"FUG";
1091 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for hv_fug_scfe, ") +
1092 QString(
"will try hard-wired one (no warranty that it works): ") +
1097 if (fLar->fLemvacFeName.isEmpty() && fLar->fEnabled[
"lemvac_scfe"]) {
1098 fLar->fLemvacFeName =
"LEMVAC_SC";
1099 errorMsg = QString(
"lemAutoRun: Couldn't find ODB name for lemvac_scfe, ") +
1100 QString(
"will try hard-wired one (no warranty that it works): ") +
1101 fLar->fLemvacFeName;
1105 if (fLar->fHVDemandPath.isEmpty() && fLar->fEnabled[
"fug_eq"]) {
1106 fLar->fHVDemandPath =
"/Equipment/HV/Variables/Demand";
1107 errorMsg = QString(
"lemAutoRun: Couldn't find the path to HV demand values in the ODB, ") +
1108 QString(
"will try hard-wired one (no warranty that it works): ") +
1109 fLar->fHVDemandPath;
1113 if (fLar->fHVMeasuredPath.isEmpty() && fLar->fEnabled[
"fug_eq"]) {
1114 fLar->fHVMeasuredPath =
"/Equipment/HV/Variables/Measured";
1115 errorMsg = QString(
"lemAutoRun: Couldn't find the path to HV measured values in the ODB, ") +
1116 QString(
"will try hard-wired one (no warranty that it works): ") +
1117 fLar->fHVMeasuredPath;
1121 if (fLar->fHVCurrentPath.isEmpty() && fLar->fEnabled[
"fug_eq"]) {
1122 fLar->fHVCurrentPath =
"/Equipment/HV/Variables/Current";
1123 errorMsg = QString(
"lemAutoRun: Couldn't find the path to HV current values in the ODB, ") +
1124 QString(
"will try hard-wired one (no warranty that it works): ") +
1125 fLar->fHVCurrentPath;
1129 if (fLar->fHVDetectorDemandPath.isEmpty() && fLar->fEnabled[
"hv_detectors_eq"]) {
1130 fLar->fHVDetectorDemandPath =
"/Equipment/HV Detectors/Variables/Demand";
1131 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the HV Detectors demand values in the ODB, ") +
1132 QString(
"will try hard-wired one (no warranty that it works): ") +
1133 fLar->fHVDetectorDemandPath;
1137 if (fLar->fHVDetectorMeasuredPath.isEmpty() && fLar->fEnabled[
"hv_detectors_eq"]) {
1138 fLar->fHVDetectorMeasuredPath =
"/Equipment/HV Detectors/Variables/Measured";
1139 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the HV Detectors measured values in the ODB, ") +
1140 QString(
"will try hard-wired one (no warranty that it works): ") +
1141 fLar->fHVDetectorMeasuredPath;
1145 if (fLar->fSpinRotMagInputPath.isEmpty() && fLar->fEnabled[
"danfysik_spin_rot_eq"]) {
1146 fLar->fSpinRotMagInputPath =
"/Equipment/Danfysik_Spin_Rot/Variables/Input";
1147 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Danfysik Spin Rotator power supply input values in the ODB, ") +
1148 QString(
"will try hard-wired one (no warranty that it works): ") +
1149 fLar->fSpinRotMagInputPath;
1153 if (fLar->fSpinRotMagOutputPath.isEmpty() && fLar->fEnabled[
"danfysik_spin_rot_eq"]) {
1154 fLar->fSpinRotMagOutputPath =
"/Equipment/Danfysik_Spin_Rot/Variables/Output";
1155 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Danfysik Spin Rotator power supply output values in the ODB, ") +
1156 QString(
"will try hard-wired one (no warranty that it works): ") +
1157 fLar->fSpinRotMagOutputPath;
1161 if (fLar->fDanfysikInputPath.isEmpty() && fLar->fEnabled[
"danfysik_eq"]) {
1162 fLar->fDanfysikInputPath =
"/Equipment/Danfysik/Variables/Input";
1163 errorMsg = QString(
"lemAutoRun: Couldn't find the path to Danfysik input values in the ODB, ") +
1164 QString(
"will try hard-wired one (no warranty that it works): ") +
1165 fLar->fDanfysikInputPath;
1169 if (fLar->fDanfysikOutputPath.isEmpty() && fLar->fEnabled[
"danfysik_eq"]) {
1170 fLar->fDanfysikOutputPath =
"/Equipment/Danfysik/Variables/Output";
1171 errorMsg = QString(
"lemAutoRun: Couldn't find the path to Danfysik output values in the ODB, ") +
1172 QString(
"will try hard-wired one (no warranty that it works): ") +
1173 fLar->fDanfysikOutputPath;
1177 if (fLar->fWEWOutputPath.isEmpty() && fLar->fEnabled[
"wew_eq"]) {
1178 fLar->fWEWOutputPath =
"/Equipment/WEW/Variables/Output";
1179 errorMsg = QString(
"lemAutoRun: Couldn't find the path to WEW output values in the ODB, ") +
1180 QString(
"will try hard-wired one (no warranty that it works): ") +
1181 fLar->fWEWOutputPath;
1185 if (fLar->fWEWInputPath.isEmpty() && fLar->fEnabled[
"wew_eq"]) {
1186 fLar->fWEWInputPath =
"/Equipment/WEW/Variables/Input";
1187 errorMsg = QString(
"lemAutoRun: Couldn't find the path to WEW input values in the ODB, ") +
1188 QString(
"will try hard-wired one (no warranty that it works): ") +
1189 fLar->fWEWInputPath;
1193 if (fLar->fMagFieldPath.isEmpty() && fLar->fEnabled[
"magnet_field_info"]) {
1194 fLar->fMagFieldPath =
"/Info/Magnetic Field (G)";
1195 errorMsg = QString(
"lemAutoRun: Couldn't find the path to magnet field parameters of the WEW in the ODB, ") +
1196 QString(
"will try hard-wired one (no warranty that it works): ") +
1197 fLar->fMagFieldPath;
1201 if (fLar->fTflInputPath.isEmpty() && fLar->fEnabled[
"tfl_eq"]) {
1202 fLar->fTflInputPath =
"/Equipment/TFL/Variables/Input";
1203 errorMsg = QString(
"lemAutoRun: Couldn't find the path to tfl input values in the ODB, ") +
1204 QString(
"will try hard-wired one (no warranty that it works): ") +
1205 fLar->fTflInputPath;
1209 if (fLar->fTflOutputPath.isEmpty() && fLar->fEnabled[
"tfl_eq"]) {
1210 fLar->fTflOutputPath =
"/Equipment/TFL/Variables/Output";
1211 errorMsg = QString(
"lemAutoRun: Couldn't find the path to tfl input values in the ODB, ") +
1212 QString(
"will try hard-wired one (no warranty that it works): ") +
1213 fLar->fTflOutputPath;
1217 if (fLar->fSampleCtrlChPath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1218 fLar->fSampleCtrlChPath =
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Loop1/CTRL_CH";
1219 errorMsg = QString(
"lemAutoRun: Couldn't find the path to ctrl channel of the LS340 in the ODB, ") +
1220 QString(
"will try hard-wired one (no warranty that it works): ") +
1221 fLar->fSampleCtrlChPath;
1225 if (fLar->fSampleChannelPath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1226 fLar->fSampleChannelPath =
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Sensors/Channel";
1227 errorMsg = QString(
"lemAutoRun: Couldn't find the path to channel assignment of the LS340 in the ODB, ") +
1228 QString(
"will try hard-wired one (no warranty that it works): ") +
1229 fLar->fSampleChannelPath;
1233 if (fLar->fSampleSensorTypePath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1234 fLar->fSampleSensorTypePath =
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Sensors/Sensor Type";
1235 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sensor type assignment of the LS340 in the ODB, ") +
1236 QString(
"will try hard-wired one (no warranty that it works): ") +
1237 fLar->fSampleSensorTypePath;
1241 if (fLar->fSampleInputPath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1242 fLar->fSampleInputPath =
"/Equipment/SampleCryo/Variables/Input";
1243 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo input values in the ODB, ") +
1244 QString(
"will try hard-wired one (no warranty that it works): ") +
1245 fLar->fSampleInputPath;
1249 if (fLar->fSampleOutputPath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1250 fLar->fSampleOutputPath =
"/Equipment/SampleCryo/Variables/Output";
1251 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo output values in the ODB, ") +
1252 QString(
"will try hard-wired one (no warranty that it works): ") +
1253 fLar->fSampleOutputPath;
1257 if (fLar->fSampleDatetimePath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1258 fLar->fSampleDatetimePath =
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Sensors/Date and Time";
1259 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo 'date and time' in the ODB, ") +
1260 QString(
"will try hard-wired one (no warranty that it works): ") +
1261 fLar->fSampleDatetimePath;
1265 if (fLar->fSampleRawVoltagePath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1266 fLar->fSampleRawVoltagePath =
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Sensors/Raw Input Ch";
1267 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo 'RawVoltage' in the ODB, ") +
1268 QString(
"will try hard-wired one (no warranty that it works): ") +
1269 fLar->fSampleRawVoltagePath;
1273 if (fLar->fSampleNoConnectionPath.isEmpty() && fLar->fEnabled[
"sample_eq"]) {
1274 fLar->fSampleNoConnectionPath =
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Internal/No Connection";
1275 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample cryo 'no connection' flag in the ODB, ") +
1276 QString(
"will try hard-wired one (no warranty that it works): ") +
1277 fLar->fSampleNoConnectionPath;
1281 if ((fLar->fSampleBhOdbOffsetInput == -1) && fLar->fEnabled[
"sample_eq"]) {
1282 fLar->fSampleBhOdbOffsetInput = 10;
1283 errorMsg = QString(
"lemAutoRun: Couldn't find input ODB offset for the bronkhorst flow meter, ") +
1284 QString(
"will try hard-wired one (no warranty that it works):%1 ").arg(fLar->fSampleBhOdbOffsetInput);
1288 if ((fLar->fSampleBhOdbOffsetOutput == -1) && fLar->fEnabled[
"sample_eq"]) {
1289 fLar->fSampleBhOdbOffsetOutput = 7;
1290 errorMsg = QString(
"lemAutoRun: Couldn't find output ODB offset for the bronkhorst flow meter, ") +
1291 QString(
"will try hard-wired one (no warranty that it works):%1 ").arg(fLar->fSampleBhOdbOffsetOutput);
1295 if (fLar->fSampleOvenOmegaInputPath.isEmpty() && fLar->fEnabled[
"omega_eq"]) {
1296 fLar->fSampleOvenOmegaInputPath =
"/Equipment/Omega/Variables/Input";
1297 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample oven omega input values in the ODB, ") +
1298 QString(
"will try hard-wired one (no warranty that it works): ") +
1299 fLar->fSampleOvenOmegaInputPath;
1303 if (fLar->fSampleOvenOmegaOutputPath.isEmpty() && fLar->fEnabled[
"omega_eq"]) {
1304 fLar->fSampleOvenOmegaOutputPath =
"/Equipment/Oven/Variables/Output";
1305 errorMsg = QString(
"lemAutoRun: Couldn't find the path to sample oven output values in the ODB, ") +
1306 QString(
"will try hard-wired one (no warranty that it works): ") +
1307 fLar->fSampleOvenOmegaOutputPath;
1311 if (fLar->fLemvacInputPath.isEmpty() && fLar->fEnabled[
"lemvac_eq"]) {
1312 fLar->fLemvacInputPath =
"/Equipment/LEMVAC/Variables/Input";
1313 errorMsg = QString(
"lemAutoRun: Couldn't find the path to lemvac input values in the ODB, ") +
1314 QString(
"will try hard-wired one (no warranty that it works): ") +
1315 fLar->fLemvacInputPath;
1319 if (fLar->fLemvacOutputPath.isEmpty() && fLar->fEnabled[
"lemvac_eq"]) {
1320 fLar->fLemvacOutputPath =
"/Equipment/LEMVAC/Variables/Output";
1321 errorMsg = QString(
"lemAutoRun: Couldn't find the path to lemvac output values in the ODB, ") +
1322 QString(
"will try hard-wired one (no warranty that it works): ") +
1323 fLar->fLemvacOutputPath;
1327 if (fLar->fFOMInputPath.isEmpty() && fLar->fEnabled[
"fom_eq"]) {
1328 fLar->fFOMInputPath =
"/Equipment/FOM/Variables/Input";
1329 errorMsg = QString(
"lemAutoRun: Couldn't find the path to FOM input values in the ODB, ") +
1330 QString(
"will try hard-wired one (no warranty that it works): ") +
1331 fLar->fFOMInputPath;
1335 if (fLar->fFOMOutputPath.isEmpty() && fLar->fEnabled[
"fom_eq"]) {
1336 fLar->fFOMOutputPath =
"/Equipment/FOM/Variables/Output";
1337 errorMsg = QString(
"lemAutoRun: Couldn't find the path to FOM output values in the ODB, ") +
1338 QString(
"will try hard-wired one (no warranty that it works): ") +
1339 fLar->fFOMOutputPath;
1343 if (fLar->fBeamlineDemandPath.isEmpty() && fLar->fEnabled[
"beamline_eq"]) {
1344 fLar->fBeamlineDemandPath =
"/Equipment/Beamline/Variables/Demand";
1345 errorMsg = QString(
"lemAutoRun: Couldn't find the path to the Beamline demand values in the ODB, ") +
1346 QString(
"will try hard-wired one (no warranty that it works): ") +
1347 fLar->fBeamlineDemandPath;
1364 if (qAttr.index(
"enabled") != -1) {
1365 if (qAttr.value(
"enabled") ==
"yes") {
1366 fLar->SetEnabled(key,
true);
1367 }
else if (qAttr.value(
"enabled") ==
"no") {
1368 fLar->SetEnabled(key,
false);
1421 const QString& qName,
1422 const QXmlAttributes&)
1424 if (qName ==
"temp_regulation") {
1425 fKey = eTemp_regulation;
1426 }
else if (qName ==
"max_temp_increase") {
1427 fKey = eMax_temp_increase;
1428 }
else if (qName ==
"bh_max_flow") {
1429 fKey = eBh_max_flow;
1430 }
else if (qName ==
"bh_min_flow") {
1431 fKey = eBh_min_flow;
1432 }
else if (qName ==
"bh_flow_p_heat_0") {
1433 fKey = eBh_flow_p_heat_0;
1434 }
else if (qName ==
"bh_flow_p_heat_1") {
1435 fKey = eBh_flow_p_heat_1;
1436 }
else if (qName ==
"bh_flow_d_heat") {
1437 fKey = eBh_flow_d_heat;
1438 }
else if (qName ==
"bh_flow_temp") {
1439 fKey = eBh_flow_temp;
1440 }
else if (qName ==
"bh_flow_temp_offset") {
1441 fKey = eBh_flow_temp_offset;
1442 }
else if (qName ==
"bh_flow_offset") {
1443 fKey = eBh_flow_offset;
1444 }
else if (qName ==
"d_set_ratio") {
1445 fKey = eD_set_ratio;
1446 }
else if (qName ==
"abs_max_temp_diff") {
1447 fKey = eAbs_max_temp_diff;
1448 }
else if (qName ==
"rel_max_temp_diff") {
1449 fKey = eRel_max_temp_diff;
1450 }
else if (qName ==
"max_temp_trend") {
1451 fKey = eMax_temp_trend;
1452 }
else if (qName ==
"heater_min") {
1454 }
else if (qName ==
"heater_max") {
1456 }
else if (qName ==
"flow_factor") {
1457 fKey = eFlow_factor;
1458 }
else if (qName ==
"flow_set_ratio") {
1459 fKey = eFlow_set_ratio;
1460 }
else if (qName ==
"flow_set_absolute") {
1461 fKey = eFlow_set_absolute;
1462 }
else if (qName ==
"flow_timeout_reduction") {
1463 fKey = eFlow_timeout_reduction;
1464 }
else if (qName ==
"timeout_flow_set") {
1465 fKey = eTimeout_flow_set;
1466 }
else if (qName ==
"flowLowestFlowToConsider") {
1467 fKey = eFlowLowestFlowToConsider;
1468 }
else if (qName ==
"flowMaxRelFlowDiffToConsider") {
1469 fKey = eFlowMaxRelFlowDiffToConsider;
1470 }
else if (qName ==
"dFlowDp0") {
1472 }
else if (qName ==
"dFlowDp1") {
1474 }
else if (qName ==
"dFlowDpExp") {
1476 }
else if (qName ==
"heatCapCof1") {
1477 fKey = eHeatCapCof1;
1478 }
else if (qName ==
"heatCapCof2") {
1479 fKey = eHeatCapCof2;
1480 }
else if (qName ==
"heatCapCof3") {
1481 fKey = eHeatCapCof3;
1482 }
else if (qName ==
"needleValveInUse") {
1483 fKey = eNeedleValveInUse;
1484 }
else if (qName ==
"prefNeedleValveCof_1_0") {
1485 fKey = ePrefNeedleValveCof_1_0;
1486 }
else if (qName ==
"prefNeedleValveCof_1_1") {
1487 fKey = ePrefNeedleValveCof_1_1;
1488 }
else if (qName ==
"prefNeedleValveCof_2_0") {
1489 fKey = ePrefNeedleValveCof_2_0;
1490 }
else if (qName ==
"prefNeedleValveCof_2_1") {
1491 fKey = ePrefNeedleValveCof_2_1;
1492 }
else if (qName ==
"prefNeedleValveCof_3_0") {
1493 fKey = ePrefNeedleValveCof_3_0;
1494 }
else if (qName ==
"prefNeedleValveCof_3_1") {
1495 fKey = ePrefNeedleValveCof_3_1;
1496 }
else if (qName ==
"prefNeedleValveCof_4_0") {
1497 fKey = ePrefNeedleValveCof_4_0;
1498 }
else if (qName ==
"prefNeedleValveCof_4_1") {
1499 fKey = ePrefNeedleValveCof_4_1;
1500 }
else if (qName ==
"prefNeedleValveRelStep") {
1501 fKey = ePrefNeedleValveRelStep;
1502 }
else if (qName ==
"prefNeedleValveAbsStep") {
1503 fKey = ePrefNeedleValveAbsStep;
1533 case eTemp_regulation:
1535 fLar->fSampleTempRegulation =
true;
1537 fLar->fSampleTempRegulation =
false;
1539 case eMax_temp_increase:
1540 fLar->fMaxTempIncrease = str.toFloat();
1543 fLar->fBHMaxFlow = str.toFloat();
1546 fLar->fBHMinFlow = str.toFloat();
1548 case eBh_flow_p_heat_0:
1549 fLar->fBHFlowPHeat0 = str.toFloat();
1551 case eBh_flow_p_heat_1:
1552 fLar->fBHFlowPHeat1 = str.toFloat();
1554 case eBh_flow_d_heat:
1555 fLar->fBHFlowDHeat = str.toFloat();
1558 fLar->fBHFlowTemp = str.toFloat();
1560 case eBh_flow_temp_offset:
1561 fLar->fBHFlowTempOffset = str.toFloat();
1563 case eBh_flow_offset:
1564 fLar->fBHFlowOffset = str.toFloat();
1567 fLar->fDSetRatio = str.toFloat();
1569 case eAbs_max_temp_diff:
1570 fLar->fAbsMaxTempDiff = str.toFloat();
1572 case eRel_max_temp_diff:
1573 fLar->fRelMaxTempDiff = str.toFloat();
1575 case eMax_temp_trend:
1576 fLar->fMaxTempTrend = str.toFloat();
1579 fLar->fHeaterMin = str.toFloat();
1582 fLar->fHeaterMax = str.toFloat();
1584 case eTimeout_flow_set:
1585 fLar->fTimeoutFlowSet = 1000.0 * str.toFloat();
1588 fLar->fFlowFactor = str.toFloat();
1590 case eFlow_set_ratio:
1591 fLar->fFlowSetRatio = str.toFloat();
1593 case eFlow_set_absolute:
1594 fLar->fFlowSetAbsolute = str.toFloat();
1596 case eFlow_timeout_reduction:
1597 fLar->fFlowTimeoutReduction = 1000.0 * str.toFloat();
1599 case eFlowLowestFlowToConsider:
1600 fLar->fFlowLowestFlowToConsider = str.toFloat();
1602 case eFlowMaxRelFlowDiffToConsider:
1603 fLar->fFlowMaxRelFlowDiffToConsider = str.toFloat();
1606 fLar->fDFlowDp0 = str.toFloat();
1609 fLar->fDFlowDp1 = str.toFloat();
1612 fLar->fDFlowDpExp = str.toFloat();
1615 fLar->fHeatCapCof1 = str.toFloat();
1618 fLar->fHeatCapCof2 = str.toFloat();
1621 fLar->fHeatCapCof3 = str.toFloat();
1623 case eNeedleValveInUse:
1624 fLar->fNeedleValveInUse = (bool) str.toInt();
1626 case ePrefNeedleValveCof_1_0:
1627 fLar->fPrefNeedleValveCof_1_0 = str.toFloat();
1629 case ePrefNeedleValveCof_1_1:
1630 fLar->fPrefNeedleValveCof_1_1 = str.toFloat();
1632 case ePrefNeedleValveCof_2_0:
1633 fLar->fPrefNeedleValveCof_2_0 = str.toFloat();
1635 case ePrefNeedleValveCof_2_1:
1636 fLar->fPrefNeedleValveCof_2_1 = str.toFloat();
1638 case ePrefNeedleValveCof_3_0:
1639 fLar->fPrefNeedleValveCof_3_0 = str.toFloat();
1641 case ePrefNeedleValveCof_3_1:
1642 fLar->fPrefNeedleValveCof_3_1 = str.toFloat();
1644 case ePrefNeedleValveCof_4_0:
1645 fLar->fPrefNeedleValveCof_4_0 = str.toFloat();
1647 case ePrefNeedleValveCof_4_1:
1648 fLar->fPrefNeedleValveCof_4_1 = str.toFloat();
1650 case ePrefNeedleValveRelStep:
1651 fLar->fPrefNeedleValveRelStep = str.toFloat();
1653 case ePrefNeedleValveAbsStep:
1654 fLar->fPrefNeedleValveAbsStep = str.toFloat();
1680 if (fLar->fMaxTempIncrease == 0.0)
1681 fLar->fMaxTempIncrease = 20.0;
1716 fCurrentLimit.clear();
1741 const QString& qName,
1742 const QXmlAttributes&)
1744 if (qName ==
"hvDeviceName") {
1745 fKey = eHvDeviceName;
1746 }
else if (qName ==
"chNo") {
1748 }
else if (qName ==
"name") {
1750 }
else if (qName ==
"hvDemand") {
1752 }
else if (qName ==
"currentLimit") {
1753 fKey = eCurrentLimit;
1788 fHvDeviceName = str.trimmed();
1789 if (fHvDeviceName !=
"FUG") {
1790 fErrorMsg =
"**ERROR** only handle FUG's, i.e. transport settings, but found '" + fHvDeviceName +
"'";
1796 ival = str.toInt(&ok);
1798 fHvChNo.push_back(ival);
1800 fErrorMsg =
"**ERROR** found HV channel '" + str +
"' at position" + QString(
"%1").arg(fHvChNo.size()) +
" which is not an integer?!?";
1806 fHvChName.push_back(str);
1809 fval = str.toFloat(&ok);
1811 fHvDemand.push_back(fval);
1813 fErrorMsg =
"**ERROR** found HV demand '" + str +
"' at position" + QString(
"%1").arg(fHvChNo.size()) +
" which is not an double?!?";
1819 fval = str.toFloat(&ok);
1821 fCurrentLimit.push_back(fval);
1823 fErrorMsg =
"**ERROR** found current limit '" + str +
"' at position" + QString(
"%1").arg(fHvChNo.size()) +
" which is not an double?!?";
1852 fCurrentLimit.clear();
2008 fHvSettingsPath = QString(
"/home/nemu/nemu/midas/experiment/nemu/hv_settings/");
2132 for (
int i=0; i<10; i++)
2294 for (
int i=0; i<10; i++) {
2362 QString fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun.xml";
2363 if (!QFile::exists(fln)) {
2364 QString err =
"lemAutoRun: Couldn't find XML startup file " + fln;
2371 QXmlInputSource source( &xmlFile );
2372 QXmlSimpleReader reader;
2373 reader.setContentHandler( &handler );
2374 reader.parse( source );
2385 char str[NAME_LENGTH];
2387 QString sampleCryoName =
"";
2391 cm_msg(MERROR,
"lemAutoRun",
"Either SampleCryo Equipment is not enabled, or /Info/Sample Cryo in ODB is missing! LEM AutoRun will not work.");
2398 sampleCryoName = QString(str);
2400 if (sampleCryoName ==
"Konti-1") {
2401 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo1.xml";
2403 }
else if (sampleCryoName ==
"Konti-2") {
2404 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo2.xml";
2406 }
else if (sampleCryoName ==
"Konti-3") {
2407 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo3.xml";
2409 }
else if (sampleCryoName ==
"Konti-4") {
2410 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_KontiCryo4.xml";
2412 }
else if (sampleCryoName ==
"LowTemp-1") {
2413 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_LowTemp1.xml";
2415 }
else if (sampleCryoName ==
"LowTemp-2") {
2416 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_LowTemp2.xml";
2418 }
else if (sampleCryoName ==
"Omega") {
2419 fln =
"/home/nemu/nemu/midas/bin/.lemXMLs/lemAutoRun_Oven.xml";
2421 }
else if (sampleCryoName ==
"NoCryo") {
2426 if (!QFile::exists(fln)) {
2427 QString err =
"lemAutoRun: Couldn't find XML startup file " + fln +
" ";
2428 err +=
"Perhaps the sample cryo name (" + sampleCryoName +
") is wrong?!";
2435 QXmlInputSource source( &xmlFile );
2436 QXmlSimpleReader reader;
2437 reader.setContentHandler( &handler );
2438 reader.parse( source );
2451 fEnabled.insert(
"trigger_events_odb",
false);
2452 fEnabled.insert(
"enable_on_off_mode_odb",
false);
2453 fEnabled.insert(
"alarms_odb",
false);
2454 fEnabled.insert(
"alarms_td_hv_trip_odb",
false);
2455 fEnabled.insert(
"run_comment_odb",
false);
2456 fEnabled.insert(
"tof_min_odb",
false);
2457 fEnabled.insert(
"tof_max_odb",
false);
2458 fEnabled.insert(
"mod_name_odb",
false);
2459 fEnabled.insert(
"mod_date_odb",
false);
2460 fEnabled.insert(
"lem_setup_odb",
false);
2461 fEnabled.insert(
"energy_loss_param_odb",
false);
2462 fEnabled.insert(
"sample_cryo_info_odb",
false);
2463 fEnabled.insert(
"sample_name_info_odb",
false);
2464 fEnabled.insert(
"spin_rot_calib_odb",
false);
2465 fEnabled.insert(
"spin_rot_angle_odb",
false);
2466 fEnabled.insert(
"mag_param_wew_odb",
false);
2467 fEnabled.insert(
"mag_param_bpar_odb",
false);
2468 fEnabled.insert(
"setup_sample_odb",
false);
2469 fEnabled.insert(
"setup_wew_odb",
false);
2470 fEnabled.insert(
"setup_bpar_odb",
false);
2473 fEnabled.insert(
"analyzer_fe",
false);
2475 fEnabled.insert(
"tfl_scfe",
false);
2476 fEnabled.insert(
"sample_scfe",
false);
2477 fEnabled.insert(
"omega_scfe",
false);
2478 fEnabled.insert(
"wew_scfe",
false);
2479 fEnabled.insert(
"danfysik_scfe",
false);
2480 fEnabled.insert(
"fug_scfe",
false);
2481 fEnabled.insert(
"lemvac_scfe",
false);
2485 fEnabled.insert(
"hv_detectors_eq",
false);
2486 fEnabled.insert(
"danfysik_spin_rot_eq",
false);
2487 fEnabled.insert(
"danfysik_eq",
false);
2489 fEnabled.insert(
"magnet_field_info",
false);
2491 fEnabled.insert(
"sample_eq",
false);
2492 fEnabled.insert(
"omega_eq",
false);
2493 fEnabled.insert(
"lemvac_eq",
false);
2495 fEnabled.insert(
"beamline_eq",
false);
2508 if (!key.compare(
"all", Qt::CaseInsensitive)) {
2509 QMapIterator<QString, bool> i(
fEnabled);
2510 while (i.hasNext()) {
2531 fExp =
new PExperiment(
"lemAutoRun1");
2533 QString err =
"lemAutoRun: Couldn't allocate memory for midas experiment handler.";
2540 if (!
fExp->IsConnected()) {
2541 QString err = QString(
"lemAutoRun: Couldn't connect to %1, %2").arg(
fHostName).arg(
fExpName);
2554 QString err = QString(
"lemAutoRun: Couldn't collect the necessary ODB keys");
2561 QString err = QString(
"lemAutoRun: **WARNING** MCP2 setup detected.");
2578 if (
fEnabled[
"enable_on_off_mode_odb"]) {
2581 if (!onOffMode->IsValid()) {
2582 QString err = QString(
"lemAutoRun: Enable_OnOff_Mode key not found.");
2585 int ival, size=
sizeof(int);
2586 onOffMode->GetData(&ival, &size, TID_BOOL);
2610 QString err = QString(
"lemAutoRun: Lost Network Connection");
2627 PKey runStateKey(
fExp,
"/AutoRun/Run State");
2628 if (runStateKey.IsValid()) {
2629 runStateKey.SetData((
void*)&runState, 1, TID_INT);
2635 err = QString(
"Autorun aborted.");
2638 err = QString(
"lemAutoRun: Received Shutdown Command");
2652 QDateTime dt = QDateTime::currentDateTime();
2655 msg =
"["+dt.toString(
"dd.MM.yy, hh:mm:ss")+
"] " + statusMsg;
2657 PKey statusMsgKey(
fExp,
"/AutoRun/Status");
2658 if (statusMsgKey.IsValid()) {
2660 memset(cmsg, 0,
sizeof(cmsg));
2661 strncpy(cmsg, msg.toLatin1().data(),
sizeof(cmsg)-1);
2662 statusMsgKey.SetData(cmsg, 1, TID_STRING);
2676 PKey key(
fExp,
"/AutoRun/Run State");
2677 if (key.IsValid()) {
2679 int size =
sizeof(ival);
2680 int status = key.GetData(&ival, &size, TID_INT);
2681 if (status == DB_SUCCESS) {
2698 PKey key(
fExp,
"/AutoRun/Run State");
2699 if (key.IsValid()) {
2700 key.SetData((
void*)&state, 1, TID_INT);
2715 PKey larSeqKey(
fExp,
"/AutoRun/Auto Run Sequence");
2716 if (larSeqKey.IsValid()) {
2717 char autoRunSequence[64];
2718 int size =
sizeof(autoRunSequence);
2719 int status = larSeqKey.GetData(autoRunSequence, &size, TID_STRING);
2720 if (status == DB_SUCCESS)
2721 fln = autoRunSequence;
2736 bool showComments =
true;
2738 PKey key(
fExp,
"/AutoRun/Show Comments");
2739 if (key.IsValid()) {
2741 int size =
sizeof(ival);
2742 int status = key.GetData(&ival, &size, TID_BOOL);
2743 if (status == DB_SUCCESS) {
2745 showComments =
false;
2749 return showComments;
2761 PKey key(
fExp,
"/AutoRun/GotoLine");
2762 if (key.IsValid()) {
2763 key.SetData((
void*)&line, 1, TID_INT);
2777 PKey key(
fExp,
"/AutoRun/GotoLine");
2778 if (key.IsValid()) {
2780 int size =
sizeof(ival);
2781 int status = key.GetData(&ival, &size, TID_INT);
2782 if (status == DB_SUCCESS) {
2796 PKey larRunStateKey(
fExp,
"/AutoRun/Run State");
2797 if (larRunStateKey.IsValid()) {
2799 int size =
sizeof(int);
2800 larRunStateKey.GetData(&state, &size, TID_INT);
2806 PKey liveDataKey(
fExp,
"/AutoRun/LiveData");
2808 if (liveDataKey.IsValid()) {
2810 PKey *errorInLineKey =
new PKey(&liveDataKey,
"ErrorInLine");
2811 if (errorInLineKey == 0) {
2812 cm_msg(MDEBUG,
"lemAutoRun",
"**ERROR** couldn't invoke errorInLineKey");
2815 if (errorInLineKey->IsValid()) {
2817 for (
int i=0; i<10; i++) {
2820 errorInLineKey->SetData((
void *)&ival[0], 10, TID_INT);
2822 delete errorInLineKey;
2825 PKey *errorMsgKey =
new PKey(&liveDataKey,
"ErrorMsg");
2826 if (errorMsgKey == 0) {
2827 cm_msg(MDEBUG,
"lemAutoRun",
"**ERROR** couldn't invoke errorMsgKey");
2830 if (errorMsgKey->IsValid()) {
2832 for (
int i=0; i<10; i++) {
2833 memset(msg[i], 0, 128);
2834 strcpy(msg[i],
"empty");
2836 errorMsgKey->SetData((
void*)msg, 10, TID_STRING);
2840 cm_msg(MINFO,
"lemAutoRun",
"try to create default /AutoRun/LiveData record.");
2843 const char *lar_live_data_settings =
2844 "ErrorInLine = INT[10] : \n\
2855 ErrorMsg = STRING[10] : \n\
2866 CurrentLineNo = INT : -1\n\
2867 LoopVal = STRING : [32] empty\n\
2868 TransitionTag = INT : 0\n\
2869 AutoRun = STRING : [32] empty\n\
2871 if (db_create_record(
fExp->GetHdb(), 0,
"/AutoRun/LiveData", lar_live_data_settings) != DB_SUCCESS) {
2872 cm_msg(MERROR,
"lemAutoRun",
"**ERROR** couldn't create /AutoRun/LiveData default record.");
2884 cm_msg(MDEBUG,
"lemAutoRun",
"debug> noOfErrors=%d, idx=%d, line=%d, errMsg=%s", noOfErrors, idx, line, errorMsg.toLatin1().data()); cm_yield(0);
2886 PKey errorInLineKey(
fExp,
"/AutoRun/LiveData/ErrorInLine");
2887 PKey errorMsgKey(
fExp,
"/AutoRun/LiveData/ErrorMsg");
2888 PKey transTagKey(
fExp,
"/AutoRun/LiveData/TransitionTag");
2891 transTagKey.SetData((
void*)&ival, 1, TID_INT);
2894 if (noOfErrors != 0) {
2901 if (errorInLineKey.IsValid()) {
2902 errorInLineKey.SetDataIndex((
void *)&ival, i, TID_INT);
2904 if (errorMsgKey.IsValid()) {
2906 memset(msg, 0,
sizeof(msg));
2907 strncpy(msg, errorMsg.toLatin1().data(),
sizeof(msg));
2908 errorMsgKey.SetDataIndex(msg, i, TID_STRING);
2920 QString runStatePath =
"/AutoRun/Run State";
2921 PKey key(
fExp, runStatePath);
2922 if (key.IsValid()) {
2924 int size =
sizeof(ival);
2926 key.GetData((
void*)&ival, &size, TID_INT);
2930 key.SetData((
void*)&ival, 1, TID_INT);
2952 sprintf(msg,
"**ERROR** in line no %d (errorNo: %d)", line, errorNo);
2954 sprintf(msg,
"**ERROR** errorNo: %d", errorNo);
2972 QCoreApplication::exit(0);
2990 char str[NAME_LENGTH];
2991 for (
int i=0; ; i++) {
2993 if (
fClientsKey->EnumSubKey(i, &hKey) == DB_NO_MORE_SUBKEYS)
2997 status = db_get_value(
fClientsKey->GetHdb(), hKey,
"Name", str, &size, TID_STRING, FALSE);
2998 if (status != DB_SUCCESS) {
2999 QString err = QString(
"Autorun: check clients failure ...");
3001 err = QString(
"PLemAutoRun::CheckClients(): Couldn't get value from subkey.");
3005 if (!strncmp(str,
"lemAutoRun",
sizeof(str)))
3043 if (
fEnabled[
"trigger_events_odb"]) {
3046 err = QString(
"lemAutoRun: Trigger Events key not found.");
3056 err = QString(
"lemAutoRun: Alarms key not found.");
3063 if (
fEnabled[
"alarms_td_hv_trip_odb"]) {
3066 err = QString(
"lemAutoRun: Alarm TD HV trip trigger key not found.");
3073 if (status != DB_SUCCESS) {
3074 err = QString(
"lemAutoRun: Couldn't hotlink Alarm TD HV trip trigger flag.");
3083 err = QString(
"lemAutoRun: Run info key not found.");
3092 err = QString(
"lemAutoRun: Run comment key not found.");
3102 err = QString(
"lemAutoRun: TOF Min key not found.");
3112 err = QString(
"lemAutoRun: TOF Max key not found.");
3122 err = QString(
"lemAutoRun: Moderator name key not found.");
3132 err = QString(
"lemAutoRun: Moderator date key not found.");
3142 err = QString(
"lemAutoRun: LEM setup key not found.");
3149 if (
fEnabled[
"sample_name_info_odb"]) {
3152 err = QString(
"lemAutoRun: Sample Name key not found.");
3159 if (
fEnabled[
"spin_rot_calib_odb"]) {
3162 err = QString(
"lemAutoRun: spin rotation enabled key not found.");
3169 if (
fEnabled[
"spin_rot_angle_odb"]) {
3172 err = QString(
"lemAutoRun: spin rotation angle key not found.");
3179 if (
fEnabled[
"sample_cryo_info_odb"]) {
3182 err = QString(
"lemAutoRun: Sample Cryo key not found.");
3189 if (
fEnabled[
"energy_loss_param_odb"]) {
3195 err = QString(
"lemAutoRun: Energy loss parameter p%1 key not found.").arg(i);
3199 size =
sizeof(float);
3209 err = QString(
"lemAutoRun: Clients key not found.");
3218 err = QString(
"lemAutoRun: HV demand key not found.");
3226 err = QString(
"lemAutoRun: HV measured key not found.");
3234 err = QString(
"lemAutoRun: HV current key not found.");
3244 err = QString(
"lemAutoRun: HV Detectors demand key not found.");
3252 err = QString(
"lemAutoRun: HV Detectors measured key not found.");
3258 if (
fEnabled[
"danfysik_spin_rot_eq"]) {
3262 err = QString(
"lemAutoRun: Danfysik Spin Rotator input key not found.");
3270 err = QString(
"lemAutoRun: Danfysik Spin Rotator output key not found.");
3280 err = QString(
"lemAutoRun: Danfysik input key not found.");
3288 err = QString(
"lemAutoRun: Danfysik output key not found.");
3298 err = QString(
"lemAutoRun: WEW output key not found.");
3306 err = QString(
"lemAutoRun: WEW input key not found.");
3312 if (
fEnabled[
"magnet_field_info"]) {
3316 err = QString(
"lemAutoRun: magnetic field value key not found.");
3326 err = QString(
"lemAutoRun: tfl input key not found.");
3334 err = QString(
"lemAutoRun: tfl output key not found.");
3344 err = QString(
"lemAutoRun: sample cryo LS340 ctrl channel key not found.");
3350 size =
sizeof(ctrl_ch);
3352 if (strstr(ctrl_ch,
"A")) {
3354 }
else if (strstr(ctrl_ch,
"B")) {
3357 err = QString(
"lemAutoRun: sample cryo LS340 ctrl channel neither 'A' or 'B'. Needs to be fixed first!");
3365 err = QString(
"lemAutoRun: sample cryo LS340 channel assignment key not found.");
3373 err = QString(
"lemAutoRun: sample cryo LS340 sensor type assignment key not found.");
3381 err = QString(
"lemAutoRun: sample cryo input key not found.");
3388 if (status != DB_SUCCESS) {
3389 err = QString(
"lemAutoRun: Couldn't hotlink sample input variables.");
3397 err = QString(
"lemAutoRun: sample cryo output key not found.");
3404 if (status != DB_SUCCESS) {
3405 err = QString(
"lemAutoRun: Couldn't hotlink sample output variables.");
3412 err = QString(
"lemAutoRun: sample cryo 'date and time' key not found.");
3418 for (
int i = 0; i<10; i++) {
3419 sprintf(number,
" %d", i+1);
3423 err = QString(
"lemAutoRun: sample cryo 'raw voltage key' key not found.");
3432 err = QString(
"lemAutoRun: sample cryo 'no connection' key not found.");
3442 err = QString(
"lemAutoRun: sample oven omega output key not found.");
3449 if (status != DB_SUCCESS) {
3450 err = QString(
"lemAutoRun: Couldn't hotlink sample oven omega input variables.");
3458 err = QString(
"lemAutoRun: sample oven omega output key not found.");
3465 if (status != DB_SUCCESS) {
3466 err = QString(
"lemAutoRun: Couldn't hotlink sample oven omega output variables.");
3476 err = QString(
"lemAutoRun: lemvac input key not found.");
3484 err = QString(
"lemAutoRun: lemvac output key not found.");
3494 err = QString(
"lemAutoRun: FOM input key not found.");
3502 err = QString(
"lemAutoRun: FOM output key not found.");
3512 err = QString(
"lemAutoRun: Beamline demand key not found.");
3518 if (
fEnabled[
"mag_param_wew_odb"]) {
3522 err = QString(
"lemAutoRun: Mag. Param. WEW calibration key not found.");
3530 err = QString(
"lemAutoRun: Mag. Param. WEW calibration with linear part == 0! Something is wrong!!");
3536 if (
fEnabled[
"mag_param_bpar_odb"]) {
3540 err = QString(
"lemAutoRun: Mag. Param. Bpar calibration key not found.");
3548 err = QString(
"lemAutoRun: Mag. Param. Bpar calibration with linear part == 0! Something is wrong!!");
3554 if (
fEnabled[
"setup_sample_odb"]) {
3558 err = QString(
"lemAutoRun: Sample setup enabled key not found.");
3563 size =
sizeof(ival);
3573 err = QString(
"lemAutoRun: WEW setup enabled key not found.");
3578 size =
sizeof(ival);
3588 err = QString(
"lemAutoRun: Bpar setup enabled key not found.");
3593 size =
sizeof(ival);
3602 char cryoName[NAME_LENGTH];
3603 size =
sizeof(cryoName);
3604 if (
fEnabled[
"sample_cryo_info_odb"])
3607 strcpy(cryoName,
"cryo");
3610 QDateTime dt(QDate::currentDate(), QTime::currentTime());
3611 QString dtStr = dt.toString(
"ddMMyy-hhmm");
3628 float energy_loss = 0.0;
3630 if (!
fEnabled[
"energy_loss_param_odb"])
3633 if (hv_mod < 20.1) {
3681 for (
int i=0; ; i++) {
3683 if (
fClientsKey->EnumSubKey(i, &subKey) == DB_NO_MORE_SUBKEYS)
3687 status = db_get_value(
fClientsKey->GetHdb(), subKey,
"Name", str, &size, TID_STRING, FALSE);
3688 if (status != DB_SUCCESS) {
3689 QString err = QString(
"Autorun: check clients failure ...");
3691 err = QString(
"PLemAutoRun::CheckClients(): Couldn't get value from subkey.");
3695 name = QString(str);
3768 char trigger_first[32];
3769 char trigger_last[32];
3770 char condition[256];
3771 char alarm_class[32];
3775 for (
int i=0; ; i++) {
3776 if (
fAlarmsKey->EnumSubKey(i, &subKey) == DB_NO_MORE_SUBKEYS)
3779 size =
sizeof(alarmData);
3780 status = db_get_record(
fAlarmsKey->GetHdb(), subKey, &alarmData, &size, 0);
3781 if (status != DB_SUCCESS) {
3782 QString err = QString(
"Autorun: check alarms failure ...");
3784 err = QString(
"PLemAutoRun::CheckMidasAlarms(): Couldn't get value from subkey.");
3787 if (alarmData.triggered && strstr(alarmData.alarm_class,
"Alarm")) {
3790 QString err = QString(
"Autorun: Alarm fired ...");
3792 err = QString(
"PLemAutoRun::CheckMidasAlarms: Alarm fired! ")+
3793 QString(
" msg: %1 ").arg(alarmData.alarm_msg)+
3794 QString(
" Error too severe, will stop.");
3797 QCoreApplication::exit(0);
3819 int imonth, day, year, hour, min, sec, msec;
3820 double days = 0, result;
3821 int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
3824 status = sscanf(str,
"%d,%d,%d,%d,%d,%d,%d", &imonth, &day, &year, &hour, &min, &sec, &msec);
3830 for (
int i=2006; i<year; i++) {
3831 if ( ((i % 4) == 0 && (i % 100) != 0) || (i % 400) == 0 )
3836 if ( ((year % 4) == 0 && (year % 100) != 0) || (year % 400) == 0 ) month[1] = 29;
3838 for (
int i = 1; i<imonth; i++ ) days = days + month[i-1];
3841 result = (double)days * 86400.0 + (
double)hour * 3600.0 + (double)min * 60.0 +
3842 (
double)sec + (double)msec / 1000.0;
3950 double denominator = -s * sxx * sxxxx + s * sxxx * sxxx + sx * sx * sxxxx
3951 - 2.0 * sxxx * sx * sxx + sxx * sxx * sxx;
3953 if ( fabs( denominator ) > 0.0 ) {
3955 sT * sxx * sxxxx - sT * sxxx * sxxx) / denominator;
3957 sh * sxx * sxxxx - sh * sxxx * sxxx) / denominator;
3959 sf * sxx * sxxxx - sf * sxxx * sxxx) / denominator;
3961 sp * sxx * sxxxx - sp * sxxx * sxxx) / denominator;
3963 sxx * sxxx * sT - sx * sT * sxxxx) / denominator;
3965 sxx * sxxx * sh - sx * sh * sxxxx) / denominator;
3966 fSampleTempTrend.
flow = -(- s * sxxx * sxxf + s * sxf * sxxxx - sxf * sxx * sxx + sxx * sx * sxxf +
3967 sxx * sxxx * sf - sx * sf * sxxxx) / denominator;
3969 sxx * sxxx * sp - sx * sp * sxxxx) / denominator;
3971 sxx * sx * sxT + sxx * sxx * sT) / denominator;
3973 sxx * sx * sxh + sxx * sxx * sh) / denominator;
3975 sxx * sx * sxf + sxx * sxx * sf) / denominator;
3977 sxx * sx * sxp + sxx * sxx * sp) / denominator;
4006 cout << endl <<
"SampleTempTrend:";
4007 cout << endl <<
" fSampleTempAverage (T, heater, flow, pressure):";
4012 cout << endl <<
" fSampleTempTrend (T, heater, flow, pressure):";
4017 cout << endl <<
" fSampleTempSecond (T, heater, flow, pressure):";
4022 cout << endl <<
" fSampleTempRmsqd (T, heater, flow, pressure):";
4047 int hr = (int)heaterRange;
4050 cout << endl <<
"in SampleTempPrefHeaterOutput: hr = " << hr;
4079 float p_heat, d_heat, pref_heat;
4082 cout << endl <<
"in SampleTempAdjustFlow ...";
4094 cout << endl <<
"--------------------";
4096 cout << endl <<
"SampleTempAdjustFlow: p_heat = " << p_heat <<
", d_heat = " << d_heat <<
", pref_heat = " << pref_heat;
4098 cout << endl <<
"change = " << change;
4099 cout << endl <<
"SampleTempAdjustFlow: new flow value = " << value;
4127 cout << endl <<
"in SampleTempStable. maxdiff = " << maxdiff;
4135 cout << endl <<
"in SampleTempStable. stability reached.";
4151 float value = 1.0e6;
4159 cout << endl <<
"in SampleTempConsiderNeedleValve ...";
4162 size =
sizeof(modus);
4166 size =
sizeof(bh_valve);
4170 size =
sizeof(needle_valve);
4172 if (bh_valve > 0.9) {
4173 size =
sizeof(demand_flow);
4188 cout << endl <<
"in SampleTempConsiderNeedleValve: value = " << value;
4217 int size =
sizeof(float);
4220 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"]);
4229 size =
sizeof(float);
4259 int size =
sizeof(float);
4262 cout << endl <<
"in SampleTempConsiderFlow ...";
4273 cm_msg(MINFO,
"SampleTempConsiderFlow",
"SampleTempConsiderFlow, demand = %e", demand);
4280 cm_msg(MINFO,
"SampleTempConsiderFlow",
4281 "SampleTempConsiderFlow skipped consideration, demand = %e, present flow = %e",
4300 if (fabs( change - 1.0 ) > 0.001 ) {
4331 char str[NAME_LENGTH];
4337 static int tempDeviationToHighCounter = 0;
4340 cout << endl <<
"in CheckTempStability ...";
4344 err += QString(
"Does not make any sense!");
4396 cout << datetime.toLatin1().data() <<
", ";
4413 tempDeviationToHighCounter++;
4421 tempDeviationToHighCounter = 0;
4439 err = QString(
"PLemAutoRun::CheckTempStabilityOvenOmega(): | Setpoint=%1 ").arg(
fSampleOvenOmegaOutput[OMEGA_OVEN_OUTPUT_SETPOINT]);
4470 PAutoRunCmdVector::Iterator iter;
4474 if ( !file.open( QIODevice::WriteOnly ) ) {
4475 QString err = QString(
"PLemAutoRun::UpdateWebPage(): Couldn't open %1").arg(
fXMLAutoRunHTML);
4481 QTextStream stream( &file );
4484 stream <<
"<html>" << endl;
4487 stream <<
" <head>" << endl;
4488 stream <<
"<link rel=\"stylesheet\" href=\"mhttpd.css\" type=\"text/css\" />" << endl;
4489 stream <<
" <title>LEM Autorun Parameter Page</title>" << endl;
4490 stream <<
" <meta http-equiv=\"Refresh\" content=\"30\">" << endl;
4491 stream <<
" <script type=\"text/javascript\" src=\"../mhttpd.js\"></script>" << endl;
4492 stream <<
" <script type=\"text/javascript\" src=\"../midas.js\"></script>" << endl;
4493 stream <<
" <script type=\"text/javascript\" src=\"../obsolete.js\"></script>" << endl;
4494 stream <<
" <script type=\"text/javascript\">" << endl;
4495 stream <<
" var lar_state;" << endl;
4496 stream <<
" function lar_running()" << endl;
4497 stream <<
" {" << endl;
4498 stream <<
" var result=confirm(\"Are you sure you want to start the autorun?\")" << endl;
4499 stream <<
" if (result==true) {" << endl;
4500 stream <<
" ODBSet(\"/AutoRun/Run State\", \"2\");" << endl;
4501 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << endl;
4502 stream <<
" }" << endl;
4503 stream <<
" }" << endl;
4505 stream <<
" function lar_resume()" << endl;
4506 stream <<
" {" << endl;
4507 stream <<
" ODBSet(\"/AutoRun/Run State\", \"3\");" << endl;
4508 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << endl;
4509 stream <<
" }" << endl;
4511 stream <<
" function lar_stop()" << endl;
4512 stream <<
" {" << endl;
4513 stream <<
" var result=confirm(\"Are you sure you want to stop the autorun?\")" << endl;
4514 stream <<
" if (result==true) {" << endl;
4515 stream <<
" ODBSet(\"/AutoRun/Run State\", \"0\");" << endl;
4516 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << endl;
4517 stream <<
" }" << endl;
4518 stream <<
" }" << endl;
4520 stream <<
" function lar_pause()" << endl;
4521 stream <<
" {" << endl;
4522 stream <<
" ODBSet(\"/AutoRun/Run State\", \"1\");" << endl;
4523 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << endl;
4524 stream <<
" }" << endl;
4526 stream <<
" function lar_load()" << endl;
4527 stream <<
" {" << endl;
4528 stream <<
" ODBSet(\"/AutoRun/Run State\", \"4\");" << endl;
4529 stream <<
" setTimeout(\"lar_refresh()\", 4000);" << endl;
4530 stream <<
" }" << endl;
4532 stream <<
" function lar_refresh()" << endl;
4533 stream <<
" {" << endl;
4534 stream <<
" window.location.reload(true);" << endl;
4535 stream <<
" }" << endl;
4536 stream <<
" function compProp(prop_odb) {" << endl;
4537 stream <<
" fetch('https://duo.psi.ch/duo/rest.php/cal/smus/lem?SECRET=change-bib-eva-grille',{method:'POST'})" << endl;
4538 stream <<
" .then( data => data.json(), console.error)" << endl;
4539 stream <<
" .then( data => {" << endl;
4540 stream <<
" console.log('propid_duo:', data.proposal);" << endl;
4541 stream <<
" if (data.proposal != prop_odb ) {" << endl;
4542 stream <<
" alert(\"The proposal number does NOT match the official schedule!\");" << endl;
4543 stream <<
" }" << endl;
4544 stream <<
" });" << endl;
4545 stream <<
" }" << endl;
4546 stream <<
" mjsonrpc_db_get_values([\"/Info/File_Header_Info/Proposal Number\"])" << endl;
4547 stream <<
" .then(function(rpc) {console.log('propid_odb:', rpc.result.data[0]);" << endl;
4548 stream <<
" compProp(rpc.result.data[0]);});" << endl;
4549 stream <<
" " << endl;
4550 stream <<
" " << endl;
4551 stream <<
" " << endl;
4552 stream <<
" </script>" << endl;
4553 stream <<
" </head>" << endl;
4556 stream <<
" <body>" << endl;
4557 stream <<
" <form name=\"form1\" method=\"Get\" action=\"/CS/AutoRun&\">" << endl;
4558 stream <<
" <input type=\"hidden\" name=\"exp\" value=\"" <<
fExpName.toLatin1().data() <<
"\">" << endl;
4559 stream <<
" <table border=3 cellpadding=2 class=\"genericTable\">" << endl;
4560 stream <<
" <tr><th colspan=3 class=\"subStatusTitle\">NEMU Experiment: Autorun Parameters</th></tr>" << endl;
4561 stream <<
" <tr><td colspan=3>" << endl;
4562 stream <<
" <input value=\"Status\" name=\"cmd\" type=\"submit\">" << endl;
4563 stream <<
" <input value=\"ODB\" name=\"cmd\" type=\"submit\">" << endl;
4564 stream <<
" <input value=\"Messages\" name=\"cmd\" type=\"submit\">" << endl;
4565 stream <<
" </td></tr>" << endl;
4566 stream <<
" <tr><td colspan=3 style=\"text-align:left;\">" << endl;
4567 stream <<
" <script type=\"text/javascript\">" << endl;
4568 stream <<
" lar_state = ODBGet('/AutoRun/Run State');" << endl;
4569 stream <<
" if ((lar_state == 0) || (lar_state == 2) || (lar_state == 4) || (lar_state == 5)) { // stopped or starting up" << endl;
4570 stream <<
" document.write('<input type=\"button\" value=\"Start AutoRun\" onclick=\"lar_running()\">');" << endl;
4571 stream <<
" document.write('<input type=\"button\" value=\"Load Sequence\" onclick=\"lar_load()\">');" << endl;
4572 stream <<
" } else if (lar_state == 1) { // paused" << endl;
4573 stream <<
" document.write('<input type=\"button\" value=\"Resume AutoRun\" onclick=\"lar_resume()\">');" << endl;
4574 stream <<
" } else { // running" << endl;
4575 stream <<
" document.write('<input type=\"button\" value=\"Stop AutoRun\" onclick=\"lar_stop()\">');" << endl;
4576 stream <<
" document.write(' ');" << endl;
4577 stream <<
" document.write('<input type=\"button\" value=\"Pause AutoRun\" onclick=\"lar_pause()\">');" << endl;
4578 stream <<
" }" << endl;
4579 stream <<
" </script>" << endl;
4580 stream <<
" </td></tr>" << endl;
4581 stream <<
" <tr><td class=\"ODBtableEven\" colspan=3 style=\"text-align:left;\">Sample Name: <b><odb src=\"/Info/Sample Name\" edit=2></b></td>" << endl;
4582 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>" << endl;
4583 stream <<
" <td class=\"ODBtableOdd\" style=\"text-align:left;\">PI: <b><odb src=\"/Info/File_Header_Info/Main Proposer\" edit=2></b></td>" << endl;
4584 stream <<
" <tr><td class=\"ODBtableOdd\" colspan=2 style=\"text-align:left;\">Sequence: <b><odb src=\"/AutoRun/Auto Run Sequence\" edit=2></b></td>" << endl;
4585 stream <<
" <td class=\"ODBtableOdd\" style=\"text-align:left;\">Show Comments: <b><odb src=\"/AutoRun/Show Comments\" edit=2></b></td></tr>" << endl;
4586 stream <<
" <tr><td class=\"ODBtableEven\" colspan=2 style=\"text-align:left;\">Goto Line: <b><odb src=\"/AutoRun/GotoLine\" edit=2></b></td>" << endl;
4587 stream <<
" <td class=\"ODBtableEven\" style=\"text-align:left;\">Next : <b><odb src=\"/AutoRun/Next\" edit=2></b></td></tr>" << endl;
4588 stream <<
" <tr><td colspan=3 style=\"text-align:left;\">Status : <b><odb src=\"/AutoRun/Status\" edit=0></b></td></tr>" << endl;
4591 stream <<
" <tr><td colspan=3 style=\"text-align:left;font-family:Fixed;line-height:1.25\" bgcolor=\"#FFFFFF\">" << endl;
4592 stream <<
" <pre>" << endl;
4595 if (errLineNo > 0) {
4600 QTextStream fstream(&f);
4604 f.open(QIODevice::ReadOnly);
4605 while (!fstream.atEnd()) {
4606 line = fstream.readLine();
4607 stream << lineNo <<
": " << line << endl;
4608 if (lineNo == errLineNo) {
4609 stream <<
"<span style=\"background-color: #FF8800;font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4616 stream <<
"<span style=\"background-color: #FF8800;font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4619 stream <<
"<span style=\"background-color: #FF8800font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4622 stream <<
"<span style=\"background-color: #FF0000font-weight: bold;\">" << errMsg.toLatin1().data() <<
"</span>";
4627 QDateTime dt = QDateTime::currentDateTime();
4628 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"));
4629 stream << cmd << endl;
4633 int width = 0, count = 0;
4641 if ((iter == currentIter) && (tag !=
HTML_LOAD))
4642 cmd =
"<span style=\"background-color: #FFFF00;font-weight: bold;\">";
4647 cmd += QString(
"%1 (%2): ").arg(count, width).arg(iter->lineNo, width);
4650 if (iter->cmd ==
"comment")
4651 cmd +=
"<span style=\"color:grey;font-style:italic\">";
4653 cmd += iter->cmdString;
4655 if (iter->cmd ==
"comment")
4658 if (iter == currentIter) {
4660 if (!errMsg.isEmpty())
4661 cmd += QString(
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">%1</span></span>").arg(errMsg);
4662 cmd +=
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">AUTORUN ABORTED ...</span></span>";
4664 cmd +=
"\nEXECUTING WARMUP COMMAND ...</span>";
4666 cmd +=
"\n<span style=\"background-color: #FF0000;font-weight: bold;\">ALARM FIRED, HENCE AUTORUN STOPPED...</span></span>";
4668 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>";
4674 stream << cmd << endl;
4678 cmd =
"<span style=\"background-color: #FFFF00;font-weight: bold;\">AUTORUN FINISHED ...</span>";
4679 stream << cmd << endl;
4683 stream <<
" </pre>" << endl;
4684 stream <<
" </td></tr>" << endl;
4685 stream <<
" </table>" << endl;
4686 stream <<
" </form>" << endl;
4687 stream <<
" </body>" << endl;
4690 stream <<
"</html>" << endl;
4705 INT status = db_find_key(
fExp->GetHdb(), 0,
"/AutoRun/LiveData/AutoRun", &hKey);
4706 if (status == DB_SUCCESS) {
4707 status = db_delete_key(
fExp->GetHdb(), hKey, TRUE);
4715 QTextStream fstream(&f);
4717 QVector<QString> data;
4719 f.open(QIODevice::ReadOnly);
4720 while (!fstream.atEnd()) {
4721 line = fstream.readLine();
4722 data.push_back(line);
4729 for (
int i=0; i<data.size(); i++) {
4730 memset(str, 0,
sizeof(str));
4731 strncpy(str, data[i].toLatin1(),
sizeof(str));
4732 status = db_set_value_index(
fExp->GetHdb(), 0,
"/AutoRun/LiveData/AutoRun", str,
sizeof(str), i, TID_STRING, FALSE);
4744 PAutoRunCmdVector::Iterator iter;
4747 bool aborted =
false;
4752 QString msg(
"**FATAL ERROR** no autorun commands present!!");
4786 if (iter->cmd ==
"comment")
4788 if (iter->lineNo > maxCount)
4789 maxCount = iter->lineNo;
4795 PKey transTagKey(
fExp,
"/AutoRun/LiveData/TransitionTag");
4796 if (!transTagKey.IsValid()) {
4797 QString msg(
"**FATAL ERROR** cannot get necessary key /AutoRun/LiveData/TransitionTag!");
4803 transTagKey.SetData((
void*)&ival, 1, TID_INT);
4811 QString msg(
"Loading Sequence ...");
4824 bool runningWhenStarting =
false;
4829 runningWhenStarting =
true;
4832 PKey lineNoKey(
fExp,
"/AutoRun/LiveData/CurrentLineNo");
4833 if (!lineNoKey.IsValid()) {
4834 QString msg(
"**FATAL ERROR** cannot get necessary key /AutoRun/LiveData/CurrentLineNo!");
4840 PKey loopValKey(
fExp,
"/AutoRun/LiveData/LoopVal");
4841 if (!loopValKey.IsValid()) {
4842 QString msg(
"**FATAL ERROR** cannot get necessary key /AutoRun/LiveData/LoopVal!");
4852 lineNoKey.SetData(&(iter->lineNo), 1, TID_INT);
4855 char loopValStr[32];
4856 memset(loopValStr, 0,
sizeof(loopValStr));
4857 if (iter->loopVal.isEmpty())
4858 strncpy(loopValStr,
"empty",
sizeof(loopValStr));
4860 strncpy(loopValStr, iter->loopVal.toLatin1().data(),
sizeof(loopValStr));
4861 loopValKey.SetData(loopValStr, 1, TID_STRING);
4869 !((iter->cmd ==
"setWait") || (iter->cmd ==
"runStop") ||
4870 (iter->cmd ==
"warmUp") || (iter->cmd ==
"alias") || (iter->cmd ==
"comment") ||
4871 (iter->cmd ==
"odbTag"))) {
4878 if ((iter->cmd ==
"alias") || (iter->cmd ==
"odbTag") || (iter->cmd ==
"comment")) {
4882 if ((iter->cmd ==
"alias") || (iter->cmd ==
"odbTag"))
4894 QString err(
"STOP cmd for a stopped run doesn't make any sense. Will change the STOP to a START cmd!");
4896 iter->cmd =
"runStart";
4897 iter->cmdString =
"START " + iter->param[0];
4898 if (iter->noElements == 2) {
4899 iter->cmdString +=
" sec";
4906 runningWhenStarting =
false;
4922 runningWhenStarting =
false;
4931 if (iter->cmd ==
"runStart") {
4933 }
else if (iter->cmd ==
"degaussWEW") {
4936 }
else if (iter->cmd ==
"degaussDanfysik") {
4939 }
else if (iter->cmd ==
"degaussMagnet") {
4942 }
else if (iter->cmd ==
"degaussSpinRot") {
4945 }
else if (iter->cmd ==
"ignore_alarms") {
4948 }
else if (iter->cmd ==
"ignore_clients") {
4951 }
else if (iter->cmd ==
"setBPV") {
4954 }
else if (iter->cmd ==
"setDump") {
4957 }
else if (iter->cmd ==
"setFOM") {
4960 }
else if (iter->cmd ==
"setFieldWEWL") {
4963 }
else if (iter->cmd ==
"setFieldWEWH") {
4966 }
else if (iter->cmd ==
"setFieldDanfysik") {
4969 }
else if (iter->cmd ==
"setField") {
4972 }
else if (iter->cmd ==
"setSpinRot") {
4975 }
else if (iter->cmd ==
"setLEMSetup") {
4978 }
else if (iter->cmd ==
"setModInfo") {
4981 }
else if (iter->cmd ==
"setOdbData") {
4984 }
else if (iter->cmd ==
"setOdbDataArray") {
4987 }
else if (iter->cmd ==
"setSampleHV") {
4990 }
else if (iter->cmd ==
"setRA_HV") {
4993 }
else if (iter->cmd ==
"setTransportHV") {
4996 }
else if (iter->cmd ==
"setHVOff") {
4999 }
else if (iter->cmd ==
"setTfl") {
5002 }
else if (iter->cmd ==
"setTemp") {
5005 }
else if (iter->cmd ==
"setTitle") {
5008 }
else if (iter->cmd ==
"setTOF") {
5011 }
else if (iter->cmd ==
"setWait") {
5014 }
else if (iter->cmd ==
"warmUp") {
5022 fExp->FeedMidasWatchdog();
5066 transTagKey.SetData((
void*)&ival, 1, TID_INT);
5070 transTagKey.SetData((
void*)&ival, 1, TID_INT);
5073 int size =
sizeof(ival);
5074 lineNoKey.GetData((
void*)&ival, &size, TID_INT);
5076 lineNoKey.SetData((
void*)&ival, 1, TID_INT);
5079 QString msg = QString(
"Autorun finished.");
5086 PKey nextAutoRun(
fExp,
"/AutoRun/Next");
5087 if (nextAutoRun.IsValid()) {
5089 int size =
sizeof(next);
5090 nextAutoRun.GetData(next, &size, TID_STRING);
5092 if (!strcmp(next,
"none")) {
5099 transTagKey.SetData((
void*)&ival, 1, TID_INT);
5132 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"]);
5141 err = QString(
"PLemAutoRun::RunStart: ");
5146 err += QString(
"not running, will stop! Fix it first ;-)");
5150 QCoreApplication::exit(0);
5158 err = QString(
"PLemAutoRun::RunStart: BPVX still closed! Check also sample regions HV's");
5162 err = QString(
"PLemAutoRun::RunStart: BPVY still closed! Check also sample regions HV's");
5172 size =
sizeof(fval);
5173 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
5175 err = QString(
"PLemAutoRun::RunStart: RA HV's < 0.2kV! Unlikely to be correct, please check!");
5183 float wew_input[11];
5184 size =
sizeof(wew_input);
5196 size =
sizeof(fval);
5197 fWEWInputKey->GetDataIndex(&fval, &size, current_idx, TID_FLOAT);
5200 size =
sizeof(fval);
5201 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
5203 err = QString(
"PLemAutoRun::RunStart: RA HV's < 0.2kV! Unlikely to be correct, please check!");
5219 if (status != CM_SUCCESS) {
5221 err = QString(
"PLemAutoRun::RunStart: Cannot start the run.");
5231 cout << endl <<
"RunStart: Runinfo.state = " <<
fRunInfo.
state;
5234 if (t.elapsed() > 60e3) {
5235 err = QString(
"PLemAutoRun::RunStart: Didn't get run transition after run started.");
5252 msg = QString(
"Autorun running: ") + msg;
5282 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"]);
5292 QString err = QString(
"PLemAutoRun::RunStop: ");
5297 err += QString(
"not running, will stop! Fix it first ;-)");
5301 QCoreApplication::exit(0);
5330 bool stopped =
false;
5343 QString err = QString(
"PLemAutoRun::RunStopCheck: ");
5348 err += QString(
"not running, will stop! Fix it first ;-)");
5351 QCoreApplication::exit(0);
5357 size =
sizeof(value);
5359 if (status != DB_SUCCESS) {
5361 err =
"PLemAutoRun::RunStopCheck: Couldn't get current number of events";
5368 if (status != CM_SUCCESS) {
5370 err = QString(
"PLemAutoRun::RunStart: Cannot stop the run.");
5374 err = QString(
"Autorun running: run stopped.");
5376 err = QString(
">> End of run; read=%1 of requested = %2").arg(value).arg(
fRunNoEventsNeeded);
5386 if (status != CM_SUCCESS) {
5388 err = QString(
"PLemAutoRun::RunStart: Cannot stop the run.");
5392 err = QString(
"Autorun running: run stopped.");
5394 err = QString(
">> End of run; read=%1 of requested = %2").arg(value).arg(
fRunNoEventsNeeded);
5424 float fval, maxField;
5430 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);
5436 if (fabs(fval) > maxField) {
5437 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);
5446 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);
5452 if (fabs(fval) > maxField) {
5453 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);
5468 if (fabs(fval) > maxField) {
5469 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);
5479 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);
5485 if (fabs(fval) > maxField) {
5486 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);
5500 if (fabs(fval) > maxField) {
5501 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);
5528 float current_wewh[3] = {+600.0, -40.0, 0.0};
5529 float current_wewl[3] = {+50.0, -45.0, 0.0};
5554 QString err = QString(
"PLemAutoRun::DegaussWEW: WEW Slowcontrol Frontend NOT running. Error too severe, will stop.");
5557 QCoreApplication::exit(0);
5564 msg = QString(
"Autorun running: ") + msg;
5569 size =
sizeof(fval);
5573 size =
sizeof(fval);
5577 size =
sizeof(fval);
5581 size =
sizeof(fval);
5585 size =
sizeof(fval);
5598 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: RA HV down. Will wait 5 sec to settle things.");
5616 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: set WEWL/H demand current to zero");
5623 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: switch off WEWL");
5630 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: unlock WEW/SSP");
5637 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: switch on WEWH");
5640 for (
unsigned int i=0; i<3; i++) {
5641 fval = current_wewh[i];
5644 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: set current %f A via WEWH.", fval);
5650 size =
sizeof(fval);
5652 }
while (fabs(fabs(fval)-fabs(current_wewh[i])) > 2.0);
5658 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: switch WEWH off, WEWL on.");
5667 size =
sizeof(fval);
5669 timeDiff = tt.elapsed();
5670 if (timeDiff % 500 < 50)
5672 }
while ((fval != 0.0) && (timeDiff < 120000));
5673 if (timeDiff >= 120000) {
5675 QString err = QString(
"PLemAutoRun::DegaussWEW: Couldn't switch off WEWH - check. Error too severe, will stop.");
5678 QCoreApplication::exit(0);
5689 bool try_again =
false;
5691 size =
sizeof(fval);
5693 timeDiff = tt.elapsed();
5694 if (timeDiff % 500 < 50)
5696 if ((timeDiff >= 60000) && !try_again) {
5707 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: couldn't switch on the WEWL yet, will try again.");
5709 }
while ((fval != 1.0) && (timeDiff < 120000));
5710 if (timeDiff >= 120000) {
5712 QString err = QString(
"PLemAutoRun::DegaussWEW: Couldn't switch on WEWL - check. Error too severe, will stop.");
5715 QCoreApplication::exit(0);
5720 for (
unsigned int i=0; i<3; i++) {
5721 fval = current_wewl[i];
5724 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: set current %f A via WEWL.", fval);
5730 size =
sizeof(fval);
5732 }
while (fabs(fabs(fval)-fabs(current_wewl[i])) > 0.2);
5740 cm_msg(MDEBUG,
"lemAutoRun",
"DegaussWEW: lock WEW/SSP");
5744 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: ramping back RA HV's.");
5760 size =
sizeof(fval);
5762 if (fabs(fval-hv[0]) < 0.2)
5766 size =
sizeof(fval);
5768 if (fabs(fval-hv[1]) < 0.2)
5772 size =
sizeof(fval);
5774 if (fabs(fval-hv[2]) < 0.2)
5778 size =
sizeof(fval);
5780 if (fabs(fval-hv[3]) < 0.2)
5784 size =
sizeof(fval);
5786 if (fabs(fval-hv[4]) < 0.2)
5793 if (tt.elapsed() > 300000) {
5794 QString err = QString(
"lemAutoRun: **WARNING** Sample region HV's couldn't be ramped back within 5min.");
5804 cm_msg(MINFO,
"lemAutoRun",
"DegaussWEW: degauss done.");
5818 float currentFieldValue;
5834 QString err = QString(
"PLemAutoRun::DegaussDanfysik: Danfysik Slowcontrol Frontend NOT running. Error too severe, will stop.");
5837 QCoreApplication::exit(0);
5844 msg = QString(
"Autorun running: ") + msg;
5848 currentFieldValue = -8.0;
5850 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: set Bpar current to -8.0A");
5857 currentFieldValue = +8.0;
5859 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: set Bpar current to +8.0A");
5868 currentFieldValue /= -2.0;
5870 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: set Bpar current to %.2f A", currentFieldValue);
5875 }
while (fabs(currentFieldValue) > 0.1);
5878 currentFieldValue = 0.0;
5880 cm_msg(MINFO,
"lemAutoRun",
"DegaussDanfysik: done");
5917 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
5924 if (!
fEnabled[
"danfysik_spin_rot_eq"]) {
5926 msg += QString(
"PLemAutoRun::DegaussSpinRot: danfysik spin rot equipment is disabled. Will do nothing here.");
5937 QString err = QString(
"PLemAutoRun::DegaussSpinRot: Slowcontrol Frontend NOT running. Error too severe, will stop.");
5940 QCoreApplication::exit(0);
5947 msg = QString(
"Autorun running: ") + msg;
5951 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: shut down Spin Rot HV's.");
5997 if (t.elapsed() > timeout) {
6000 msg = QString(
"Couldn't shut down Spin Rot HVs within %1 sec: will give it another try in 120 sec.").arg(
fHVTimeout);
6016 if (i == HV_FUG_MAX_TRY) {
6019 msg = QString(
"Couldn't shut down the Spin Rotator HV, even after a few trials :-( .");
6025 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to 0.");
6037 size =
sizeof(value);
6040 if (fabs(value) < 0.1)
6044 if (t.elapsed() > timeout) {
6047 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6056 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to 12.0 A.");
6068 size =
sizeof(value);
6071 if (fabs(value-12.0) < 0.1)
6075 if (t.elapsed() > timeout) {
6078 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6087 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to -1.3 A.");
6099 size =
sizeof(value);
6102 if (fabs(value+1.3) < 0.1)
6106 if (t.elapsed() > timeout) {
6109 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6118 cm_msg(MINFO,
"DegaussSpinRot",
"DegaussSpinRot: set Spin Rot Magnet current to 0 - done.");
6130 size =
sizeof(value);
6133 if (fabs(value) < 0.1)
6137 if (t.elapsed() > timeout) {
6140 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6167 msg = QString(
"Autorun running: ") + msg;
6170 if ((arc->
param[0] ==
"yes") || (arc->
param[0] ==
"1") || (arc->
param[0] ==
"true"))
6193 msg = QString(
"Autorun running: ") + msg;
6196 if ((arc->
param[0] ==
"yes") || (arc->
param[0] ==
"1") || (arc->
param[0] ==
"true"))
6220 msg += QString(
"PLemAutoRun::SetDump: sample equipment is disabled. Will do nothing here.");
6230 msg = QString(
"Autorun running: ") + msg;
6238 fDumpFile.open(QIODevice::WriteOnly | QIODevice::Append);
6241 static bool write_header =
true;
6244 write_header =
false;
6248 int size =
sizeof(ctrl_ch);
6252 char sensor_ch[10][4];
6253 size =
sizeof(sensor_ch[0]);
6259 int sensor_type[10];
6267 stream <<
"%--------------------------------------------------------------------------" << endl;
6268 stream <<
"% Number of Entries : 23" << endl;
6269 stream <<
"% Number of Raw Data Reading : 10" << endl;
6270 stream <<
"% First Raw Data Reading Entry : 14" << endl;
6271 stream <<
"% Entry 1 : month" << endl;
6272 stream <<
"% Entry 2 : day" << endl;
6273 stream <<
"% Entry 3 : year" << endl;
6274 stream <<
"% Entry 4 : hour" << endl;
6275 stream <<
"% Entry 5 : minutes" << endl;
6276 stream <<
"% Entry 6 : seconds" << endl;
6277 stream <<
"% Entry 7 : msec" << endl;
6278 stream <<
"% Entry 8 : measured temperature of control channel = " << ctrl_ch << endl;
6279 stream <<
"% Entry 9 : pressure" << endl;
6280 stream <<
"% Entry 10 : heater output" << endl;
6281 stream <<
"% Entry 11 : setpoint temperature" << endl;
6282 stream <<
"% Entry 12 : heater range" << endl;
6283 stream <<
"% Entry 13 : BH1 flow measured" << endl;
6284 for (
int i=0; i<10; i++) {
6285 stream <<
"% Entry " << 14+i <<
" : Raw Data Reading Entry " << i <<
" : Channel " << sensor_ch[i] <<
" : Sensor Type " << sensor_type[i] << endl;
6287 stream <<
"%--------------------------------------------------------------------------" << endl;
6311 float value, demand;
6312 int size, err_count;
6319 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6333 QString err = QString(
"PLemAutoRun::SetFieldWEWL: WEW Slowcontrol Frontend NOT running.\n")+
6334 QString(
" Error too severe, will stop.");
6337 QCoreApplication::exit(0);
6345 msg = QString(
"Autorun running: ") + msg;
6350 size =
sizeof(value);
6353 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWL",
"**WARNING** WEWH still ON! Will ramp it to zero and switch it off first.");
6361 size =
sizeof(value);
6364 }
while ((value > 2.0) && (err_count++ < 120));
6371 size =
sizeof(value);
6374 }
while ((value != 0.0) && (err_count++ < 120));
6375 if (err_count >= 120) {
6376 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWL",
"**WARNING** WEWH status is still ON. Please check! EPICS Gateway Problems?");
6382 size =
sizeof(value);
6389 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWL",
"**WARNING** WEWL still OFF! Will switch it on first.");
6396 value = arc->
param[0].toFloat();
6397 if (arc->
param[1] ==
"G") {
6408 size =
sizeof(fval);
6409 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
6416 msg = QString(
"PLemAutoRun::SetFieldWEWL: demand current %1 > %2, hence RA HV's will be shut down").arg(value).arg(
fWEWCriticalCurrentRA);
6440 size =
sizeof(value);
6448 if (t.elapsed() > timeout) {
6451 msg = QString(
"Field (WEW) was not reached within %1 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand).arg(value);
6472 float value, demand;
6473 int size, err_count;
6480 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6494 QString err = QString(
"PLemAutoRun::SetFieldWEWH: WEW Slowcontrol Frontend NOT running.\n")+
6495 QString(
" Error too severe, will stop.");
6498 QCoreApplication::exit(0);
6506 msg = QString(
"Autorun running: ") + msg;
6511 size =
sizeof(value);
6514 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWH",
"**WARNING** WEWL still ON! Will ramp it to zero and switch it off first.");
6522 size =
sizeof(value);
6525 }
while ((value > 0.1) && (err_count++ < 120));
6532 size =
sizeof(value);
6535 }
while ((value != 0.0) && (err_count++ < 120));
6536 if (err_count >= 120) {
6537 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWH",
"**WARNING** WEWL status is still ON. Please check! EPICS Gateway Problems?");
6543 size =
sizeof(value);
6550 cm_msg(MINFO,
"PLemAutoRun::SetFieldWEWH",
"**WARNING** WEWH still OFF! Will switch it on first.");
6557 value = arc->
param[0].toFloat();
6558 if (arc->
param[1] ==
"G") {
6569 size =
sizeof(fval);
6570 fHVDemandKey->GetDataIndex(&fval, &size, i, TID_FLOAT);
6577 msg = QString(
"PLemAutoRun::SetFieldWEWH: demand current %1 > %2, hence RA HV's will be shut down").arg(value).arg(
fWEWCriticalCurrentRA);
6601 size =
sizeof(value);
6605 if (fabs(demand) < 2.0) {
6606 if (fabs(demand-value) < 2.0)
6612 if (t.elapsed() > timeout) {
6615 msg = QString(
"Field (WEW) was not reached within %1 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand).arg(value);
6637 float value, demand;
6644 msg +=
": PLemAutoRun::SetFieldDanfysik: danfysik equipment disabled in lemAutoRun. Will do nothing here.";
6659 QString err = QString(
"PLemAutoRun::SetFieldDanfysik: Danfysik Slowcontrol Frontend NOT running.\n")+
6660 QString(
" Error too severe, will stop.");
6663 QCoreApplication::exit(0);
6671 msg = QString(
"Autorun running: ") + msg;
6674 value = arc->
param[0].toFloat();
6675 if (arc->
param[1] ==
"G") {
6694 size =
sizeof(value);
6702 if (t.elapsed() > timeout) {
6705 msg = QString(
"Field (Danfysik) was not reached within %1 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand).arg(value);
6728 float value = arc->
param[0].toFloat();
6729 if (arc->
param[1] ==
"G") {
6733 if (fabs(value) < 50.0)
6742 msg +=
"PLemAutoRun::SetField: no magnet is enabled. Will do nothing here.";
6767 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
6773 if (!
fEnabled[
"danfysik_spin_rot_eq"]) {
6775 msg += QString(
"PLemAutoRun::SetSpinRot: danfysik spin rot equipment disabled. Will do nothing here.");
6786 msg = QString(
"Autorun running: ") + msg;
6798 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: start Spin Rot shutdown and degauss procedure.");
6799 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: shut down Spin Rot HV's.");
6845 if (t.elapsed() > timeout) {
6848 msg = QString(
"Couldn't shut down Spin Rot HVs within %1 sec: will give it another try in 120 sec.").arg(
fHVTimeout);
6864 if (i == HV_FUG_MAX_TRY) {
6867 msg = QString(
"Couldn't shut down the Spin Rotator HV, even after a few trials :-( .");
6873 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to 0.");
6885 size =
sizeof(value);
6888 if (fabs(value) < 0.1)
6892 if (t.elapsed() > timeout) {
6895 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6904 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to 12.0 A.");
6916 size =
sizeof(value);
6919 if (fabs(value-12.0) < 0.1)
6923 if (t.elapsed() > timeout) {
6926 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6935 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to -1.3 A.");
6947 size =
sizeof(value);
6950 if (fabs(value+1.3) < 0.1)
6954 if (t.elapsed() > timeout) {
6957 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6966 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set Spin Rot Magnet current to 0 - done.");
6978 size =
sizeof(value);
6981 if (fabs(value) < 0.1)
6985 if (t.elapsed() > timeout) {
6988 msg = QString(
"Couldn't set the Spin Rot Magnet current within %1 sec.").arg(
fFieldTimeout);
6994 if (arc->
param[0] !=
"off") {
6996 int size =
sizeof(enabled);
6998 cm_msg(MDEBUG,
"SetSpinRot",
"SetSpinRot: enabled=%d.", enabled);
7000 if (enabled == FALSE) {
7002 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: enable spin rotator.");
7008 float angle = arc->
param[0].toFloat();
7009 cm_msg(MINFO,
"SetSpinRot",
"SetSpinRot: set spin rotation angle to %f", angle);
7034 float standby, demand_current, measured_current;
7042 msg += QString(
"PLemAutoRun::SetFOM: fom equipment disabled. Will do nothing here.");
7053 msg = QString(
"Autorun running: ") + msg;
7057 size =
sizeof(standby);
7059 if (status != DB_SUCCESS) {
7069 demand_current = arc->
param[0].toFloat();
7071 if (demand_current == 0.0) {
7078 timeout = 300 * 1e3;
7086 size =
sizeof(measured_current);
7094 if (t.elapsed() > timeout) {
7097 msg = QString(
"Current (FOM) was not reached within 300 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand_current).arg(measured_current);
7109 if (standby != 0.0) {
7122 timeout = 300 * 1e3;
7130 size =
sizeof(measured_current);
7138 if (t.elapsed() > timeout) {
7141 msg = QString(
"Current (FOM) was not reached within 300 sec. (demand=%2, measured=%3)").arg(
fFieldTimeout).arg(demand_current).arg(measured_current);
7166 msg += QString(
"PLemAutoRun::SetLEMSetup: setup info ODB entries disabled. Will do nothing here.");
7177 msg = QString(
"Autorun running: ") + msg;
7200 msg += QString(
"PLemAutoRun::SetModInfo: moderator info ODB entries disabled. Will do nothing here.");
7211 msg = QString(
"Autorun running: ") + msg;
7214 fModNameKey->SetData((
void *)arc->
param[0].toLatin1().data(), 1, TID_STRING);
7215 fModDateKey->SetData((
void *)arc->
param[1].toLatin1().data(), 1, TID_STRING);
7233 QString str(arc->
param[2]);
7238 ival = str.toInt(&ok);
7240 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);
7244 if ((ival < 0) || (ival > 255)) {
7245 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);
7251 ival = str.toInt(&ok);
7253 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SBYTE is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7257 if ((ival < -128) || (ival > 127)) {
7258 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SBYTE; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7264 ival = str.toInt(&ok);
7266 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_WORD is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7270 if ((ival < 0) || (ival > 65535)) {
7271 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_WORD; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7277 ival = str.toInt(&ok);
7279 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SHORT is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7283 if ((ival < -32768) || (ival > 32767)) {
7284 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_SHORT; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7290 ival = str.toInt(&ok);
7292 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_DWORD is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7297 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_DWORD; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7303 ival = str.toInt(&ok);
7305 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_INT is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7311 ival = str.toInt(&ok);
7313 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_BOOL is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7317 if ((ival != 1) && (ival != 0)) {
7318 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_BOOL; %1 out of range. See line no %2").arg(str).arg(arc->
lineNo);
7324 fval = str.toFloat(&ok);
7326 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_FLOAT is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7332 dval = str.toDouble(&ok);
7334 QString err = QString(
"PLemAutoRun::CheckOdbType: ODB key type TID_DOUBLE is not compatible with %1. See line no %2").arg(str).arg(arc->
lineNo);
7342 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);
7363 PAutoRunCmdVector::Iterator iter;
7368 if (iter->cmd ==
"setOdbData") {
7371 QString setPath = iter->param[0];
7372 setKey =
new PKey(
fExp, setPath);
7373 if (!setKey->IsValid()) {
7375 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: Couldn't access ODB set key %1 from the ODB_SET_DATA cmd.").arg(iter->param[0]);
7387 if (!iter->param[1].isEmpty()) {
7388 int index = iter->param[1].toInt();
7389 if (index > setKey->GetNumValues()) {
7391 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: ODB_SET_DATA set index '%1' out of range (%2)!").arg(iter->param[1]).arg(setKey->GetNumValues());
7414 if (!iter->param[3].isEmpty()) {
7417 QString readPath = iter->param[3];;
7419 PKey *readKey =
new PKey(
fExp, readPath);
7420 if (!readKey->IsValid()) {
7422 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: Couldn't access ODB read key %1 from the ODB_SET_DATA cmd.").arg(iter->param[3]);
7437 if (!iter->param[4].isEmpty()) {
7438 int index = iter->param[4].toInt();
7439 if (index > readKey->GetNumValues()) {
7441 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: ODB_SET_DATA read index '%1'' out of range (%2)!").arg(index).arg(readKey->GetNumValues());
7470 if (iter->cmd ==
"setOdbDataArray") {
7473 QString setPath = iter->param[0];
7474 setKey =
new PKey(
fExp, setPath);
7475 if (!setKey->IsValid()) {
7477 QString err = QString(
"PLemAutoRun::CheckForOdbSetDataCmds: Couldn't access ODB set key %1 from the ODB_SET_DATA_ARRAY cmd.").arg(iter->param[0]);
7491 for (
int i=1; i<iter->noElements; i++) {
7493 switch (setKey->GetType()) {
7496 if (iter->param[i].length() > 1)
7501 if (iter->param[i].length() > 1)
7506 if (iter->param[i].length() > 1)
7511 iter->param[i].toInt(&ok);
7515 iter->param[i].toInt(&ok);
7519 iter->param[i].toInt(&ok);
7523 iter->param[i].toInt(&ok);
7527 iter->param[i].toInt(&ok);
7531 iter->param[i].toFloat(&ok);
7534 type =
"TID_DOUBLE";
7535 iter->param[i].toDouble(&ok);
7538 type =
"TID_STRING";
7543 QString err = QString(
"CheckForOdbSetDataCmds: Wrong data type of element '%1', should be '%2'").arg(iter->param[i]).arg(type);
7550 if (iter->noElements-1 != setKey->GetNumValues()) {
7552 QString err = QString(
"CheckForOdbSetDataCmds: Wrong number of element '%1', should be '%2'").arg(iter->noElements-1).arg(setKey->GetNumValues());
7583 msg = QString(
"Autorun running: ") + msg;
7588 double tolerance = 0.0;
7599 QString setPath = arc->
param[0];
7601 if (!arc->
param[5].isEmpty())
7602 timeout = arc->
param[5].toInt() * 1000;
7604 if (!arc->
param[6].isEmpty())
7605 tolerance = arc->
param[6].toDouble();
7609 setKey =
new PKey(
fExp, setPath);
7610 if (!setKey->IsValid()) {
7612 QString err = QString(
"PLemAutoRun::SetOdbData: Couldn't access ODB set key %1 from the ODB_SET_DATA cmd.").arg(arc->
param[0]);
7623 switch (setKey->GetType()) {
7632 ival = arc->
param[2].toInt();
7637 fval = arc->
param[2].toFloat();
7642 dval = arc->
param[2].toDouble();
7655 if (!arc->
param[3].isEmpty()) {
7656 QString readPath = arc->
param[3];
7658 readKey =
new PKey(
fExp, readPath);
7659 if (!readKey->IsValid()) {
7661 QString err = QString(
"PLemAutoRun::SetOdbData: Couldn't access ODB read key %1 from the ODB_SET_DATA cmd.").arg(arc->
param[3]);
7677 if (arc->
param[1].isEmpty()) {
7680 setKey->SetData(&ival, 1, setKey->GetType());
7683 setKey->SetData(&fval, 1, setKey->GetType());
7686 setKey->SetData(&dval, 1, setKey->GetType());
7689 strcpy(sval, arc->
param[2].toLatin1().data());
7690 setKey->SetData(sval, 1, setKey->GetType());
7696 setIndex = arc->
param[1].toInt();
7699 setKey->SetDataIndex(&ival, setIndex, setKey->GetType());
7702 setKey->SetDataIndex(&fval, setIndex, setKey->GetType());
7705 setKey->SetDataIndex(&dval, setIndex, setKey->GetType());
7708 strcpy(sval, arc->
param[2].toLatin1().data());
7709 setKey->SetDataIndex(sval, setIndex, setKey->GetType());
7718 if (!arc->
param[4].isEmpty())
7719 readIndex = arc->
param[4].toInt();
7726 double readVal = 0.0;
7731 if (readIndex < 0) {
7732 switch (readKey->GetType()) {
7741 size =
sizeof(ival);
7742 readKey->GetData(&ival, &size, readKey->GetType());
7746 size =
sizeof(fval);
7747 readKey->GetData(&fval, &size, readKey->GetType());
7751 size =
sizeof(dval);
7752 readKey->GetData(&dval, &size, readKey->GetType());
7759 switch (readKey->GetType()) {
7768 size =
sizeof(ival);
7769 readKey->GetDataIndex(&ival, &size, readIndex, readKey->GetType());
7773 size =
sizeof(fval);
7774 readKey->GetDataIndex(&fval, &size, readIndex, readKey->GetType());
7778 size =
sizeof(dval);
7779 readKey->GetDataIndex(&dval, &size, readIndex, readKey->GetType());
7788 if (fabs(setVal-readVal) < tolerance) {
7794 }
while((time.elapsed() < timeout) && !done);
7797 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);
7831 msg = QString(
"Autorun running: ") + msg;
7835 QString setPath = arc->
param[0];
7839 setKey =
new PKey(
fExp, setPath);
7840 if (!setKey->IsValid()) {
7842 QString err = QString(
"PLemAutoRun::SetOdbData: Couldn't access ODB set key %1 from the ODB_SET_DATA cmd.").arg(arc->
param[0]);
7855 data[i-1] = arc->
param[i].toFloat();
7858 setKey->SetData(data, arc->
noElements-1, TID_FLOAT);
7894 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
7903 msg +=
"PLemAutoRun::SetSampleHV: FUG equipment disabled in lemAutoRun. Will do nothing here.";
7914 QString err = QString(
"PLemAutoRun::SetSampleHV: Slowcontrol Frontend NOT running.\n")+
7915 QString(
" Error too severe, will stop.");
7918 QCoreApplication::exit(0);
7927 msg = QString(
"Autorun running: ") + msg;
7933 size =
sizeof(value);
7934 value = arc->
param[0].toFloat() + (-1)*(i%2)*0.001;
7950 size =
sizeof(value);
7960 if (t.elapsed() > timeout) {
7963 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);
7979 if (i == HV_FUG_MAX_TRY) {
7982 msg = QString(
"Couldn't set Sample HV of %1 (kV), even after a few trials :-( .").arg(demand);
8011 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8020 msg +=
"PLemAutoRun::SetRA_HV: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8031 QString err = QString(
"PLemAutoRun::SetRA_HV: Slowcontrol Frontend NOT running.\n")+
8032 QString(
" Error too severe, will stop.");
8035 QCoreApplication::exit(0);
8044 msg = QString(
"Autorun running: ") + msg;
8050 size =
sizeof(float);
8051 value[0] = arc->
param[0].toFloat() + (-1)*(i%2)*0.001;
8054 size =
sizeof(float);
8055 value[1] = arc->
param[1].toFloat() + (-1)*(i%2)*0.001;
8059 size =
sizeof(float);
8060 value[2] = arc->
param[2].toFloat() + (-1)*(i%2)*0.001;
8063 size =
sizeof(float);
8064 value[3] = arc->
param[3].toFloat() + (-1)*(i%2)*0.001;
8077 demand[j] = value[j];
8085 size =
sizeof(float);
8088 size =
sizeof(float);
8092 size =
sizeof(float);
8095 size =
sizeof(float);
8117 if (t.elapsed() > timeout) {
8121 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);
8123 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);
8140 if (i == HV_FUG_MAX_TRY) {
8143 msg = QString(
"RA HV of (%1/%2) (kV), was not reached even after several trials :-( ").arg(arc->
param[0]).arg(arc->
param[1]);
8145 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]);
8168 PAutoRunCmdVector::Iterator iter;
8171 if (iter->cmd ==
"setTransportHV") {
8174 QFileInfo fileInfo(filePath);
8175 if (!fileInfo.exists()) {
8176 QString msg = filePath + QString(
" does not exist! Fix that first!");
8181 msg = QString(
"Autorun stopped: Skript failure");
8217 if (!QFile::exists(fln)) {
8218 QString err =
"lemAutoRun: Couldn't find HV setting file: " + fln;
8225 QXmlInputSource source( &xmlFile );
8226 QXmlSimpleReader reader;
8227 reader.setContentHandler( &handler );
8228 reader.parse( source );
8230 QString errMsg =
"";
8231 if (!handler.
isValid(errMsg)) {
8234 QString err =
"lemAutoRun: Couldn't read HV setting file: " + fln;
8243 QVector<int> *hvCh = handler.
GetChNo();
8247 float *pHvDemand = (
float*)malloc(hvDemand->size()*
sizeof(float));
8248 float *pCurrentLimit = (
float*)malloc(currentLimit->size()*
sizeof(float));
8249 float *pHvMeasured = (
float*)malloc(hvDemand->size()*
sizeof(float));
8251 for (
int i=0; i<hvCh->size(); i++) {
8252 pHvDemand[hvCh->at(i)-1] = hvDemand->at(i);
8253 pCurrentLimit[hvCh->at(i)-1] = currentLimit->at(i);
8257 QString path = QString(
"/Equipment/HV/Settings/Current Limit");
8258 PKey currentLimitKey(
fExp, path);
8259 if (!currentLimitKey.IsValid()) {
8260 errMsg =
"**ERROR** couldn't obtain the current limit ODB key";
8264 QString err =
"lemAutoRun: Couldn't read HV setting file: " + fln;
8269 free(pCurrentLimit);
8273 currentLimitKey.SetData(pCurrentLimit, currentLimit->size(), TID_FLOAT);
8276 fHVDemandKey->SetData(pHvDemand, hvDemand->size(), TID_FLOAT);
8281 QVector<int> hv_reached;
8282 hv_reached.resize(hvDemand->size());
8283 for (
int i=0; i<hv_reached.size(); i++)
8294 size = hvDemand->size()*
sizeof(float);
8299 for (
int i=0; i<hvDemand->size(); i++) {
8300 if (fabs(pHvDemand[i]-pHvMeasured[i]) <
fHVAccuracy) {
8303 size += hv_reached[i];
8307 if (size == (
int)hvDemand->size())
8311 if (t.elapsed() > timeout) {
8314 QString msg = QString(
"HV settings could not be reached within %3 sec.").arg(
fHVTimeout);
8324 free(pCurrentLimit);
8346 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8355 msg +=
"PLemAutoRun::SetTransportHV: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8367 msg = QString(
"Autorun running: ") + msg;
8391 msg +=
": FUG disabled in lemAutoRun. Will do nothing here.";
8400 msg +=
"PLemAutoRun::SetHvOff: FUG equipment disabled in lemAutoRun. Will do nothing here.";
8412 msg = QString(
"Autorun running: ") + msg;
8416 float fval[4] = {0.0, 0.0, 0.0, 0.0};
8418 float timeout = 300 * 1e3;
8420 if (arc->
param[0].contains(
"mc", Qt::CaseInsensitive)) {
8422 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down FUG HV's in the Moderator Chamber ...");
8425 fHVDemandKey->SetDataIndex((
void *)&fval[0], i, TID_FLOAT);
8427 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down MCP1 HV in the Moderator Chamber ...");
8437 size =
sizeof(float);
8440 if (fabs(fval[0]) < 0.3) {
8445 if (t.elapsed() > timeout) {
8448 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]);
8452 }
else if (arc->
param[0].contains(
"tc", Qt::CaseInsensitive)) {
8454 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down FUG HV's in the Trigger Chamber ...");
8458 fHVDemandKey->SetDataIndex((
void *)&fval[0], i, TID_FLOAT);
8460 fHVDemandKey->SetDataIndex((
void *)&fval[0], i, TID_FLOAT);
8462 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down TD HV's in the Trigger Chamber ...");
8474 size =
sizeof(float);
8478 if ((fabs(fval[0]) < 0.3) && (fabs(fval[1]) < 0.3) && (fabs(fval[2]) < 0.3) && (fabs(fval[4]) < 0.3)) {
8483 if (t.elapsed() > timeout) {
8486 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]);
8490 }
else if (arc->
param[0].contains(
"sc", Qt::CaseInsensitive)) {
8492 cm_msg(MINFO,
"PLemAutoRun::SetHvOff",
"PLemAutoRun::SetHvOff: shut down FUG HV's in the Trigger Chamber ...");
8495 fHVDemandKey->SetDataIndex((
void *)&fval, i, TID_FLOAT);
8517 PAutoRunCmdVector::Iterator iter;
8518 bool check_needed =
false;
8522 if (iter->cmd ==
"setTemp") {
8523 check_needed =
true;
8535 size =
sizeof(cmode);
8542 QString str = QString(
"/Equipment/SampleCryo/Settings/Devices/Lake340_Sample_0/DD/Zone/Zone");
8544 zoneKey =
new PKey(
fExp, str);
8545 if (!zoneKey->IsValid()) {
8546 QString err = QString(
"sample cryo ZONE settings key not found.");
8553 size =
sizeof(float);
8557 size =
sizeof(zone_str);
8558 float loop, zone, top_value, p_pid, i_pid, d_pid, mount_value, range;
8559 for (
int i=0; i<10; i++) {
8561 zoneKey->GetDataIndex(zone_str, &size, i, TID_STRING);
8563 status = sscanf(zone_str,
"%f,%f,%f,%f,%f,%f,%f,%f", &loop, &zone, &top_value,
8564 &p_pid, &i_pid, &d_pid, &mount_value, &range);
8566 QString err = QString(
"Couldn't extract sample cryo ZONE settings (%1/%2).").arg(status).arg(zone_str);
8570 if (temp < top_value)
8598 if ( Tset < 10.0 ) {
8602 if ( Tset < 20.0 ) {
8611 cm_msg(MINFO,
"NeedleValve",
"NeedleValve: demand = %e", value);
8615 if ( value > 100.0 )
8638 + (rampSpeed / 60.0) *
8647 cm_msg(MINFO,
"EmpircalFlow",
"EmpiricalFlow: demandflow = %e", demandflow);
8671 float rampSpeed=0.0;
8674 if (!rampParam.isEmpty()) {
8675 rampSpeed = rampParam.toFloat();
8687 }
while (t.elapsed() < 60e3);
8718 float deltaT,
float flowScale)
8722 if (rampSpeed == 0.0) {
8723 if (!flowParam.isEmpty()) {
8724 value = flowParam.toFloat();
8733 if (!flowParam.isEmpty()) {
8766 if (flowParam.isEmpty())
8769 float value = flowParam.toFloat();
8848 size =
sizeof(status);
8854 }
while (t.elapsed() < 300e3);
8875 if (rampSpeed == 0.0) {
8877 bool setpoint_readback_failure =
true;
8881 setpoint_readback_failure =
false;
8886 fvalue = setpoint + 1.0e-4 * (float)rand()/(float)RAND_MAX;
8889 }
while (t.elapsed() < 600e3);
8890 if (setpoint_readback_failure) {
8892 QString err = QString(
"setTemp: Couldn't get new setpoint readback value within 10 min!");
8917 bool setpoint_readback_failure =
true;
8921 setpoint_readback_failure =
false;
8926 fvalue = setpoint + 1.0e-4 * (float)rand()/(float)RAND_MAX;
8929 }
while (t.elapsed() < 600e3);
8930 if (setpoint_readback_failure) {
8932 QString err = QString(
"setTempOvenOmega: Couldn't get new setpoint readback value within 10 min!");
8975 msg +=
"PLemAutoRun::SetHvOff: TFL equipment disabled in lemAutoRun. Will do nothing here.";
8982 float tfl_pos = arc->
param[0].toFloat();
8983 float tfl_mode = arc->
param[1].toFloat();
8986 cout << endl <<
"in SetTfl ...";
8992 QString err = QString(
"PLemAutoRun::SetTfl: TFL Slowcontrol Frontend NOT running.\n")+
8993 QString(
" Error too severe, will stop.");
8996 QCoreApplication::exit(0);
9004 msg = QString(
"Autorun running: ") + msg;
9033 float newDemandTemp;
9034 float newDemandFlow = -1.0;
9036 float rampSpeed = 0.0;
9043 msg +=
"PLemAutoRun::SetTemp: sample equipment disabled in lemAutoRun. Will do nothing here.";
9051 cout << endl <<
"in SetTemp ...";
9054 char cryoName[NAME_LENGTH];
9055 size =
sizeof(cryoName);
9057 if (QString(cryoName).startsWith(
"omega", Qt::CaseInsensitive)) {
9075 msg += arc->
param[i];
9076 if (i<arc->noElements-1)
9090 cout << endl <<
"in SetTemp: will check clients ...";
9096 QString err = QString(
"PLemAutoRun::SetTemp: Slowcontrol Frontend NOT running.\n")+
9097 QString(
" Error too severe, will stop.");
9100 QCoreApplication::exit(0);
9107 QString err = QString(
"PLemAutoRun::SetTemp: LakeShore is not remote.\n")+
9108 QString(
" Error too severe, will stop.");
9111 QCoreApplication::exit(0);
9120 msg = QString(
"Autorun running: ") + msg;
9124 cout << endl <<
"in SetTemp: check lemvac and BPVX/Y positions ...";
9130 QString err = QString(
"PLemAutoRun::SetTemp: Lemvac NOT running. Error too severe, will stop.");
9133 QCoreApplication::exit(0);
9140 QString err = QString(
"PLemAutoRun::SetTemp: Couldn't read BPVX/Y. Error too severe, will stop.");
9148 QString err = QString(
"PLemAutoRun::SetTemp: Couldn't close BPVX. Error too severe, will stop.");
9162 cout << endl <<
"in SetTemp: increasing temperature ..." << endl;
9166 cout << endl <<
"in SetTemp: check if it is necessary to shut down the hv's and to close BPVY ...";
9175 cout << endl <<
"in SetTemp: get HV's from the sample region ...";
9180 cout << endl <<
"in SetTemp: shut down the sample HV's ...";
9185 cout << endl <<
"in SetTemp: set demand temperature, ramping, flow ...";
9201 cout << endl <<
"in SetTemp: set the new bronkhorst flow and needle valve ...";
9209 cout << endl <<
"in SetTemp: set the parameters of the LS340 ...";
9233 cout << endl <<
"in SetTemp: check and tweak temperature until stability is reached or timeout happend ...";
9267 if (t.elapsed() > timeout) {
9268 QString err = QString(
"PLemAutoRun::SetTemp: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9280 cout << endl <<
"in SetTemp: if HV is shut down: (i) open BPVY, than (ii) ramp sample HV's back ...";
9289 cout << endl <<
"in SetTemp: decreasing temperature ..." << endl;
9293 cout << endl <<
"in SetTemp: set the parameters of the LS340 ...";
9320 size =
sizeof(value);
9331 if (newDemandTemp > 50.0)
9344 cout << endl <<
"in SetTemp: check and tweak temperature until stability is reached or timeout happend ...";
9370 value = 1.5 * newDemandFlow;
9374 value = 1.2 * newDemandFlow;
9378 value = 1.1 * newDemandFlow;
9382 value = newDemandFlow;
9421 if (t.elapsed() > timeout) {
9422 QString err = QString(
"PLemAutoRun::SetTemp: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9436 cout << endl <<
"in SetTemp: ramping enabled for cooling down or flow explicitly given ...";
9450 size =
sizeof(newDemandFlow);
9459 if ( rampSpeed == 0.0 )
9465 cout << endl <<
"in SetTemp: check and tweak temperature until stability is reached or timeout happend ...";
9474 if (rampSpeed != 0.0) {
9477 value = newDemandTemp /
fSampleInput[LS340_INPUT_SETPOINT] *
9490 cout << endl <<
"in SetTemp: set flow and adjust the needle valve of the transferline ...";
9500 cout << endl <<
"in SetTemp: check if final setpoint is reached ...";
9501 if (fabs(
fSampleInput[LS340_INPUT_SETPOINT] - newDemandTemp) < 0.1) {
9504 cout << endl <<
"in SetTemp: gradually reduce the flow to steady value if flow was not given explicitly ...";
9506 float value2 = 0.3 * rampSpeed;
9511 value2 = 0.2 * rampSpeed;
9516 value2 = 0.1 * rampSpeed;
9533 cout << endl <<
"in SetTemp: check temperature stability and feed history buffer ...";
9539 cout << endl <<
"in SetTemp: see if a flow tweaking is needed ...";
9550 if (t.elapsed() > timeout) {
9551 QString err = QString(
"PLemAutoRun::SetTemp: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9566 cout << endl <<
"in SetTemp: only open the BPVX when it initially was open ...";
9571 QString err = QString(
"PLemAutoRun::SetTemp: Couldn't open BPVX. Error too severe, will stop.");
9593 float newDemandTemp;
9594 float rampSpeed = 0.0;
9601 msg +=
"PLemAutoRun::SetTempOvenOmega: omega equipment disabled in lemAutoRun. Will do nothing here.";
9615 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Slowcontrol Frontend (Omega SC) NOT running. Error too severe, will stop.");
9618 QCoreApplication::exit(0);
9627 msg = QString(
"Autorun running: ") + msg;
9631 cout << endl <<
"in SetTempOvenOmega: check lemvac and BPVX/Y positions ...";
9637 QString err = QString(
"PLemAutoRun::SetTemp: Lemvac NOT running. Error too severe, will stop.");
9640 QCoreApplication::exit(0);
9647 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Couldn't read BPVX/Y. Error too severe, will stop.");
9655 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Couldn't close BPVX. Error too severe, will stop.");
9669 cout << endl <<
"in SetTempOvenOmega: increasing temperature ..." << endl;
9679 cout << endl <<
"in SetTempOvenOmega: get HV's from the sample region ...";
9684 cout << endl <<
"in SetTempOvenOmega: shut down the sample HV's ...";
9689 cout << endl <<
"in SetTempOvenOmega: set demand temperature, ramping, flow ...";
9696 cout << endl <<
"in SetTempOvenOmega: set the parameters of the LS340 ...";
9708 cout << endl <<
"in SetTempOvenOmega: check and tweak temperature until stability is reached or timeout happend ...";
9711 int stabilityCounter = 0;
9720 if (t.elapsed() > timeout) {
9721 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9729 if (stabilityCounter == 60)
9732 stabilityCounter = 0;
9738 cout << endl <<
"in SetTempOvenOmega: if HV is shut down: ramp sample HV's back ...";
9745 cout << endl <<
"in SetTempOvenOmega: decreasing temperature ..." << endl;
9749 cout << endl <<
"in SetTempOvenOmega: set the parameters of the Omega ...";
9765 cout << endl <<
"in SetTempOvenOmega: check the temperature until stability is reached or timeout happend ...";
9768 int stabilityCounter = 0;
9777 if (t.elapsed() > timeout) {
9778 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: couldn't reach temperature %1 (K), ").arg(newDemandTemp) +
9786 if (stabilityCounter == 60)
9789 stabilityCounter = 0;
9797 cout << endl <<
"in SetTempOvenOmega: only open the BPVX when it initially was open ...";
9802 QString err = QString(
"PLemAutoRun::SetTempOvenOmega: Couldn't open BPVX. Error too severe, will stop.");
9844 if (!
fEnabled[
"sample_name_info_odb"] || !
fEnabled[
"sample_cryo_info_odb"]) {
9846 msg +=
"PLemAutoRun::SetTitle: not all necessary ODB settings are enabled in lemAutoRun. Will do nothing here.";
9853 msg= QString(
"%1").arg(arc->
param[0]);
9856 if (arc->
param[1] ==
"true") {
9861 msg.replace(
"ODB_SAMPLE", str);
9863 if (arc->
param[2] ==
"true") {
9865 char cryoName[NAME_LENGTH];
9866 size =
sizeof(cryoName);
9870 if (QString(cryoName).startsWith(
"omega", Qt::CaseInsensitive)) {
9871 size =
sizeof(fvalue);
9874 dvalue = fvalue + 273.16;
9877 size =
sizeof(fvalue);
9883 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9884 msg.replace(
"ODB_TEMP", QString(
"%1").arg(valueStr));
9887 if (arc->
param[3] ==
"true") {
9890 size =
sizeof(float);
9898 msg.replace(
"ODB_FIELD", QString(
"%1").arg(valueStr));
9904 msg.replace(
"ODB_FIELD", QString(
"%1").arg(valueStr));
9907 msg.replace(
"ODB_FIELD",
"??(G)/??(A)");
9910 if (arc->
param[4] ==
"true") {
9912 size =
sizeof(fvalue);
9916 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9917 msg.replace(
"ODB_TRANSP", QString(
"%1").arg(valueStr));
9920 size =
sizeof(fvalue);
9924 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9925 msg.replace(
"ODB_TRANSP", QString(
"%1").arg(valueStr));
9929 if (arc->
param[5] ==
"true") {
9931 size =
sizeof(fvalue);
9935 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9936 msg.replace(
"ODB_HV_SAMP", QString(
"%1").arg(valueStr));
9939 size =
sizeof(fvalue);
9943 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9944 msg.replace(
"ODB_HV_SAMP", QString(
"%1").arg(valueStr));
9948 if (arc->
param[6] ==
"true") {
9951 float hv_mod, hv_samp, energy_loss;
9953 size =
sizeof(hv_mod);
9956 size =
sizeof(hv_samp);
9961 dvalue = hv_mod - energy_loss - hv_samp;
9962 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9963 msg.replace(
"ODB_ENERGY", QString(
"%1").arg(valueStr));
9967 float hv_mod, hv_samp, energy_loss;
9969 size =
sizeof(hv_mod);
9972 size =
sizeof(hv_samp);
9977 dvalue = hv_mod - energy_loss - hv_samp;
9978 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9979 msg.replace(
"ODB_ENERGY", QString(
"%1").arg(valueStr));
9983 if (arc->
param[7] ==
"true") {
9994 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
9995 msg.replace(
"ODB_RA_DIFF_LR", QString(
"%1").arg(valueStr));
10001 size =
sizeof(ral);
10004 size =
sizeof(rar);
10007 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10008 msg.replace(
"ODB_RA_DIFF_LR", QString(
"%1").arg(valueStr));
10012 if (arc->
param[8] ==
"true") {
10017 size =
sizeof(rat);
10020 size =
sizeof(rab);
10023 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10024 msg.replace(
"ODB_RA_DIFF_TB", QString(
"%1").arg(valueStr));
10030 size =
sizeof(rat);
10033 size =
sizeof(rab);
10036 valueStr = QString(
"%1").arg(dvalue, 0,
'f', 2);
10037 msg.replace(
"ODB_RA_DIFF_TB", QString(
"%1").arg(valueStr));
10041 if (arc->
param[9] ==
"true") {
10046 int size =
sizeof(srEnabled);
10048 size =
sizeof(srAngle);
10050 if (srEnabled == FALSE) {
10051 msg.replace(
"ODB_SPIN_ROT",
"disabled");
10053 valueStr = QString(
"%1").arg(srAngle, 0,
'f', 2);
10054 msg.replace(
"ODB_SPIN_ROT", valueStr);
10065 fRunCommentKey->SetData((
void *)msg.toLatin1().data(), 1, TID_STRING);
10071 msg = QString(
"Autorun running: ") + msg;
10088 int idx=-1, status=0, size;
10095 QString subStr(
"??");
10102 if (key->IsValid()) {
10104 cm_msg(MINFO,
"HandleOdbTitleTags",
"HandleOdbTitleTags: %s: idx=%d >= number of entries=%d, will ignore it.",
10107 }
else if ((key->GetType() != TID_BYTE) &&
10108 (key->GetType() != TID_SBYTE) &&
10109 (key->GetType() != TID_CHAR) &&
10110 (key->GetType() != TID_WORD) &&
10111 (key->GetType() != TID_SHORT) &&
10112 (key->GetType() != TID_DWORD) &&
10113 (key->GetType() != TID_INT) &&
10114 (key->GetType() != TID_BOOL) &&
10115 (key->GetType() != TID_FLOAT) &&
10116 (key->GetType() != TID_DOUBLE) &&
10117 (key->GetType() != TID_STRING)) {
10118 cm_msg(MINFO,
"HandleOdbTitleTags",
"HandleOdbTitleTags: %s: wrong data type (%d), will ignore it.",
10119 fOdbTagVector->at(i).odb_path.toLatin1().data(), key->GetType());
10123 switch (key->GetType()) {
10125 size =
sizeof(char);
10126 status = key->GetDataIndex(&bval, &size,
fOdbTagVector->at(i).idx, TID_BYTE);
10127 subStr = QString(
"%1").arg(bval);
10130 size =
sizeof(char);
10131 status = key->GetDataIndex(&bval, &size,
fOdbTagVector->at(i).idx, TID_SBYTE);
10132 subStr = QString(
"%1").arg(bval);
10135 size =
sizeof(char);
10136 status = key->GetDataIndex(&bval, &size,
fOdbTagVector->at(i).idx, TID_CHAR);
10137 subStr = QString(
"%1").arg(bval);
10140 size = 2*
sizeof(char);
10141 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_WORD);
10142 subStr = QString(
"%1").arg(ival);
10145 size =
sizeof(int);
10146 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_SHORT);
10147 subStr = QString(
"%1").arg(ival);
10150 size =
sizeof(int);
10151 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_DWORD);
10152 subStr = QString(
"%1").arg(ival);
10155 size =
sizeof(int);
10156 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_INT);
10157 subStr = QString(
"%1").arg(ival);
10160 size =
sizeof(int);
10161 status = key->GetDataIndex(&ival, &size,
fOdbTagVector->at(i).idx, TID_BOOL);
10162 subStr = QString(
"%1").arg(ival);
10165 size =
sizeof(float);
10166 status = key->GetDataIndex(&fval, &size,
fOdbTagVector->at(i).idx, TID_FLOAT);
10167 subStr = QString(
"%1").arg(fval);
10170 size =
sizeof(double);
10171 status = key->GetDataIndex(&dval, &size,
fOdbTagVector->at(i).idx, TID_DOUBLE);
10172 subStr = QString(
"%1").arg(dval);
10175 size = key->GetItemSize()*
sizeof(float);
10177 status = key->GetDataIndex(&str, &size,
fOdbTagVector->at(i).idx, TID_STRING);
10186 if (status == DB_SUCCESS) {
10190 switch (key->GetType()) {
10192 size =
sizeof(char);
10193 status = key->GetData(&bval, &size, TID_BYTE);
10194 subStr = QString(
"%1").arg(bval);
10197 size =
sizeof(char);
10198 status = key->GetData(&bval, &size, TID_SBYTE);
10199 subStr = QString(
"%1").arg(bval);
10202 size =
sizeof(char);
10203 status = key->GetData(&bval, &size, TID_CHAR);
10204 subStr = QString(
"%1").arg(bval);
10207 size = 2*
sizeof(char);
10208 status = key->GetData(&ival, &size, TID_WORD);
10209 subStr = QString(
"%1").arg(ival);
10212 size =
sizeof(int);
10213 status = key->GetData(&ival, &size, TID_SHORT);
10214 subStr = QString(
"%1").arg(ival);
10217 size =
sizeof(int);
10218 status = key->GetData(&ival, &size, TID_DWORD);
10219 subStr = QString(
"%1").arg(ival);
10222 size =
sizeof(int);
10223 status = key->GetData(&ival, &size, TID_INT);
10224 subStr = QString(
"%1").arg(ival);
10227 size =
sizeof(int);
10228 status = key->GetData(&ival, &size, TID_BOOL);
10229 subStr = QString(
"%1").arg(ival);
10232 size =
sizeof(float);
10233 status = key->GetData(&fval, &size, TID_FLOAT);
10234 subStr = QString(
"%1").arg(fval);
10237 size =
sizeof(double);
10238 status = key->GetData(&dval, &size, TID_DOUBLE);
10239 subStr = QString(
"%1").arg(dval);
10242 size = key->GetItemSize()*
sizeof(char);
10244 status = key->GetData(&str, &size, TID_STRING);
10253 if (status == DB_SUCCESS) {
10264 subStr = QString(
"??");
10285 msg +=
"PLemAutoRun::SetTof: TOF ODB entires disabled in lemAutoRun. Will do nothing here.";
10297 msg = QString(
"Autorun running: ") + msg;
10301 value = arc->
param[0].toFloat();
10302 fTofMinKey->SetData((
void *)&value, 1, TID_FLOAT);
10304 value = arc->
param[1].toFloat();
10305 fTofMaxKey->SetData((
void *)&value, 1, TID_FLOAT);
10325 msg = QString(
"Autorun running: ") + msg;
10328 int wait = arc->
param[0].toInt();
10330 for (
int i=0; i<wait; i++) {
10333 if ( ((i+1) % 5) == 0 ) {
10377 PAutoRunCmdVector::Iterator iter;
10378 int yy, MM, dd, hh, mm, ss;
10383 if (iter->cmd ==
"warmUp") {
10385 sscanf(iter->param[0].toLatin1().data(),
"%d-%d-%d", &yy, &MM, &dd);
10386 d = QDate(yy, MM, dd);
10388 sscanf(iter->param[1].toLatin1().data(),
"%d:%d:%d", &hh, &mm, &ss);
10389 t = QTime(hh, mm, ss);
10391 if (iter->param[2] ==
"1")
10419 msg +=
"PLemAutoRun::WarmUp: sample equipment disabled in lemAutoRun. Will do nothing here.";
10427 msg = QString(
"PLemAutoRun::WarmUp(): warm up procedure starts. Will stop any pending runs, shutdown HV's, ...");
10437 if (status != CM_SUCCESS) {
10438 err = QString(
"PLemAutoRun::RunStart: Cannot stop the run.");
10442 err = QString(
"Autorun running: run stopped.");
10449 msg = QString(
"PLemAutoRun::WarmUp(): close KV61 and KV62");
10459 msg = QString(
"PLemAutoRun::WarmUp(): switch off all the FUG HV's");
10467 value = 0.0 + j*0.001;
10470 fHVDemandKey->SetData((
void *)&hv, HV_FUG_CHS, TID_FLOAT);
10490 if (fabs(value) < 0.5) {
10496 if (t.elapsed() > 3e5) {
10498 err = QString(
"PLemAutoRun::WarmUp(): Couldn't shut down HV's. Will give it another try in 120 sec.");
10514 if (j == HV_FUG_MAX_TRY) {
10515 err = QString(
"PLemAutoRun::WarmUp(): Couldn't shut down sample region HV's. Error too severe, will stop.");
10521 msg = QString(
"PLemAutoRun::WarmUp(): disable potentially set RA pulsing.");
10524 PKey *enable_RA_pulsing =
new PKey(
fExp,
"/Equipment/Trigger/Settings/Enable_OnOff_Mode");
10525 if (!enable_RA_pulsing->IsValid()) {
10526 err = QString(
"PLemAutoRun::WarmUp(): Couldn't get the Enable_OnOff_Mode key for the RA pulsing. Please check instantly! Error too severe, will stop.");
10530 enable_RA_pulsing->SetData((
void*)&ival, 1,TID_BOOL);
10531 if (enable_RA_pulsing) {
10532 delete enable_RA_pulsing;
10533 enable_RA_pulsing = 0;
10537 msg = QString(
"PLemAutoRun::WarmUp(): close BPVX/Y");
10542 QString err = QString(
"PLemAutoRun::WarmUp(): Couldn't close BPVX. Error too severe, will stop.");
10548 QString err = QString(
"PLemAutoRun::WarmUp(): Couldn't close BPVY. Error too severe, will stop.");
10553 msg = QString(
"PLemAutoRun::WarmUp(): sample He flow set to minimum value");
10559 msg = QString(
"PLemAutoRun::WarmUp(): set demand temperature ramping to zero");
10570 }
while (t.elapsed() < 60e3);
10573 msg = QString(
"PLemAutoRun::WarmUp(): set sample cryo temperature to 300K");
10583 size =
sizeof(value);
10587 msg = QString(
"PLemAutoRun::WarmUp(): vent the sample chamber.");
10596 if (value > 250.0) {
10599 msg = QString(
"PLemAutoRun::WarmUp(): sample He flow set to zero");
10623 if (gotoLine <= max) {
10625 if (loopIter->cmd ==
"comment") {
10632 if (pos == gotoLine) {
10635 cm_msg(MINFO,
"ExecAutoRun",
"ExecAutoRun: will goto line %d", gotoLine);
10637 msg = QString(
"will go to line %1").arg(gotoLine);
10643 cm_msg(MERROR,
"ExecAutoRun",
"ExecAutoRun: goto line %d > max. line number (%d). Doesn't make sense. Will ignore it!", gotoLine, max);
10645 msg = QString(
"line number %1 > max. line number (%2). Doesn't make sense. Will ignore it.").arg(gotoLine).arg(max);
10667 size =
sizeof(demands);
10668 status =
fHVDemandKey->GetData(&demands, &size, TID_FLOAT);
10669 if (status != DB_SUCCESS) {
10671 QString err = QString(
"PLemAutoRun::GetDemandHVSampleChamber: Couldn't get demand HV's. Error too severe, will stop.");
10675 for (
int i=0; i<5; i++)
10687 int i, j, ok, size;
10703 msg = QString(
"ramp sample region HV's down.");
10710 value = 0.0 + j*0.001;
10711 for (i=0; i<5; i++)
10726 size =
sizeof(measured);
10731 for (i=0; i<5; i++) {
10738 if ((fabs(value) < 0.1) || (hv_down == 5)) {
10744 if (t.elapsed() > 3e5) {
10746 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't shut down sample region HV's. Will give it another try in 120 sec.");
10761 if (j == HV_FUG_MAX_TRY) {
10763 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't shut down sample region HV's. Error too severe, will stop.");
10765 for (
int k=0; k<5; k++) {
10767 cm_msg(MERROR,
"lemAutoRun",
"FUG channel %d should be 0.0 but found %f", k+
HV_FUG_RAL, measured[k+
HV_FUG_RAL]);
10775 msg = QString(
"ramp sample region HV's back up.");
10782 for (i=0; i<5; i++) {
10796 size =
sizeof(measured);
10801 for (i=0; i<5; i++) {
10813 if (t.elapsed() > 3e5) {
10815 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't ramp back sample region HV's. Will give it another try in 120 sec.");
10831 if (j == HV_FUG_MAX_TRY) {
10833 err = QString(
"PLemAutoRun::ChangeSampleChamberHV: Couldn't ramp back sample region HV's. Error too severe, will stop.");
10854 msg +=
"PLemAutoRun::SetBPV: lemvac equipment disabled in lemAutoRun. Will do nothing here.";
10865 msg = QString(
"Autorun running: ") + msg;
10870 if (arc->
param[0] ==
"X")
10876 if ((arc->
param[1] ==
"1") || (arc->
param[1] ==
"open"))
10909 size =
sizeof(value);
10940 size =
sizeof(value);
10951 if (t.elapsed() > 6e4) {
10980 size =
sizeof(value);
10986 fExp->FeedMidasWatchdog();
11007 float value, value1, value2, value3, value4, value5, value6;
11008 char LSDateTime[32];
11009 int size4 =
sizeof(value);
11021 for (
int i = 0; i < 10; i++ ) {
11027 stream << LSDateTime <<
"," <<
11034 for(
int i = 0; i < 10; i++ ) stream <<
"," << rv[i];
11053 int count = timeout / 1000;
11055 for (
int i=0; i<count; i++) {
11057 fExp->FeedMidasWatchdog();
11061 if ((timeout % 1000) != 0) {
11062 ss_sleep(timeout % 1000);
11063 fExp->FeedMidasWatchdog();
11083 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.
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 LS340_OUTPUT_PID_D
ODB Offset for D output.
#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.
void setAttribute(const QString key, const QXmlAttributes &qAttr)
PLemAutoRunXMLParser::setAttribute.
#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
#define LAR_MIDAS_CONNECTION_FAILED
MIDAS connection failed error tag.
void UpdateWebPage(PAutoRunCmdVector::Iterator currentIter, int tag, int lineNo=0, QString errMsg="")
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
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 (LS340, BH)
#define TEMP_STABILITY_TIMEOUT
stability timeout parameter tag
float fBHFlowOffset
variable needed to calculate the flow if non is explicitly given (see SetTemp())
#define LAR_FATAL
something unexpected really bad happend
float fHeatCapCof1
heat Capacity of cryo =
QString fSampleNamePath
ODB path to the sample name.
#define LS340_INPUT_CF1
ODB Offset for the cold finger 1 sensor.
#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.
QString GetAutoRunSequence()
PLemAutoRun::GetAutoRunSequence.
void SetTemp(AutoRunCmd *arc)
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
bool fSetupWewEnabled
true if the WEW magnet is in use. This is fed with the WEWL/H power supplies.
#define BPVX_SET
ODB offset for BPVX set cmd (output)
bool fSetupSampleEnabled
true if the sample frontend is enabled (normal operation), otherwise MCP2 setup.
QString fLemvacOutputPath
ODB path to the lemvac output variables.
#define LS340_INPUT_HEATER_MODE
ODB Offset for the heater control mode read back.
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
float fPrefNeedleValveCof_3_1
bool fRunCheckEvents
if true check number of events, otherwise check time
float fBHFlowPHeat0
see SampleTempAdjustFlow()
#define LS340_INPUT_CF2
ODB Offset for the cold finger 2 sensor.
#define BPVX_STATE
ODB offset for BPVX state (input)
double datetime
time as obtained from the LS340
#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
void CheckMidasAlarms(PAutoRunCmdVector::Iterator iter)
void SetTfl(AutoRunCmd *arc)
PLemAutoRun::SetTfl.
#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 LS340_INPUT_PID_D
ODB Offset for the D value of the PID (read back)
#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 LS340 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)
#define LAR_LS340_TEMP_NOT_STABLE
sample temperature is out of the tolerance band
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
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.
PKey * fSampleDatetimeKey
pointer to the ODB key: sample cryo date and time
float fDFlowDp0
calculates d(flow)/dP from d(flow)/dP =
double fSampleHistoTime
time stamp of the current reading in seconds since 1-1-2000
PKey * fHVDetectorMeasuredKey
pointer to the ODB key: HV Detector measured values
PKey * fSampleChannelKey
pointer to the ODB key: sample cryo LS340 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
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
bool characters(const QString &)
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.
void SetSampleLS340ZoneSettings()
#define LS340_OUTPUT_SETPOINT
ODB Offset for the setpoint.
int lineNo
line number from where in the user auto run sequence the command originates
#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 LS340_OUTPUT_RAMP
ODB Offset for the demand temperature ramping.
#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 LS340 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 LS340_INPUT_RAMP
ODB Offset for the demand temperature ramping read back.
~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
bool startElement(const QString &, const QString &, const QString &, const QXmlAttributes &qAttr)
QString fClientsPath
ODB path to the running clients.
#define CRYO_LOWTEMP
LowTemp cryo in use.
QString fSampleSensorTypePath
ODB path to the sample cryo LS340 sensor type assignement.
#define LS340_OUTPUT_HEATER_MODE
ODB Offset for the heater control mode.
bool characters(const QString &)
#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
#define LS340_OUTPUT_PID_P
ODB Offset for P output.
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.
PLemAutoRunXMLParser(PLemAutoRun *lar)
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.
void WaitUntilSampleLS340Ready()
PLemHvSettingsFileParser()
#define LS340_INPUT_HEATER
ODB Offset for the heater read back.
#define TEMP_FLOW
flow parameter tag
#define LS340_OUTPUT_HEATER_RANGE
ODB Offset for the heater range.
float measured_T
measured temperature of the sample
bool CheckOdbType(INT type, AutoRunCmd *arc)
bool fLemvacFeRunning
flag indicating if the lemvac_scfe is running
void SetLS340Setpoint(float setpoint, float rampSpeed)
#define FOM_CURRENT_DEMAND
ODB Index of the FOM current setpoint.
#define DANFYSIK_OUTPUT_CURRENT
ODB Offset for the demand current of the danfysik.
float fFlowFactor
constant used in SampleTempConsiderFlow()
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
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
void SetLS340HeaterRangeAndPIDs(AutoRunCmd *arc)
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
#define LAR_MIDAS_DEVICE_NOT_REMOTE
MIDAS device not remote error tag.
void UpdateStatusMsg(const QString statusMsg)
void SetTof(AutoRunCmd *arc)
void SetIgnoreAlarms(AutoRunCmd *arc)
bool endElement(const QString &, const QString &, const QString &)
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.
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 LS340 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 LS340_CTRL_ZONE
LS340 in table driven PID mode.
#define BPV_STATE_CLOSED
BPVX/Y closed.
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)
#define LS340_OUTPUT_PID_I
ODB Offset for I output.
bool fRunStopped
flag telling if a run is stopped
void DegaussWEW(AutoRunCmd *arc)
QDateTime fWarmUpDateTime
when the warmup shall take place
#define LS340_OUTPUT_REMOTE
ODB Offset for the remote output flag.
void SetFlowTweak(float flow)
PKey * fTriggerEventsKey
pointer to the ODB key: trigger event
#define LS340_INPUT_HEATER_RANGE
ODB Offset for the heater range read back.
PKey * fSampleInputKey
pointer to the ODB key: sample cryo input values
bool startElement(const QString &, const QString &, const QString &, const QXmlAttributes &)
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.
QTime fRunStarted
time stamp, when a run started
QString fHVDemandPath
ODB path to the FUG HV demand variables.
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
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 characters(const QString &)
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
float EmpiricalFlow(float Tset, float rampSpeed)
QString fSampleInputPath
ODB path to the sample cryo (LS340, bronkhorst) input variables.
#define WEWH_INPUT_STATUS
ODB Offset for the WEWH status.
int GetRunState()
PLemAutoRun::GetRunState.
PKey * fSampleNameKey
pointer to the ODB key: Sample Name
#define RUN_STOPPED
MIDAS run stopped tag.
#define LAR_OUT_OF_MEMORY
out of memory error tag
#define FOM_CURRENT_MEASURED
ODB Index of the FOM current reading.
#define HV_FUG_MIRROR
ODB Offset for the FUG HV of the mirror.
QString fSampleOutputPath
ODB path to the sample cryo (LS340, bronkhorst) output variables.
#define LS340_INPUT_SETPOINT
ODB Offset for the setpoint read back.
PKey * fSampleOutputKey
pointer to the ODB key: sample cryo output values
PKey * fHVMeasuredKey
pointer to the ODB key: FUG HV measured values
QString fSampleNoConnectionPath
ODB path to the sample cryo (LS340, bronkhorst) DD 'no connection' flag.
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.
QString fHVDetectorMeasuredPath
ODB path to the HV Detectors measured variables.
int GetGotoLine()
PLemAutoRun::GetGotoLine.
#define LS340_CTRL_PID
LS340 in manual PID mode.
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
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
void SetLS340Mode(AutoRunCmd *arc)
bool endElement(const QString &, const QString &, const QString &)
bool endElement(const QString &, const QString &, const QString &)
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
PKey * fSampleRawVoltageKey[10]
pointer to the ODB key: sample cryo raw voltage
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
void TdHvTripFlagChanged(HNDLE, HNDLE, void *)
PKey * fHVCurrentKey
pointer to the ODB key: FUG HV measured current values
PLemSampleCryoXMLParser(PLemAutoRun *lar)
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
QString fSampleDatetimePath
ODB path to the sample cryo (LS340, bronkhorst) DD date and time variable.
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_LS340_INPUT_NONSENSE
sample lakshore readback doesn't make any sense
#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
#define LS340_INPUT_PRESSURE
ODB Offset for the He pressure before the bronkhorst.
#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
int fRunNoEventsNeeded
number of events needed to complete a run
bool startElement(const QString &, const QString &, const QString &, const QXmlAttributes &)
QString fSetupSampleEnabledPath
ODB path to the sample enabled flag.
QString cmdString
untouched original lar-cmd string
QString fSampleRawVoltagePath
ODB path to the LS340 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 LS340 control channel
#define HTML_LOAD
html load tag