1. Problem Overview
A SINAMICS S120 axis controlled via the SIMATIC SINA_POS telegram block from a higher-level SIMOTION, SIMATIC S7-1500, or T-CPU controller exhibits a non-zero following error after the position setup mode is exited and absolute/relative positioning is started. The drive appears to add the residual following error from the setup phase to the new position setpoint, so the axis overshoots or undershoots the target. This document covers root causes, parameter changes, third-party encoder handling, and the trace-based verification procedure.
The reported symptom on the platform is consistent with one or more of the following field conditions:
- Speed pre-control
p2534is set to 0 % (default) on firmware versions where this parameter can fully eliminate following error during constant velocity. - Position controller proportional gain
p2536(Kv factor) is too low for the mechanical load. - The encoder is wired to the CU320-2 via a CUA31 control unit adapter and is not a Siemens DRIVE-CLiQ encoder; pulse number, resolution, or counting direction is mis-configured.
- A third-party induction motor is operated without completing the motor data identification routine, leaving the field-weakening and slip models inaccurate and dragging the torque pre-control output.
- Trace
r2665shows a steady-state DC offset (typical value reported: 2,500-4,500 LU), which is characteristic of an open current loop or encoder scaling mismatch rather than a tuning problem.
2. Following Error Fundamentals
The following error is the closed-loop position error that remains after the position controller has acted on it. In a SIMOVERT/SINAMICS context it is defined in length units (LU) so that the mechanical and software views of the axis share a single unit basis.
Definition:
e_follow [LU] = s_setpoint [LU] − s_actual [LU]
where s_setpoint is the smoothed position setpoint from the interpolator (r2665 is derived from this), and s_actual is the position actual value from the encoder interface (r2521).
Under ideal conditions, a P-only position controller cannot drive the following error to zero for a constant-velocity motion because a non-zero speed is required to produce a non-zero setpoint velocity, and that speed can only be commanded when a non-zero position error exists. The Kv gain defines the linear relationship:
n_setpoint [rpm] = e_follow [LU] × Kv [1000/min]
For constant velocity, the steady-state following error is therefore:
e_follow,ss = v_setpoint / Kv
To bring this error to zero without sacrificing dynamic response, SINAMICS provides setpoint pre-control: a copy of the velocity and acceleration reference is added to the position controller output, bypassing the proportional path during the constant-velocity and constant-acceleration phases.
3. SINAMICS S120 Position Control Architecture
The SINAMICS S120 position control chain with the standard servo control structure (active when p0108 bit 12 is set or under SERVO control mode) is:
-
Position setpoint input via PROFIdrive telegram 110 (SINA_POS) or 111 — the PLC writes
MDI_TARPOS,MDI_VELOCITY,MDI_ACCEL,MDI_DECELand triggers viaSTW2bits. -
Position controller (r2561 setpoint / r2562 output) operates with Kv =
p2536. -
Speed pre-control adds
p2534 × v_setpointto the controller output. -
Torque pre-control adds
p2535 × a_setpoint × total_inertiato the controller output. - Speed controller (p1460 P / p1472 I) drives the current setpoint.
- Current controller (p1715 P / p1720 I, field-oriented) commands the Motor Module.
The relevant firmware requirement for full speed pre-control is documented in the SINAMICS S120/S150 List Manual and Function Manual "Speed and Position Control": speed pre-control at 100 % was officially exposed and recommended starting with firmware 4.8. On older firmware, the parameter is present but the default is 0 % and the recommendation in official Siemens documentation is more conservative.
r0018 (Control Unit firmware version) and the drive object firmware with r0128. The 100 % speed pre-control recommendation in the Siemens support entry is specifically tied to firmware 4.8 or later.4. SINA_POS Block Integration
The SINA_POS function block (FB284 for SIMATIC S7-1500/TIA Portal, FB388 for SIMOTION SCOUT, equivalent blocks on SIMOTION V4.x) implements the PROFIdrive positioning interface defined by telegram 110.
Signal mapping summary:
| SINA_POS input | PLC variable | Drive parameter | Purpose |
|---|---|---|---|
| Position setpoint | MDI_TARPOS |
Connect to p2640 via telegram mapping |
Target position in LU |
| Velocity | MDI_VELOCITY |
p2641 |
Velocity override in 1000 LU/min |
| Acceleration | MDI_ACCEL |
p2642 |
Acceleration ramp |
| Deceleration | MDI_DECEL |
p2643 |
Deceleration ramp |
| Mode select | ModePos |
STW1.0/.1/.2/.3/.4/.5/.6/.8/.9/.10/.11/.12/.13/.14/.15 |
MDI mode, setpoint acceptance, absolute/relative, jog |
| Execute | Execute |
STW1.6 |
Lift setpoint acceptance edge |
| Cancel traversing | CancelTraversing |
STW1.13 |
Reject current motion |
The PLC must signal the axis the correct mode bits before lifting the setpoint acceptance edge. If the axis was previously in "position setup mode" and the mode bits are not updated before the first MDI block, the drive may still be receiving a residual setpoint from the setup profile generator and the resulting motion combines the MDI target with the residual.
Recommended startup sequence after the setup mode
- Run
CancelTraversingto clear the residual setpoint and ensureZSW1.13"drive stop active" is cleared. - Write the desired mode bits (absolute positioning:
ModePos = 16#0001or relative:16#0002, depending on FB version). - Write target position, velocity, acceleration, deceleration.
- Trigger
Executewith a positive edge onSTW1.6. - Monitor
ZSW1.10(MDI setpoint acknowledged) andZSW1.12(traversing command acknowledged).
5. Pre-Control Configuration (Speed and Torque)
Speed pre-control is the single most effective parameter change for eliminating steady-state following error during the constant-velocity phase of a motion.
| Parameter | Description | Recommendation | Effect |
|---|---|---|---|
p2534 |
Speed pre-control scaling (active from FW 4.8) | 100 % | Eliminates constant-velocity following error |
p2535 |
Torque pre-control scaling | 100 % once total inertia is correct | Reduces following error during acceleration / braking |
p2536 |
Position controller Kv factor | Start with the value from the controller optimization | Defines disturbance rejection bandwidth |
p2537 |
Position controller integral time | Leave at default (no I component in position controller) | Risk of instability if non-zero |
p2538 |
Position controller output scaling | Leave at 100 % unless load-side gearing requires it | — |
p2542...p2546
|
Following error monitoring thresholds | Tune to mechanical limits | Trip thresholds for F07451 |
p2544 |
Following error window | 1 LU default | Position controller "in position" criterion |
Procedure to activate speed and torque pre-control:
- Set
p2534 = 100(speed pre-control = 100 %). If the parameter has bit-field semantics on your firmware, ensure bit 0 is set or the value is interpreted as a percentage. - Compute or measure the total moment of inertia at the motor shaft:
p1117 + p1118 = J_total(motor + load). Usep1959.5orp1900 = 5for the rotating measurement if the mechanics permit. - Set
p2535 = 100(torque pre-control = 100 %). - Verify that the encoder reference sign in
r2521[0]matches the rotation sign: rotate the motor shaft by hand and confirm the sign ofr2521matches the sign you set inp0410.0(signal inversion). - Save and RAM-to-ROM (
p0977 = 1). - Re-run the trace described in section 8.
p2533 is set very high, the pre-control will be effective but the visible r2521 value will still show a small lag. A typical smoothing time is 1-3 position-controller cycles (1-3 ms for a 1 kHz position controller).6. CU320-2 with CUA31 and Third-Party Encoders
The CU320-2 control unit has two onboard encoder interfaces (HTL/TTL on Sub-D connector) and supports DRIVE-CLiQ encoders directly. For non-DRIVE-CLiQ encoders (TTL/HTL, SSI, EnDat 2.1 without DRIVE-CLiQ converter), a CUA31 control unit adapter is inserted into the encoder slot. The CUA31 supports incremental encoders with TTL (RS422) or HTL (24 V) outputs and SSI absolute encoders.
| Encoder type | CUA31 support | Configuration parameter | Verification trace |
|---|---|---|---|
| TTL incremental (RS422) | Yes |
p0400 = 9999, set pulse count in p0408
|
r0061[0] rotating in correct direction |
| HTL incremental (24 V) | Yes |
p0400 = 9999, set p0404 bit for HTL, p0408 pulse count |
r0061[0], observe signal quality on trace |
| SSI absolute | Yes (CUA31) |
p0400 = 9999, set p0421 (single-turn bits), p0422 (multi-turn bits), p0423 (parity) |
r2521[0] monotonic, no wrap discontinuities |
| EnDat 2.1 | Via CUA31 with adapter | EnDat 2.1 direct supported on CUA31 only with firmware 4.6 SP3 or later | Nameplate read OK (r0040 bit) |
| Resolver | No (use SMC10) | Use SMC10 Sensor Module Cabinet | r0061 |
The CUA31 occupies encoder interface interface 2 on the drive object, with parameters p04xx indexed under index [1] in many lists (confirm in r0148 and the topology view in STARTER / Startdrive).
For third-party induction motors, the motor data must be entered manually because the electronic nameplate path is not available. Required parameters:
-
p0304Rated motor voltage -
p0305Rated motor current -
p0307Rated motor power -
p0308Rated power factor cos φ -
p0310Rated motor frequency -
p0311Rated motor speed -
p0314Motor pole pair number -
p0322Maximum motor speed -
p0326Stall torque / pull-out torque
Then run motor data identification via p1900 = 2 (standstill measurement) followed by p1910 (rotating measurement if safe). The rotating measurement must be enabled (p1900 = 1 or via the optimization run) and the encoder must be configured to a valid topology before this step; otherwise, the drive will abort with F07995 "Motor data identification fault" or F07085.
7. Third-Party Motor and Encoder: Root Cause of the Reported Symptom
The user explicitly stated: "Whenever I'm using non-Siemens encoder for position control means I'm facing this problem." This is a diagnostic signal that the encoder interface — not the position controller — is the source of the residual error.
The most common failure modes encountered with third-party encoders on a CUA31 are:
-
Counting direction inverted. Pulse A / pulse B wiring reversed, or the encoder specifies CW rotation while the drive is configured for CCW. Fix: invert via
p0410.0 = 1for incremental encoders, or set the relevant bit inp0430.13for absolute encoders. -
Pulse count (p0408) mismatch. If the parameter does not match the physical line count on the encoder nameplate, every revolution will accumulate an error of
(n_physical − n_parametric) × LU_per_rev. For a 2,500-LU pulley and a 1024 vs 2048 mismatch, this yields exactly the type of residual observed. - Track A / B swapped. The position controller can hold a stationary position correctly but loses position proportional to mechanical play during direction reversal — the symptom is a steady-state offset of a few hundred LU that disappears after a single rotation.
-
Reference loss during the setup phase. When the position setup mode runs the drive in an open configuration and the encoder reports index pulses inconsistently, the absolute reference is not captured. Verify with
r2685"Encoder absolute value valid" before the first MDI move. -
Encoder scaling (LU per motor revolution) wrong. If
p2520[0](load revolutions per LU) orp2521[0](encoder revolutions per load revolution) is miscalculated, the error scales linearly with motion distance and produces a persistent bias that is independent of the velocity profile.
8. Optimization Procedure (Step-by-Step)
The following procedure is the recommended commissioning sequence for a SINAMICS S120 axis driven by SINA_POS from a higher-level controller, with a third-party motor and third-party encoder on the CUA31.
Prerequisites
- STARTER (≤ V5.x) or Startdrive (V15 and later) commissioned project online.
- Drive
READYstate, no active faults (r0949 empty). - Controller connected via PROFIBUS or PROFINET to the CU320-2, with telegram 110 mapped.
- Mechanics confirmed safe for motion (E-stop chain, software limit switches in
p2570).
Step-by-Step Procedure
-
Verify topology. In STARTER / Startdrive, open the topology view and confirm that the CUA31 is online. Check
r0148[1]for the sensor module firmware version. -
Configure the encoder. Set
p0400[1] = 9999(third-party encoder), enter pulse count, supply voltage type, and counting direction. Run the encoder commissioning test inp1990if available. Verifyr0061[0]tracks manual rotation in real time. -
Enter the motor data. Enter the third-party motor data in
p0300-p0349withp0300 = 1or the appropriate motor type code. -
Run motor identification.
p1900 = 2, then power-cycle, then pulse enable, then triggerp1910 = 1for the rotating measurement (if safe). Verifyr0047.30 = 1after a successful identification. -
Configure the mechanical system. Set
p2502[0]= encoder interface,p2503[0]= load gear ratio,p2504[0]= feed constant (LU per load revolution),p2505[0]= load revolutions per motor revolution,p2506[0]= feed constant units. -
Activate the position controller. Set
p2501 = 6or appropriate to enable position control. Setp2530(LR configuration) to enable setpoint pre-control. -
Set Kv. Start with
p2536 = 10(1000/min default for 1 m/s = 16.6 LU/ms). Increase stepwise while monitoring the step response. -
Set pre-control.
p2534 = 100,p2535 = 100. -
Configure the SINA_POS telegram. In the controller, instantiate
SINA_POS, connectAxisNo, and wire the cyclic I/O to the axis telegram. - Run the trace. Open the trace recorder, add r2665, r2666, r2561, r2521, r2565, r2524, r898, r899 with a sample time of 1 ms and trigger on MDI start.
-
Validate. Command a 100,000 LU move at 50,000 LU/min. Confirm r2665 stays within ±5 LU during the constant-velocity phase and settles to zero within
p2544.
9. Diagnostic Trace Parameters
The following parameters, recorded with the SINAMICS internal trace or STARTER trace tool, are the canonical set requested by Siemens support for following-error investigations.
| Parameter | Name | Interpretation |
|---|---|---|
r2521[0] |
Position actual value at position controller | The position actual value in LU as seen by the position controller |
r2524 |
Velocity actual value at position controller | Velocity feedback |
r2561 |
Position setpoint after position controller | The position setpoint after the controller stage |
r2565 |
Velocity setpoint after position controller | The speed command fed into the speed controller |
r2665 |
Position setpoint (servo) | Output of the position profile generator |
r2666 |
Velocity setpoint (servo) | Output of the position profile velocity stage |
r898...r899
|
Encoder parameter list for the second encoder (interface 2, CUA31) | Active encoder configuration; verify pulse count, signal type, and voltage level |
When evaluating the trace:
-
r2561 - r2521must equalr2665 - r2521minus the position-controller output. A persistent non-zero difference indicates a sign or scaling error. -
r2565during the constant-velocity phase must equalr2666(within ±1 LU) if speed pre-control is set correctly. If not, the position controller is still doing the work and the proportional gain / Kv is not correctly sized. - The d/dt of
r2561should matchr2666when pre-control is at 100 %. If it does not, the smoothing time inp2533is too high.
10. Fault and Warning Reference
| Code | Meaning | Cause | Action |
|---|---|---|---|
| F07451 | Following error exceeded threshold |
p2542 set tighter than achievable |
Loosen threshold, retune Kv, verify pre-control |
| F07452 | Following error after standstill exceeded | Load movement after MDI complete | Check mechanics, increase p2546
|
| F07453 | Position controller output limited |
p2535 too high or Kv too low |
Reduce Kv or correct inertia estimate |
| F07995 | Motor data identification fault | Encoder missing or mis-configured during p1910
|
Verify encoder, rerun identification |
| F07085 | Closed-loop controller parameters invalid | Speed/position controller settings inconsistent | Reset p1460, p1472, p2536 and retune |
| A07452 | Following error warning | Threshold p2544 reached |
Investigate before F07451 trips |
| F31110 | Encoder signal track A/B lost | CUA31 wiring, shielded cable grounded at one end only | Recheck wiring, run p1990 encoder test |
11. Verification Checklist
- Position setup mode can be entered and exited without residual error in
r2665. - Speed pre-control
p2534 = 100 %and torque pre-controlp2535 = 100 %. -
r2521andr2524respond correctly to manual rotation in both directions. -
r2665does not accumulate an offset between successive MDI moves. - Position controller
p2536is set for the desired Kv with at least 20 % margin before instability. -
r2565matchesr2666during the constant-velocity phase. - Following error
r2523(or equivalent) remains within the warning thresholdp2544at standstill. - Drive does not report F07451, F07452, F07995, F07085, or F31110 under any of the test motions.
12. Troubleshooting Matrix
| Symptom | Most likely cause | Confirm with | Fix |
|---|---|---|---|
| Constant following error of a few hundred LU during constant velocity | Speed pre-control disabled | Read p2534
|
Set p2534 = 100 (FW 4.8+) |
| Following error grows with acceleration | Torque pre-control disabled or inertia wrong | Read p2535, p1117 + p1118
|
Set p2535 = 100, run inertia identification |
| Pre-control makes error worse | Encoder sign inverted | Slow velocity test: r2521 direction |
Invert encoder p0410.0
|
| Following error scales with distance moved | Load gear ratio (p2503, p2505) wrong |
Move known distance, compare r2521 to r2665
|
Recalculate gear ratio |
| Residual after position setup mode | Setup mode not cleanly exited, residual setpoint latched | Check STW1.13 handling |
Force CancelTraversing, then re-issue MDI |
| Following error only on direction reversal | Encoder A/B swapped | Square-wave test on trace | Swap A/B in CUA31 wiring |
| F31110 during motion | Encoder cable quality or length issue | Check shield termination, run p1990
|
Use shielded twisted pair, ground at drive end only |
| Error present only with third-party motor | Motor data incomplete | Compare p0350...p0369 to nameplate |
Complete p0300...p0349, run p1910
|
| Error scales with payload (variable load) | No torque pre-control or wrong p1117 + p1118
|
Trace r2565 with two different payloads |
Enable p2535, verify inertia estimate |
13. Related Documentation
- SINAMICS S120 Function Manual — Speed and Position Control (entry ID 60593549)
- SINAMICS S120/S150 List Manual (Firmware 5.x)
- S120 Commissioning Manual with STARTER
- SIMATIC S7-1500 / T-CPU SINA_POS FB284 manual
- PROFIdrive Profile Drive Technology (PNO)
What is the exact formula for following error in a SINAMICS S120 axis?
The following error is defined in length units (LU) as: e_follow = s_setpoint − s_actual, where the setpoint is r2665 and the actual is r2521. During constant velocity, a P-only position controller cannot drive it to zero unless speed pre-control is enabled.
Which parameter eliminates following error during constant velocity?
Set p2534 = 100 % (speed pre-control). On SINAMICS firmware 4.8 or later this parameter is officially supported at 100 %, and the constant-velocity steady-state error becomes zero because the speed controller output is fed from the velocity setpoint directly.
Why does enabling pre-control make the following error larger?
Almost always a sign error between the encoder and the motor, or wrong load gear ratio. The pre-control applies a velocity that is in the opposite direction to what the closed loop expects, so the controller fights it. Reduce the speed to a few LU/min and verify r2521 and r2665 move in the same direction. If they don't, invert the encoder with p0410.0 = 1.
Which parameters should be in a support trace for a following error investigation?
Record r2521, r2524, r2561, r2565, r2665, r2666, r898, and r899 at 1 ms sampling, triggered on the MDI start. These are the canonical parameters Siemens support requests when a ticket is opened.
Why does the error only appear with a third-party encoder on CUA31?
The CUA31 requires manual configuration of pulse count (p0408), signal type (TTL/HTL in p0404), and counting direction. Most residual errors come from a p0408 mismatch with the physical line count, an inverted sign, or incorrect load gear ratio in p2503/p2505. Verify r0061 tracks manual rotation, then check r2665 vs r2521 over a known distance.