FB_ALY_ThresholdStringClassificator_1Ch
The Threshold String Classifier 1Ch algorithm classifies the input values into three different classes according to the configured thresholds. The class names (output string) can be configured individually as String 1, String 2 and String 3.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_ThresholdStringClassificator_1Ch
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
sResult: STRING(255) := '';
fbTimeLastEvent: FB_ALY_DateTime;
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 |
sResult | STRING(255) | Classification result |
fbTimeLastEvent | FB_ALY_DateTime | Timestamp of the last classification change. |
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. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
SetChannelValue() | Local | Method for passing values to the algorithm. |
Properties
Name | Type | Access | Definition location | Initial value | Description |
---|---|---|---|---|---|
fTolerance | LREAL | Get, Set | Local | 0.0 | Tolerance value for the Equal / NotEqual comparisons |
Sample
VAR
fbThresholdStringClassificator : FB_ALY_ThresholdStringClassificator_1Ch;
fbSystemTime : FB_ALY_GetSystemTime;
fThresholdLevel12 : LREAL := 10;
fThresholdLevel23 : LREAL:= 20;
sResult1 : STRING := 'This string is set at level 1 ( < 10)';
sResult2 : STRING := 'This string is set at level 2 ( >= 10)';
sResult3 : STRING := 'This string is set at level 3 ( >= 20)';
bConfigure : BOOL := TRUE;
nInput : INT;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbThresholdStringClassificator.Configure(fThresholdLevel12, fThresholdLevel23, sResult1, sResult2, sResult3);
END_IF
// Get current system time
fbSystemTime.Call();
// Call algorithm
fbThresholdStringClassificator.SetChannelValue(nInput);
fbThresholdStringClassificator.Call(fbSystemTime.tSystemTime);
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |