Resolving SIMOTION D435 Incremental Encoder Position Read Errors

David Krause13 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

Problem Overview

An incremental encoder configured as an external encoder on a SIMOTION controller reports erratic or unexpected values when read through the Technology Object (TO) sensor data. The classic symptom: a 5000 PPR rotary encoder is wired to a SIMOTION TO External Encoder (TO type D435), but the value of TO.sensorData[1].incrementalPosition does not match the expected pulse-per-revolution count and appears to change unpredictably between scans. Gear ratio is 1:1, the TO is enabled, and the encoder is mechanically coupled to a rotary axis.

This symptom is one of the most frequently reported configuration traps in SIMOTION motion commissioning. It almost always traces to one of three root causes: (1) reading a raw pulse count while expecting engineering units, (2) the encoder pulses-per-revolution being set in the wrong subsystem (SIMOTION vs. SINAMICS Integrated), or (3) the wrong monitor path being inspected in the expert list.

Critical distinction: SIMOTION does not natively expose pulses to the user program. It works in engineering units (mm, degrees, increments of 1 LU = Length Unit). The raw pulse count lives in SINAMICS Integrated or in the D435 sensor data block as a 32-bit modular integer.

Understanding the D435 Technology Object

The D435 component in SIMOTION is the system-internal identifier for an External Encoder Technology Object. Every external encoder that is not part of a SINAMICS drive object (e.g., a third-party encoder mounted on a linear stage, a load-side encoder on a gearbox, or a stand-alone rotary encoder) is represented as a TO of type D435 in the SIMOTION project navigator.

The D435 TO exposes its live data through a structured system variable namespace:

Path Segment Meaning
D435 TO type identifier for an External Encoder.
TOname User-defined name of the encoder TO in the project (e.g., Enc_LoadShaft).
sensorData[1] Index 1 = the first/primary encoder of the TO. Index 2 is available only if a second encoder is configured on the same TO.
incrementalPosition Raw, unfiltered pulse accumulator (modular, power-of-two width, non-directional).

The full monitor path in the SIMOTION expert list is:

D435.TOname.sensorData[1].incrementalPosition

For an axis that uses the encoder through a TO Axis, the equivalent axis-level position is exposed at axisName.sensorData[1].incrementalPosition and axisName.positioningState.actualPosition (the latter is the engineering-unit value, in degrees for a rotary axis).

Root Cause: Pulse Count vs. Engineering Units

The most common root cause for "different values" reported by the user is a semantic mismatch. SIMOTION offers two fundamentally different position quantities on every encoder TO, and they do not numerically match unless the TO's mechanical configuration and the user's mental model agree.

Variable Domain Type Width Behavior
sensorData[1].incrementalPosition Pulses DINT (LREAL on newer TO versions) 32-bit modular (mod 232) Monotonic, never inverts with direction change, wraps every full turn of the modulo range.
positioningState.actualPosition Engineering units (e.g., degrees) LREAL 64-bit floating point Reflects axis modulo, gear ratio, leadscrew pitch, and software direction.
motionState.actualPosition Engineering units LREAL 64-bit floating point Same domain as positioningState, but sampled at the IPO/IPO2 clock.

The internal incrementalPosition is a raw pulse accumulator. It is expressed in the same 2N modular format used by the SINAMICS drive firmware and increments on every valid edge the encoder logic detects. For a 5000 PPR encoder in quadrature (×4 evaluation), the encoder hardware produces 20,000 edges per mechanical revolution, and the IncrementalPosition counter ticks 20,000 times per revolution.

Quadrature multiplication: When the encoder is set to quadrature (the SIMOTION/SINAMICS default for HTL/TTL incremental encoders), the effective resolution is 4 × PPR. A 5000 PPR encoder therefore yields 20,000 counts per revolution at the IncrementalPosition variable. If the user reads 5000, the encoder is configured in pulse-and-direction or non-quadrature mode.

The second source of confusion is the modular behavior of the raw counter. The 32-bit counter wraps at 232 = 4,294,967,296 counts. At 20,000 counts per revolution, the wrap occurs every 214,748 mechanical turns. Because the value is read as a signed 32-bit integer, observing it as a "large, random-looking number" (e.g., 16,000,000+) is normal — the counter starts at the value present at power-on or TO initialization, not at zero.

The third source is the lack of direction inversion. Unlike engineering-unit position, the raw incrementalPosition does not invert sign when the encoder direction bit is toggled in the TO configuration. It only resets (zeroes) when the TO is initialized or when a reference-mark search completes, depending on the firmware version. This is intentional: it allows precise mixed-domain calculations that must be independent of the configured axis direction.

SINAMICS Integrated Encoder Configuration

The encoder's pulses-per-revolution parameter is owned by the SINAMICS Integrated drive object, not by the SIMOTION project. The setting lives in the SINAMICS parameter tree, which is accessible through SCOUT/STARTER or, since TIA Portal V15, through the TIA Portal SIMOTION plug-in.

  1. Open the project in SIMOTION SCOUT (or TIA Portal with the SIMOTION option).
  2. Navigate to the SINAMICS Integrated drive object that hosts the encoder interface (typically DO name > Configuration > Encoder).
  3. Select the encoder sub-object (Encoder 1, Encoder 2, or Encoder 3 depending on which interface the external encoder is wired to).
  4. Set PPR (pulses per revolution) to 5000 for a 5000 PPR encoder.
  5. Set Signal type to match the physical encoder output: TTL, HTL unipolar, or HTL bipolar.
  6. Set Evaluation to Quadrature 4x unless the encoder explicitly requires 1x or 2x evaluation.
  7. Download the configuration to the drive and perform a power-on reset if the firmware version requires it.
Configuration separation: SIMOTION owns the engineering-unit interpretation (gear ratio, modulo value, leadscrew pitch). SINAMICS Integrated owns the electrical interface and pulses-per-revolution. Setting the PPR in SIMOTION has no effect on the drive-side counter, and the TO configuration cannot override the SINAMICS value.

The relevant SINAMICS parameters for a SINAMICS S120 (or G120 with CU320-2) connected encoder are:

Parameter Name Value for 5000 PPR Encoder
p0408 Encoder type Match the encoder class (rotary incremental).
p0418 Fine resolution Gx_XIST1 (in bits) 11 (default for standard SIMOTION TO interface)
p0418 / p0419 Fine resolution of incremental signals Quadrature 4x = 2 bits per pulse × 5000 = 20,000 increments/rev.
p0420[0] Encoder configuration (connection type) Match the terminal interface (X520, X521, X531, etc.).
p0431[0] Incremental signal amplitude 1 Vpp / 5 V HTL depending on hardware.

After download, verify the parameter is active by reading back r0021 (actual smoothed speed) and a known-position move — if the speed value is correct for a given mechanical RPM, the encoder is wired and parameterized correctly.

Technology Object Setup for the External Encoder

With the SINAMICS side configured, the SIMOTION TO must be told how to interpret the 20,000 counts per revolution. For a rotary axis with gear ratio 1:1 and a desired engineering unit of degrees:

  1. In the project navigator, right-click the SIMOTION device and select Insert New Object > Technology Object > External Encoder.
  2. Assign a name (e.g., Enc_LoadShaft) — this becomes the TOname in the system variables.
  3. In the configuration dialog, set the encoder type to Incremental.
  4. Set Increments per motor/load revolution to 20,000 (the quadrature-multiplied PPR).
  5. Set Modulo value to 360.0 (degrees) for a single-turn rotary axis, or leave the value empty for an absolute rotary axis.
  6. If the encoder is on the load side of a gearbox, set the load gear ratio; for 1:1, the fields can be left as 1:1.
  7. Set the Encoder direction bit if the mechanical rotation is opposite to the SIMOTION-defined positive direction.
  8. Download the project and bring the TO to RUN state via the SCOUT commissioning panel or via the program command _enableAxis() for a TO Axis, or POU call to enable the TO encoder for a stand-alone encoder.

Once the TO is in RUN, the engineering-unit value at TOname.positioningState.actualPosition should report a value in degrees that increments and decrements with rotation. The IncrementalPosition should be a steadily increasing (or decreasing, depending on sign convention) integer that changes by 20,000 per mechanical revolution.

Accessing IncrementalPosition via the Expert List

SIMOTION SCOUT provides the Expert List as the canonical tool for inspecting live TO variables. The procedure to monitor the raw pulse count is:

  1. Open the SIMOTION device in SCOUT and connect online (target > connect to target system).
  2. Right-click the encoder TO in the project navigator and select Expert List.
  3. Navigate to the sensorData substructure and add the line sensorData[1].incrementalPosition to the watchlist.
  4. Right-click the watchlist entry and enable Update cyclically.
  5. Rotate the shaft by a known amount (e.g., one full turn) and observe the delta in the variable. The expected delta for a 5000 PPR encoder in quadrature is 20,000.

From the user program, the same variable is accessible as a structured system variable:

// ST code in a SIMOTION user program
PROGRAM EncoderMonitor;
VAR
    pulseCount : DINT;
    degreesPos : LREAL;
END_VAR

pulseCount := Enc_LoadShaft.sensorData[1].incrementalPosition;
degreesPos := Enc_LoadShaft.positioningState.actualPosition;

// Display or use both in the application as needed

The incrementalPosition is of type DINT (signed 32-bit). Reading it as LREAL is possible on newer TO firmware versions, but the bit pattern is identical. Treat it as a modular counter and only compute deltas between two samples taken at a defined interval — do not interpret the absolute value as a meaningful position.

Step-by-Step Resolution Procedure

For the specific symptom of "IncrementalPosition shows unexpected values for a 5000 PPR encoder with 1:1 gearing on a TO External Encoder":

  1. Verify the encoder is recognized at all. In SCOUT, open the TO's diagnostics panel. The state must read RUN or OPERATIONAL. If the state is INITIALIZED or shows a configuration error, the encoder wiring or the SINAMICS-side parameter is at fault.
  2. Confirm the SINAMICS PPR setting. Read back parameter p0408 and the encoder's Configuration dialog in SCOUT. The PPR must be 5000; the resolution is calculated automatically by the firmware from the quadrature setting.
  3. Compute the expected count per revolution. For a 5000 PPR encoder in quadrature: counts_per_rev = 4 × PPR = 20,000. If the encoder is configured in non-quadrature (1x) mode: counts_per_rev = 5,000. Write the expected value down — this is the verification target.
  4. Sample the IncrementalPosition at t=0 and t=one revolution. Use the SCOUT expert list with a fixed update rate, or insert a logging breakpoint in the user program. The delta between the two samples must equal the expected count from step 3.
  5. If the delta is correct but the absolute value is "large," the system is working as designed. The 32-bit modular counter accumulates from the value present at power-on. Re-initialize the TO (_resetAxis equivalent for encoder TOs, or a power cycle) only if a zero-referenced starting point is required.
  6. If the delta is wrong (zero, oscillating, or off by a constant multiple), check the evaluation mode in SINAMICS, the encoder cable shielding, and the termination resistors on the encoder interface terminals.
  7. If the engineering-unit value at positioningState.actualPosition is wrong but the raw IncrementalPosition is correct, the TO's mechanical configuration (gear ratio, modulo, leadscrew pitch) is the cause — not the encoder.

Verification and Commissioning Checks

After the corrective configuration, run the following verification sequence to confirm correct operation:

  1. Quadrature resolution check: Move the axis by exactly 1 mechanical revolution. The IncrementalPosition must change by exactly 20,000 counts (for 5000 PPR quadrature). A delta of 5,000 indicates 1x evaluation; a delta of 10,000 indicates 2x.
  2. Engineering-unit check: Move the axis by 1 mechanical revolution. The positioningState.actualPosition must change by 360.0 degrees (for a rotary axis with 1:1 gearing and modulo 360).
  3. Direction inversion check: Command a small positive move. Both the raw and engineering-unit values must change in the sign the application expects. If one inverts and the other does not, the Encoder direction bit in the TO has been toggled, but the raw counter correctly ignores it.
  4. Wraparound check: Command a multi-turn move. The raw IncrementalPosition must wrap cleanly at 232 with no lost counts. The engineering-unit value must wrap cleanly at the configured modulo (360.0 for a rotary axis).
  5. Noise/EMC check: With the axis stationary, monitor the LSBs of IncrementalPosition. A stationary TTL encoder in a clean electrical environment shows zero noise. HTL encoders may show 1-2 LSB of jitter, which is normal. Larger noise values indicate cable shielding or grounding issues.

For background on incremental encoder electrical characteristics and quadrature decoding, refer to the AutomationDirect Encoders Explained technical reference.

Common Pitfalls and Edge Cases

Wrong monitor path. Reading axisName.sensorData[1].incrementalPosition on a TO Axis that uses the encoder indirectly may return the encoder that is configured as the motor encoder, not the external encoder. Always verify which encoder is referenced by index 1 and index 2 of the TO's sensorData array.

TO not in RUN state. A TO that has been added to the project but not assigned to a running task, or that has lost its enable, will hold the IncrementalPosition at its last valid value. This is not a bug; it is a fallback behavior. Bring the TO to RUN via the user program or the SCOUT commissioning panel.

Multiple encoder instances on one TO. A TO can have a primary (sensorData[1]) and a secondary (sensorData[2]) encoder. If the project is configured with two encoders, ensure the index in the watchlist matches the physical encoder being diagnosed. A common configuration is encoder 1 = load-side, encoder 2 = motor-side; this is firmware-version dependent.

Fine resolution mismatch. The fine resolution parameter (p0418, p0419 on SINAMICS) controls how many bits of sub-count resolution the drive sends to the controller. A mismatch between the SINAMICS fine resolution and the TO's expected resolution will cause the raw counter to be scaled incorrectly. The standard value for SIMOTION integration is 11 bits of fine resolution per encoder period.

Encoder type misconfiguration. Configuring a TTL encoder as HTL, or vice versa, will cause the encoder to appear to count but with erratic or multiplied values. The hardware interface must match the parameter in p0400/p0420.

Initialization timing. The IncrementalPosition value is only valid after the TO has completed its initialization sequence. Reading the variable during startup may return a stale or default value. Add a wait condition in the user program for the TO state to reach RUN before sampling.

Firmware version dependencies. The exact behavior of the IncrementalPosition variable, including its data type (DINT vs. LREAL) and whether it resets on enable/disable cycles, is firmware-version dependent. Consult the SIMOTION function reference for the specific runtime version in use (e.g., SIMOTION V4.5, V5.2, V5.4, V5.6) before relying on any particular reset or wrap behavior.

What does the D435 component refer to in SIMOTION?

D435 is the internal type identifier for a SIMOTION External Encoder Technology Object (TO). Every external encoder that is not part of a SINAMICS drive object is represented as a D435 in the project, and its live data is exposed under the path D435.TOname.sensorData[1].incrementalPosition and related system variables.

Why does IncrementalPosition show a large value instead of zero for a 5000 PPR encoder?

The IncrementalPosition is a 32-bit modular counter that accumulates from the value present at power-on or TO initialization, not from zero. It is a raw pulse accumulator with a modulo of 232 = 4,294,967,296 counts, so values in the tens of millions are normal. Use delta values between two samples rather than the absolute value.

How many counts should IncrementalPosition change per revolution for a 5000 PPR encoder?

For a 5000 PPR encoder in quadrature (×4 evaluation, the SIMOTION default), the IncrementalPosition changes by 20,000 counts per mechanical revolution. In 1x (non-quadrature) mode the change is 5,000 counts, and in 2x mode it is 10,000. Verify the evaluation mode in the SINAMICS encoder configuration to confirm.

Where do I set the pulses-per-revolution for a SIMOTION external encoder?

The PPR is set in the SINAMICS Integrated drive object, not in the SIMOTION project. Open the SINAMICS drive in SCOUT (or TIA Portal with the SIMOTION option), navigate to the encoder sub-object, and set the PPR value. SIMOTION's TO then converts the raw pulse count into engineering units based on the mechanical configuration (gear ratio, modulo, leadscrew pitch).

Why does IncrementalPosition not change sign when I invert the encoder direction in the TO configuration?

By design, the raw IncrementalPosition is independent of the configured encoder direction. This property allows mixed-domain calculations that must remain stable when the axis direction is toggled. The engineering-unit value at positioningState.actualPosition will invert with the direction setting; the raw pulse count will not.

Back to blog