Tuning

Tuning 1:

Exclusive function for actuators

This core function is only available for actuators.

Tuning 2:

This core function is used to automatically optimize an actuator.

Syntax:

FUNCTION_BLOCK FB_ActuatorTuning EXTENDS FB_CorefunctionFeedback

Tuning 3: Properties

Name

Type

Access

Description

InitState

BOOL

Get, Set

The core function is not completely and successfully initialized.

FB_ActuatorTuning

TimeoutFactor

LREAL

Get, Set

Factor (multiplier) for determining the timeout of the movement time.

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.

Tuning 4: Methods

Name

Description

[INTERN] Cyclic()

This method is called cyclically by the axis.

FB_ActuatorTuning

DoAbort(bExecute)

Cancels the current procedure.

DoTuneTimeout(bExecute)

Starts a sequence of commands to the end positions of the actuator and measures the time of the movement.

Notice Make sure that the connected end positions can be reached mechanically.

Tuning 5: Interfaces

Type

Description

I_Corefunction

Standard interface on FB_Corefunction.

I_ActuatorTuning

Standard interface on FB_ActuatorTuning.

I_CorefunctionFeedback

Standard interface on FB_CorefunctionFeedback.

Example:

// Get specific interface I_ActuatorBase from general interface I_MotionBase
IF __QUERYINTERFACE(iMotionBase, iActuatorBase) THEN
    
    CASE nState OF
    0:  // Start the tuning
        iActuatorBase.Tuning.DoTuneTimeout(TRUE);
        
    1:  // observe or abort
        IF iActuatorBase.Tuning.FailedState THEN
            nState := -1;
        ELSIF iActuatorBase.Tuning.DoneState THEN
            nState := nState + 1;
        ELSIF bAbortTuning THEN
            iActuatorBase.Tuning.DoAbort(TRUE);
            nState := nState + 2;
        END_IF
    
    2,  // done
    3,  // aborted
    -1: // error
        iActuatorBase.Tuning.DoAbort(FALSE);
        iActuatorBase.Tuning.DoTuneTimeout(FALSE);
    
    END_CASE
ELSE
    // interface is not set to an instance of FB_ActuatorBase
    bIncompatible := TRUE;
END_IF

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4024.55

PC or CX (x64, x86)

Tc3_PlasticFunctions (>= v3.12.5.0)