MC_TransformPosition

MC_TransformPosition 1:

MC_TransformPosition 2: Inputs

VAR_INPUT
    Execute             : BOOL;
    OriginOid           : OTCID;
    DestinationOid      : OTCID;
    OriginPosition      : MC_LREAL;
END_VAR

Name

Type

Description

Execute

BOOL

This function block outputs the target position when a rising edge is triggered at input Execute.

OriginOid

OTCID

This input refers to the origin mover template object as a coordinate system reference.

DestinationOid

OTCID

This input refers to the target mover template object as a coordinate system reference.

OriginPosition

MC_LREAL

Position value in the frame of the coordinate system to which the origin mover template object refers.

MC_TransformPosition 3: Outputs

VAR_OUTPUT
    Done                : BOOL;
    Busy                : BOOL;
    Error               : BOOL;
    ErrorId             : UDINT;
    DestinationPosition : MC_LREAL;
END_VAR

Name

Type

Description

Done

BOOL

This output becomes TRUE if the command was executed and the execution was successful.

Busy

BOOL

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

Error

BOOL

This output becomes TRUE if an error has occurred during command execution.

ErrorId

UDINT

Contains the command-specific error code of the last executed command.

DestinationPosition

MC_LREAL

Position value within the coordinate system to which the destination mover template object refers.

Sample

VAR
    fbAbsoluteToTcp        : MC_TransformPosition;
    fbTcpToAbsolute        : MC_TransformPosition;
    inputPositionAbsolute  : LREAL;
    inputPositionTcp       : LREAL;
    outputPositionTcp      : LREAL;
    outputPositionAbsolute : LREAL;
    oidMoverTemplate       : OTCID;
END_VAR
fbAbsoluteToTcp(
    Execute                := TRUE,
    OriginOid              := 0, //absolute
    DestinationOid         := oidMoverTemplate,
    OriginPosition         := inputPositionAbsolute,
    DestinationPosition    => outputPositionTcp
);

fbTcpToAbsolute(
    Execute                := TRUE,
    OriginOid              := oidMoverTemplate,
    DestinationOid         := 0, //absolute
    OriginPosition         := inputPositionTcp,
    DestinationPosition    => outputPositionAbsolute
);

Requirements

Development environment

Target platform

PLC libraries
to include

TwinCAT V3.1.4022.25

TF5400 Advanced Motion Pack V3.1.6.07

PC or CX (x64)

Tc3_McCollisionAvoidance,
Tc3_McCoordinatedMotion, Tc2_MC2