Overcoming Simulation Freezing to Restart SIMIT Simulations via External Boolean Signals
In SIMIT Simulation Platform, placing the simulation into a Paused state halts cyclical diagram execution, meaning internal components (such as the standard 'Simulation Control' block) cease executing equations and cannot detect a local boolean trigger to resume operation. To restart or resume a paused SIMIT simulation using an external boolean signal (such as from an OPC DA coupling, S7 coupling, or external supervisory script), you must evaluate the signal outside the frozen simulation time slice. This is achieved by deploying an external supervisory automation client using the SIMIT Remote Control / COM API (Siemens.Simit.Api.RemoteControl) or by utilizing an asynchronous external coupling that monitors the trigger tag and issues the 'Simulation.Resume()' or 'Simulation.Start()' API call.
Table of Contents
- Executive Summary
- Architecture and Fundamental Mechanics
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
In automated testing, virtual commissioning, and automated regression testing suites, engineers frequently need to pause and resume SIMIT simulations dynamically based on test sequence events, batch recipe transitions, or external triggers. SIMIT provides standard internal components such as the 'Simulation Control' block, which allows chart logic to pause or terminate the simulation based on an internal condition. However, engineers frequently encounter an architectural paradox: once the simulation is paused, the internal diagram stops executing, freezing all internal logic and preventing the 'Simulation Control' block from ever evaluating a subsequent restart or resume trigger.
When attempting to restart a paused simulation using a boolean signal originating from an external coupling (such as OPC DA or S7 communication), the internal chart cannot process the incoming value because the simulation time slice is suspended. This guide explains the fundamental execution mechanics of SIMIT's simulation kernel, details why internal pause logic creates an unrecoverable frozen state for internal components, and provides a production-proven architecture using the SIMIT Remote Control API to monitor external signals asynchronously and command simulation lifecycle transitions.
Architecture and Fundamental Mechanics
The SIMIT simulation kernel processes simulation diagrams within discrete cyclical time slices (typically configured between 10 ms and 100 ms). During each cycle, the kernel executes a deterministic four-phase sequence:
1. Input Acquisition: Reads values from active couplings (OPC DA, PROFINET IO, Shared Memory, Virtual Controller).
2. Component Execution: Calculates mathematical equations and state transitions across all component instances within the active charts.
3. Output Dispatch: Transmits updated output values back to couplings.
4. Time Advancement: Advances internal simulation time _sim_time by the time step _dt.
When a pause command is triggered via the internal 'Simulation Control' component (Action = Pause):
* The SIMIT kernel immediately suspends cyclical time advancement (_sim_time stops).
* The execution pipeline is halted: component equations are no longer evaluated.
* While asynchronous communication drivers (like OPC DA servers) may continue to update underlying shared memory buffers, the SIMIT diagram execution engine does not dispatch or evaluate these values within component logic.
* Consequently, any condition tied to a resume input on an internal component will never be evaluated, resulting in a permanent simulation freeze.
Architectural Solution: To control the simulation lifecycle dynamically, the supervisory trigger must reside in an external supervisory process operating outside the simulation time loop. The SIMIT Remote Control interface (Siemens.Simit.Api.RemoteControl) exposes an out-of-process COM/RPC interface that operates asynchronously relative to the simulation calculation engine. An external monitoring script or service polls the external trigger (or subscribes to OPC DA events) and invokes Simulation.Resume() or Simulation.Start(), which directly signals the SIMIT kernel to re-enter the cyclical execution pipeline.
Step-by-Step Implementation Procedure
Step 1: Architect the Asynchronous Trigger Architecture
- Recognize that internal SIMIT diagram logic cannot resume a paused simulation.
- Designate an external supervisory mechanism—such as a lightweight C# service, PowerShell script, or external test manager—to supervise simulation lifecycle states.
Step 2: Establish the SIMIT Remote Control API Reference
- In your external automation or test tool project (e.g., Visual Studio C# or PowerShell environment), add a reference to the SIMIT Remote Control assembly:
*C:\Program Files (x86)\Siemens\Automation\SIMIT\SIMIT SF\bin\Siemens.Simit.Api.RemoteControl.dll
Step 3: Implement the External Monitor and Resume Logic
- Implement a supervisory controller that connects to SIMIT via Remote Control and monitors the external trigger tag:
```csharp
using System;
using System.Threading;
using Siemens.Simit.Api.RemoteControl;
public class SimitLifecycleController
{
public static void Main(string[] args)
{
// Connect to active SIMIT instance
using (var simit = SimitRemoteControl.Connect())
{
var simulation = simit.ActiveProject.Simulation;
Console.WriteLine("Connected to SIMIT. Monitoring external resume trigger...");
while (true)
{
// Poll external trigger tag or listen to OPC DA event
if (simulation.State == SimulationState.Paused)
{
bool resumeRequested = CheckExternalResumeTrigger();
if (resumeRequested)
{
Console.WriteLine("Resume trigger detected! Resuming simulation...");
simulation.Resume();
}
}
Thread.Sleep(100); // 100ms asynchronous polling
}
}
}
private static bool CheckExternalResumeTrigger()
{
// Connect to OPC DA or read external boolean tag
return ReadOpcDaBooleanTag("TestControl.ResumeSimulation");
}
}
```
Step 4: Configure SIMIT Simulation Control Component for Safe Pausing
- In your SIMIT project diagram, use the standard 'Simulation Control' component ONLY to initiate the pause condition (e.g., when a specific test step completes or a safety interlock trips).
- Set the component action to
Pause. - Do not attempt to wire restart or resume logic into this component inside the diagram.
Step 5: Test and Validate the Automated Lifecycle Cycle
- Launch SIMIT and open the simulation project.
- Start the simulation runtime in SIMIT.
- Start the external
SimitLifecycleControllerprocess. - Trigger the pause condition in the simulation and verify that SIMIT transitions to the Paused state.
- Assert the external boolean signal on the OPC DA server and confirm that the external controller commands
simulation.Resume(), returning SIMIT to active execution.
Verification
- In SIMIT, observe the simulation status bar: verify the status indicator shows 'Running' and simulation time increments.
- Trigger the internal pause condition: verify that the status indicator changes to 'Paused' and time stops.
- In the external OPC DA client, toggle the boolean tag
TestControl.ResumeSimulationfrom0to1. - Observe the SIMIT runtime window: within 200 ms, verify the status bar returns to 'Running' and simulation time resumes advancing.
- Inspect connected PLC or S7-PLCSIM signals to verify that process values resume continuous cyclic updating without initialization bumps.
Limitations and Operational Precautions
- While paused, communication watchdogs on connected physical PLCs or field devices may timeout if heartbeat frames are not maintained by the coupling hardware.
- SIMIT Remote Control API requires an active SIMIT installation and appropriate software licensing on the executing workstation.
- High polling frequencies in external supervisory scripts (less than 10 ms) may consume excessive CPU resources; a polling interval of 50 ms to 100 ms is recommended.
- If using OPC DA for the resume trigger, ensure the OPC server operates out-of-process so it continues serving tag reads/writes while SIMIT is paused.
Engineer FAQ
Why can't an internal SIMIT chart component resume a paused simulation?
When SIMIT pauses, the cyclical execution of all chart components is completely frozen. Because component logic is not executed, the block cannot detect that an input signal has changed state.
Can I slow down the simulation instead of pausing it?
Yes. Rather than pausing, you can use the SIMIT Remote Control API or simulation settings to reduce the execution speed factor (e.g., 0.1x real-time), allowing logic to continue running slowly.
Does SIMIT have an automated scripting interface for testing without writing C# code?
Yes. SIMIT provides an integrated 'Automatic model execution' and script editor using SIMIT Script, which can sequence simulation start, pause, resume, and stop actions.
Can I restart the simulation from the beginning using an external signal?
Yes. The SIMIT Remote Control API provides the simulation.Reset() and simulation.Start() methods, which re-initialize all model states to their initial values.
Do I need an additional license to use the SIMIT Remote Control API?
The Remote Control API is included with SIMIT engineering packages. However, executing simulations requires a valid SIMIT runtime license. For licensing details, consult an authorized Siemens distributor or the Siemens Industry Mall.
Technical References
- SIMATIC SIMIT Simulation Platform Operating Manual (Entry ID: 109780811)
- SIMATIC SIMIT Remote Control Interface and API Reference (Entry ID: 109758814)
- OPC Data Access Custom Interface Specification V3.0 (OPC Foundation)
Related Articles
- Controlling Pause and Resume of SIMIT Simulations via External Boolean Signals
- Resolving Distributed Simulation Synchronization and Inter-VC Communication Faults in SIMIT 10.2
- Simulating PROFIdrive Telegrams and State Machines in SIMIT Component Type Editor
Related Tags
- SIMIT Simulation
- Remote Control API
- Simulation Lifecycle
- OPC DA
- Automated Testing