This page describes the detailed IOC startup structure and the main classic entry points. If you want the shortest current path for a new configuration, start with Quickstart and Examples first. If any naming is unclear, see Terminology.
ECMC Engineering Studio brings together IOC configuration, virtual commissioning and online diagnostics in a single engineering environment. It works with the existing ECMC, ECMCCFG and ECMCCOMP framework and uses the same startup scripts and YAML configuration files for real and simulated systems.
See also Simulation backend and ecmc_cfg_tool for the runtime tools.
For a schematic of the EPICS, realtime-engine and EtherCAT layers, see How the layers fit together.
EtherCAT requires the field bus components (slaves) to be configured on the master. The master must know about the data exchanges with the slaves, this is referred to as process image.
During IOC-startup, the requested configuration is validated against the actually present hardware on the bus. Mismatches will result in an error, the IOC will not start.
Blindly restarting the IOC with only partially working EtherCAT hardware will result in an inoperable IOC. If troubleshooting is needed then check the knowledge base.
The startup script has several steps:
require ecmccfgrequire ecmccfg <VERSION>
Each slave on the field bus must be configured for use with ECMC. For this purpose scripts can be called for:
In addition to the ecmccfg scripts, the ecmccomp component library can also be used.
Settings are then applied with applyComponent.cmd, see the examples below.
The addSlave is used for simple slaves, a default configuration is automatically applied.
In addition default PVs will be created for the basic slave features, i.e. status.
Most slaves also have PVs created matching the purpose, i.e. inputs will have bi records, outputs will have bo records for each channel.
This behavior can be modified by arguments.
add a coupler and slaves
# slave 0 {EK1100}
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EK1100"
# SLAVE_ID is automatically incremented
# slave 1 {EL1018}
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1018"
# skip slaves 2..6
# slave 7 {EL2008}, with optional SLAVE_ID
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL2008, SLAVE_ID=7"
# slave 9 {EL2008}, with optional SLAVE_ID and P_SCRIPT
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL2008, SLAVE_ID=9, P_SCRIPT=mXsXXX"
# slave 10 {EL3204}, without default substitutions or slave-status PVs
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL3204, DEFAULT_SUBS=false, DEFAULT_SLAVE_PVS=false"
add more slaves and apply configuration to the slaves
# slave 8 {EL7037}, configure slave using applyComponent.cmd from ecmccomp module with optional SLAVE_ID.
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7037, SLAVE_ID=8"
${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000, I_STDBY_MA=500, U_NOM_MV=48000, R_COIL_MOHM=1230'"
# slave 9 {EL7037}, addSlave, with immediate call off applySlaveConfig
# slave with global configuration
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7037"
${SCRIPTEXEC} ${ecmccfg_DIR}applySlaveConfig.cmd, "CONFIG=-Motor-Nanotec-ST4118L1804-B"
# slave with local configuration, in this case provided by the module `ECMC_AGIR`
epicsEnvSet("CFG_ROOT", "${ECMC_AGIR_DIR}/")
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EP7211-0034_ALL"
${SCRIPTEXEC} ${ecmccfg_DIR}applySlaveConfig.cmd, "LOCAL_CONFIG=${CFG_ROOT}AM8211_AGIR.cfg"
Optionally, manual modifications can be made to the default configuration.
In order to manually set binaryOutput01 to 1 at startup, the following can be added to the startup script.
ecmcConfigOrDie "Cfg.WriteEcEntryIDString(${ECMC_EC_SLAVE_NUM_DIG_OUT},binaryOutput01,1)"
ecmcConfigOrDie "Cfg.WriteEcEntryEcPath(ec0.s${ECMC_EC_SLAVE_NUM_DIG_OUT}.binaryOutput12,1)"
Axis configuration is explained in detail in the motion configuration section.
The preferred way to configure axes is with the yaml based configuration.
It unifies the way (1) physical axes, (2) virtual axes and (3) synchronization is handled.
YAML and classic loaders create the same native objects. Prefer one axis
configuration path per axis; avoid configuring the same axis twice. Use
loadYamlEnc.cmd to add further encoders to the currently configured axis.
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=./cfg/ax1.yaml, DEV=${DEV}, DRV_SLAVE=4, ENC_SLAVE=3, ENC_CHANNEL=01"
epicsEnvSet("DEV", "STEST-MYDEVICE")
${SCRIPTEXEC} ${ecmccfg_DIR}configureAxis.cmd, "CONFIG=./cfg/axis_1"
See motion best practice and axis YAML for more information.
Use loadYamlAxis.cmd with axis.type: virtual (or end_effector) for new
configurations. The YAML loader handles its encoder/trajectory sources and
optional axis PLC. The classic equivalent below remains available:
${SCRIPTEXEC} ${ecmccfg_DIR}configureVirtualAxis.cmd, "CONFIG=./cfg/axis_11_virt"
See motion best practice and axis YAML for more information.
${SCRIPTEXEC} ${ecmccfg_DIR}applyAxisSynchronization.cmd, "CONFIG=./cfg/axis_1_sync"
${SCRIPTEXEC} ${ecmccfg_DIR}applyAxisSynchronization.cmd, "CONFIG=./cfg/axis_11_sync"
See motion best practice and axis YAML for more information.
The PLC functionality is explained in detail in the PLC configuration section. ECMC PLCs can be loaded from classical PLC files, from pure yaml files or from a yaml/PLC hybrid.
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "PLC_ID=0, FILE=./plc/homeSlit.plc, SAMPLE_RATE_MS=100"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlPlc.cmd, "FILE=./plc1.yaml"
file key in yaml config will overwrite anything in the code key!${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlPlc.cmd, "FILE=./plc1File.yaml"
See the PLC configuration section for syntax, variables, patterns, and function reference, and PLC best practice for recommended structure and EPICS variable mapping.
require ecmccfg registers finalize.cmd through atInit. That hook applies
the configured I/O and starts ECMC when the IOC is initialized. A shell prompt
by itself does not show that initialization happened: look for iocRun: All initialization complete. Some launchers invoke iocInit automatically; others
expect it in the startup script. See startup ordering and readiness
for START_EPICS_FIRST and the motion startup gate.
For SIM=1, slave declarations build memory-backed I/O rather than verifying a
physical bus. An external model must provide feedback. This differs from
MASTER_ID=-1, which omits the EtherCAT master. See Simulation backend.