CTCRBCSim
ADR-029 CTC simulator — receive-only observer of train-connected/MA indications
Loading...
Searching...
No Matches
ctc.ctc_sim Namespace Reference

Functions

 _is_keepalive (data)
 main ()

Variables

 CATALOG = MessageCatalog(os.path.join(os.path.dirname(os.path.abspath(__file__)), "message_catalog.json"))
int _RELAY_KEEPALIVE_KIND = 9
dict _ALARM_SEVERITY_LOG = {0: logging.INFO, 1: logging.WARNING, 2: logging.ERROR}
dict _ALARM_SEVERITY_NAME = {0: "INFO", 1: "WARNING", 2: "ERROR"}

Detailed Description

CTC (Centralized Traffic Control) sim (ADR-029) - a real, dual-homed
TCP client. A single instance oversees both sites (unlike train/il, which
run one pair per train slot) - dual-homed to both sites' CTC port the
same way train_sim.py/il_sim.py are (see dual_link.py's own header),
receive-only: this scenario never has CTC send anything back to the RBC,
it only observes the one-way status pushes (train connected/MA granted/
MA extended) and logs them, tagged by train_id.

Configuration: one JSON file (common/sim_config.py, SIM_CONFIG_PATH env
var, default /app/config.json) - rbcWest/rbcEast and controlServer only
(no trainIndex - CTC is not per-train). See config/ctc.json, right next
to this script. Message vocabulary comes from message_catalog.json, also
right next to this script.

Commands (controlServer.port, config file - see common/control_server.py):
  PING   Replies "PONG\\n" - liveness check.

Structured JSON commands (tests/robot/design/DESIGN.md,
SIM_INTERFACES.md - same port, see common/control_server.py's own doc).
No sendMessage - CTC never transmits in this scenario:
  getMessage   {"cmd":"getMessage","nidEngine":N,"message":"CTC_MA_GRANTED"}
               Returns the most recently received indication of that
               kind concerning train nidEngine, or an ERR if none has
               arrived yet.

Function Documentation

◆ _is_keepalive()

_is_keepalive ( data)
protected

Definition at line 54 of file ctc_sim.py.

◆ main()

main ( )

Definition at line 58 of file ctc_sim.py.

Variable Documentation

◆ _ALARM_SEVERITY_LOG

dict ctc.ctc_sim._ALARM_SEVERITY_LOG = {0: logging.INFO, 1: logging.WARNING, 2: logging.ERROR}
protected

Definition at line 50 of file ctc_sim.py.

◆ _ALARM_SEVERITY_NAME

dict ctc.ctc_sim._ALARM_SEVERITY_NAME = {0: "INFO", 1: "WARNING", 2: "ERROR"}
protected

Definition at line 51 of file ctc_sim.py.

◆ _RELAY_KEEPALIVE_KIND

int ctc.ctc_sim._RELAY_KEEPALIVE_KIND = 9
protected

Definition at line 44 of file ctc_sim.py.

◆ CATALOG

ctc.ctc_sim.CATALOG = MessageCatalog(os.path.join(os.path.dirname(os.path.abspath(__file__)), "message_catalog.json"))

Definition at line 41 of file ctc_sim.py.