Problem Description: Persistent 5 mm Position Deviation on a CNC Z-Axis Driven by SINAMICS S120
A retrofit CNC milling machine equipped with a SINAMICS S120 drive on the Z-axis reports a repeatable position deviation of 5 mm. The operator enters a target of 980 mm on the HMI/operating panel; when the axis stops, a hand-measurement with a ruler shows 975 mm. The error is consistent in sign and magnitude across multiple moves, which rules out random mechanical slippage but points to a systematic scaling, tuning, or feedback issue inside the SINAMICS S120 closed-loop chain.
Because the SINAMICS S120 position loop is only one half of a typical CNC motion chain (the upper CNC controller closes position, the drive closes current and speed), a 5 mm steady-state deviation can be introduced by any of the following: an incorrect Length Unit (LU) scaling, an un-tuned speed controller, missing speed precontrol, wrong encoder pulses per revolution, missing backlash compensation, or a mismatch between CNC and drive position reference. This reference walks through every parameter in the chain that has to be verified.
Closed-Loop Architecture: Where the Position Error Is Generated
In a CNC–SINAMICS S120 topology the position loop is closed by the CNC, the speed loop is closed by the drive, and the current loop is closed by the drive. The SINAMICS S120 still contains a position controller that can be used as a secondary fine-positioning loop or for stand-alone positioning. The standard position-control signal chain is:
- CNC position setpoint → PROFIdrive telegram (telegram 110 or 111, NSOLL/NSOLL_B) → drive word.
- SINAMICS position controller (p2500…p2534) generates a speed setpoint from the position error (r2521 = position actual value in LU).
- Speed precontrol (p2534, %) adds a feed-forward term so the speed controller does not have to integrate the entire position error.
- Speed controller (p1460, p1462) generates a torque setpoint from the speed error.
- Current controller (p1715, p1717) closes the torque loop on the motor.
The SINAMICS-internal calculation of speed from the position difference is described in detail in the SINAMICS S120 Function Manual Safety Integrated (FH1, section "Position and speed calculation"): Pos diff = Pos new − Pos old; the speed is then derived as Pos diff / T_s. If the LU per load revolution is wrong, both the actual position and the internal speed are wrong by the same factor, which produces a steady-state offset rather than a dynamic following error.
Root-Cause Matrix for a Steady-State 5 mm Z-Axis Offset
| # | Root cause | Diagnostic signal | Symptom | Typical drive parameter |
|---|---|---|---|---|
| 1 | Wrong LU per load revolution (scaling) | r2521 vs. CNC display | Constant offset of N×LU across the entire travel range | p2506, p2507, p2508 |
| 2 | Speed precontrol disabled | r2521 overshoot/undershoot | Following error during motion, settles to wrong value | p2534 = 100 % |
| 3 | Speed controller not optimized | r0061, r0063 (speed/ torque) | Position error correlates with load | p1460 (Kp), p1462 (Tn), p1715 |
| 4 | Encoder pulses per revolution wrong | r0061 vs. r9713 | Position error grows with distance, not constant | p0408, p0421 |
| 5 | Backlash not compensated | Asymmetric error on direction reversal | −5 mm one way, +0.5 mm the other | p2583, p2584 |
| 6 | Mechanical mounting slip (coupling, key) | Random jump after E-Stop | Position error resets after power-cycle | Mechanical |
| 7 | CNC drive MD scaling mismatch | Drive r2521 correct, CNC wrong | Display error only, machine physically right | CNC MD |
Step 1 — Verify Position Scaling (LU per Load Revolution)
The Length Unit (LU) is the user-defined resolution of the position controller; it determines how many LU correspond to one load revolution and how many LU correspond to one motor revolution. A 5 mm offset that does not scale with travel distance almost always indicates a wrong LU per load revolution (p2506).
| Parameter | Meaning | Typical Z-axis value (1 LU = 1 µm) |
|---|---|---|
| p2502 | Encoder configuration / position sensing | 1 (motor encoder) or 2 (load encoder) |
| p2503 | Length unit reference | 0 = mm, 1 = m, 2 = inch, 3 = ° |
| p2504 | Position controller configuration | Bit 0 = 1 → position controller active |
| p2505 | Position controller output unit | 0 = LU/s |
| p2506 | LU per load revolution | Lead screw pitch (e.g. 10 000 for 10 mm pitch with 1 µm/LU) |
| p2507 | Encoder revolutions for load revolution | Gear ratio numerator |
| p2508 | Encoder revolutions per motor revolution | Gear ratio denominator |
| p2521 | Actual position value (LU) | read-only diagnostic |
Scaling calculation
For a ball-screw with pitch P (mm/rev) and a reduction ratio i = n_motor / n_load:
p2506 [LU/rev] = P [mm/rev] × 1000 / R [µm/LU]
With P = 10 mm/rev, R = 1 µm/LU → p2506 = 10 000 LU/rev. If p2506 is set to 9 500 the drive will think a 10 mm mechanical move is only 9.5 mm, producing exactly the 5 ‰ (0.5 %) error class observed on a 980 mm target (980 × 5 ‰ = 4.9 mm ≈ 5 mm).
Step 2 — Enable and Tune Speed Precontrol (p2534)
Even with perfect scaling, an un-tuned speed controller can leave a residual position error if the I-term of the speed controller never has time to wind up. Speed precontrol injects the demanded velocity directly into the torque setpoint so the speed controller only has to correct disturbances.
- Set
p2534 = 100 %(full precontrol). - Set
p2535 = 0(precontrol from setpoint, not filtered). - Set
p2536 = 0(no speed precontrol of torque setpoint — leave at 0 unless using a direct setpoint). - Re-run the auto-tuning wizard (STARTER / Startdrive → Commissioning → Speed controller).
With precontrol active the position controller output (r2526) is no longer the only feed to the speed controller; the velocity feed-forward term (r2527 / p2534) covers the bulk of the speed setpoint, and the I-term of the speed controller only has to compensate friction and load torque.
Step 3 — Optimize the Speed Controller (p1460, p1462, p1715)
Open STARTER / Startdrive and capture a trace of r0061 (speed actual) and r0063 (torque setpoint) during a representative Z-axis move. Use the one-button tuning function:
- Set p1910 = 1 (motor identification) — run with the motor uncoupled if possible.
- Set p1960 = 1 (speed controller optimization with rotation).
- Accept the proposed Kp (p1460) and Tn (p1462) values.
- Set the current setpoint filter p1715 to the suggested value (typically 0.5 × 1/(2π×Kp)).
If the optimization rejects a stable result, manually de-tune by halving Kp and doubling Tn, then re-test. A sign-inverted Kp (negative) will drive the axis away from the setpoint and is the most common cause of a growing rather than constant error.
Step 4 — Verify the Encoder (p0408, p0421, p0431)
For a 5 mm constant offset, the encoder pulse count is rarely the cause, but a wrong PPR will scale the error with distance. Confirm:
| Parameter | Meaning | Action |
|---|---|---|
| p0400 | Encoder type selection | Match to actual encoder (e.g. 1001 = DRIVE-CLiQ, 2001 = EnDat 2.1) |
| p0408 | Encoder pulses per revolution | Set to the encoder nameplate value (e.g. 2048, 8192, 1 048 576 for sin/cos) |
| p0421 | Absolute encoder rotary resolution | Set to bits per revolution for absolute encoders |
| p0431 | Commutation angle offset | Run p1990 = 1 (commutation) for synchronous motors |
Read r0061 during a 60 rpm reference move; if the drive shows exactly 60 rpm, the encoder is wired and parameterized correctly. Read r0979[0…30] to capture the encoder identification; cross-check the listed PPR against the nameplate.
Step 5 — Compensate Mechanical Backlash (p2583, p2584)
Backlash compensation only corrects the error produced by reversing direction. It does not correct a one-direction constant offset, but the two effects are often confused. Enable backlash compensation only after scaling is correct:
- Measure the backlash: command +1 mm, read r2521; command −1 mm, read r2521; the difference is the mechanical backlash B (in LU).
- Set
p2583 = B(backlash compensation value). - Set
p2584 = 1(backlash compensation active). - Re-run the 980 mm move in both directions; the offset should be within ±1 LU.
Step 6 — Synchronize CNC Machine Data with the Drive
On a CNC retrofit the drive may be correct and the CNC machine data (MD) may be the source of the mismatch. Verify on the controller side:
- Lead screw pitch (often MD 30300 → 31030 family on Siemens SINUMERIK).
- Encoder pulses per revolution (MD 31020 / 31025).
- Gear ratio (MD 31060 / 31070 / 31080).
- Feed-forward gain (MD 32610 / 32810).
Command a small move from the CNC in JOG mode and read both r2521 (drive) and the CNC actual-value display. If the drive shows 10 000 LU and the CNC shows 9 500 µm, the CNC scaling is wrong, not the drive.
Verification Procedure After Correction
- Power-cycle the drive (p0970 = 1) so all parameters are saved to the CF card.
- Run a reference move to the machine zero and re-define the home position via p2596 / p2507 referencing mode.
- Command moves of 10 mm, 100 mm, 500 mm, and 980 mm in both directions. Record r2521, r0061, and r0063 with a STARTER trace.
- Accept the result when the difference between the CNC display and the mechanical measurement is ≤ ±1 LU (= 1 µm) at all four positions, in both directions.
- Back up the parameter set with
p0971 = 1to the CF card / non-volatile memory.
Field-Proven Cautions
- Do not change p2506 on the fly with the axis enabled — the LU counter can jump and cause a following-error fault (F07452) on Safety-Integrated machines.
- When retrofitting a Sinamics S120 into a machine that previously used an older drive, the encoder wiring order (A+/A−, B+/B−, R+/R−) is often inverted between DRIVE-CLiQ and TTL encoders. A reversed B channel shows up as negative position feedback, not as a 5 mm offset.
- If the safety functions are active (SS1, SLS, SDI), changes to p2506 may trigger a STOP reaction. Temporarily set p9501 / p9601 to bypass mode only if the machine is in a controlled commissioning state; never run production with safety bypassed.
- For absolute encoders, an uncorrected homing (p2596 = 0) is the most common cause of a constant offset. Always re-home after changing p2506 or p0408.
When to Open a Siemens Service Request
If scaling, precontrol, encoder, and backlash have all been verified and a residual deviation of more than ±2 LU remains, escalate via the Siemens Industry Online Support Service Request tool. Attach the STARTER project archive, the function diagrams (FP2500, FP2520, FP2700), and the trace recordings requested above. A Safety-Integrated problem (F01611, F07452) should always go through a Service Request, not a forum thread.
FAQ
Which SINAMICS S120 parameter scales position in mm or µm?
Position scaling is defined by p2503 (length unit reference, e.g. mm), p2506 (LU per load revolution) and p2507 (encoder revolutions per load revolution). For 1 LU = 1 µm on a 10 mm pitch ball screw, set p2506 = 10 000.
How do I read the actual Z-axis position on a SINAMICS S120?
Use r2521 (actual position value in LU). If 1 LU = 1 µm, r2521 = 980 000 corresponds to 980 mm. Compare r2521 with the CNC display to localize whether the error is in the drive or the controller.
What is parameter p2534 and why must it be 100 %?
p2534 is the speed precontrol of the position controller, in percent. Set p2534 = 100 % to inject the full velocity feed-forward into the torque setpoint, so the speed controller no longer has to integrate the position error. Without precontrol, transient following error is larger and the I-term may not settle to zero.
My 980 mm command gives 975 mm only in one direction. Is it backlash?
Yes — a direction-dependent offset is the classic signature of mechanical backlash. Measure the lost motion by commanding +1 mm and −1 mm from the same point, set the result as p2583, and enable compensation with p2584 = 1.
Can I change p2506 with the axis enabled?
No. Always disable the pulse enable, switch to commissioning mode (p0009 = 1), change p2506, save with p0971 = 1, and re-home the axis. Changing p2506 with the axis enabled causes a position jump and typically triggers F07452 (following error).