FB_ALY_ArrayStatistics
The Array Statistics algorithm calculates various statistical quantities based on the input array.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_ArrayStatistics
VAR_OUTPUT
ipResultMessage : Tc3_EventLogger.I_TcMessage;
bError : BOOL;
bNewResult : BOOL;
bConfigured : BOOL;
fMin : LREAL;
nIdxMin : DINT
fMax : LREAL;
nIdxMax : DINT;
fMaxDelta : LREAL;
nIdxMaxDelta : DINT;
nCountPeaks : ULINT;
nCountValleys : ULINT;
fSum : LREAL;
fMean : LREAL;
fStandardDeviation : LREAL;
END_VAR
Outputs
Name | Type | Description |
---|---|---|
ipResultMessage | 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 |
bNewResult | BOOL | When a new result has been calculated, the output is |
bConfigured | BOOL | Displays |
fMin | LREAL | Smallest value in the input array. |
nIdxMin | DINT | Array index from |
fMax | LREAL | Largest value in the input array. |
nIdxMax | DINT | Array index from |
fMaxDelta | LREAL | Maximum of the absolute difference between two consecutive values in the input array. |
nIdxMaxDelta | DINT | Array index from |
nCountPeaks | ULINT | Total number of peaks identified. |
nCountValleys | ULINT | Total number of valleys identified. |
fSum | LREAL | Sum over the entire input array. |
fMean | LREAL | Mean value over the entire input array. |
fStandardDeviation | LREAL | Standard deviation over the entire input array. |
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. The configuration is identical for all channels. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
Sample
VAR
fbArrayStatistics : FB_ALY_ArrayStatistics;
bUseBesselCorrection : BOOL := TRUE;
fThresholdReversal : LREAL := 0.5;
fThresholdDelta : LREAL := 0.5;
nLowerBound : DINT := 1;
bConfigure : BOOL := TRUE;
aInput : ARRAY[1..20] OF LREAL;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbArrayStatistics.Configure(bUseBesselCorrection, fThresholdReversal, fThresholdDelta, nLowerBound);
END_IF
// Call algorithm
fbArrayStatistics.Call(ADR(aInput), SIZEOF(aInput));
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |