Low-Energy Muon (LEM) Experiment  0.5.2
hv_fug_scfe.cxx File Reference
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include "midas.h"
#include "mfe.h"
#include "msystem.h"
#include "class/hv.h"
#include "hv_scs3000.h"
#include "bus/null.h"
Include dependency graph for hv_fug_scfe.cxx:

Go to the source code of this file.

Macros

#define LEMVAC_GAS_INLET_ON   0x80
 
#define LEMVAC_MC_STATUS_WORD_2   15
 
#define LEMVAC_TC_STATUS_WORD_2   18
 
#define LEMVAC_SC_STATUS_WORD_2   21
 
#define FUG_CHS   16
 
#define FUG_READ_TIME   10
 
#define FUG_DEMAND_CHANGED_TIMEOUT   300
 
#define FUG_MC   0
 
#define FUG_TC   1
 
#define FUG_SC   2
 
#define TD_FIRST_CH   0
 
#define TD_LAST_CH   3
 
#define FUG_BEAMLINE_KV61_CH   28
 
#define FUG_BEAMLINE_KV62_CH   29
 

Functions

INT poll_event (INT source, INT count, BOOL test)
 
INT interrupt_configure (INT cmd, INT source, POINTER_T adr)
 
void hv_fug_check_trip_level (INT, INT, void *)
 
void hv_fug_trip_rate_source_changed (INT hDB, INT hKey, void *dummy)
 
void hv_fug_scfe_monitoring (INT hDB, INT hKey, void *hv)
 
void hv_fug_scfe_gas_inlet (INT hDB, INT hKey, void *dummy)
 
void hv_fug_demand_changed (INT hDB, INT hKey, void *dummy)
 
INT frontend_init ()
 
INT frontend_exit ()
 
INT frontend_loop ()
 
INT begin_of_run (INT run_number, char *error)
 
INT end_of_run (INT run_number, char *error)
 
INT pause_run (INT run_number, char *error)
 
INT resume_run (INT run_number, char *error)
 

Variables

const char * frontend_name = "FUG"
 The frontend name (client name) as seen by other MIDAS clients. More...
 
const char * frontend_file_name = __FILE__
 The frontend file name, don't change it. More...
 
BOOL frontend_call_loop = TRUE
 frontend_loop is called periodically if this variable is TRUE More...
 
INT display_period = 1000
 a frontend status page is displayed with this frequency in ms More...
 
INT max_event_size = 10000
 maximum event size produced by this frontend More...
 
INT max_event_size_frag = 5*1024*1024
 maximum event size for fragmented events (EQ_FRAGMENTED) More...
 
INT event_buffer_size = 10*10000
 buffer size to hold events More...
 
INT hv_fug_detector_rate
 hotlink variable holding the TD or MCP1 rate More...
 
float * hv_detectors_measured
 hotlink variable holding the measured TD HV's More...
 
HNDLE hv_fug_hDB
 
HNDLE hv_fug_measured_hKey
 
float hv_fug_demand [FUG_CHS]
 
int hv_fug_chamber_flag [FUG_CHS]
 
DWORD hv_fug_demand_changed_timer
 
DWORD hv_fug_check_timestamp
 
int hv_fug_drop_counter [FUG_CHS]
 
int hv_fug_debug = 0
 
INT hv_fug_monitoring_enabled
 hotlink variable holding the monitoring enabled flag More...
 
char hv_fug_trip_rate_source [NAME_LENGTH]
 hotlink variable holding the name of the detector which is to monitor the rate More...
 
INT hv_fug_tripEnabled
 hotlink variable holding the trip enabled flag More...
 
INT hv_fug_tripRate
 hotlink variable holding the TD trip rate More...
 
INT hv_fug_hvAlreadyOff
 HV already switched off. More...
 
float lemvac_in [27]
 holds the lemvac input variables More...
 
const char * hv_fug_monitoring_str
 
DEVICE_DRIVER hv_driver []
 device driver list More...
 
BOOL equipment_common_overwrite = FALSE
 
EQUIPMENT equipment []
 equipment structure for the mfe.c More...
 

Macro Definition Documentation

#define FUG_BEAMLINE_KV61_CH   28

Definition at line 61 of file hv_fug_scfe.cxx.

Referenced by hv_fug_check_trip_level().

