diff --git a/examples/PSI/lab_setup/stepper_bissc/README.md b/examples/PSI/lab_setup/stepper_bissc/README.md new file mode 100644 index 000000000..44ce4d6d2 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/README.md @@ -0,0 +1,100 @@ +# Configuration for EL7041-0052 and EL5042 +* Lab test stage (1mm/rev) +* Lab 4 axis motion control box +* RLS BISS-C linear encoder (absolute) +* Open loop encoder (incremental) + +## Scalings +Config for scaling in mm, mm/s, mm/s2 + +### Encoder scalings +Two encoders are configured: +1. Closed loop: BISS-C. This is used as the default encoder for control +2. Open loop: EL7041 Step counter + +Both these encoders (and drive) should be scaled to the same unit (mm). + +#### RLS BISS-C (encoder 1) + +RLS BISS-C: +* encoder.numerator: Travels 1 mm/rev (linear encoder) +* encoder.denominator: Resolution: 4096 counts per = 1mm +* encoder.absBits: 26 bits +* encoder.type: Absolute (type 1) +* ecnoder.absOffset: Offset to 0 position of linear stage (-1408.794 in this example) + +``` +encoder: + desc: BISS-C + numerator: 1 # Scaling numerator example 1 mm/rev + denominator: 4096 # Scaling denominator example 4096 ticks per 360 degree + type: 1 # Type: 0=Incremental, 1=Absolute + bits: 26 # Total bit count of encoder raw data + absBits: 26 # Absolute bit count (for absolute encoders) always least significant part of 'bits' + absOffset: -1408.794 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(ENC_SID).positionActual${ENC_CH=01} # Ethercat entry for actual position input (encoder) + status: ec0.s$(ENC_SID).encoderStatus${ENC_CH=01} # mandatory only if 'warning' or 'error' are used + ready: 2 # Bit in encoder status word for encoder ready + warning: 0 # Warning (optional) + error: # max 3 (optional) + - 1 # Error 0 +``` + +#### Open loop (encoder 2) +The EL7041 drive has a build in micro step counter (64 microsteps/fullstep): +* encoder.numerator: Travels 1 mm/rev +* encoder.denominator: Resolution: 200*64=12800 microsteps/rev = 12800 microsteps/mm +* encoder.bits: The counter is 16bit (default) +* encoder.type: Incremental (type 0) + +``` +encoder: + desc: 'Open loop' + unit: mm + numerator: 1 # Scaling numerator + denominator: 12800 # Scaling denominator + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 16 # Total bit count of encoder raw data + absBits: 0 # Absolute bit count (for absolute encoders) + absOffset: 0 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(DRV_SID).positionActual01 # Ethercat entry for actual position input (encoder) + homing: + refToEncIDAtStartup: 1 # Ref encoder at startup (to BISS value) + +``` +### Drive scalings + +The EL7041 is default setup to operate in a velocity range of +-2000 full steps/s which then corresponds to the 16bit drive.setpoint parameter (ec0.s$(DRV_SID).velocitySetpoint01): +* drive.numerator: Max velo = 2000 fullsteps/s == 10mm/s +* drive.denominator: velocity setpoint is 16bit == +-15bit = 32768 +* drive.type: Stepper drive, set to 0 + +``` +drive: + numerator: 10 # Fastest speed in eng. units (2000 Fullsteps/s==10mm/s) + denominator: 32768 # I/O range for ECMC_EC_ALIAS_DRV_VELO_SET (normally +-16bit) + type: 0 # Stepper: 0. DS402: 1 (DS402 = servos and advanced stepper drives) + setpoint: ec0.s$(DRV_SID).velocitySetpoint01 # Velocity setpoint if CSV. Position setpoint if CSP + control: ec0.s$(DRV_SID).driveControl01 # Control word ethercat entry + enable: 0 # Enable bit index in control word (not used if DS402) + reset: 1 # Reset bit in control word (if no drive reset bit then leave empty) + reduceTorque: 2 # Reduce torque bit in drive control word + reduceTorqueEnable: True # Enable reduce torque functionality + status: ec0.s$(DRV_SID).driveStatus01 # Status word ethercat entry + enabled: 1 # Enabled bit index in status word (not used if DS402) + warning: 2 # Warning bit in status word (if no drive warning bit then leave empty) + error: # max 3 error bits in status word + - 3 # Error 0 (if no drive error bit then leave empty) + - 7 # Error 1 (if no drive error bit then leave empty) + - 14 # Error 2 (if no drive error bit then leave empty) +``` + +## Switches +In standard setup switches are feed from 24V output, for the lab 4ax motion crate this is not the case. +However, the configuration for feeding switches (axis.feedSwitchesOutput) have been added anyway: +``` +axis: + id: 1 # Axis id + feedSwitchesOutput: ec0.s5.binaryOutput01 # Ethercat entry for feed switches + +``` diff --git a/examples/PSI/lab_setup/stepper_bissc/cfg/axis.yaml b/examples/PSI/lab_setup/stepper_bissc/cfg/axis.yaml new file mode 100644 index 000000000..b85b249c2 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/cfg/axis.yaml @@ -0,0 +1,89 @@ +axis: + id: ${AXIS_ID=1} # Axis id + feedSwitchesOutput: ec0.s${BO_SID}.binaryOutput${BO_CH=01} # Ethercat entry for feed switches + +epics: + name: ${AX_NAME=M1} # Axis anme + precision: 3 # Decimal count + description: Test cfg # Axis description + unit: mm # Unit + motorRecord: + fieldInit: 'RTRY=0,FOFF=Frozen' # Extra config for Motor record + +drive: + numerator: 10 # Fastest speed in eng. units (2000 Fullsteps/s==10mm/s) + denominator: 32768 # I/O range for ECMC_EC_ALIAS_DRV_VELO_SET (normally +-16bit) + type: 0 # Stepper: 0. DS402: 1 (DS402 = servos and advanced stepper drives) + setpoint: ec0.s$(DRV_SID).velocitySetpoint01 # Velocity setpoint if CSV. Position setpoint if CSP + control: ec0.s$(DRV_SID).driveControl01 # Control word ethercat entry + enable: 0 # Enable bit index in control word (not used if DS402) + reset: 1 # Reset bit in control word (if no drive reset bit then leave empty) + reduceTorque: 2 # Reduce torque bit in drive control word + reduceTorqueEnable: True # Enable reduce torque functionality + status: ec0.s$(DRV_SID).driveStatus01 # Status word ethercat entry + enabled: 1 # Enabled bit index in status word (not used if DS402) + warning: 2 # Warning bit in status word (if no drive warning bit then leave empty) + error: # max 3 error bits in status word + - 3 # Error 0 (if no drive error bit then leave empty) + - 7 # Error 1 (if no drive error bit then leave empty) + - 14 # Error 2 (if no drive error bit then leave empty) + +encoder: + desc: BISS-C + numerator: 1 # Scaling numerator example 1 mm/rev + denominator: 4096 # Scaling denominator example 4096 ticks per 360 degree + type: 1 # Type: 0=Incremental, 1=Absolute + bits: 32 # Total bit count of encoder raw data + absBits: 26 # Absolute bit count (for absolute encoders) always least significant part of 'bits' + absOffset: -1408.794 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(ENC_SID).positionActual${ENC_CH=01} # Ethercat entry for actual position input (encoder) + status: ec0.s$(ENC_SID).encoderStatus${ENC_CH=01} # mandatory only if 'warning' or 'error' are used + ready: 2 # Bit in encoder status word for encoder ready + warning: 0 # Warning (optional) + error: # max 3 (optional) + - 1 # Error 0 + +controller: + Kp: 10 # Kp proportinal gain + Ki: 0 # Ki integral gain + Kd: 0 # Kd derivative gain + +trajectory: + axis: + velocity: 2 # Default velo for axis + acceleration: 2 # Default acc for axis + deceleration: 2 # Default dec for axis + emergencyDeceleration: 5 # Deceleration when axis in error state + jerk: 10 # Default jerk for axis + jog: + velocity: 1 # Default velo fro JOG (motor record) + +input: + limit: + forward: ec0.s$(DRV_SID).driveStatus01.12 # Ethercat entry for low limit switch input + backward: ec0.s$(DRV_SID).driveStatus01.11 # Ethercat entry for high limit switch input + home: 'ec0.s$(DRV_SID).ONE.0' # Ethercat entry for home switch + interlock: 'ec0.s$(DRV_SID).ONE.0' # Ethercat entry for interlock switch input + +softlimits: + enable: false # Enable soft limits + forward: 100 # Soft limit position fwd + forwardEnable: false # Soft limit position fwd enable + backward: -100 # Soft limit position bwd + backwardEnable: false # Soft limit position bwd enable + +monitoring: + lag: + enable: true # Enable position lag monitoring (following error) + tolerance: 0.1 # Allowed tolerance + time: 10 # Allowed time outside tolerance target: + velocity: + enable: false # Enable velocity monitoring + max: 8 # Allowed max velocity + time: + trajectory: 100 # Time allowed outside max velo before system init halt + drive: 200 # Time allowed outside max velo before system disables drive + target: + enable: true # Enable at target monitoring (needs to be enabled if using motor record) + tolerance: 0.01 # Allowed tolerance + time: 10 # Filter time inside tolerance to be at target diff --git a/examples/PSI/lab_setup/stepper_bissc/cfg/axis_ipos.yaml b/examples/PSI/lab_setup/stepper_bissc/cfg/axis_ipos.yaml new file mode 100644 index 000000000..fc61a7591 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/cfg/axis_ipos.yaml @@ -0,0 +1,81 @@ +axis: + id: ${AXIS_ID=1} # Axis id + +epics: + name: ${AX_NAME=M1} # Axis anme + precision: 5 # Decimal count + description: Test cfg # Axis description + unit: mm # Unit + motorRecord: + fieldInit: 'RTRY=0,FOFF=Frozen' # Extra config for Motor record + +drive: + #numerator: 1 # Fastest speed in eng. units (2000 Fullsteps/s==10mm/s) + #denominator: 9322 # I/O range for ECMC_EC_ALIAS_DRV_VELO_SET (normally +-16bit) + numerator: -1 # + denominator: 3355920 # 360*9322 + type: 1 # Stepper: 0. DS402: 1 (DS402 = servos and advanced stepper drives) + setpoint: ec0.s$(DRV_SID).velocitySetpoint01 # Velocity setpoint if CSV. Position setpoint if CSP + control: ec0.s$(DRV_SID).driveControl01 # Control word ethercat entry + status: ec0.s$(DRV_SID).driveStatus01 # Status word ethercat entry + +encoder: + desc: BISS-C + numerator: 1 # Scaling numerator example 1 mm/rev + denominator: 4096 # Scaling denominator example 4096 ticks per 360 degree + type: 1 # Type: 0=Incremental, 1=Absolute + bits: 32 # Total bit count of encoder raw data + absBits: 26 # Absolute bit count (for absolute encoders) always least significant part of 'bits' + absOffset: -1408.794 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(ENC_SID).positionActual${ENC_CH=01} # Ethercat entry for actual position input (encoder) + status: ec0.s$(ENC_SID).encoderStatus${ENC_CH=01} # mandatory only if 'warning' or 'error' are used + ready: 2 # Bit in encoder status word for encoder ready + warning: 0 # Warning (optional) + error: # max 3 (optional) + - 1 # Error 0 + +controller: + Kp: 1 # Kp proportinal gain + Ki: 0 # Ki integral gain + Kd: 0 # Kd derivative gain + +trajectory: + type: 1 + axis: + velocity: 1 # Default velo for axis + acceleration: 1 # Default acc for axis + deceleration: 1 # Default dec for axis + emergencyDeceleration: 1 # Deceleration when axis in error state + jerk: 1 # Default jerk for axis + jog: + velocity: 1 # Default velo fro JOG (motor record) + +input: + limit: + forward: ec0.s$(DRV_SID).ONE.0 # Ethercat entry for low limit switch input + backward: ec0.s$(DRV_SID).ONE.11 # Ethercat entry for high limit switch input + home: 'ec0.s$(DRV_SID).ONE.0' # Ethercat entry for home switch + interlock: 'ec0.s$(DRV_SID).ONE.0' # Ethercat entry for interlock switch input + +softlimits: + enable: false # Enable soft limits + forward: 100 # Soft limit position fwd + forwardEnable: false # Soft limit position fwd enable + backward: -100 # Soft limit position bwd + backwardEnable: false # Soft limit position bwd enable + +monitoring: + lag: + enable: true # Enable position lag monitoring (following error) + tolerance: 100 # Allowed tolerance + time: 100 # Allowed time outside tolerance target: + velocity: + enable: true # Enable velocity monitoring + max: 10 # Allowed max velocity + time: + trajectory: 100 # Time allowed outside max velo before system init halt + drive: 200 # Time allowed outside max velo before system disables drive + target: + enable: true # Enable at target monitoring (needs to be enabled if using motor record) + tolerance: 0.001 # Allowed tolerance + time: 100 # Filter time inside tolerance to be at target diff --git a/examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop.yaml b/examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop.yaml new file mode 100644 index 000000000..3abf8df5f --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop.yaml @@ -0,0 +1,12 @@ +encoder: + desc: 'Open loop' + unit: mm + numerator: 1 # Scaling numerator + denominator: 12800 # Scaling denominator + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 16 # Total bit count of encoder raw data + absBits: 0 # Absolute bit count (for absolute encoders) + absOffset: 0 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(DRV_SID).positionActual01 # Ethercat entry for actual position input (encoder) + homing: + refToEncIDAtStartup: 1 # Ref encoder at startup (to BISS value) diff --git a/examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop_ipos.yaml b/examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop_ipos.yaml new file mode 100644 index 000000000..70dae6ae4 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop_ipos.yaml @@ -0,0 +1,11 @@ + +encoder: + desc: Openloop + unit: mm + prec: 5 + numerator: -1 # Scaling numerator example 1 mm/rev + denominator: 51200 # Scaling denominator example 4096 ticks per 360 degree + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 32 # Total bit count of encoder raw data + position: ec0.s$(DRV_SID).positionActual${ENC_CH=01} # Ethercat entry for actual position input (encoder) + status: ec0.s$(DRV_SID).encoderStatus${ENC_CH=01} # mandatory only if 'warning' or 'error' are used diff --git a/examples/PSI/lab_setup/stepper_bissc/startup.cmd b/examples/PSI/lab_setup/stepper_bissc/startup.cmd new file mode 100644 index 000000000..44bcfed94 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/startup.cmd @@ -0,0 +1,59 @@ +############################################################################## +## Example config for EL7041 and EL5042 + +require ecmccfg "ENG_MODE=1" + +#- ############################################################################ +#- 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, RLS-LA11 +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5042" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=2" +epicsEnvSet(ENC_SID,${ECMC_EC_SLAVE_NUM}) + +# 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" +epicsEnvSet(BO_SID,${ECMC_EC_SLAVE_NUM}) + +# 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} ${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'" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=./cfg/axis.yaml, DEV=${IOC}, AX_NAME=M1, AXIS_ID=1, DRV_SID=${ECMC_EC_SLAVE_NUM}, ENC_SID=${ENC_SID}, ENC_CH=01, BO_SID=${BO_SID}, BO_CH=01" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlEnc.cmd, "FILE=./cfg/enc_open_loop.yaml, DEV=${IOC}, DRV_SID=${ECMC_EC_SLAVE_NUM}" + +# 0:8 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" + +# 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" + diff --git a/examples/PSI/lab_setup/stepper_bissc/startup_local_hw.cmd b/examples/PSI/lab_setup/stepper_bissc/startup_local_hw.cmd new file mode 100644 index 000000000..523568dbf --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/startup_local_hw.cmd @@ -0,0 +1,19 @@ +############################################################################## +## Example config for EL7041 and EL5042 + +require ecmccfg "ENG_MODE=1,MASTER_ID=1" + +# 0:7 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=14,HW_DESC=EL7041-0052" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1500, I_STDBY_MA=1000, U_NOM_MV=48000, R_COIL_MOHM=1230'" +epicsEnvSet(DRV_SID,${ECMC_EC_SLAVE_NUM}) + +# 0:2 - EL5042 2Ch BiSS-C Encoder, RLS-LA11 +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=9,HW_DESC=EL5042" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=2" +epicsEnvSet(ENC_SID,${ECMC_EC_SLAVE_NUM}) + +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=./cfg/axis.yaml, DEV=${IOC}, AX_NAME=M1, AXIS_ID=1, DRV_SID=${DRV_SID}, ENC_SID=${ENC_SID}, ENC_CH=01" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlEnc.cmd, "FILE=./cfg/enc_open_loop.yaml, DEV=${IOC}, DRV_SID=${DRV_SID}" + diff --git a/examples/PSI/lab_setup/stepper_bissc/startup_local_hw_ipos.cmd b/examples/PSI/lab_setup/stepper_bissc/startup_local_hw_ipos.cmd new file mode 100644 index 000000000..8dd6c573d --- /dev/null +++ b/examples/PSI/lab_setup/stepper_bissc/startup_local_hw_ipos.cmd @@ -0,0 +1,30 @@ +############################################################################## +## Example config for EL7041 and EL5042 + +require ecmccfg sandst_a "ECMC_VER=sandst_a,ENG_MODE=1,MASTER_ID=1" + +# 0:7 - EL7041 1Ch Stepper +# ${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=14,HW_DESC=EL7041-0052" +# ${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1500, I_STDBY_MA=1000, U_NOM_MV=48000, R_COIL_MOHM=1230'" + +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=29, HW_DESC=iPOS4808BX_2" +#- Apply component: Oriental motor PKE244A +#- For IPOS4808 some macros are mandatory: +#- * I_CTRL_GAIN : Current loop gain +#- * I_CTRL_INT : Current loop integrator gain +#- * I_MAX_MA : Mandatory if Motor-Generic-2Phase-Stepper is used +#- * I_STDBY_MA : Mandatory if Motor-Generic-2Phase-Stepper is used +#- The values can be taken from EasyMotionStudio or by trial and error (BTW, coil resistance and inductance are not used in the iPOS cfgs) +#- After running a tuning test in EasyMotionStudio, a reset is needed (from easymotion studio or over SDO (see motor cfg scripts).) +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000,I_STDBY_MA=200,CURR_KP=0.8,CURR_TI=0.26'" +epicsEnvSet(DRV_SID,${ECMC_EC_SLAVE_NUM}) + +# 0:2 - EL5042 2Ch BiSS-C Encoder, RLS-LA11 +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=9,HW_DESC=EL5042" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1" +${SCRIPTEXEC} ${ecmccfg_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=2" +epicsEnvSet(ENC_SID,${ECMC_EC_SLAVE_NUM}) + +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=./cfg/axis_ipos.yaml, DEV=${IOC}, AX_NAME=M1, AXIS_ID=1, DRV_SID=${DRV_SID}, ENC_SID=${ENC_SID}, ENC_CH=01" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlEnc.cmd, "FILE=./cfg/enc_open_loop_ipos.yaml, DEV=${IOC}, DRV_SID=${DRV_SID}" + diff --git a/examples/PSI/lab_setup/stepper_openloop_7031/README.md b/examples/PSI/lab_setup/stepper_openloop_7031/README.md new file mode 100644 index 000000000..44ce4d6d2 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_openloop_7031/README.md @@ -0,0 +1,100 @@ +# Configuration for EL7041-0052 and EL5042 +* Lab test stage (1mm/rev) +* Lab 4 axis motion control box +* RLS BISS-C linear encoder (absolute) +* Open loop encoder (incremental) + +## Scalings +Config for scaling in mm, mm/s, mm/s2 + +### Encoder scalings +Two encoders are configured: +1. Closed loop: BISS-C. This is used as the default encoder for control +2. Open loop: EL7041 Step counter + +Both these encoders (and drive) should be scaled to the same unit (mm). + +#### RLS BISS-C (encoder 1) + +RLS BISS-C: +* encoder.numerator: Travels 1 mm/rev (linear encoder) +* encoder.denominator: Resolution: 4096 counts per = 1mm +* encoder.absBits: 26 bits +* encoder.type: Absolute (type 1) +* ecnoder.absOffset: Offset to 0 position of linear stage (-1408.794 in this example) + +``` +encoder: + desc: BISS-C + numerator: 1 # Scaling numerator example 1 mm/rev + denominator: 4096 # Scaling denominator example 4096 ticks per 360 degree + type: 1 # Type: 0=Incremental, 1=Absolute + bits: 26 # Total bit count of encoder raw data + absBits: 26 # Absolute bit count (for absolute encoders) always least significant part of 'bits' + absOffset: -1408.794 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(ENC_SID).positionActual${ENC_CH=01} # Ethercat entry for actual position input (encoder) + status: ec0.s$(ENC_SID).encoderStatus${ENC_CH=01} # mandatory only if 'warning' or 'error' are used + ready: 2 # Bit in encoder status word for encoder ready + warning: 0 # Warning (optional) + error: # max 3 (optional) + - 1 # Error 0 +``` + +#### Open loop (encoder 2) +The EL7041 drive has a build in micro step counter (64 microsteps/fullstep): +* encoder.numerator: Travels 1 mm/rev +* encoder.denominator: Resolution: 200*64=12800 microsteps/rev = 12800 microsteps/mm +* encoder.bits: The counter is 16bit (default) +* encoder.type: Incremental (type 0) + +``` +encoder: + desc: 'Open loop' + unit: mm + numerator: 1 # Scaling numerator + denominator: 12800 # Scaling denominator + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 16 # Total bit count of encoder raw data + absBits: 0 # Absolute bit count (for absolute encoders) + absOffset: 0 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(DRV_SID).positionActual01 # Ethercat entry for actual position input (encoder) + homing: + refToEncIDAtStartup: 1 # Ref encoder at startup (to BISS value) + +``` +### Drive scalings + +The EL7041 is default setup to operate in a velocity range of +-2000 full steps/s which then corresponds to the 16bit drive.setpoint parameter (ec0.s$(DRV_SID).velocitySetpoint01): +* drive.numerator: Max velo = 2000 fullsteps/s == 10mm/s +* drive.denominator: velocity setpoint is 16bit == +-15bit = 32768 +* drive.type: Stepper drive, set to 0 + +``` +drive: + numerator: 10 # Fastest speed in eng. units (2000 Fullsteps/s==10mm/s) + denominator: 32768 # I/O range for ECMC_EC_ALIAS_DRV_VELO_SET (normally +-16bit) + type: 0 # Stepper: 0. DS402: 1 (DS402 = servos and advanced stepper drives) + setpoint: ec0.s$(DRV_SID).velocitySetpoint01 # Velocity setpoint if CSV. Position setpoint if CSP + control: ec0.s$(DRV_SID).driveControl01 # Control word ethercat entry + enable: 0 # Enable bit index in control word (not used if DS402) + reset: 1 # Reset bit in control word (if no drive reset bit then leave empty) + reduceTorque: 2 # Reduce torque bit in drive control word + reduceTorqueEnable: True # Enable reduce torque functionality + status: ec0.s$(DRV_SID).driveStatus01 # Status word ethercat entry + enabled: 1 # Enabled bit index in status word (not used if DS402) + warning: 2 # Warning bit in status word (if no drive warning bit then leave empty) + error: # max 3 error bits in status word + - 3 # Error 0 (if no drive error bit then leave empty) + - 7 # Error 1 (if no drive error bit then leave empty) + - 14 # Error 2 (if no drive error bit then leave empty) +``` + +## Switches +In standard setup switches are feed from 24V output, for the lab 4ax motion crate this is not the case. +However, the configuration for feeding switches (axis.feedSwitchesOutput) have been added anyway: +``` +axis: + id: 1 # Axis id + feedSwitchesOutput: ec0.s5.binaryOutput01 # Ethercat entry for feed switches + +``` diff --git a/examples/PSI/lab_setup/stepper_openloop_7031/cfg/axis_open_loop.yaml b/examples/PSI/lab_setup/stepper_openloop_7031/cfg/axis_open_loop.yaml new file mode 100644 index 000000000..52fa4970e --- /dev/null +++ b/examples/PSI/lab_setup/stepper_openloop_7031/cfg/axis_open_loop.yaml @@ -0,0 +1,84 @@ +axis: + id: ${AXIS_ID=1} # Axis id + #feedSwitchesOutput: ec0.s${BO_SID}.binaryOutput${BO_CH=01} # Ethercat entry for feed switches + +epics: + name: ${AX_NAME=M1} # Axis anme + precision: 3 # Decimal count + description: Test cfg # Axis description + unit: mm # Unit + motorRecord: + fieldInit: 'RTRY=0,FOFF=Frozen' # Extra config for Motor record + +drive: + numerator: 57600 # Fastest speed in eng. units (2000 Fullsteps/s==10mm/s) + denominator: 32768 # I/O range for ECMC_EC_ALIAS_DRV_VELO_SET (normally +-16bit) + type: 0 # Stepper: 0. DS402: 1 (DS402 = servos and advanced stepper drives) + setpoint: ec0.s$(DRV_SID).velocitySetpoint01 # Velocity setpoint if CSV. Position setpoint if CSP + control: ec0.s$(DRV_SID).driveControl01 # Control word ethercat entry + enable: 0 # Enable bit index in control word (not used if DS402) + reset: 1 # Reset bit in control word (if no drive reset bit then leave empty) + reduceTorque: 2 # Reduce torque bit in drive control word + reduceTorqueEnable: True # Enable reduce torque functionality + status: ec0.s$(DRV_SID).driveStatus01 # Status word ethercat entry + enabled: 1 # Enabled bit index in status word (not used if DS402) + warning: 2 # Warning bit in status word (if no drive warning bit then leave empty) + error: # max 3 error bits in status word + - 3 # Error 0 (if no drive error bit then leave empty) + - 7 # Error 1 (if no drive error bit then leave empty) + - 14 # Error 2 (if no drive error bit then leave empty) + +encoder: + desc: Openloop + numerator: 360 # Scaling numerator example 1 mm/rev + denominator: 12800 # Scaling denominator example 4096 ticks per 360 degree + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 16 # Total bit count of encoder raw data + absBits: 0 # Absolute bit count (for absolute encoders) always least significant part of 'bits' + position: ec0.s$(ENC_SID).positionActual${ENC_CH=01} # Ethercat entry for actual position input (encoder) + status: ec0.s$(ENC_SID).encoderStatus${ENC_CH=01} # mandatory only if 'warning' or 'error' are used + +controller: + Kp: 10 # Kp proportinal gain + Ki: 0 # Ki integral gain + Kd: 0 # Kd derivative gain + +trajectory: + axis: + velocity: 720 # Default velo for axis + acceleration: 2000 # Default acc for axis + deceleration: 2000 # Default dec for axis + emergencyDeceleration: 7200 # Deceleration when axis in error state + jerk: 7200 # Default jerk for axis + jog: + velocity: 1 # Default velo fro JOG (motor record) + +input: + limit: + forward: ec0.s$(DRV_SID).ONE.0 # Ethercat entry for low limit switch input + backward: ec0.s$(DRV_SID).ONE.0 # Ethercat entry for high limit switch input + home: 'ec0.s$(DRV_SID).ONE.0' # Ethercat entry for home switch + interlock: 'ec0.s$(DRV_SID).ONE.0' # Ethercat entry for interlock switch input + +softlimits: + enable: false # Enable soft limits + forward: 100 # Soft limit position fwd + forwardEnable: false # Soft limit position fwd enable + backward: -100 # Soft limit position bwd + backwardEnable: false # Soft limit position bwd enable + +monitoring: + lag: + enable: true # Enable position lag monitoring (following error) + tolerance: 10 # Allowed tolerance + time: 100 # Allowed time outside tolerance target: + velocity: + enable: false # Enable velocity monitoring + max: 8 # Allowed max velocity + time: + trajectory: 100 # Time allowed outside max velo before system init halt + drive: 200 # Time allowed outside max velo before system disables drive + target: + enable: true # Enable at target monitoring (needs to be enabled if using motor record) + tolerance: 0.1 # Allowed tolerance + time: 10 # Filter time inside tolerance to be at target diff --git a/examples/PSI/lab_setup/stepper_openloop_7031/startup_local_hw.cmd b/examples/PSI/lab_setup/stepper_openloop_7031/startup_local_hw.cmd new file mode 100644 index 000000000..074850046 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_openloop_7031/startup_local_hw.cmd @@ -0,0 +1,28 @@ +############################################################################## +## Example config for open loop only + +require ecmccfg "ENG_MODE=1,MASTER_ID=1,EC_RATE=500" +require ecmccomp + +# 0:11 - EL7031 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=11,HW_DESC=EL7031" +${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=8000,SPEED_RANGE=5'" +epicsEnvSet(DRV_SID,${ECMC_EC_SLAVE_NUM}) +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=./cfg/axis_open_loop.yaml, DEV=${IOC}, AX_NAME=M1, AXIS_ID=1, DRV_SID=${DRV_SID}, ENC_SID=${DRV_SID}, ENC_CH=01" + +#- Disable boosts.. Nicer current control +ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x7,0,2)" +ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x8,0,2)" + +# 8010:05 EMF +#ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8010,0x5,100,2)" +##- Kp +#ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x1,40,2)" +# +##- Ki +#ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x2,4,2)" + +#- ########################################################################### +#- Go Active +${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd +${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd