You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Copied from Controls Software Operations Group's page by Tasha Summers

It typically takes 1 day (week?) to go through the information on this page.

Take your time to go through the details, and follow the links for more information. EPICS is a large and complex toolkit, and this page intends to give you only the most basic understanding of how common variables work. Much more in-depth training on IOC development and fun with records is available to those who need it.

You are ready for the next topic Operator Interface Tools when you have a working softIoc database and a general understanding of what the records are doing.

Running your first database

For this section, and the following Operator Interface Tools, you will copy a set of example files into your own directory to follow along.

Step 1: Copy the example files into your home directory (on lcls-dev3)

# Start from your top-level folder, make an new folder called training and cd into it
cd ~
mkdir training
cd training
# Copy the example files to here
cp $TOOLS/pydm/eed-examples/training/* .
# List the folder contents and make sure there are several files
ll (or ls)

Step 2: Explore and run the EPICS record database

Open the basics.db file with gedit and set the highlighting to 'sh' for readability. Take a look through the comments and records to get an idea of what they are and what they should do. Notice the use of macro variable $(USER). We often use many of these macros, E.g. $(SYS), $(AREA), $(INST) so we can treat the database files like templates. In full IOCs these macros are defined either through 'substitution' files that are expanded as part of the build (make) process, or in the IOC's startup file - but these methods are beyond the scope of this introduction. Instead, we will define the macro when we run this file using the 'softIoc' command.

# When we run the 'softIoc' command below it takes over the terminal so
# you want to keep your other terminal free for other work.
 
# Open a new terminal, ssh to lcls-dev3, cd to the training folder,
# and run the database file with your username as the macro
ssh lcls-dev3
cd training
softIoc -m USER=USERNAME -d basics.db

Now you will be in the EPICS IOC shell, and see 'epics>' as the prompt. Two useful commands to run are 'dbl' and 'dbcar':

# Print out a list of PVs running on the IOC
# copy one of these to use in the next section
epics> dbl
# Print a report of the input and output link status:
epics> dbcar
# To close or exit out of the IOC just hit Ctrl-c

Note that we don't generally do much in the IOC shell - when IOCs are deployed on the controls servers they run in background processes and we only log onto them for debugging and troubleshooting.

Congratulations! Your PVs are now live on the development network! (big grin)

Step 3: Use command line tools to read and write to your PVs

You will only be able to see the PVs while the IOC is running by exiting in the step above your IOC will no longer be running

During this project your IOC shell is only running while you have the softIoc program running, by closing or exiting it you will not be able to find the PVs because the IOC shell is no longer running. In order to see the PVs you will need to open another cmd with the original still in the IOC shell.

EPICS comes with simple command line tools to interact with your PVs.

# Replace the 'MYPV's below with the PV you copied from your IOC
# Read a PV's value on demand:
caget MYPV
# Read the PV's severity field:
caget MYPV.SEVR
# Monitor the PV to write each new value as it comes in:
camonitor MYPV
# Write the value '12' to an Analog Input PV:
caput MYPV 12
# Write a string to a String In PV:
caput MYPV "Here is my string"



  • No labels