19 #include "bus/tcpip.h"
20 #include "class/generic.h"
24 #define BL_CHANNELS 40
25 #define BL_TOLERANCE 0.01
26 #define BL_CHECK_MAX_COUNT 5
106 INT
poll_event(INT source, INT count, BOOL test) {
return 1;};
120 cm_msg(MINFO,
"bl_check_info",
"Checking of beamline devices disabled.");
125 cm_msg(MINFO,
"bl_check_info",
"Checking of beamline devices enabled.");
128 cm_msg(MINFO,
"bl_check_info",
"Automatic switch-on of beamline devices enabled.");
131 cm_msg(MINFO,
"bl_check_info",
"Automatic switch-on of beamline devices disabled.");
135 cm_msg(MINFO,
"bl_check_info",
"Checking beamline device %s", beamline_settings.
names[i]);
155 char alarm_message[128];
165 bl_deviation = fabs(beamline_event.
demand[i] - beamline_event.
measured[i]);
166 if (beamline_event.
demand[i] != 0.0){
177 sprintf(alarm_message,
"Problem with beamline device %s: Demand = %8f, Measured = %8.4f",
179 al_trigger_alarm(
"bl_check_devices", alarm_message,
180 "Warning",
"BeamLine Magnets have to be checked!", AT_INTERNAL);
181 if ((i<18 || i == 30) && beamline_monitoring.
bl_checking==2) {
182 sprintf(cmd,
"caput %s:COM:1 1", beamline_settings.
names[i]);
183 status = system(cmd);
184 cm_msg(MINFO,
"bl_check_devices",
"Try to turn on magnet device: cmd = %s",cmd);
204 cm_deregister_transition(TR_START);
205 cm_deregister_transition(TR_STOP);
206 cm_deregister_transition(TR_PAUSE);
207 cm_deregister_transition(TR_RESUME);
209 cm_get_experiment_database(&hDB, NULL);
213 db_find_key(hDB, 0,
"/Equipment/Beamline/Settings", &hKey);
215 if (db_get_record(hDB, hKey, &beamline_settings, &size, 0) != DB_SUCCESS){
216 cm_msg(MERROR,
"beamline_frontend_init",
"Cannot get \"/Equipment/Beamline/Settings\" record in ODB");
222 db_find_key(hDB, 0,
"/Equipment/Beamline/Monitoring", &hKey);
224 if (db_open_record(hDB, hKey, &beamline_monitoring,
sizeof(beamline_monitoring),
226 cm_msg(MERROR,
"beamline_frontend_init",
"Cannot get \"/Equipment/Beamline/Monitoring\" record in ODB");
231 db_find_key(hDB, 0,
"/Equipment/Beamline/Variables", &hKey);
233 if (db_open_record(hDB, hKey, &beamline_event,
sizeof(beamline_event),
235 cm_msg(MERROR,
"beamline_frontend_init",
"Cannot open \"/Equipment/Beamline/Variables\" record in ODB");
243 cm_msg(MINFO,
"beamline_frontend_init",
"Checking of beamline devices enabled.");
245 cm_msg(MINFO,
"beamline_frontend_init",
"Checking of beamline devices disabled.");
249 cm_msg(MINFO,
"beamline_frontend_init",
"Automatic switch-on of beamline devices enabled.");
251 cm_msg(MINFO,
"bl_check_info",
"Automatic switch-on of beamline devices disabled.");
const char * frontend_name
< created by ODBedit, command "make"
INT max_event_size
maximum event size produced by this frontend
DEVICE_DRIVER bl_driver[]
device driver list
BOOL frontend_call_loop
frontend_loop is called periodically if this variable is TRUE
INT bl_check_counter[BL_CHANNELS]
counter needed in the beamline check
INT display_period
a frontend status page is displayed with this frequency in ms
BEAMLINE_MONITORING beamline_monitoring
INT event_buffer_size
buffer size to hold events
#define BL_CHANNELS
number for muE4 beamline epics channels
void bl_check_devices(INT hDB, INT hKey, void *dummy)
BEAMLINE_SETTINGS beamline_settings
INT lem_epics(INT cmd,...)
INT begin_of_run(INT run_number, char *error)
INT interrupt_configure(INT cmd, INT source, PTYPE adr)
INT resume_run(INT run_number, char *error)
INT max_event_size_frag
maximum event size for fragmented events (EQ_FRAGMENTED)
#define BL_TOLERANCE
when checking devices allow 1% difference between Demand/Measured values
BEAMLINE_EVENT beamline_event
for slow control parameters
BOOL equipment_common_overwrite
INT end_of_run(INT run_number, char *error)
INT32 bl_channel_checking[40]
#define BL_CHECK_MAX_COUNT
INT poll_event(INT source, INT count, BOOL test)
INT pause_run(INT run_number, char *error)
const char * frontend_file_name
The frontend file name, don't change it.
void bl_check_info(INT hDB, INT hKey, void *dummy)