FB_ALY_XtsMovementAnalysis

The XTS Movement Analysis calculates the position, speed, acceleration and jerk of an XTS mover. Various filter stages are chained together to smooth the signal. In order to be able to analyze additional, associated signals, the module enables the filtering of two further signals with the same filter stages.

FB_ALY_XtsMovementAnalysis 1:

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_XtsMovementAnalysis
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    fPositionRaw: LREAL;
    fPositionFiltered: LREAL;
    fVelocityRaw: LREAL;
    fVelocityFiltered: LREAL;
    fAccelerationRaw: LREAL;
    fAccelerationFiltered: LREAL;
    fJerkRaw: LREAL;
    fExtSignal1Filtered: LREAL;
    fExtSignal2Filtered: LREAL;
END_VAR

FB_ALY_XtsMovementAnalysis 2: Outputs

Name

Type

Description

ipResultMessage

I_TcMessage

Contains more detailed information on the current return value. For this special interface pointer, it is ensured internally that it is always valid/assigned.

bError

BOOL

The output is TRUE if an error occurs.

bNewResult

BOOL

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

bConfigured

BOOL

Displays TRUE if the function block is successfully configured.

fPositionRaw

LREAL

Position in mm.

fPositionFiltered

LREAL

Filtered position in mm.

fVelocityRaw

LREAL

Velocity in m/s.

fVelocityFiltered

LREAL

Filtered velocity in m/s.

fAccelerationRaw

LREAL

Acceleration in m/s².

fAccelerationFiltered

LREAL

Filtered acceleration in m/s².

fJerkRaw

LREAL

Jerk in m/s³.

fJerkFiltered

LREAL

Filtered jerk in m/s³.

fExtSignal1Filtered

LREAL

External signal 1 has the same filter stages as the position signal.

fExtSignal2Filtered

LREAL

External signal 2 has the same filter stages as the position signal.

FB_ALY_XtsMovementAnalysis 3: Methods

Name

Definition location

Description

Call()

Local

Method for calculating the outputs for a specific configuration.

Configure()

Local

General configuration of the algorithm with its parameterized conditions.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

Example

VAR
    fbXtsMovementAnalysis : FB_ALY_XtsMovementAnalysis;
    fbSystemTime : FB_ALY_GetSystemTime;

    // Config
    bConfigure : BOOL := TRUE;
    nXtsLength : UDINT := 4000;
    fHardwarePosFactor : LREAL := 0.0001;
    fSampleRate : LREAL := 4000;
    aFilterOrder : ARRAY[1..4] OF UDINT := [2, 2, 2, 2];
    aFilterTimeConstant : ARRAY[1..4] OF LREAL := [0.05, 0.05, 0.05, 0.05];
    aUseFilterForExtSignal1 : ARRAY[1..4] OF BOOL := [TRUE, TRUE, FALSE, FALSE];
    aUseFilterForExtSignal2 : ARRAY[1..4] OF BOOL := [TRUE, TRUE, TRUE, FALSE];

    // Inputs
    nHardwarePosModulo AT%I* : UDINT;
    fExtSignal1 : LREAL;
    nExtSignal2 : UDINT;
END_VAR
// Get current system time
fbSystemTime.Call();

// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;
    fbXtsMovementAnalysis.Configure(nXtsLength, fHardwarePosFactor, fSampleRate, aFilterOrder, aFilterTimeConstant, aUseFilterForExtSignal1, aUseFilterForExtSignal2);
END_IF

// Call algorithm
fbXtsMovementAnalysis.SetChannelValue(1, nHardwarePosModulo);
fbXtsMovementAnalysis.SetChannelValue(2, fExtSignal1);
fbXtsMovementAnalysis.SetChannelValue(3, nExtSignal2);
fbXtsMovementAnalysis.Call(tTimestamp:=fbSystemTime.tSystemTime);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics