FB_ALY_StateHistogram_1Ch
The State Histogram 1Ch counts how often the input signal (INT) has a specific value between the configured minimum and maximum and shows the distribution in a histogram. The first bar represents the boundary values which are smaller than the minimum and the last bar represents the boundary values which are greater than the maximum. The State Histogram 1Ch is suitable for state-machines to show how often the different states are executed.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_StateHistogram_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 calculates the outputs for a given configuration. |
GetResults() | Local | Get 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 made so far. |
SetChannelValue() | Local | Method to pass values to the algorithm. |
SetInital() | Local | Method to set initial histogram values. |
Sample
VAR
fbStateHistogram : FB_ALY_StateHistogram_1Ch;
eStateHistMode : E_ALY_StateHistMode := E_ALY_StateHistMode.Absolute;
nMin : LINT := 1;
nMax : LINT:= 20;
bConfigure : BOOL := TRUE;
nInput : INT;
aHistArrayOut : ARRAY[0..21] OF ULINT;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbStateHistogram.Configure(eStateHistMode, nMin, nMax);
END_IF
// Call algorithm
fbStateHistogram.SetChannelValue(nInput);
fbStateHistogram.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 |