UtcTimeQuality_To_String

Converts the components of the structured type T_UtcTimeQuality into a formatted UTC-Time-Quality string. The resulting string 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 UtcTimeQuality_To_String : STRING(9)
VAR_INPUT
    in     : T_UtcTimeQuality;
END_VAR
VAR_OUTPUT
    bError : BOOL;
END_VAR

UtcTimeQuality_To_String 1: Inputs

Name

Type

Description

in

T_UtcTimeQuality

The information to be converted as UTC-Time-Quality structure.

UtcTimeQuality_To_String 2: Outputs

Name

Type

Description

bError

BOOL

The output is "TRUE" if the input value could not be converted without error.

UtcTimeQuality_To_String 3: Return value

Name

Type

Description

UtcTimeQuality_To_String

STRING(9)

Converted information as a UTC-Time-Quality string.

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;