FB_ALY_XyShapeMonitor_Triangle_2Ch

The XY Shape Monitor Triangle 2Ch counts the amount of intersections of an XY input with a specified triangle shape.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_XyShapeMonitor_Triangle_2Ch
VAR_INPUT
    bPersistent: BOOL;
END_VAR
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    bWithinShape: BOOL;
    bIntersection: BOOL;
    nCountIntersections: ULINT;
    fbTimeLastIntersection: FB_ALY_DateTime;
END_VAR

FB_ALY_XyShapeMonitor_Triangle_2Ch 1: Inputs

Name

Type

Description

bPersistent

BOOL

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

FB_ALY_XyShapeMonitor_Triangle_2Ch 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.

bWithinShape

BOOL

TRUE if the input signal is currently within the specified shape.

bIntersection

BOOL

TRUE if the input signal currently crosses the specified shape.

nCountIntersections

ULINT

Total number of intersections of input signal and shape.

fbTimeLastIntersection

FB_ALY_DateTime

Timestamp of the last intersection.

FB_ALY_XyShapeMonitor_Triangle_2Ch 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.

ConfigureChannel()

Local

Channel-specific configuration for the respective algorithm.

Reset()

Local

Resets all internal states or the calculations made so far.

SetChannelValue()

Local

Method to pass values to the algorithm.

Sample

VAR
    fbXyShapeMonitor_Triangle : FB_ALY_XyShapeMonitor_Triangle_2Ch;
    fbSystemTime : FB_ALY_GetSystemTime;
    stCorner1 : ST_ALY_XyPosition := ( X:= 0.0, Y := 0.0);
    stCorner2 : ST_ALY_XyPosition := ( X:= 0.0, Y := 6.0);
    stCorner3 : ST_ALY_XyPosition := ( X:= 4.0, Y := 3.0);
    bConfigure : BOOL := TRUE;
    fInputChX : LREAL;
    fInputChY : LREAL;
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;
    
    fbXyShapeMonitor_Triangle.Configure(stCorner1, stCorner2, stCorner3);
END_IF

// Get current system time
fbSystemTime.Call();

// Call algorithm
fbXyShapeMonitor_Triangle.SetChannelValue(1, fInputChX);
fbXyShapeMonitor_Triangle.SetChannelValue(2, fInputChY);
fbXyShapeMonitor_Triangle.Call(fbSystemTime.tSystemTime);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics