SetPosition

SetPosition 1:

Core function is not supported by inverter axes

This core function is not supported by inverter axes. Any use will report DEVICE_NOTINIT and trigger an error message.

SetPosition 2:

This Corefunction is used to change the actual position without physically moving the axis. It updates the offset of the position encoder function.

Syntax:

FUNCTION_BLOCK FB_SetPosition EXTENDS FB_CorefunctionFeedback

SetPosition 3: Properties

Name

Type

Access

Description

InitState

BOOL

Get, Set

The core function is not completely and successfully initialized.

FB_SetPosition

Mode

BOOL

Get, Set

Mode = TRUE causes the actual position to be changed by an amount specified as Target.

Mode = FALSE causes the actual position to be set to the value specified as the target.
This property can also be set using the SetParameter() method.

Target

LREAL

Get, Set

The new position value is set here.
This property can also be set using the SetParameter() method.

FB_CorefunctionFeedback

AbortedState

BOOL

Get, Set

Signals the abort of a command by another Corefunction.

BusyState

BOOL

Get, Set

Signals the active execution of a command.

DoneState

BOOL

Get, Set

Signals the successful execution of a command.

IdleState

BOOL

Get, Set

The Corefunction is ready for operation and commandable.

IsCommanded

BOOL

Get

Signals the pending of a command.

FB_Corefunction

FailedState

BOOL

Get, Set

If IsActivated is TRUE at the same time: Signals the failure of an accepted command.

If IsActivated is FALSE at the same time: Signals the rejection of a command.

HasFeedback

BOOL

Get

The core function has responded to a pending command.

IsActivated

BOOL

Get

The core function has an accepted command pending.

IsLocalCmd

BOOL

Get

Signals that the axis is assigned with a command of this core function.

ReadyState

BOOL

Get, Set

The Corefunction is ready for operation, but is not commandable at this time.

Possible reasons are:
- The axis is not enabled.
- Another Corefunction is active.
- The Corefunction does not support any commands.

SetPosition 4: Methods

Name

Description

[INTERN] Cyclic()

This method is called cyclically by the axis.

FB_SetPosition

DoSetPosition()

A rising edge at the input bExecute triggers the setting of the position.

SetParameter()

Here the new position and the operation mode of the Corefunction are defined.

SetPosition 5: Interfaces

Type

Description

I_Corefunction

Standard interface on FB_Corefunction.

I_SetPosition

Standard interface on FB_SetPosition.

I_CorefunctionFeedback

Standard interface on FB_CorefunctionFeedback.

Example:

IF bSetPosition THEN
    
    iAxisBase.SetPosition.Mode := TRUE;           // TRUE => Add relative
    iAxisBase.SetPosition.Target := 12.34;        // [mm]
    iAxisBase.SetPosition.DoSetPosition(TRUE);
    
// revert command
ELSIF iAxisBase.SetPosition.IsCommanded THEN
        
    iAxisBase.SetPosition.DoSetPosition(FALSE);

END_IF

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4024.35

PC or CX (x64, x86)

Tc3_PlasticFunctions v3.12.4.26 or higher