8 Commits

Author SHA1 Message Date
sandst_a db80d255de Add PLC desc 2024-10-02 11:11:09 +02:00
sandst_a 2c12d995df Update readme 2024-09-26 16:30:37 +02:00
sandst_a 4a65e3b753 Update readme 2024-09-26 16:29:35 +02:00
sandst_a 1c7e7793eb Update readme 2024-09-26 16:28:43 +02:00
sandst_a fd0f594c08 Add startup file to Makefile 2024-09-26 16:09:01 +02:00
sandst_a 1ccabdf578 Remove version in examples 2024-09-26 16:05:06 +02:00
sandst_a c485498cb7 Update macros to sm 2024-09-26 16:00:27 +02:00
sandst_a 184f01302d use common cfgs for slit example 2024-09-26 15:21:57 +02:00
25 changed files with 183 additions and 469 deletions
+1
View File
@@ -6,6 +6,7 @@ BUILDCLASSES = Linux
ARCH_FILTER = deb10%
EXCLUDE_VERSIONS+=3 7.0.5 7.0.6
SCRIPTS += startup.cmd
SCRIPTS += axis_sm.plc_inc
SCRIPTS += axis_kin_slit.plc_inc
SCRIPTS += axis_kin_mirror.plc_inc
+87 -3
View File
@@ -1,5 +1,89 @@
# ecmc_master_slave
Standard syncronization scripts for ecmc
Standard syncronization scripts for ecmc. The module provides:
* Syncronization scripts
* Generic state machine
## Syncronization scripts
Syncronazation can be done both by defining the forward adn inverse kinematcis as equations or by matrices.
The module implement 5 generic syncronazation scripts based on the matrix approach:
* axis_kin_2DoF.plc_inc : Kinematics for a 2 Dof system (slits)
* axis_kin_3DoF.plc_inc : Kinematics for a 3 Dof system
* axis_kin_4DoF.plc_inc : Kinematics for a 4 Dof system
* axis_kin_5DoF.plc_inc : Kinematics for a 5 Dof system
* axis_kin_6DoF.plc_inc : Kinematics for a 6 Dof system
and 2 dedicated:
* axis_kin_slit.plc_inc : Dedicated script for a slit system based on equations (including interlocks and softlimits)
* axis_kin_mirror.plc_inc : Dedicated script for a 5 DoF mirror system based on matrices
### Generic scripts (axis_kin_\<index\>DoF.plc_inc)
The generic scripts needs a few macros:
* AX_S\<index\> : Axis index for slave axes, index = 1..DoF
* AX_M\<index\> : Axis index for master axes, index = 1..DoF
* FWD\<index\> : Forward kinematics array, index = 1..DoF
* INV\<index\> : Inverse kinematics array, index = 1..DoF
## State machine
The state machine makes sure that master and slaved axes cannot run simultaneous. However, several master axes or several slave axes can run at the same time.
The state machine is implemented in the file axis_sm.plc.inc in this module.
The state machine needs two macros:
* GRP_ID_MA : Group id for master axes (most often virtual axes)
* GRP_ID_SA : Group id for slave axes (most often real axes)
The easiest way to create a group is to just add it in the axis yaml configuration:
```
axis:
id: 5
group: realAxes
```
If the group does not exist, it will be created. The id of the group will be accessible through the environment variable "GRP_\<group_name\>_ID", in this case "GRP_realAxes_ID".
This macro can the be used when loading the PLC-code.
## Using the scripts
The easiest way is to generate a main plc file and then use include to access the kinematic and state machine scripts.
Example for a slit system:
```
/* Forward kinematics to calculate virtual axes from real axes
| CEN | = FWD * | S1_LO |
| GAP | | S2_HI |
Equations:
ax{AX_CEN}.enc.actpos:=(ax{AX_LO}.enc.actpos+ax{AX_HI}.enc.actpos)/2;
ax{AX_GAP}.enc.actpos:=ax{AX_HI}.enc.actpos-ax{AX_LO}.enc.actpos;
*/
var FWD1[2] := {0.5, 0.5};
var FWD2[2] := { -1, 1 };
/* Inverse kinematics to calculate real axes from virtal axes
| S1_LO | = INV * | CEN |
| S2_HI | | GAP |
Equations:
ax{AX_LO}.traj.extsetpos:=ax{AX_CEN}.traj.setpos-ax{AX_GAP}.traj.setpos/2;
ax{AX_HI}.traj.extsetpos:=ax{AX_CEN}.traj.setpos+ax{AX_GAP}.traj.setpos/2;
*/
var INV1[2] := { 1, -0.5};
var INV2[2] := { 1, 0.5};
# Kinematics for slit system.
include "axis_kin_2DoF.plc_inc"
# State machine
include "axis_sm.plc_inc"
```
The main plc file can then be loaded into ecmc with appropriate macros (also not the INC):
```
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "FILE=./cfg/axis_main.plc, PLC_ID=1, INC=.:${ecmc_master_slave_DIR}, PLC_MACROS='PLC_ID=1, AX_M1=12, AX_M2=13, AX_S1=5, AX_S2=6, GRP_ID_SA=${GRP_realAxes_ID}, GRP_ID_MA=${GRP_virtualAxes_ID}'"
```
NOTE: Macros cannot not be used in the include statement. The path to this module needs to set in the INC parameter to loadPLCFile.cmd
## Examples
See examples dir for usage:
* slits
* mirror
* slits (equations, 2DoFs matrix)
* mirror (matrix)
+24 -24
View File
@@ -12,7 +12,7 @@ if ( static.counter<0.105 ) {
if ( static.counter>=0.105) { static.VMState:=0 };
#- VMs in Internal mode, ready to listen
mc_grp_set_traj_src(${GRP_ID_VA},0);
mc_grp_set_traj_src(${GRP_ID_MA},0);
};
@@ -26,19 +26,19 @@ if ( static.counter<0.105 ) {
if(static.VMState==-1) {
#- Trigg MR sync for all virt axes
mc_grp_sync_act_set(${GRP_ID_VA},1);
mc_grp_sync_act_set(${GRP_ID_MA},1);
#- RM are no longer in motion
#- -1 -> 0
#- Trigger Condition:
#- - all RM are not busy
if( mc_grp_get_any_busy(${GRP_ID_RA})==0 ) {
if( mc_grp_get_any_busy(${GRP_ID_SA})==0 ) {
#- disable real motors
mc_grp_set_enable(${GRP_ID_RA},0);
mc_grp_set_enable(${GRP_ID_SA},0);
#- VMs in Internal mode, back to ground state
mc_grp_set_traj_src(${GRP_ID_VA},0);
mc_grp_set_traj_src(${GRP_ID_MA},0);
#- state change
println('-1 -> 0');
@@ -46,8 +46,8 @@ if(static.VMState==-1) {
};
#- If RM Motion is occuring, and user commands VM motion: simply disable the VMs to void the command.
if( mc_grp_get_any_enabled(${GRP_ID_VA})==1 and mc_grp_get_any_enable(${GRP_ID_VA})==1 ) {
mc_grp_set_enable(${GRP_ID_VA},0);
if( mc_grp_get_any_enabled(${GRP_ID_MA})==1 and mc_grp_get_any_enable(${GRP_ID_MA})==1 ) {
mc_grp_set_enable(${GRP_ID_MA},0);
};
}
@@ -60,10 +60,10 @@ else if(static.VMState==0) {
#- - all RM are in internal mode
#- - all VM are disabled
mc_grp_get_any_traj_src_ext(${GRP_ID_RA})==0
if( mc_grp_get_any_busy(${GRP_ID_RA})==1 and mc_grp_get_any_traj_src_ext(${GRP_ID_RA})==0 and mc_grp_get_any_enabled(${GRP_ID_VA})==0 ) {
mc_grp_get_any_traj_src_ext(${GRP_ID_SA})==0
if( mc_grp_get_any_busy(${GRP_ID_SA})==1 and mc_grp_get_any_traj_src_ext(${GRP_ID_SA})==0 and mc_grp_get_any_enabled(${GRP_ID_MA})==0 ) {
#- VMs in PLC mode, so no following errors occur
mc_grp_set_traj_src(${GRP_ID_VA},0);
mc_grp_set_traj_src(${GRP_ID_MA},0);
#- state change
println('0 -> -1');
@@ -73,29 +73,29 @@ else if(static.VMState==0) {
#- 0 -> 1
#- Trigger Condition:
#- - at least 1 VM is enabled
else if( mc_grp_get_any_enabled(${GRP_ID_VA})==1 ) {
else if( mc_grp_get_any_enabled(${GRP_ID_MA})==1 ) {
#- Exit Condition: all axes are on
if( mc_grp_get_enabled(${GRP_ID_RA})==1 and mc_grp_get_enabled(${GRP_ID_VA})==1 and mc_grp_get_any_busy(${GRP_ID_RA})==0 ) {
if( mc_grp_get_enabled(${GRP_ID_SA})==1 and mc_grp_get_enabled(${GRP_ID_MA})==1 and mc_grp_get_any_busy(${GRP_ID_SA})==0 ) {
if( mc_grp_get_any_busy(${GRP_ID_VA})==1 ) {
mc_grp_set_traj_src(${GRP_ID_RA},1);
if( mc_grp_get_any_busy(${GRP_ID_MA})==1 ) {
mc_grp_set_traj_src(${GRP_ID_SA},1);
#- state change
println('0 -> 1');
static.VMState:=1;
#- Disable MR sync for all virt axes
mc_grp_sync_act_set(${GRP_ID_VA},0);
mc_grp_sync_act_set(${GRP_ID_MA},0);
};
}
#- Actions: If Exit Conditions not met
else {
#- enable motors
mc_grp_set_enable(${GRP_ID_VA},1);
mc_grp_set_enable(${GRP_ID_RA},1);
mc_grp_set_enable(${GRP_ID_MA},1);
mc_grp_set_enable(${GRP_ID_SA},1);
#- halt real motors
mc_grp_halt(${GRP_ID_RA});
mc_grp_halt(${GRP_ID_SA});
};
};
}
@@ -105,18 +105,18 @@ else if(static.VMState==1) {
#- basically a done test
#- 1 -> 0
if( mc_grp_get_any_busy(${GRP_ID_VA})==0 ) {
if( mc_grp_get_any_busy(${GRP_ID_MA})==0 ) {
#- disable motors and set source
mc_grp_set_enable(${GRP_ID_VA},0);
mc_grp_set_enable(${GRP_ID_RA},0);
mc_grp_set_enable(${GRP_ID_MA},0);
mc_grp_set_enable(${GRP_ID_SA},0);
mc_grp_set_traj_src(${GRP_ID_RA},0);
mc_grp_set_traj_src(${GRP_ID_SA},0);
#- once VMs are done, RMs need a bit longer to disable
if( mc_grp_get_any_busy(${GRP_ID_RA})==0 ) {
if( mc_grp_get_any_busy(${GRP_ID_SA})==0 ) {
#- For some reason, an interlock is raised, but not sure why or what the implications are. It can be cleared this way.
mc_grp_reset_error(${GRP_ID_RA});
mc_grp_reset_error(${GRP_ID_SA});
#- state change
println('1 -> 0');
+1 -1
View File
@@ -63,7 +63,7 @@ ${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}loadYamlAxis.cmd, "FILE=cfg/ax10_ROLL.yaml"
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}loadYamlAxis.cmd, "FILE=cfg/ax11_YAW.yaml"
# load the VFM virtual axes PLC
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}loadPLCFile.cmd, "FILE=cfg/VFM.plc,PLC_ID=1,INC=.:${ecmc_master_slave_DIR},PLC_MACROS='PLC_ID=1,AX_Y1=1,AX_Y2=2,AX_Y3=3,AX_X1=4,AX_X2=5,AX_TRX=7,AX_TRY=8,AX_PITCH=9,AX_ROLL=10,AX_YAW=11,GRP_ID_RA=${GRP_VFM_REAL_ID=0},GRP_ID_VA=${GRP_VFM_VIRT_ID=0}'"
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}loadPLCFile.cmd, "FILE=cfg/VFM.plc,PLC_ID=1,INC=.:${ecmc_master_slave_DIR},PLC_MACROS='PLC_ID=1,AX_Y1=1,AX_Y2=2,AX_Y3=3,AX_X1=4,AX_X2=5,AX_TRX=7,AX_TRY=8,AX_PITCH=9,AX_ROLL=10,AX_YAW=11,GRP_ID_SA=${GRP_VFM_REAL_ID=0},GRP_ID_MA=${GRP_VFM_VIRT_ID=0}'"
#- #############################################################################
#- Temporary test
@@ -1,16 +1,4 @@
#- Configuration scripts
require ecmccfg,"ENG_MODE=1,EC_RATE=100"
#- Components lib
require ecmccomp
#- Syncronization configs
require ecmc_master_slave
#- Only output errors
asynSetTraceMask(${ECMC_ASYN_PORT}, -1, 0x01)
#- ############################################################################
#- add slaves
#- list of slaves (4 axis test motion box)
@@ -52,12 +40,12 @@ ${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1008"
# 0:7 - EL7041 1Ch Stepper
${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'"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_ax5_LO.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=../common/axis_ax5_LO.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01"
# 0:8 - EL7041 1Ch Stepper
${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'"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_ax6_HI.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=../common/axis_ax6_HI.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01"
# 0:9 - EL7041 1Ch Stepper
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052"
@@ -67,19 +55,5 @@ ${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052"
#- #################################################################
#- Virtual axes
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_vax5_YCEN.yaml, AX_ID=${AX_NUM=12}"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_vax6_YGAP.yaml, AX_ID=${AX_NUM=13}"
#- #################################################################
#- PLCs with inverse kinematics (note the INC var including dirs to search for include files)
#- The group ID:s configured in yaml are stored in GRP_<axis.group>_ID
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "FILE=./cfg/axis_main.plc, PLC_ID=1, INC=.:${ecmc_master_slave_DIR}, PLC_MACROS='PLC_ID=1, AX_CEN=12, AX_GAP=13, AX_LO=5, AX_HI=6, GRP_ID_RA=${GRP_realAxes_ID}, GRP_ID_VA=${GRP_virtualAxes_ID}'"
#- #################################################################
#- go active
${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd
${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
#- #############################################################################
#- reset all errors
afterInit("ecmcConfigOrDie 'ControllerErrorReset()'")
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=../common/axis_vax5_YCEN.yaml, AX_ID=${AX_NUM=12}"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=../common/axis_vax6_YGAP.yaml, AX_ID=${AX_NUM=13}"
+7
View File
@@ -0,0 +1,7 @@
## Panel
```
caqtdm -macro "IOC=c6025a" ecmcMain.ui
```
## TODO
Test with motor record.
@@ -0,0 +1,30 @@
#- Configuration scripts
require ecmccfg,"ENG_MODE=1,EC_RATE=100"
#- Components lib
require ecmccomp
#- Syncronization configs
require ecmc_master_slave
#- Only output errors
asynSetTraceMask(${ECMC_ASYN_PORT}, -1, 0x01)
#- #################################################################
# Configure Hardware and Motion
< ../common/cfgHW_and_motion.cmd
#- #################################################################
#- PLCs with inverse kinematics (note the INC var including dirs to search for include files)
#- The group ID:s configured in yaml are stored in GRP_<axis.group>_ID
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "FILE=./cfg/axis_main.plc, PLC_ID=1, INC=.:${ecmc_master_slave_DIR}, PLC_MACROS='PLC_ID=1, AX_CEN=12, AX_GAP=13, AX_LO=5, AX_HI=6, GRP_ID_SA=${GRP_realAxes_ID}, GRP_ID_MA=${GRP_virtualAxes_ID}'"
#- #################################################################
#- go active
${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd
${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
#- #############################################################################
#- reset all errors
afterInit("ecmcConfigOrDie 'ControllerErrorReset()'")
@@ -0,0 +1,29 @@
#- Configuration scripts
require ecmccfg sandst_a "ENG_MODE=1,EC_RATE=100"
#- Components lib
require ecmccomp
#- Syncronization configs
require ecmc_master_slave
#- Only output errors
asynSetTraceMask(${ECMC_ASYN_PORT}, -1, 0x01)
#- #################################################################
# Configure Hardware and Motion
< ../common/cfgHW_and_motion.cmd
#- #################################################################
#- PLCs with kinematics (note the INC var including dirs to search for include files)
#- The group ID:s configured in yaml are stored in GRP_<axis.group>_ID
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "FILE=./cfg/axis_main.plc, PLC_ID=1, INC=.:${ecmc_master_slave_DIR}, DESC='Slit Kinematics and Statemachine', PLC_MACROS='PLC_ID=1, AX_M1=12, AX_M2=13, AX_S1=5, AX_S2=6, GRP_ID_SA=${GRP_realAxes_ID}, GRP_ID_MA=${GRP_virtualAxes_ID}'"
#- #################################################################
#- go active
${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd
${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
#- #############################################################################
#- reset all errors
afterInit("ecmcConfigOrDie 'ControllerErrorReset()'")
-19
View File
@@ -1,19 +0,0 @@
# Test ioc for a slit system
Note: Motor record disabled in this test system
## Changes
1. Use ecmc/ecmccfg version 9.5.4 or newer.
2. Divide statemachine and kinematics into separate include files (add INC param to loadPLCFile.cmd needed)
3. Use extsetpos in kinematics
4. Use new axis group functions in statemachine to make it generic (no direct access to axes in statemachine)
5. Set allow source change when enabled in axis yaml cfg (remove in startup script)
6. Remove encoder.position in virtual axis (not needed anymore)
7. Remove filter cfgs in yaml files
## Panel
```
caqtdm -macro "IOC=c6025a" ecmcMain.ui
```
## TODO
Test with motor record.
-79
View File
@@ -1,79 +0,0 @@
# https://paulscherrerinstitute.github.io/ecmccfg/manual/axis/axisyaml/
axis:
id: 5
group: realAxes
mode: CSV
features:
allowSrcChangeWhenEnabled: true
epics:
name: TR_LO
precision: 4
unit: mm
motorRecord:
description: "Low"
fieldInit: "SPAM=0,RTRY=1,FOFF=Frozen,TWV=1"
drive:
numerator: 10 # max velo in EGU/s
denominator: 32768 # MAX_INT for a 16-bit register, always this for this stepper drive!
type: 0
control: ec0.s$(DRV_SLAVE).driveControl01
status: ec0.s$(DRV_SLAVE).driveStatus01
setpoint: ec0.s$(DRV_SLAVE).velocitySetpoint01
encoder:
numerator: 1 # 1egu = 1mm
denominator: 12800 # Number of ticks when motor moves numerator (=1mm): 1 mm / 50 nm = 20000
type: 0 # Type: 0=Incremental, 1=Absolute
bits: 16 # Total bit count of encoder raw data
absBits: 0 # Absolute bit count (for abs enc) always least significant part of 'bits'
absOffset: 0.0000 # Encoder offset in eng units (for absolute encoders)
position: ec0.s$(ENC_SLAVE).positionActual$(ENC_CHANNEL)
controller:
Kp: 10.00
Ki: 0.001
Kd: 0.000
Kff: 1.00
trajectory:
axis:
velocity: 1.0
acceleration: 1.0
deceleration: 1.0
input:
limit:
forward: ec0.s$(DRV_SLAVE).driveStatus01.12 # 1119994 cnts // 55.9997 mm
backward: ec0.s$(DRV_SLAVE).driveStatus01.11 # 98010 cnts // 4.9005 mm
home: ec0.s$(DRV_SLAVE).ONE.0 # unused
interlock: ec0.s$(DRV_SLAVE).ONE.0 # unused
softlimits:
enable: false
backwardEnable: true
forwardEnable: true
forward: 55.8
backward: 5.1
monitoring:
lag:
enable: true
tolerance: 0.05
time: 100
target:
enable: true
tolerance: 0.05
time: 100
velocity:
enable: true
max: 5
time:
trajectory: 100
drive: 200
plc:
enable: true
externalCommands: true
-79
View File
@@ -1,79 +0,0 @@
# https://paulscherrerinstitute.github.io/ecmccfg/manual/axis/axisyaml/
axis:
id: 6
group: realAxes
mode: CSV
features:
allowSrcChangeWhenEnabled: true
epics:
name: TR_HI
precision: 4
unit: mm
motorRecord:
description: "Hi"
fieldInit: "SPAM=0,RTRY=1,FOFF=Frozen,TWV=1"
drive:
numerator: 10 # max velo in EGU/s
denominator: 32768 # MAX_INT for a 16-bit register, always this for this stepper drive!
type: 0
control: ec0.s$(DRV_SLAVE).driveControl01
status: ec0.s$(DRV_SLAVE).driveStatus01
setpoint: ec0.s$(DRV_SLAVE).velocitySetpoint01
encoder:
numerator: 1 # 1egu = 1mm
denominator: 12800 # Number of ticks when motor moves numerator (=1mm): 1 mm / 50 nm = 20000
type: 0 # Type: 0=Incremental, 1=Absolute
bits: 16 # Total bit count of encoder raw data
absBits: 0 # Absolute bit count (for abs enc) always least significant part of 'bits'
absOffset: 0.0000 # Encoder offset in eng units (for absolute encoders)
position: ec0.s$(ENC_SLAVE).positionActual$(ENC_CHANNEL)
controller:
Kp: 2.000
Ki: 0.001
Kd: 0.000
Kff: 1.00
trajectory:
axis:
velocity: 1.0
acceleration: 1.0
deceleration: 1.0
input:
limit:
forward: ec0.s$(DRV_SLAVE).driveStatus01.12 # 1111969 cnts // 55.5984 mm
backward: ec0.s$(DRV_SLAVE).driveStatus01.11 # 109007 cnts // 5.4504 mm
home: ec0.s$(DRV_SLAVE).ONE.0 # unused
interlock: ec0.s$(DRV_SLAVE).ONE.0 # unused
softlimits:
enable: false
backwardEnable: true
forwardEnable: true
forward: 55.4
backward: 5.7
monitoring:
lag:
enable: true
tolerance: 0.05
time: 100
target:
enable: true
tolerance: 0.05
time: 100
velocity:
enable: true
max: 5
time:
trajectory: 100
drive: 200
plc:
enable: true
externalCommands: true
@@ -1,65 +0,0 @@
axis:
id: ${AX_ID}
group: virtualAxes
type: end effector
epics:
name: CENTERY
precision: 4
unit: mm
motorRecord:
description: "Center (Virtual)"
fieldInit: "SPAM=0,RTRY=1,FOFF=Frozen,TWV=1"
encoder:
type: 1
source: 1
numerator: 1
bits: 32
trajectory:
axis:
velocity: 0.5
acceleration: 0.25
jerk: 0.25
input:
limit:
forward: ec0.s0.ONE.0 # unused
backward: ec0.s0.ONE.0 # unused
home: ec0.s0.ONE.0 # unused
interlock: ec0.s0.ONE.0 # unused
softlimits:
enable: false
forwardEnable: true
backwardEnable: true
forward: 52
backward: 8
monitoring:
lag:
enable: yes
tolerance: 0.02
time: 100
target:
enable: yes
tolerance: 0.02
time: 100
velocity:
enable: yes
max: 0.6
time:
trajectory: 100
drive: 100
plc:
enable: true
externalCommands: true
filter:
velocity:
enable: false
size: 10
trajectory:
enable: false
size: 10
@@ -1,65 +0,0 @@
axis:
id: ${AX_ID}
group: virtualAxes
type: end effector
epics:
name: GAPY
precision: 4
unit: mm
motorRecord:
description: "Gap (Virtual)"
fieldInit: "SPAM=0,RTRY=1,FOFF=Frozen,TWV=1"
encoder:
type: 1
source: 1
numerator: 1
bits: 32
trajectory:
axis:
velocity: 0.5
acceleration: 0.25
jerk: 0.25
input:
limit:
forward: ec0.s0.ONE.0 # unused
backward: ec0.s0.ONE.0 # unused
home: ec0.s0.ONE.0 # unused
interlock: ec0.s0.ONE.0 # unused
softlimits:
enable: false
forwardEnable: true
backwardEnable: true
forward: 20
backward: -20
monitoring:
lag:
enable: yes
tolerance: 0.02
time: 100
target:
enable: yes
tolerance: 0.02
time: 100
velocity:
enable: yes
max: 0.6
time:
trajectory: 100
drive: 100
plc:
enable: true
externalCommands: true
filter:
velocity:
enable: false
size: 10
trajectory:
enable: false
size: 10
-19
View File
@@ -1,19 +0,0 @@
# Test ioc for a slit system
Note: Motor record disabled in this test system
## Changes
1. Use ecmc/ecmccfg version 9.5.4 or newer.
2. Divide statemachine and kinematics into separate include files (add INC param to loadPLCFile.cmd needed)
3. Use extsetpos in kinematics
4. Use new axis group functions in statemachine to make it generic (no direct access to axes in statemachine)
5. Set allow source change when enabled in axis yaml cfg (remove in startup script)
6. Remove encoder.position in virtual axis (not needed anymore)
7. Remove filter cfgs in yaml files
## Panel
```
caqtdm -macro "IOC=c6025a" ecmcMain.ui
```
## TODO
Test with motor record.
-85
View File
@@ -1,85 +0,0 @@
#- Configuration scripts
require ecmccfg,"ENG_MODE=1,EC_RATE=100"
#- Components lib
require ecmccomp
#- Syncronization configs
require ecmc_master_slave sandst_a
#- Only output errors
asynSetTraceMask(${ECMC_ASYN_PORT}, -1, 0x01)
#- ############################################################################
#- add slaves
#- list of slaves (4 axis test motion box)
# Master0
# 0 0:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus)
# 1 0:1 PREOP + EL9227-5500 berstromschutz 24V DC, 2K., max. 10A (Summe), eins
# 2 0:2 PREOP + EL5042 2Ch. BiSS-C Encoder
# 3 0:3 PREOP + EL5042 2Ch. BiSS-C Encoder
# 4 0:4 PREOP + EL3204 4K. Ana. Eingang PT100 (RTD)
# 5 0:5 PREOP + EL2008 8K. Dig. Ausgang 24V, 0.5A
# 6 0:6 PREOP + EL1008 8K. Dig. Eingang 24V, 3ms
# 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)
#
# 0:0 - EK1100 EtherCAT coupler
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EK1100"
# 0:1 - EL9227-5500
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL9227-5500"
# 0:2 - EL5042 2Ch BiSS-C Encoder
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5042"
# 0:3 - EL5042 2Ch BiSS-C Encoder
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5042"
# 0:4 - EL3204
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL3204"
# 0:5 - EL2008
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL2008"
# 0:6 - EL1008 8K. Dig. Eingang 24V, 3ms
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1008"
# 0:7 - EL7041 1Ch Stepper
${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'"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_ax5_LO.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01"
# 0:8 - EL7041 1Ch Stepper
${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'"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_ax6_HI.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01"
# 0:9 - EL7041 1Ch Stepper
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052"
# 0:10 - EL7041 1Ch Stepper
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052"
#- #################################################################
#- Virtual axes
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_vax5_YCEN.yaml, AX_ID=${AX_NUM=12}"
${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_vax6_YGAP.yaml, AX_ID=${AX_NUM=13}"
#- #################################################################
#- PLCs with inverse kinematics (note the INC var including dirs to search for include files)
#- The group ID:s configured in yaml are stored in GRP_<axis.group>_ID
${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "FILE=./cfg/axis_main.plc, PLC_ID=1, INC=.:${ecmc_master_slave_DIR}, PLC_MACROS='PLC_ID=1, AX_M1=12, AX_M2=13, AX_S1=5, AX_S2=6, GRP_ID_RA=${GRP_realAxes_ID}, GRP_ID_VA=${GRP_virtualAxes_ID}'"
#- #################################################################
#- go active
${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd
${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd
#- #############################################################################
#- reset all errors
afterInit("ecmcConfigOrDie 'ControllerErrorReset()'")