Run Control of Multiple Event Builders


The aim of the Run Control of the Event Builders is to have a central control and monitoring system for all Event Builders. The Run Control system was implemented using EPICS software tools. The GUI was made using MEDM.


  • CVS Root:
  • CVS Repository: ebctrl

ebctrl consists of two directories:
  • ioc - the IOC software itself
  • mon - contains the adl files for MEDM GUI

Everything below is written for a given linux-x86 architecture. If your host has 64-bit architecture you should replace linux-x86 by linux-x86_64.

Installation guide:
  • login to SCS account
  • EPICS Base must be installed on the machine!
  • check if the following settings are done:
    • export EPICS_HOST_ARCH=linux-x86
    • export EPICS_BASE=/home/scs/base-3.14.9
    • export PATH=$EPICS_BASE/bin/linux-x86:$PATH
  • checkout ebctrl module from CVS
  • cd ioc
  • configure IOC as master/slave
    • edit line epicsEnvSet(EBTYPE,"slave") in iocBoot/iocebctrl/st.cmd
  • In iocBoot/iocebctrl/st.cmd give proper Event Builder number (edit second argument) for the data bases:
    • dbLoadRecords("db/evtbuild.db","eb=eb01")
    • dbLoadRecords("db/netmem.db","eb=eb01")
    • dbLoadRecords("db/genrunid.db","eb=eb01")
  • make sure that up-to-date versions of libcompat.a and libhadaq.a are placed in ioc/lib/linux-x86/.
  • make

How to execute:
  • First open permissions to the shared memory: chmod 775 /dev/shm/*.shm
  • cd iocBoot/iocebctrl
  • ../../bin/linux-x86/ebctrl st.cmd

How to execute in screen:
  • cd iocBoot/iocebctrl
  • screen -dmS ioc ../../bin/linux-x86/ebctrl st.cmd

Possible problems

Compilation of Base fails

  • Error: readline/readline.h: No such file or directory
  • Reason: libreadline5-dev is missing, install with apt-get

Compilation of IOC fails

  • Error: /home/scs/ebctrl/ioc/lib/linux-x86_64/libhadaq.a(worker.o): In function `Worker_addStatistic': /home/hadaq/yurevich/dev/hadaq/worker.c:366: undefined reference to `SYSLOG_syslog' collect2: ld returned 1 exit status
  • Reason: libcompat.a is missing in ioc/lib/linux-x86_64/.

Messages after execution of IOC

  • In case of several IOCs running on the same host you can see the following messages: (EPICS_CA_ADDR_LIST=
       cas warning: Configured TCP port was unavailable.
       cas warning: Using dynamically assigned TCP port 45352,
       cas warning: but now two or more servers share the same UDP port.
       cas warning: Depending on your IP kernel this server may not be
       cas warning: reachable with UDP unicast (a host's IP in EPICS_CA_ADDR_LIST)
       iocRun: All initialization complete
  • Solution: For the newer versions of base this is not a problem. You should not set unicast IP on CA Client (MEDM) side for EPICS_CA_ADDR_LIST variable. You must set EPICS_CA_ADDR_LIST to multicast or broadcast like EPICS_CA_ADDR_LIST=

Requirements for Parallel Event Building

  • Identical RUN Id for all Event Builders.
    • This is achieved by a master IOC which generates and distributes RUN Id to all Event Builders via slave IOCs
    • Master IOC generates RUN Id from the time in seconds since the Epoch minus offset (subtraction of the offset is needed to fit the RUN Id to INT)
  • Synchronization of the Event Builders.
    • Synchronization is achieved again by the RUN Id: each time the RUN Id changes the Event Builder closes the current file and opens new file with newly generated RUN Id. File names consist of the time extracted from the RUN Id and an Event Builder number (the only different part of the file name between the Event Builders).
             File name format: "%y%j%H%M%S" where  %y : year (00-99), %j : day of year (001-366), %H : hour (00-23),
                                                   %M : minute (00-59), %S : second (00-59)


IOC has three data bases located in ebctrlApp/Db/
  • evtbuild.db - records for EB Process Variables
    • ebctrlApp/src/evtbuild.c - subroutine to access EB PVs
    • ebctrlApp/src/writerunid.c - subroutine to write RUN Id to shared memory
  • netmem.db - records for
    • ebctrlApp/src/netmem.c - subroutine to access
  • genrunid.db - record for generated RUN Id
    • ebctrlApp/src/genrunid.c - subroutine to generate RUN Id

IOC talks to Event Builder and
via shared memory segments. To make this interprocess communication possible I used functionality provided by libhadaq.a library. Up-to-date version of the library must be located in lib/linux-x86/libhadaq.a. Additionally libcompat.a must be also located in lib/linux-x86/ since libhadaq.a depends on libcompat.a.

A graphical representation of a composition of the EPICS databases is given in the link:ebctrl_vdct.pdf

  • The following picture shows all the relations between different components of the Control and Monitoring system.
IOC master/slave scheme


GUI is implemented using MEDM. Three adl files can be found in the repository ebctrl under the directory mon. GUI displays all the relevant information concerning the performance of the EB and
. The status of all the EBs is also shown.

How to execute:
  • export EPICS_CA_ADDR_LIST=
  • For many Event Builders: medm -x -macro "SUBSYSNUM=40" eballctrl.adl
  • For one Event Builder: medm -x -macro "EB=01,SUBSYSNUM=20" ebctrl.adl

  • general MEDM pannel: three event builders are active.
    EB MEDM pannel

  • EB MEDM pannel: cartesian plot shows fill levels of the opened buffers for EB and

    EB MEDM pannel

  • NetMem
    MEDM pannel:
    EB MEDM pannel

-- SergeyYurevich - 08 Apr 2010
I Attachment Action Size Date Who Comment
ebctrl100.pngpng ebctrl100.png manage 11 K 2008-07-14 - 20:12 SergeyYurevich EB MEDM pannel
ebctrl_vdct.pdfpdf ebctrl_vdct.pdf manage 26 K 2008-07-25 - 16:22 SergeyYurevich graphical representation of databases done with Visual DCT
ebioc_crop.pngpng ebioc_crop.png manage 30 K 2008-07-14 - 15:47 SergeyYurevich IOC master/slave scheme
evtbuildall_mon.pngpng evtbuildall_mon.png manage 14 K 2008-07-14 - 20:11 SergeyYurevich general pannel (MEDM)
netmem100.pngpng netmem100.png manage 14 K 2008-07-14 - 20:50 SergeyYurevich NetMem MEDM pannel
Topic revision: r9 - 2010-04-08, SergeyYurevich
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki Send feedback | Imprint | Privacy Policy (in German)