Level Five: Synchronization

Last modified on January 31st, 2017.


This tutorial utilizes a very complex model with synchronization to demonstrate a 'SYNC' construct being executed by the simulator. This tutorial assumes you have completed the previous Level Four: Triggers tutorial and have the Robotic System example models already imported into your current project.

Perform the following outlined steps in Innoslate:

  1. Use 'Diagrams View' to navigate directly to the 'Action Diagram’ named "Level Five: Robot Root Action". Once in the 'Action Diagram', shown below, you can see this example fixes the issue with deadlock pointed out in the previous tutorial using a 'SYNC' construct to control synchronization and kill execution of branches as necessary.

    Level Five Action Diagram Example

    This example model now includes a 'SYNC' construct named "Sync Robot State". This 'SYNC' will begin execution as soon as any one of its branches complete execution. For example, if the "Yes" branch of the 'OR' is selected, then "Perform Command" will execute. Once "Perform Command" completes execution, then execution of "Sync Robot State" will begin. Similarly, if the "No" branch of the 'OR' is selected, then "Receive Cancel Command" will execute. Once "Receive Cancel Command" completes execution, then execution of "Sync Robot State" will begin.

    The Duration attribute of the 'SYNC' essentially specifies how long the simulator should wait before killing execution of the other branches which have not yet completed. In this example, the 'SYNC' needs to kill "Receive Cancel Command" immediately to prevent extra time being added to the total simulation time. If you select the "Sync Robot State" Action, you will notice the Duration is set to 0 which will effectively kill execution of any remaining uncompleted branches immediately.

  2. Navigate to the ‘Discrete Event Simulator’ via the blue ‘Simulate’ dropdown and then run the simulator by clicking the ‘Play’ button.

    When the simulation is running, you will now notice either branch selected on the "Valid Command?" prompt will now complete successfully without deadlock. At any time, you may pause the simulator to run a report or view the panels at their current state if need be. Below is a screenshot of the simulator paused during execution of this model:

    Simulation Paused

    Here is a quick summary of what can be interpreted from the above screenshot: In the ‘Status’ panel you can see the ‘Action’ named “Initiate a Command” is currently executing and "Interpret User Command", "Perform User Action?" and "Receive Cancel Command" are all waiting for an 'Input/Output' to be triggered.

  3. Continue rerunning the simulator providing the prompts with different values to see how the simulation results are affected and you are comfortable with how to control synchronization and kill execution of branches.

    This concludes this series of tutorials. For more information on Innoslate's simulation capabilities, see Simulation Controls, Simulation Scripts and Monte Carlo Simulator documentation.

 

Previous TutorialNo Next Tutorial

Level Five: Synchronization

Last modified on January 31st, 2017. 


This tutorial utilizes a very complex model with synchronization to demonstrate a ‘SYNC’ construct being executed by the simulator. This tutorial assumes you have completed the previous Level Four: Triggers tutorial and have the Robotic System example models already imported into your current project.

Perform the following outlined steps in Innoslate:

  1. Use ‘Diagrams View’ to navigate directly to the ‘Action Diagram’ named “Level Five: Robot Root Action”. Once in the ‘Action Diagram’, shown below, you can see this example fixes the issue with deadlock pointed out in the previous tutorial using a ‘SYNC’ construct to control synchronization and kill execution of branches as necessary.

    Level Five Action Diagram Example

    This example model now includes a ‘SYNC’ construct named “Sync Robot State”. This ‘SYNC’ will begin execution as soon as any one of its branches complete execution. For example, if the “Yes” branch of the ‘OR’ is selected, then “Perform Command” will execute. Once “Perform Command” completes execution, then execution of “Sync Robot State” will begin. Similarly, if the “No” branch of the ‘OR’ is selected, then “Receive Cancel Command” will execute. Once “Receive Cancel Command” completes execution, then execution of “Sync Robot State” will begin.

    The Duration attribute of the ‘SYNC’ essentially specifies how long the simulator should wait before killing execution of the other branches which have not yet completed. In this example, the ‘SYNC’ needs to kill “Receive Cancel Command” immediately to prevent extra time being added to the total simulation time. If you select the “Sync Robot State” Action, you will notice the Duration is set to 0 which will effectively kill execution of any remaining uncompleted branches immediately.

  2. Navigate to the ‘Discrete Event Simulator’ via the blue ‘Simulate’ dropdown and then run the simulator by clicking the ‘Play’ button.

    When the simulation is running, you will now notice either branch selected on the “Valid Command?” prompt will now complete successfully without deadlock. At any time, you may pause the simulator to run a report or view the panels at their current state if need be. Below is a screenshot of the simulator paused during execution of this model:

    Simulation Paused

    Here is a quick summary of what can be interpreted from the above screenshot: In the ‘Status’ panel you can see the ‘Action’ named “Initiate a Command” is currently executing and “Interpret User Command”, “Perform User Action?” and “Receive Cancel Command” are all waiting for an ‘Input/Output’ to be triggered.

  3. Continue rerunning the simulator providing the prompts with different values to see how the simulation results are affected and you are comfortable with how to control synchronization and kill execution of branches.

    This concludes this series of tutorials. For more information on Innoslate’s simulation capabilities, see Simulation Controls, Simulation Scripts and Monte Carlo Simulator documentation.

 

Previous TutorialNo Next Tutorial