Simulation Reset
Overview
Section titled “Overview”A SimulationReset component restarts the scene when a boolean PLC output rises. The reset is the same one the Reset button in the simulation controls runs: parts are removed, drives return to their start pose and the logic starts again. Use it when a controller, a Structured Text program or an MQTT source must bring the twin back to a known state, for example after a test cycle or when an operator confirms a restart on the real panel.
The component can also report back. SignalResetDone goes true for a short time after the reset it requested has run, so the controller knows the twin is ready.
For a reset from an operator panel, you do not need this component. Give a panel button the command sim.reset instead, see Operator Panel.
Properties
Section titled “Properties”Signal Reset (ComponentReference to PLCOutputBool) The signal that triggers the reset. Its rising edge, false to true, resets the simulation once. Link it in the inspector. Without a signal the component does nothing.
Signal Reset Done (ComponentReference to PLCInputBool) Optional feedback signal. The viewer writes it true for Done Pulse Time after a reset that this component requested has run, then false again. Leave it empty if the controller needs no confirmation.
Min Interval (number, at least 0, seconds, default 1) The minimum real time between two signal-triggered resets. It guards against a controller that requests a reset in a loop. The interval is measured on the wall clock, because the simulation time jumps back to 0 on every reset and stands still while the simulation is paused.
Done Pulse Time (number, at least 0.01, seconds, default 0.2) The length of the Done pulse, measured in simulation time. While the simulation is paused, the pulse does not progress.
How it works
Section titled “How it works”Only a rising edge counts. The level the viewer reads when the signal is first linked, a level that is re-applied after a reset or after an interface reconnects, and the first value of an interface that has not synchronised yet never trigger a reset. They only set the starting point for the next edge.
One reset per request. The reset runs right after the current simulation tick, never in the middle of it. Several requests in the same tick, from one or more components, produce one reset. It also runs while the simulation is paused.
A held request does not repeat. After every reset, whatever triggered it, the signal must be seen low before its next rising edge counts. A controller that keeps the request true through the reset therefore cannot trigger a second one, even if the reset sets the signal back to its start value. A request that was low throughout stays ready.
Minimum interval. A request that arrives before Min Interval has passed since the last reset is ignored.
Done pulse. After the reset has run, Signal Reset Done is true for Done Pulse Time. It means that the viewer has reset the twin. It does not mean that a controller has restarted. A reset triggered by a button, the keyboard or the AI bridge does not set the pulse, unless a component also requested it.
Both connection modes. The component works in Simulation mode and in PLC mode, as it reads and writes ordinary signals. The reset does not write to signals that an interface, a binding or a force controls.
If the reset is refused, the request is dropped, a warning appears in the browser console and the Done signal stays false.
Example: PLC handshake
Section titled “Example: PLC handshake”The program requests a reset when the operator presses the key on the real panel, waits for the Done pulse and then withdraws the request. S_ResetReq is linked to Signal Reset and S_ResetDone to Signal Reset Done:
PROGRAM MainVAR_EXTERNAL OpKeyReset : BOOL; (* @signal: S_KeyReset *) ResetReq : BOOL; (* @signal: S_ResetReq *) ResetDone : BOOL; (* @signal: S_ResetDone *)END_VARVAR trig : R_TRIG;END_VAR
trig(CLK := OpKeyReset);IF trig.Q THEN ResetReq := TRUE; // 1. set the requestEND_IF;IF ResetReq AND ResetDone THEN ResetReq := FALSE; // 3. Done seen: clear the requestEND_IF;// 2. between the two steps the twin resets and then pulses ResetDoneEND_PROGRAMClearing the request is what makes the signal low again. The next rising edge then resets the simulation once more.
Quick Start
Section titled “Quick Start”- Create two signals with Quick Edit: a PLC Output Bool for the request, for example
S_ResetReq, and optionally a PLC Input Bool for the feedback, for exampleS_ResetDone. - Add SimulationReset to any node, conventionally the scene root. In the component menu it is listed as Simulation Reset.
- Link Signal Reset to the output signal. Link Signal Reset Done to the input signal if the controller needs the confirmation.
- Leave Min Interval at 1 s and Done Pulse Time at 0.2 s. Raise the pulse time if the controller scans slowly.
- Run the simulation, set the request signal to true, for example by forcing it, and watch the scene return to its start state.
Continuous simulation and DES
Section titled “Continuous simulation and DES”| Continuous simulation | DES (event-driven) | |
|---|---|---|
| Available | Yes | Yes |
| When the request is evaluated | When the signal value reaches the viewer. The reset runs right after the current tick | When the signal value reaches the viewer. The reset runs right after the current evaluation |
| After the reset | The simulation keeps running | The run stops at time 0 and waits for Play, as after any reset in DES |
| Done pulse | Counts down in simulation time, on every tick | Ends on the event clock at the pulse deadline. It does not progress while the run is paused, so after a reset it ends after Play |
| Snapshots | Not affected | Saving or loading a snapshot is refused while the Done pulse is open. Wait until it has ended |
| Switching mode during a pulse | The pulse continues on the new clock | The pulse continues on the new clock |
See also
Section titled “See also”- Operator Panel — a panel button that resets the simulation
- Signals and Logic — signals, logic steps and the Simulation / PLC mode
- Virtual PLC (ST) — the built-in controller, cold-started by every reset
- Drop Detection — another component with a reset signal