FB_ALY_StringCompare_2Ch
The String Compare 2Ch compares the values of the first input string with the values of the second string and counts the string matches. Therefore case sensitivity can be taken into account or not and the count mode can be changed.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_StringCompare_2Ch
VAR_INPUT
bPersistent: BOOL;
END_VAR
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
bStringMatch: BOOL;
nCount: ULINT;
fbTimeLastEvent: FB_ALY_DateTime;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
bPersistent | BOOL | If the value is |
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 |
bStringMatch | BOOL | Result of the string comparison. |
nCount | ULINT | Incremented when the output value is |
fbTimeLastEvent | FB_ALY_DateTime | Timestamp of the last change to |
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. |
Sample
VAR
fbStringCompare : FB_ALY_StringCompare_2Ch;
fbSystemTime : FB_ALY_GetSystemTime;
eStringCompareMode : E_ALY_StringCompareMode := E_ALY_StringCompareMode.Equals;
eCountMode : E_ALY_CountMode := E_ALY_CountMode.OnChange;
bCaseSensitive : BOOL := TRUE;
bConfigure : BOOL := TRUE;
sInputCh1 : STRING := 'Input string';
sInputCh2 : STRING := 'String to compare with';
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbStringCompare.Configure(eStringCompareMode, eCountMode, bCaseSensitive);
END_IF
// Get current system time
fbSystemTime.Call();
// Call algorithm
fbStringCompare.SetChannelValue(1, sInputCh1);
fbStringCompare.SetChannelValue(2, sInputCh2);
fbStringCompare.Call(fbSystemTime.tSystemTime);
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |