21 #include "hv_scs2001_apd.h"
22 #include "hpx30_107.h"
23 #include "tcpip_rs232.h"
50 #define LEMVAC_GAS_INLET_ON 0x80
51 #define LEMVAC_MC_STATUS_WORD_2 15
52 #define LEMVAC_TC_STATUS_WORD_2 18
53 #define LEMVAC_SC_STATUS_WORD_2 21
57 #define MCP2_FIRST_CH 6
58 #define MCP2_LAST_CH 7
62 #define HV_TD_MAX_COUNT 30
64 #define HV_DETECTOR_CHANNELS 94
66 #define HV_DETECTOR_READ_TIME 10
90 {
"TD", hv_nhr, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP | DF_REPORT_STATUS | DF_REPORT_TEMP },
91 {
"MCP", hv_nhr, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP | DF_REPORT_STATUS | DF_REPORT_TEMP },
92 {
"PHVR400_1",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
93 {
"PHVR400_2",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
94 {
"PHVR400_3",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
95 {
"NHVR400_1",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
96 {
"NHVR400_2",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
97 {
"HPP30_107", hpx30_107, 1, tcpip_rs232, DF_PRIO_DEVICE | DF_REPORT_STATUS | DF_REPORT_TEMP },
98 {
"HPN30_107", hpx30_107, 1, tcpip_rs232, DF_PRIO_DEVICE | DF_REPORT_STATUS | DF_REPORT_TEMP },
99 {
"HV_APD", hv_scs2001_apd, 64, null, DF_PRIO_DEVICE | DF_HW_RAMP },
143 INT
poll_event(INT source, INT count, BOOL test) {
return 1;};
173 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
174 status = db_find_key(hDB, 0, str, &hv_hKey);
175 if (status != DB_SUCCESS) {
176 cm_msg(MERROR,
"hv_detectors_scfe_gas_inlet",
"hv_detectors_scfe_gas_inlet: Couldn't find %s", str);
183 db_set_data_index(hDB, hv_hKey, &value,
sizeof(value),
MCP1_CH, TID_FLOAT);
187 if (ival & LEMVAC_GAS_INLET_ON) {
189 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
190 status = db_find_key(hDB, 0, str, &hv_hKey);
191 if (status != DB_SUCCESS) {
192 cm_msg(MERROR,
"hv_detectors_scfe_gas_inlet",
"hv_detectors_scfe_gas_inlet: Couldn't find %s", str);
200 db_set_data_index(hDB, hv_hKey, &value,
sizeof(value), i, TID_FLOAT);
205 if (ival & LEMVAC_GAS_INLET_ON) {
207 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
208 status = db_find_key(hDB, 0, str, &hv_hKey);
209 if (status != DB_SUCCESS) {
210 cm_msg(MERROR,
"hv_detectors_scfe_gas_inlet",
"hv_detectors_scfe_gas_inlet: Couldn't find %s", str);
218 db_set_data_index(hDB, hv_hKey, &value,
sizeof(value), i, TID_FLOAT);
248 al_trigger_alarm(
"hv_detectors_scfe_td_check",
"TD HV's need to be checked!!",
249 "Warning",
"TD HV's need to be checked!!", AT_INTERNAL);
270 cm_deregister_transition(TR_START);
271 cm_deregister_transition(TR_STOP);
272 cm_deregister_transition(TR_PAUSE);
273 cm_deregister_transition(TR_RESUME);
280 cm_get_experiment_database(&hDB, NULL);
286 strcpy(str,
"/Equipment/LEMVAC/Variables/Input");
287 status = db_find_key(hDB, 0, str, &hKey);
288 if (status != DB_SUCCESS) {
289 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
302 strcpy(str,
"/Equipment/HV Detectors/Settings/Names");
303 status = db_find_key(hDB, 0, str, &hKey);
304 if (status != DB_SUCCESS) {
305 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
313 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
314 status = db_find_key(hDB, 0, str, &hKey);
315 if (status != DB_SUCCESS) {
316 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
324 strcpy(str,
"/Equipment/HV Detectors/Variables/Measured");
325 status = db_find_key(hDB, 0, str, &hKey);
326 if (status != DB_SUCCESS) {
327 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
357 cm_get_experiment_database(&hDB, NULL);
360 strcpy(str,
"/Equipment/LEMVAC/Variables/Input");
361 status = db_find_key(hDB, 0, str, &hKey);
362 if (status != DB_SUCCESS) {
363 cm_msg(MERROR,
"frontend_exit",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
366 db_close_record(hDB, hKey);
369 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
370 status = db_find_key(hDB, 0, str, &hKey);
371 if (status != DB_SUCCESS) {
372 cm_msg(MERROR,
"frontend_exit",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
375 db_close_record(hDB, hKey);
378 strcpy(str,
"/Equipment/HV Detectors/Variables/Measured");
379 status = db_find_key(hDB, 0, str, &hKey);
380 if (status != DB_SUCCESS) {
381 cm_msg(MERROR,
"frontend_exit",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
384 db_close_record(hDB, hKey);
403 char name[NAME_LENGTH];
414 size =
sizeof(measured);
423 sprintf(str,
"HV Detector %s: measured = %f, demand = %f, check!!",
425 al_trigger_alarm(
"hv_detectors_scfe", str,
"Warning", str, AT_INTERNAL);
431 else if (offset == -1)
434 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
436 if (status != DB_SUCCESS) {
437 cm_msg(MERROR,
"frontend_loop",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
444 cm_msg(MINFO,
"hv_detectors_scfe",
"hv_detectors_scfe: try to self-reset POS_MCP1_I HV");
447 cm_msg(MINFO,
"hv_detectors_scfe",
"hv_detectors_scfe: try to self-reset POS_MCP1_O HV");
const char * frontend_name
< created by ODBedit, command "make"
float hv_detectors_measured[HV_DETECTOR_CHANNELS]
INT max_event_size
maximum event size produced by this frontend
BOOL frontend_call_loop
frontend_loop is called periodically if this variable is TRUE
INT display_period
a frontend status page is displayed with this frequency in ms
void hv_detectors_scfe_td_check(INT hDB, INT hKey, void *dummy)
INT event_buffer_size
buffer size to hold events
DWORD hv_dectector_timestamp
cyclic timer to check hv's
HNDLE hv_detectors_measured_hKey
INT hv_hvAlreadyOff
HV already switched off.
INT begin_of_run(INT run_number, char *error)
DEVICE_DRIVER hv_driver[]
device driver list
INT interrupt_configure(INT cmd, INT source, PTYPE adr)
INT resume_run(INT run_number, char *error)
int hv_detectors_drop_counter[HV_DETECTOR_CHANNELS]
INT max_event_size_frag
maximum event size for fragmented events (EQ_FRAGMENTED)
#define HV_DETECTOR_READ_TIME
float hv_detectors_demand[HV_DETECTOR_CHANNELS]
INT hv_monitoring_enabled
Monitoring enabled (hotlinked)
float lemvac_in[27]
holds the status info of lemvac input variables
char hv_detectors_names[HV_DETECTOR_CHANNELS *NAME_LENGTH]
BOOL equipment_common_overwrite
INT end_of_run(INT run_number, char *error)
INT poll_event(INT source, INT count, BOOL test)
#define LEMVAC_TC_STATUS_WORD_2
int hv_td_hv_check_counter
counter needed in the TD HV check
#define LEMVAC_GAS_INLET_ON
#define LEMVAC_SC_STATUS_WORD_2
#define HV_DETECTOR_CHANNELS
void hv_detectors_scfe_gas_inlet(INT hDB, INT hKey, void *dummy)
INT pause_run(INT run_number, char *error)
#define LEMVAC_MC_STATUS_WORD_2
const char * frontend_file_name
The frontend file name, don't change it.