This tutorial utilizes an even more complex model with a decomposition diagram, 'Resource' constructs and cost included to demonstrate these controls and constructs being executed by the simulator. This tutorial assumes you have completed the previous Level Three: Decision Logic 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 Three: Robot Root Action." Once in the 'Action Diagram,' shown below, you can see this example looks nearly identical at the top level to the model in the previous tutorial.
The only noticeable change is the 'Action' named "Perform Desired Command" now has a 'DECOMPOSED' flag. This indicates another 'Action Diagram' is present under the 'Action' at a lower level of decomposition. - To view the decomposition diagram, click on the 'DECOMPOSED' flag.
In the previous tutorials, the Robot performed an abstract command which did not consume a resource nor have a cost specified. In this model, the Robot is performing specific commands with both resource consumption and cost specified. Notice the "Perform Desired Command" decomposition diagram has an 'OR' with three branches, one for each 'Action' the Robot can perform. The 'Action' constructs which the Robot performs consume the 'Resource' named "Power." 'Resource' constructs can be consumed, produced, or seized by an 'Action.' 'Resource' constructs are always consumed or seized at the start of an 'Action' construct's execution and produced or released (from a seize) at the end of the 'Action.' - The Initial Amount, Maximum Amount, Minimum Amount, and Units attributes of the 'Resource' must be set in order to properly model the Robot's power consumption. These attributes can be set by clicking on the 'Resource' named "Power" to highlight it and populating those sections in the 'Attributes' tab of the left sidebar.
In this example, these attributes have already been set to simulate a battery's capacity with an Initial Amount of 2000, a Maximum Amount of 2000, a Minimum Amount of 0, and mAh for Units. - The actual quantity of the 'Resource' being consumed during simulation is represented by the Amount attribute on the consumes/consumed by relationship between each 'Action' and the 'Resource.' This can be set by opening 'Entity View' of "Power" by selecting it in the diagram, clicking on the 'Open' drop-down and then selecting the 'Entity' menu item (shown below). When you are finished, click the 'Done' button to return to 'Entity View' and then click the 'Save' button to persist your changes to your project's database.
- Within 'Entity View,' click on the 'Attributes' button, shown below, beside the name of an 'Action' within the 'Relationships' panel ('Popular' tab) under the 'consumed by Action' section.
- This causes a 'consumed by Attributes' dialog to appear which allows you to input a static value or one of the supported distributions. The units of the Amount attribute are relative to the units selected for the 'Resource.' In this example you will find the Amount attribute on the relationship between each 'Action' and "Power" has already been set to some form of a Normal Distribution. For example, the Amount attribute on the relationship between "Power" and the 'Action' named "Grab Object" is set to a Normal Distribution with a mean of 10 mAh and a standard deviation of 3 mAh.
- Cost is modeled by adding an incurs relationship from the 'Action' to a Cost entity with the Amount and Units attributes set. Within 'Entity View' of "Replace Robot Part," click on the 'Popular' tab of the 'Relationships' panel and then locate the 'incurs Cost' section and see if any relationship exists. In this example, an incurs relationship has already been added from "Replace Robot Part" to a Cost entity named "Part Cost" which has the Amount attribute set to a Uniform Distribution and the Units attribute set to $. To set these attributes navigate to 'Entity View' of "Part Cost" by clicking on the name of the Cost entity under the 'incurs Cost' section.
- Use 'Diagrams View' to navigate back to the 'Action Diagram' named "Level Three: Robot Root Action." Once in the 'Action Diagram,' navigate to the 'Discrete Event Simulator' via the blue 'Simulate' drop-down.
- Once in the simulator, add the 'Cost Over Time' panel and the 'Resources Over Time' panels, change 'Decisions' to "Automate with no script" in 'Settings,' and save your settings. Run the simulator by clicking the 'Play' button.
Note: Within the 'Action Trace 3D' panel, the decomposition diagram is displayed in the z-axis behind the top level 'Action Diagram.' By scrolling within the 'Action Trace 3D' panel, you can zoom in or out on the diagram. By left clicking within the 'Action Trace 3D' panel, you can rotate the diagram. By right clicking within the 'Action Trace 3D' panel, you can move/pan the diagram.
While the simulation is running you will notice each time "Replace Part" is executed within the 'OR,' the Cost increases and the Robot's "Power" decreases. At any time, you may pause the simulator to run a report or view the panels at their current state if need be.
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 resources are consumed and costs are incurred.