Merge branch 'master' of git.psi.ch:epics_ioc_modules/ecmc_plugin_safety
This commit is contained in:
@@ -21,10 +21,10 @@ epics:
|
||||
precision: 3 # Decimal count
|
||||
description: very important motor axis # Axis description
|
||||
unit: mm # Unit
|
||||
# motorRecord:
|
||||
# enable: true
|
||||
# description: This is MR
|
||||
# fieldInit: 'RRES=1.0,RTRY=2,RMOD=1,UEIP=0,RDBD=0.1,URIP=1,RDBL=$(IOC):$(ECMC_MOTOR_NAME)-PosActSim' # Extra config for Motor record
|
||||
motorRecord:
|
||||
enable: true
|
||||
description: This is MR
|
||||
fieldInit: 'TWV=1000' # Extra config for Motor record
|
||||
|
||||
drive:
|
||||
numerator: 3600 # Fastest speed in engineering units
|
||||
@@ -35,31 +35,31 @@ drive:
|
||||
enabled: 1 # Enabled bit index in status word (not used if DS402)
|
||||
status: ec0.s$(DRV_SLAVE).driveStatus01 # Status word ethercat entry
|
||||
setpoint: ec0.s$(DRV_SLAVE).velocitySetpoint01 # Velocity setpoint if CSV. Position setpoint if CSP
|
||||
# reduceTorque: 2 # Reduce torque bit in drive control word
|
||||
# reduceTorqueEnable: True # Enable reduce torque functionality
|
||||
reduceTorque: 2 # Reduce torque bit in drive control word
|
||||
reduceTorqueEnable: True # Enable reduce torque functionality
|
||||
# brake:
|
||||
# enable: true # Enable brake
|
||||
# output: ec0... # Ethercat link to brake output
|
||||
# openDelay: 0 # Brake timing parameter in cycles (default 1kHz)
|
||||
# closeAhead: 0 # Brake timing parameter in cycles (default 1kHz)
|
||||
# reset: 1 # Reset (if no drive reset bit then leave empty)
|
||||
# warning: 2 # Warning (if no drive warning bit then leave empty)
|
||||
# error: # max 3
|
||||
# - 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)
|
||||
reset: 1 # Reset (if no drive reset bit then leave empty)
|
||||
warning: 2 # Warning (if no drive warning bit then leave empty)
|
||||
error: # max 3
|
||||
- 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:
|
||||
numerator: 360 # Scaling numerator example 360 deg/rev
|
||||
denominator: 12800 # Scaling denominator example 4096 ticks per 360 degree
|
||||
numerator: 720 # Scaling numerator example 360 deg/rev
|
||||
denominator: 8192 # 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'
|
||||
# absOffset: 0 # Encoder offset in eng units (for absolute encoders)
|
||||
# mask: '0xFFF00' # Mask applied to raw encoder value
|
||||
position: ec0.s$(DRV_SLAVE).positionActual01 # Ethercat entry for actual position input (encoder)
|
||||
control: ec0.s$(DRV_SLAVE).encoderControl01 # mandatory only if 'reset' is used
|
||||
status: ec0.s$(DRV_SLAVE).encoderStatus01 # mandatory only if 'warning' or 'error' are used
|
||||
position: ec0.s$(ENC_SLAVE).positionActual01 # Ethercat entry for actual position input (encoder)
|
||||
control: ec0.s$(ENC_SLAVE).encoderControl01 # mandatory only if 'reset' is used
|
||||
status: ec0.s$(ENC_SLAVE).encoderStatus01 # mandatory only if 'warning' or 'error' are used
|
||||
# ready: 10 # Bit in encoder status word for encoder ready
|
||||
# source: 0 # 0 = Encoder value from etehrcat hardware, 1 = Encoder value from PLC
|
||||
# reset: 1 # Reset (optional)
|
||||
@@ -165,11 +165,11 @@ softlimits:
|
||||
monitoring:
|
||||
lag:
|
||||
enable: true # Enable position lag monitoring (following error)
|
||||
tolerance: 2 # Allowed tolerance
|
||||
tolerance: 10 # Allowed tolerance
|
||||
time: 10 # Allowed time outside tolerance target:
|
||||
target:
|
||||
enable: true # Enable at target monitoring (needs to be enabled if using motor record)
|
||||
tolerance: 0.5 # Allowed tolerance
|
||||
tolerance: 0.1 # Allowed tolerance
|
||||
time: 10 # Filter time inside tolerance to be at target
|
||||
velocity:
|
||||
enable: true # Enable velocity monitoring
|
||||
@@ -183,20 +183,3 @@ monitoring:
|
||||
# time:
|
||||
# trajectory: 100 # Time allowed outside max diff velo before system init halt
|
||||
# drive: 200 # Time allowed outside max diff velo before system disables drive
|
||||
|
||||
#plc:
|
||||
# enable: true # Enable axis plc
|
||||
# externalCommands: true # Allow axis to inputs from PLC
|
||||
# file: ${PLC_PATH}test.plc
|
||||
# code: # Sync code
|
||||
# - "if(static.counter % ${LIMIT} == 0){println('AX PLC: Appended');static.counter:=0;};" # calculate set pos for physical axis
|
||||
# - "if(not(static.plc_code_loaded)) {static.counter:=static.counter+1;};"
|
||||
# - ec0.s$(DRV_SLAVE).ONE > 1; # Enable axis if one of master axes is enabled
|
||||
# - ec0.s$(DRV_SLAVE).ZERO > 1; # calculate set pos for physical axis
|
||||
# velocity_filter: # Filter used to smother velocity feedforward
|
||||
# encoder: # Filter plc enc velo
|
||||
# enable: false # Filter enable
|
||||
# size: 100 # Filter size
|
||||
# trajectory: # Filter plc traj velo
|
||||
# enable: false # Filter enable
|
||||
# size: 100 # Filter size
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
macros: LIMIT=1000,TYPE=1 # Macros to pass to this file (also plc.file)
|
||||
plc:
|
||||
id: 1
|
||||
enable: yes
|
||||
rateMilliseconds: 1
|
||||
file: ${PLC_PATH}test.plc
|
||||
code:
|
||||
- "if(static.counter % ${LIMIT} == 0){println('PLC: Appended');static.counter:=0;};" # calculate set pos for physical axis
|
||||
- "if(not(static.plc_code_loaded)) {static.counter:=static.counter+1;};"
|
||||
@@ -1,9 +0,0 @@
|
||||
###############################################################################################
|
||||
# For help on syntax, variables and functions, please read the file: "plcSyntaxHelp.plc"
|
||||
#
|
||||
# PLC Functionality Demo:
|
||||
# No hardware related variables
|
||||
#
|
||||
|
||||
static.time:=ec_get_time()/1E9;
|
||||
static.sineval:=sin(2*pi*${FREQ=10}*static.time);
|
||||
@@ -1,9 +0,0 @@
|
||||
static.counter:=static.counter+1;
|
||||
static.plc_code_loaded:=1;
|
||||
if(static.counter % ${LIMIT} == 0) {
|
||||
if(${TYPE}=0) {
|
||||
println('AX PLC: File');
|
||||
} else {
|
||||
println('PLC : File');
|
||||
};
|
||||
};
|
||||
@@ -45,13 +45,12 @@ ecmcConfigOrDie "Cfg.EcApplyConfig(1)"
|
||||
## AXIS 1
|
||||
#
|
||||
epicsEnvSet("DEV", "$(IOC)")
|
||||
epicsEnvSet("PLC_PATH", "/ioc/c6025a5a/ecmccfg/examples/test/ecmccomp/plc/")
|
||||
${SCRIPTEXEC} ${ECMC_CONFIG_ROOT}loadYamlAxis.cmd, "FILE=./cfg/axis.yaml"
|
||||
|
||||
##############################################################################
|
||||
## Load safety plugin
|
||||
#
|
||||
require ecmc_plugin_safety safety3
|
||||
require ecmc_plugin_safety sandst_a
|
||||
|
||||
# Create SS1 group
|
||||
#- EC_RAMP_DOWN : Ethercat entry for ramp down command, input to ecmc (command from safety PLC/system)
|
||||
@@ -62,14 +61,14 @@ epicsEnvSet(EC_RAMP_DOWN,"ec${ECMC_EC_MASTER_ID}.s${BI_SLAVE}.binaryInput08.0")
|
||||
epicsEnvSet(EC_AXES_REST,"ec${ECMC_EC_MASTER_ID}.s${BO_SLAVE}.binaryOutput07.0")
|
||||
epicsEnvSet(EC_AXES_MAX_VELO,"ec${ECMC_EC_MASTER_ID}.s${BO_SLAVE}.ONE.0")
|
||||
epicsEnvSet(SAFETY_TIMEOUT,500)
|
||||
${SCRIPTEXEC} ${ecmc_plugin_safety_DIR}addSS1Group.cmd "NAME=first,EC_RAMP_DOWN=${EC_RAMP_DOWN},EC_AXES_REST=${EC_AXES_REST},${EC_AXES_MAX_VELO},DELAY_MS=${SAFETY_TIMEOUT}"
|
||||
${SCRIPTEXEC} ${ecmc_plugin_safety_DIR}addSS1Group.cmd "NAME=first,EC_RAMP_DOWN=${EC_RAMP_DOWN},EC_AXES_REST=${EC_AXES_REST},EC_AXES_MAX_VELO=${EC_AXES_MAX_VELO=empty},DELAY_MS=${SAFETY_TIMEOUT}"
|
||||
|
||||
#- Add axis
|
||||
#- AX_ID : Axis ID
|
||||
#- VELO_REST_LIM : Velocity at rest limit [unit same as EGU of axis]
|
||||
#- VELO_MAX_LIM : Velocity maximum limit, -1 to disable [unit same as EGU of axis]
|
||||
${SCRIPTEXEC} ${ecmc_plugin_safety_DIR}addAxisToSafetyGroup.cmd "NAME=first,AX_ID=1,VELO_REST_LIM=1,VELO_MAX_LIM=100"
|
||||
#${SCRIPTEXEC} ${ecmc_plugin_safety_DIR}addAxisToSafetyGroup.cmd "NAME=first,AX_ID=1,VELO_REST_LIM=1"
|
||||
|
||||
|
||||
##############################################################################
|
||||
## Configure diagnostics:
|
||||
|
||||
@@ -291,6 +291,10 @@ void ecmcSS1SafetyGroup::connectToDataSources() {
|
||||
throw std::runtime_error( "Safety: EtherCAT entry for rampdown I/O NULL.");
|
||||
}
|
||||
|
||||
if(bitRampDown_ >= ecEntryRampDown_->getBits()) {
|
||||
throw std::runtime_error( "Safety: Bit out of range for rampdown ethercat entry.");
|
||||
}
|
||||
|
||||
// standstill
|
||||
slave = ecMaster_->findSlave(slaveIdStandStill_);
|
||||
if(!slave) {
|
||||
@@ -302,6 +306,9 @@ void ecmcSS1SafetyGroup::connectToDataSources() {
|
||||
throw std::runtime_error( "Safety: EtherCAT entry for standstill I/O NULL.");
|
||||
};
|
||||
|
||||
if(bitStandStill_ >= ecEntryStandstill_->getBits()) {
|
||||
throw std::runtime_error( "Safety: Bit out of range for standstill ethercat entry.");
|
||||
}
|
||||
|
||||
// Limit velo
|
||||
if( limitMaxVeloEnable_ ) {
|
||||
@@ -314,6 +321,10 @@ void ecmcSS1SafetyGroup::connectToDataSources() {
|
||||
if(!ecEntryLimitVelo_) {
|
||||
throw std::runtime_error( "Safety: EtherCAT entry for limit velo I/O NULL.");
|
||||
};
|
||||
|
||||
if(bitLimitVelo_ >= ecEntryLimitVelo_->getBits()) {
|
||||
throw std::runtime_error( "Safety: Bit out of range for limit velo ethercat entry.");
|
||||
}
|
||||
}
|
||||
dataSourcesLinked_ = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user