ILRBCSim
ADR-029 Interlocking simulator — grants/extends Movement Authority against the RBC wire protocol
Loading...
Searching...
No Matches
il.site_data Namespace Reference

Functions

 routes (railml_path=None)

Variables

str _RAILML_NS = "https://www.railml.org/schemas/3.3"
str _SAPI_NS = "https://safeapirbc2oo2.example/schemas/sapi-ext/1"
dict _NS = {"r": _RAILML_NS, "sapi": _SAPI_NS}
 _WORKSPACE_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", ".."))
 DEFAULT_RAILML_PATH = os.path.join(_WORKSPACE_ROOT, "safeAPIRBC2oo2SA", "etc", "site", "ab_site.railml.xml")

Detailed Description

site_data.py - IL sim's own tiny RailML reader.

Independently re-parses safeAPIRBC2oo2SA/etc/site/ab_site.railml.xml -
see TrainRBCSim/src/train/site_data.py's own header for the full "why a
FOURTH independent reader, not a shared library call" rationale (matches
the no-pipeline-coupling convention safeAPIRBC2oo2GP's/GA's own RailML
generators already established).

Unlike Train's own reader, this is genuinely NEW ground for IL - today's
il_sim.py hardcodes no route data at all (every ROUTE_ADD's own
start_signal/end_signal/route_len is entirely test/command-supplied, see
that file's own header doc). This module gives IL its own real route
table (id/name/start_signal/end_signal/length_m), the same shape
safeAPIRBC2oo2GA/etc/scripts/generate_ab_site_ga.py's own
ab_site_ga_route_layout_t table already carries and the SAME positional-
id convention it uses (route/signal ids assigned by RailML document
order, not parsed from the element's own @id string) - so a route id
this module reports lines up numerically with what GP/GA's own C code
means by that same id.

Function Documentation

◆ routes()

routes ( railml_path = None)
@return a list of {"id", "name", "start_signal", "end_signal",
"length_m"} dicts, one per <route>, ordered and id-numbered exactly
the way generate_ab_site_ga.py's own parse_railml() derives them
(signal/route ids by document-order position, length_m read directly
from each route's own sapi:routeDescription/@lengthM extension - no
segment-length summation needed, that field is already explicit).
Raises on a genuinely missing/malformed RailML file - unlike Train's
balise_names() (a pure log-decoration convenience), a route table
this sim doesn't have at all today is real, load-bearing IL data
(this is what Phase D's own periodic route-status broadcast iterates
over) - a silent empty-table fallback here would make IL announce
"there are zero routes," which is materially wrong, not just
cosmetically incomplete like a missing balise name would be.

Definition at line 37 of file site_data.py.

Variable Documentation

◆ _NS

dict il.site_data._NS = {"r": _RAILML_NS, "sapi": _SAPI_NS}
protected

Definition at line 28 of file site_data.py.

◆ _RAILML_NS

str il.site_data._RAILML_NS = "https://www.railml.org/schemas/3.3"
protected

Definition at line 26 of file site_data.py.

◆ _SAPI_NS

str il.site_data._SAPI_NS = "https://safeapirbc2oo2.example/schemas/sapi-ext/1"
protected

Definition at line 27 of file site_data.py.

◆ _WORKSPACE_ROOT

il.site_data._WORKSPACE_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", ".."))
protected

Definition at line 33 of file site_data.py.

◆ DEFAULT_RAILML_PATH

il.site_data.DEFAULT_RAILML_PATH = os.path.join(_WORKSPACE_ROOT, "safeAPIRBC2oo2SA", "etc", "site", "ab_site.railml.xml")

Definition at line 34 of file site_data.py.