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:
Example
- Construct a process model with three MathTasks as shown in the section Creating a Process with Math Tasks.
- Select the second task block in your process model: 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.
- On the selected block, right-click, and then select break
point.A red break point appears on the task block:
- 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.
- 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
input_1 = 1
input_2 = 2
output = 3
.
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: - 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.
- 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.
- Run the process again.
The process resumes from the breakpoint, and runs to completion.
- 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.
- 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.