From RSI - Robotic Systems Integration - SynqNet Systems
Contents |
What are User Limits
User Limits are a functionality through which user can configure input comparisons which can trigger outputs and other SynqNet events. A User Limit will evaluate conditions set by the user. These conditions will be processed in the firmware of the SynqNet card. When these conditions are met, the User Limit will generate an interrupt and can also output 32-bit word to any location in the SynqNet firmware.
Each axis in the SynqNet controller has 16 User Limits available.
Each User Limit has two input conditions and one output configuration block.
When would I use User Limits
- Monitor axis position and change proportional gain (Kp) when axis reaches a user defined position
- Monitor axis position and change state of a Digital Output (SLICE I/O module) when axis reaches user defined position
- Generate ESTOP ABORT event when axis reaches a specific user defined position
- Generate ESTOP event on axis-1 when axis-0 reaches a user defined position
Can you explain the RapidCode methods used for User Limits in detail
The main methods used for User Limits in RapidCode are:
1. UserLimitConditionSet (long number, long conditionNumber, long type, void * address, long mask, long limitValue)
2. UserLimitOutputSet (long number, long andMask, long orMask, long * outputPtr, long enabled)
3. UserLimitConfigSet (long number, long status, long logic, double duration)
4. UserLimitStateGet (long number)
Let's discuss each method in detail:
UserLimitConditionSet
UserLimitConditionSet (long number, long conditionNumber, long type, void * address, long mask, long limitValue)
This method should be called first. UserLimitConditionSet configures user limits to evaluate an input bit. It sets a condition for when the user limit should trigger.
- long number: user needs to enter the user limit number that will be used. This is very straightforward. There are 16 available user limits for an axis. Ex: would be RSIEventTypeLIMIT_USER0, RSIEventTypeLIMIT_USER1 and etc.
- long conditionNumber: user needs to enter the number of input bits to be compared. If user wants to compare one input bit then conditionNumber would be set to 0. Maximum of two input conditions can be tracked. Ex: user wants to compare the input condition of only single axis position.
If user intends on tracking two input conditions, call the function twice using 0 for the first condition and 1 for the 2nd. Ex: user wants to monitor input bits of axis-2 & axis-3 position.
- long type: user to choose how input value would be compared. See below for valid options. Ex: user wants to compare an actual position to see when actual position is greater than 2000 counts. User would have to enter RSIXmpLimitTypeGT
- void * address: user needs to enter the address of the input. User can call RsiAxis::AddressGet() or RsiController::AddressFromStringGet() to get the address of a particular input. See below for sample addresses for the RsiAxis::AddressGet() function
- long mask: user will have to decide the bits in an address which need to be used when comparing. Use 0xFFFFFFFF when a long or float comparison is desired
- long limitValue: The value to be compared which needs to be set here. Ex: if user wants the User Limit to trigger when axis-0 position is greater than 2000 counts, then 2000 would be the limitValue
Ex: For a Digital Input Slice I/O, if the 4th bit is changing then the user would simply enter: 0x00010000.
Below are the enumerations for each input discussed above for the UserLimitConditionSet method:
long number:
RSIEventTypeLIMIT_USER0 User Limit 0
RSIEventTypeLIMIT_USER1 User Limit 1
RSIEventTypeLIMIT_USER2 User Limit 2
RSIEventTypeLIMIT_USER3 User Limit 3
RSIEventTypeLIMIT_USER4 User Limit 4
RSIEventTypeLIMIT_USER5 User Limit 5
RSIEventTypeLIMIT_USER6 User Limit 6
RSIEventTypeLIMIT_USER7 User Limit 7
RSIEventTypeLIMIT_USER8 User Limit 8
RSIEventTypeLIMIT_USER9 User Limit 9
RSIEventTypeLIMIT_USER10 User Limit 10
RSIEventTypeLIMIT_USER11 User Limit 11
RSIEventTypeLIMIT_USER12 User Limit 12
RSIEventTypeLIMIT_USER13 User Limit 13
RSIEventTypeLIMIT_USER14 User Limit 14
RSIEventTypeLIMIT_USER15 User Limit 15
long type:
RSIXmpLimitTypeFALSE False
RSIXmpLimitTypeTRUE True
RSIXmpLimitTypeGT Greater than
RSIXmpLimitTypeGE Greater than or equal to
RSIXmpLimitTypeLT Less than
RSIXmpLimitTypeLE Less than or equal to
RSIXmpLimitTypeEQ Equal
RSIXmpLimitTypeBIT_CMP Bit comparison
RSIXmpLimitTypeNE Not equal
RSIXmpLimitTypeABS Absolute value
RSIXmpLimitTypeABS_GT Greater than absolute value
RSIXmpLimitTypeABS_LE Less than absolute value
RSIXmpLimitTypeFGT Floating point greater than
RSIXmpLimitTypeFGE Floating point greater than or equal to
RSIXmpLimitTypeFLT Floating point less than
RSIXmpLimitTypeFLE Floating point less than or equal to
RSIXmpLimitTypeFEQ Floating point equal
RSIXmpLimitTypeFNE Floating point not equal
RSIXmpLimitTypeFABS Floating point absolute value
RSIXmpLimitTypeFABS_GT Floating point greater than absolute value
RSIXmpLimitTypeFABS_LE Floating point less than absolute value
void *address:
RSIAxisAddressTypeACTUAL_POSITION, Actual Position
RSIAxisAddressTypeCOMMAND_POSITION, Command Position
RSIAxisAddressTypePOSITION_ERROR, Position Error
RSIAxisAddressTypeACTUAL_VELOCITY, Actual Velocity
RSIAxisAddressTypeCOMMAND_VELOCITY, Command Velocity
RSIAxisAddressTypeCOMMAND_ACCELERATION, Command Acceleration
RSIAxisAddressTypeSTATUS, Axis Status
RSIAxisAddressTypeMOTION_STATUS, Motion Status
RSIAxisAddressTypeDEMAND, Filter Output
RSIAxisAddressTypeDIGITAL_OUTPUTS, Digital Output
RSIAxisAddressTypeDIGITAL_INPUTS, Digital Input
To track more complex input bit addresses. User can get the address from vm3 or contact us.
UserLimitOutputSet
UserLimitOutputSet (long number, long andMask, long orMask, long * outputPtr, long enabled)
This method allows the user to configure the output to be triggered. The output will only be triggered if the input conditions are TRUE.
- long number: user needs to enter the User Limit enumerations that will be used. 16 User Limits are available for one axis. Ex: RSIEventTypeLIMIT_USER0 up to RSIEventTypeLIMIT_USER15 possible
- long andMask: this is a 32-bit AND mask. long andMask is always computed before long orMask. Bit mask will be AND-ed with the data pointed by long *outputPtr. Ex: AND gates concept is explained later
- long orMask: this is a 32-bit OR mask. Bit mask will be OR-ed with the result of (andMask & *outputPtr)
- long *outputPtr: pointer to any location in the SynqNet controller firmware
- long enabled: if TRUE, the output AND-ing and OR-ing will be executed when the User Limit triggers
UserLimitConfigSet
UserLimitConfigSet (long number, long status, long logic, double duration)
This method configures a User Limit. Please read individual inputs in the method to understand this method better.
- Long number: user needs to enter the User Limit that will be used. There are 16 available user limits for an axis. Ex: RSIEventTypeLIMIT_USER0 up to RSIEventTypeLIMIT_USER15 possible
- Long status: user needs to enter the action when a User Limit is triggered. Ex: If user enters RSIXmpStatusESTOP_ABORT and a User Limit triggers, method will change the output bit by computing the andMask & orMask on the outputPtr and an ESTOP_ABORT will be commanded on the axis
Ex: If user enters RSIXmpStatusLIMIT, method will only compute the andMask and orMask on the outputPtr, no action will occur on the axis.
- Long logic: if method UserLimitConditionSet has two conditions, user will decide how both the conditions will be compared
Ex: If both conditions need to be true then RSIXmpLogicAND can be used. Enumerations are provided below.
Ex: If only one condition is kept track of then RSIXmpLogicSINGLE is entered.
- Long duration: user needs to enter the duration (in seconds) the conditions need to be evaluated as TRUE before the User Limit triggers
Ex: This really helps the users where systems temporarily change the state of an input condition due to noise spikes.
long status:
RSIXmpStatusSTOP STOP
RSIXmpStatusESTOP E-STOP
RSIXmpStatusESTOP_ABORT E-STOP then ABORT
RSIXmpStatusESTOP_CMD_EQ_ACT E-STOP then set Command = Actual
RSIXmpStatusABORT ABORT
RSIXmpStatusLIMIT Limit
long logic:
RSIXmpLogicNEVER Never evaluate
RSIXmpLogicSINGLE Evaluate first condition
RSIXmpLogicDOUBLE Not used
RSIXmpLogicTYPE_MASK Type Mask
RSIXmpLogicOR OR conditions
RSIXmpLogicAND AND conditions
Can you explain the AND & OR mask used in the User Limits methods
As mentioned above, AND Mask is executed before OR Mask. Basically andMask is AND-ed to outputPtr and then orMask is OR-ed to the result of (andMask and outputPtr).
Truth table for AND Gate:

Truth table for OR Gate:

An example for user using User Limits:

RapidCode Sample Applications
1.user_limit_digital_input_action.cpp
2.user_limit_gain_change_based_on_position_.cpp
3.user_limit_state_action_.cpp
4.usrlim1.cpp