Debugging a Sequential Function Chart

You can use the Debug feature to debug a Sequential Function Chart (SFC). The debugging feature allows you to check that your program provides the expected Logic functions. It is particularly useful when you need to check separate parts of large programs—you can step through each section of the program and view its effect on the variables. To view the variables, you need to use the Variables Window. This helps you to determine which parts of your SFC programs are not working as intended (if any).

A Logic program can only be debugged by one user at a time. When a user has a Logic program in debug mode, it cannot be executed manually or by schedules.

There are two ways to start the debugging process:

Typically, you will need to use the debugging feature to debug separate sections of an SFC program. For example, if a complex SFC program is not returning the values you expected, you will need to debug each calculation within the program separately—this allows you to determine which sections of the SFC program are incorrect.

To debug parts of a program, you need to use the commands in the Debuggroup on the Logic tab:

Start

The debugger runs the program until it reaches a breakpoint or the program completes.

Stop

Stops the debugging feature. The debugger will not run again until you select the Restartcommand.

Restart

Starts the debugging feature again (after it has been stopped).

Step Over

Sets the debugger to ignore any further statements in a function block that is contained within the SFC program. If the debugger is set to Step Into when you select this command, it will execute the current statement in the function block and then return to the main part of the SFC program. It will not execute the remaining calculations in the function block (unlike the Step Out command).

The debugger is set to Step Over by default.

Step Into

When a program is being debugged, the debugger ignores the code in any function blocks that are contained within the program. You can set the debugger to run the function block code as well as the rest of the program code by selecting the Step Into command.

The Step Into command is useful when investigating function blocks within an SFC program. If the function blocks have already been debugged, there is no need to use the Step Into command.

Step Out

Sets the debugger to ignore any further statements in a function block that is contained within the SFC program. If the debugger is set to Step Into when you select this option, it will execute the remaining statements in the function block and then return to the main part of the SFC program.

Rerun on Completion

By default, when the debugger has executed every statement successfully, it waits a short time before starting the debugging process again. You can use the following options from the command's drop-down menu options to control how long the debugger waits and whether it will repeat the debugging process:

Break on Error

The debugger will execute each statement in the program (up to a breakpoint if a breakpoint is defined). If there is an error in the program, the debugger will stop at the line in which the error occurs.

After 1s, 2s, 5s, 10s, 30s, 60s

Defines the amount of time the debugger will wait after successfully executing each statement before it starts again. The options correspond to 1 second, 2 seconds, 5 seconds, 10 seconds, 30 seconds, and 60 seconds respectively.

To use breakpoints while debugging,use the commands in the Breakpoints group on the Logic tab:

Insert/Remove

Inserts or removes a break point at a selected position. You need to use this command to divide your program into sections.

You can also insert a breakpoint using the following steps:

  1. On the SFC, right-click on the step on which you want to insert the breakpoint.
    A context-sensitive menu is displayed.
  2. Select the Insert Breakpoint option.
    A breakpoint is set on the step. A red dot appears on the step to indicate that a breakpoint has been inserted.

The debugger will only run up to the breakpoint—it does not run the parts of the program that are after the breakpoint. If the code up to the breakpoint is working as expected, you can remove the breakpoint using the Insert/Remove command.

 

Remove All

Deletes each of the breakpoints in the program.

To view the Variables window while debugging a program,use the Variables command. The command is available from the View group on the Logic tab.

You need to use the Variables window to view the values that are being produced by each section of the SFC program. By examining the values that are produced, you can determine which values are unexpected (and therefore which parts of the SFC may be incorrect). For more information, see Viewing the Variables in your Sequential Function Chart.


Disclaimer

Geo SCADA Expert 2020