5 / 16 · Machine programming

Positioning and continuous travel

Choose absolute, relative, additive or velocity commands for a machine requirement.

The station is fixed; the starting point is not

A drilling fixture has loading at 20 mm and drilling at 250 mm. After a manual jog, the carriage might be at 80 mm. A command for the drilling station should still finish at 250 mm. Use MC_MoveAbsolute with Position 250, because the machine requirement names a coordinate.

MC_MoveRelative describes a displacement from the applicable starting position. A 30 mm jog-style increment is a relative requirement. MC_MoveAdditive extends an existing commanded endpoint; it is useful when an application adds distance to a move already being commanded, subject to vendor support and timing restrictions. These commands have different reference bases.

Compare the reference points

Suppose actual position is 20 mm and the active command endpoint is 100 mm. An additive distance of 30 mm extends the endpoint to 130 mm. A relative move uses its documented starting-position reference when it is accepted or begins under that runtime's rules. It is not automatically an extension of the previous endpoint.

RequirementCommand familyCheck first
Reach fixture coordinate 250 mmMoveAbsoluteHome/reference validity and coordinate system
Advance another 30 mmMoveRelativeWhen starting position is captured
Extend commanded travel by 30 mmMoveAdditiveActive-command and buffering restrictions
Run a conveyor at 100 mm/sMoveVelocityDirection, acceleration and termination policy
Change displayed coordinate at a datumSetPositionPhysical validity of the datum

TryPLC executes MoveAbsolute, MoveRelative and MoveVelocity in its ST runtime. MoveAdditive is taught here as standard/vendor motion theory; the runtime rejects it instead of pretending to execute it.

Continuous motion needs an exit

MC_MoveVelocity accelerates toward a requested velocity. InVelocity commonly indicates that the requested velocity has been reached within the vendor's rules. Travel then continues. A feeder needs a defined next action: a positioning command, Halt, Stop or another permitted operation.

A conveyor that must deliver an exact distance may need position-based control or registration. Running for a fixed time at a nominal speed ignores acceleration and deceleration travel. At low speed the timing method may appear adequate, then fail when the production speed changes.

In TryPLC's runtime, MoveVelocity Direction is an INT: 1 for positive and 2 for negative. That is a simulator interface choice, not a portable PLCopen enum definition. Vendor code should use the enum and rules defined by its motion library.

Modulo coordinates

A rotary table can use a repeating coordinate such as 0 to 360 degrees. A destination of 10 degrees from 350 degrees needs a direction policy: positive travel, negative travel or shortest permitted path. A shortest path may cross tooling or cable constraints. Specify the physical travel permission independently of the numerical wrap.

A multi-turn axis and a modulo axis also differ in how an absolute coordinate relates to revolutions. Confirm the axis configuration before assuming that 720 degrees means the same physical endpoint as zero with a deliberate two-turn journey.

Bench investigation

Use the absolute-move bench to reach 200 mm. Release Execute, change the target to 50 mm and issue a new edge. Observe reversal and braking. The accepted input velocity is a magnitude; actual velocity becomes negative while the carriage travels left.

Next, issue a target equal to the present position. The command should complete without the large motion of a relative 200 mm increment. State the machine requirement in words before selecting a block.

Sequence exercise

Design a feeder with three positions: load 20 mm, inspect 120 mm and unload 250 mm. Each move must finish before the next station action starts. Include an aborted-move path and a timeout that records feedback rather than blindly issuing another target. Explain why each station uses absolute coordinates.

For a second machine, a strip feeder advances 30 mm after each punch cycle. Explain when relative travel is convenient and how registration correction would prevent accumulated product-placement error. The strip slipping on its rollers remains a mechanical or measurement problem even if the axis executes every increment correctly.

References

CODESYS single-axis motion overview compares movement reference bases and continuous-command families. PLCopen motion control is the standard reference.

Check your reasoning

A fixture must reach station coordinate 250 mm from any starting position. Choose:

  • MC_MoveRelative with 250
  • MC_SetPosition with 250
  • MC_MoveAbsolute
Worked answer

MC_MoveAbsolute. Absolute targets a coordinate; relative adds distance; SetPosition changes the coordinate representation.

A velocity command reaches InVelocity. Has travel ended?

  • Only if the encoder has zero offset
  • No
  • Yes, Done must be TRUE
Worked answer

No. A continuous velocity operation continues until another operation or stop interrupts it.