This tutorial utilizes a slightly more complex model with decision points to demonstrate ‘OR’ and ‘LOOP’ constructs being executed by the simulator. This tutorial assumes you have completed the previous Level One: Sequential Execution tutorial and have the Robotic System example models already imported into your current project.
Perform the following outlined steps in Innoslate:
- Use ‘Diagrams View’ to navigate directly to the ‘Action Diagram’ named “Level Two: Robot Root Action.” Once in the ‘Action Diagram’ (shown below), you can see this example includes decision points often used in the real world for selecting paths or continuously looping until a state has been reached.A user of the Robotic System would likely want to instruct the Robot to perform multiple commands. The added ‘LOOP’ allows the model to iterate until a condition is reached. ‘LOOPs’ can be scripted to perform a set number of iterations, wait for a resource condition, continue probabilistically, or a custom script. If no script is assigned, the ‘LOOP’ will prompt you to make the decision to continue iteration.
Not all commands issued by a user to the Robot will be valid. To simulate this, an ‘OR’ has been added to the model to check whether the user’s command is valid. The added ‘OR’ allows the simulation to select a single branch of a set of two or branches to execute. In this example, the ‘OR’ has two branches, “Yes” and “No.” If the command is valid, the “Yes” branch is executed and the Robot will perform the command. If the command is invalid, the “No” branch is executed and the Robot will display an error message.
- Navigate to the ‘Discrete Event Simulator’ via the blue ‘Simulate’ drop-down, ensure the Speed setting is still set to “1x (Real Time),” ensure the Decisions setting is set to “Prompt on no script” and then run the simulator by clicking the ‘Play’ button.
- Once the simulator begins executing the ‘LOOP,’ a prompt will be displayed, as shown below. The prompt requires your input for how many iterations the ‘LOOP’ should execute. The number of iterations will default to 3, but any non-negative integer can be set. For the purposes of this tutorial, keep the default number of iterations set to 3 and click the green ‘Submit’ button.
- Once the simulator begins executing the ‘OR,’ a prompt will be displayed, as shown below. The prompt requires your input for which branch to execute. The ‘OR’ will continue to prompt for each iteration of the loop. For the purposes of this tutorial, submit the prompts with the following answers “Yes,” “No,” and then “Yes.”Once the simulator has finished executing the model, the simulator will display a result similar to the example shown below:
- Continue rerunning the simulator providing the prompts with different values to see how the simulation results are affected and you are comfortable with how decision points are executed.