Epics Front-End
From tigwiki
Contents |
[edit] Introduction
There are many MIDAS clients out there that will transfer data back and forth between MIDAS and EPICS. The main needs for this in a TIGRESS experiment are a) providing ISAC beam delivery group and operations a real-time quantitative measure of how much beam is getting to us, b) monitoring accelerator and beamline device parameters that might be of interest in (later) analyzing the experimental data.
The version described here allows up to 20 channels for transferring somewhat arbitrary MIDAS data to EPICS and vice versa. The MIDAS data source is now configurable through ODB entries rather than through hard-coding.
It is assumed that the reader has working experience with MIDAS and EPICS, in particular knows how to find and set MIDAS Online Database (ODB) entries, i.e. things with names like /Equipment/MCS/Variables/MCS2[10]. It is also assumed that the user has made EPICS strip-tools in the past, and as such, has exposure to EPICS "Process Variable", or PVs, i.e. things with names like SEBT3A:SK6:RDCURL or 8PI:SCLR:VAR1.
[edit] Configuration
All the configuration is done through entries in Equipment/Epics/Settings. There are several entries which are arrays of 20 values, one for each available channel. These variables are defined as follows:
- /Equipment/Epics/Settings/Keys[]: Names of ODB entry data sources, for ODB-to-PV transfers.
- /Equipment/Epics/Settings/Names[]: Describes the value on this channel (e.g. detector count rate). This name will (for example) show up in the legend of a Striptool.
- /Equipment/Epics/Settings/Devices/Epics/Channel name[]: Name of the PV. If there is a corresponding entry in Keys[], then that data is written to the PV. Under any circumstance the value of that PV is read (back) into MIDAS.
The other variables, Channels/Epics and Update Threshold Measured -- well, I just don't know what they do.
[edit] Running
See the Starting and Stopping the MIDAS Clients page for up-to-date information specific to the TIGRESS experiment.
[edit] Where the data goes
As noted before, if there is a non-blank entry in /Equipment/Epics/Settings/Keys[i], then the data in the ODB entry named in that Key is transferred to the PV in /Equipment/Epics/Settings/Devices/Epics/Channel name[i]. In fact the data is first transferred to an entry /Equipment/Epics/Settings/Demand[i]; the MIDAS Epics device driver takes care of it from there. After all the Demanded data has been sent, the device driver reads back the PVs and puts the results in /Equipment/Epics/Settings/Measured[i].
This data can also be written to the data stream with appropriate settings of /Equipment/Epics/Common variables. The MSRD banks contain the data that have been read back from the EPICS PVs. As of the initial writing of this document, the MSRD banks were included in events of ID 5. See the Examples section for an example of how to configure the Common variables and what an mdump of the event looks like.
Technical Details and To-Do List
- So far this is limited to DWORD (aka INT) and FLOAT ODB data sources.
- Keep the Names entries under 24 characters long or the Logger will crash and will refuse to restart until you fix it.
- Source code can be found at (for example) amelie.triumf.ca:/home/tigress/tigcol2/epics .
Example Configuration The first listing is a sample result of the ODB command ls -lr /Equipment/Epics/Settings during setup for E1069. The /Equipment/MCS/Variables/MCS2[] ODB entries are the contents of the latest bank read out from an SIS3820 VME scaler. Selected contents of the MCS2 banks are written to virtual PVs 8PI:SCLR:VARxx. The cyclotron current is read from the PV CCS2BL2A:BL2ACURRENT into the ODB at /Equipment/Epics/Variables/MSRD[16].
Key name Type #Val Size Last Opn Mode Value
---------------------------------------------------------------------------
Settings DIR
Channels DIR
Epics INT 1 4 20h 0 RWD 20
Devices DIR
Epics DIR
Channel name STRING 20 32 3h 0 RWD
[0] 8PI:SCLR:VAR1
[1] 8PI:SCLR:VAR2
[2] 8PI:SCLR:VAR3
[3] 8PI:SCLR:VAR4
[4] 8PI:SCLR:VAR5
[5] 8PI:SCLR:VAR6
[6] 8PI:SCLR:VAR7
[7] 8PI:SCLR:VAR8
[8] 8PI:SCLR:VAR9
[9] 8PI:SCLR:VAR10
[10] 8PI:SCLR:VAR11
[11] 8PI:SCLR:VAR12
[12] 8PI:SCLR:VAR13
[13] 8PI:SCLR:VAR14
[14] 8PI:SCLR:VAR15
[15] 8PI:SCLR:VAR16
[16] CCS2ISAC:BL2ACURRENT
[17] 8PI:SCLR:VAR18
[18] 8PI:SCLR:VAR19
[19] 8PI:SCLR:VAR20
Names STRING 20 32 3h 1 RWD
[0] Beam Dump Scintillator
[1] not connected
[2] Dn Si Sect 1-8 TIG36
[3] Dn Si Sect 9-16 TIG37
[4] Dn Si Sect 17-24 TIG38
[5] Dn Si Sect 25-32 TIG39
[6] Dn Si Ring 1-8 TIG40
[7] Dn Si Ring 17-24 TIG42
[8] Up Si Sect 1-8 TIG43
[9] Up Si Sect 9-16 TIG44
[10] Up Si Ring 1-8 TIG45
[11] Si Quadrant TIG39
[12] Aries Blue Ge TIG0
[13] Si Inner Ring TIG40
[14] not connected
[15] not connected
[16] Beamline 2A Current
[17] do not use
[18] do not use
[19] do not use
Update Threshold Measured FLOAT 20 4 3h 0 RWD
[0] 1
[1] 1
[2] 1
[3] 1
[4] 1
[5] 1
[6] 1
[7] 1
[8] 1
[9] 1
[10] 1
[11] 1
[12] 1
[13] 1
[14] 1
[15] 1
[16] 1
[17] 1
[18] 1
[19] 1
Keys STRING 20 100 20h 0 RWD
[0] /Equipment/MCS/Variables/MCS2[28]
[1] /Equipment/MCS/Variables/MCS2[28]
[2] /Equipment/MCS/Variables/MCS2[16]
[3] /Equipment/MCS/Variables/MCS2[17]
[4] /Equipment/MCS/Variables/MCS2[18]
[5] /Equipment/MCS/Variables/MCS2[19]
[6] /Equipment/MCS/Variables/MCS2[20]
[7] /Equipment/MCS/Variables/MCS2[22]
[8] /Equipment/MCS/Variables/MCS2[23]
[9] /Equipment/MCS/Variables/MCS2[24]
[10] /Equipment/MCS/Variables/MCS2[25]
[11] /Equipment/MCS/Variables/MCS2[27]
[12] /Equipment/MCS/Variables/MCS2[0]
[13] /Equipment/MCS/Variables/MCS2[1]
[14] /Equipment/MCS/Variables/MCS2[6]
[15] /Equipment/MCS/Variables/MCS2[17]
[16]
[17]
[18]
[19]
This second listing is the contents of /Equipment/Epics/Common from the same run. In this case the data is being written to MIDAS events of ID 5, once per second. There is also the output of an mdump of ID 5. Exercise to reader: See if you can find where a current of 70.1 uA is reported.
[local:tigress:R]/>ls /equipment/Epics/Common/ Event ID 5 Trigger mask 0 Buffer SYSTEM Type 8 Source 0 Format MIDAS Enabled y Read on 511 Period 1000 Event limit 0 Num subevents 0 Log history 1 Frontend host isdaq08.triumf.ca Frontend name Epics Frontend file name frontend.c [local:tigress:R]/>q 6:48:56pm tigress@midtig02:~% mdump -i 5 -1.9.5 -- Enter <!> to Exit ------- Midas Dump --- ------------------------ Event# 1 ------------------------ Evid:0005- Mask:0000- Serial:8265- Time:0x47521d1d- Dsize:184/0xb8 #banks:2 - Bank list:-DMNDMSRD- Bank:DMND Length: 80(I*1)/20(I*4)/20(Type) Type:Real*4 (FMT machine dependent) 1-> 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 1.700e+01 0.000e+00 9-> 1.700e+01 0.000e+00 0.000e+00 0.000e+00 4.400e+01 1.496e+03 1.157e+03 0.000e+00 17-> 0.000e+00 0.000e+00 0.000e+00 0.000e+00 Bank:MSRD Length: 80(I*1)/20(I*4)/20(Type) Type:Real*4 (FMT machine dependent) 1-> 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 1.700e+01 0.000e+00 9-> 1.700e+01 0.000e+00 0.000e+00 0.000e+00 3.200e+01 1.309e+03 1.174e+03 0.000e+00 17-> 7.010e+01 0.000e+00 0.000e+00 0.000e+00 6:49:01pm tigress@midtig02:~%

