Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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:

TerminalRoleWorking directoryEnvironment
Terminal 1TC-32 emulator (9399)jeonglee_Demo/simulator/No EPICS environment required
Terminal 2Compiled IOC (./st4.cmd, ./st2.cmd)jeonglee_Demo/iocBoot/ioctraining-jeonglee_Demo/source "$TREE/setEpicsEnv.bash"
Terminal 3CA and PVA clientAny directorysource "$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".

  1. In terminal 1 inside jeonglee_Demo/simulator/, start one emulator:

    ./tc32_emulator.bash --port 9399
    

    Wait for Emulator running on port 9399 and leave it running for st4.cmd.

  2. In terminal 2 inside jeonglee_Demo/iocBoot/ioctraining-jeonglee_Demo/, save this complete startup as st4.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
    

    < envPaths reads another IOC shell file. It does not execute an operating-system shell command; lesson 5.4 explains system.

  3. In terminal 2 from that boot directory, start the file:

    chmod +x st4.cmd
    ./st4.cmd
    

    The IOC initializes, prints its clock report, and lists 32 records.

  4. 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:CH32
    

    Each value is between 10 and 90. Stop tc32_emulator.bash with Ctrl+C in terminal 1, stop st4.cmd with exit in terminal 2, then restart ./tc32_emulator.bash --port 9399 and run ./st2.cmd from 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.