2.5.3 StepNLoop Closed Loop Control operation
The Commander core features a closed-loop position verification algorithm called StepNLoop. The algorithm requires the use of an incremental encoder.
StepNLoop performs the following operations:
- Position Verification: At the end of any targeted move, StepNLoop will perform a correction if the current error is greater than the tolerance value (SLT[axis]).
- Delta Monitoring: The delta value is the difference between the actual and the target position. When delta exceeds the error range value (SLE[axis]), the motor is stopped and the StepNLoop status goes into an error state. Delta monitoring is performed during moves – including homing and jogging. To read the delta value, use the D[axis] command.
StepNLoop is commonly used to close a position loop on stepper systems (encoder on back of motor). StepNLoop can also be used for the external position loop on stepper or servo systems, which have a loss of motion due to backlash or hysteresis, as long as the encoder feedback to the Commander core is from the final work-point instead of the motor. See Figures "Encoder at motor" and "Encoder at workpoint" below, as examples.
Encoder at motor Encoder at work-point
This table outlines how StepNLoop behaves in different scenarios.
Condition |
StepNLoop behavior (motor is moving) |
StepNLoop behavior (motor is idle) |
δ ≤ SLT |
Continue to monitor the D[axis] |
In Position. No correction is performed. |
δ >SLT AND δ < SLE |
Continue to monitor the D[axis] |
Out of Position. A correction is performed. |
δ >SLT AND δ > SLE |
Stall Error. Motor stops and signals an error*. |
Error Range Error. Motor stops and signals an error*. |
Correction Attempt > SLA |
N/A |
Max Attempt Error. Motor stops and signals an error*. |
StepNLoop behavior
Key:
[δ]: |
Error between the target position and actual position |
SLT: |
Tolerance range |
SLE: |
Error range |
SLA: |
Max. correction attempt |
Footnote:
* The error status here is not the main status (MST) but the status (SLS) of the compensation operation.
In order to perform the StepNLoop Closed Loop Control operation, the following four parameters must be set beforehand. Parameters should be set for each axis.
StepNLoop Parameter |
Description |
Command |
StepNLoop Ratio |
The ratio between motor pulses and encoder counts. This ratio will depend on the motor type, micro-stepping, encoder resolution, and decoding multiplier. The value must be in the range [0.001, 999.999]. |
SLR[axis] |
Tolerance |
The maximum error between target and actual position that is considered “In Position.” In this case, no correction is performed. Units are in encoder counts. |
SLT[axis] |
Error Range |
The maximum error between target and actual position that is not considered a serious error. If the error exceeds this value, the motor will stop immediately and go into an error state. |
SLE[axis] |
Correction Attempt |
The maximum number of correction tries that the controller will attempt before stopping and going into an error state. Setting SLA[axis]=0 will allow for infinite number of correction tries. |
SLA[axis] |
With StepNLoop enabled: When making a move to a target position (Red Line above), if the final position is inside the tolerance range set by SLT[axis] (Green area above), then the move is finished successfully. If the move ends inside the error range set by SLE[axis] (Orange area above), the StepNLoop process will attempt to move the motor position until it is inside the tolerance range. If the motor position ends outside the error range (Blue area above), or it takes more than the number of times set by Correction Attempt SLA[axis], an error is returned, and the StepNLoop correction process ends.
A convenient way to find the StepNLoop ratio is to set EX=0, PX=0 and move the motor +1000 pulses. The ratio can be calculated by dividing 1000 by the resulting EX value. Note that the value must be positive. If it is not, then the direction polarity must be adjusted. This test should be performed while StepNLoop is disabled.
To enable/disable the StepNLoop feature use the SL[axis] command. To read the StepNLoop status, use SLS[axis] command. See table SLS command below for a list of the return values.
Value |
Description |
0 |
Idle |
1 |
Moving |
2 |
Correcting |
3 |
Stopping |
4 |
Aborting |
5 |
Jogging |
6 |
Homing |
7 |
Z-Homing |
8 |
Correction range error. To clear this error, use CLR command. |
9 |
Correction attempt error. To clear this error, use CLR command. |
10 |
Stall Error. D value has exceeded the correction range value. To clear this error, use CLR command. |
11 |
Limit Error |
12 |
N/A (i.e. StepNLoop is not enabled) |
SLS command
While StepNLoop is enabled, position move commands are in term of encoder position. For example, X1000 means to move the motor to encoder position 1000. This applies to individual as well as interpolated moves.
Additionally, once StepNLoop is enabled, the speed is in encoder speed. For example, HSPD=1000 when StepNLoop is enabled means that the target high speed is 1000 encoder counts per second. This only applies to individual axis moves.
For linear interpolated movement, the speed is calculated as pulse/sec, NOT encoder counts/sec. The same will apply to the X and Y axis while performing arc/circular interpolated moves.
ASCII |
||||||
Standalone |
SL[axis] |
⎯ |
⎯ |
⎯ |
⎯ |
SLS[axis] |
Operating procedure
If there is no change in previous set data, operation 1 below is not necessary.
- Set each setting value of StepNLoop Closed Loop Control operation.
- Enable the StepNLoop Closed Loop Control operation function with the SL command.
- Execute a positioning operation.
- A StepNLoop Closed Loop Control operation is executed after the positioning operation is completed.
Operating conditions
- Joystick operation is invalid
- Buffer operation is invalid
- The error status is clear
Related commands
SL, SLR, SLT, SLE, SLA, SLS
< Previous Chapter | Topic Home | Home | Next Topic >