Simulating
You can start, pause and reset the simulation using the controlbar at the top right of the viewport.
Playing
Click the play button in the controlbar to start the simulation. The dropdown menu allows you to change the speed of the simulation. You can run the simulation at 0.1X speed, 0.5X speed, 1.0X speed, 2.0X speed, 5.0X speed or MAX speed. MAX speed will play the simulation as fast as possible, limited only by the speed of your hardware. STEP can be used to step between frames, advancing the simulation by one timestep.
If you are connecting ProtoTwin to a physical PLC for controls testing, it is required that you run the simulation at 1.0X (realtime) speed. You can run the simulation at faster or slower than realtime if you are using the integrated SoftPLC or a scripted component to control a machine.
Pausing
Click the pause button to pause the simulation. Click again to resume the simulation.
Resetting
Click the reset button in the controlbar to reset the model back to its state immediately before the simulation was started:
- Any entities, components or materials that were added during the simulation are automatically removed.
- Any entities, components or materials that were removed during the simulation are automatically added back.
- Any entities, components or materials that were modified during the simulation are automatically reset back to their state immediately before the simulation was started.
This reset behavior is consistent with reloading a model. The benefit is that you don’t need to implement any reset logic inside your scripts, and it ensures that simulations are deterministic across resets by default.
What is reset logic?
In most traditional industrial simulation software, you are required to implement logic that resets your components back to some initial state. This initial state is sometimes fixed, but frequently you want to be able to specify the initial state.
What is non-determinism?
Non-determinism means that the model may produce different results each time you run the simulation with the same initial conditions. Non-determinism makes models difficult to modify, difficult to reason about and difficult to collaborate on.
Why is reset logic problematic?
Reset logic can be difficult to implement correctly. You typically need to store the values that various properties need to be reset back to, and then reset those properties back to those values when the reset event occurs. Forgetting to reset properties, or resetting properties incorrectly, will introduce non-determinism across reset events. Issues with reset logic are often very difficult and time-consuming to track down.
How is reset logic avoided?
Resetting models in ProtoTwin is nearly identical to reloading the model. We store the entire state of the model at initialization (just before the simulation is started) and reload that state when you click reset. This sounds computationally expensive, but we’ve ensured that this process is fast even for large models.
Why were my changes discarded?
If you made changes to the model after the simulation was initialized (i.e. after clicking the play button), then those changes will be discarded when the simulation is reset. Note that clicking the save button will automatically reset the simulation before saving. To make persistent changes, the simulation must not be initialized. A notification is displayed at the bottom of the viewport after the simulation has been initialized, warning that any changes you make will be discarded upon reset.
The typical workflow for making changes to a simulation in ProtoTwin is to repeat the following steps:
- Edit the model.
- Run the simulation to test changes.
- Reset the simulation before making further changes.
If the simulation is not reset in Step 3, then any changes after that will be discarded. Please make sure you reset the simulation before making further changes.