Low-Energy Muon (LEM) Experiment
0.5.1
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <math.h>
#include "midas.h"
#include "lemvac.h"
Go to the source code of this file.
Data Structures | |
struct | LEMVAC_INTERN |
Stores DD specific internal information. More... | |
struct | LEMVAC_NAMES |
Stores the names of the various channels which are than transferred form the DD to the variable names. More... | |
struct | LEMVAC_INFO |
This structure contains private variables for the device driver. More... | |
Macros | |
#define | LV_HV_NO_INTERLOCK_FLAG 128 |
#define | LV_GAS_INLET_FLAG 128 |
#define | LV_BIT0 0x0100 |
#define | LV_BIT1 0x0200 |
#define | LV_BIT2 0x0400 |
#define | LV_BIT3 0x0800 |
#define | LV_BIT4 0x1000 |
#define | LV_BIT5 0x2000 |
#define | LV_BIT6 0x4000 |
#define | LV_BIT7 0x8000 |
#define | LV_BIT8 0x0001 |
#define | LV_BIT9 0x0002 |
#define | LV_BIT10 0x0004 |
#define | LV_BIT11 0x0008 |
#define | LV_BIT12 0x0010 |
#define | LV_BIT13 0x0020 |
#define | LV_BIT14 0x0040 |
#define | LV_BIT15 0x0080 |
#define | LV_LIFESIGN 0 |
#define | LV_MCGR 1 |
#define | LV_MCGT 2 |
#define | LV_MCGJ 3 |
#define | LV_MCGJ2 4 |
#define | LV_TCGR 5 |
#define | LV_TCGT 6 |
#define | LV_TCGJ 7 |
#define | LV_TCGJ2 8 |
#define | LV_SCGR 9 |
#define | LV_SCGT 10 |
#define | LV_SCGJ 11 |
#define | LV_SCGJ2 12 |
#define | LV_PZGR 13 |
#define | LV_MCSTAT1 14 |
#define | LV_MCSTAT2 15 |
#define | LV_MCSTAT3 16 |
#define | LV_TCSTAT1 17 |
#define | LV_TCSTAT2 18 |
#define | LV_TCSTAT3 19 |
#define | LV_SCSTAT1 20 |
#define | LV_SCSTAT2 21 |
#define | LV_SCSTAT3 22 |
#define | LV_PZSTAT1 23 |
#define | LV_PZSTAT2 24 |
#define | LV_BPVX 25 |
#define | LV_BPVY 26 |
#define | LV_BPVX_ENABLED 0 |
#define | LV_BPVX_CMD 1 |
#define | LV_BPVY_ENABLED 2 |
#define | LV_BPVY_CMD 3 |
#define | LV_SC_PUMP_CMD_ENABLED 4 |
#define | LV_SC_PUMP_CMD 5 |
#define | LV_SC_VENT_CMD_ENABLED 6 |
#define | LV_SC_VENT_CMD 7 |
#define | LV_BPV_CMD_IDLE 0.0 |
#define | LV_BPV_CMD_TOGGLE 1.0 |
#define | LV_BPV_CMD_OPEN 2.0 |
#define | LV_BPV_CMD_CLOSE 3.0 |
#define | SPS_MAX_BYTES 680 |
length of the data structure exchanged between SPS and midas More... | |
#define | LEMVAC_TIME_CONST 0 |
trigger time constant for read out of the SPS More... | |
#define | LEMVAC_TIMEOUT_ERROR 3600 |
after what time (sec.) read errors should be reported More... | |
#define | LEMVAC_SC_PENDING_CMD_IDLE 0 |
#define | LEMVAC_SC_PENDING_CMD_STOP 1 |
#define | LEMVAC_SC_PENDING_CMD_VENT 2 |
#define | VENT_STATE_HV_BIT 0 |
#define | VENT_STATE_TEMP_BIT 1 |
#define | VENT_STATE_BPVY_BIT 2 |
#define | VENT_STATE_PUMP_BIT 3 |
#define | VENT_CMD_STOP 0 |
#define | VENT_CMD_START 1 |
#define | FUG_SC_RAL_IDX 11 |
#define | FUG_SC_RAR_IDX 12 |
#define | FUG_SC_RAT_IDX 13 |
#define | FUG_SC_RAB_IDX 14 |
#define | FUG_SC_SAMPLE_IDX 15 |
#define | SAMPLE_IN_CF1_IDX 0 |
#define | SAMPLE_OUT_SET_POINT_IDX 1 |
#define | SAMPLE_OUT_LS_RAMP 7 |
#define | SAMPLE_OUT_BH1_FLOW_IDX 8 |
#define | SAMPLE_OUT_BH2_FLOW_IDX 10 |
#define | LAMVAC_INTERN_STR "\Detailed Messages = INT : 0\n\" |
Initializing string for the struct LEMVAC_INTERN. More... | |
#define | LEMVAC_NAMES_STR "\Input Names = STRING[27] : \n\[32] Life Sign\n\[32] MC_GR Pirani\n\[32] MC_GT Pirani\n\[32] MC_GJ Penning\n\[32] MC_GJ2 Penning\n\[32] TC_GR Pirani\n\[32] TC_GT Pirani\n\[32] TC_GJ Penning\n\[32] TC_GJ2 Penning\n\[32] SC_GR Pirani\n\[32] SC_GT Pirani\n\[32] SC_GJ Penning\n\[32] SC_GJ2 Penning\n\[32] PZ_GR Pirani\n\[32] MC Status Word 1\n\[32] MC Status Word 2\n\[32] MC Status Word 3\n\[32] TC Status Word 1\n\[32] TC Status Word 2\n\[32] TC Status Word 3\n\[32] SC Status Word 1\n\[32] SC Status Word 2\n\[32] SC Status Word 3\n\[32] PZ Status Word 1\n\[32] PZ Status Word 2\n\[32] BPVX Status Word\n\[32] BPVY Status Word\n\Output Names = STRING[8] : \n\[32] BPVX enabled\n\[32] BPVX toggle cmd\n\[32] BPVY enabled\n\[32] BPVY toggle cmd\n\[32] SC pump cmd enabled\n\[32] SC pump cmd\n\[32] SC vent enabled\n\[32] SC vent cmd\n\" |
Initializing string for the struct LEMVAC_NAMES. More... | |
Variables | |
LEMVAC_INFO * | gInfo |
global info structure, in/out-init routines need the same structure More... | |
INT | lemvac_sc_vent_state |
INT | lemvac_pending_sc_cmd |
#define FUG_SC_RAL_IDX 11 |
Definition at line 104 of file lemvac.c.
Referenced by lemvac_check_sample_hv(), and lemvac_shutdown_sc_hv().
#define FUG_SC_SAMPLE_IDX 15 |
Definition at line 108 of file lemvac.c.
Referenced by lemvac_check_sample_hv(), and lemvac_shutdown_sc_hv().
#define LAMVAC_INTERN_STR "\Detailed Messages = INT : 0\n\" |
Initializing string for the struct LEMVAC_INTERN.
Definition at line 123 of file lemvac.c.
Referenced by lemvac_in_init().
#define LEMVAC_NAMES_STR "\Input Names = STRING[27] : \n\[32] Life Sign\n\[32] MC_GR Pirani\n\[32] MC_GT Pirani\n\[32] MC_GJ Penning\n\[32] MC_GJ2 Penning\n\[32] TC_GR Pirani\n\[32] TC_GT Pirani\n\[32] TC_GJ Penning\n\[32] TC_GJ2 Penning\n\[32] SC_GR Pirani\n\[32] SC_GT Pirani\n\[32] SC_GJ Penning\n\[32] SC_GJ2 Penning\n\[32] PZ_GR Pirani\n\[32] MC Status Word 1\n\[32] MC Status Word 2\n\[32] MC Status Word 3\n\[32] TC Status Word 1\n\[32] TC Status Word 2\n\[32] TC Status Word 3\n\[32] SC Status Word 1\n\[32] SC Status Word 2\n\[32] SC Status Word 3\n\[32] PZ Status Word 1\n\[32] PZ Status Word 2\n\[32] BPVX Status Word\n\[32] BPVY Status Word\n\Output Names = STRING[8] : \n\[32] BPVX enabled\n\[32] BPVX toggle cmd\n\[32] BPVY enabled\n\[32] BPVY toggle cmd\n\[32] SC pump cmd enabled\n\[32] SC pump cmd\n\[32] SC vent enabled\n\[32] SC vent cmd\n\" |
Initializing string for the struct LEMVAC_NAMES.
Definition at line 134 of file lemvac.c.
Referenced by lemvac_in_init().
#define LEMVAC_SC_PENDING_CMD_IDLE 0 |
Definition at line 91 of file lemvac.c.
Referenced by lemvac_check_pending_cmd(), lemvac_in_init(), and lemvac_set().
#define LEMVAC_SC_PENDING_CMD_STOP 1 |
Definition at line 92 of file lemvac.c.
Referenced by lemvac_check_pending_cmd(), and lemvac_prepare_stop_sc_pump().
#define LEMVAC_SC_PENDING_CMD_VENT 2 |
Definition at line 93 of file lemvac.c.
Referenced by lemvac_check_pending_cmd(), and lemvac_prepare_venting_sc().
#define LEMVAC_TIME_CONST 0 |
trigger time constant for read out of the SPS
Definition at line 87 of file lemvac.c.
Referenced by lemvac_get_all().
#define LEMVAC_TIMEOUT_ERROR 3600 |
after what time (sec.) read errors should be reported
Definition at line 88 of file lemvac.c.
Referenced by lemvac_get_all().
#define LV_BIT0 0x0100 |
Definition at line 24 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), and lemvac_start_sc_pump().
#define LV_BIT1 0x0200 |
Definition at line 25 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), and lemvac_stop_sc_pump().
#define LV_BIT2 0x0400 |
Definition at line 26 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), lemvac_set_sliding_valve(), and lemvac_start_sc_pump().
#define LV_BIT3 0x0800 |
Definition at line 27 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), lemvac_set_sliding_valve(), and lemvac_start_sc_pump().
#define LV_BIT4 0x1000 |
Definition at line 28 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), and lemvac_set_sliding_valve().
#define LV_BIT9 0x0002 |
Definition at line 33 of file lemvac.c.
Referenced by lemvac_deal_with_handshake().
#define LV_BPV_CMD_CLOSE 3.0 |
Definition at line 84 of file lemvac.c.
Referenced by lemvac_get_all(), lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().
#define LV_BPVX 25 |
Definition at line 67 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), and lemvac_decode_data().
#define LV_BPVX_CMD 1 |
Definition at line 72 of file lemvac.c.
Referenced by lemvac_get_all(), and lemvac_set().
#define LV_BPVX_ENABLED 0 |
Definition at line 71 of file lemvac.c.
Referenced by lemvac_set().
#define LV_BPVY 26 |
Definition at line 68 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), lemvac_decode_data(), and lemvac_get_all().
#define LV_BPVY_CMD 3 |
Definition at line 74 of file lemvac.c.
Referenced by lemvac_get_all(), lemvac_prepare_stop_sc_pump(), lemvac_prepare_venting_sc(), and lemvac_set().
#define LV_BPVY_ENABLED 2 |
Definition at line 73 of file lemvac.c.
Referenced by lemvac_set().
#define LV_GAS_INLET_FLAG 128 |
Definition at line 21 of file lemvac.c.
Referenced by lemvac_get_all().
#define LV_HV_NO_INTERLOCK_FLAG 128 |
Definition at line 20 of file lemvac.c.
Referenced by lemvac_get_all().
#define LV_LIFESIGN 0 |
Definition at line 42 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCGJ 3 |
Definition at line 45 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCGJ2 4 |
Definition at line 46 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCGR 1 |
Definition at line 43 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCGT 2 |
Definition at line 44 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCSTAT1 14 |
Definition at line 56 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCSTAT2 15 |
Definition at line 57 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_MCSTAT3 16 |
Definition at line 58 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_PZGR 13 |
Definition at line 55 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_PZSTAT1 23 |
Definition at line 65 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_PZSTAT2 24 |
Definition at line 66 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_SC_PUMP_CMD 5 |
Definition at line 76 of file lemvac.c.
Referenced by lemvac_set(), lemvac_start_sc_pump(), and lemvac_stop_sc_pump().
#define LV_SC_PUMP_CMD_ENABLED 4 |
Definition at line 75 of file lemvac.c.
Referenced by lemvac_set(), lemvac_start_sc_pump(), and lemvac_stop_sc_pump().
#define LV_SC_VENT_CMD 7 |
Definition at line 78 of file lemvac.c.
Referenced by lemvac_set(), and lemvac_vent_sc().
#define LV_SC_VENT_CMD_ENABLED 6 |
Definition at line 77 of file lemvac.c.
Referenced by lemvac_set(), and lemvac_vent_sc().
#define LV_SCGJ 11 |
Definition at line 53 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_SCGJ2 12 |
Definition at line 54 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_SCGR 9 |
Definition at line 51 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_SCGT 10 |
Definition at line 52 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_SCSTAT1 20 |
Definition at line 62 of file lemvac.c.
Referenced by lemvac_deal_with_handshake(), lemvac_decode_data(), lemvac_get_all(), lemvac_start_sc_pump(), and lemvac_stop_sc_pump().
#define LV_SCSTAT2 21 |
Definition at line 63 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_SCSTAT3 22 |
Definition at line 64 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCGJ 7 |
Definition at line 49 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCGJ2 8 |
Definition at line 50 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCGR 5 |
Definition at line 47 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCGT 6 |
Definition at line 48 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCSTAT1 17 |
Definition at line 59 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCSTAT2 18 |
Definition at line 60 of file lemvac.c.
Referenced by lemvac_decode_data().
#define LV_TCSTAT3 19 |
Definition at line 61 of file lemvac.c.
Referenced by lemvac_decode_data().
#define SAMPLE_IN_CF1_IDX 0 |
Definition at line 111 of file lemvac.c.
Referenced by lemvac_check_sample_temp().
#define SAMPLE_OUT_BH1_FLOW_IDX 8 |
Definition at line 114 of file lemvac.c.
Referenced by lemvac_forced_warmup().
#define SAMPLE_OUT_BH2_FLOW_IDX 10 |
Definition at line 115 of file lemvac.c.
Referenced by lemvac_forced_warmup().
#define SAMPLE_OUT_LS_RAMP 7 |
Definition at line 113 of file lemvac.c.
Referenced by lemvac_forced_warmup().
#define SAMPLE_OUT_SET_POINT_IDX 1 |
Definition at line 112 of file lemvac.c.
Referenced by lemvac_forced_warmup().
#define SPS_MAX_BYTES 680 |
length of the data structure exchanged between SPS and midas
Definition at line 86 of file lemvac.c.
Referenced by lemvac_get_all(), and lemvac_in_init().
#define VENT_CMD_START 1 |
Definition at line 101 of file lemvac.c.
Referenced by lemvac_check_pending_cmd(), lemvac_prepare_venting_sc(), and lemvac_vent_sc().
#define VENT_CMD_STOP 0 |
Definition at line 100 of file lemvac.c.
Referenced by lemvac_set(), and lemvac_vent_sc().
#define VENT_STATE_BPVY_BIT 2 |
Definition at line 97 of file lemvac.c.
Referenced by lemvac_get_all(), lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().
#define VENT_STATE_HV_BIT 0 |
Definition at line 95 of file lemvac.c.
Referenced by lemvac_get_all(), lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().
#define VENT_STATE_PUMP_BIT 3 |
Definition at line 98 of file lemvac.c.
Referenced by lemvac_get_all().
#define VENT_STATE_TEMP_BIT 1 |
Definition at line 96 of file lemvac.c.
Referenced by lemvac_get_all(), lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().
void lemvac_check_pending_cmd | ( | LEMVAC_INFO * | info | ) |
Checks if there is a pending command related to the sample chamber.
info | pointer to the main info structure |
Definition at line 365 of file lemvac.c.
References lemvac_pending_sc_cmd, LEMVAC_SC_PENDING_CMD_IDLE, LEMVAC_SC_PENDING_CMD_STOP, LEMVAC_SC_PENDING_CMD_VENT, lemvac_sc_vent_state, lemvac_stop_sc_pump(), lemvac_vent_sc(), and VENT_CMD_START.
Referenced by lemvac_get_all().
INT lemvac_check_sample_hv | ( | ) |
check if demand HV's in the sample chamber are set. Does NOT check if the HV FUG frontend is running!
Definition at line 233 of file lemvac.c.
References FUG_SC_RAL_IDX, FUG_SC_SAMPLE_IDX, hDB, and hKey.
Referenced by lemvac_get_all().
INT lemvac_check_sample_temp | ( | ) |
Check the sample temperature (CF1).
Definition at line 271 of file lemvac.c.
References hDB, hKey, and SAMPLE_IN_CF1_IDX.
Referenced by lemvac_get_all().
void lemvac_deal_with_handshake | ( | LEMVAC_INFO * | info | ) |
Between the SPS and midas a handshake mechanism is needed to make sure that commands are acctually executed on the SPS side. A pending command bit in the DB needs to be reseted from the midas side if the command has been executed from the SPS.
info | pointer to the DD info structure |
Definition at line 541 of file lemvac.c.
References LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::handshake_err_count, LEMVAC_INFO::lemvac_buffer, LEMVAC_INFO::lemvac_data, lemvac_write_cmd(), LV_BIT0, LV_BIT1, LV_BIT2, LV_BIT3, LV_BIT4, LV_BIT9, LV_BPVX, LV_BPVY, and LV_SCSTAT1.
Referenced by lemvac_get_all().
BOOL lemvac_decode_data | ( | LEMVAC_INFO * | info, |
const char * | buffer | ||
) |
decodes the DB buffer and write it into an array which mirrors the midas input variables.
info | pointer to the DD info structure. |
buffer | pointer to the internal DB buffer structure. |
Definition at line 496 of file lemvac.c.
References LEMVAC_INFO::lemvac_data, LV_BPVX, LV_BPVY, LV_LIFESIGN, LV_MCGJ, LV_MCGJ2, LV_MCGR, LV_MCGT, LV_MCSTAT1, LV_MCSTAT2, LV_MCSTAT3, LV_PZGR, LV_PZSTAT1, LV_PZSTAT2, LV_SCGJ, LV_SCGJ2, LV_SCGR, LV_SCGT, LV_SCSTAT1, LV_SCSTAT2, LV_SCSTAT3, LV_TCGJ, LV_TCGJ2, LV_TCGR, LV_TCGT, LV_TCSTAT1, LV_TCSTAT2, LV_TCSTAT3, penning_ikr070(), pirani_tpr018(), spsToNumber(), and spsToWord().
Referenced by lemvac_get_all().
INT lemvac_exit | ( | LEMVAC_INFO * | info | ) |
quits the bus driver and free's the memory allocated for the info structure
LEMVAC_INFO
.
info | is a pointer to the DD specific info structure |
Definition at line 1225 of file lemvac.c.
References LEMVAC_INFO::bd, LEMVAC_INFO::bd_info, LEMVAC_INFO::hDB, and LEMVAC_INFO::hKey_DB_Buffer.
Referenced by lemvac_in().
void lemvac_forced_warmup | ( | LEMVAC_INFO * | info | ) |
Will set the sample cryo temperature to T=300K and the BH1, BH2 flows to to zero.
info | pointer to the main info structure |
Definition at line 330 of file lemvac.c.
References LEMVAC_INFO::hDB, hKey, SAMPLE_OUT_BH1_FLOW_IDX, SAMPLE_OUT_BH2_FLOW_IDX, SAMPLE_OUT_LS_RAMP, and SAMPLE_OUT_SET_POINT_IDX.
Referenced by lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().
INT lemvac_get | ( | LEMVAC_INFO * | info, |
INT | channel, | ||
float * | pvalue | ||
) |
reads the status of the lem SPS vacuum control unit
info | is a pointer to the DD specific info structure |
channel | to be read back |
pvalue | pointer to the ODB value |
Definition at line 1370 of file lemvac.c.
References LEMVAC_INTERN::detailed_msg, LEMVAC_INFO::intern, LEMVAC_INFO::lemvac_data, lemvac_get_all(), and LEMVAC_IN_VARS.
Referenced by lemvac_in().
void lemvac_get_all | ( | LEMVAC_INFO * | info | ) |
Establishes the communication to the SPS controll unit for reading, reads the data and stores them in the local structure
lemvac_data
. The SPS is setup for the fetch protocol. Since the communication sometimes fails, an error protocol system is implemented as well. It records the errors over a period of 10 min. and records them (cm_msg).
info | is a pointer to the DD specific info structure |
Definition at line 642 of file lemvac.c.
References LEMVAC_INFO::bd, LEMVAC_INFO::bd_info, LEMVAC_INTERN::detailed_msg, LEMVAC_INFO::errTime, LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::intern, LEMVAC_INFO::lemvac_buffer, lemvac_check_pending_cmd(), lemvac_check_sample_hv(), lemvac_check_sample_temp(), LEMVAC_INFO::lemvac_data, lemvac_deal_with_handshake(), lemvac_decode_data(), lemvac_sc_vent_state, lemvac_set_sliding_valve(), LEMVAC_TIME_CONST, LEMVAC_TIMEOUT_ERROR, LV_BPV_CMD_CLOSE, LV_BPVX_CMD, LV_BPVY, LV_BPVY_CMD, LV_GAS_INLET_FLAG, LV_HV_NO_INTERLOCK_FLAG, LV_SCSTAT1, LEMVAC_INFO::read_counts, LEMVAC_INFO::read_error, SPS_MAX_BYTES, LEMVAC_INFO::tcpip_open_error, LEMVAC_INFO::time, VENT_STATE_BPVY_BIT, VENT_STATE_HV_BIT, VENT_STATE_PUMP_BIT, and VENT_STATE_TEMP_BIT.
Referenced by lemvac_get().
INT lemvac_in | ( | INT | cmd, |
... | |||
) |
lem vacuum controller device driver (read routines) entry function. Establishes the communication with the SPS controll unit of the LEM experiment and reads the state of the pumps, valves, and the pressure values.
Definition at line 1392 of file lemvac.c.
References hKey, info, lemvac_exit(), lemvac_get(), lemvac_in_get_label(), and lemvac_in_init().
INT lemvac_in_get_label | ( | LEMVAC_INFO * | info, |
INT | channel, | ||
char * | name | ||
) |
at startup, after initialization of the DD, this routine allows to write default names into the ODB.
info | is a pointer to the DD specific info structure |
channel | of the name to be set |
name | pointer to the ODB name |
Definition at line 1337 of file lemvac.c.
References LEMVAC_NAMES::in_name, and LEMVAC_INFO::lemvac_names.
Referenced by lemvac_in().
INT lemvac_in_init | ( | HNDLE | hKey, |
void ** | pinfo, | ||
INT | channels, | ||
INT(*)(INT cmd,...) | bd | ||
) |
Initializes the lemvac device driver for reading, i.e. generates all the necessary structures in the ODB if necessary, initializes the bus driver and the lemvac.
hKey | is the device driver handle given from the class driver |
**pinfo | is needed to store the internal info structure |
channels | is the number of channels of the device (from the class driver) |
*bd | is a pointer to the bus driver |
Definition at line 1082 of file lemvac.c.
References LEMVAC_INFO::bd, LEMVAC_INFO::bd_info, LEMVAC_INFO::bpv_enabled, LEMVAC_INTERN::detailed_msg, LEMVAC_INFO::errTime, gInfo, LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::handshake_err_count, hDB, LEMVAC_INFO::hDB, hKey, LEMVAC_INFO::hKey_DB_Buffer, LEMVAC_INFO::hKey_in, LEMVAC_INFO::intern, LAMVAC_INTERN_STR, LEMVAC_INFO::last_success, LEMVAC_INFO::lemvac_buffer, LEMVAC_INFO::lemvac_names, LEMVAC_NAMES_STR, lemvac_pending_sc_cmd, LEMVAC_SC_PENDING_CMD_IDLE, lemvac_sc_vent_state, LEMVAC_INFO::read_counts, LEMVAC_INFO::read_error, LEMVAC_INFO::sc_pump_cmd_enabled, LEMVAC_INFO::sc_vent_cmd_enabled, SPS_MAX_BYTES, LEMVAC_INFO::tcpip_open_error, and LEMVAC_INFO::time.
Referenced by lemvac_in().
INT lemvac_out | ( | INT | cmd, |
... | |||
) |
lem vacuum controller device driver (write routines) entry function. At the moment only control over the BPVX (sliding valve between moderator and trigger chamber) and BPXY (sliding valve between trigger and sample chamber) is implemented. As a precaution for each valve two variables are introduced:
Definition at line 1444 of file lemvac.c.
References hKey, info, lemvac_out_get_label(), lemvac_out_init(), and lemvac_set().
INT lemvac_out_get_label | ( | LEMVAC_INFO * | info, |
INT | channel, | ||
char * | name | ||
) |
at startup, after initialization of the DD, this routine allows to write default names into the ODB.
info | is a pointer to the DD specific info structure |
channel | of the name to be set |
name | pointer to the ODB name |
Definition at line 1354 of file lemvac.c.
References LEMVAC_INFO::lemvac_names, and LEMVAC_NAMES::out_name.
Referenced by lemvac_out().
INT lemvac_out_init | ( | HNDLE | hKey, |
void ** | pinfo, | ||
INT | channels, | ||
INT(*)(INT cmd,...) | bd | ||
) |
Initializes the lemvac device driver for writing, i.e. generates all the necessary structures in the ODB if necessary, initializes the bus driver and the lemvac.
hKey | is the device driver handle given from the class driver |
**pinfo | is needed to store the internal info structure |
channels | is the number of channels of the device (from the class driver) |
*bd | is a pointer to the bus driver |
Definition at line 1206 of file lemvac.c.
References gInfo, hKey, and LEMVAC_INFO::hKey_out.
Referenced by lemvac_out().
void lemvac_prepare_stop_sc_pump | ( | LEMVAC_INFO * | info, |
BOOL | forced | ||
) |
prepare to stop the SC pumps. If necessary conditions are not fulfilled (i.e. BPVY closed, SC HVs down, CF1 T>90K), initiate the necessary steps and set lemvac_pending_sc_cmd to LEMVAC_SC_PENDING_CMD_STOP.
info | pointer to the main info structure |
forced | TRUE means initiate a forced warmup, otherwise leave the sample cryo temperature alone (monitoring only). |
Definition at line 951 of file lemvac.c.
References lemvac_forced_warmup(), lemvac_pending_sc_cmd, LEMVAC_SC_PENDING_CMD_STOP, lemvac_sc_vent_state, lemvac_set_sliding_valve(), lemvac_shutdown_sc_hv(), lemvac_stop_sc_pump(), LV_BPV_CMD_CLOSE, LV_BPVY_CMD, VENT_STATE_BPVY_BIT, VENT_STATE_HV_BIT, and VENT_STATE_TEMP_BIT.
Referenced by lemvac_set().
void lemvac_prepare_venting_sc | ( | LEMVAC_INFO * | info, |
BOOL | forced | ||
) |
prepare to vent to SC. If necessary conditions are not fulfilled (i.e. BPVY closed, SC HVs down, CF1 T>90K), initiate the necessary steps and set lemvac_pending_sc_cmd to LEMVAC_SC_PENDING_CMD_STOP.
info | pointer to the main info structure |
forced | TRUE means initiate a forced warmup, otherwise leave the sample cryo temperature alone (monitoring only). |
Definition at line 985 of file lemvac.c.
References lemvac_forced_warmup(), lemvac_pending_sc_cmd, LEMVAC_SC_PENDING_CMD_VENT, lemvac_sc_vent_state, lemvac_set_sliding_valve(), lemvac_shutdown_sc_hv(), lemvac_vent_sc(), LV_BPV_CMD_CLOSE, LV_BPVY_CMD, VENT_CMD_START, VENT_STATE_BPVY_BIT, VENT_STATE_HV_BIT, and VENT_STATE_TEMP_BIT.
Referenced by lemvac_set().
INT lemvac_set | ( | LEMVAC_INFO * | info, |
INT | channel, | ||
float | value | ||
) |
sends a new value to the lem SPS vacuum control unit. At the moment only the BPVX (sliding valve between the moderator and the trigger chamber) and the BPVY (sliding valve between the trigger and the sample chamber) are implemented. As a precaution, for each valve there are two variables:
info | is a pointer to the DD specific info structure |
channel | for which channel is this command |
value | to be set. |
Definition at line 1255 of file lemvac.c.
References LEMVAC_INFO::bpv_enabled, lemvac_pending_sc_cmd, lemvac_prepare_stop_sc_pump(), lemvac_prepare_venting_sc(), LEMVAC_SC_PENDING_CMD_IDLE, lemvac_set_sliding_valve(), lemvac_start_sc_pump(), lemvac_vent_sc(), LV_BPVX_CMD, LV_BPVX_ENABLED, LV_BPVY_CMD, LV_BPVY_ENABLED, LV_SC_PUMP_CMD, LV_SC_PUMP_CMD_ENABLED, LV_SC_VENT_CMD, LV_SC_VENT_CMD_ENABLED, LEMVAC_INFO::sc_pump_cmd_enabled, LEMVAC_INFO::sc_vent_cmd_enabled, and VENT_CMD_STOP.
Referenced by lemvac_out().
void lemvac_set_sliding_valve | ( | LEMVAC_INFO * | info, |
INT | valve, | ||
float | value | ||
) |
Sends commands to the SPS control unit in the write protocol. At the moment only the BPVX and the BPVY are handled.
info | is a pointer to the DD specific info structure |
valve | which valve: 1=BPVX, 3=BPVY |
value | valve command: idle=0, toggle=1 (open->close; close->open), open=2, close=3 |
Definition at line 798 of file lemvac.c.
References LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::hDB, hKey, LEMVAC_INFO::lemvac_buffer, lemvac_write_cmd(), LV_BIT2, LV_BIT3, LV_BIT4, and spsToWord().
Referenced by lemvac_get_all(), lemvac_prepare_stop_sc_pump(), lemvac_prepare_venting_sc(), and lemvac_set().
void lemvac_shutdown_sc_hv | ( | LEMVAC_INFO * | info | ) |
Shut down the HVs in the sample chamber.
info | pointer to the main info structure |
Definition at line 304 of file lemvac.c.
References FUG_SC_RAL_IDX, FUG_SC_SAMPLE_IDX, LEMVAC_INFO::hDB, and hKey.
Referenced by lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().
void lemvac_start_sc_pump | ( | LEMVAC_INFO * | info | ) |
start the sample chamber turbo pump.
info | pointer to the main info structure |
Definition at line 866 of file lemvac.c.
References LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::hDB, hKey, LEMVAC_INFO::lemvac_buffer, LEMVAC_INFO::lemvac_data, lemvac_write_cmd(), LV_BIT0, LV_BIT2, LV_BIT3, LV_SC_PUMP_CMD, LV_SC_PUMP_CMD_ENABLED, and LV_SCSTAT1.
Referenced by lemvac_set().
void lemvac_stop_sc_pump | ( | LEMVAC_INFO * | info | ) |
stop sample chamber turbo pump, and closes the necessary valves.
info | pointer to the main info structure |
Definition at line 907 of file lemvac.c.
References LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::hDB, hKey, LEMVAC_INFO::lemvac_buffer, LEMVAC_INFO::lemvac_data, lemvac_write_cmd(), LV_BIT1, LV_SC_PUMP_CMD, LV_SC_PUMP_CMD_ENABLED, and LV_SCSTAT1.
Referenced by lemvac_check_pending_cmd(), and lemvac_prepare_stop_sc_pump().
void lemvac_vent_sc | ( | LEMVAC_INFO * | info, |
INT | cmd | ||
) |
vent the sample chamber.
info | pointer to the main info structure |
cmd | 0: stop venting, 1: start venting |
Definition at line 1016 of file lemvac.c.
References LEMVAC_INFO::handshake_cmd, LEMVAC_INFO::hDB, hKey, LEMVAC_INFO::lemvac_buffer, lemvac_write_cmd(), LV_SC_VENT_CMD, LV_SC_VENT_CMD_ENABLED, VENT_CMD_START, and VENT_CMD_STOP.
Referenced by lemvac_check_pending_cmd(), lemvac_prepare_venting_sc(), and lemvac_set().
void lemvac_write_cmd | ( | LEMVAC_INFO * | info | ) |
sends a command from midas to the SPS. The command is encoded in the DB structure.
info | pointer to the DD info structure |
Definition at line 775 of file lemvac.c.
References LEMVAC_INFO::bd, LEMVAC_INFO::bd_info, LEMVAC_INTERN::detailed_msg, LEMVAC_INFO::intern, LEMVAC_INFO::lemvac_buffer, and LEMVAC_INFO::tcpip_open_error.
Referenced by lemvac_deal_with_handshake(), lemvac_set_sliding_valve(), lemvac_start_sc_pump(), lemvac_stop_sc_pump(), and lemvac_vent_sc().
double penning_ikr070 | ( | int | analog | ) |
Conversion of the analog output (mV) of the Penning IKR070 to real pressure in (mbar). The implemented conversion is only valid in the pressure interval p=[10e-11mbar, 4x10e-5mbar].
analog | pressure in (mV) |
Definition at line 437 of file lemvac.c.
Referenced by lemvac_decode_data().
double pirani_tpr018 | ( | int | analog | ) |
Conversion of the analog output (mV) of the Pirani TPR018 to real pressure in (mbar).
analog | pressure in (mV) |
Definition at line 451 of file lemvac.c.
Referenced by lemvac_decode_data().
short spsToNumber | ( | unsigned char * | buffer | ) |
This routine converts the 2 byte input to a integer number.
buffer | pointer to 2 bytes |
Definition at line 394 of file lemvac.c.
Referenced by lemvac_decode_data(), and ps64_decode_data().
int spsToWord | ( | unsigned char * | buffer | ) |
This routine converts the 2 byte input to a word (16 bit).
buffer | pointer to 2 bytes |
Definition at line 419 of file lemvac.c.
Referenced by lemvac_decode_data(), lemvac_set_sliding_valve(), and ps64_decode_data().
LEMVAC_INFO* gInfo |
global info structure, in/out-init routines need the same structure
Definition at line 200 of file lemvac.c.
Referenced by lemvac_in_init(), lemvac_out_init(), ps64_in_init(), ps64_out_init(), and sep61vac_init().
INT lemvac_pending_sc_cmd |
Definition at line 219 of file lemvac.c.
Referenced by lemvac_check_pending_cmd(), lemvac_in_init(), lemvac_prepare_stop_sc_pump(), lemvac_prepare_venting_sc(), and lemvac_set().
INT lemvac_sc_vent_state |
Definition at line 214 of file lemvac.c.
Referenced by lemvac_check_pending_cmd(), lemvac_get_all(), lemvac_in_init(), lemvac_prepare_stop_sc_pump(), and lemvac_prepare_venting_sc().