Assert

Assert 1:

Validates a condition and outputs an ERROR message via the ADS logging system if the condition is FALSE. The function block offers various versions with 0 to 5 additional parameters.

Assert (without parameters)

Validates a condition without any additional parameters.

METHOD Assert : BOOL
VAR_INPUT
  sLogCode : STRING := '';
  sLogText : T_MaxString;
  bResult  : BOOL := FALSE;
END_VAR

Name

Type

Description

sLogCode

STRING

Optional log code for uniquely identifying the message.

sLogText

T_MaxString

Message text to be output.

bResult

BOOL

Condition that is being validated. If it is FALSE, the message is output.

Assert1 (with 1 parameter)

Validates a condition using an additional parameter, tArg1.

METHOD Assert1 : BOOL
VAR_INPUT
  sLogCode : STRING := '';
  sLogText : T_MaxString;
  tArg1    : T_Arg;
  bResult  : BOOL := FALSE;
END_VAR

Name

Type

Description

sLogCode

STRING

Optional log code for uniquely identifying the message.

sLogText

T_MaxString

Message text with placeholders for parameters.

tArg1

T_Arg

The first parameter to be included in the message.

bResult

BOOL

Condition that is being validated. If it is FALSE, the message is output.

Assert2 (with 2 parameters)

Validates a condition using two additional parameters, tArg1 and tArg2.

METHOD Assert2 : BOOL
VAR_INPUT
  sLogCode : STRING := '';
  sLogText : T_MaxString;
  tArg1    : T_Arg;
  tArg2    : T_Arg;
  bResult  : BOOL := FALSE;
END_VAR

Name

Type

Description

sLogCode

STRING

Optional log code for uniquely identifying the message.

sLogText

T_MaxString

Message text with placeholders for parameters.

tArg1

T_Arg

The first parameter to be included in the message.

tArg2

T_Arg

Second parameter to be included in the message.

bResult

BOOL

Condition that is being validated. If it is FALSE, the message is output.

Assert3 (with 3 parameters)

Validates a condition using three additional parameters.

METHOD Assert3 : BOOL
VAR_INPUT
  sLogCode : STRING := '';
  sLogText : T_MaxString;
  tArg1    : T_Arg;
  tArg2    : T_Arg;
  tArg3    : T_Arg;
  bResult  : BOOL := FALSE;
END_VAR

Assert4 (with 4 parameters)

Validates a condition using four additional parameters.

METHOD Assert4 : BOOL
VAR_INPUT
  sLogCode : STRING := '';
  sLogText : T_MaxString;
  tArg1    : T_Arg;
  tArg2    : T_Arg;
  tArg3    : T_Arg;
  tArg4    : T_Arg;
  bResult  : BOOL := FALSE;
END_VAR

Assert5 (with 5 parameters)

Validates a condition using five additional parameters.

METHOD Assert5 : BOOL
VAR_INPUT
  sLogCode : STRING := '';
  sLogText : T_MaxString;
  tArg1    : T_Arg;
  tArg2    : T_Arg;
  tArg3    : T_Arg;
  tArg4    : T_Arg;
  tArg5    : T_Arg;
  bResult  : BOOL := FALSE;
END_VAR
Assert 2:
  • All assert variants are suppressed if the same log code is called in quick succession.
  • You can reset the suppression logic using Reset().
  • A rising edge on bResult is not required.
  • The various options allow for flexible configuration as needed.