TwinCore & Coupled Simulation
TwinCore is the deterministic execution engine underlying TwinControl. It expands parametric facility topologies into flat, cache-friendly memory so one host can simulate whole-facility physics, vPLC control scans, and live fieldbus wire traffic together without garbage-collection pauses or separate desktop simulator seats.
Deterministic Execution Model
Conventional plant simulation splits tags across JVM gateways, standalone PLC soft-runtimes, and uncoupled device mock responders—stalling under heap garbage collection or socket exhaustion at facility scale. TwinCore eliminates both bottlenecks through four architectural properties:
- 500,000+ Point Contiguous Facility State: Parametric blueprints expand ahead-of-time into dense, flat typed arrays indexed in constant time, eliminating per-point object allocations and runtime string lookups.
- 10,000+ Multiplexed Protocol Endpoints on One Host: A shared connectivity fabric maps thousands of virtual unit IDs, IP aliases, port bindings, and TLS identities onto shared async I/O loops across 59 symmetric protocol stacks (73 registered protocols) without spawning thousands of OS processes.
- Zero-Allocation Deterministic Lockstep Scans: Steady-state physics, vPLC execution, and wire codecs execute with zero heap allocations on the scan thread, guaranteeing deterministic timing with zero GC stalls.
- Binary RBE Delta Rollups: Report-by-Exception (RBE) encoding transmits only changed points respecting per-point deadbands and computes streaming min/max/sum/mean hierarchy rollups up to rack, row, and facility views.
Multi-Rate Coupled Physics
Real facilities span microsecond electromagnetic switching transients alongside millisecond relay logic and multi-second thermal and hydraulic inertia. TwinCore schedules heterogeneous domain slices on lockstep boundaries—executing electromagnetic transients (EMT) and IEC 61850-9-2LE Sampled Values on microsecond-scale sub-cycle timesteps (for example, 250 µs at 80 samples per 50 Hz cycle) alongside10 ms RMS protection evaluation, 20 ms deterministic vPLC control scans,100 ms liquid-cooling CDU hydraulics, and 1 s ambient thermal loops across shared contiguous point boundaries.
Models are declared inside signed domain and equipment packs using bond graphs, differential-algebraic equations, lookup tables, and sandboxed FMI 3.0 co-simulation FMUs. Because the same contiguous point state feeds both physics solvers and protocol emulators, closing a breaker or tripping a valve alters downstream current, bus voltage, coolant delta-P, and SNMP/Modbus/Redfish register values in the same scan sequence.
Dual-Clock Execution: Real-Time Wall Clock vs Stepped Deterministic Virtual Time
TwinCore executes the exact same compiled facility graph and protocol codecs under two selectable clock modes:
| Clock Mode | Pacing | Primary Engineering Use |
|---|---|---|
| Real-Time Wall Clock | 1× host monotonic time | Hardware-in-the-loop (HIL) benches, physical PLC/relay testing, operator training, and Production Shadow cutover. |
| Stepped Deterministic Virtual Time | 100×+ virtual fast-forward | Automated CI regression sweeps, multi-hour thermal soak tests, and Monte Carlo fault matrices with bit-exact PRNG reproducibility. |
{
"kind": "twinspec",
"node_id": "hall-b2-twin",
"clock_mode": "stepped_deterministic",
"tick_ms": 20,
"source": "scenario hall_b2_cdu_trip { ... }"
}# Run a time-warped simulation on a fork of the live facility twin
twinctl control warp-sim --seconds 120 --open-breaker MV1-Q01 --json
# Verify wire-level protocol conformance and inspect live emulator instances
twinctl emulator conform --plugin vertiv-xdu-cdu
twinctl emulator instances --api-url http://127.0.0.1:8080Seeded Fault Injection & COMTRADE Replay
Every fault campaign accepts an explicit PRNG seed so failures reproduce bit-for-bit across developer workstations and CI runners. TwinCore injects faults across four orthogonal layers:
- Wire Protocol Faults: Deterministic packet loss, frame corruption, timing jitter, out-of-order delivery, and link severance across all 73 registered protocols.
- Physical Process Faults: Stuck valves, coolant leaks, pump trips, breaker fail-to-open, battery string degradation, and synchronised AI training load steps.
- Sensor & Telemetry Faults: Calibration drift, frozen registers, open-circuit transducer scaling, and quality-bit degradation (
Good,Uncertain,Bad). - Controller & COMTRADE Replay: Scan overruns, I/O forcing conflicts, and
IEEE C37.111COMTRADE disturbance waveform injection directly into emulated or HIL protection bays.
Virtual FAT/SAT Scorecards & API
Scenarios evaluate declarative acceptance invariants—such as bus voltage ride-through limits, CDU supply temperature ceilings, breaker clearing order, and alarm flood bounds—producing machine-verifiable scorecards withPassed, Failed, or N/A verdicts. Verified scorecards attach directly to the project's Commissioning Handover Dossier before equipment reaches site.
/api/v1/vplc/emulate/scenariosBearer tokenList scenario presets declared by active licensed PLC packs.
Returns pack-declared scenario identifiers, descriptions, source pack identifiers, and per-device telemetry overrides.
Response
{
"scenarios": [
{
"id": "overcurrent_trip",
"label": "Overcurrent Trip",
"description": "Protection relay trip with open breaker and fault current cleared",
"packIds": ["com.twinctl.plc.abb-ac500"],
"overrides": {
"ac500-sub-01": {
"bus_kv": 0.0,
"feeder_current_a": 0.0,
"breaker_closed": false,
"relay_trip": true
}
}
}
]
}/api/v1/vplc/emulate/scenarioBearer tokenApply a licensed scenario preset or point overrides onto emulated devices.
Applies a pack-declared scenarioId preset and/or custom per-device overrides onto running or staged emulated devices and returns the updated device telemetry.
| Parameter | In | Type | Description |
|---|---|---|---|
instanceId | body | string | Target vPLC instance identifier (defaults to vplc-local-0). |
scenarioId | body | string | Identifier of the licensed .twinpack scenario preset to apply. |
overrides | body | object | Optional per-device point overrides merged over preset telemetry. |
Request body
{
"instanceId": "vplc-local-0",
"scenarioId": "overcurrent_trip",
"overrides": {
"ac500-sub-01": {
"feeder_current_a": 0.0
}
}
}Response
{
"instanceId": "vplc-local-0",
"scenarioId": "overcurrent_trip",
"label": "Overcurrent Trip",
"description": "Protection relay trip with open breaker and fault current cleared",
"appliedCount": 1,
"devices": [],
"telemetry": {
"ac500-sub-01": {
"bus_kv": 0.0,
"feeder_current_a": 0.0,
"breaker_closed": false,
"relay_trip": true
}
}
}
