Examine and Debug a Process

The Example Process tool lets you set breakpoints in your process and step through the execution of individual tasks.

This tool is especially useful when constructing large or complex processes. At breakpoints you can evaluate and examine variables and understand the operation of your process.

To set break points:

  1. To set breakpoints in your process, on the toolbar, click .
    The Examine Process tool is activated.
  2. In your process model, select the task block on which you would like to set a break point.
    A break point appears in the task block.
  3. Right-click and select break point.
  4. Run your process.

    The execution stops at the break point.

Example

  1. Construct a process model with three MathTasks as shown in the section Creating a Process with Math Tasks.
  2. Select the second task block in your process model:


    Figure 1.
    Notice that a sequence number and ID appear under the selected task block. Each task block in a process has a unique ID that you can use to retrieve information. For the selected task block in the image above, the sequence number is 7 and the ID is MathTask_75.
  3. On the selected block, right-click, and then select break point.
    A red break point appears on the task block:


    Figure 2.
  4. Click to run the process.
    The process executes as you see in the following image. The first MathTask block is flagged green indicating that the task has executed. The block with the break point is flagged orange indicating that the process paused at the break point.


    Figure 3.
  5. While the simulation is paused, you can review the values of the input and output of the task blocks. To view the inputs and output defined in the blocks, click the Preferences tool , and then select Show > Port Labels.


    Figure 4.
    The variable names input_1, input_2 and output are element attributes that you can define in the Task Implementation file. For the MathTask blocks, the values are predefined as follows:
    • input_1 = 1
    • input_2 = 2
    • output = 3
  6. To find out the value of the input into the block with the break point, enter the following in the Command window, where xx is the MathTask ID:

    ::pc::objMathTaskxx cget -input_1.

    For the task block in the image above, enter the command ::pc::objMathTask75 cget -input_1.

    The software returns the value of 1, the original value of the input, letting you know that the input into MathTask75 has not yet received a value from the first block due to the break point in the process.

  7. Similarly, instead of input, check the value for output:

    ::pc::objMathTask75 cget -output

    Since the simulation stopped at the breakpoint, the value for output returns as not yet defined.

  8. Run the process again.

    The process resumes from the breakpoint, and runs to completion.

  9. Check the input:

    ::pc::objMathTask75 cget -input_1

    The value returned is 3, indicating that the process executed as intended and the output from the first task block has been provided to the input_1 of the second block, Mathtask75.

  10. Check the output:

    ::pc::objMathTask75 cget -output

    The value returned is 5, indicating that the process executed as intended and the output from the first block has been provided as input to MathTask_75.