MC_MoveBlendingPreparation

MC_MoveBlendingPreparation 1:

The MC_MoveBlendingPreparation function block adds a blending transition between two movements to the path segment table (PathData structure).

TF5410
TwinCAT 3 Motion Collision Avoidance

TF5420
TwinCAT 3 Motion Pick-and-Place

 

MC Group with Pick-and-Place

MC Group Coordinated Motion

MC_MoveBlendingPreparation 2:

MC_MoveBlendingPreparation 3:

MC_MoveBlendingPreparation 4:

MC_MoveBlendingPreparation 5: Inputs

VAR_INPUT
    Velocity                 : MC_LREAL := MC_INVALID;
    Acceleration             : MC_LREAL := MC_DEFAULT;
    Deceleration             : MC_LREAL := MC_DEFAULT;
    Jerk                     : MC_LREAL := MC_DEFAULT;
    BufferMode               : MC_BUFFER_MODE := mcAborting;
    TransitionMode           : MC_TRANSITION_MODE := mcTransModeNone;
    TransitionParameter      : POINTER TO LREAL;
    TransitionParameterCount : UDINT;
    InvokeId                 : UDINT;
    DynamicConstraints       : REFERENCE TO IPlcDynamicConstraint := 0;
END_VAR

Name

Type

Description

Velocity

MC_LREAL

The maximum velocity for the programmed segment. The velocity does not always have to be reached. The velocity must be set >0.

Acceleration

MC_LREAL

Maximum path acceleration for the programmed segment.
Special input values can be used:

  • MC_DEFAULT executes the command with default axis values.
  • MC_MAXIMUM executes the command with the maximum axis values. The acceleration must be set ≥1.

Deceleration

MC_LREAL

Maximum path deceleration for the programmed segment.
Special input values can be used:

  • MC_DEFAULT executes the command with default axis values.
  • MC_MAXIMUM executes the command with the maximum axis values. The deceleration must be set ≥1.

Jerk

MC_LREAL

Path jerk for the programmed segment.
Special input values can be used:

  • MC_DEFAULT executes the command with default axis values. The jerk must be set ≥100.
  • MC_MAXIMUM = 100 * MC_DEFAULT

BufferMode

MC_BUFFER_MODE

Defines how successive motion commands are to be processed.

Transition Mode

MC_TRANSITION_MODE

Defines the blending mode.

TransitionParameter

POINTER TO LREAL

Pointer to array [1..TransitionParameterCount] of blending parameters. Transition parameters define the blending from the last programmed position.

TransitionParameterCount

UDINT

Number of blending parameters.

InvokeId

UDINT

Segment ID for analysis purposes.

DynamicConstraints

REFERENCE TO IPlcDynamicConstraint

Optional input to further restrict the permitted values for speed, acceleration, deceleration, or jerk during movement.

Notice Reference assignment:

<InstanceOfMC_MoveLinearAbsolutePreparation>.DynamicConstraints REF= <InstanceOfIPlcDynamicConstraint>;

MC_MoveBlendingPreparation 6: / MC_MoveBlendingPreparation 7: Inputs/Outputs

VAR_IN_OUT
    PathData                 : MC_PATH_DATA_REF;
END_VAR

Name

Type

Description

PathData

MC_PATH_DATA_REF

Table containing the segments of a path. The table is written by MC_Move…Preparation and executed by MC_MovePath (see MC_PATH_DATA_REF).

MC_MoveBlendingPreparation 8: Outputs

VAR_OUTPUT
    Error                    : BOOL;
    ErrorId                  : UDINT;
END_VAR

Name

Type

Description

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. Details of the error code can be found in the ADS error documentation or in the NC error documentation (error codes 0x4nnn and 0x8nnn).

Example

This example shows two variants of the blending definition between two linear movements:

First blending (N10)

The blending segment has the InvokeId of the first linear movement (N10). The transition parameters that define the blending of the subsequent linear movement (N20) are used.

Second blending (N25, MC_MoveBlendingPreparation)

Blending is defined via MC_MoveBlendingPreparation. The transition parameters of the MC_MoveBlendingPreparation function block are used accordingly and the blending segment has its own InvokeId.

MC_MoveBlendingPreparation 9:
VAR
    buffer             : ARRAY[1..4096] OF BYTE;
    path               : MC_PATH_DATA_REF(ADR(buffer), SIZEOF(buffer));

    aTargetPos         : ARRAY[1..4] OF MC_LREAL;
    aTransitionParam   : ARRAY[1..2] OF MC_LREAL;

    fbMovePath         : MC_MovePath;
    fbMoveLinePrep     : MC_MoveLinearAbsolutePreparation;
    fbMoveBlendingPrep : MC_MoveBlendingPreparation;
END_VAR
path.ClearPath();

fbMoveLinePrep.Position                 := ADR(aTargetPos); //pointer to position array
fbMoveLinePrep.PositionCount            := 4; //number of axes in group
fbMoveLinePrep.TransitionParameterCount := 2;
fbMoveLinePrep.BufferMode               := mcBuffered;
fbMoveLinePrep.TransitionMode           := mcTransModeNone;
fbMoveLinePrep.TransitionParameter      := ADR(aTransitionParam);

fbMoveLinePrep.Acceleration            := MC_DEFAULT;
fbMoveLinePerep.Deceleration           := MC_DEFAULT;
fbMoveLinePrep.Jerk                    := MC_DEFAULT;

fbMoveBlendingPrep.Velocity            := fVelo;
fbMoveBlendingPrep.Acceleration        := MC_DEFAULT;
fbMoveBlendingPrep.Deceleration        := MC_DEFAULT;
fbMoveBlendingPrep.Jerk                := MC_DEFAULT;
fbMoveBlendingPrep.BufferMode          := mcBlendingPrevious;
fbMoveBlendingPrep.TransitionMode      := mcTransModeCornerDistanceAdvanced;
fbMoveBlendingPrep.TransitionParameter := ADR(aTransitionParam);
fbMoveBlendingPrep.TransitionParameterCount := 2;

aTargetPos[1] := 0;
aTargetPos[2] := 100;
aTransitionParam[1] := 0;
aTransitionParam[2] := 0;
fbMoveLinePrep(PathData := path, InvokeId := 10);

aTargetPos[1] := 200;
aTargetPos[2] := 100;
aTransitionParam[1] := 15;
aTransitionParam[2] := 25;
fbMoveLinePrep(PathData := path, InvokeId := 20);

aTransitionParam[1] := 25;
aTransitionParam[2] := 15;
fbMoveBlendingPrep(PathData := path, InvokeId := 25);

aTargetPos[1] := 200;
aTargetPos[2] := 0;
aTransitionParam[1] := 0;
aTransitionParam[2] := 0;
fbMoveLinePrep(PathData := path, InvokeId := 30);

fbMovePath(AxesGroup := stGroupRef, PathData := path, Execute := TRUE);

Requirements

Development environment

Target platform

PLC libraries
to include

TF5400 Advanced Motion Pack V3.4.45

PC or CX (x64)

Tc3_McCoordinatedMotion, Tc2_MC2