FB_ALY_Histogram_1Ch
The Histogram 1Ch calculates the distribution of a single channel input value cyclically. It can be configured with minimal bin, maximal bin and the total amount of bins. The dimension of the output array is the number of bins + 2. Because values that are less than the minimal bin are stored in the first array element and values greater than the maximal bin are stored in the last array element.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_Histogram_1Ch
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
nNumValues: ULINT;
END_VAR
Outputs
Name | Type | Description |
---|---|---|
ipResultMessage | 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 |
bNewResult | BOOL | When a new result has been calculated, the output is |
bConfigured | BOOL | Displays |
nNumValues | ULINT | Number of values included in the histogram. |
Methods
Name | Definition location | Description |
---|---|---|
Call() | Local | Method for calculating the outputs for a specific configuration. |
GetResults() | Local | Getting the result array without adding new values. |
Configure() | Local | General configuration of the algorithm with its parameterized conditions. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
SetChannelValue() | Local | Method for passing values to the algorithm. |
Sample
VAR
fbHistogram : FB_ALY_Histogram_1Ch;
eHistMode : E_ALY_HistMode := E_ALY_HistMode.Absolute;
nBins : UDINT := 20;
fMinBinned : LREAL := 1;
fMaxBinned : LREAL:= 200;
bConfigure : BOOL := TRUE;
nInput : INT;
aHistArrayOut : ARRAY[0..21] OF ULINT;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbHistogram.Configure(eHistMode, nBins, fMinBinned, fMaxBinned);
END_IF
// Call algorithm
fbHistogram.SetChannelValue(nInput);
fbHistogram.Call(ADR(aHistArrayOut), SIZEOF(aHistArrayOut));
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |