Skip to content

PLCopen Motion

Commercial

Included in the public demo Compare editions

Use MC function blocks to command simulated single axes, straight Cartesian paths and robots. 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, with the limits described below. A group of kind Robot couples the motion task to a RobotIK and commands its joints from the TCP pose (see Robots).

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
Kindenum Cartesian / RobotCartesian
KinematicsComponentReference to a RobotIK (Robot only)empty
JointVelocitynumber, deg/s (Robot only)120
JointAccelerationnumber, deg/s² (Robot only)600
JointJerknumber, deg/s³ (Robot only)6000
AngularVelocitynumber, deg/s (Robot only)180
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 Z (Cartesian), J1..Jn (Robot)empty; required
SetpointPLCOutputFloat signal slot, in the axis unitunbound; required
FeedbackPLCInputFloat signal slot, in the axis unitunbound; optional
Min / Maxnumber, logical mm-1000000 / 1000000
Offsetnumber, mm0
Signenum 1 / -11
Variablestring, optional AXIS_REF handle of this axisempty
Unitenum mm / degmm

Min and Max must be finite with Min < Max. Cartesian axes use Unit = mm, robot axes Unit = deg; a wrong unit is reported and blocks the deploy. For a Robot group Min, Max and Offset are hidden and not used: the drive limits of the RobotIK apply. 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. The newer fields (Kind, Kinematics, the joint dynamics, MotionAxis Variable and Unit) are taken over at deploy: a change shows “Takes effect on the next PLC deploy” and never affects a move that is running.

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
Group (Cartesian or Robot)Purpose
MC_AddAxisToGroupAdd an axis handle to the group before enabling it
MC_GroupEnable / MC_GroupDisableEnable coordination / immediately cancel and hold
MC_GroupResetClear a resolved fault at standstill
MC_MoveLinearAbsoluteStraight move to Position (array) or PositionX/Y/Z (Cartesian only); optional transition to the previous move
MC_MoveDirectAbsolutePoint-to-point move to Position; all axes arrive together; optional transition to the previous move
MC_GroupHaltControlled stop that locks nothing and can be replaced by the next move
MC_GroupStopControlled stop with held-Execute interlock
MC_GroupReadActualPosition / MC_GroupReadPositionEnable → Valid/Busy/Position[0..5] and 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.

Positions and enums. Position is an ARRAY[0..5] OF LREAL, set element by element (move.Position[2] := 400.0;). A MC_MoveLinearAbsolute instance uses either Position or PositionX/Y/Z, never both. CoordSystem takes MC_COORD_SYSTEM.ACS (0) or MC_COORD_SYSTEM.MCS (1, default); BufferMode takes the bare constants mcAborting/mcBuffered or the qualified enum MC_BUFFER_MODE. MC_MoveDirectAbsolute takes Velocity, Acceleration, Deceleration and Jerk in percent of the group’s nominal dynamics (0 means 100 %).

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.

Set the group Kind to Robot, assign the robot’s RobotIK to Kinematics and add one MotionAxis per joint named J1 to Jn (the index in the RobotIK axis list) with Unit deg. Bind each Setpoint to the signal that the joint’s drive follows. The group then commands the robot from poses instead of single coordinates.

From a TCP pose to the robot's joints An MC block in the PLC program passes a tool pose to the MotionGroup of kind Robot. The group solves the inverse kinematics of the referenced RobotIK every simulation step and writes one joint set-point signal in degrees per MotionAxis J1 to Jn. The drive behaviour of each joint follows its set-point signal and moves the robot. From a TCP pose to the robot's joints PLC program MC_MoveDirectAbsolute MC_MoveLinearAbsolute Position[0..5], mm and deg MotionGroup · Robot Kinematics → RobotIK inverse kinematics each step nearest solution MotionAxis J1..Jn Setpoint signals in degrees Drive_Follow Position moves the joint The group only observes the robot's axes: a running IKPath or another owner gives ErrorID 16#8005.
The group solves the kinematics and writes joint set-points as signals; the joint drives follow them like any other set-point.
PROGRAM Pick
VAR
arm : AXES_GROUP_REF;
enable : MC_GroupEnable;
toPick : MC_MoveDirectAbsolute;
lift : MC_MoveLinearAbsolute;
END_VAR
VAR_EXTERNAL Start : BOOL; END_VAR
toPick.Position[0] := 300.0; toPick.Position[1] := -250.0; toPick.Position[2] := 400.0;
toPick.Position[3] := 180.0; toPick.Position[4] := 0.0; toPick.Position[5] := 90.0;
lift.Position[0] := 300.0; lift.Position[1] := -250.0; lift.Position[2] := 500.0;
lift.Position[3] := 180.0; lift.Position[4] := 0.0; lift.Position[5] := 90.0;
enable(AxesGroup := arm, Execute := TRUE);
toPick(AxesGroup := arm, Execute := enable.Done AND Start, CoordSystem := MC_COORD_SYSTEM.MCS);
lift(AxesGroup := arm, Execute := toPick.Done);
END_PROGRAM

With CoordSystem = MCS (the default), Position[0..2] is the local X, Y, Z position in millimetres and Position[3..5] the local rotation as Euler angles X, Y, Z in degrees (order XYZ) of a node that hangs directly below the RobotIK node and sits on the tool point. These are exactly the numbers the Inspector shows for such a node (the Inspector shows metres; multiply by 1000). Moving, turning or uniformly scaling the robot base does not change them. To read the pose of a mark elsewhere in the scene, use MC_GroupReadPosition or the read-only line Pose in robot frame on the RobotIK.

CoordSystem = ACS takes the joint values J1 to Jn in degrees. MC_MoveDirectAbsolute moves point to point in either system; MC_MoveLinearAbsolute on a Robot group needs the array form, and with ACS the joint target is converted to a pose and approached on a straight line. MC_GroupHalt brakes along the path without locking, MC_GroupStop locks until Execute falls.

  • The solution nearest to the current joint position is always used; there is no configuration or turn data.
  • Only rotary axes; a chain with a linear axis is refused with a diagnostic.
  • OrientationMode supports only mcLinear (0): the orientation turns the shortest way, evenly along the line.
  • A linear move is checked when it becomes active: samples at most 10 mm and 2° apart, at most 2000 (20 m). An unsolvable sample ends the command with 16#800F before anything moves. At run time a joint jump of more than 30° per step stops the group with 16#800F; recover with MC_GroupReset.
  • The tool rotation is limited by AngularVelocity; point-to-point moves use JointVelocity, JointAcceleration and JointJerk as 100 %.
  • A linear move limits the tool dynamics (Velocity, Acceleration, Jerk, AngularVelocity), not the joint dynamics. Close to a singularity (for example a nearly stretched wrist) the joints can exceed JointVelocity, JointAcceleration and JointJerk even at a low tool speed. Keep linear moves away from singular poses or lower the tool speed there; use a point-to-point move to pass through.
  • Blending between moves works as described under Blending between moves. Only ACS and MCS; the robot IK solver must be loaded (otherwise MC_GroupEnable answers 16#800D).

By default a move ends at standstill before the next one starts. MC_MoveLinearAbsolute and MC_MoveDirectAbsolute can instead pass a corner without stopping: the group leaves the first move shortly before its end, follows a smooth curve and joins the second move. realvirtual WEB runs locally, so the curve is planned on your machine with no cloud service and your data stays with you.

A corner with and without a transition A move runs along a straight line to the programmed corner C and continues on a second line at an angle. Without a transition the group stops at C. With a transition the group leaves the first line at point A, a distance d before C, follows a smooth curve and joins the second line at point B, the same distance d after C, without stopping. A corner with and without a transition stops at C (no transition) passes the corner (transition) predecessor successor A curve starts B curve ends d C: programmed corner, end of the predecessor d = TransitionParameter[0], the same distance on both lines. The speed in the curve follows TransitionVelocity.
The group leaves the first line at A, follows a smooth curve and joins the second line at B, the distance d on either side of the corner C.

The three inputs belong to the second move (the successor) and describe the transition from the first move into it:

InputValuesMeaning
TransitionVelocityMC_TRANSITION_VELOCITY: mcTVZero 0, mcTVLow 1, mcTVPrevious 2, mcTVNext 3, mcTVHigh 4Speed in the curve. mcTVZero (default) stops at the corner as before. 1 uses the lower of the two move velocities, 2 that of the first move, 3 that of the second, 4 the higher one
TransitionModeMC_TRANSITION_MODE: mcTMNone 0 (default) or mcTMCornerDistance 3Only these two modes execute; mcTMStartVelocity, mcTMConstantVelocity and mcTMMaxCornerDeviation give 16#8004
TransitionParameterARRAY[0..3] OF LREAL[0] is the corner distance d: millimetres on a linear move, degrees of the leading joint on a point-to-point move, millimetres on the linear move of a mixed pair. [1..3] are reserved and must be 0

A transition needs BufferMode = mcBuffered, TransitionVelocity other than 0, TransitionMode = mcTMCornerDistance and a successor that is commanded while the first move is still running. With mcAborting, or with the inputs at their defaults, the first move brakes as before. The reference point is fixed to the start of the second move. A value of 0 or less for d, a TransitionVelocity outside 0 to 4 or a nonzero TransitionParameter[1..3] returns 16#8004.

PROGRAM Corner
VAR
arm : AXES_GROUP_REF;
enable : MC_GroupEnable;
first, second : MC_MoveLinearAbsolute;
corner : ARRAY[0..3] OF LREAL;
END_VAR
VAR_EXTERNAL Start : BOOL; END_VAR
first.Position[0] := 300.0; first.Position[1] := -250.0; first.Position[2] := 400.0;
first.Position[3] := 180.0; first.Position[4] := 0.0; first.Position[5] := 90.0;
second.Position[0] := 500.0; second.Position[1] := -250.0; second.Position[2] := 400.0;
second.Position[3] := 180.0; second.Position[4] := 0.0; second.Position[5] := 90.0;
corner[0] := 40.0;
enable(AxesGroup := arm, Execute := TRUE);
first(AxesGroup := arm, Execute := enable.Done AND Start);
second(AxesGroup := arm, Execute := enable.Done AND Start,
BufferMode := MC_BUFFER_MODE.mcBuffered,
TransitionVelocity := MC_TRANSITION_VELOCITY.mcTVLow,
TransitionMode := MC_TRANSITION_MODE.mcTMCornerDistance,
TransitionParameter := corner);
END_PROGRAM
  • Linear to linear, point-to-point to point-to-point and mixed pairs, on robot groups and on Cartesian groups.
  • The corner distance is limited to half the length of the shorter of the two moves. The Problems panel then shows the info motion-blend-distance-capped.
  • The speed in the curve is never higher than the limits allow: the joint limits along the curve, AngularVelocity and the speed from which the second move can still stop at its end.
  • Stop, Halt, an Aborting command or a fault inside the curve brake along the path.

No transition arises, and the group stops at the corner exactly as without blending, when

  • the second move is commanded too late, for example in the scan in which the first move already reaches the corner,
  • the curve cannot be driven within the limits,
  • the check of the second move uses up its budget or the second move is unreachable,
  • the group is already braking, or the pair has no curve (a pure rotation, a move of length zero),
  • a move is longer than 20 m (2000 samples).

The Problems panel then shows the info motion-blend-rejected with the reason, once per program run. Both hints are reported at the end of the scan. The second move is checked over its stopping distance when it is accepted and step by step ahead of the motion. If that check fails before the curve starts, the transition is dropped and the second move ends with 16#800F when it starts; once the curve has started, the group stops with 16#800F and brakes inside the checked part.

  • A linear move limits the tool dynamics, not the joint dynamics (see Limits of robot motion). At a transition the joint limits hold in the sense “not worse than without a transition”; close to a singularity the joint jerk can lie slightly above its limit.
  • Only mcTMCornerDistance exists. The obsolete mcBlendingLow to mcBlendingHigh buffer modes stay rejected with 16#8007; use TransitionVelocity instead.

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
16#800BAxis of another group added
16#800CAxis added twice, or group enabled before all axes were added and powered
16#800DRobot kinematics unavailable (reference missing, solver not loaded, no solver budget)
16#800EPoint-to-point target unreachable
16#800FLinear path not solvable or jump guard hit
16#8010Coordinate system not supported

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, single-axis speed control and robots with rotary axes. Only ACS and MCS exist as coordinate systems; homing and synchronisation are absent, and moves are blended only with the corner distance transition. 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 in both simulation kinds. In DES the moves advance on a fixed motion cycle, and the program scans only when something it reads changes.

Continuous simulationDES (event-driven)
MC_ blocksRun; the motion task advances the profile every simulation stepRun; a fixed motion cycle (the Cycle Time of the DES manager) advances the profile while a move is running
When a command startsIn the same simulation step, right after the scan that issued itAt the following motion cycle point, up to one cycle later
When the program scansEvery stepWhen a command’s status or InVelocity changes, and on its other triggers (signal change, timer, own change). A program that reads a position with MC_ReadActualPosition or MC_GroupReadActualPosition also scans when that axis moves
Idle modelScans every stepNo motion cycle events while no move is running
DES checkNot applicableMC_ blocks cause no finding. D5 remains only for a motion program started without the DES motion cycle
SnapshotsNot applicableA move that is running when you save continues identically after the restore
End position and timingReferenceThe same profile, started on the motion cycle grid. Do not expect the same timestamps as in continuous simulation

A snapshot is refused, with the reason shown before it is saved, in two short situations: a move was started before the DES run began (let it finish), or a motion task is still braking after its program or group was removed (try again after about a second).

Robot groups run in DES as well: MC_MoveDirectAbsolute and linear moves use the same motion cycle, and a snapshot taken during a robot move continues identically after the restore. The IK solver must be loaded when you restore.

With a limited number of live IK solves, a model that contains both a PLC-controlled robot group and an IK path cannot be saved as a snapshot. The snapshot menu shows the reason before saving, and loading such a snapshot is refused without changing the running simulation. With an unlimited solver budget, or with only PLC robot groups or only IK paths in the model, snapshots work.