#define FUG_BEAMLINE_KV62_CH   29

Definition at line 62 of file hv_fug_scfe.cxx.

Referenced by hv_fug_check_trip_level().

#define FUG_CHS   16
#define FUG_DEMAND_CHANGED_TIMEOUT   300

Definition at line 54 of file hv_fug_scfe.cxx.

Referenced by frontend_loop().

#define FUG_MC   0

Definition at line 55 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and hv_fug_scfe_gas_inlet().

#define FUG_READ_TIME   10

Definition at line 53 of file hv_fug_scfe.cxx.

Referenced by frontend_loop().

#define FUG_SC   2

Definition at line 57 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and hv_fug_scfe_gas_inlet().

#define FUG_TC   1

Definition at line 56 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and hv_fug_scfe_gas_inlet().

#define LEMVAC_GAS_INLET_ON   0x80

Definition at line 47 of file hv_fug_scfe.cxx.

Referenced by hv_fug_scfe_gas_inlet().

#define LEMVAC_MC_STATUS_WORD_2   15

Definition at line 48 of file hv_fug_scfe.cxx.

Referenced by hv_fug_scfe_gas_inlet().

#define LEMVAC_SC_STATUS_WORD_2   21

Definition at line 50 of file hv_fug_scfe.cxx.

Referenced by hv_fug_scfe_gas_inlet().

#define LEMVAC_TC_STATUS_WORD_2   18

Definition at line 49 of file hv_fug_scfe.cxx.

Referenced by hv_fug_scfe_gas_inlet().

#define TD_FIRST_CH   0

Definition at line 59 of file hv_fug_scfe.cxx.

Referenced by hv_fug_scfe_monitoring().

#define TD_LAST_CH   3

Definition at line 60 of file hv_fug_scfe.cxx.

Referenced by hv_fug_scfe_monitoring().

Function Documentation

INT begin_of_run ( INT  run_number,
char *  error 
)

Called by the mfe at the begin of the run. Here it is only a dummy.

Definition at line 873 of file hv_fug_scfe.cxx.

INT end_of_run ( INT  run_number,
char *  error 
)

Called by the mfe at the end of the run. Here it is only a dummy.

Definition at line 883 of file hv_fug_scfe.cxx.

INT frontend_exit ( )

Called by the mfe at exiting stage. Unlinks all the established hotlinks.

Definition at line 706 of file hv_fug_scfe.cxx.

References hDB, hKey, and hv_detectors_measured.

INT frontend_init ( )

Called by the master frontend (mfe) at initializing stage. It hotlinks various variables which are needed for safety reasons. It monitors for example the trigger detector rate. If it is getting too high, depending on the switches, the HV of the transport system is switched off. For further details see the corresponding hotlink dispatcher functions.

Definition at line 507 of file hv_fug_scfe.cxx.

References FUG_CHS, FUG_MC, FUG_SC, FUG_TC, hDB, hKey, hv_detectors_measured, hv_fug_chamber_flag, hv_fug_check_timestamp, hv_fug_demand, hv_fug_demand_changed(), hv_fug_demand_changed_timer, hv_fug_drop_counter, hv_fug_hDB, hv_fug_hvAlreadyOff, hv_fug_measured_hKey, hv_fug_monitoring_enabled, and hv_fug_monitoring_str.

INT frontend_loop ( )

Called by the mfe in the main loop. Here it is only a dummy.

Definition at line 813 of file hv_fug_scfe.cxx.

References FUG_CHS, FUG_DEMAND_CHANGED_TIMEOUT, FUG_READ_TIME, hKey, hv_fug_check_timestamp, hv_fug_debug, hv_fug_demand, hv_fug_demand_changed_timer, hv_fug_drop_counter, hv_fug_hDB, and hv_fug_measured_hKey.

void hv_fug_check_trip_level ( INT  hDB,
INT  hKey,
void *  hv 
)

If enabled (hv_fug_tripEnabled flag), this routine checks that the trigger detector rate is not too high (< hv_fug_tripRate). In case the maximum trigger detector rate is exeeded, the transport high voltage will be switched off.

Parameters
hDBmain ODB handle
hKeynot used
hvpointer to the measured TD rate

Definition at line 257 of file hv_fug_scfe.cxx.

