Number Of Statements (NOS)

Title short form

NOS

Categories

Informative

Definition

Number of executable statements in the implementation of a function block, function or method

Further information

NOS = Number Of executable Statements

Statements in the declaration, empty statements or pragmas are not counted.

Sample:

FUNCTION_BLOCK FB_Sample
VAR_OUTPUT
    nTest  : INT;
    i      : INT;
END_VAR
VAR
    bVar   : BOOL;
    c      : INT := 100;    // statements in the declaration are not counted
END_VAR
IF bVar THEN                //if statement: +1
    nTest := 0;             // +1
END_IF
 
WHILE nTest = 1 DO          //while statement: +1
    ;                       // empty statements do not add to the statement count
END_WHILE
 
FOR c := 0 TO 10 BY 2 DO    //for statement: +1
    i := i+i;               // +1
END_FOR
 
{text 'simple text pragma'} //pragmas are not counted
nTest := 2;                 //+1

The sample has six statements.