Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELM7231 and AM8123 #208

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions db/Beckhoff_7XXX/ecmcELM7231-0010.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
file "ecmcEL72XX_DRV.template"
{
pattern {CH_ID}
{01 }
}

file "ecmcEL72XX_ENC.template"
{
pattern {CH_ID}
{01 }
}
70 changes: 70 additions & 0 deletions examples/test/elm7321/cfg/AM8123.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
axis:
id: 1
type: joint # this is for future selection of axis type
mode: CSV # supported mode, CSV and CSP

epics:
name: axis
precision: 3
unit: deg
motorRecord:
description: AM8123 CSV

drive:
numerator: 2880000 # Fastest speed in engineering units
denominator: 2147483648 # I/O range for ECMC_EC_ALIAS_DRV_VELO_SET
type: 1 # Stepper: 0. DS402: 1 (DS402 = servos and advanced stepper drives)
control: ec0.s$(DRV_SLAVE).driveControl01
status: ec0.s$(DRV_SLAVE).driveStatus01
setpoint: ec0.s$(DRV_SLAVE).velocitySetpoint01
# control bit for reset in 'control'
reset: 7
# status bit for warning in 'status'
warning: 7
# list of error bits in 'status', or if type==string, complete EC-link
error:
- 3 # Error
- 7 # Warning as Error

encoder:
numerator: 360
denominator: 1048576
type: 1 # Type: 0=Incremental, 1=Absolute
bits: 32 # Total bit count of encoder raw data
absBits: 25 # Absolute bit count (for absolute encoders) always least significant part of 'bits'
absOffset: 0 # Encoder offset in eng units (for absolute encoders)
position: ec0.s$(DRV_SLAVE).positionActual01 # Ethercat entry for actual position input (encoder)

controller:
Kp: 10
Ki: 0.05

trajectory:
type: 1
axis:
velocity: 36000 # 5000 rpm (web page), 7883 rpm (name plate) => 47298 deg/s
acceleration: 144000
jerk: 360000

input:
limit:
forward: ec0.s$(DRV_SLAVE).ONE.0 # Ethercat entry for low limit switch input
backward: ec0.s$(DRV_SLAVE).ONE.0 # Ethercat entry for high limit switch input
home: ec0.s$(DRV_SLAVE).ONE.0 # Ethercat entry for home switch input
interlock: ec0.s$(ENC_SLAVE).ONE.0 # Ethercat entry for interlock switch input

monitoring:
lag:
enable: true
tolerance: 360
time: 100
target:
enable: yes
tolerance: 0.1
time: 100
velocity:
enable: true
max: 40000
time:
trajectory: 100
drive: 200
21 changes: 21 additions & 0 deletions examples/test/elm7321/startup.iocsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require ecmccfg,ELM7231 "ENG_MODE=1,ECMC_VER=9.2.0"

${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}configureSlave.cmd, "HW_DESC=ELM7231-0010, SLAVE_ID=20, CONFIG=-Motor-Beckhoff-AM8123-1NH1-0000"

epicsEnvSet("DRV_SLAVE", ${ECMC_EC_SLAVE_NUM})
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}loadYamlAxis.cmd, "FILE=cfg/AM813.yaml, DEV=${DEV=${IOC}}, DRV_SLAVE=${DRV_SLAVE}"

#- #############################################################################
#- apply configuration
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}applyConfig.cmd
#- #############################################################################
#- go active
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}setAppMode.cmd

#- be quiet
asynSetTraceMask(MC_CPU1, -1, 0x01)
asynSetTraceIOMask(MC_CPU1, -1, 6)
asynSetTraceInfoMask(MC_CPU1, -1, 1)

#- reset all errors
ecmcConfigOrDie "ControllerErrorReset()"
62 changes: 62 additions & 0 deletions hardware/Beckhoff_7XXX/ELM/ecmcELM7231-0010.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#-d /**
#-d \brief hardware script for ELM7231-0010
#-d \details ELM7231-0010 Servo terminal with OCT feedback
#-d \author Niko Kivel
#-d \file
#-d \note SDOS
#-d \param [out] SDO 0x1011:01 --> 1684107116 \b reset
#-d */

#- ###########################################################
#- ############ Information:
#- Description: ELM7231-0010 Servo terminal with OCT feedback
#-
#- Note: The sync mode can not be written to in newer firmwares:
#- (0x1C32,0x1,0x1C33,0x1). So then these lines below needs
#- to be removed or commented out.
#- The log will then show error like:
#- EtherCAT ERROR 0-46: SDO download 0x1C32:01 (2 bytes) aborted.
#- EtherCAT ERROR 0-46: SDO abort message 0x06090030: "Value range of parameter exceeded".
#- EtherCAT ERROR 0-46: SDO configuration failed.
#-
#- ###########################################################

epicsEnvSet("ECMC_EC_HWTYPE" "ELM7231-0010_CSV")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x502275f9")
epicsEnvSet("ECMC_EC_COMP_TYPE" "EL7231_OCT")

#- verify slave, including reset
${SCRIPTEXEC} ${ecmccfg_DIR}slaveVerify.cmd "RESET=true"

#- Activly choose CSV mode
ecmcConfigOrDie "Cfg.EcWriteSdo(${ECMC_EC_SLAVE_NUM},0x7010,0x3,9,1)"

#- ############ read electronic nameplate
ecmcConfigOrDie "Cfg.EcWriteSdo(${ECMC_EC_SLAVE_NUM},0x8008,0x1,1,1)"
ecmcConfigOrDie "Cfg.EcWriteSdo(${ECMC_EC_SLAVE_NUM},0x8008,0x2,1,1)"
ecmcConfigOrDie "Cfg.EcWriteSdo(${ECMC_EC_SLAVE_NUM},0x8008,0x3,1,1)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x1610,0x7010,0x01,U16,driveControl01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x1612,0x7010,0x06,S32,velocitySetpoint01)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x11,U32,positionActual01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a10,0x6010,0x01,U16,driveStatus01)"

