From 1e09c0aede85239b64f8899be9e249e76948be08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Sandstr=C3=B6m?= Date: Fri, 25 Oct 2024 16:15:47 +0200 Subject: [PATCH] Add cfgs for PSI lab setup --- .../PSI/lab_setup/stepper_openloop/README.md | 100 ++++++++++++++++++ .../stepper_openloop/cfg/axis_open_loop.yaml | 84 +++++++++++++++ .../stepper_openloop/startup_local_hw.cmd | 23 ++++ 3 files changed, 207 insertions(+) create mode 100644 examples/PSI/lab_setup/stepper_openloop/README.md create mode 100644 examples/PSI/lab_setup/stepper_openloop/cfg/axis_open_loop.yaml create mode 100644 examples/PSI/lab_setup/stepper_openloop/startup_local_hw.cmd diff --git a/examples/PSI/lab_setup/stepper_openloop/README.md b/examples/PSI/lab_setup/stepper_openloop/README.md new file mode 100644 index 000000000..44ce4d6d2 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_openloop/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/cfg/axis_open_loop.yaml b/examples/PSI/lab_setup/stepper_openloop/cfg/axis_open_loop.yaml new file mode 100644 index 000000000..357eb8a55 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_openloop/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: 7200 # 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/startup_local_hw.cmd b/examples/PSI/lab_setup/stepper_openloop/startup_local_hw.cmd new file mode 100644 index 000000000..79707f4b0 --- /dev/null +++ b/examples/PSI/lab_setup/stepper_openloop/startup_local_hw.cmd @@ -0,0 +1,23 @@ +############################################################################## +## Example config for open loop only + +require ecmccfg "ENG_MODE=1" +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=200, U_NOM_MV=24000, R_COIL_MOHM=1230,SPEED_RANGE=2'" +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" + +# 0:13 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "SLAVE_ID=13,HW_DESC=EL7041-0052" +${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper, MACROS='I_MAX_MA=1000, I_STDBY_MA=200, U_NOM_MV=48000, R_COIL_MOHM=1230,SPEED_RANGE=2'" +epicsEnvSet(DRV_SID,${ECMC_EC_SLAVE_NUM}) + +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=./cfg/axis_open_loop.yaml, DEV=${IOC}, AX_NAME=M2, AXIS_ID=2, DRV_SID=${DRV_SID}, ENC_SID=${DRV_SID}, ENC_CH=01" + +#- ########################################################################### +#- go active +${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd +${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd