AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Why a PLC reads servo position only as cyclic data

Servo and stepper motion Published 9 min read By AutomateDirectUSA engineering team

Short answer

A PLC can read each servo drive's actual position cyclically over CANopen or Ethernet, but the drive's sample period, the bus cycle and the task period, each with jitter, age the value, so it is never time-aligned across axes. At 2.0 m/s a 19 ms worst-case age makes the read-back stale by 38 mm, far past a ±3 mm mark tolerance. Close mark registration on a latched sensor edge with a clamped speed trim instead, or move to a motion controller on a synchronized drive bus.

On this page
  1. Can a PLC read a servo drive's actual position in real time?
  2. Which link should carry the position: CANopen, Ethernet or serial?
  3. What delays age the position value before the program sees it?
  4. How much registration error does that latency cost at line speed?
  5. Why is motor encoder position the wrong variable for mark alignment?
  6. How do you align four webs with a speed trim on a latched mark edge?
  7. When does a motion controller replace the PLC?
  8. Questions asked

Four servo drives on one PLC is a common architecture, and reading each drive's actual position over CANopen or Ethernet works — as cyclic data, not as real time. The value your program sees has been aged by the drive's sample period, the bus cycle and the task period, with jitter on each boundary, so it is never a time-aligned snapshot of all four axes. Whether that matters depends on what you do with the number. For display and supervision it is fine. For aligning printed marks on four paper webs it is not, and that job closes on a latched sensor edge with a clamped speed trim, or on a motion controller with a synchronized drive bus.

Can a PLC read a servo drive's actual position in real time? #

Yes to reading and no to real time: a PLC with a CANopen or Ethernet master reads each drive's actual position every bus cycle, but the value arrives as cyclic data with an age, never as a time-aligned snapshot of all four axes.

On CANopen the mechanism is standard. The CiA 402 drive profile, also published as IEC 61800-7, requires every compliant drive to expose the same drive-profile objects, actual position among them, and CiA 301 lets you map that object into a transmit PDO that goes out once per bus cycle. Cyclic Ethernet exchange works the same way in principle, with Modbus TCP or EtherNet/IP mappings refreshed on a fixed period. What a plain PLC cycle does not give you is a guarantee that the four values were sampled at the same instant. That is what cycle-bound means: each number is a real measurement with a known mechanism behind it and an age that differs from axis to axis.

Use CANopen or a cyclic Ethernet exchange for the position and keep the serial link for commissioning; a PLCopen motion library maps actual position into the cyclic data on either bus, but the four axes share one CANopen cycle while Ethernet reads finish at instants that are not aligned.

Put the position on CANopen when all four axes should share one defined bus cycle. Four drives on one cable consume bandwidth, and how short the cycle can run before the bus saturates is the subject of what decides a CANopen controller's servo axis capacity. Use a cyclic Ethernet exchange when the motion library expects it or the drives offer only an Ethernet interface; the data rate is higher, but the refresh instants of the four axes are not synchronized. Leave the RS-485 serial link for parameter access and diagnostics during commissioning — it is too slow for a continuous position stream. Whatever you choose, take the object or register addresses for actual position from the fieldbus manual for your exact drive firmware, then jog each motor and confirm every value moves in the right direction and scale before trusting the mapping.

What delays age the position value before the program sees it? #

Three delays stack before your program sees one position value — the drive's sample period, one bus cycle of transit, and the task period of the PLC — each with jitter, so the number to budget is a worst-case age, not the average cycle time.

The first delay is the drive's sample period: the drive updates its actual-position object on its own task, so the value in a frame may have been sampled almost one sample period earlier. The second is one bus cycle of transit and scheduling before the frame reaches the PLC. The third is the task period: the program consumes the value at its task boundary, up to one period after arrival. Each boundary adds jitter, and cycle-to-cycle jitter is defined as the maximum difference between two consecutive periods, which is why the budget uses the worst case. To get the real figure, log the interval between updates of the received value over several minutes of production running and take the maximum interval. The working formula, with T_sample the drive's sample period, T_bus the bus cycle, T_task the PLC task period and J the measured worst-case jitter:

