EPICS Lab 2 IOC Database 1999Ph 514 Lab
EPICS Lab #2 IOC Database 1999/Ph 514: Lab #2 : IOC Database 1
Lab #2 IOC Database u EPICS Real Life Example #2 : After returning from your vacation, you have an email requesting the following enhancements to the LINAC Control System: u u u u Add Beam Transport Efficiency calculations (and PVs) for FC 1 and FC 2 Provide a PV that allows the operator to enter their name. Display this PV on the medm display labeled “Operator In Charge” Turn off gun and set cathode current to 0 if cathode temperature exceeds 180 degrees Don’t allow the Beam On button to be activated unless the cathode temperature is within range Define an “Open Access” PV which gets its state from a toggle switch Define appropriate records to keep all power supplies at 0 current when in “Open Access” Turn on a warning light when beam reaches either faraday cup. Reflect the amount of beam hitting the faraday cup on the analog gauge. 1999/Ph 514: Lab #2 : IOC Database 2
New PVs u EPICS You can either create a new database file for your PVs or add them to ~/ioc/linac. App/Db/xx. Linac. Sim. db u To start jdct … cd ~/ioc/linac. App/Db jdct & u Load database definition file … From file menu, Open u . . /dbd/linac. App. dbd Save edited (or new) database … From file menu, Save as u . . /linac. App/Db/_. db If you created a new database, edit Makefile. Host and execute gnumake. You must also edit ~/ioc/linac/ioc. Boot/ioclinac/st. cmd to load the new database. 1999/Ph 514: Lab #2 : IOC Database 3
New PVs u Create Beam Transport Efficiency PVs for FC 1 and FC 2 u u EPICS Create a calc record studnt_: FC 1: transport. Ratio. M that provides the required calculation (FC 1/CM 1). Scan it periodically at 1 second. Create a calc record studnt_: FC 2: transport. Ratio. M. that provides the required calculation (FC 2/CM 1). Use the. CP attributes on the input links to have it scan when necessary. Add readouts for these PVs on the medm display Provide a PV that allows the operator to enter their name. Display this PV on the medm display labeled “Operator In Charge” u u Create a stringin record named studnt_: OP: operator. Have the value initialize to “None”. Create a text entry on the medm display for operator entry 1999/Ph 514: Lab #2 : IOC Database 4
Auto-shutdown - gun u Turn off gun and set cathode current to 0 if cathode temperature exceeds 180 degrees u u EPICS Create a calcout record that monitors cathode temperature. When temperature exceeds 180 degrees, have the calcout record force the processing of a sequence record that turns the gun off and sets the cathode current to 0. NOTE : APS is very careful to distinguish between “equipment protective interlocks” and “prudent operating procedures”. We do not rely on EPICS to perform “equipment protective interlocks”. The above example assumes that there is a hardwired interlock protecting the cathode at 190 degrees. 1999/Ph 514: Lab #2 : IOC Database 5
Beam On Inhibit u EPICS Don’t allow the Beam On button to be activated unless the cathode temperature is within range u u u Create a calc record (studnt_: cathode. Temp. Check) whose value is 1 when the cathode temperature is within the appropriate range (140 -160 degrees) and 0 when it is not within range. Set the studnt_: gun. On. C. SDIS to fetch the above record. Set studnt_: gun. On. C. DISV to 0 to disable the record when the cathode temperature is out of range. Does this work as you expect ? 1999/Ph 514: Lab #2 : IOC Database 6
Beam On Inhibit u EPICS Another approach … u u Copy studnt_: gun. On. C to a new PV studnt_: gun. On. Request. C Set the following fields of studnt_: gun. On. Request. C : u u Change the following fields of studnt_: gun. On. C : u u u u . FLNK to studnt_: gun. On. C. SDIS to studnt_: cathode. Temp. Check. VAL. DISV to 0. DOL to studnt_: gun. On. Request. C. OMSL to closed_loop. SDIS to NULL. DISV to 1 Use studnt_: gun. On. Request. C as the operator control on the medm display, but still monitor studnt_: gun. On. C Does this work like you want it to ? What happens if the beam is on and the cathode temperature decreases ? 1999/Ph 514: Lab #2 : IOC Database 7
Beam On Inhibit u EPICS Yet another approach : Use the “Mask” mode of a sequence record to perform a conditional set of operations (i. e turn gun on or reset the request) u Define a calc record (studnt_: gun. On. Request. Check) which yields the following result: u If studnt_: gun. On. Request. C is 0, result is 2 If studnt_: gun. On. Request. C is 1 and studnt_: cathode. Temp. Check is 0, result 1 If studnt_: gun. On. Request. C is 1 and studnt_: cathode. Temp. Check is 1, result 4 u Set. FLNK to studnt_: gun. On. Request. SQ u u u Set studnt_: gun. On. Request. C. SDIS to NULL and studnt_: gun. On. Request. C. DISV u to 1 Define a sequence record (studnt_: gun. On. Request. SQ) as follows : u. SELM = Mask, . SELL to studnt_: gun. On. Request. Check. VAL u u u . DLY 1 = 0. 5, . DOL 1 = 0, . LNK 1 to studnt_: gun. On. Request. C (cancels request). DLY 2 = 0, . DOL 2 = 0, . LNK 2 to studnt_: gun. On. C to 0 (turns gun off). DLY 3 = 0, . DOL 3 = 1, . LNK 3 to studnt_: gun. On. C to 0 (turns gun on) 1999/Ph 514: Lab #2 : IOC Database 8
Open Access Mode u Add a PV to monitor an “access mode” switch u Create a bi record named studnt_: access. Mode. u u EPICS . DTYP : Bitbus Device. INP : #L 0 N 1 P 0 S 0 @. ZNAM : Open Access , . ONAM : No Access Keep all power supplies at 0 current if toggle switch is in “Open Access” u u Create a calcout record (studnt_: ps. Hold. Off. CO) that forces the processing of a sequence record (studnt_: ps. Hold. Off. SQ ) if the toggle switch is in the “Open Access” state. Define the sequence record studnt_: ps. Hold. Off. SQ to hold the set current of all power supplies to 0. Forward link to another sequence record that finishes the job. Decide on the appropriate way to process these records. 1999/Ph 514: Lab #2 : IOC Database 9
Beam Alert u EPICS Provide an indication on the I/O panel when beam reaches either faraday cup u Define a binary output record (studnt_: beam. Present. Led. C) to turn on an LED u u Define an analog output record (studnt_: beam. Present. Meter. C) to drive the panel meter u u u DTYP : Bitbus Device OUT : #L 0 N 1 P 0 S 3 @ ZNAM : No Beam ONAM : Beam On DTYP : Bitbus Device OUT : #L 0 N 1 P 0 S 0 @ EGUF : 20 EGUL : 0 Define two calcout records to drive the above records based on the current present at the faraday cups. EXTRA CHALLENGE : Enhance the above implementation by blinking the light if the beam at the faraday cup exceeds 5 m. A (Hint : this can be done by adding one record). 1999/Ph 514: Lab #2 : IOC Database 10
Additional Database Exercises u Rate-of-change on ao record u u EPICS Monitor studnt_: BM 1: set. Current. C. OVAL (with medm or probe) while changing studnt_: BM 1: set. Current. C. VAL. Set studnt_: BM 1: set. Current. C. OROC to 10. Set studnt_: BM 1: set. Current. C. SCAN to '1 second'. Monitor studnt_: BM 1: set. Current. C. OVAL again while changing studnt_: BM 1: set. Current. C. VAL. Create a record that indicates when studnt_: BM 1: set. Current. C has not reached its setpoint (i. e. indicates that it is still ramping). Indicate this on the medm display with a yellow box around the set point text entry. I/O Panel - (Make sure these don't interfere with the other uses of the I/O panel) u u Create the necessary records so three LEDs on the I/O panel (0, 1, 2) count in binary while switch 0 is on and stop counting when the switch is off. Create the necessary records so the meter follows the potentiometer when all switches are on. 1999/Ph 514: Lab #2 : IOC Database 11
Additional Database Exercises u EPICS Implement Channel Access Security such that only studnt_ can control studnt_: BM 1: set. Current. C. u Create an access security configuration file named CA_ACCESS in ~/ioc. Boot/ioclinac/. UAG(users) {studnt_} ASG(DEFAULT) { RULE(1, READ) RULE(1, WRITE) } u ASG(SUPERUSER) { RULE(1, READ) RULE(1, WRITE) { UAG(users) } } Add the following lines in ~/ioc. Boot/ioclinac/st. cmd cd startup as. Set. Filename("CA_ACCESS") u u Change studnt_: BM 1: set. Current. C. ASG to SUPERUSER. Add other security conditions as desired. 1999/Ph 514: Lab #2 : IOC Database 12
- Slides: 12