17 #include "bus/tcpip.h"
18 #include "class/generic.h"
23 #define BL_CHANNELS 40
24 #define BL_TOLERANCE 0.01
25 #define BL_CHECK_MAX_COUNT 5
95 INT
poll_event(INT source[], INT count, BOOL test) {
return 1;};
109 cm_msg(MINFO,
"bl_check_info",
"Checking of beamline devices disabled.");
114 cm_msg(MINFO,
"bl_check_info",
"Checking of beamline devices enabled.");
117 cm_msg(MINFO,
"bl_check_info",
"Automatic switch-on of beamline devices enabled.");
120 cm_msg(MINFO,
"bl_check_info",
"Automatic switch-on of beamline devices disabled.");
124 cm_msg(MINFO,
"bl_check_info",
"Checking beamline device %s", beamline_settings.
names[i]);
144 char alarm_message[128];
154 bl_deviation = fabs(beamline_event.
demand[i] - beamline_event.
measured[i]);
155 if (beamline_event.
demand[i] != 0.0){
166 sprintf(alarm_message,
"Problem with beamline device %s: Demand = %8f, Measured = %8.4f",
168 al_trigger_alarm(
"bl_check_devices", alarm_message,
169 "Warning",
"BeamLine Magnets have to be checked!", AT_INTERNAL);
170 if ((i<18 || i == 30) && beamline_monitoring.
bl_checking==2) {
171 sprintf(cmd,
"caput %s:COM:1 1", beamline_settings.
names[i]);
172 status = system(cmd);
173 cm_msg(MINFO,
"bl_check_devices",
"Try to turn on magnet device: cmd = %s",cmd);
193 cm_deregister_transition(TR_START);
194 cm_deregister_transition(TR_STOP);
195 cm_deregister_transition(TR_PAUSE);
196 cm_deregister_transition(TR_RESUME);
198 cm_get_experiment_database(&hDB, NULL);
202 db_find_key(hDB, 0,
"/Equipment/Beamline/Settings", &hKey);
204 if (db_get_record(hDB, hKey, &beamline_settings, &size, 0) != DB_SUCCESS){
205 cm_msg(MERROR,
"beamline_frontend_init",
"Cannot get \"/Equipment/Beamline/Settings\" record in ODB");
211 db_find_key(hDB, 0,
"/Equipment/Beamline/Monitoring", &hKey);
213 if (db_open_record(hDB, hKey, &beamline_monitoring,
sizeof(beamline_monitoring),
215 cm_msg(MERROR,
"beamline_frontend_init",
"Cannot get \"/Equipment/Beamline/Monitoring\" record in ODB");
220 db_find_key(hDB, 0,
"/Equipment/Beamline/Variables", &hKey);
222 if (db_open_record(hDB, hKey, &beamline_event,
sizeof(beamline_event),
224 cm_msg(MERROR,
"beamline_frontend_init",
"Cannot open \"/Equipment/Beamline/Variables\" record in ODB");
232 cm_msg(MINFO,
"beamline_frontend_init",
"Checking of beamline devices enabled.");
234 cm_msg(MINFO,
"beamline_frontend_init",
"Checking of beamline devices disabled.");
238 cm_msg(MINFO,
"beamline_frontend_init",
"Automatic switch-on of beamline devices enabled.");
240 cm_msg(MINFO,
"bl_check_info",
"Automatic switch-on of beamline devices disabled.");
void bl_check_info(INT hDB, INT hKey, void *dummy)
#define BL_CHANNELS
number for muE4 beamline epics channels
INT interrupt_configure(INT cmd, INT source, PTYPE adr)
#define BL_CHECK_MAX_COUNT
char * frontend_name
experiment specific ODB structures
INT max_event_size_frag
maximum event size for fragmented events (EQ_FRAGMENTED)
void bl_check_devices(INT hDB, INT hKey, void *dummy)
INT end_of_run(INT run_number, char *error)
#define BL_TOLERANCE
when checking devices allow 1% difference between Demand/Measured values
INT bl_check_counter[BL_CHANNELS]
counter needed in the beamline check
BEAMLINE_EVENT beamline_event
for slow control parameters
INT lem_epics(INT cmd,...)
BOOL frontend_call_loop
frontend_loop is called periodically if this variable is TRUE
INT max_event_size
maximum event size produced by this frontend
INT pause_run(INT run_number, char *error)
BEAMLINE_SETTINGS beamline_settings
INT event_buffer_size
buffer size to hold events
DEVICE_DRIVER bl_driver[]
device driver list
char * frontend_file_name
The frontend file name, don't change it.
INT poll_event(INT source, INT count, BOOL test)
INT begin_of_run(INT run_number, char *error)
BEAMLINE_MONITORING beamline_monitoring
INT display_period
a frontend status page is displayed with this frequency in ms
INT resume_run(INT run_number, char *error)
INT bl_channel_checking[40]