age_max = T_sample + T_bus + T_task + J

How much registration error does that latency cost at line speed? #

The error equals line speed multiplied by the worst-case sample age: at 2.0 m/s with a 19 ms age the read-back position is stale by 38 mm, about thirteen times a ±3 mm mark tolerance.

Here is a calculated example with inputs you would take from your own configuration, not measured results: line speed v = 2.0 m/s, drive sample period 4 ms, bus cycle 4 ms, PLC task period 10 ms, and 1 ms of worst-case jitter from a logged run.

  • age_max = 4 ms + 4 ms + 10 ms + 1 ms = 19 ms
  • stale distance = v × age_max = 2.0 m/s × 0.019 s = 0.038 m = 38 mm

That is thirteen times over the tolerance, so on this line the cyclic read cannot close a registration loop; it stays useful for display, supervision and slow trending. As a rule of thumb, let a cyclic read touch a control loop only when its stale distance is below one fifth of the tolerance — this example fails that gate by a wide margin.

Why is motor encoder position the wrong variable for mark alignment? #

Because the mark lives on the web, and the path from motor angle to web position runs through draw, slip, stretch and a changing roll diameter, so four perfectly matched encoder readings can sit above four marks that drift apart.

The quantity that matters is the mark-to-reference error at the sensor, and motor angle reaches it only through the draw between rollers, web slip and stretch, and a roll diameter that changes as the roll runs down. A position lock on four encoder values can therefore hold perfectly while the printed marks walk apart. So whatever controller stays in the cabinet, the registration feedback is the contrast sensor's edge, and the encoder position is supervision data. Closing a loop on a sensor rather than the motor encoder has the same requirements as any external feedback loop — one scaling, one fresh edge, one defined sample — the subject of what an external encoder position loop needs to close.

How do you align four webs with a speed trim on a latched mark edge? #

Run every web in velocity mode from one common line-speed reference, latch each contrast sensor's edge in hardware, compute each web's mark error from the time between latched edges, and add a small clamped speed trim per web until the error is zero.

  1. Commission the four drives in velocity mode with identical scaling, so one line-speed reference produces the same web speed on every axis; verify with a hand tachometer or a length measured over a timed interval.
  2. Wire each contrast sensor to a hardware-latched input on the PLC, or to a drive capture input where the drive has one. Latching takes the mark timestamp out of the task cycle, so task jitter drops out of the measurement. Prove it by toggling a sensor at a known spacing and confirming the measured spacing repeats.
  3. Compute each web's error as line speed multiplied by the time between its latched edge and the reference web's edge. With a latch resolution of 100 µs — take the real figure from the PLC's fast-input specification — the same line speed times 0.0001 s gives 0.0002 m, or 0.2 mm, far inside the tolerance.
  4. Apply a clamped trim to each web's velocity command. In the example all variables are REAL, ErrN and ErrIntN start at 0.0, Kp is 5 per second and Ki starts at zero; LIMIT is the standard structured-text clamp function.
LineSpeed := 2.0;   (* m/s, the common reference *)
TrimMax   := 0.04;  (* m/s, two percent of line speed *)
SpeedCmdN := LineSpeed + LIMIT(-TrimMax, Kp * ErrN + Ki * ErrIntN, TrimMax);

The clamp test: with ErrN at 0.010 m the raw trim is 5 per second × 0.010 m = 0.05 m/s, LIMIT returns TrimMax, and the web runs at line speed plus 0.04 m/s — the clamp holds. Freeze ErrIntN while the clamp is active to prevent windup.

  1. Tune with Ki at zero: raise Kp from a low value until the error converges without oscillating, then add Ki to remove the steady offset. Correct only on valid marks.
  2. Check the correction time: removing a full 3 mm error at the 0.04 m/s clamp takes 0.003 m ÷ 0.04 m/s = 0.075 s, so the loop settles in a fraction of a second.

This design keeps the fast position loop in the drive's velocity controller and gives the PLC only the slow correction; where each loop belongs is the subject of servo control loops in the drive or the controller.

