Siemens MC-ServoPost Waveform Fault: Fixing 0-10V Analog Output

David Krause12 min read
Motion ControlSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

1. Problem Summary

When an axis is configured with an analog drive interface (0-10 V) in a Siemens motion controller, the MC-ServoPost (a.k.a. MC-PostServo, SIMOTION OB92 / S7-1500T equivalent post-servo organization block) writes the velocity setpoint directly to the configured analog output of the Technology Object (TO). On a perfectly functional axis, the analog waveform should swing only between 0 V and +10 V, with the algebraic sign of motion carried by a separate digital output wired to the drive's direction input.

Symptom: when the axis decelerates from a positive set velocity (for example, 0.1 m/s) toward zero, the analog output briefly drops below 0 V (negative excursion) instead of cleanly ramping to 0 V. The waveform becomes non-monotonic and the drive either faults, holds, or produces an audible/visible position step on reversal of direction. The same fault appears on direction reversal: the analog value crosses zero through negative values rather than through zero.

Field signature: Scope the analog pin (0-10 V) with a 1 MΩ passive probe. If you see a negative lobe any time the velocity setpoint changes sign, the post-servo OB is not splitting magnitude and sign — that is the root cause covered in this article.

2. Affected Platforms and Firmware

Platform OB Name Typical Firmware Status
SIMOTION D / P MC-ServoPost (BackgroundTask / IPO / Servo) V4.4 – V5.6 Affected
SIMOTION D / P MC-PostServo (Servo_fast / Servo) V6.0 + Affected (same procedure)
S7-1500T / S7-1500TF PostServo OB (MC-Servo-Post) V2.5 + (TIA V16+) Affected (analog axis profile only)
S7-1200 + TO PositioningAxis MC-PostServo (analog output) FW 4.2 + Affected

The exact OB name varies by controller generation; the diagnostic and the fix are identical. The reference documentation for the output handling in MC-PostServo is the controller System Manual, chapter A.10.7 (Analog drive interface, 0-10 V unipolar).

3. Root Cause Analysis

The motion controller's velocity setpoint is a signed real number. The setpoint naturally becomes negative whenever the axis must move in the configured negative direction. The post-servo OB simply copies this signed real to the analog output card (AQ). A 0-10 V analog input on a drive is unipolar and cannot represent negative voltage. Several failure modes follow:

  1. Negative excursion during decel: the controller commands a negative setpoint for one or two servo cycles to actively brake the axis. The drive saturates the analog input or reports an undervoltage, but the waveform on the scope shows a clean negative lobe.
  2. Direction reversal through zero: instead of ramping to 0 V, holding, and then ramping back to +10 V in the opposite direction, the controller passes the setpoint through negative territory. With sign-on-DQ wiring not in place, the drive ignores the sign and the axis jumps.
  3. Cable / shielding issue mis-diagnosed: technicians often suspect noise on the analog cable, add shielding, ferrite, and filtering — none of which changes the waveform because the negative lobe is generated at the controller, not induced.
Defective waveform: signed setpoint routed directly to AQ +10 V 0 V -10 V time (servo cycles) unwanted negative lobe correct + polarity

The negative lobe is a direct consequence of writing a signed real to an unipolar output. The fix is structural: do not write a signed value to a unipolar output. Split magnitude from sign, write magnitude to AQ (always ≥ 0), and write sign to a digital output (DQ).

4. Architecture: TO, PostServo OB, and PIP OB Servo

Three blocks participate in the analog setpoint chain on a SIMOTION / S7-1500T axis:

  • Technology Object (TO) — the speed/position axis object. Internally holds a signed real velocity setpoint.
  • MC-PostServo OB (a.k.a. MC-ServoPost) — runs once per servo cycle, after the position controller. This is the only block in which the analog output should be overwritten for an analog axis.
  • PIP OB Servo (Peripheral I/O Post-Processing) — runs immediately after MC-ServoPost, dedicated to writing the digital direction bit. Putting the DQ write here guarantees it is synchronous with the analog output and inside the same servo window.
