MC_MoveModulo

MC_MoveModulo 1:

The function block MC_MoveModulo carries out a positioning referenced to the modulo position of an axis. The basis for a modulo rotation is the adjustable axis parameter modulo factor (e.g. 360°). A distinction is made between three possible start types, depending on the Direction input.

MC_MoveModulo 2:

Motion commands can be applied to coupled slave axes, if this option was explicitly activated in the axis parameters. A motion command such as MC_MoveModulo then automatically leads to decoupling of the axis, after which the command is executed. In this case the only available buffer mode is Aborting.

Starting an axis from standstill

If an axis is started from standstill with MC_MoveModulo , it is possible to specify positions greater than or equal to 360°, in order to perform additional full turns. The same applies to a start with the BufferModeMC_Buffered.

Starting an axis during motion

If an axis is already in motion, certain special considerations apply. The direction of movement cannot be reversed by MC_MoveModulo, i.e. the target can only be reached in the current direction. The user is not able to specify the number of additional turns. The system automatically calculates how the axis can be moved to the target position on the shortest possible path.

The error output must be analyzed, because under certain conditions an oriented stop is not possible. For example, a standard stop may have been triggered just before, or an oriented stop would cause an active software limit switch to be exceeded. For all fault conditions, the axis is stopped safely, but it may subsequently not be at the required oriented position.

Special cases

Special attention must be paid to the behavior when one or more complete modulo rotations are requested. If the axis is located at an exact set position, such as 90 degrees, and if positioning to 90 degrees is required, no movement is carried out. If required to turn 450 degrees in a positive direction, it will perform just one rotation. The behavior can be different following an axis reset, because the reset will cause the current actual position to be adopted as the set position. The axis will then no longer be exactly at 90 degrees, but will be a little under or over. These cases will give rise either to a minimum positioning to 90 degrees, or on the other hand a complete rotation. For further details please refer to the Commentary section.

Depending on the particular case, it may be more effective for complete modulo rotations to calculate the desired target position on the basis of the current absolute position, and then to position using the function block MC_MoveAbsolute.

MC_MoveModulo 3:

Modulo positioning and absolute positioning are available for all axes, irrespective of the Modulo setting in the TwinCAT System Manager. For each axis, the current absolute position SetPos can be read from the cyclic axis interface data type NCTOPLC_AXIS_REF.

Important: Further information on modulo movements

Inputs


VAR_INPUT
Execute : BOOL;
Position : LREAL;
Velocity : LREAL;
Acceleration : LREAL;
Deceleration : LREAL;
Jerk : LREAL;
Direction : MC_Direction;
BufferMode : MC_BufferMode;
Options : ST_MoveOptions;
END_VAR

MC_BufferMode MC_Direction

Execute

The command is executed with a rising edge at Execute input.

Position

Modulo target position to be used for positioning.
If the axis is started from standstill, positions greater than 360° result in additional turns. Negative positions are not permitted.

Velocity

Maximum travel velocity (>0).

Acceleration

Acceleration (≥0). If the value is 0, the standard acceleration from the axis configuration in the System Manager is used.

Deceleration

Deceleration (≥0). If the value is 0, the standard deceleration from the axis configuration in the System Manager is used.

Jerk

Jerk (≥0). If the value is 0, the standard jerk from the axis configuration in the System Manager is used.

Direction

Positive or negative direction of travel of type MC_Direction.
If the axis is started during a motion, the direction may not be reversed.

BufferMode

The BufferMode is analyzed, if the axis is already executing another command. The running command can be aborted, or the new command becomes active after the running command. The transition condition from the current to the next command is also defined by the BufferMode.
To use the BufferMode, a second function block is always necessary. It is not possible to trigger a move function block with new parameters while it is active.

Options

The data structure Options includes additional, rarely required parameters. The input can normally remain open.

General rules for MC function blocks

Outputs


VAR_OUTPUT
Done : BOOL;
Busy : BOOL;
Active : BOOL;
CommandAborted : BOOL;
Error : BOOL;
ErrorID : UDINT;
END_VAR

Done

The Done output becomes TRUE once the target position was reached.

Busy

The Busy output becomes TRUE when the command is started with Execute and remains TRUE as long as the movement command is processed. If Busy becomes FALSE again, the function block is ready for a new order. At the same time one of the outputs, Done, CommandAborted or Error, is set.

Active

Active indicates that the command is executed. If the command was buffered, it becomes active once a running command is completed.

CommandAborted

Becomes TRUE, if the command could not be fully executed. The axis may have been stopped, or the running command may have been followed by a further Move command.

Error

Becomes TRUE if an error occurs.

ErrorID

If the error output is set, this parameter supplies the error number.

General rules for MC function blocks

Inputs/outputs


VAR_IN_OUT
Axis : AXIS_REF;
END_VAR

AXIS_REF

Axis

Axis data structure

The axis data structure of type AXIS_REF addresses an axis unambiguously within the system. Among other parameters it contains the current axis status, including position, velocity or error state.