Lab #2: IOC Database

EPICS
Lab #2
IOC Database
2003/P571: Lab #2 : IOC Database
1
EPICS
1.
2.
3.
4.
5.
6.
Lab #2 Outline
Look at the example database used for Lab #1
Learn how to use the vdct database editor
Create some new records and functionality
Run the IOC and load the new records
Use cau, probe or edm to test the new functionality
Repeat steps 3-5 until it works
2003/P571: Lab #2 : IOC Database
2
EPICS




Examine yesterday’s database
Use the linux more command (or your favorite text editor)
to look at the file ~/example/db/dbExample1.db
Work out how the $(user):calcExample record field
values configure the record to generate the sawtooth
pattern we saw yesterday
Look at the file ~/example/dbd/example.dbd
Start the IOC by typing
cd ~/example/iocBoot/iocexample
../../bin/linux-x86/example st.cmd


Look at the commands it executed from the st.cmd file,
and what messages were reported
Type help at the epics prompt for a list of commands
2003/P571: Lab #2 : IOC Database
3
EPICS
Example1.db
record(ai, "$(user):aiExample")
{
field(DESC, "Analog input")
field(INP, "$(user):calcExample.VAL
field(EGUF, "10")
field(EGU, "Counts")
field(HOPR, "10")
field(LOPR, "0")
field(HIHI, "8")
field(HIGH, "6")
field(LOW, "4")
field(LOLO, "2")
field(HHSV, "MAJOR")
field(HSV, "MINOR")
field(LSV, "MINOR")
field(LLSV, "MAJOR")
}
2003/P571: Lab #2 : IOC Database
NPP NMS")
4
EPICS
Example1.db (cont’d)
record(calc, "$(user):calcExample")
{
field(DESC, "Counter")
field(SCAN,"1 second")
field(FLNK, "$(user):aiExample")
field(CALC, "(A<B)?(A+C):D")
field(INPA, "$(user):calcExample.VAL
field(INPB, "9")
field(INPC, "1")
field(INPD, "0")
field(EGU, "Counts")
field(HOPR, "10")
field(HIHI, "8")
field(HIGH, "6")
field(LOW, "4")
field(LOLO, "2")
field(HHSV, "MAJOR")
field(HSV, "MINOR")
field(LSV, "MINOR")
field(LLSV, "MAJOR")
}
2003/P571: Lab #2 : IOC Database
NPP NMS")
5
EPICS


How to edit databases in vdct
You can either create a new database file for your PVs or add them
to the file ~/example/db/dbExample1.db
To start vdct:
cd ~/example
vdct &

Select a database definition file:
In the dialog box, select and open dbd/example.dbd
 To modify the existing db/dbExample1.db file:


Use the File/Open menu item, or the left-most toolbar button
Edit away (see Help Topics menu item or vdct manual for keys)
Save the edited (or new) database ...
From file menu, pick Save or Save as

../db/_.db
If you created a new database, edit
~/example/iocBoot/iocexample/st.cmd
and add a line to load your new database.
2003/P571: Lab #2 : IOC Database
6
EPICS


バイナリ入力レコードを追加し、caclExampleレコードの
カウント動作を停止・継続を制御する。
How many other ways can you devise of controlling
whether calcExample cycles or not?




Suggested Database Changes
Adding new records is allowed and even encouraged
Add another binary input record, and some logic to only
permit oscillation when both records are “On”
Extend this so that the sawtooth only stops after the permit
has been withdrawn once its value reaches zero
Replace the sawtooth generator with one that is smoother
(i.e. doesn't just go up in integer steps)
2003/P571: Lab #2 : IOC Database
7
EPICS

Additional Database Exercises
Implement Channel Access Security in your IOC so that only studnt_
can modify studnt_:calcExample.

Create an access security configuration file named rules.cas in
~/ioc/iocBoot/iocexample
UAG(users) {studnt_}
ASG(DEFAULT) {
RULE(1, READ)
RULE(1, WRITE)
}

ASG(SUPERUSER) {
RULE(1, READ)
RULE(1, WRITE) {
UAG(users)
}
}
Add the following line to ~/ioc/iocBoot/iocexample/st.cmd
asSetFilename("rules.cas")


Change studnt_:calcExample.ASG to SUPERUSER.
Add other security conditions as desired.
2003/P571: Lab #2 : IOC Database
8