Analog Axis Setpoint Chain TO Axis signed real v_set MC-ServoPost OB split |v| and sign AQ → |v| (0-10 V) DQ → sign bit (DIR) Do not write signed real to AQ directly Use MC-ServoPost for the magnitude, PIP OB Servo for the sign.

5. Solution Approach

Two field-proven methods exist. Both rely on the same principle: the post-servo OB is the only legal place to overwrite the analog output for an analog axis, and the magnitude/sign split must happen there.

Method Where Magnitude is Computed Where Sign is Computed Recommended For
A — Direct Inline in MC-PostServo Inline in MC-PostServo Single axis, prototype
B — TO-to-DB Mirror TO data read in MC-PostServo, written to a DB; DB drives AQ Same DB → DQ in PIP OB Servo Production, multiple axes, traceability

Method B is the recommended approach for any deployment beyond a lab. It decouples the TO from the I/O, allows scope of intermediate values, supports HMI trending, and survives TO reconfiguration without recompiling OB code.

6. Implementation — Method A (Direct)

Insert the following logic at the top of MC-ServoPost. The input AxisData.VelocitySetpoint is the signed real issued by the position controller; output Magnitude feeds the AQ and Sign feeds the DQ.

// SCL — Method A, direct, in MC-ServoPost
VAR
    v_set       : LREAL;   // signed setpoint, m/s
    v_mag       : LREAL;   // 0 .. v_max
    v_sign      : BOOL;    // 0 = positive, 1 = negative
    v_max       : LREAL := 10.0; // corresponds to +10 V at the AQ
END_VAR

v_set  := AxisData.VelocitySetpoint;       // internal TO struct
v_mag  := ABS(v_set);

// Saturate to converter range, never below 0
IF v_mag > v_max THEN v_mag := v_max; END_IF;

// Direction: TRUE for negative setpoint
v_sign := (v_set < 0.0);

// Write magnitude to analog output (unipolar, 0-10 V)
AQ_Velocity := REAL_TO_INT(v_mag * 2764.8);  // 0..10 V -> 0..27648 raw
// Write sign to digital output (drive direction input)
DQ_Direction := v_sign;
Raw-to-V conversion: Siemens 0-10 V analog outputs use 0..27648 raw counts for the nominal range, with 0 V at 0 counts and 10 V at 27648 counts. Overshoot range 0..32511 is allowed briefly. Negative raw counts are invalid on a 0-10 V channel and cause the negative-lobe symptom when written.

7. Implementation — Method B (TO-to-DB Mirror, recommended)

Create a dedicated data block DB_AxisMirror with one struct per axis. The TO does not write directly to AQ; instead, the post-servo OB copies the relevant fields from the TO into the DB, and the PIP OB Servo (or the same OB) copies from the DB to AQ and DQ. This pattern is the same as recommended in the system manual A.10.7 and is mandatory when multiple consumers (HMI, recorder, second controller) need the value.

// DB_AxisMirror — visible to HMI, recorder, second CPU
TYPE
    UDT_AxisMirror : STRUCT
        bEnable        : BOOL;
        bFault         : BOOL;
        bDirection     : BOOL;   // 0 = +, 1 = -
        rVelocitySet   : LREAL;  // signed, m/s
        rVelocityAbs   : LREAL;  // 0..v_max, V-scaled
        rVelocityRaw   : INT;    // 0..27648 for AQ
    END_STRUCT
END_TYPE

DATA_BLOCK DB_AxisMirror
  STRUCT
      Axis1 : UDT_AxisMirror;
  END_STRUCT
END_DATA_BLOCK
// SCL — Method B, MC-ServoPost (mirror write only)
DB_AxisMirror.Axis1.bEnable      := AxisData.Controller.Enable;
DB_AxisMirror.Axis1.bFault       := AxisData.FaultWord.%X0;
DB_AxisMirror.Axis1.rVelocitySet := AxisData.VelocitySetpoint;
DB_AxisMirror.Axis1.rVelocityAbs := ABS(AxisData.VelocitySetpoint);

IF DB_AxisMirror.Axis1.rVelocityAbs > 10.0 THEN
    DB_AxisMirror.Axis1.rVelocityAbs := 10.0;
END_IF;