References FUG_BEAMLINE_KV61_CH, FUG_BEAMLINE_KV62_CH, FUG_CHS, hv_fug_detector_rate, hv_fug_trip_rate_source, hv_fug_tripEnabled, and hv_fug_tripRate.

Referenced by hv_fug_trip_rate_source_changed().

void hv_fug_demand_changed ( INT  hDB,
INT  hKey,
void *  dummy 
)

Starts the FUG HV demand changed timer. It is used to suppress demand vs measured checking for a given time.

Parameters
hDBmain ODB handle
hKeyunused handle
dummynot used

Definition at line 493 of file hv_fug_scfe.cxx.

References hv_fug_demand_changed_timer.

Referenced by frontend_init().

void hv_fug_scfe_gas_inlet ( INT  hDB,
INT  hKey,
void *  dummy 
)

This hotlink routine sets the values of the hv demand values of the FUG's in the chambers to zero, if the corresponding gas inlet flag of the vacuum control unit (lemvac) is set.

The purpose is the following: the vacuum control unit is switching the hv power supplies power off if the gas inlet is activated. Hence, if the demand values wouldn't be set to zero, after powering the hv power supplies again, the hv would just ramp back to there set values. This could lead to hv problems and therefore these demand values are set to zero.

Parameters
hDBmain ODB handle
hKeyhandle to the lemvac input
dummynot used

Definition at line 419 of file hv_fug_scfe.cxx.

References FUG_CHS, FUG_MC, FUG_SC, FUG_TC, hv_fug_chamber_flag, LEMVAC_GAS_INLET_ON, lemvac_in, LEMVAC_MC_STATUS_WORD_2, LEMVAC_SC_STATUS_WORD_2, and LEMVAC_TC_STATUS_WORD_2.

void hv_fug_scfe_monitoring ( INT  hDB,
INT  hKey,
void *  hv 
)

If enabled (hv_fug_monitoring_enabled flag), this routine checks whether the trigger high voltage is switched on. If not, it will prevent to set any high voltage to the transport system.

Parameters
hDBmain ODB handle
hKeynot used
hvpointer to the measured TD hv's

Definition at line 353 of file hv_fug_scfe.cxx.

References hv_fug_hvAlreadyOff, hv_fug_monitoring_enabled, TD_FIRST_CH, and TD_LAST_CH.

void hv_fug_trip_rate_source_changed ( INT  hDB,
INT  hKey,
void *  dummy 
)

As a HV trip source, the rates of either MCP1 or the TD can be used. This routine checks which one is the relvant one.

Parameters
hDBhandle to the ODB
hKeyODB key for the HV
dummynot used

Definition at line 171 of file hv_fug_scfe.cxx.

References hv_fug_check_trip_level(), hv_fug_detector_rate, and hv_fug_trip_rate_source.

INT interrupt_configure ( INT  cmd,
INT  source,
POINTER_T  adr 
)

Definition at line 156 of file hv_fug_scfe.cxx.

INT pause_run ( INT  run_number,
char *  error 
)

Called by the mfe when the run is paused. Here it is only a dummy.

Definition at line 893 of file hv_fug_scfe.cxx.

INT poll_event ( INT  source,
INT  count,
BOOL  test 
)

Definition at line 155 of file hv_fug_scfe.cxx.

INT resume_run ( INT  run_number,
char *  error 
)

Called by the mfe when the run is resumed. Here it is only a dummy.

Definition at line 903 of file hv_fug_scfe.cxx.

Variable Documentation

INT display_period = 1000

a frontend status page is displayed with this frequency in ms

Definition at line 34 of file hv_fug_scfe.cxx.

EQUIPMENT equipment[]
Initial value:
= {
{ "HV",
{72, 0,
"SYSTEM",
EQ_SLOW,
0,
"FIXED",
TRUE,
RO_RUNNING |
RO_TRANSITIONS,
30000,
0,
0,
1,
"", "", "",},
cd_hv_read,
cd_hv,
NULL,
},
{ "" }
}
DEVICE_DRIVER hv_driver[]
device driver list

equipment structure for the mfe.c

Definition at line 126 of file hv_fug_scfe.cxx.

BOOL equipment_common_overwrite = FALSE

