diff --git a/404.html b/404.html index 372c113ff..a8e3e85f0 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -
Woops. Looks like this page doesn't exist ¯\_(ツ)_/¯.
Go to homepage
Built with from Grav and Hugo
A configuration framework for ECMC Motion Control Module for EPICS.
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 @@ -10,4 +10,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
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
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 adjustments to match your needs in terms of versions.
dev
R7+
MASTER_ID=-1
iocsh -7 -r "ecmccfg,dev 'ECMC_VER=dev,MASTER_ID=-1'"
The variable “ECMC_CONFIG_RETURN_VAL” then can be used to set record fields, name or alias for instance..
Normally these arguments are set when the module is required:
require ecmccfg "ENG_MODE=1,MASTER_ID=2"
A very powerful tool is provided through the command line. See a summary, incl. some examples of what possible here.
In DAQ mode, motion functionalities are disabled and the following commands are blocked:
This mode is intended to be used for pure DAQ use cases.
Example of starting ecmc in DAQ mode:
$(ECMCCFG_INIT)$(SCRIPTEXEC) ${ecmccfg_DIR}startup.cmd, "IOC=$(IOC),ECMC_VER=develop,MODE=DAQ"
NOTE: The default record update rate is set to 10ms in initAlll.cmd. For DAQ applications it could be needed to change this parameter to update records faster by changing the ECMC_SAMPLE_RATE_MS variable:
epicsEnvSet("ECMC_SAMPLE_RATE_MS",1)
In this mode all features are supported, but motor record will not be created for motion axes.
Setting the parameter ENG_MODE=1 will result in loading of extra PVs usefull for commissioning, i.e. controller parameters for motion axes.
The configuration framework contains the necessary files to configure an EPICS IOC for EtherCAT based motion control and DAQ.
require
require ecmccfg <VERSION> +ecmccfg > manual
require ecmccfg <VERSION>
# slave 0 {ecmcEK1100} ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}addSlave.cmd, "HW_DESC=EK1100" # SLAVE_ID is automatically incremented @@ -40,4 +40,4 @@
file
code
${SCRIPTEXEC} "${ECMC_CONFIG_ROOT}loadYamlPlc.cmd" "FILE=./plc1File.yaml, ECMC_TMPDIR=/tmp/"
${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlPlc.cmd "FILE=./plc1File.yaml"
ethercat
ethercat slaves
ethercat sdos
ethercat pdos
ethercat upload
ethercat download
ethercat states
The IgH EtherCAT master provides a command line interface (CLI) which is a very powerful tool. +The most common commands will be explained here.
ethercat master
This will show the state of all masters on the respective host.
The command will show the state of all masters. To limit the command to a single master, make use of the -m parameter.
-m
The -m parameter is available to all ethercat commands, and is even require by some in case of multiple masters. Check the help by issuing ethercat -h for details.
ethercat -h
Example:
ethercat master +
Master0 + Phase: Operation + Active: yes + Slaves: 38 + Ethernet devices: + Main: b4:7a:f1:30:7e:d5 (attached) + Link: UP + Tx frames: 133210322 + Tx bytes: 11957093893 + Rx frames: 133210320 + Rx bytes: 11957093737 + Tx errors: 0 + Tx frame rate [1/s]: 500 500 500 + Tx rate [KByte/s]: 43.4 43.4 43.3 + Rx frame rate [1/s]: 500 500 500 + Rx rate [KByte/s]: 43.4 43.4 43.3 + Common: + Tx frames: 737445202 + Tx bytes: 114898987125 + Rx frames: 737445184 + Rx bytes: 114898984314 + Lost frames: 18 + Tx frame rate [1/s]: 500 500 500 + Tx rate [KByte/s]: 43.4 43.4 43.3 + Rx frame rate [1/s]: 500 500 500 + Rx rate [KByte/s]: 43.4 43.4 43.3 + Loss rate [1/s]: 0 0 0 + Frame loss [%]: 0.0 0.0 0.0 + Distributed clocks: + Reference clock: Slave 0 + DC reference time: 708164169043902491 + Application time: 708427716430011969 + 2022-06-13 09:28:36.430011969 +
In case the numbers mostly zero, check the link state.
Ethernet devices: + Main: b4:7a:f1:30:7e:d5 (attached) + Link: UP <--- HERE +
If the link is DOWN, try bringing the network device up manually. +This, can be done with ip link set <nameOfNetworkDevice> up
DOWN
ip link set <nameOfNetworkDevice> up
If the device name is unkown, check with ip link show and search for the MAC the EtherCAT master is bound to.
ip link show
As the command suggest, this will provide a list of the EtherCAT slaves.
ethercat slaves +
0 0:0 PREOP + EK1100 EtherCAT Coupler (2A E-Bus) + 1 0:1 PREOP + EL9227-5500 ?berstromschutz 24V DC, 2K., max. 10A (Summe), eins + 2 0:2 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s + 3 0:3 PREOP + EL5042 2Ch. BiSS-C Encoder + 4 0:4 PREOP + EL5042 2Ch. BiSS-C Encoder + 5 0:5 PREOP + EL9410 E-Bus Netzteilklemme (Diagnose) + 6 0:6 PREOP + EL9576 Bremschopper Klemme + 7 0:7 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) + 8 0:8 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) + 9 0:9 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +10 0:10 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +11 0:11 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) +12 0:12 PREOP + EL9227-5500 ?berstromschutz 24V DC, 2K., max. 10A (Summe), eins +13 0:13 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s +14 0:14 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s +15 0:15 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s +16 0:16 PREOP + EL5042 2Ch. BiSS-C Encoder +17 0:17 PREOP + EL5042 2Ch. BiSS-C Encoder +18 0:18 PREOP + EL5042 2Ch. BiSS-C Encoder +19 0:19 PREOP + EL3314 4K. Ana. Eingang Thermoelement (TC) +20 0:20 PREOP + EL9410 E-Bus Netzteilklemme (Diagnose) +21 0:21 PREOP + EL9576 Bremschopper Klemme +22 0:22 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +23 0:23 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +24 0:24 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +25 0:25 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +26 0:26 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +27 0:27 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +28 0:28 PREOP + EKM1101 EtherCAT Coupler (2A E-Bus, ID switch, Diagnostics, is +29 0:29 PREOP + ELM3004-0000 4K. Ana. Eingang +/-30V, 24 bit, hochgenau +30 0:30 PREOP + ELM3146-0000 6Ch. Ana. Input +/-10V, +/-20mA, 24 bit, high prec +31 0:31 PREOP + ELM3602-0002 2Ch. IEPE Sensor, 24 bit, high precision +32 0:32 OP + EP7047-1032 1K. Schrittmotor-Endstufe (50V, 5A) +33 0:33 OP + EP5001-0002 1K. SSI Encoder +34 0:34 PREOP + EP7041-0002 1K. Schrittmotor-Endstufe (50V, 5A) +35 0:35 PREOP + EP7211-0034 1Ch. MDP742 Servo motor output stage with OCT (50V, +36 0:36 PREOP + EP7211-0034 1K. MDP742 Servo-Motor-Endstufe mit OCT (50V, 4,5A +37 0:37 PREOP + EP7211-0034 1K. MDP742 Servo-Motor-Endstufe mit OCT (50V, 4,5A +
Download and display the service data objects.
Use with caution as this command can take a long time to fetch all data. It is advised to limit the download to the specific slave in question, with the -p <slaveID> parameter.
-p <slaveID>
Similar to the sdos counterpart, this command will fetch the currently applied process data objects. +To avoid excessive output, it is advised to limit the command to a single slave.
sdos
With this command the value of a register can be fetched.
If the type is not explicitly given, first issue ethercat -p <slaveID> sdos. This will allow implicit type handling.
type
ethercat -p <slaveID> sdos
Example: +Fetch content of register 0x8020, sub-register 0x05 from slave 32.
0x8020
0x05
32
ethercat upload -m0 -p32 0x8020 0x05 +
0x03e8 1000 +
With this command the value of a register can be set on the slave.
Example: +Set value of register 0x8010, sub-register 0x07 from slave 7 to 314.
0x8010
0x07
7
314
ethercat download -m0 -p7 0x8010 0x07 314 +
With this command a specific state of a slave can be forced, or at least an attempt to enter the specific state is made.
This is helpful when a slave is stuck, e.g. with an error. Rather than cycle the power of the entire controller, the slave can be set to ‘REBOOT’. This might be enough to recover.
Alternatively, cycling to ‘INIT’ and back to ‘OP’ might also be attempted.
A power cycling of the of the EtherCAT components is the last resort!
For EL70x1 stepper drives the following parameters can be tuned:
8011:07 Ka factor / 8011:08 Kd factor are “current boosts” during acceleration/deceleration. -Default they are set to 100% which is way too high for most applications. Start by setting these parameters to 0.
This is the current loop settings and this is also what affect the performance. The higher you set these registers, the stiffer the control loop. -For most applications it is important to keep a ration of 40:1. -Default is 400 / 10, if you want a stiffer loop, then change to f ex 800 / 20 and onwards. -Increase until the motor misbehaves and go back to a safe setting.
Tuning systems with backlash can be difficult. Sometimes a small D-part helps to reduce spikes in the centralized ecmc position loop controller output.
From experience, very few issues are related to the EtherCAT hardware itself. +Mostly the cabling or the actual motor/encoder hardware is to blame.
Even more likely is human error, such as:
Before anything is restarted or power cycled, check the status of the system.
A simple way to get an overview of the entire ecmc system is to start the ecmcMain.ui panel. This panel contains, or links to, almost the entire ecmc IOC:
caqtdm -macro "IOC=<iocname>" ecmcMain.ui +
Remember, red is not necessarily a bad sign! +It can also indicate that certain channels are not connected. +Whether those channels should be connected is beyond the scope of this guide.
red
Next step is to diagnose from a dedicated shell, or from within the iocsh.
iocsh
If all slaves are in ‘OP’ state, at least data is exchanged between the hardware and the master.
Blindly restarting the IOC, with only partially working EtherCAT hardware, WILL RESULT IN TOTAL FAILURE OF THE IOC!!!
Check the hardware BEFORE restarting the IOC!
Could be caused by:
Always start troubleshooting by checking the error, warning and ready bits and reading the EL5042 manual. Next step is to read the diagnostic SDO bits of the EL5042, see below under heading “Diagnostics”.
The serial communication is hanled by two RS422 channels, one for the clock and one for data. These channels can be measured with a scope:
Lack of clock or data pulses could be caused by (in order of probability):
Make sure the encoder is powered with the correct voltage. Most encoders require 5V, but there are also some that require 9V, 12V or 24V.
Never apply a higher voltage than the specified operating voltage for the encoder.
The EL5042 can supply 5V or 9V. The default setting is 5V and in order to change the setting to 9V a special sequence need to be executed (see EL5042 manual).
After ensuring that the encoder is correctly supplied, the verify the power consumption of the encoder and compare with the specified consumption. If the power consumption does not match, the encoder might be broken or a faulty cabling.
Long cable lengths can affect both power supply levels and the serial data channels.
Power supply:
Longer cables will normally also result in a higher voltage drops. Especaillay for 5V encoders this can be an issue. Make sure that the voltage are within the specified range by measuring the voltage level close to the encoder.
If the voltage is to low (mainly for 5V encoders):
Serial communication: +The serial communication is also affected by the cable legth. For long cable lengths a reduction of the clock rate can be needed. The clock rate can be reduced by setting the CLK_FRQ_KHZ macro in the call to applyComponent.cmd (set clock freq. to 500kHz):
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1,MACROS='CLK_FRQ_KHZ=500'" +
For EL5042 the following rates are availble:
NOTE: The closest freq. equal or higher than CLK_FRQ_KHZ will be selected.
The diagnostic data can be read from register Index A0p8 FB BiSS-C Diag data (for Ch.1, p = 0; Ch.2, p = 1):
The ecmccfg/utils/read_el5042_diag.sh tool can be used for reading the diagnostics:
bash read_el5042_diag.sh <master_id> <slave_id> <channel_id> +
NOTE: The channel id starts at 0. First encoder channel is 0.
Example: master 1, slave 14, channel 0
# first login to ecmc server +$ bash read_el5042_diag.sh 1 14 0 + +######################################################### +Reading EL5042 Ch 0 status at master id 1 and slave id 14: + +Power supply present: +0x01 1 +Error: +0x00 0 +SDC Error: +0x01 1 +WD Error: +0x01 1 +Data valid: +0x00 0 +Data raw value: +0x0000000000000000 0 + +######################################################### +
Note: The tool ecmccfg/utils/PDO_read can also be used for reading the diagnostics.
When using the LSB offset, the same amount of ones (“1”) will be shifted in as MSB. Therefore the LSB offset should normally not be used.
When using the LSB offset setting, the same amout of bits needs to be subtracted from the ST_BITS or MT_BITS
Example: 26bit RLS, no LSB offset
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1,OFF_BITS=0" +
Example: 26bit RLS with 3 bits offset (ST_BITS=23, OFF_BITS=0)
#If the offset is needed then the sum of the bit's still need to match the bitcount of the encoder. Example: Offset 3 LSB bits, set ST_BITS=23 (26-3) +${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-Generic-BISS-C,CH_ID=1,MACROS=MT_BITS=0,ST_BITS=23,CLK_FRQ_KHZ=1000,OFF_BITS=3" +
If the total bit count does not match, the READY bit of the EL5042 will be low (and soemtimes also error or warning).
Example: 26bit RLS encoder with 2 status bits (set ST_BITS=28)
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-Generic-SSI,CH_ID=1,MACROS=MT_BITS=0,ST_BITS=28,CLK_FRQ_KHZ=1000,CODING=0" +
Some SSI encoders, i.e. Posital kit SSI, also send startup bits. These also needs to be accounted for in the ST_BITS and MT_BITS.
Example: Posital kit SSI encoder, KCD-S1X3B-1617-IE4F-GRQ
# Specs: +# Single turn bits 17 +# Multiturn bits: 16 +# Status bits: 2 +# Startup bits 8 (zeros) +# This then results in: +# MT_BITS=16 + 8 = 24 (multi turn bits + startup bits) +# ST_BITS=17 + 2 = 19 (single trun bits + status bits) +${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-Generic-SSI,CH_ID=1,MACROS=MT_BITS=24,ST_BITS=19" +
The status bits can then be masked away by:
If the drive is in error or warning state, further information about the reason for the warning/error can be read from the drive terminal by using the ethercat command. See command line interface for more info.
In order to use the ethercat command, you must first login to the server where the ecmc IOC is running.
The diagnostic data can be read from register Index A010 STM Diag data Ch.1 with the folowing syntax:
ethercat upload -m <master_index> -p <slave_index> --type uint8 0xA010 <subindex> +
Example for master 0, slave position 3:
# Saturated +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x1 + +# Over temperature +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x2 + +# Torque overload +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x3 + +# Under voltage +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x4 + +# Over voltage +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x5 + +# Short circuit A +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x6 + +# Short circuit B +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x7 + +# No control power +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x8 + +# Misc error +ethercat upload -m 0 -p 3 --type uint8 0xA010 0x9 +
The ecmccfg/utils/read_el70xx_diag.sh tool can also be used for reading the diagnostics:
bash read_el70xx_diag.sh <master_id> <slave_id> +
Example: master 0, slave 3, drive under voltage warning
bash read_el7041_diag.sh 0 3 + +######################################################### +Reading EL70xx status at master id 0 and slave id 3: + +Saturated: +0x00 0 +Over temperature: +0x00 0 +Torque overload: +0x00 0 +Under voltage: +0x01 1 +Over voltage: +0x00 0 +Short circuit A: +0x00 0 +Short circuit B: +0x00 0 +No control power: +0x00 0 +Misc error: +0x00 0 + +######################################################### + +
Use a multimeter to verify that the voltage level corresponds to voltage levels described in the electrical drawings. If the voltage is correct, then the under voltage alarm could be related to worng setting of nominal drive voltage setting (48V but the drive is powered with 24V).
The nominal drive voltage setting can be changed by the U_NOM_MV macro when applying the component (ecmccomp).
Example: Set nominal voltage to 24V
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" +${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000, I_STDBY_MA=500, U_NOM_MV=24000, R_COIL_MOHM=1230'" +
For the EL703x drives the nominal voltage must be set to 24V (ecmccomp handles this automatically).
Use a multimeter to verify that the voltage level corresponds to voltage levels described in the electrical drawings. If the voltage is correct, then the over voltage alarm could be related to worng setting of nominal drive voltage setting (24V but the drive is powered with 48V).
Example: Set nominal voltage to 48V
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" +${SCRIPTEXEC} ${ecmccomp_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'" +
There are normally several control loops in an ecmc system:
However, for the EL70x1 drives there’s no dedicated velocity loop (however some current boost settings that can be applied in acc/dec, see below)
The position loop control parameters can be accessed and tuned by PVs. Normally, a pure P controller is enough (ki and kp set to 0) but sometimes the I and D part can be needed.
For most usecases, the default current controller parameters are already well tuned. Sometimes when operating at higher speeds the current loop needs to be tuned.
** 8011:07 Ka and 8011:08 Kd factor: **
8011:07 Ka factor / 8011:08 Kd factor are “current boosts” during acceleration/deceleration. +Default they are set to 100% which is way too high for most applications. Start by setting these parameters to 0.
** 8011:01 Kp and 8011:02 Ki factor: ** +This is the current loop settings and this is also what affect the performance. The higher you set these registers, the stiffer the control loop. +For most applications it is important to keep a ration of 40:1. +Default is 400 / 10, if you want a stiffer loop, then change to f ex 800 / 20 and onwards. +Increase until the motor misbehaves and go back to a safe setting.
Also see troubleshooting/tuning section.
In the standard setup at PSI over current protection modules are used to feed 24V to both the EtherCAT communication bus (E-bus) and the power bus of the EtherCAT slaves. If the over current protection is not enabled then the EtherCAT slaves will not receive power.
First time, (and only first time), a system is in use, the overcurrent modules needs to be enabled in order to allow current to flow. Enabling is done by push buttons in the LED area of the module. The long horizontal LEDs are in fact buttons that can be used to activate or tripp the over current protection.
Before pressing the buttons, check the electrical drawings. Make sure it’s safe to power on the system.
The EL9221-5000 has one channel and therefore only the top button is needed to be pressed.
The EL9227-5500 is a 2 channel module and normally both channels needs to be enabled by pressing both the top and bottom long LED. if only one are pressed it could result in that the power to the communication is fine but the power to the i/o bus is lacking. This can result in starnge issues. Both EL9227-5500 and EL9221-5000 have dedicated panels whre status of the over current protection can be seen.
Some terminals are passive. Passive terminals are not EtherCAT slaves and do not communicate over EtherCAT (not equipped with EtherCAT slave controller). Passive terminals are normally used to simplify electrical connections (avoiding external terminals). For instance for distributing potential, 24V and 0V, an EL9184 can be used (8Ch 24V and 8Ch 0V).
The passive terminals will not show up as an EtherCAT slave when issueing the “ethercat slaves” command. However, they are normally visible in the electrical drawings. This could result in that the slave id in the electrical drawing is NOT corresponding to the EtherCAT slave index used when configuring ecmc. In worst case this could lead to that the wrong hardware/drive is configured.
When configuring ecmc, make sure the EtherCAT slave index is correct, do not blindly trust the electrical drawings since and passive terminal could introduce an shift in the slave indices.
High latency, more than 10% of the ethercat cycle time, can in worse case result, in lost ethercat frames, which of course is not an ideal situation. High latency of the ecmc_rt thread can be related to:
Check which driver is in use by running (on the ecmc server):
lsmod | grep ec_ +
If the ec_master is using the ec_generic driver then a switch to igb driver is recommended.
The file /ioc/hosts/<hostname>/cfg/ETHERCATDRVR is listing the available drivers.
The recommended contents of the ETHERCATDRVR file is:
DEVICE_MODULES="igb generic" +
In this case, the system will first try to use igb driver, if not possible it will fallback to the generic driver. +After editing the file, the host needs to be rebooted in order for the changes to take effect.
** Reduce sample rate** +Reducing the ethercat cycle time is often very effichient when it comes to reduce latency. Do not run the ecmc systems faster than needed. +The default ecmc sample rate is 1Khz, which in many cases is not needed.
The sample rate is defined when require ecmccfg (example set to 500Hz, instead of 1kHz):
require ecmccfg "EC_RATE=500" +
There are some restrictions on the sample rate. Normally, a rate in the range 100Hz-1Khz is a good choice. For other rates, please check the documentation of slaves in use.
** Affinity** +Setting the affinity of the ecmc realtiem thread can often improve the performace. First check how many cores the controller has.
At PSI, core 0 is always isolated, do not move any threads to core 0.
In order to pin the ecmc thread to a single core, add the following line to the startup script (after setAppMode.cmd):
#- go active (create ecmc_rt) +${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd + +#- Set affinity of ecmc_rt (core 5) +epicsThreadSetAffinity ecmc_rt 5 +
If more than one ecmc ioc is running on the server, then make sure the ecmc_rt threads run on differnt cores.
Also other threads might take a lot of resources, for instace the epics thread “cbLow”:
afterInit "epicsThreadSetAffinity cbLow 6" +
cbLow is created at iocInit, therefore the “epicsThreadSetAffinity” must be executed with the “afterInit” command.
From experience, very few issues are related to the EtherCAT hardware itself. -Mostly the cabling or the actual motor/encoder hardware is to blame.
caqtdm -macro "IOC=<iocname>" ecmcMain.ui -
Remember, red is not necessarily a bad sign! -It can also indicate that certain channels are not connected. -Whether those channels should be connected is beyond the scope of this guide.
Due to the complexity an EtherCAT bus topology can assume, troubleshooting can be challenging. +This guide should provide the basic means to diagnose simple errors and is by no means complete!
For general issues, a very short troubleshooting guide is provided here.
A very powerful tool is provided through the command line. +See a summary, incl. some examples of what possible here.
For motion related issues, a very short troubleshooting guide is provided here.
Tune drive control loops
For hardware related issues, a very short troubleshooting guide is provided here.
Trigger manual motion (without motion ecmc-axis).
This procedure is for experts only. You run the risk of destroying expansive devices! Limit switches are not obeyed! YOU HAVE BEEN WARNED!
For this however, the IOC needs to be reconfigured to not link the hardware to an axis!
dbgrep "*s007*"
-Drv01-Cmd
-Drv01-Spd
1
The “BOTH_LIMITS” error can be related to that limits switches are not powered with 24V. As standard at PSI, limts are feed from 24V outputs, normally an EL2819 terminal. Basically the ouptputs needs then to be set to 1 in order to power the switches. Check the schematics in order to find out which output that powers the switches for a certain axis and then use one the following approaches to set it to 1:
Define the output in axis yaml file:
axis: + id: 1 # Axis id + ... + feedSwitchesOutput: ec0.s5.binaryOutput02 # Ethercat entry for feed switches + ... +
By using the commad Cfg.WriteEcEntryEcPath(ec<master_id>.s<slave_id>.binaryOutput<id>,<value>):
ecmcConfigOrDie "Cfg.WriteEcEntryEcPath(ec0.s5>.binaryOutput02,1)" +
A position lag error (following error) can be genereated in the following situations:
Before increase current to the motor, make sure that both motor and drive can handle the higher current. Extra care needs to be taken for vaccum applications.
Check the scaling documentation here. +One way to test if the scaling is correct is to set all controller parameters (except Kff) to 0 and then initiate a move. Basically the actual position of the axis should follow the setpoint closely with teh same slope. If the slope differs, then the scaling factors are wrong.
If a stepper motor stalls because of too high velocity there’s a few thing that can be done in order to improve the ability to reach higehr velocities:
For EL704x stepper drives are default setup to maximum veleocity range of +-2000fullsteps/s. The 16bit velocity setpoint that are sent to the drive correspons to this range. Bascially trying to write a higehr value than that will saturate the velocity setpoint resulting in that the required speed is not achived, resulting in position lag error. The speed range for the EL704x can however be changed by setting SDO 8012:05:
0 for 1000 full steps/second +1 for 2000 full steps/second (default) +2 for 4000 full steps/second +3 for 8000 full steps/second +4 for 16000 full steps/second +5 for 32000 full steps/second +
After changing this value you also need to change the drive scaling in the axis yaml file.
First check the dedicated hardware drive panel for diagnostics. If the drive is in warning or error state the diagnose the problem with the tool described in hardware.
Possible reasons:
This is the current loop settings and this is also what affect the performance. The higher you set these registers, the stiffer the control loop. +For most applications it is important to keep a ration of 40:1. +Default is 400 / 10, if you want a stiffer loop, then change to f ex 800 / 20 and onwards. +Increase until the motor misbehaves and go back to a safe setting.
This is the respective plc file
ax${AXIS_NO}.enc.actpos:=(ax{{ var.ty1 }}.enc.actpos+ax{{ var.ty2 }}.enc.actpos)/2;
Note the mixed use to MACROs ${AXIS_NO} and local variables {{ var.ty1 }} to boost flexibility.
${AXIS_NO}
{{ var.ty1 }}
An example configuration of a EL7041-0052 and a EL5042. The complete example with starup file can be found here
An example configuration of a Ex72xx servo drive with AM8xxx motor. The complete example with starup file can be found here
Always verify where the switches are connected in the electrical drawings.
All switches in the “input” section needs to be linked. If not used, then the simulation registers, “ONE” and “ZERO”, can be used:
Example, Use bit 1 in the ONE register of slave 1:
ec0.s1.ONE.1
If no ethercat slave is defined, slave number “-1” can be used: ec<master_id>.s-1.ONE.
This will affect the motorRecord only, thus ECMC internally is still moving in the wrong direction. You have been warned!
From v8+ yaml files are linted for syntactic errors, observe the iocsh for warnings and errors. Additionally the schema of the yaml file is checked by Cerberus. This check will point out errors in the structure of the configuration as well as certain type errors.
Syncronization configurations
Configuration of scaling
Defining the direction of motion
Configuration of homing
numerator
type: 0
uint16
bits: 16
The resulting code will toggle two different outputs, the state of the last output will be printed.
NOTE: Macros cannot be used in the filename when including a file. Instead the dir should be defined in the INC param when loading the PLC, see above.
Adding a DBG macro can be usefull to be able to turn on/off printouts. Typically during commsioning it can be usefull to have many printouts but later when system goes into production, it could be a good idea to turn (some) printouts off.
Example of a printout that can be turned on/off (default off)
${DBG=#}println('Value: ', ${M}.s${BO_S_ID}.binaryOutput${BO_CH});
Will result in the below if setting the DBG='' (and some other macros, see above):
println('Value: ', ec0.s10.binaryOutput01);
Unfortunately debugging of function libs is not as easy as normal PLC:s since exprtk returns less infomation at compile failure.
In order to troubleshoot, load the code as a normal PLC instead. This way you will get more diagnostics. Also remember, ecmc varaibles cannot be accessed in plc libs.
iocsh call
The IgH EtherCAT master provides a command line interface (CLI) which is a very powerful tool. -The most common commands will be explained here.
ethercat master -
Master0 - Phase: Operation - Active: yes - Slaves: 38 - Ethernet devices: - Main: b4:7a:f1:30:7e:d5 (attached) - Link: UP - Tx frames: 133210322 - Tx bytes: 11957093893 - Rx frames: 133210320 - Rx bytes: 11957093737 - Tx errors: 0 - Tx frame rate [1/s]: 500 500 500 - Tx rate [KByte/s]: 43.4 43.4 43.3 - Rx frame rate [1/s]: 500 500 500 - Rx rate [KByte/s]: 43.4 43.4 43.3 - Common: - Tx frames: 737445202 - Tx bytes: 114898987125 - Rx frames: 737445184 - Rx bytes: 114898984314 - Lost frames: 18 - Tx frame rate [1/s]: 500 500 500 - Tx rate [KByte/s]: 43.4 43.4 43.3 - Rx frame rate [1/s]: 500 500 500 - Rx rate [KByte/s]: 43.4 43.4 43.3 - Loss rate [1/s]: 0 0 0 - Frame loss [%]: 0.0 0.0 0.0 - Distributed clocks: - Reference clock: Slave 0 - DC reference time: 708164169043902491 - Application time: 708427716430011969 - 2022-06-13 09:28:36.430011969 -
Ethernet devices: - Main: b4:7a:f1:30:7e:d5 (attached) - Link: UP <--- HERE -
If the link is DOWN, try bringing the network device up manually. -This, can be done with ip link set <nameOfNetworkDevice> up
ethercat slaves -
0 0:0 PREOP + EK1100 EtherCAT Coupler (2A E-Bus) - 1 0:1 PREOP + EL9227-5500 ?berstromschutz 24V DC, 2K., max. 10A (Summe), eins - 2 0:2 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s - 3 0:3 PREOP + EL5042 2Ch. BiSS-C Encoder - 4 0:4 PREOP + EL5042 2Ch. BiSS-C Encoder - 5 0:5 PREOP + EL9410 E-Bus Netzteilklemme (Diagnose) - 6 0:6 PREOP + EL9576 Bremschopper Klemme - 7 0:7 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) - 8 0:8 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) - 9 0:9 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -10 0:10 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -11 0:11 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) -12 0:12 PREOP + EL9227-5500 ?berstromschutz 24V DC, 2K., max. 10A (Summe), eins -13 0:13 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s -14 0:14 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s -15 0:15 PREOP + EL1034 4K. Dig. Eingang 24V, potenzialfrei, 10?s -16 0:16 PREOP + EL5042 2Ch. BiSS-C Encoder -17 0:17 PREOP + EL5042 2Ch. BiSS-C Encoder -18 0:18 PREOP + EL5042 2Ch. BiSS-C Encoder -19 0:19 PREOP + EL3314 4K. Ana. Eingang Thermoelement (TC) -20 0:20 PREOP + EL9410 E-Bus Netzteilklemme (Diagnose) -21 0:21 PREOP + EL9576 Bremschopper Klemme -22 0:22 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -23 0:23 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -24 0:24 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -25 0:25 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -26 0:26 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -27 0:27 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) -28 0:28 PREOP + EKM1101 EtherCAT Coupler (2A E-Bus, ID switch, Diagnostics, is -29 0:29 PREOP + ELM3004-0000 4K. Ana. Eingang +/-30V, 24 bit, hochgenau -30 0:30 PREOP + ELM3146-0000 6Ch. Ana. Input +/-10V, +/-20mA, 24 bit, high prec -31 0:31 PREOP + ELM3602-0002 2Ch. IEPE Sensor, 24 bit, high precision -32 0:32 OP + EP7047-1032 1K. Schrittmotor-Endstufe (50V, 5A) -33 0:33 OP + EP5001-0002 1K. SSI Encoder -34 0:34 PREOP + EP7041-0002 1K. Schrittmotor-Endstufe (50V, 5A) -35 0:35 PREOP + EP7211-0034 1Ch. MDP742 Servo motor output stage with OCT (50V, -36 0:36 PREOP + EP7211-0034 1K. MDP742 Servo-Motor-Endstufe mit OCT (50V, 4,5A -37 0:37 PREOP + EP7211-0034 1K. MDP742 Servo-Motor-Endstufe mit OCT (50V, 4,5A -
Similar to the sdos counterpart, this command will fetch the currently applied process data objects. -To avoid excessive output, it is advised to limit the command to a single slave.
Example: -Fetch content of register 0x8020, sub-register 0x05 from slave 32.
ethercat upload -m0 -p32 0x8020 0x05 -
0x03e8 1000 -
Example: -Set value of register 0x8010, sub-register 0x07 from slave 7 to 314.
ethercat download -m0 -p7 0x8010 0x07 314 -
The serial communication performed by two RS422 channels, one for the clock and one for data. These channels can easily be measured with a scope:
After ensureing that the encoder is correctly supplied, it’s a good ide to measure the power consumption of the encoder and compare with the specified consumption. If the power consumption does not match, the encoder might be broken or a faulty cabling.
Serial communication: -The serial communication is also affected by the cable legth. For long cable lengths a reduction of the clock rate can be needed. The clock rate can be reduced by setting the CLK_FRQ_KHZ macro in the call to applyComponent.cmd (set clock freq. to 500kHz):
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1,MACROS='CLK_FRQ_KHZ=500'" -
bash read_el5042_diag.sh <master_id> <slave_id> <channel_id> -
# first login to ecmc server -$ bash read_el5042_diag.sh 1 14 0 - -######################################################### -Reading EL5042 Ch 0 status at master id 1 and slave id 14: - -Power supply present: -0x01 1 -Error: -0x00 0 -SDC Error: -0x01 1 -WD Error: -0x01 1 -Data valid: -0x00 0 -Data raw value: -0x0000000000000000 0 - -######################################################### -
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1,OFF_BITS=0" -
#If the offset is needed then the sum of the bit's still need to match the bitcount of the encoder. Example: Offset 3 LSB bits, set ST_BITS=23 (26-3) -${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-Generic-BISS-C,CH_ID=1,MACROS=MT_BITS=0,ST_BITS=23,CLK_FRQ_KHZ=1000,OFF_BITS=3" -
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-Generic-SSI,CH_ID=1,MACROS=MT_BITS=0,ST_BITS=28,CLK_FRQ_KHZ=1000,CODING=0" -
# Specs: -# Single turn bits 17 -# Multiturn bits: 16 -# Status bits: 2 -# Startup bits 8 (zeros) -# This then results in: -# MT_BITS=16 + 8 = 24 (multi turn bits + startup bits) -# ST_BITS=17 + 2 = 19 (single trun bits + status bits) -${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-Generic-SSI,CH_ID=1,MACROS=MT_BITS=24,ST_BITS=19" -
ethercat upload -m <master_index> -p <slave_index> --type uint8 0xA010 <subindex> -
# Saturated -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x1 - -# Over temperature -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x2 - -# Torque overload -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x3 - -# Under voltage -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x4 - -# Over voltage -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x5 - -# Short circuit A -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x6 - -# Short circuit B -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x7 - -# No control power -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x8 - -# Misc error -ethercat upload -m 0 -p 3 --type uint8 0xA010 0x9 -
bash read_el70xx_diag.sh <master_id> <slave_id> -
bash read_el7041_diag.sh 0 3 - -######################################################### -Reading EL70xx status at master id 0 and slave id 3: - -Saturated: -0x00 0 -Over temperature: -0x00 0 -Torque overload: -0x00 0 -Under voltage: -0x01 1 -Over voltage: -0x00 0 -Short circuit A: -0x00 0 -Short circuit B: -0x00 0 -No control power: -0x00 0 -Misc error: -0x00 0 - -######################################################### - -
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" -${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000, I_STDBY_MA=500, U_NOM_MV=24000, R_COIL_MOHM=1230'" -
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" -${SCRIPTEXEC} ${ecmccomp_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'" -
** 8011:01 Kp and 8011:02 Ki factor: ** -This is the current loop settings and this is also what affect the performance. The higher you set these registers, the stiffer the control loop. -For most applications it is important to keep a ration of 40:1. -Default is 400 / 10, if you want a stiffer loop, then change to f ex 800 / 20 and onwards. -Increase until the motor misbehaves and go back to a safe setting.
In the standard setup at PSI over current protection modules are used to feed 24V to both the ethercat communication bus (E-bus) and the power bus of the ethercat slaves. If the over current protection is not enabled then the ethercat slaves will not receive power.
lsmod | grep ec_ -
DEVICE_MODULES="igb generic" -
In this case, the system will first try to use igb driver, if not possible it will fallback to the generic driver. -After editing the file, the host needs to be rebooted in order for the changes to take effect.
** Reduce sample rate** -Reducing the ethercat cycle time is often very effichient when it comes to reduce latency. Do not run the ecmc systems faster than needed. -The default ecmc sample rate is 1Khz, which in many cases is not needed.
require ecmccfg "EC_RATE=500" -
** Affinity** -Setting the affinity of the ecmc realtiem thread can often improve the performace. First check how many cores the controller has.
#- go active (create ecmc_rt) -${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd - -#- Set affinity of ecmc_rt (core 5) -epicsThreadSetAffinity ecmc_rt 5 -
afterInit "epicsThreadSetAffinity cbLow 6" -
Due to the complexity an EtherCAT bus topology can assume, troubleshooting can be challenging. -This guide should provide the basic means to diagnose simple errors and is by no means complete!
A very powerful tool is provided through the command line. -See a summary, incl. some examples of what possible here.
axis: - id: 1 # Axis id - ... - feedSwitchesOutput: ec0.s5.binaryOutput02 # Ethercat entry for feed switches - ... -
ecmcConfigOrDie "Cfg.WriteEcEntryEcPath(ec0.s5>.binaryOutput02,1)" -
Check the scaling documentation here. -One way to test if the scaling is correct is to set all controller parameters (except Kff) to 0 and then initiate a move. Basically the actual position of the axis should follow the setpoint closely with teh same slope. If the slope differs, then the scaling factors are wrong.
0 for 1000 full steps/second -1 for 2000 full steps/second (default) -2 for 4000 full steps/second -3 for 8000 full steps/second -4 for 16000 full steps/second -5 for 32000 full steps/second -
Validates requested oversampling factor
Checks if requested oversampling factor is valid otherwise exits EPICS/ECMC
Anders Sandstroem
Validates the resulting sampling time for oversampling slaves.
Checks if the resulting sampling time for oversampling slaves is higher or equal to the minimum time.
Validates current settings
Checks if requested run current and standby current is less than max current and larger than 0.
Validates requested voltage
Ensure requested nominal voltage is less than max voltage and larger than 0
Add general PVs
Script for adding general and master diagnostics EPICS PVs
Niko Kivel, Anders Sandstroem
Script for general diagnostics
Script for setting default diagnostics
Initialization script
Script for setting up the basic EPICS environment.
Init main script
init axis environment
Script for setting up the basic AXIS environment.
Issue a warning
Generic verification script for expressions
Generic verification script
Script for adding axis related EPICS PVs.
Adds motorRecord to the IOC.
This script is typically called by \b addAxis.cmd
Script for configuring a physical axis.
Configures a physical axis in ECMC, based on previously set environment variables.
This script is typically called by \b addAxis.cmd, often via \b ecmc_axis-records.cmd
Script for adding axis diagnostic EPICS PVs.
Adds diagnostic PVs to the IOC.
Script for loading motor record related databases
Script for loading motor record related databases and creating motor record axis object
This script is typically called by \b ecmc_axis.cmd, often via \b ecmc_axis-records.cmd
Script for configuring axis synchronization
Configures ECMC for axis synchronization, based on previously set environment variables.
This script is typically called by \b applyAxisSynchronization.cmd
Script for adding encoder related EPICS PVs.
Script for adding an encoder to a previously created axis.
Script for adding an extra encoder
Configures a encoder object in ECMC, based on previously set environment variables.
This script is typically called by \b addEncoder.cmd
This script is typically called by \b addVirtualAxis.cmd
Script for configuring a virtual axis.
Configures a virtual axis in ECMC, based on previously set environment variables.
This script is typically called by \b addVirtualAxis.cmd, often via \b ecmc_virt_axis-records.cmd
Script for defining ${ECMC_PREFIX}
Gathers relevant information about MasterID, SlaveID, … to create naming convention compliant PREFIX
Niko Kivel
Script for defining ${ECMC_P}
Script for adding axis EPICS PVs.
Adds an motion axis.
Script for adding dataStorage.
Adds dataStorage buffer.
DS_SIZE Size of data buffer.DS_ID (optional), default 0, buffer IDDS_TYPE (optional), default 0, 0: Normal Buffer, 1: Ring Buffer, 2: FIFO BufferSAMPLE_RATE_MS (optional), default 1DS_DEBUG (optional), default 0, 0: No debug printouts, 1: Debug printouts
Example calls:
${SCRIPTEXEC} ${ecmccfg_DIR}addDataStorage.cmd "DS_ID=1, DS_SIZE=1000, SAMPLE_RATE_MS=100"
Script for adding an EtherCAT domain.
Adds an EtherCAt domain.
Anders Sandström
EXE_RATE (optional) Execution rate [cycles] defaults 0 (same EC_RATE)EXE_OFFSET (optional) Execution offset cycles [cycles] defaults 0ALLOW_OFFLINE (optional) Allow domain to be offline defaults 0
All EtherCAT entries generated after this command will be assigned
Script for adding a ethercat data item.
The ethercat data item allows for accessing alreday configured ethercat domain data in a flexible
Script for adding asyn SDO object (access to SDO:s in realtime)
Add SDO for async access during realtime operation
Script for adding an extra encoder to an axis.
Adds an encoder to the last configured axis.
CONFIG configuration file, i.e. ./cfg/axis_1_enc_2.encDEV (optional) device name, i.e. MOTOR1CLEAR_VARS_CMD (optional) Set to “empty” for not clear env vars (if vars needed for later use).CFG_MACROS (optional) Substitution macros for config file
Example call:
${SCRIPTEXEC} ${ecmccfg_DIR}addEncoder.cmd, "CONFIG=./cfg/linear_1_enc_3.enc"
Script for claiming a particular master.
Claims an EtherCAT master.
MASTER_ID (optional) master ID as shown by ethercat master.
${SCRIPTEXEC} ${ecmccfg_DIR}addMaster.cmd
${SCRIPTEXEC} ${ecmccfg_DIR}addMaster.cmd, "MASTER_ID=3"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1018, SLAVE_ID=1, P_SCRIPT=mXsXXX"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL3204, DEFAULT_SUBS=false, DEFAULT_SLAVE_PVS=true"
Script for adding a KL slave to the EtherCAT bus configuration of KL type.
Adds the respective hardware to the bus configuration, adds specific and default PV to the EPICS database. For some/most slaves also a default
Anders Sandstrom
HW_DESC Hardware descriptor, i.e. KL2032SLAVE_ID EtherCAT bus position of the BK1250 (or similar terminal)SLAVE_ID_KL KL-Bus index in two digit hex starting at zero for the first slave after BK1250 (or similar terminal)SUBST_FILE (optional) substitution file
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1018, SLAVE_ID=1, SLAVE_ID_KL=0A"
Adds an virtual axis with PVs.
Script for applying axis synchronization
Adds synchronization parameters to an axis provided by CONFIG.
CONFIG configuration file, i.e. ./cfg/linear_1.saxCLEAR_VARS_CMD (optional) Set to “empty” for not clear env vars (if needed vars for later use).
${SCRIPTEXEC} ${ecmccfg_DIR}applyAxisSynchronization.cmd, "CONFIG=./cfg/linear_1.sax"
Script for applying bus configuration.
Applies the EtherCAT configuration and caluclates data offsets in the process image.
${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cfg
Script for applying a specific slave configuration after the slave had been added manually.
Apply configurations to a slave.
Example call:call applySlaveConfig with CONFIG
${SCRIPTEXEC} ${ecmccfg_DIR}applySlaveConfig.cmd, "CONFIG=-Motor-Nanotec-ST4118L1804-B"
call applySlaveConfig with LOCAL_CONFIG
${SCRIPTEXEC} ${ecmccfg_DIR}applySlaveConfig.cmd, "LOCAL_CONFIG=./myFancyServoConfig.cfg"
Script for applying dc config to slave
Apply dc configurations to a slave.
Script for applying substitution file
Applies substitution from ${SUBST_FILE} with ${P_SCRIPT}
SUBST_FILE (optional) substitution fileECMC_P PV prefixP_SCRIPT (optional) naming convention prefix scriptNELM (optional) Used for oversampling cards. Defaults to 1
${SCRIPTEXEC} "${ECMC_CONFIG_ROOT}applySubstitutions.cmd" "SUBST_FILE=${SUBST_FILE=ecmc${ECMC_EC_HWTYPE}.substitutions},ECMC_P=${ECMC_P}"
Script for applying a template
Applies template from ${TEMPLATE_FILE} with ${P_SCRIPT}, PARAMS can be passed
TEMPLATE_FILE template fileECMC_P PV prefixPARAMS (optional) additional parameters
${SCRIPTEXEC} "${ECMC_CONFIG_ROOT}applyTemplate.cmd" "TEMPLATE_FILE=ecmcEcSlave.template,ECMC_P=${ECMC_P}"
Script for adding an axis with configuration.
Adds an axis to the configuration and applies parameters provided by CONFIG.
CONFIG configuration file, i.e. ./cfg/linear_1.paxDEV (optional) device name, i.e. MOTOR1CLEAR_VARS_CMD (optional) Set to “empty” for not clear env vars (if vars needed for later use).CFG_MACROS (optional) Substitution macros for config file
${SCRIPTEXEC} ${ecmccfg_DIR}configureAxis.cmd, "CONFIG=./cfg/linear_1.pax"
Script for adding a slave with dedicated slave configuration to the EtherCAT bus configuration.
Adds the respective hardware to the bus configuration, adds specific and default PV to the EPICS database. Applies a specific slave configuration.
HW_DESC Hardware descriptor, i.e. EL7037CONFIG configuration file, i.e. -Motor-Nanotec-ST4118L1804-B
The CONFIG together with the HW_DESC form the full filename which by definition is ecmc${HW_DESC}${CONFIG}.cmd, i.e.: ecmcEL7037-Motor-Nanotec-ST4118L1804-B.cmd
SLAVE_ID (optional) bus positionCFG_MACROS (optional) Substitution macros for config fileNELM (optional) Used for oversampling cards. Defaults to 1
${SCRIPTEXEC} ${ecmccfg_DIR}configureSlave.cmd, "HW_DESC=EL7037, CONFIG=-Motor-Nanotec-ST4118L1804-B"
${SCRIPTEXEC} ${ecmccfg_DIR}configureSlave.cmd, "HW_DESC=EL7037, CONFIG=-Motor-Nanotec-ST4118L1804-B, SLAVE_ID=8"
Script for adding a virtual axis with configuration.
Adds a virtual axis to the configuration and applies parameters provided by CONFIG.
CONFIG configuration file, i.e. ./cfg/linear_11.vaxDEV (optional) device name, i.e. GAPCLEAR_VARS_CMD (optional) Set to “empty” for not clear env vars (if needed vars for later use).
${SCRIPTEXEC} ${ecmccfg_DIR}configureVirtualAxis.cmd, "CONFIG=./cfg/linear_11.vax"
Script for finalizing. Executed just before iocInit (atInit)
Script for finalizing. Executed just before iocInit (atInit).
Script for loading Axis from yaml file via jinja2
jinja2
adds an Axis, based on a yaml config file
Niko Kivel, Anders Sandström
FILE the yaml-file containing the PLC definitionDEV the device name (optional, defaults to ${IOC}
${SCRIPTEXEC} "./loadYamlAxis.cmd" "FILE=./axis1.yaml" ${SCRIPTEXEC} "./loadYamlAxis.cmd" "FILE=./axis1.yaml, DEV=foobar"
Script for adding Encoder from yaml file via jinja2
adds an encoder to an axis, based on a yaml config file
${SCRIPTEXEC} "./loadYamlEnc.cmd" "FILE=./enc.yaml" ${SCRIPTEXEC} "./loadYamlEnc.cmd" "FILE=./enc.yaml, DEV=foobar"
Script for loading PLC from yaml file via jinja2
adds a PLC, line by line, from a yaml-file, parsed by jinja2
FILE the yaml-file containing the PLC definition
${SCRIPTEXEC} "./loadYamlPlc.cmd" "FILE=./plc1.yaml"
Script for adding a PLC from file.
Adds a PLC defined in FILE. Also adds PLC specific EPICS PVs, i.e. for enable/disable.
FILE PLC definition file, i.e. ./plc/homeSlit.plcAX_ID (optional) Ax number, default 0PLC_MACROS (optional) Substitution macros for PLC codeTMP_PATH (optional) directory to dump the temporary plc file after macro substitutionPRINT_PLC_FILE (optional) 1/0, printout msi parsed plc file (default enable(1)).SUBST_FILE (optional) custom substitution file otherwise ecmccfg default will be loaded
${SCRIPTEXEC} ${ecmccfg_DIR}loadAxisPLCFile.cmd, "AX_ID=1, FILE=./plc/homeSlit.plc"
FILE PLC definition file, i.e. ./plc/homeSlit.plcPLC_ID (optional) PLC number, default 0, or to next free PLC, the actual PLC Id is stored in ECMC_PLC_ID and can be used after this commandSAMPLE_RATE_MS (optional) excecution rate, default 1000/EC_RATEPLC_MACROS (optional) Substitution macros for PLC code. The macros “SELF_ID”,“SELF”,M_ID, and M are reserved:TMP_PATH (optional) directory to dump the temporary plc file after macro substitutionPRINT_PLC_FILE (optional) 1/0, printout msi parsed plc file (default enable(1)).SUBST_FILE (optional) custom substitution file otherwise ecmccfg default will be loadedINC (optional) List of directories for include files to pass to MSI (if several paths thendivide with ‘:').DESC (optional) Description of PLC
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "PLC_ID=0, FILE=./plc/homeSlit.plc, SAMPLE_RATE_MS=100"
Script for loading a PLC from lib from file.
FILE PLC definition file, i.e. ./plc/homeSlit.plcPLC_ID (optional) PLC number, default last loaded PLCPLC_MACROS (optional) Substitution macros for PLC code. The macros “SELF_ID”,“SELF”,M_ID, and M are reserved:INC (optional) List of directories for include files to pass to MSI (if several paths thendivide with ‘:').TMP_PATH (optional) directory to dump the temporary plc file after macro substitutionPRINT_PLC_FILE (optional) 1/0, printout msi parsed plc file (default enable(1)).
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCLib.cmd, "PLC_ID=0, FILE=./plc/homeSlit.plc, SAMPLE_RATE_MS=100"
Script for loading a ecmc plugin from file.
Loads a ecmc-plugin from file.
FILE Filename of plugin shared lib (./ecmcPlugin_Advanced.so)PLUGIN_ID Id of plugin to loadCONFIG (optional) Configuration string sent to plugin at constructREPORT (optional) Printout information of loaded plugin if set to “1”
${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=0,FILE=./ecmcPlugin_Advanced.so,CONFIG='PLUGIN CONFIGS GO HERE '
Script for adding multiple axes based on subst and template file
Configure multiple axes by using subst file
${SCRIPTEXEC} ${ecmccfg_DIR}loadSubstAxes.cmd, "FILE=./ax.subs"
Script for loading complete ecmc cfg based on subst files and templates
Loads complete ecmc cfg based on subst files and templates
${SCRIPTEXEC} ${ecmccfg_DIR}loadSubstConfig.cmd, "FILE=./cfg.subs"
Script for adding multiple hw based on subst and template file
Loads hw cfg based on subst files and templates
${SCRIPTEXEC} ${ecmccfg_DIR}loadSubstHw.cmd, "FILE=./hw.subs"
Restores record update rate to what was defined in startup.cmd
Script for switching to operational mode.
Validates configuration, starts realtime thread and checks EtherCAT slaves are in OP.
Script for enabling default diagnostics.
Set some default values to diagostics
Script for changing record update rate
Update record processing rate, all records created after this command will be updated in the specified rate.
** script for slave verification and optional reset**
will verify the slave identity and reset by writing to 0x1011, optionally read firmwre version from 0x100a
Macros