5.1 Compare IOC shell command styles
Run the Chapter 4 temperature IOC with space-separated commands and compare its records with the function-style startup. Both forms call the same IOC shell commands.
Complete Generate and load 32 channel records
first and stop any IOC or simulator using port 9399. Open three Bash
terminals on the same host with these roles and settings:
| Terminal | Role | Working directory | Environment |
|---|---|---|---|
| Terminal 1 | TC-32 emulator (9399) | jeonglee_Demo/simulator/ | No EPICS environment required |
| Terminal 2 | Compiled IOC (./st4.cmd, ./st2.cmd) | jeonglee_Demo/iocBoot/ioctraining-jeonglee_Demo/ | source "$TREE/setEpicsEnv.bash" |
| Terminal 3 | CA and PVA client | Any directory | source "$TREE/setEpicsEnv.bash", export EPICS_CA_AUTO_ADDR_LIST=NO EPICS_CA_ADDR_LIST=127.0.0.1, export EPICS_PVA_AUTO_ADDR_LIST=NO EPICS_PVA_ADDR_LIST=127.0.0.1 |
In each EPICS terminal, set TREE to your installation path from
lesson 1.1 (such as
"$HOME/epics/1.5.0/debian-13/7.0.10") before running
source "$TREE/setEpicsEnv.bash".
-
In terminal 1 inside
jeonglee_Demo/simulator/, start one emulator:./tc32_emulator.bash --port 9399Wait for
Emulator running on port 9399and leave it running forst4.cmd. -
In terminal 2 inside
jeonglee_Demo/iocBoot/ioctraining-jeonglee_Demo/, save this complete startup asst4.cmd:#!../../bin/linux-x86_64/jeonglee_Demo on error break < envPaths epicsEnvSet "DB_TOP" "$(TOP)/db" epicsEnvSet "STREAM_PROTOCOL_PATH" "$(DB_TOP)" epicsEnvSet "IOCNAME" "training-jeonglee_Demo" epicsEnvSet "IOC" "ioctraining-jeonglee_Demo" dbLoadDatabase "$(TOP)/dbd/jeonglee_Demo.dbd" jeonglee_Demo_registerRecordDeviceDriver pdbbase drvAsynIPPortConfigure "LocalTCPServer" "127.0.0.1:9399" 0 0 0 asynOctetSetInputEos "LocalTCPServer" 0 "\n" asynOctetSetOutputEos "LocalTCPServer" 0 "\n" dbLoadRecords "$(DB_TOP)/TC-32.db" "P=MYDEMO:,R=TC32:,PORT=LocalTCPServer" iocInit ClockTime_Report dbl< envPathsreads another IOC shell file. It does not execute an operating-system shell command; lesson 5.4 explainssystem. -
In terminal 2 from that boot directory, start the file:
chmod +x st4.cmd ./st4.cmdThe IOC initializes, prints its clock report, and lists 32 records.
-
In terminal 3, direct CA and PVA searches to loopback and read several channels:
export EPICS_CA_AUTO_ADDR_LIST=NO EPICS_CA_ADDR_LIST=127.0.0.1 export EPICS_PVA_AUTO_ADDR_LIST=NO EPICS_PVA_ADDR_LIST=127.0.0.1 caget MYDEMO:TC32:CH01 MYDEMO:TC32:CH10 MYDEMO:TC32:CH32Each value is between
10and90. Stoptc32_emulator.bashwith Ctrl+C in terminal 1, stopst4.cmdwithexitin terminal 2, then restart./tc32_emulator.bash --port 9399and run./st2.cmdfrom the same boot directory to repeat the read. Both startups expose the same 32 names and units; temperatures vary.
Finish the comparison by stopping tc32_emulator.bash in terminal 1 with
Ctrl+C and then entering exit in terminal 2.
Command syntax reference
These forms set the same environment variable:
epicsEnvSet("DEVICE", "TC32:")
epicsEnvSet "DEVICE" "TC32:"
Quote arguments containing spaces. In dbLoadRecords, comma-separated
macro assignments remain inside one quoted argument in either style.