|
SAPI
Workspace master specification — safety-related railway software around an ERTMS Radio Block Centre (RBC), CENELEC EN 50128 / SIL 4
|
What SAPI is, how its subsystems fit together, and the safety posture that shapes those boundaries. This is the workspace's own architecture overview — each subsystem's own docs (linked throughout) are the source of truth for its internals; this document exists to describe the concept that holds them together and should not drift into re-describing what a subsystem's own README/ADRs already say better.
A collection of independently-versioned projects that together let you build, simulate, and test a redundant ERTMS Radio Block Centre (RBC): a 2oo2 (two-out-of-two) voting pair of vital channels, a non-vital gateway concentrating external traffic, the safety-oriented OS abstraction layer underneath all of it, and a full simulated environment (train, interlocking, CTC) to exercise the whole system without real trackside hardware. The core C/C++ code targets CENELEC EN 50128 / SIL 4 rigor (MISRA C:2012); the Python simulation and test tooling does not — it exists to exercise the SIL4 code, not to carry that rating itself.
Dependency direction is one-way and never reverses: safeAPIRBC2oo2GP depends on safeAPIFreamwork/safeAPIBackendPosix/safeAPIRBC2oo2GA/safeAPIRBC2oo2SA; the three sims depend on SimCore; nothing upstream ever depends on something downstream. A change in a depended-on project that breaks a consumer is the consumer's problem to absorb, not the other way round. The one deliberate exception is safeCommFreamwork's stated design: nothing in it depends on safeAPIRBC2oo2* — a future revision of safeAPIRBC2oo2GP's transport code would consume it, not vice versa.
Every C project installs to its own dist/<platform>/; every Python project builds a wheel into its own dist/. A downstream project consumes either via the plain mechanism (find_package() for C, pip install --find-links for Python — zero extra tooling) or via Conan (conan create . / requires = "...", one shared cache and real version resolution across the whole workspace). Both paths are kept working simultaneously; a Conan-only feature is a regression against the plain path and vice versa. See each subsystem's own CLAUDE.md "dist/ convention" section for its exact install layout.
| Tier | Subsystems | Posture |
|---|---|---|
| Vital, SIL 4 | safeAPIFreamwork, safeAPIRBC2oo2GP/GA/SA (the A/B channel code paths), safeCommFreamwork's safecomm::safety/safecomm::cfm | MISRA C:2012, EN 50128 lifecycle discipline, no dynamic memory, full Doxygen traceability to docs/requirements/SRS.md per project. |
| Non-vital, safety-adjacent | safeAPIRBC2oo2GP's role-C Gateway paths, safeCommFreamwork's safecomm::ale/safecomm::config, CommServer | C99, careful but not SIL-rated — a fault here can drop or misroute a connection, never forge a vital decision, because the vital side independently verifies everything it receives (e.g. the EuroRadio MAC — see safeCommFreamwork/docs/architecture/ADR-002-stack-and-deployment.md §3). |
| Tooling, not safety-rated | SimCore, TrainRBCSim, ILRBCSim, CTCRBCSim, safeAPIRBC2oo2TestEnv, the four toolchain projects | Test/simulation/build infrastructure. Do not apply MISRA/EN 50128 rules here — each states its own (much lighter) conventions. |
This split is why CommServer and the Gateway ALE (safecomm::ale) can be developed and iterated on quickly while the vital core stays under heavier process: they carry bytes they cannot authenticate or alter undetectably, so a bug in them degrades to a safe supervision-timeout, never a false permissive signal.
safeCommFreamwork is the newest addition to the vital stack: it implements the ERTMS/ETCS Subset-037 (EuroRadio, EVC↔RBC) and Subset-098 (RBC↔RBC) safe-communication layers as a library safeAPIRBC2oo2GP will eventually link, replacing today's unauthenticated plain TCP. CommServer is the non-vital access point in front of it — today a plain-TCP stub standing in for the real ISDN/FRMCS train-facing bearer. See safeCommFreamwork/docs/architecture/ADR-002-stack-and-deployment.md for the full stack diagram and ADR-003-protocol-detail-and-build-out.md for the wire-level design and phased build-out plan; both projects are pre-integration today (safeCommFreamwork is a skeleton, CommServer speaks plain TCP with no SFM authentication yet).
Every subsystem is documented in Doxygen and published under this repository's single GitHub Pages site, https://bula173.github.io/SAPI/:
See each subsystem's own README (linked from the root README.md) for its build/test/run instructions — this document does not duplicate them.