- Help Center
- User’s Guide
- Discrete Event Simulator
- Level Four: Triggers
Level Four: Triggers
Last modified on June 15th, 2020.
This tutorial utilizes a complex model with parallel branches (each with a performer specified) and interaction between those performers to demonstrate how 'Input/Output' constructs can to used to control the order in which the 'Action' constructs are executed by the simulator. This tutorial assumes you have completed the previous Level Three: Decomposition, Resources, Cost 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 Four: Robot Root Action." Once in the 'Action Diagram,' you can see this example includes 'Branch Asset' constructs for each branch of the 'Parallel' within the 'LOOP.'
The 'Branch Asset' construct acts as a swim lane and automatically adds a performed by relationship from each 'Action' on that branch to the 'Branch Asset.' By default, each branch of the 'Parallel' will execute concurrently; however, the Robot Application and Robot must wait for the applicable user commands to execute.
In this example, to control order of execution, "Initiate a Command" generates an 'Input/Output,' which is received by "Interpret User Command." An 'Input/Output' also must be generated by "Send Command to Robot" to ensure that "Perform Command" waits for a valid user command to execute.
- The decomposition diagram for "Perform Command" now has an 'Input/Output' triggering the 'Action' named "Perform User Action," which will ensure the model waits for "Send Command to Robot" to complete before executing.
The 'Action' named "Perform Command" is called a parent, acting as an abstract wrapper. The parent doesn't generate or receive 'Input/Output' constructs, doesn't consume or produce 'Resource' constructs, doesn't run for its own Duration (Duration of a parent is calculated by the children's runtime), and doesn't utilize assets. When an 'Input/Output' is triggered to a parent, the 'Input/Output' is automatically added to the child diagram. The 'Input/Output' needs to then be received (or generated) by the applicable child 'Action.'
- Use the 'Back' button to navigate back to the parent 'Action Diagram' named "Level Four: Robot Root Action." Once in the 'Action Diagram,' navigate to the 'Discrete Event Simulator' via the blue 'Simulate' drop-down.
- Run the simulator by clicking the 'Play' button. The simulator will operate normally as long as "Yes" is selected for the 'OR' named "Valid Command?." Once the simulator has finished executing the model, the simulator will display a result similar to the example shown below:
The yellow bars shown above in the 'Gantt Chart' panel indicate the amount of time the simulator waited for an 'Input/Output' to be triggered.
If at any point during the simuation you select "No" in the "Valid Command?" 'OR' prompt, the simulator will deadlock and display the 'Simulation Deadlock' dialog:
This is because the "Perform Command" and subsequent child "Perform User Action" never receive the 'Input/Output' trigger "Action Command." This issue is resolved in the next tutorial about synchronization.
- Continue rerunning the simulator until you are comfortable with how 'Input/Output' can be used to control the order in which the 'Action' constructs are executed by the simulator.