FB_ALY_XtsDistanceIntegrator_1Ch

The XTS Distance Integrator 1Ch calculates the distance covered by a XTS mover. The algorithm provides the total distance, the positive distance and the negative distance. For this purpose, the length of the XTS in millimeters must be declared and as input signal the mover position is required.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_XtsDistanceIntegrator_1Ch
VAR_INPUT
    bPersistent: BOOL;
END_VAR
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    fDistance: LREAL;
    fDistancePos: LREAL;
    fDistanceNeg: LREAL;
END_VAR

FB_ALY_XtsDistanceIntegrator_1Ch 1: Inputs

Name

Type

Description

bPersistent

BOOL

If the value is TRUE, the internal data is stored persistently.

FB_ALY_XtsDistanceIntegrator_1Ch 2:Outputs

Name

Type

Description

ipResultMessage

I_TcMessage

Contains more detailed information on the current return value. This special interface pointer is internally secured so that it is always valid/assigned.

bError

BOOL

This output is TRUE if an error occurs.

bNewResult

BOOL

When a new result has been calculated, the output is TRUE.

bConfigured

BOOL

Displays TRUE when the function block is successfully configured.

fDistance

LREAL

Total distance covered by the XTS mover. In m.

fDistancePos

LREAL

Positive distance covered by the XTS mover (direction: forward). In m.

fDistanceNeg

LREAL

Negative distance covered by the XTS mover (direction: backward). In m.

FB_ALY_XtsDistanceIntegrator_1Ch 3:Methods

Name

Definition Location

Description

Call()

Local

Method calculates the outputs for a given configuration.

Configure()

Local

General configuration of the algorithm with its parameterized conditions.

Reset()

Local

Resets all internal states or the calculations made so far.

SetChannelValue()

Local

Method to pass values to the algorithm.

Sample

VAR
    fbXtsDistance : FB_ALY_XtsDistanceIntegrator_1Ch;
    nXtsLenght : UDINT := 4000;
    bConfigure : BOOL := TRUE;
    fPosition : LREAL;
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;
    
   fbXtsDistance.Configure(nXtsLenght);
END_IF

// Call algorithm
fbXtsDistance.SetChannelValue(fPosition);
fbXtsDistance.Call();

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics