String_To_UtcTimeQuality

Converts the UTC-Time-Quality information formatted as a string into the components of the structured type T_UtcTimeQuality. The string to be converted must be specified and has the following structure: 'UQ#LFC|A[A]'. It corresponds to the TwinCAT UTC-Time-Quality string format specification.

Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)

Syntax

FUNCTION String_To_UtcTimeQuality : T_UtcTimeQuality
VAR_INPUT
    in     : STRING(9) := 'UQ#000|0';
END_VAR
VAR_OUTPUT
    bError : BOOL;
END_VAR

String_To_UtcTimeQuality 1: Inputs

Name

Type

Description

in

STRING(9)

The information to be converted as a UTC-Time-Quality string.

String_To_UtcTimeQuality 2: Outputs

Name

Type

Description

bError

BOOL

This output is "TRUE" if the input string could not be converted without error.

String_To_UtcTimeQuality 3: Return value

Name

Type

Description

String_To_UtcTimeQuality

T_UtcTimeQuality

Converted information as UTC-Time-Quality structure.

Sample

The return value: 'UQ#001|3' means that leap seconds are not known. Timer has no error and is not synchronized, the resolution of the time information of the seconds fraction is 3 bits.

METHOD UtcTimeQuality_ToFrom_String : BOOL
VAR_INPUT
    fbIED    : REFERENCE TO FB_IED;
END_VAR
VAR
    Quality  : T_UtcTimeQuality;
    sQuality : STRING;
END_VAR
IF NOT __ISVALIDREF(fbIED) THEN
    RETURN;
END_IF

Quality := String_To_UtcTimeQuality('UQ#000|0');
sQuality := UtcTimeQuality_To_String(Quality);(* sQuality := 'UQ#000|0' *)
IF fbIED.Relay.LLN0.Beh.t.sQuality <> sQuality THEN
    Quality := fbIED.Relay.LLN0.Beh.t.Quality;
END_IF

Quality := String_To_UtcTimeQuality('UQ#001|3');
sQuality := UtcTimeQuality_To_String(Quality);(* sQuality := 'UQ#001|3' *)
IF fbIED.Relay.LLN0.Health.t.sQuality <> sQuality THEN
    Quality := fbIED.Relay.LLN0.Health.t.Quality;
END_IF

Quality := String_To_UtcTimeQuality('UQ#000|31');
sQuality := UtcTimeQuality_To_String(Quality);(* sQuality := 'UQ#000|31' *)
IF fbIED.Relay.LLN0.Mod_.t.sQuality <> sQuality THEN
    Quality := fbIED.Relay.LLN0.Mod_.t.Quality;
END_IF

UtcTimeQuality_ToFrom_String := TRUE;