Skip to content

PLCopen Motion

Commercial

Included in the public demo Compare editions

Use MC function blocks to command simulated single axes and straight Cartesian paths. MotionGroup and its child MotionAxis components configure the PLC’s motion task. The task writes position signals; drive behaviours such as Drive_FollowPosition consume those signals. It never directly moves a Drive.

The implemented subset follows PLCopen Motion Control Part 1 v2.0 and Part 4 v1.0, with the limits described below.

From MC function block to moving drive An MC function block in the PLC program commands the motion task of a MotionGroup through its handle variable. The motion task calculates an S-curve profile from velocity, acceleration, deceleration and jerk and writes one position set-point signal in millimetres per MotionAxis X, Y and Z. A drive behaviour such as Drive_FollowPosition reads the set-point and moves the drive. An optional feedback signal per axis returns the actual position to readers such as MC_GroupReadActualPosition. From MC function block to moving drive PLC program MC_GroupEnable MC_MoveLinearAbsolute handle variable motion Motion task MotionGroup Program + Variable S-curve profile from V · A · D · Jerk Axis X · Setpoint mm Axis Y · Setpoint mm Axis Z · Setpoint mm Drive_FollowPosition reads the set-point Drive moves the model Feedback signal per axis (optional, mm) → MC_GroupReadActualPosition without feedback, readers use the simulated set-position
The PLC never moves a drive directly: the motion task writes position set-point signals, and the drive's own behaviour follows them. Live or forced set-points are never overwritten.
MotionGroup propertyType / unitDefault
KindenumCartesian
ProgramComponentReference to owning PLCProgramunbound; required
Variablestring, program handle variable nameempty; required
Velocitynumber, mm/s500
Accelerationnumber, mm/s²5000
Decelerationnumber, mm/s²5000
Jerknumber, mm/s³100000

Profile defaults must be finite and strictly positive. Add MotionAxis components to child nodes; nested groups own their own descendants.

MotionAxis propertyType / unitDefault
Namestring; unique X, Y or Zempty; required
SetpointPLCOutputFloat signal slot, mmunbound; required
FeedbackPLCInputFloat signal slot, mmunbound; optional
Min / Maxnumber, logical mm-1000000 / 1000000
Offsetnumber, mm0
Signenum 1 / -11

Min and Max must be finite with Min < Max. The signal value is Offset + Sign × logical position; feedback uses the inverse. Without Feedback, readers use the simulated set-position. A configured invalid feedback produces an error.

The inspector uses the standard reference picker, signal slot rows, selects and number/string editors. Runtime position and command state are read-only. Redeploy after changing motion configuration.

A MotionGroup selected in the editor: the inspector shows Kind, Variable, the profile defaults with their units and the owning Program, and the hierarchy lists its three MotionAxis child nodes

  1. Add a PLCProgram and a MotionGroup.
  2. Add one to three child MotionAxis nodes, configure coordinate names and bounds, and bind each Setpoint to a PLCOutputFloat position signal.
  3. Configure each drive’s position-following behaviour to consume the matching signal.
  4. Enter the program below. Set MotionGroup.Program to that PLCProgram and Variable to motion.
  5. Deploy, then Run in continuous simulation. Raise Start after enablement.
PROGRAM Positioning
VAR
motion : AXES_GROUP_REF;
enable : MC_GroupEnable;
move : MC_MoveLinearAbsolute;
END_VAR
VAR_EXTERNAL Start : BOOL; END_VAR
enable(AxesGroup := motion, Execute := TRUE);
move(AxesGroup := motion, Execute := enable.Done AND Start,
PositionX := 100.0, PositionY := 50.0, PositionZ := 0.0);
END_PROGRAM

Zero profile inputs select group defaults. Hold Start through completion, then release and raise it for another move. Use AXIS_REF and Axis for a group containing exactly one MotionAxis. Handles belong only in PROGRAM VAR, are required on every MC call and cannot be assigned, calculated or passed through user POUs.

To check the profile on a running machine, open Axis forces for the mechanism and switch to Motor torque. Jerk-limited moves show smooth, repeating peaks without spikes:

The Axis forces window for a delta robot driven by MC_MoveLinearAbsolute: motor torque of the three rail joints over 10 s, smooth repeating peaks of about 0.2 N·m and their peak and RMS figures

Single axisPurpose
MC_PowerLevel-sensitive logical enable; Status/Valid
MC_ResetClear a resolved fault at standstill
MC_ReadActualPositionEnable → Valid/Busy/Position
MC_MoveAbsoluteAbsolute Position
MC_MoveRelativeSigned Distance from position at activation
MC_MoveVelocityContinuous Velocity; InVelocity when speed is reached
MC_HaltInterruptible controlled stop
MC_StopControlled stop with held-Execute interlock
Cartesian groupPurpose
MC_GroupEnable / MC_GroupDisableEnable coordination / immediately cancel and hold
MC_GroupResetClear a resolved fault at standstill
MC_MoveLinearAbsoluteStraight move to PositionX/Y/Z
MC_GroupStopControlled stop with held-Execute interlock
MC_GroupReadActualPositionEnable → Valid/Busy/PositionX/Y/Z

