FB_ALY_PieChart

The Pie Chart function block can be used to create a pie chart for later use in the HMI Dashboard. The number of pie pieces can be parameterized via the parameterNum Channels.

Since the function of this function block is irrelevant for the analysis itself, it belongs to the Visualization Only category.

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_StateHistogram_1Ch
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
END_VAR

FB_ALY_PieChart 1: 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 when the function block is successfully configured.

FB_ALY_PieChart 2: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.

ConfigureChannel()

Local

Channel-specific configuration

FB_init

Local

Initializes the number of input channels.

GetChannelOutputValue()

Local

Method for getting individual output values from the output array.

GetOutputArray()

Local

Method for getting the entire output array.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

SetInputArray()

Local

Simultaneous setting of all input channels.

Sample

VAR
    fbPieChart : FB_ALY_PieChart(nNumChannels := 3);
    aChannelNames : ARRAY[1..3] OF STRING(255) := ['First Channel', 'Second Channel', 'Third Channel'];
    bRelativeOutput : BOOL := TRUE;
    bConfigure : BOOL := TRUE;
    fInput1 : LREAL;
    nInput2 : ULINT;
    nInput3 : INT;
    aResult : ARRAY[1..3] OF LREAL;
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;

    fbPieChart.ConfigureChannel(1, aChannelNames[1]);
    fbPieChart.ConfigureChannel(2, aChannelNames[2]);
    fbPieChart.ConfigureChannel(3, aChannelNames[3]);
    fbPieChart.Configure(bRelativeOutput);
END_IF

// Call algorithm
fbPieChart.SetChannelValue(1, fInput1);
fbPieChart.SetChannelValue(2, nInput2);
fbPieChart.SetChannelValue(3, nInput3);
fbPieChart.Call();
fbPieChart.GetOutputArray(ADR(aResult), SIZEOF(aResult));

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics