Project

General

Profile

EPICS AcnetDeviceRecord

Description

Existing IOCs are likely v3 style IOCs. This wrapper allows one to run an EPICS IOC and have it respond as an acnet device after only a
few changes to configuration files and Makefiles (typical in EPICS builds). No new code or front end is required.

The principle takes advantage of both the new communication protocol (for high rate/high bandwidth data) and structured data which are
available in EPICS v7. Ordinary v3 PVs are mapped to any of the appropriate 13 standard acnet properties of an acnet device in a
substitution file (1 file for each acnet device); these fill a v7 structure which we defined as a new "Fermilab" normative type called
an Acnet Device Record (or ADR). Charlie has modified DPM to unpack these structures thus allowing all existing console applications
to access IOCs completely agnostic to the fact that the front end is an EPICS IOC.

From the EPICS point of view, this is done by including a new acnetPV Module to the IOC in the standard way and customizing substitution
files to map the PVs to the 13 acnet properties. Macro substitution files are commonly used in EPICS to allow reuse of code; as such,
you'll find many substitution files in our repositories and code bases. Note that the burden of ensuring unique PV names is on the
developer. Dummy PVs are provided for acnet devices which don't have all 13 properties.

Another noteworthy point is that one can either:
  • Rebuild an existing IOC by adding this new ADR Module, or
  • Build a new IOC to perform the mapping without having to rebuild an existing IOC (I will provide a template IOC for this).

Steps

In what follows, "myIOC" is the name of the v3 IOC and its TOP directory, namely ./iocTops/myIOC. Let "Z:ADR01" be the name of the
acnet device to which the PVs will be associated. Then the modification steps are as follows; note that there is no specific order,
although steps 2-5 have to be completed before step 6:
1. Create acnet device(s), Z:ADR01 (and others), as normal
2. Add the acnetPV Module by editing the following files:
  • In ./myIOC/configure/RELEASE add line:
    • ACNETPV=$(EPICS_SUPPORT)/acnetPV where EPICS_SUPPORT or SUPPORT points to the Modules directory
3. Add the following to the src Makefile:
  • In ./myIOC/myIOCApp/src/Makefile add the lines for the dbd files:
    • myIOC_DBD += qsrv.dbd
    • myIOC_DBD += PVAServerRegister.dbd
    • myIOC_DBD += addRecordRegister.dbd
    • myIOC_DBD += registerChannelProviderLocal.dbd
    • myIOC_DBD += acnetPV.dbd
    • myIOC_DBD += dbExtra.dbd
  • In ./myIOC/myIOCApp/src/Makefile add the lines for the libraries:
    • myIOC_LIBS += acnetPV
    • myIOC_LIBS += pvDatabase qsrv pvAccessIOC pvAccess pvAccessCA nt pvData pvaClient
  • In ./myIOC/myIOCApp/src/Makefile be certain that the compiler flags include:
    • USR_CXXFLAGS_DEFAULT += -fno-operator-names -pedantic
    • USR_CXXFLAGS += -W -Wall
4. Create the mapping file (the most complicated step) by:
  • Copy from ./Support/acnetPV/acnetPVApp/Db/acnetPV.substitutions to ./myIOC/myIOCApp/Db/ and rename it to ADR01.substitutions.
    • We need to determine how to implement the "X:" part of the acnet device name; I propose that we simply skip the ":" and name the
      files XADR01.substitutions which will correspond to X:ADR01 acnet device.
  • Note that you'll need one for each acnet device being created.
  • Edit the file and replace the "dummy" records with the v3 PVs that you need
  • A description of the replacements is found in the substitution and template
    files :
    ##************************************************************************##
    ##*                                                                      *##
    ##* Use this template to allow substitution files to fill PVs:           *##
    ##*                                                                      *##
    ##* di:   device index          (filled from config DB)                  *##
    ##* ssdn: SSDN of ACNET device  (filled from config DB)                  *##
    ##* node: ACNET trunk/node      (filled from config DB)                  *##
    ##* name: name of ACNET device  (filled from config DB)                  *##
    ##* bdev/bsta/bpp:              ACNET basic status                       *##
    ##* edev/esta/epp:              ACNET extended status                    *##
    ##* ddev/dsta/dpp:              digital alarm block                      *##
    ##* adev/asta/app:              analog alarm block                       *##
    ##* rdev/read/rpp/rtype:        reading value                            *##
    ##* wdev/wrd/wpp/wnelm/wtype:   reading waveform value                   *##
    ##* cdev/ctrl/cpp:              control bits                             *##
    ##* dev/set/pp:                 setting value                            *##
    ##*                                                                      *##
    ##* At present both PV description and engineering units are read from   *##
    ##* from the v3 record and written to the ADR                            *##
    ##*                                                                      *##
    ##* Where  Xdev/xxxx/Xpp (above) is:                                     *##
    ##*        xdev-> IOC family                                             *##
    ##*        xxxx-> PV name                                                *##
    ##*        Xpp -> CP (different IOC) or PP (same IOC)                    *##
    ##*                                                                      *##
    ##* When there are no input PVs, xxxx should be "Xdummy"                 *##
    ##*                                                                      *##
    ##* These macros are defined in the IOC substitution file:               *##
    ##* AcnetDevices.substitutions found in xxx/xxxApp/Db                    *##
    ##*                                                                      *##
    ##************************************************************************##
    ##*                                                                      *##
    ##* PV names should have the form: ACC/EXP-SYS-SUB-NUM:VAR               *##
    ##* where:                                                               *##
    ##*       ACC/EXP is ACC=accelerator (e.g. LIN,BOO,MI )                  *##
    ##*               or EXP=experiment  (e.g. NUMI)                         *##
    ##*       SYS=system (e.g. VAC for vacuum)                               *##
    ##*       SUB=sub-system (e.g. GAUGE,PUMP,VALVE)                         *##
    ##*       NUM=element number (e.g. 01 for pump 1)                        *##
    ##*       VAR=variable being read or written (e.g. PRES for pressure)    *##
    ##* These names will eventually be standardized                          *##
    ##*                                                                      *##
    ##************************************************************************##
    

Explicit examples can be found Z:OUTTMP and Tomco RF Amplifier P:H2RACT and Keithley2700 Flux Gates E:HSTFG3

  • You will need one one such file for each acnet device.
5. Add the following to the Db Makefile:
  • In ./myIOC/myIOCApp/Db/Makefile add the lines to create the db files (one line for each ADR):
    • DB += ADR01.db
6. Build the modified IOC:
  • In ./myIOC run make
  • After build is complete, check that you have the correct db files in ./myIOC/db
  • Check that none of the db files have the exact same name PVs; if they do, modify the substitution files
    and run make again
7. Modify the startup script to load the db files and to create the ADRs:
  • In ./myIOC/iocBoot/iocmyIOC/st.cmd add the lines:
    • dbLoadRecords("db/ADR01.db") -- you'll need to add one for each acnet device
  • In the same file, but after the line with "iocInit", create the ADRs with:
    • createAcnetDeviceRecord Z:ADR01

You are now ready to run your IOC. Once started the PVdata structure(s) you created with the same
name as your acnet device will exist. From the command line, one can monitor the PV with
"pvmonitor Z:ARD01". Any changes to any of the input and output PVs to the ADR, will be displayed
on the screen as well with any acnet application.