EPICS: generation of DBs and GUIs for HV
Following example explains how it works.
Example for test setup CAEN
Following procedure generates *.db and *.adl/*.alh files for High Voltage applications.
cd $APP/hvca/db/
Create *.dat file with following format:
clonpc1:db> more caen.dat CAEN_1_00 02 1 1 01 01 03 00 -1200.0 1.5 1.3 121.5 486.0 2550.0 -2500.0 CAEN_1_01 02 1 1 01 01 03 01 -1200.0 1.5 1.3 121.5 486.0 2550.0 -2500.0 CAEN_1_02 02 1 1 01 01 03 02 -1200.0 1.5 1.3 121.5 486.0 2550.0 -2500.0 CAEN_1_03 02 1 1 01 01 03 03 -1200.0 1.5 1.3 121.5 486.0 2550.0 -2500.0 .....................................
Columns have following meaning (NEED CHECK !):
1 - group name (channel name, will be used as part of EPICS channel access variable names) 2 - group number 3 - allow (looks like not in use ?) 4 - ioc number (that number goes to channel name, for example 'CAEN_<ioc number>_02'); that number must be unique for all CLAS IOCs (for example classc12 has ioc number 12 and that number should not be used for any other IOC) 5 - mainframe address (for Lecroy by jumpers, for CAEN by IP, goes to channel name, for example 'CAEN_99_<mainframe address>); output DB files will be splitted based on this number, for example all lines in file 'caen.dat' with this number equal to 4 will be placed to the file 'caen_04.db'; this number have to be used as first parameter in 'sy1527Start()' and 'sy527Start()' calls, although in second case the same number must be in the end of second parameter as well 6 - slot/card number 7 - submodule: this is important code to specify what king of system we have; it must be equal to one of the predefined numbers, which is 2 for Lecroy HV and 3 for CAEN HV 8 - channel number 9 - voltage (demand, V) 10 - mvdz (measured voltage dead-zone, V) 11 - mcdz (measuerd current dead-zone, uA?) 12 - rump up speed, V/s 13 - rump down speed, V/s 14 - tc (trip current, uA?) 15 - maximum voltage (max, V)
Second input file is *.grp, for example caen.grp:
clonpc1:db> more caen.grp 1 CAEN_7 2 CAEN_3 3 CAEN_7 4 CAEN_8 5 CAEN_10
First column is group number and second one is group name. It will be first two columns on medm screen.
Makefile must be manually adjusted for every new *.dat file. It is possible to combine several *.dat file in one - see inside Makefile.
To generate all necessary file type 'make <filename without extension>', for example if file name is 'caen.dat', type:
make caen
Following output fill shows up:
clonpc1:db> make caen ./dat2db.pl caen echo caen | /usr/local/clas/devel/R3.14.8.2/EPICS/app/hvca/bin/hv_adl Input name of hv data file (omit the extension '.dat') : WORKING ON GROUP #1 Initializing variables to default values. Creating file: caen_CAEN_7_1.adl Initializing variables to default values. Creating file: caen_CAEN_7_param_1.adl Initializing variables to default values. Creating file: caen.adl ./dat2req.pl caen chmod +x caen*.csh test -d ../medm/adl || mkdir ../medm/adl test -d ../req || mkdir ../req mv caen*.adl ../medm/adl mv caen*.snap ../req mv caen*.csh ../medm/adl mv caen*.alarms ../medm/adl test -d ../medm/alh || mkdir ../medm/alh mv caen*.alhConfig* ../medm/alh
Following files will be produced:
caen_01.db ../medm/adl/caen.adl .................adl ../medm/alh/caen_CAEN_7.alhConfig ../medm/alh/caen_mf_01_01.alhConfig_mf
For NEW EPICS ONLY copy generated *.db files into final destination where it will be picked up by IOC startup script, for example:
cp caen_01.db $BASEB/src/CAEN_HV/IocShell/ cp caen102_02.db $BASEB/src/CAEN_HV/IocShell/
Create appropriate links to our medm files from standard place:
cd $APP/medm make
Create appropriate links to our alh files from standard place:
cd $APP/alh make
Configuring LAC HV mainframes
LAC's two sectors equiped with four sy527 mainframes. First goto '$APP/hvca/db' and create two *.dat files: traditionally we keep different sectors in separate files. Fragments of those files:
lac1.dat:
LAC_S1_IN_LL_01 01 1 09 01 00 03 00 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_02 01 1 09 01 00 03 01 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_03 01 1 09 01 00 03 02 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_04 01 1 09 01 00 03 03 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_05 01 1 09 01 00 03 04 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_06 01 1 09 01 00 03 05 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_07 01 1 09 01 00 03 06 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_08 01 1 09 01 00 03 07 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_09 01 1 09 01 00 03 08 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_10 01 1 09 01 00 03 09 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_11 01 1 09 01 00 03 10 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_12 01 1 09 01 00 03 11 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_13 01 1 09 01 00 03 12 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_14 01 1 09 01 00 03 13 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_15 01 1 09 01 00 03 14 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_16 01 1 09 01 00 03 15 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_17 01 1 09 01 01 03 00 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_18 01 1 09 01 01 03 01 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_19 01 1 09 01 01 03 02 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_20 01 1 09 01 01 03 03 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_21 01 1 09 01 01 03 04 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_22 01 1 09 01 01 03 05 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_23 01 1 09 01 01 03 06 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LL_24 01 1 09 01 01 03 07 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LS_01 01 1 09 01 01 03 08 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LS_02 01 1 09 01 01 03 09 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LS_03 01 1 09 01 01 03 10 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LS_04 01 1 09 01 01 03 11 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LS_05 01 1 09 01 01 03 12 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_IN_LS_06 01 1 09 01 01 03 13 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 .......................................................................................... LAC_S1_OUT_RS_31 02 1 09 02 07 03 06 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_32 02 1 09 02 07 03 07 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_33 02 1 09 02 07 03 08 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_34 02 1 09 02 07 03 09 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_35 02 1 09 02 07 03 10 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_36 02 1 09 02 07 03 11 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_37 02 1 09 02 07 03 12 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_38 02 1 09 02 07 03 13 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_39 02 1 09 02 07 03 14 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S1_OUT_RS_40 02 1 09 02 07 03 15 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0
lac2.dat:
LAC_S2_IN_LL_01 03 1 09 03 00 03 00 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_02 03 1 09 03 00 03 01 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_03 03 1 09 03 00 03 02 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_04 03 1 09 03 00 03 03 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_05 03 1 09 03 00 03 04 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_06 03 1 09 03 00 03 05 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_07 03 1 09 03 00 03 06 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_08 03 1 09 03 00 03 07 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_09 03 1 09 03 00 03 08 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_10 03 1 09 03 00 03 09 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_11 03 1 09 03 00 03 10 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_12 03 1 09 03 00 03 11 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_13 03 1 09 03 00 03 12 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_14 03 1 09 03 00 03 13 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_15 03 1 09 03 00 03 14 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_16 03 1 09 03 00 03 15 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_17 03 1 09 03 01 03 00 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_18 03 1 09 03 01 03 01 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_19 03 1 09 03 01 03 02 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_20 03 1 09 03 01 03 03 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_21 03 1 09 03 01 03 04 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_22 03 1 09 03 01 03 05 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_23 03 1 09 03 01 03 06 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LL_24 03 1 09 03 01 03 07 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LS_01 03 1 09 03 01 03 08 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LS_02 03 1 09 03 01 03 09 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LS_03 03 1 09 03 01 03 10 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LS_04 03 1 09 03 01 03 11 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LS_05 03 1 09 03 01 03 12 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_IN_LS_06 03 1 09 03 01 03 13 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 .......................................................................................... LAC_S2_OUT_RS_31 04 1 09 04 07 03 06 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_32 04 1 09 04 07 03 07 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_33 04 1 09 04 07 03 08 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_34 04 1 09 04 07 03 09 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_35 04 1 09 04 07 03 10 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_36 04 1 09 04 07 03 11 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_37 04 1 09 04 07 03 12 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_38 04 1 09 04 07 03 13 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_39 04 1 09 04 07 03 14 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0 LAC_S2_OUT_RS_40 04 1 09 04 07 03 15 -1000.0 1.5 1.3 121.5 486.0 2550.0 2500.0
Create lac.grp file:
1 lac_s1_in 2 lac_s1_out 3 lac_s2_in 4 lac_s2_out
In lac1.dat and lac2.dat files we specified group numbers (column 2), IOC number equal to 9 (column 4), mainframe number (column 5) and submodule equal to 3 (column 7). It is important to know that IOC number must be unique for CLAS, two IOCs cannot have the same number. Submodule type corresponds to the type of system, in our case '2' corresponds to LecroyHV, and '3' corresponds to CAEN_HV; we specified '3' which will force usage of the 'CAEN_HV' names in database files (see HV.pm, it is all defined there).
Following fragments were added or modified in Makefile:
LACDATA = lac1.dat lac2.dat
LAC_DB = lac_01.db lac_02.db lac_03.db lac_04.db
all: $(BM_DB) $(BMTASC_DB) $(CCECS_DB) $(CCECN_DB) $(SCF_DB) $(LAC_DB) \ ../medm/adl/cc.adl ../medm/adl/ec.adl \ ../medm/adl/sc.adl ../medm/adl/ta.adl \ ../medm/adl/photon.adl ../medm/adl/bm.adl \ ../medm/adl/lac.adl
lac.dat: $(LACDATA) $(RM) -f lac.dat cat $(LACDATA) > lac.dat
$(RM) -f lac.dat
$(LAC_DB): lac.dat ./dat2db.pl lac
Following fragment was added to the HV.pm:
} elsif( $ioc_id == 9 ) { $detector = "LAC"; }
Type 'gmake clean' and 'gmake': file lac.dat, and then files lac_*.db will be generated.
NOTE: the fact that four *.db files were generated for LAC is defined by *.dat file contents, you have to know file names and number of them to make right dependence in Makefile, it is not automatic
NOTE: currently 'make' will work on Linux only; some bin files ('hv_adl' produced from 'medm/*.c' etc) are machine-dependant and compiled for Linux; current procedure allows to compile for one platform only, it must be fixed
Include LAC into alarm handlers. Makefile in current directory has appropriate target, so just type
gmake alh
Actually it will goto $APP/general/alh and do
gmake hv.alhConfig
which can be done manually as well.
NOTE: what about $APP/general/medm, should we type gmake there ???
Commit all new or modified files to CVS:
cvs up Makefile cvs add lac1.dat lac2.dat lac.grp cvs ci lac1.dat lac2.dat lac.grp Makefile
(to get it from cvs later use command 'cvs update').
Create appropriate links to our medm files from standard place:
cd $APP/medm gmake
Create appropriate links to our alh files from standard place:
cd $APP/alh gmake
Set 'burt' software which will allow to backup and restore HV boards settings. As user 'epics', create directory /home/epics/burt/HV/LAC. Add 'LAC' to the 'DetectorNames' in scripts $APP/hvca/scripts/restore_hv.pl and $APP/hvca/scripts/save_hv_4_det.pl.
NOTE: when IOCs reboots, it maybe good idea to restore voltages from backup, we are not doing that right now; as result, if channel tripped and IOC rebooted in the same time, it will consider tripped channel as normal setting and alarm will not sound; need to discuss it ...
Edit medm script $APP/general/medm/hv_screens.adl to include LAC button. It can be done manually using text editor, or from medm GUI starting it without '-x' flag:
cd $APP/general/medm medm hv_screens.adl
ASK Hovanes !!!