#- ############ Distributed clocks config:
#- Configure DC clock
#- From TwinCAT: SYNC 0: User defined 62.5 us, SYNC 1: 4000 us <-- I set this to the cycle time below
ecmcEpicsEnvSetCalc("ECMC_TEMP_PERIOD_NANO_SECS",1000/${ECMC_EC_SAMPLE_RATE=1000}*1E6)
ecmcConfigOrDie "Cfg.EcSlaveConfigDC(${ECMC_EC_SLAVE_NUM},0x700,62500,${ECMC_SYNC_0_OFFSET_NS=0},${ECMC_TEMP_PERIOD_NANO_SECS},${ECMC_SYNC_1_OFFSET_NS=0})"
epicsEnvUnset("ECMC_TEMP_PERIOD_NANO_SECS")

#- watchdog
${SCRIPTEXEC} ${ecmccfg_DIR}ecmcWatchDog.cmd

#- Set 4000 ms delay of ethercat bus at startup:
#- Somtimes the Ex72xx-xxxx will not report a correct encoder signal when transition from PREOP to OP. This is not reflected in any status word or bit
#- This will result in problems sicne ecmc cannot know if teh value is correct or not after startup.
#- For the drives with problems measurements have been made which concludes that after 2600ms after entering OP the EL72xx will give correct encoder position.
#- For twincat probably this is not an isue since the terminals are not goung from PROP to OP so often.
#- Conclusion: Need to contact Beckhoff. Probably firmware bug.
ecmcConfigOrDie "Cfg.EcSetDelayECOkAtStartup(${ECMC_EC_STARTUP_DELAY=4000})"
29 changes: 29 additions & 0 deletions hardware/Beckhoff_7XXX/ecmcEX72XX_CSV.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,32 @@ ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${EC
#- For twincat probably this is not an isue since the terminals are not goung from PROP to OP so often.
#- Conclusion: Need to contact Beckhoff. Probably firmware bug.
ecmcConfigOrDie "Cfg.EcSetDelayECOkAtStartup(${ECMC_EC_STARTUP_DELAY=4000})"

# ethercat -p22 pdos
# SM0: PhysAddr 0x1000, DefaultSize 256, ControlRegister 0x26, Enable 1
# SM1: PhysAddr 0x1100, DefaultSize 256, ControlRegister 0x22, Enable 1

# SM2: PhysAddr 0x1200, DefaultSize 12, ControlRegister 0x24, Enable 1
# RxPDO 0x1610 "DRV RxPDO-Map Controlword Ch.1"
# PDO entry 0x7010:01, 16 bit, "Controlword"
# RxPDO 0x1611 "DRV RxPDO-Map Target position Ch.1"
# PDO entry 0x7010:05, 32 bit, "Target position"
# RxPDO 0x1650 "DRV RxPDO-Map Controlword Ch.2"
# PDO entry 0x7110:01, 16 bit, "Controlword"
# RxPDO 0x1651 "DRV RxPDO-Map Target position Ch.2"
# PDO entry 0x7110:05, 32 bit, "Target position"

# SM3: PhysAddr 0x1600, DefaultSize 20, ControlRegister 0x20, Enable 1
# TxPDO 0x1a00 "FB TxPDO-Map Position Ch.1"
# PDO entry 0x6000:11, 32 bit, "Position"
# TxPDO 0x1a10 "DRV TxPDO-Map Statusword Ch.1"
# PDO entry 0x6010:01, 16 bit, "Statusword"
# TxPDO 0x1a11 "DRV TxPDO-Map Following error actual value Ch.1"
# PDO entry 0x6010:06, 32 bit, "Following error actual value"

# TxPDO 0x1a40 "FB TxPDO-Map Position Ch.2"
# PDO entry 0x6100:11, 32 bit, "Position"
# TxPDO 0x1a50 "DRV TxPDO-Map Statusword Ch.2"
# PDO entry 0x6110:01, 16 bit, "Statusword"
# TxPDO 0x1a51 "DRV TxPDO-Map Following error actual value Ch.2"
# PDO entry 0x6110:06, 32 bit, "Following error actual value"
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
############################################################
############# Parmetrization of ELM7231-XXXX for motor AM8122-0FH1-0000
#- Motor WITH brake
#-
#- Note: For important parameters see TwinCAT CoE startup list for the
#- motor terminal configuration.
#-
#- Macros (optional):
#-d \param I_MAX_MA : Maximum current in mA (defaults to 22400)
#-d \param I_RUN_MA : Running current in mA (defaults to 4000mA)
#-d */

#- Current loop integral time
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8010,0x12,21,2)"
#- Current loop proportianal gain
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8010,0x13,58,2)"

#- Motor max current
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x11,${I_MAX_MA=88400},4)"
#- Motor rated current
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x12,${I_RUN_MA=14600},4)"
#- Motor pole pairs
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x13,3,1)"
#- Commutation offset
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x15,270,2)"
#- Torque contstant
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x16,78,4)"
#- Rotor moment of inertia
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x18,449,4)"
#- Winding inductance
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x19,3,2)"
#- Motor speed limitation
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x1b,7883,4)"

#- Motor Temperature warn level
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x2b,1200,2)"
#- Motor thermal time constant
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8011,0x2d,832,2)"

#- Release delay
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8012,0x11,25,2)"
#- Application delay
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8012,0x12,8,2)"
Loading