AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

How-to

Why an EtherCAT servo can follow an AC drive master axis

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

Short answer

Yes. Keep the EtherCAT master in the CODESYS controller, add both drives as slave devices, back each with a CODESYS axis, and couple the servo with MC_GearIn to the AC-drive axis's actual position at a ratio taken from the machine mechanics. Master axis is a motion role; it does not make the AC drive the network master.

On this page
  1. A master axis is not the EtherCAT master
  2. What each device must provide
  3. The coupling relationship
  4. Setup order in the CODESYS project
  5. Worked check for a 2.00 ratio and a 45.0 rev master move
  6. Checks before the machine couples
  7. When the following error grows after coupling
  8. Questions asked

Yes, the servo can follow the AC-drive axis, and the setup is standard rather than special. The CODESYS controller keeps the EtherCAT master role, both drives sit on the network as slave devices, and the motion relationship is made in the controller's motion engine: you back each drive with a CODESYS axis, then couple the servo axis to the AC-drive axis with the PLCopen gearing block MC_GearIn. Keep one distinction straight from the start: a master axis is a motion role, the axis that supplies the reference, not a network role. A Control Techniques C200 called the master axis is still an EtherCAT slave device in this layout; it is the master only because its position feeds the gearing function as the reference.

A master axis is not the EtherCAT master #

Three roles are in play, and only one of them is a network role:

Role What it does Who holds it in this project
EtherCAT master Runs the cyclic data exchange with every slave device The CODESYS controller, the only one on the segment
Motion master axis Supplies the position reference The axis backed by the AC drive
Motion slave axis Follows the reference at the gear ratio The axis backed by the servo

In a CODESYS 3.5.20 project with Crevis EtherCAT network cards, the CODESYS runtime is the segment's master, and both drives, the C200 and the servo drive, are slave devices in its device tree. Calling the C200 the master axis changes nothing on the network side. A drive on this bus can even be plain IO with no motion axis behind it, a distinction spelled out in when an EtherCAT stepper drive is an IO device and not a motion axis.

What each device must provide #

Four things, confirmed before any logic is written:

  • A cyclic actual-position value from the AC drive over EtherCAT. Take the exact process data objects from the documentation of the drive's EtherCAT option; do not assume them from another drive family.
  • A cyclic position command input and position feedback on the servo drive, which in practice means running it in a cyclic synchronous position mode, whatever the drive's manual calls that mode.
  • Current EtherCAT device-description files for both drives, so CODESYS adds them under the master with the correct process data layout.
  • A definition of follow for the machine: position following through a fixed ratio (what this article sets up), speed matching only, or coordinated start and stop. Ratio coupling is the strictest of the three; if it holds, the others come free.

Choosing which physical signal becomes the reference is a decision in its own right, worked through for cam axes in what decides the master input for an electronic cam axis. For a following axis the answer is the AC drive's actual position, not its commanded setpoint, because the servo should copy what the load did.

The coupling relationship #

Electronic gearing makes the slave's commanded position a scaled, shifted copy of the master's position: slave command = ratio x master position + offset. The ratio is dimensionless and only meaningful once both axes are scaled into one engineering-unit family (rev per rev, or millimetres per rev when one axis is linear). Its sign sets direction; the offset sets phase, meaning where the slave stands when the master is at zero. The same ratio scales speed, so the slave runs at ratio times master speed at every point of the move.

MC_GearIn is the PLCopen block that does this among the CODESYS motion function blocks. Its documented behavior: the gear ratio defines the speed ratio between the master and slave axes, and the slave can be coupled either to the master's setpoints or to its actual values; for this project, select the actual values. The same master-slave structure is what lets a stepper traverse track a reference, as in following a master axis with a stepper traverse; the block and the network are the same, only the follower hardware differs.

Setup order in the CODESYS project #

  1. Leave the EtherCAT master in the CODESYS controller and confirm the segment holds exactly one master; the drives and the network cards stay slave devices.
  2. Add both drives under the master using their current device descriptions.
  3. Map the servo's cyclic position command, control word, status word and actual position; map the AC drive's cyclic actual position plus whatever control data the machine needs from it.
  4. Create one CODESYS axis per drive and connect each axis to its drive's cyclic interface.
  5. Scale both axes into the same unit family so the ratio means something mechanical.
  6. Enable both axes and establish a valid position reference for each, because the engagement has to know where both axes stand.
  7. Call MC_GearIn with the mechanically derived ratio, the correct sign and the phase offset, coupled to the master's actual values.
  8. Run the arithmetic check in the next section before the machine is mechanically coupled.

Worked check for a 2.00 ratio and a 45.0 rev master move #

Your setup details include no machine numbers, so every value below is an example input chosen to show the arithmetic: a calculated example for those inputs, not a measured result.

Inputs:

  • Master move, 45.0 rev: a test move commanded on the AC-drive axis.
  • Gear ratio, 2.00, dimensionless: example mechanics in which the slave must make two turns per master turn.
  • Offset, 0.0 rev: no phase shift at engagement.
  • Allowed coupling error, 0.10 rev of steady following error: an example window for what the mechanics tolerate.

Rule: the slave command equals ratio times master position plus offset, so the change in slave command equals ratio times the change in master position.

Arithmetic: change in slave command = 2.00 x 45.0 rev + 0.0 rev = 90.0 rev.

Result: with the master reporting 45.0 rev of travel, the servo must report 90.0 rev in the same direction.

Decision: inside the 0.10 rev window, scaling, sign and coupling are right, so move on to commissioning. A reading of 45.0 rev instead means the ratio never reached the block. A negative reading means the ratio's sign or the feedback direction is inverted; change one, never both. An error that grows past the window without settling means the master value is wrongly scaled or is computed rather than measured; fix the mapping before touching any gain.

Checks before the machine couples #

Cheapest first:

  1. Network: every device reaches its operational state with no cycle errors. If the master stack cannot open its network adapter, no axis traffic flows at all; the causes and fixes for that failure are walked through in fixing a CODESYS EtherCAT master adapter open error on a PFC200.
  2. Each axis alone: jog the servo and watch feedback change with the correct sign in scaled units; run the AC drive in its normal mode and watch its actual position.
  3. Mode acceptance: the servo's status data shows it in the commanded position mode, with no faults on either drive.
  4. First engagement: guards in place, everyone clear, the master at the slowest speed that still runs cleanly, a hand on the stop. What may move during commissioning comes from the machine's risk assessment, and why safety program placement follows the risk-reduction role applies to that override state as much as to production.
  5. Compare master and slave positions against the calculated relation from the previous section.

When the following error grows after coupling #

The symptom is slave lag that ramps instead of settling. Likely causes, cheapest first, each with its confirming check:

  • Sign error on the ratio or on the feedback: confirm with a slow direction test before any other change.
  • Scaling mismatch between the drive's units and the axis's units: confirm by commanding exactly one master revolution and reading what each axis reports.
  • A commanded or computed master value where a measured one was intended: confirm by loading the AC motor and watching whether the reference still tracks the shaft.
  • Late or dropped cyclic frames: confirm in the controller's network diagnostics.

Do not retune the servo until the first three are excluded; a copied reference cannot be improved by sharpening the copy.

For your case the decision is: the EtherCAT master stays in the controller, both drives stay slave devices, two axes, MC_GearIn on actual values, ratio and sign from the mechanics, and the arithmetic check passed before anything couples mechanically. One conditional closes it: if the C200's actual position turns out to be a calculated estimate rather than a measured value, find how far it drifts under load before trusting the coupling, because the servo will copy the estimate, not the load.

Questions asked

Should the slave couple to the AC drive's setpoints or to its actual position?

Couple to actual values while the master is an AC drive. Its actual position reflects what the load really did; its setpoint is only what was asked, and under slip the two diverge, so setpoint coupling would make the servo chase motion that never happened. Setpoint coupling suits a master that tracks its command tightly, such as a closed-loop servo, and gives a smoother, noise-free reference. MC_GearIn accepts either source, so this is a commissioning decision, not a hardware limit.

Does the servo correct the AC drive's speed or position error?

No. Gearing reproduces the master, scaled: the error the AC axis shows comes out on the slave multiplied by the ratio, so a master running slightly slow makes the servo run proportionally slow, exactly in step. If the product needs accuracy the AC axis cannot hold, the fix is a better reference, meaning measured feedback on the AC axis or a different master, not servo tuning, which can only sharpen the copy.

Can one of the drives take the EtherCAT master role instead of the controller?

Not in this layout. A segment runs exactly one master, and the motion engine sits in the CODESYS controller, so the drives stay slave devices. The master-axis role is only a controller-side assignment: the axis whose position feeds the gearing block. Moving network roles would change nothing about the motion relationship, and a second master on the same segment is simply an invalid topology.

Keep reading

  • How-to

    Changing a servo axis gear ratio at runtime with MC_GearIn

    The load-gear values of an S7-1500 positioning axis are start values, so a write from the user program is rejected. To change the ratio during operation, command a virtual master axis and couple the real axis with MC_GearIn, whose ratio is a runtime parameter; the fallback is WRIT_DBL plus a technology object restart, which costs memory-card life.

    Servo and stepper motion

  • How-to

    Configuring a PLC pulse-output servo axis before PLS2 moves

    The drives are not plug and play: keep command scaling in one place, the drive's gearing or the PLC program, and stay under the 100 kHz pulse ceiling, which at 10,000 pulses per revolution caps the motor at 600 rpm. Prove direction, limits and homing first, then tune for the load.

    Servo and stepper motion

  • How-to

    Setting Up Servo Electronic Gearing With Registration Correction

    Gear the folder servo to the web encoder with one fixed electronic gear ratio and apply registration error as a bounded phase trim ramped across the 100 to 200 ms between corrections. At 150 m/min a 0.1 mm tolerance is 40 microseconds of web travel — about eight 0.0127 mm increments — so doubling or halving a pulse train for six pulses trips following error, while a ramped trim changes speed by 0.04 percent.

    Servo and stepper motion