Verify in four runs: trim disabled at constant line speed to record the raw drift per web, the disturbance the loop must reject; trim enabled until the error settles inside tolerance and stays over several minutes; line speed stepped up and down across the working range to confirm the marks hold through the ramps; one sensor covered to confirm the missed-mark behavior. Do the step and covered-sensor trials at reduced speed with the web path guarded, and follow the machine's risk assessment and lockout practice under ISO 12100 whenever someone reaches into the line.

When does a motion controller replace the PLC? #

Move to a motion controller on a synchronized drive bus when you need time-aligned axis positions — electronic CAM, gearing or a phase lock — or when the latency error stays above tolerance; a synchronous bus samples every axis in one shared cycle by design.

SERCOS (IEC 61492) and EtherCAT (within the IEC 61158 fieldbus family) are the two drive interfaces built for this: the controller and every drive run one synchronized cycle, actual positions are sampled inside that cycle, and the axis-to-axis jitter disappears by design rather than by tuning. The catch comes at order time: a drive family usually mixes fieldbus variants, and only specific variants speak the synchronous interface, so verify the exact drive reference against the manufacturer's datasheet before committing. The signals that you have reached this point are growing axis counts, CAM profiles, and coordination a plain PLC cannot schedule.

The decision for each case:

  • Latency error below one fifth of the tolerance: keep the PLC cyclic read for display, supervision and trending.
  • Error above tolerance with a visible mark: keep the PLC, run the drives in velocity mode, and close registration on the latched sensor edge with the clamped speed trim.
  • Time-aligned positions required, for electronic CAM, gearing or a phase lock: the PLC class is wrong; specify a motion controller on a synchronized drive bus and drives that support it.

Questions asked

Does a faster PLC task remove the latency?

No. The task period is only the last of the three delays, and a task that runs faster than the bus cycle reads the same frame twice, so the age of the value cannot drop below the drive sample period plus one bus cycle. Shortening the bus cycle or the drive's position update rate moves that floor; shortening only the task does not.

Can the drive timestamp the mark edge instead of the PLC?

Often yes. Many servo drives have a capture or touch-probe input that latches a position or timestamp at an edge, independent of any bus cycle, so the bus latency drops out of the measurement. The feature name, resolution and setup are in the drive's manual, so confirm them for the exact drive and firmware before designing the registration around it.

How large should the speed trim clamp be?

A workable starting point is one to two percent of line speed, widened only if the loop cannot recover inside one mark repeat. The clamp sets the fastest speed change the web ever sees, and a wide clamp turns a sensor glitch into a command. At 0.04 m/s a full tolerance error clears in 75 ms, which is quick enough for most print repeats.

What should the trim do when a web misses its mark?

Hold the last trim and count the misses. After a set number of consecutive misses, for example three, freeze the integral term, raise an alarm and stop correcting. A missed mark usually means a dirty or misadjusted contrast sensor, and correcting on a false edge drives that web to its trim clamp at full line speed.

Keep reading

  • Explainer

    Servo control loops in the drive or the controller

    Keep the current and speed loops in the servo drive, and close the position loop in the drive too. A position loop implemented in the controller runs no faster than the fastest task-class cycle, typically 1 to 10 ms, versus tens of microseconds in a modern drive — at 500 mm/s and 4 ms of delay that is already 2 mm of transport error. Default to drive-closed loops; move the loop into the controller only for slow, non-registration axes after measuring.

    Servo and stepper motion

  • Selection guide

    When multi-axis servo motion outgrows the PLC

    Keep every axis in one controller sized for the whole machine. Move motion off the PLC only when the rated axis count is exceeded, the synchronized group's motion task misses its cycle time, or certified SLS/SS1 monitoring needs a safety controller or drive-integrated safety. Otherwise divide by machine function, never by motion versus logic.

    Servo and stepper motion

  • Explainer

    Position control vs velocity control in servo systems

    Position control regulates measured position against a position command so the axis stops at a target; velocity control regulates speed against a speed command regardless of load. Most servo drives nest them: an outer position loop generates the velocity demand, an inner velocity loop delivers it, and the encoder's pulse count gives position while pulse rate gives speed.

    Servo and stepper motion