Documentation menu

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.
TwinControl Studio — TwinCode & Running vPLC Fleet/control · TwinCode IDE
TwinControl Studio TwinCode IDE showing running vPLC fleet instance vplc-local-0, a 20 ms scan period, 18 licensed PLC packs, and IEC 61131-3 Structured Text program HallB2_CDU_RideThrough in hall_b2_cdu_ridethrough.st
TwinCode IDE running IEC 61131-3 Structured Text program HallB2_CDU_RideThrough (hall_b2_cdu_ridethrough.st) on vPLC fleet instance vplc-local-0 at a 20 ms scan period across 18 licensed PLC packs.

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 ModePacingPrimary Engineering Use
Real-Time Wall Clock1× host monotonic timeHardware-in-the-loop (HIL) benches, physical PLC/relay testing, operator training, and Production Shadow cutover.
Stepped Deterministic Virtual Time100×+ virtual fast-forwardAutomated 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 { ... }"
}

Seeded 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.111 COMTRADE disturbance waveform injection directly into emulated or HIL protection bays.
TwinControl Studio — Combined-Cycle 400 kV Commissioning/commission · Light Engineering
TwinControl Studio Commission workbench for Combined-Cycle 400 kV Station showing L3 and L4 procedures, Rehearse on Twin action, canonical asset identifier field, and Telemetry & Residuals and deterministic engineering checks tabs
TwinCommission displaying L3/L4 breaker and bus procedures, Rehearse on Twin action, Telemetry & Residuals, and deterministic engineering checks tabs.

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.

GET/api/v1/vplc/emulate/scenariosBearer token

List 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
        }
      }
    }
  ]
}
POST/api/v1/vplc/emulate/scenarioBearer token

Apply 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.

ParameterInTypeDescription
instanceIdbodystringTarget vPLC instance identifier (defaults to vplc-local-0).
scenarioIdbodystringIdentifier of the licensed .twinpack scenario preset to apply.
overridesbodyobjectOptional 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
    }
  }
}