equipment_common_overwrite:

  • If that flag is TRUE, then the contents of the "equipment" structure is copied to the ODB on each start of the front-end.
  • If the flag is FALSE, then the ODB values are kept on the start of the front-end

Definition at line 123 of file hv_fug_scfe.cxx.

INT event_buffer_size = 10*10000

buffer size to hold events

Definition at line 43 of file hv_fug_scfe.cxx.

BOOL frontend_call_loop = TRUE

frontend_loop is called periodically if this variable is TRUE

Definition at line 31 of file hv_fug_scfe.cxx.

const char* frontend_file_name = __FILE__

The frontend file name, don't change it.

Definition at line 28 of file hv_fug_scfe.cxx.

const char* frontend_name = "FUG"

The frontend name (client name) as seen by other MIDAS clients.

Definition at line 26 of file hv_fug_scfe.cxx.

float* hv_detectors_measured

hotlink variable holding the measured TD HV's

Definition at line 68 of file hv_fug_scfe.cxx.

DEVICE_DRIVER hv_driver[]
Initial value:
= {
{ "hv_spin_rot", hv_scs3000, 4, null, DF_PRIO_DEVICE },
{ "hv_mc_tc", hv_scs3000, 7, null, DF_PRIO_DEVICE },
{ "hv_sc", hv_scs3000, 5, null, DF_PRIO_DEVICE }
}

device driver list

Definition at line 109 of file hv_fug_scfe.cxx.

int hv_fug_chamber_flag[FUG_CHS]

Definition at line 77 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and hv_fug_scfe_gas_inlet().

DWORD hv_fug_check_timestamp

Definition at line 81 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and frontend_loop().

int hv_fug_debug = 0

Definition at line 86 of file hv_fug_scfe.cxx.

Referenced by frontend_loop().

float hv_fug_demand[FUG_CHS]

Definition at line 75 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and frontend_loop().

DWORD hv_fug_demand_changed_timer

Definition at line 79 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), frontend_loop(), and hv_fug_demand_changed().

INT hv_fug_detector_rate

hotlink variable holding the TD or MCP1 rate

Definition at line 65 of file hv_fug_scfe.cxx.

Referenced by hv_fug_check_trip_level(), and hv_fug_trip_rate_source_changed().

int hv_fug_drop_counter[FUG_CHS]

Definition at line 83 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and frontend_loop().

HNDLE hv_fug_hDB

Definition at line 71 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and frontend_loop().

INT hv_fug_hvAlreadyOff

HV already switched off.

Definition at line 93 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and hv_fug_scfe_monitoring().

HNDLE hv_fug_measured_hKey

Definition at line 72 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and frontend_loop().

INT hv_fug_monitoring_enabled

hotlink variable holding the monitoring enabled flag

Definition at line 89 of file hv_fug_scfe.cxx.

Referenced by frontend_init(), and hv_fug_scfe_monitoring().

const char* hv_fug_monitoring_str
Initial value:
=
"FUG Monitoring = INT : 0\n\
Trip Rate Source = STRING : [32] TD\n\
Trip Enabled = INT : 1\n\
Trip Level = INT : 1500000\n\
"

Definition at line 99 of file hv_fug_scfe.cxx.

Referenced by frontend_init().

char hv_fug_trip_rate_source[NAME_LENGTH]

hotlink variable holding the name of the detector which is to monitor the rate

Definition at line 90 of file hv_fug_scfe.cxx.

Referenced by hv_fug_check_trip_level(), and hv_fug_trip_rate_source_changed().

INT hv_fug_tripEnabled

hotlink variable holding the trip enabled flag

Definition at line 91 of file hv_fug_scfe.cxx.

Referenced by hv_fug_check_trip_level().

INT hv_fug_tripRate

hotlink variable holding the TD trip rate

Definition at line 92 of file hv_fug_scfe.cxx.

Referenced by hv_fug_check_trip_level().

float lemvac_in[27]

holds the lemvac input variables

Definition at line 96 of file hv_fug_scfe.cxx.

INT max_event_size = 10000

maximum event size produced by this frontend

Definition at line 37 of file hv_fug_scfe.cxx.

INT max_event_size_frag = 5*1024*1024

maximum event size for fragmented events (EQ_FRAGMENTED)

Definition at line 40 of file hv_fug_scfe.cxx.