Skip to content
Snippets Groups Projects
ReadMe.md 4.79 KiB
Newer Older
# ecmccfg
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
A configuration framework for ECMC Motion Control Module for EPICS.

Niko Kivel's avatar
Niko Kivel committed
## License
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
## Build
by default this module is only build for RHEL7 and Epics >=R7.0.4
```bash
make [LIBVERSION] [clean] install
```
Niko Kivel's avatar
Niko Kivel committed
check the module loads for version `dev`, Epics `R7+` and ECMC version `dev`, note `MASTER_ID=-1` which runs ECMC in master-less mode.
Make proper adjustements to match your needs in terms of versions.
Niko Kivel's avatar
Niko Kivel committed
```bash
Niko Kivel's avatar
Niko Kivel committed
iocsh -7 -r "ecmccfg,dev 'ECMC_VER=dev,MASTER_ID=-1'"
Niko Kivel's avatar
Niko Kivel committed
```
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
## Purpose

Niko Kivel's avatar
Niko Kivel committed
The configuration framework contains the necessary files to configure an EPICS IOC for EtherCAT based motion control and DAQ.
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
## provided common user commands
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
* addAxis.cmd
* addDataStorage.cmd
* addMaster.cmd
* addSlave.cmd
* addSlaveKL.cmd
* addVirtualAxis.cmd
* applyAxisSynchronization.cmd
* applyConfig.cmd
* applySlaveConfig.cmd
* configureAxis.cmd
* configureSlave.cmd
* configureVirtualAxis.cmd
* loadPLCFile.cmd
* loadPlugin.cmd
* setAppMode.cmd
* setDiagnostics.cmd
Niko Kivel's avatar
Niko Kivel committed

## Example IOC

Niko Kivel's avatar
Niko Kivel committed
1.  `require` the configuration module with optional version
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  require ecmccfg <VERSION>
  ```
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
2.  add a coupler and slave
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  # slave 0 {ecmcEK1100}
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addSlave.cmd,       "HW_DESC=EK1100"
  # SLAVE_ID is automatically incremented
  # slave 1 {ecmcEL1018}
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addSlave.cmd,       "HW_DESC=EL1018"
  # skip slaves 2..6
  # slave 7 {ecmcEL2008}, with optional SLAVE_ID
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addSlave.cmd,       "HW_DESC=E2008, SLAVE_ID=7"
  #-- ATTENTION, this only work for certain slaves, as the EPICS templates have to be migrated before
  # slave 9 {ecmcEL2008}, with optional SLAVE_ID and P_SCRIPT
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addSlave.cmd,       "HW_DESC=E2008, SLAVE_ID=7, P_SCRIPT=mXsXXX"
  ```
Niko Kivel's avatar
Niko Kivel committed
3.  add more slaves and apply configuration to the slaves
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  # slave 8 {ecmcEL7037}, configure slave with optional SLAVE_ID
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}configureSlave.cmd, "HW_DESC=EL7037, CONFIG=-Motor-Nanotec-ST4118L1804-B, SLAVE_ID=8"
  # slave 9 {ecmcEL7037}, addSlave, with immediate call off applySlaveConfig
  # slave with global configuration
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addSlave.cmd,       "HW_DESC=EL7037"
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}applySlaveConfig,   "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} ${ECMC_CONFIG_ROOT}addSlave.cmd,       "HW_DESC=EP7211-0034_ALL"
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}applySlaveConfig.cmd, "LOCAL_CONFIG=${CFG_ROOT}AM8211_AGIR.cfg"
  ```
Niko Kivel's avatar
Niko Kivel committed

4.  apply the configuration
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}applyConfig.cmd
  ```
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
5. additional configuration
Niko Kivel's avatar
Niko Kivel committed

  manually set `binaryOutput01` to `1`

  ```bash
  ecmcConfigOrDie "Cfg.WriteEcEntryIDString(${ECMC_EC_SLAVE_NUM_DIG_OUT},binaryOutput01,1)"
  ```
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
6. adding a physical motor axis
Niko Kivel's avatar
Niko Kivel committed

  * classic config
  ```bash
  epicsEnvSet("DEV",      "STEST-MYDEVICE")
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}configureAxis.cmd,  "CONFIG=./cfg/axis_1"
  ```
   * yaml config
  ```bash
  ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addAxisYaml.cmd, "FILE=./AM8111_CSV_minimum.yaml, ECMC_TMPDIR=/tmp/"
  ```
Niko Kivel's avatar
Niko Kivel committed

7. adding a virtual motor axis
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  ${SCRIPTEXEC} ${ecmccfg_DIR}configureVirtualAxis.cmd,     "CONFIG=./cfg/axis_11_virt"
  ```
Niko Kivel's avatar
Niko Kivel committed

8. adding synchronization
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  ${SCRIPTEXEC} ${ecmccfg_DIR}applyAxisSynchronization.cmd, "CONFIG=./cfg/axis_1_sync"
  ${SCRIPTEXEC} ${ecmccfg_DIR}applyAxisSynchronization.cmd, "CONFIG=./cfg/axis_11_sync"
  ```   
Niko Kivel's avatar
Niko Kivel committed

9. loading a PLC from file
Niko Kivel's avatar
Niko Kivel committed
  * classic PLC-file
  ```bash
  ${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "PLC_ID=0, FILE=./plc/homeSlit.plc, SAMPLE_RATE_MS=100"
  ```
  * pure yaml based PLC
  ```bash
  ${SCRIPTEXEC} "${ECMC_CONFIG_ROOT}loadYamlPlc.cmd" "FILE=./plc1.yaml, ECMC_TMPDIR=/tmp/"
  ```
  * yaml definition, with classic PLC-file, Note: `file` key in yaml config will overwrite anything in the `code` key!
  ```bash
  ${SCRIPTEXEC} "${ECMC_CONFIG_ROOT}loadYamlPlc.cmd" "FILE=./plc1File.yaml, ECMC_TMPDIR=/tmp/"
  ```
Niko Kivel's avatar
Niko Kivel committed

Niko Kivel's avatar
Niko Kivel committed
10. go active
Niko Kivel's avatar
Niko Kivel committed
  ```bash
  ${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
  ```