Execute commands trigger on a rising edge; falling Execute does not cancel the motion. Call instances cyclically to observe completion. Positional moves expose Done, Busy, Active, CommandAborted, Error and ErrorID. Stop has no Active port; MoveVelocity has InVelocity instead of Done. Readers use Enable, Valid and Busy, plus Error/ErrorID.

Only the first call of one MC instance per scan evaluates inputs; later calls return cached values. Use separate instances for scan-order arbitration. Direction constants are mcPositiveDirection (1), mcShortestWay (2), mcNegativeDirection (3) and mcCurrentDirection (4). Absolute linear moves accept but ignore a valid Direction; MoveVelocity rejects shortest-way. Zero Velocity selects the default, not a stop.

Axis states are Disabled, Standby, DiscreteMotion, ContinuousMotion, Stopping and ErrorStop. Group states are GroupDisabled, GroupStandby, GroupMoving, GroupStopping and GroupErrorStop. Enable reaches standby; completed moves return to standby; faults require reset after the cause clears.

Axis states and the blocks that change them MC_Power moves an axis from Disabled to Standby. From Standby, MC_MoveAbsolute or MC_MoveRelative start DiscreteMotion, MC_MoveVelocity starts ContinuousMotion and MC_Stop leads to Stopping. A completed discrete move, or standstill after MC_Stop with Execute released, returns to Standby. A fault leads to ErrorStop from any state; MC_Reset returns to Standby once the cause is cleared. Power off returns to Disabled from any state. Groups follow the same pattern with the group states and group blocks. Axis states and the blocks that change them Disabled power off returns here from any state MC_Power Standby DiscreteMotion MC_MoveAbsolute/Relative ContinuousMotion MC_MoveVelocity Stopping MC_Stop Done, or standstill after MC_Stop with Execute = FALSE ErrorStop a fault leads here from any state MC_Reset Groups follow the same pattern: GroupDisabled, GroupStandby, GroupMoving, GroupStopping and GroupErrorStop, with MC_GroupEnable, MC_MoveLinearAbsolute, MC_GroupStop and MC_GroupReset.
Execute starts a command on its rising edge. MC_Stop holds the axis in Stopping until it is at standstill and Execute is released; MC_Halt stops under control but can be interrupted by the next move.

A group has exactly one owning PLCProgram occurrence. Many FB instances can share its handle, but one handle cannot bind two groups. Missing/duplicate bindings and competing program/group or group/group set-point writers refuse deployment with Problems entries.

Live controller values override local motion; the task writes nothing to live-bound or forced set-points. Authority loss suspends the group until authority returns and it is reset. Reconnect resynchronises without replaying commands. External operation/jog must enter the PLC as signals.

Runner Stop, scan error, COLD redeploy and group removal brake and hold under local authority. Simulation/PLC Reset is immediate, even while paused, and clears motion before the viewer resets drives. Power off/GroupDisable cancel immediately; use Stop first for a controlled stop.

ErrorIDMeaning
16#8001Invalid binding
16#8002Disabled
16#8003Axis bounds exceeded
16#8004Invalid parameters
16#8005Owner/writer conflict
16#8006Forced/external authority
16#8007Invalid BufferMode/Direction
16#8008State/interlock refusal
16#8009Invalid feedback
16#800AProfile provider failure

These are realvirtual-specific positive DINT values. Parameter errors reject that request without disturbing healthy motion. Kernel faults latch ErrorStop/GroupErrorStop.

Use this subset for Cartesian handling, positioning and single-axis speed control. PositionX/Y/Z replace PLCopen position arrays; orientation, robot kinematics, homing, synchronisation and coordinate-system selection are absent. Acceleration/deceleration share the conservative limit min(A,D). Every replacement brakes first, including a collinear move. Done reports profile completion, with no hardware settling monitor. An unavailable protected profile core uses a warned trapezoid fallback without a jerk guarantee.

PLCopen motion runs only in continuous simulation. A motion profile is integrated at a fixed step, and DES has no fixed step.

Continuous simulationDES (event-driven)
MC_ blocksRun; the motion task advances the profile every simulation tickNot supported
Program with MC_ blocksRuns normallyThe editor shows finding D5 and the badge not DES-ready. At its first DES scan the program goes into error
Suppress with (* @des: allow *)—Not possible for D5
Experiment batches—Refuse the model
SnapshotsNot possible for a program that declares MC_ blocks, even when it is stopped or the instance is never calledNot possible

Run models with motion programs in continuous simulation. For DES and experiments, use LogicSteps or ST programs without MC_ blocks.