Skip to content

Commit

Permalink
Merge branch 'master' of github.com:paulscherrerinstitute/ecmccfg
Browse files Browse the repository at this point in the history
  • Loading branch information
anderssandstrom committed Dec 10, 2024
2 parents 3b63865 + 7b08834 commit 307d080
Show file tree
Hide file tree
Showing 11 changed files with 613 additions and 0 deletions.
100 changes: 100 additions & 0 deletions examples/PSI/lab_setup/stepper_bissc/README.md
Original file line number Diff line number Diff line change
@@ -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
```
89 changes: 89 additions & 0 deletions examples/PSI/lab_setup/stepper_bissc/cfg/axis.yaml
Original file line number Diff line number Diff line change
@@ -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
81 changes: 81 additions & 0 deletions examples/PSI/lab_setup/stepper_bissc/cfg/axis_ipos.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop.yaml
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions examples/PSI/lab_setup/stepper_bissc/cfg/enc_open_loop_ipos.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 307d080

Please sign in to comment.