An e3 IOC¶
The following assumes that you already have EPICS base, require (3.3.0
or
later as the module version has been left out in the require
call1),
and iocStats installed.
An IOC in e3 is typically (minimally) just a startup script which is passed to
softIocPVA
.2
Create the startup script¶
A very minimal startup script to illustrate what a ‘typical’ IOC in e3 looks like:
[iocuser@host:~]$ touch st.cmd
[iocuser@host:~]$ echo "require iocstats" >> st.cmd # iocInit() is called implicitly
Start the IOC¶
[iocuser@host:~]$ /opt/epics/base-7.0.6.1/require/4.0.0/bin/iocsh st.cmd
Note
In require 4.0.0, the startup utility was renamed to iocsh
. If you are
using an older version of require, you should use iocsh.bash
instead.
Conventions¶
To set correct PV names, the environment variable $IOCNAME
must be set before
starting your IOC. (where the easiest option is to just write
export IOCNAME=yourIocName
prior to starting the IOC).
Thus you may end up with something like the following:
Directory¶
[iocuser@host:~]$ tree e3-ioc-test
e3-ioc-test
├── README.md
├── env.sh # depending on the version of require you are using
└── st.cmd
Startup script (st.cmd
)¶
[iocuser@host:~]$ cd e3-ioc-test
[iocuser@host:e3-ioc-test]$ cat st.cmd
require common
require module
epicsEnvSet(${IOCNAME}, "${IOCNAME:NoName}")
iocshLoad(${module_DIR}snippet.iocsh, "IOCNAME=${IOCNAME}")
iocInit()
dbl > PVs.list
date
Note
Note that st.cmd
must end with a newline—this will be explained in
The require module.
- 1
In version 3.3.0 of require, version pinning became optional; i.e. from
require MODULE,MODULE_VERSION
torequire MODULE[,MODULE_VERSION]
.- 2
ESS only uses EPICS base 7 for production, and thus only uses
softIocPVA
. Earlier iterations of e3 also supported use ofsoftIoc
, but that functionality has been removed from scope.