FB_ALY_MathOperation_1Ch

The Math Operation 1Ch executes a mathematical operation on the signal of the input channel and a reference value. The algorithm provides the result of the mathematical operation and the operator can be configured individually.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_MathOperation_1Ch
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    fResult: LREAL;
END_VAR

FB_ALY_MathOperation_1Ch 1: 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.

fResult

LREAL

Outputs the result of the mathematical operation.

FB_ALY_MathOperation_1Ch 2: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
    fbMathOperation : FB_ALY_MathOperation_1Ch;
    fOperand : LREAL := 50;
    eMathOperator : E_ALY_MathOperator := E_ALY_MathOperator.Addition;
    bUseAbsValues : BOOL := FALSE;
    bConfigure : BOOL := TRUE;
    nInput : INT;
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;

    fbMathOperation.Configure(fOperand, eMathOperator, bUseAbsValues);
END_IF

// Call algorithm
fbMathOperation.SetChannelValue(nInput);
fbMathOperation.Call();

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics