19 #include "hv_scs2001_apd.h"
20 #include "hpx30_107.h"
21 #include "tcpip_rs232.h"
48 #define LEMVAC_GAS_INLET_ON 0x80
49 #define LEMVAC_MC_STATUS_WORD_2 15
50 #define LEMVAC_TC_STATUS_WORD_2 18
51 #define LEMVAC_SC_STATUS_WORD_2 21
55 #define MCP2_FIRST_CH 6
56 #define MCP2_LAST_CH 7
60 #define HV_TD_MAX_COUNT 30
62 #define HV_DETECTOR_CHANNELS 94
64 #define HV_DETECTOR_READ_TIME 10
88 {
"TD", hv_nhr, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP | DF_REPORT_STATUS | DF_REPORT_TEMP },
89 {
"MCP", hv_nhr, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP | DF_REPORT_STATUS | DF_REPORT_TEMP },
90 {
"PHVR400_1",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
91 {
"PHVR400_2",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
92 {
"PHVR400_3",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
93 {
"NHVR400_1",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
94 {
"NHVR400_2",
hvr400, 4, null, DF_PRIO_DEVICE | DF_HW_RAMP },
95 {
"HPP30_107", hpx30_107, 1, tcpip_rs232, DF_PRIO_DEVICE },
96 {
"HPN30_107", hpx30_107, 1, tcpip_rs232, DF_PRIO_DEVICE },
97 {
"HV_APD", hv_scs2001_apd, 64, null, DF_PRIO_DEVICE | DF_HW_RAMP },
131 INT
poll_event(INT source[], INT count, BOOL test) {
return 1;};
161 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
162 status = db_find_key(hDB, 0, str, &hv_hKey);
163 if (status != DB_SUCCESS) {
164 cm_msg(MERROR,
"hv_detectors_scfe_gas_inlet",
"hv_detectors_scfe_gas_inlet: Couldn't find %s", str);
171 db_set_data_index(hDB, hv_hKey, &value,
sizeof(value),
MCP1_CH, TID_FLOAT);
175 if (ival & LEMVAC_GAS_INLET_ON) {
177 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
178 status = db_find_key(hDB, 0, str, &hv_hKey);
179 if (status != DB_SUCCESS) {
180 cm_msg(MERROR,
"hv_detectors_scfe_gas_inlet",
"hv_detectors_scfe_gas_inlet: Couldn't find %s", str);
188 db_set_data_index(hDB, hv_hKey, &value,
sizeof(value), i, TID_FLOAT);
193 if (ival & LEMVAC_GAS_INLET_ON) {
195 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
196 status = db_find_key(hDB, 0, str, &hv_hKey);
197 if (status != DB_SUCCESS) {
198 cm_msg(MERROR,
"hv_detectors_scfe_gas_inlet",
"hv_detectors_scfe_gas_inlet: Couldn't find %s", str);
206 db_set_data_index(hDB, hv_hKey, &value,
sizeof(value), i, TID_FLOAT);
236 al_trigger_alarm(
"hv_detectors_scfe_td_check",
"TD HV's need to be checked!!",
237 "Warning",
"TD HV's need to be checked!!", AT_INTERNAL);
258 cm_deregister_transition(TR_START);
259 cm_deregister_transition(TR_STOP);
260 cm_deregister_transition(TR_PAUSE);
261 cm_deregister_transition(TR_RESUME);
268 cm_get_experiment_database(&hDB, NULL);
274 strcpy(str,
"/Equipment/LEMVAC/Variables/Input");
275 status = db_find_key(hDB, 0, str, &hKey);
276 if (status != DB_SUCCESS) {
277 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
290 strcpy(str,
"/Equipment/HV Detectors/Settings/Names");
291 status = db_find_key(hDB, 0, str, &hKey);
292 if (status != DB_SUCCESS) {
293 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
301 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
302 status = db_find_key(hDB, 0, str, &hKey);
303 if (status != DB_SUCCESS) {
304 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
312 strcpy(str,
"/Equipment/HV Detectors/Variables/Measured");
313 status = db_find_key(hDB, 0, str, &hKey);
314 if (status != DB_SUCCESS) {
315 cm_msg(MERROR,
"frontend_init",
"hv_detectors_scfe: Couldn't find %s", str);
345 cm_get_experiment_database(&hDB, NULL);
348 strcpy(str,
"/Equipment/LEMVAC/Variables/Input");
349 status = db_find_key(hDB, 0, str, &hKey);
350 if (status != DB_SUCCESS) {
351 cm_msg(MERROR,
"frontend_exit",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
354 db_close_record(hDB, hKey);
357 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
358 status = db_find_key(hDB, 0, str, &hKey);
359 if (status != DB_SUCCESS) {
360 cm_msg(MERROR,
"frontend_exit",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
363 db_close_record(hDB, hKey);
366 strcpy(str,
"/Equipment/HV Detectors/Variables/Measured");
367 status = db_find_key(hDB, 0, str, &hKey);
368 if (status != DB_SUCCESS) {
369 cm_msg(MERROR,
"frontend_exit",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
372 db_close_record(hDB, hKey);
391 char name[NAME_LENGTH];
402 size =
sizeof(measured);
411 sprintf(str,
"HV Detector %s: measured = %f, demand = %f, check!!",
413 al_trigger_alarm(
"hv_detectors_scfe", str,
"Warning", str, AT_INTERNAL);
419 else if (offset == -1)
422 strcpy(str,
"/Equipment/HV Detectors/Variables/Demand");
424 if (status != DB_SUCCESS) {
425 cm_msg(MERROR,
"frontend_loop",
"hv_detectors_scfe: Couldn't find %s, status=%d", str, status);
432 cm_msg(MINFO,
"hv_detectors_scfe",
"hv_detectors_scfe: try to self-reset POS_MCP1_I HV");
435 cm_msg(MINFO,
"hv_detectors_scfe",
"hv_detectors_scfe: try to self-reset POS_MCP1_O HV");
void hv_detectors_scfe_gas_inlet(INT hDB, INT hKey, void *dummy)
INT interrupt_configure(INT cmd, INT source, PTYPE adr)
#define LEMVAC_GAS_INLET_ON
int hv_detectors_drop_counter[HV_DETECTOR_CHANNELS]
char * frontend_name
experiment specific ODB structures
INT max_event_size_frag
maximum event size for fragmented events (EQ_FRAGMENTED)
INT hv_monitoring_enabled
Monitoring enabled (hotlinked)
DEVICE_DRIVER hv_driver[]
device driver list
void hv_detectors_scfe_td_check(INT hDB, INT hKey, void *dummy)
INT end_of_run(INT run_number, char *error)
int hv_td_hv_check_counter
counter needed in the TD HV check
char hv_detectors_names[HV_DETECTOR_CHANNELS *NAME_LENGTH]
#define LEMVAC_SC_STATUS_WORD_2
BOOL frontend_call_loop
frontend_loop is called periodically if this variable is TRUE
#define LEMVAC_TC_STATUS_WORD_2
INT max_event_size
maximum event size produced by this frontend
INT pause_run(INT run_number, char *error)
INT hv_hvAlreadyOff
HV already switched off.
#define HV_DETECTOR_CHANNELS
float * hv_detectors_measured
hotlink variable holding the measured TD HV's
INT event_buffer_size
buffer size to hold events
char * frontend_file_name
The frontend file name, don't change it.
INT poll_event(INT source, INT count, BOOL test)
float lemvac_in[27]
holds the lemvac input variables
float hv_detectors_demand[HV_DETECTOR_CHANNELS]
HNDLE hv_detectors_measured_hKey
INT begin_of_run(INT run_number, char *error)
#define LEMVAC_MC_STATUS_WORD_2
DWORD hv_dectector_timestamp
cyclic timer to check hv's
INT display_period
a frontend status page is displayed with this frequency in ms
INT resume_run(INT run_number, char *error)
#define HV_DETECTOR_READ_TIME