DB_AxisMirror.Axis1.bDirection   := (AxisData.VelocitySetpoint < 0.0);
// SCL — PIP OB Servo (I/O write only)
VAR_TEMP
    rV : LREAL;
END_VAR

rV := DB_AxisMirror.Axis1.rVelocityAbs;
DB_AxisMirror.Axis1.rVelocityRaw := REAL_TO_INT(rV * 2764.8);

AQ_Velocity := DB_AxisMirror.Axis1.rVelocityRaw;   // 0..27648, never negative
DQ_Direction := DB_AxisMirror.Axis1.bDirection;   // drive DIR input

With the magnitude strictly clamped to the interval [0, v_max] before the integer cast, AQ_Velocity can never become negative. The waveform on the scope will look like the correct trace below.

Corrected waveform: |v| on AQ, sign on DQ +10 V 0 V -10 V DQ toggles here time (servo cycles)

8. Direction Bit Edge Cases

The algebraic sign must be evaluated with a strict inequality and a defined zero window. Treating v_set = 0.000 m/s as "no motion" prevents the direction bit from chattering when the axis is at rest with a small bias around zero.

// Recommended sign evaluation with dead-band
IF v_set >  0.001 THEN   bDirection := FALSE; // positive
ELSIF v_set < -0.001 THEN   bDirection := TRUE;  // negative
ELSE                       bDirection := bDirection; // hold last
END_IF;

Drive commissioning manuals for the analog 0-10 V input almost universally require that the enable and direction signals change only when the setpoint is below a defined threshold (typically 0.5 V or 0.1 V). The threshold enforcement belongs in the application OB; the PIP OB Servo is the correct place because the analog output and the digital output then change within the same servo cycle and meet the drive's setup/hold requirements.

9. Wiring and Hardware Considerations

Signal Wire Pin Convention (drive-side) Notes
Velocity setpoint (0-10 V) Shielded twisted pair, ≤ 10 m AIN+ / AIN- (differential) Shield grounded at controller end only
Direction (DQ) Standard signal wire, ≤ 30 m DIR / FWD-REV / SIGN 24 V sourcing, opto-isolated
Enable (DQ) Standard signal wire ENABLE / SVC-ON Often handled by TO default, but verify in MC-ServoPost
Common (M) Dedicated 0 V return COM / GND Do not share with motor power PE
EMC warning: a clean waveform after the software fix does not mean the analog cable is healthy. Run the analog pair in a separate shielded conduit at least 200 mm from VFD power cables. The negative-lobe symptom is software-generated, but a noisy cable will still superimpose ripple on the corrected waveform.

10. Parameter Mapping

The conversion from engineering units to the analog output raw value must use the same scaling as the TO. For a velocity axis with v_max = 10.0 m/s and an analog output range 0-10 V (0-27648 raw):

raw = v_abs / v_max * 27648
    = v_abs * 2764.8

If the TO is configured for a different v_max, the multiplier changes accordingly. Mismatches between the TO's reference velocity and the analog scaling constant are the second most common cause of "the waveform looks wrong" tickets after the signed/unipolar issue.

TO v_max (m/s) AQ raw at 0.1 m/s AQ voltage (V) Drive interpreted speed
1.0 2765 1.000 0.1 m/s
5.0 553 0.200 0.1 m/s
10.0 276 0.100 0.1 m/s

11. Verification Procedure

  1. Online trace — In TIA Portal, open Trace & Test > Traces, add AxisData.VelocitySetpoint, DB_AxisMirror.Axis1.rVelocityAbs, DB_AxisMirror.Axis1.bDirection, and the raw AQ value. Trigger on direction toggle.
  2. Scope check — Probe the analog pin with a passive 10:1 probe referenced to the controller's analog ground. Move the axis through a full forward-reverse cycle at 10 % of v_max. Confirm zero negative excursion.
  3. Direction-toggle timing — Verify that the DQ transitions within the same servo cycle as the AQ crossing of the 0.5 V threshold (use a two-channel scope, edge-triggered on DQ).
  4. Fault word monitor — Watch the drive's analog-undervoltage and direction-setup-time faults. With the fix in place, both must remain clear across 100 direction reversals.
  5. Functional accuracy — Command a known move of 100.0 mm at 0.1 m/s and compare the actual position to the command. The post-fix accuracy should be within the mechanical repeatability of the system (typically ± 0.01 mm for a ball-screw stage).

12. Common Pitfalls and Field Notes

  • Writing to AQ in the IPO OB — only the post-servo OB is guaranteed to run after the position controller finishes. Writing to AQ in IPO or the background task produces an inconsistent waveform and a one-cycle delay that breaks the drive's setup time.
  • Forgetting the PIP OB Servo — the sign bit and the analog value must update in the same servo window. A common mistake is to put the sign bit in the cyclic OB1: the drive sees a 1-cycle skew and reports a direction-setup violation.
  • Using REAL instead of LREAL — the velocity setpoint at low speeds (sub-mm/s) loses resolution quickly in a 32-bit real. Always cast to LREAL before the absolute-value and the integer conversion.
  • Casting negative to UINT — REAL_TO_UINT of a negative real returns 0 on most SIMOTION runtimes, masking the bug instead of surfacing it. Use REAL_TO_INT inside a saturated wrapper, never the raw conversion.
  • Hot-spare CPU — on a redundant SIMOTION pair, the mirror DB must be in the synchronised area. Otherwise the backup CPU will command 0 V on takeover while the TO is still in the sign-reversal state.

13. Related Configuration Knobs

TO Property Path in TIA Relevant Value
Reference velocity TO > Configuration > Mechanics Match the analog scaling constant in §10
Output scaling TO > Configuration > Analog interface 0-10 V, unipolar, signed-output disabled
Position controller cycle TO > Configuration > Closed loop ≥ 1 ms, multiple of MC-ServoPost cycle
Drive enable mode TO > Configuration > Drive Hold on analog fault, do not reset on direction change

14. Standards and References

The 0-10 V analog interface and the unipolar-only constraint are documented in the controller system manual referenced in the field report (chapter A.10.7) and in the application example for "analog drive with SIMOTION / S7-1500T". For commissioning and EMC, the wiring practices in the Siemens Industry Online Support FAQ for "S7-1500 Motion Control — Analog Drive" apply. Numerical converter scaling is per the IEC 61131-9 convention adopted in the SIMATIC analog-module documentation.

Why does the analog output go negative only when I add the MC-ServoPost OB?

Because the OB is the only block that writes the signed velocity setpoint to the analog output channel. Without it, the TO drives no signal; with it, the signed real is copied straight to the AQ, producing a negative lobe on direction reversal and decel. The fix is to split the signed setpoint into magnitude and sign inside the OB.

Can I clamp the analog output to 0 V instead of splitting magnitude and sign?

No. Clamping to 0 V removes the brake capability — the controller can no longer command a negative velocity to actively decelerate the axis. The drive relies on the magnitude on the analog line and the direction on the digital line to know which way to spin. Use the magnitude/sign split, not a clamp.

What raw count corresponds to 0 V and to 10 V on a Siemens 0-10 V analog output?

0 V = 0 raw counts, +10 V = 27648 raw counts. The overshoot range 0..32511 is allowed briefly. Negative raw counts are invalid on a unipolar channel and will produce the negative-lobe symptom when written.

Where exactly should the digital direction bit be written?

Inside the PIP OB Servo (also called the post-servo I/O OB), in the same servo cycle as the analog output write. Writing the DQ in OB1 introduces a one-cycle skew that most drives reject with a direction-setup-time fault.

Is the TO-to-DB mirror approach mandatory?

It is not mandatory, but it is the recommended pattern for any production deployment. The mirror decouples the TO from the I/O, allows HMI trending of the same value, and survives TO reconfiguration without recompiling the post-servo OB. The direct method is acceptable for a single-axis prototype.

My drive has ±10 V input, not 0-10 V. Does this still apply?

No. With a ±10 V bipolar analog input, the negative setpoint is meaningful and the magnitude/sign split is not required. The symptom covered in this article is specific to unipolar 0-10 V interfaces. Verify your drive's analog input specification in its datasheet before applying this fix.

Back to blog