FB_ALY_MinMaxAvg_1Ch

The Min Max Avg 1Ch calculates the minimum, maximum and the average of the input values from the beginning of the analysis up to the current moment. Furthermore, the time values of minimum and maximum are shown.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_MinMaxAvg_1Ch 
VAR_INPUT
    bPersistent: BOOL;
END_VAR
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    fMin: LREAL;
    fMax: LREAL;
    fAvg: LREAL;
    fbTimeMin: FB_ALY_DateTime;
    fbTimeMax: FB_ALY_DateTime;
END_VAR

FB_ALY_MinMaxAvg_1Ch 1: Inputs

Name

Type

Description

bPersistent

BOOL

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

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

fMin

LREAL

Minimum of the input values.

fMax

LREAL

Maximum of the input values.

fAvg

LREAL

Average of the input values.

fbTimeMin

FB_ALY_DateTime

Timestamp of fMin.

fbTimeMax

FB_ALY_DateTime

Timestamp of fMax.

FB_ALY_MinMaxAvg_1Ch 3: Methods

Name

Definition location

Description

Call()

Local

Method for calculating the outputs for a specific configuration.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

Sample

VAR
    fbMinMaxAvg : FB_ALY_MinMaxAvg_1Ch;
    fbSystemTime : FB_ALY_GetSystemTime;
    nInput : INT;
END_VAR
// Get current system time
fbSystemTime.Call();

// Call algorithm
fbMinMaxAvg.SetChannelValue(nInput);
fbMinMaxAvg.Call(fbSystemTime.tSystemTime);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics