Testing the communication

A simple simulation of the commands in the control direction is activated by setting the bExecuteCmd variable to TRUE and deactivated by setting it to FALSE. With an active connection, a single command (C_SC_NA_1, IOA = 10 ) is cyclically transmitted to the substation every 10 seconds in the sample used.

PROGRAM MAIN
VAR
    ...

    bExecuteCmd : BOOL;
    timer : TON;

    ...
END_VAR
...

(* Simple command simulation *)
timer( IN := bExecuteCmd, PT := T#10s ); (* Send cyclic command *)
IF timer.Q THEN
    timer( IN := FALSE );
    cmdSingle_0 := NOT cmdSingle_0; (* toggle single command ON<->OFF *)

(*      cmdDouble_0 := SEL( cmdDouble_0 = 1, 1, 2 );

    cmdBitStr_0 := cmdBitStr_0 + 1;

    cmdNormalized_0 := cmdNormalized_0 + 2;

    cmdScaled_0 := cmdScaled_0 + 4;

    cmdFloating_0 := cmdFloating_0 + 1.2; *)
END_IF

...