Troubleshooting S7-1200 MC_MoveRelative Servo Backtracking

David Krause20 min read
SiemensTIA PortalTroubleshooting
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

Troubleshooting S7-1200 MC_MoveRelative Servo Backtracking in TIA Portal V14 SP1

On an S7-1200 1214C DC/DC/DC running TIA Portal V14 SP1 with S7-1200 Motion Control V6, an axis driven through a 0-10 V analog servo (with the drive's encoder-simulation output wired back to a high-speed counter on the PLC) exhibits a back-and-forth profile when commanded by MC_MoveRelative: the axis reaches the relative target, reverses direction, travels back a portion of the way, and only then settles. The reverse distance grows with the commanded velocity. The MC_MoveRelative command itself is not the source of the symptom; the symptom is a position-control-loop response problem on the Technology Object (TO) PositionAxis, generally produced by one or more of the following:

  • Position controller proportional gain (Kv) too low for the mechanical load, producing an under-damped approach and a corrective pull-back when the integrator winds up.
  • Acceleration, deceleration, and jerk limits in the TO that are inconsistent with the drive's own ramp parameters, producing a setpoint the drive cannot follow without a sustained following error.
  • Encoder-simulation PPR configured on the drive that does not match the TO's encoder configuration, scaling the actual position the TO sees and forcing continuous correction.
  • Analog output scaling (10 V = n mechanical units/s) misaligned with the drive's reference-velocity input, producing a velocity bias the loop must cancel.
  • Re-triggering of MC_MoveRelative while the previous move is still in motion, producing decoupled-and-replace behavior on the S7-1200 that the trace shows as backtracking if sampled on the wrong OB.

This article covers the diagnostic procedure, position-controller tuning, encoder and analog-output verification, the MC-Servo trace configuration that exposes what the TO is actually writing, and the command-sequencing check that distinguishes loop problems from command-overlap problems.

1. System Architecture

The motion path is a closed loop: PLC -> TO -> analog output -> drive -> motor -> drive's encoder-simulation output -> high-speed counter (HSC) on the PLC -> TO. Each stage has scaling parameters that must be consistent, otherwise the position controller cannot reach the target without oscillation.

  1. The user program calls MC_MoveRelative on the TO PositionAxis with a target distance and a velocity.
  2. The TO's interpolator generates a setpoint position once per MC-Servo OB cycle (default OB 91).
  3. The TO's position controller compares the setpoint to the actual position read from the HSC and outputs a signed velocity setpoint.
  4. The velocity setpoint is written to the configured analog output address (e.g., PQW on the signal board or a SM analog output).
  5. The drive receives the 0-10 V velocity command, runs its internal current/velocity/position loops, and drives the motor.
  6. The drive's encoder-simulation output produces a pulse train proportional to motor shaft position. The PLC HSC counts these pulses and the TO converts them to mechanical units using the configured PPR and distance per revolution.

If any of the four scaling factors below is wrong, the position controller cannot zero the following error without producing motion in the opposite direction.

Stage TO / drive parameter Effect of mismatch
Encoder interface Increments per revolution / Distance per revolution Actual position reported to the TO is wrong; controller commands a continuous correction that appears as backtracking.
Drive interface Reference speed (10 V = ... units/s) Velocity setpoint saturates below what the drive can deliver, or produces a bias the loop must cancel.
Dynamic limits Max velocity, acceleration, deceleration, jerk Setpoint ramps exceed drive capability; drive lags, following error rises, and the loop pulls back at ramp end.
Position controller Kv, precontrol weighting, filter time Loop is under-damped; overshoot on approach followed by reverse correction.

2. The MC_MoveRelative Execution Model

On the S7-1200 with Motion Control V6, MC_MoveRelative is a non-buffered command under the default mode. The behavior follows the standard PLCopen motion-control model: a new command issued while a previous move is in progress either aborts the previous move (if the input Execute edge is used with aborting behavior) or is rejected. The reference semantics are documented in the PLCopen specification, and a parallel description is given in the Beckhoff MC_MoveRelative information system: a new motion command automatically decouples the axis and the new command is then executed.

For the use case described - one MC_MoveRelative every 1 s or less with velocity derived from the trigger period - two pitfalls exist:

  1. If the move duration is longer than the trigger period, the axis never completes a move before the next one starts. The setpoint is rewritten every cycle and the trace shows a continuous "approach - overshoot - correct" pattern that is in fact a sequence of overlapping profiles, not a single back-and-forth motion.
  2. If the move duration is short enough that the axis finishes a smooth unidirectional move, but the trace still shows reversal, the problem is in the position loop (Sections 4-7), not in the command sequencing.

Diagnostic: temporarily increase the trigger period to 5 s and confirm the axis completes a full smooth unidirectional move before the next is issued. If it does, the issue is sequencing. If it still backtracks, the issue is loop tuning.

3. Diagnostic Procedure with Trace

The first step is to capture the actual signals the TO is producing. Open the TO in TIA Portal, select Commissioning > Trace, and create a trace with the following signals (all exposed on the TO's diagnostics view):

  • <Axis>.ActualPosition
  • <Axis>.SetpointPosition
  • <Axis>.ActualVelocity
  • <Axis>.SetpointVelocity
  • <Axis>.FollowingError
  • The PLC tag driving the analog output word (e.g., "AQ_Velocity" written to a PQW address on the signal board)
  • The raw HSC value (e.g., "HSC_Count") for an independent sanity check of the encoder scale
Sampling point. Set the trace sampling to OB MC-Servo (i.e. the application cycle of the TO, which defaults to OB 91 on the S7-1200). Do not use the default OB1. Sampling on OB1 produces jitter because motion is processed in a fixed MC-Servo cycle that is decoupled from OB1. The recorded values will not be the values the controller actually saw.

Trigger the trace on FollowingError > threshold or on a rising edge of a tag that pulses at the start of each MC_MoveRelative call. Record at least 5-10 successive moves so that steady-state behavior is visible.

Interpreting the trace

Three signatures are diagnostic.

  1. Overshoot then reverse pull-back (typical Kv too low or ramp too short). ActualPosition approaches SetpointPosition, overshoots, and the controller commands a negative velocity to pull back. The reverse stroke is roughly the overshoot. Fix by enabling velocity precontrol at 100% (Section 5) and tuning Kv (Section 4).
  2. Setpoint leads actual by a constant lag (drive not keeping up). SetpointVelocity and the analog output saturate at the configured maximum, but ActualVelocity stays below it. FollowingError rises during the move and collapses when the ramp ends, often with reverse motion. Increase the TO's max velocity, max acceleration, and jerk to match what the drive can deliver, or reduce the commanded motion to fit the drive's envelope.
  3. Following error roughly proportional to velocity (velocity scale mismatch). The drive is asked for more speed than the analog output can command, or the analog output is not zero-centered correctly. Verify the reference speed and the analog polarity (Section 7).

4. Position Controller Tuning

The TO's position controller on the S7-1200 is a P-controller with optional velocity precontrol. Open the TO configuration under Control Loop > Position Controller and adjust the parameters below.

Parameter Default Effect
Kv (proportional gain) 1.0 Higher Kv reduces following error but reduces damping. Too high produces oscillation; too low produces overshoot and backtracking.
Velocity precontrol weighting 100% Removes the following error caused by a velocity step. Recommended at 100% so the loop responds to setpoint changes without a large proportional correction.
Acceleration precontrol weighting 0% Removes following error during acceleration ramps. Enable if acceleration following error is visible in the trace.
Position setpoint filter 0 ms Smoothing the setpoint. Adding filter time improves smoothness but adds following error and can produce back-and-forth oscillation if too high.

A reasonable starting Kv for a 0-10 V drive with velocity precontrol at 100% is between 5 and 20 (the unit depends on the configured mechanical unit; on a rotary axis it is typically (1/s)).

Manual tuning procedure without a model:

  1. Set jerk, acceleration, and deceleration to values the drive can follow without saturating (start at 50% of the TO's max).
  2. Set velocity precontrol to 100%.
  3. Set Kv = 1.0 and run a single move. Observe the trace: ActualPosition will lag SetpointPosition by a steady amount proportional to velocity (visible as a non-zero FollowingError during the move).
  4. Increase Kv in steps of 2-3 and rerun. The following error during the move should shrink.
  5. Stop increasing when the trace shows oscillation, overshoot, or ringing on the actual position. Back off 20-30% from that Kv.
Why backtracking appears with Kv too low. With velocity precontrol disabled, the position controller must generate the full velocity setpoint from the position error alone. Near the target, the setpoint decelerates while the actual velocity is still high, producing a position overshoot. The controller then commands a negative velocity to drive the actual position back to the setpoint. Enabling velocity precontrol at 100% removes most of this overshoot because the controller no longer needs to "wind up" to generate a forward velocity.

5. Velocity Precontrol and Loop Dynamics

The S7-1200 position controller follows a feed-forward plus feedback structure: the velocity setpoint to the analog output is Precontrol + Kv * (SetpointPosition - ActualPosition). With precontrol = 100%, a step in setpoint velocity produces a step in the analog output without requiring any following error. Without precontrol, the controller must develop a following error proportional to the velocity before the analog output reaches the commanded value.

For a smooth unidirectional move, the target state is:

  • During the acceleration ramp: the analog output drives the drive at the velocity the setpoint requires, with a small bounded following error.
  • At constant velocity: the following error is approximately constant and small (a few encoder increments).
  • During the deceleration ramp: the following error decreases toward zero.
  • At standstill: the following error is zero, the analog output is at its configured standstill value, and the drive holds position.

If the trace shows a different shape (rising following error during the move, falling following error with reverse motion at the end), one of three things is wrong: the Kv is too low, the drive cannot follow the setpoint ramp, or the analog output is saturated.

6. Encoder Simulation and PPR Matching

When the drive simulates the encoder, the PPR value on the drive must match the PPR expected by the TO. The TO's expectation is set in Configuration > Encoder > Increments per revolution. Mismatches produce a steady following error that the controller cannot zero, which appears as continuous back-and-forth motion or a constant offset.

Verification procedure:

  1. Command a small MC_MoveRelative (for example, one motor revolution) and observe ActualPosition in the trace at the end of the move.
  2. If ActualPosition is correct (within one encoder increment), the scaling is correct.
  3. If ActualPosition is off by a constant ratio, the PPR or distance-per-revolution is wrong. Adjust either the drive's encoder-simulation PPR or the TO's "Increments per revolution" / "Distance per revolution" so that the actual position increments match the commanded distance.

Example: if the drive is set to 2500 ppr quadrature (= 10000 counts/rev) but the TO is configured for 1024 increments/revolution, every commanded revolution will be reported back as 1024/10000 = 0.1024 of a revolution, and the TO will command approximately 9.77 forward revolutions to reach a 1-rev target - with continuous correction, which the trace will show as a sawtooth motion with reversals at every cycle.

7. Analog Output Scaling and Polarity

The TO's drive interface is configured under Configuration > Drive > Analog drive interface. Three values must match the drive:

TO parameter Drive parameter Typical value
Reference speed (10 V = ... units/s) Maximum analog input speed 3000 rpm = 314.16 rad/s on a rotary axis
Output polarity Analog input polarity / sign convention 0-10 V unipolar (0 V = 0, 10 V = +max) or bipolar (5 V = 0, 0 V = -max, 10 V = +max) - depends on drive
Standstill output value Drive zero-speed command voltage 0 V unipolar, 5 V bipolar

If the drive is set for 0-10 V unipolar but the TO is configured for bipolar (5 V center), the drive sees a constant 5 V bias at standstill and never actually stops. The position controller then commands a small negative velocity to overcome this bias, which looks exactly like the backtracking symptom.

Verify with the trace: at standstill with a zero command, the analog output should be either 0 V (unipolar) or 5 V (bipolar), not some intermediate value the controller has "decided" on. If the analog output is, for example, 4.6 V at standstill, the drive is interpreting that as a small forward speed and the controller is applying -0.4 V of correction - the same symptom in the trace as a position controller oscillation.

8. Dynamic Limits, Jerk, and Profile Shape

The TO's dynamic limits are in Configuration > Dynamic Limits.

Parameter Effect of undersizing
Max velocity Analog output saturates; drive runs at its own limit independent of TO command.
Max acceleration / deceleration Setpoint ramps finish inside the drive's capability; if lower than the drive's own ramp, the drive is "fighting" the TO's slower ramp and producing oscillation at transition points.
Max jerk (S-curve) Smoothing the trajectory. Excessive jerk limiting makes the trajectory arrive late at the target, leaving a following error the controller cancels with reverse motion.
Emergency deceleration Used on error stop. If too low, the axis overruns after a fault; if too high, the drive faults on its own overcurrent limit.

For a "smooth unidirectional" profile, the correct setting is moderate jerk (so the velocity ramps are S-curves, not triangles) and acceleration / deceleration high enough that the drive can reach the commanded velocity in the time available. If the move distance is small relative to the velocity, jerk-limited profiles never reach the target velocity at all - the axis is in continuous acceleration / deceleration, and any mismatch between the TO's profile and the drive's profile shows up as backtracking.

Rule of thumb: for a 1 s move at 100 mm/s, the profile must reach 100 mm/s within the move. If max acceleration is 50 mm/s^2, the axis needs 2 s of acceleration alone - the move cannot be a constant-velocity motion at all, and a smooth unidirectional profile is impossible without raising the acceleration limit.

9. Position Monitoring, Following Error Limits, and Standstill

The TO has two monitoring windows that can mask the backtracking symptom by aborting the move with a fault rather than letting the oscillation run. They should be set wide enough that they do not trip on a normal move, and tight enough to catch real faults.

Parameter Path Typical value
Following error tolerance Configuration > Monitoring > Following error 0.5 - 2x the expected following error at max velocity with the current Kv. Too tight -> fault on every move; too loose -> no detection of real following errors.
Position tolerance / standstill window Configuration > Monitoring > Position A few encoder increments. The axis is "in position" when the actual position is within this window for the configured dwell time.
Standstill signal dwell time Configuration > Monitoring > Standstill 100 - 500 ms typical. Prevents the standstill signal from pulsing on a momentary arrival during an oscillation.
Note on standstill. If the standstill signal is used to gate the next MC_MoveRelative trigger, an under-damped loop will report "in position" for a few cycles, then move out of the window, then back. Each transition retriggers the next move from a moving base, which the trace shows as a back-and-forth profile. Increase the standstill dwell time so the next trigger only fires after the axis has actually settled.

10. Drive Enable, Homing, and Pre-Move State

Before MC_MoveRelative can be called, the axis must be in the correct state. The required state is Standstill (or Positioning, depending on abort behavior), which is reached only after MC_Power has enabled the drive, the axis has been homed with MC_Home, and any active error has been acknowledged with MC_Reset. Forgetting any of these produces different symptoms:

Missing step Symptom
MC_Power not called / not latched Axis remains in "Disabled" state; MC_MoveRelative returns an error, no motion.
MC_Home not called Axis is in "Homing required" state on the S7-1200; MC_MoveRelative is rejected with error 0x8001 (axis not homed).
MC_Reset not called after a fault Axis is in "Error" state; MC_MoveRelative returns an error.
Drive enable output not wired to the drive The TO thinks it is enabled (MC_Power.Status = TRUE) but the drive is actually off. The analog output swings but the motor does not move; the position loop winds up the analog output, and when the drive enable is finally applied, the motor jumps in the wrong direction.

Verify the sequence in the trace: MC_Power.Status = TRUE, MC_Home.Done = TRUE, no active error on the axis, and then MC_MoveRelative is called. If the drive enable is a digital output (e.g., on the signal board), include that output in the trace as well.

11. Commissioning Checklist

Work through this list in order. After each change, re-run the trace and confirm that all five verification checks in Section 12 pass.

  1. OB cycle: confirm the MC-Servo OB is present (default OB 91) and its cycle time is at most 1/10 of the expected move time.
  2. Encoder scale: command one motor revolution and confirm ActualPosition increments by exactly the configured "Distance per revolution".
  3. Analog output: with the axis disabled, manually write a small test value (e.g., 0 V and 5 V) to the analog output and confirm the drive responds as expected (motor at zero speed / motor at half speed for a bipolar drive).
  4. Reference speed: confirm the TO's "Reference speed" parameter equals the drive's rated speed at 10 V input, in the same units.
  5. Drive enable: confirm the digital output wired to the drive enable changes state when MC_Power is called.
  6. Position controller: set velocity precontrol = 100%, Kv = 1.0, run a move, and increase Kv until the trace shows minimum oscillation.
  7. Dynamic limits: confirm the TO's max velocity, acceleration, deceleration, and jerk are all at or below the drive's capability, and that the move profile is reachable in the time available.
  8. Monitoring windows: set following error tolerance and standstill dwell time wide enough that they do not trip on a normal move.
  9. Trace sampling: confirm the trace is sampling on OB MC-Servo, not OB1.

12. Verification Steps

After each change, re-run the trace and confirm:

  1. SetpointPosition reaches the target monotonically (S-curve profile, no discontinuities).
  2. ActualPosition tracks SetpointPosition with a small, bounded following error during the move and zero following error at standstill.
  3. No reversal of ActualVelocity during or after the move.
  4. FollowingError converges to zero within a few MC-Servo cycles after standstill.
  5. The analog output is at the configured standstill value (0 V unipolar or 5 V bipolar) when the axis is at rest.

Once all five are satisfied, the axis will perform a smooth unidirectional move to the target and stop without backtracking.

13. Summary of Settings to Check

Symptom First thing to check
Reversal after reaching target Position controller Kv; enable velocity precontrol 100%
Reversal grows with velocity Drive reference speed vs. TO max velocity; encoder simulation PPR vs. TO PPR
Steady offset at target Encoder scaling (PPR + distance per revolution)
Drive saturates during move TO max velocity / acceleration / jerk vs. drive capability
Trace looks jittery or values look quantized strangely Trace sampling OB (must be MC-Servo / OB 91, not OB1)
Axis never reaches commanded velocity Move distance too short for the velocity / acceleration / jerk profile
MC_MoveRelative rejected Axis state - confirm MC_Power, MC_Home, MC_Reset sequence
Axis never reaches "in position" Standstill dwell time vs. oscillation period; widen the dwell or fix the loop

14. Cross-Reference: Related Motion Blocks

Other blocks in the same motion library interact with the loop behavior and should be reviewed in the same commissioning pass.

Block Role Failure mode if misconfigured
MC_Power Enables the drive and latches it on Axis never leaves the Disabled state; no motion.
MC_Reset Acknowledges axis errors Axis stays in Error state after a fault; no new motion accepted.
MC_Home Sets the position reference Axis is in "Homing required"; MC_MoveRelative rejected.
MC_MoveAbsolute Move to a fixed position Same loop issues as MC_MoveRelative; useful diagnostic for distinguishing profile-dependent from command-dependent symptoms.
MC_MoveVelocity Move at a fixed velocity indefinitely Useful for measuring the open-loop velocity response and the analog-output saturation point.
MC_Stop Decelerate to standstill with the configured emergency deceleration If emergency deceleration is too low, the axis overruns the target after MC_Stop; if too high, the drive faults.
MC_Halt Decelerate to standstill with the configured normal deceleration, axis remains enabled Used at end of a sequence to leave the axis in Standstill without disabling it.

15. Compatibility and Firmware Notes

The trace behavior, MC-Servo OB cycle time, and position controller parameters are firmware-version dependent on the S7-1200. The configuration described in this article applies to TIA Portal V14 SP1 with S7-1200 Motion Control V6 (firmware 4.x on the CPU). Earlier firmware versions (Motion Control V3 / V4 / V5) have a different trace structure, a different parameter naming for the position controller, and do not expose all the signals listed in Section 3. If the project is migrated to a newer TIA Portal version (V15, V16, V17, V18) the MC-Servo block name and the parameter layout change, but the loop-tuning procedure is unchanged. Confirm the CPU firmware version under Online > Accessible devices before applying the parameter values from this article.

The official S7-1200 Motion Control function manual is published on the Siemens Industry Online Support portal: support.industry.siemens.com. Use the manual's section on "Position controller" and "Trace" as the authoritative reference for the parameter names on the specific firmware version in use.

FAQ

Why does my S7-1200 servo reverse direction after MC_MoveRelative reaches the target?

The reversal is the position controller pulling the actual position back toward the setpoint after an overshoot. Enable velocity precontrol at 100% in the TO's position-controller configuration and raise Kv until the following error during the move is small but no oscillation appears on the actual position.

Which OB should I select for the trace sampling point on S7-1200 motion control?

Use OB MC-Servo (default OB 91 on the S7-1200) so that trace values are recorded in the same cycle in which the TO interpolates, reads the encoder, and writes the analog output. OB1 sampling produces jitter that hides the actual loop behavior.

How do I match the encoder-simulation PPR on the drive to the S7-1200 TO?

Set the drive's encoder-simulation PPR equal to the "Increments per revolution" value in the TO's encoder configuration. Verify by commanding a known distance (e.g., one motor revolution) and confirming ActualPosition increments by the configured "Distance per revolution" once the move completes.

What is the correct analog output scaling for a 0-10 V servo?

Set the TO's drive reference speed (the speed commanded when the analog output is at 10 V) equal to the drive's rated maximum speed at 10 V input, in the same units. If the drive uses bipolar 5 V center, configure the TO's drive interface accordingly - a mismatch produces a constant velocity bias and apparent backtracking.

Can I call MC_MoveRelative more often than the move duration?

Yes, but the previous move is decoupled and the new distance is computed from the current position. If the new command arrives before the previous one has settled, the axis will never complete a full profile and the trace will show overlapping approach / overshoot / correction cycles. Increase the trigger period, reduce the commanded distance, or reduce the velocity so each move completes before the next is issued.

What is a reasonable starting value for Kv on the S7-1200 position controller?

With velocity precontrol at 100%, start with Kv = 1.0 and increase in steps of 2-3 until the trace shows minimum oscillation. Typical final values for a 0-10 V drive with a motor in the 100 W - 1 kW range are between 5 and 20 (units depend on the configured mechanical unit, typically 1/s on a rotary axis).

My MC_MoveRelative is rejected with an error. What state is the axis in?

Check the axis status word and the standard PLCopen error codes. Most commonly: error 0x8001 means the axis has not been homed, error 0x8002 means the axis is disabled (call MC_Power first), error 0x8004 means the axis is in an error state (acknowledge with MC_Reset). The exact error IDs depend on the firmware version - see the S7-1200 Motion Control manual for the current mapping.

Back to blog