Overview
Torque-limited motion control is a safety-critical pattern in machine automation: when a drive reports that mechanical resistance has crossed a configured threshold (jam, tool wear, workpiece misalignment, end-stop contact), the controller must halt the active move, retract to a safe position, and either resume the original program or branch to a recovery routine. This article documents the implementation of torque limit detection, abort sequencing, and program resumption on a SINAMICS-driven axis controlled by a PLC executing PLCopen motion function blocks. The same architectural pattern applies to IndraDrive, PowerFlex, KEB, and Bosch Rexroth IndraMotion platforms with minor telegram and tag-name substitutions.
The reference topology is a SIMATIC S7-1500 or SIMOTION controller connected to a SINAMICS S120 drive over PROFINET IRT, with the axis controlled through the PLCopen part 1 and part 2 motion profile. Torque feedback is read from the drive via the standard PROFIdrive telegram extension (telegram 1, 2, 3, 4, or 5 with additional torque actual value words), and the PLCopen function block MC_TorqueLimiting (or the equivalent axis library AxisControl block) is used to monitor the limit. The abort sequence is implemented as a finite state machine driven from a background task, with motion tasks invoked for the recovery path.
Prerequisites
-
Controller: SIMATIC S7-1500 (firmware V2.5 or later) with TIA Portal V17 or later, or SIMOTION D4xx with SCOUT TIA. The PLCopen library AxisControl (or the LCom/MC library for SIMOTION) must be installed and the axis FB instance
MC_Axis_REFgenerated. - Drive: SINAMICS S120 with CU320-2 control unit firmware V5.2 SP3 or later. The drive must be commissioned in STARTER or Startdrive and the active telegram configured with the torque actual value PZD word.
- PROFINET: PROFINET IRT topology with the drive assigned to a sync domain. The controller is the sync master. Update time 1 ms for high-dynamic torque monitoring; 4 ms is acceptable for slow clamping operations.
-
PLCopen library: The PLCopen Motion Control part 1 library shipped with TIA Portal provides
MC_Power,MC_MoveAbsolute,MC_MoveRelative,MC_Stop,MC_Halt, andMC_TorqueLimiting. For SIMOTION, the LAxisBasic or LAxisControl library provides the equivalent commands. -
Torque limit source: The torque limit is applied in the drive as a function of p1520/p1521 (positive/negative torque limit) or via the supplementary torque setpoint in the telegram. The PLCopen
MC_TorqueLimitingFB writes a normalized value to the drive's torque limit input.
Extending the PROFIdrive Telegram for Torque Feedback
The default PROFIdrive telegram 1 (Standard Telegram 1, PZD-2/2) contains control word 1 (STW1) and speed setpoint (NSOLL) in the downward channel, and status word 1 (ZSW1) and speed actual value (NIST) in the upward channel. To read torque actual value (MIST) and torque utilization (M_LIM), extend the upward channel. SINAMICS supports two methods:
- Standard Telegram with extension: Configure telegram 1 + torque extension (PZD-3/5) in Startdrive. This adds MIST (16-bit, scaling 4000 hex = 100% of p2003) to the receive PZD list.
- SIEMENS Telegram 136: Use telegram 136 (PZD-14/16) which contains a full motion control interface including torque actual, torque setpoint, and torque utilization. This telegram is the default for SIMOTION axes and is also available on S7-1500 with the TO axis.
In the PLC project, map the additional PZD words to a data block. Example mapping for an S7-1500 TO axis on telegram 136 with PROFINET slot 1, subslot 1:
| PZD Index | Direction | Signal | Data Type | Address (DB) |
|---|---|---|---|---|
| PZD1 | From drive | ZSW1 (Status Word 1) | WORD | %IW100 |
| PZD2 | From drive | NIST (Speed Actual) | INT (N2) | %IW102 |
| PZD3 | From drive | MIST (Torque Actual) | INT (N2) | %IW104 |
| PZD4 | From drive | M_LIM (Torque Utilization) | INT | %IW106 |
| PZD5 | To drive | STW1 (Control Word 1) | WORD | %QW100 |
| PZD6 | To drive | NSOLL (Speed Setpoint) | INT (N2) | %QW102 |
| PZD7 | To drive | M_LIM (Torque Limit) | INT (N2) | %QW104 |
Reference: SINAMICS S120 Function Manual (FH1) chapter "PROFIdrive profile" and PROFIdrive Profile Drive Technology Technical Specification.
PLCopen Function Block Architecture
The PLCopen motion library provides the MC_TorqueLimiting function block (PLCopen part 2). It dynamically writes a torque limit to the drive during motion and exposes a InTorqueLimit boolean output that becomes TRUE the moment the drive's actual torque reaches the configured limit value. The block is executed cyclically in the motion task; the InTorqueLimit signal is the primary trigger for the abort state machine.
For axes that do not require dynamic torque limiting, the drive's r1407.8 status bit (Torque limit reached) on SINAMICS S120 is sufficient. This bit is mapped into ZSW1 bit 11 in the standard PROFIdrive profile, so no telegram extension is required for the basic detection case.
Axis FB Instance
The axis is instantiated from the PLCopen AxisControl library. The standard instance exposes the following tags used by the abort sequence:
-
Axis.Status.actualTorque(LREAL, normalized to 1.0 = p2003 reference torque) -
Axis.Status.torqueLimitActive(BOOL, equivalent to drive r1407.8) -
Axis.Status.actualPosition(LREAL, in user units, e.g. mm or deg) -
Axis.Cmd.position(LREAL, last commanded position) -
Axis.Cmd.velocity(LREAL, last commanded velocity)
State Machine Design for Abort and Recovery
The control logic is a five-state finite state machine executed in a slow background task (OB1 cycle time 10–20 ms is sufficient; the motion FBs run in the servo task at 1 ms):
State definitions:
- IDLE: Axis enabled, no active command. Transition to RUN_MOTION on program start.
-
RUN_MOTION: PLCopen motion FB (
MC_MoveAbsoluteorMC_MoveRelative) active. The background task pollstorqueLimitActiveor comparesactualTorqueagainst the configuredTlimthreshold. On detection, latches the current commanded position intolatchedPosand transitions to ABORT_DETECTED. -
ABORT_DETECTED: Calls
MC_Haltwith deceleration 2× the run deceleration. WhenMC_Halt.Doneis TRUE, transitions to RETRACT and saves the halt-end position ashaltPos. -
RETRACT: Issues
MC_MoveRelativeby-retractDistance(e.g. -5 mm or -10 deg) at reduced velocity. OnDone, transitions to RESUME_OR_FAULT. -
RESUME_OR_FAULT: Two sub-paths based on operator input or process logic. (a) Resume: re-issue the original motion to
latchedPos, then continue the program. (b) Fault: set the process fault latch and require operator acknowledge before returning to IDLE.
Structured Text Implementation
The following SCL (Structured Control Language) code runs in OB1 (the background task) and is the core of the torque-limit abort logic. It uses the SIMATIC S7-1500 PLCopen AxisControl library and an S7-1500 TO (Technology Object) named TO_Axis_1.
// ============================================================
// Torque-limit abort state machine (OB1, background task)
// Inputs from technology object: TO_Axis_1
// Outputs to operator panel: HMI_AbortState, HMI_Torque
// ============================================================
TYPE eState : (eIDLE, eRUN, eABORT, eRETRACT, eRESUME); END_TYPE
VAR RETAIN
State : eState := eIDLE;
LatchedPos : LREAL; // position at abort detection
HaltPos : LREAL; // position after MC_Halt
TorqueLimitPct : LREAL := 0.80; // 80% of p2003
RetractDist : LREAL := 5.0; // mm or deg
ResumeVel : LREAL := 50.0; // mm/s
ResumeAcc : LREAL := 200.0; // mm/s^2
END_VAR
VAR
fbHalt : MC_Halt;
fbRetract : MC_MoveRelative;
fbResume : MC_MoveAbsolute;
fbTorqLimit : MC_TorqueLimiting;
HaltBusy : BOOL;
RetractBusy : BOOL;
ResumeBusy : BOOL;
END_VAR
// 1. Torque limit write (always active while axis enabled)
fbTorqLimit(
Axis := TO_Axis_1,
Enable := (State = eRUN) OR (State = eRETRACT),
Limit := TorqueLimitPct,
LimitMode := mcTORQUE_LIMIT_PCT_NOM,
InTorqueLimit => HMI_TorqueLimitActive
);
// 2. State machine
CASE State OF
eIDLE:
IF ProgramStart THEN
LatchedPos := 0.0;
State := eRUN;
END_IF;
eRUN:
// Detect torque exceedance
IF HMI_TorqueLimitActive OR (TO_Axis_1.Status.actualTorque >= TorqueLimitPct) THEN
LatchedPos := TO_Axis_1.Status.actualPosition;
HaltBusy := TRUE;
State := eABORT;
END_IF;
eABORT:
// Decelerate to zero via MC_Halt
IF HaltBusy THEN
fbHalt(
Axis := TO_Axis_1,
Deceleration := 400.0, // mm/s^2, 2x run decel
Jerk := 0.0, // trapezoidal
Execute := TRUE,
Done => HaltBusy // self-resets via logic below
);
IF fbHalt.Done THEN
HaltPos := TO_Axis_1.Status.actualPosition;
fbHalt(Execute := FALSE); // edge reset
HaltBusy := FALSE;
RetractBusy := TRUE;
State := eRETRACT;
END_IF;
END_IF;
eRETRACT:
// Move back by RetractDist at reduced velocity
IF RetractBusy THEN
fbRetract(
Axis := TO_Axis_1,
Execute := TRUE,
Distance := -RetractDist,
Velocity := ResumeVel * 0.5,
Acceleration := ResumeAcc,
Deceleration := ResumeAcc,
Jerk := 0.0,
Done => RetractBusy
);
IF fbRetract.Done THEN
fbRetract(Execute := FALSE);
RetractBusy := FALSE;
State := eRESUME;
END_IF;
END_IF;
eRESUME:
// Operator choice: resume the original program, or hold and fault
IF HMI_ResumeCmd AND NOT ResumeBusy THEN
ResumeBusy := TRUE;
fbResume(
Axis := TO_Axis_1,
Execute := TRUE,
Position := LatchedPos,
Velocity := ResumeVel,
Acceleration := ResumeAcc,
Deceleration := ResumeAcc,
Done => ResumeBusy
);
END_IF;
IF HMI_FaultAck THEN
ResumeBusy := FALSE;
fbResume(Execute := FALSE);
State := eIDLE;
END_IF;
IF fbResume.Done THEN
fbResume(Execute := FALSE);
ResumeBusy := FALSE;
// Hand control back to caller program
ProgramStart := FALSE;
State := eIDLE;
END_IF;
END_CASE;
HMI_AbortState := State; // for HMI display
Background Task vs Motion Task Execution
A common implementation mistake is to call the motion FBs from the same OB that runs the HMI or business logic, with cycle time 50–100 ms. This is too slow for torque detection on a fast axis: at 1 m/s, a 50 ms scan lag allows the drive to advance 50 mm after the torque threshold is crossed, often past the jam point and into mechanical damage. The correct split is:
-
Servo / IPO task (1 ms, OB91 in S7-1500): Runs the PLCopen
MC_TorqueLimitingFB and the actual torque comparison. This task reads the drive's torque actual value at the PROFINET IRT update rate. -
Background task (10–20 ms, OB1): Runs the state machine, HMI data exchange, and non-time-critical logic. The motion FBs themselves (
MC_Halt,MC_MoveRelative) are issued from OB1 but are processed by the technology object asynchronously.
For SIMOTION controllers, the equivalent split is between the Servo task (IPO fast, < 1 ms) and the Background task (cyclic, 10 ms). The execution system automatically routes PLCopen calls to the correct task level when the axis is assigned to the Servo task.
Commissioning and Verification
- Signal test (offline): Force the torque actual value in the drive (via Startdrive control panel, p1545 = torque setpoint source) to 0%, 50%, 100% of p2003 and confirm the PLC reads the correct value. The scaling is 0x4000 = 100% of p2003 in the PROFIdrive N2 format.
- Static load test: With the axis stationary, command a low torque limit (e.g. 5%) and apply a manual push on the mechanism. The PLC must transition to ABORT_DETECTED within 2 PROFINET cycles (2 ms at 1 ms update).
-
Dynamic test: Run the program at full velocity and trigger an artificial jam (e.g. clamp the axis). Record the trace of
actualTorque,actualPosition, andStatein the TIA Portal trace. The abort should occur within 5 mm of the trigger point at 1 m/s velocity. - Recovery test: Confirm the retract distance is sufficient to fully clear the obstruction. On a vertical axis, ensure the retract direction is positive torque (against gravity) if the load is held by the motor.
-
Resume test: Verify that
LatchedPosis the position at the moment of detection, not at the moment of halt completion. Using halt-completion position as the resume target will overshoot by the halt stopping distance.
Cross-Platform Notes
KUKA RSI and kuka_rsi_hw_interface
When a KUKA robot is controlled via the ROS 2 kuka_rsi_hw_interface package, the controller monitors the robot's joint torque feedback over the RSI (Robot Sensor Interface) UDP socket. A "command gear torque" error on axes A3/A2 typically indicates the gearbox mechanical limit is being exceeded, often because the programmed path drives the arm into a singularity or payload exceeds the rated dynamic capacity. The fix is to (a) reduce acceleration in the RSI motion command, (b) verify the payload mass and inertia in robot_config.yaml, and (c) lower the RSI command rate from 250 Hz to 125 Hz if CPU saturation is suspected. Reference: kuka_experimental issue #126.
Rockwell Studio 5000 / Logix Designer
On a ControlLogix or CompactLogix platform with a Kinetix 5700 drive, the equivalent PLCopen Motion Direct Command does not expose MC_TorqueLimiting directly. Instead, the MAAT (Motion Axis Attribute) torque limiting is used, and the Motion Axis Homing routine is configured for Torque Limit home mode. The Home to Torque Limit Sequence in Studio 5000 application note describes the exact pattern: the actual torque level is monitored, and when it reaches the limit for 500 ms continuously, a status flag sets and the homed position is latched. The same 500 ms debounce pattern is recommended for the abort sequence to avoid nuisance triggers on transient torque spikes.
Bosch Rexroth IndraMotion / ctrlX
On IndraDrive or ctrlX DRIVE, the MB_TorqueLimit function block from the Rexroth IndraLogic library writes the limit to S-0-0092 (Torque limit positive) and S-0-0093 (Torque limit negative). The actual torque value is read from S-0-0084 (Torque actual value). The drive's status word returns bit Torque limit reached in P-0-0116. For high-precision applications, Bosch Rexroth provides cogging torque and cogging force compensation which pre-shapes the torque setpoint to reduce the ripple that can otherwise cause false torque limit triggers on slow-speed moves.
Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Remediation |
|---|---|---|---|
| Abort never triggers despite visible stall | Torque threshold set above p2003 reference, or actual torque scaling wrong | Read r0031 (actual torque smoothed) in Startdrive trace, compare to PLC %IW104 | Set TorqueLimitPct to a value below p2003 * (max mechanical torque / rated torque); verify scaling = 0x4000 = p2003 |
| Abort triggers on every move start | Acceleration torque exceeds limit | Trace actualTorque during accel phase | Use MC_TorqueLimiting only during the constant-velocity phase, or raise the limit during accel and lower it after |
| Resume overshoots the original position | LatchedPos saved at halt completion, not at detection | Add a trace tag for both values | Save LatchedPos on the rising edge of HMI_TorqueLimitActive, not on MC_Halt.Done |
| HMI shows InTorqueLimit but PLC does not branch | MC_TorqueLimiting Enable is FALSE | Watch the Enable input in the axis DB | Set Enable = TRUE while State = eRUN OR eRETRACT |
| Retract moves in wrong direction | Mechanical layout: jam is in +X, retract must be -X | Manual jog in both directions after fault | Sign of RetractDist must be opposite to the force direction at the jam |
| Axis faults with F07901 on SINAMICS | Motor stalled for > configured time (p2177) | Check r2132 bit 12 in expert list | Raise p2177, or shorten the abort sequence scan time |
Field-Proven Caveats
- On a vertical axis with a held load,
MC_Haltfollowed by a relative retract can drop the load if the drive's hold control is not enabled. Enable p1400.1 (speed controller hold) and p1502 (freeze ramp-function generator) on SINAMICS, or use the equivalent IndraDrive command Stop with hold. - If the abort path is triggered by a non-torque event (e.g. E-Stop category 1), do not issue
MC_Haltfirst. The drive's internal ramp will conflict with the E-Stop ramp. The standard pattern is to let the drive's STO (Safe Torque Off) or SS1 (Safe Stop 1) handle the E-Stop, and only use the PLCopen abort path for process-level torque events. - The
MC_TorqueLimitingblock writes the limit on every cycle whileEnableis TRUE. If you call it from the background task at 20 ms, the drive receives a new limit value at 50 Hz. This is fine for clamping, but for very fast tool-monitoring (e.g. drill breakage detection) move the call to the servo task so the limit can be updated at 1 kHz. - When the
InTorqueLimitsignal is latched, it stays TRUE until the next motion command. If you need to detect a second jam after a resume, dropEnablefor one cycle, then re-assert. Otherwise the second jam is masked by the still-set flag.
What is the minimum cycle time for reliable torque limit detection on SINAMICS S120?
The PLCopen MC_TorqueLimiting block samples the drive's torque actual value at the PROFINET IRT update time. For S120 with a 1 ms PROFINET update, a servo task cycle of 1 ms is recommended. With a 4 ms update, the minimum detection lag is two cycles (8 ms). At 1 m/s axis velocity, that is 8 mm of travel past the threshold, which must be added to the safety margin when sizing the mechanical end-stop.
Can I use MC_TorqueLimiting together with MC_MoveAbsolute on the same axis instance?
Yes. MC_TorqueLimiting is a passive supervising FB that writes a torque limit while its Enable input is TRUE, and it does not command motion. The axis can be in any motion state (Discrete Motion, Continuous Motion, Synchronized) while torque limiting is active. The InTorqueLimit output is the diagnostic signal that the calling program uses to branch.
How do I scale the torque actual value from the PROFIdrive telegram?
SINAMICS uses the N2 (16-bit normalized) format: 0x4000 (16384 decimal) corresponds to 100% of the reference torque defined in p2003. A negative value indicates a braking torque in the opposite direction. To convert to physical Nm, multiply by p2003 / 16384. If p2003 is set to 50 Nm and the raw value is 0x2000 (8192), the actual torque is 25 Nm.
Why does my axis fault with F07901 (motor stalled) before the PLC abort sequence runs?
F07901 fires when the motor speed is below the stall speed threshold p2175 for longer than p2177, and the torque has reached the torque threshold p2192. If this fires before the PLC's torque limit logic can complete, the drive's stall monitoring is more sensitive than your PLC logic. Either raise p2177, raise p2192, or move your PLC torque limit to the servo task so the reaction is faster than the drive's stall time.
Do I need to extend the telegram if I only need the torque limit reached bit?
No. The torque limit reached status is bit 11 of the PROFIdrive status word ZSW1, which is present in every standard telegram (1 through 5) and in SIEMENS telegram 136. The bit is driven by the drive's r1407.8 internal signal. You only need to extend the telegram (add a PZD word) if you want the actual torque numerical value, not just the boolean reached state.