Shared transport-layer plumbing for the ADR-029 Train/IL/CTC RBC simulators (TrainRBCSim, ILRBCSim, CTCRBCSim). Extracted from what used to be three separately-duplicated common/ copies inside those projects.
Deliberately scoped to transport-layer mechanics only — TCP/IP session handling, generic envelope byte-packing, generic command-port framing — with zero knowledge of which specific messages/commands any sim actually uses. Each sim's own code is its "application layer," built on top of SimCore, never the other way round.
What's here
- rbc_wire.py — the rbc_envelope_t codec: a byte-verified Python mirror of safeAPIRBC2oo2GP/src/application/rbc_wire.c/.h's wire layout (byte offsets/types) only. It does not name or enumerate what any kind value means — that's each sim's own message_catalog.json's job. If the C codec's wire layout changes, this mirror needs a matching manual update — nothing enforces the two stay in sync automatically.
- dual_link.py — the dual-homed WEST+EAST TCP link: connects to both sites at once, so a site failover is invisible to the sim using it.
- rbc_messages.py — generic catalog-driven encode/decode. A sim's own message_catalog.json is the sole authority on its message names/kind numbers/fields; SimCore only sanity-checks a declared kind is a plausible wire byte (0–255).
- control_server.py — a real TCP/IP control port (ControlServer) each sim wires up with its own dedicated command table (constructor handlers/json_handlers args). SimCore itself defines no commands — Train's, IL's, and CTC's tables all differ.
- sim_config.py — JSON config-file loader (SIM_CONFIG_PATH, default /app/config.json).
- status_report.py, safecomm.py — status-reporting and (future) safe-comms transport helpers shared across the sims.
Using it
Each sim project declares dependencies = ["simcore"] in its own pyproject.toml and resolves this package from dist/ (pip install --find-links ../SimCore/dist simcore) or via Conan (requires = "simcore/0.1.0") — see the root workspace's dist/ convention in ../docs/architecture/MASTER_SPEC.md.
Building
python -m build --outdir dist