RBC_Test_Sim_Core 0.1.0 build 51fd23e
Shared transport-layer plumbing for the ADR-029 Train/IL/CTC RBC simulators
Loading...
Searching...
No Matches
simcore.sai Namespace Reference

Classes

class  SaiError
class  SaiSession

Functions

 _ec_state_from_delta (delta)

Variables

int MSG_EC_START = 0x81
int MSG_EC_DATA = 0x86
int HEADER_LEN = 19
int START_EXTRA_LEN = 6

Detailed Description

SAI - Python mirror of the Safe Application Intermediate sub-layer (Subset-098 v4.0.0 SS5.4),
EC-counter variant. Byte-identical to ``Platform_Protocol_SafeComm`` (``src/sai/sai.c``), the same way
``simcore.saf`` mirrors ``src/saf/saf.c``.

Sits functionally *above* a connected :class:`simcore.saf.SafSession`: it wraps every user PDU in a SAI
header (message type, 16-bit sequence number, EC counter; the Triple-Time-Stamp fields are zeroed - only
EC is implemented, same scope limit as the C module) before handing it to ``SafSession.send_pdu``, and
unwraps/checks it on ``recv_pdu``. This supplies the delay/re-ordering/repetition defence the Safety
Layer's own DT PDU doesn't carry (Subset-037-2 Table 12 has no sequence field at all).

Implements SS5.4.7 (sequence window) and SS5.4.9 (EC counter freshness: the EC-start exchange, the
ratio/Ex bookkeeping, and the Delta-based 0..3 state check). Does NOT implement Triple Time Stamping
(SS5.4.8), the long-term drift correction of SS5.4.9.5, or the separate delay-detection heartbeat of
SS5.4.9.6 - same scope as ``sai.c``; see Platform_Protocol_SafeComm/docs/safety/SUBSET_MAPPING.md.

Function Documentation

◆ _ec_state_from_delta()

_ec_state_from_delta ( delta)
protected
SS5.4.9.4.7: the current EC state depends only on the latest Delta.

Definition at line 33 of file sai.py.

Variable Documentation

◆ HEADER_LEN

int simcore.sai.HEADER_LEN = 19

Definition at line 21 of file sai.py.

◆ MSG_EC_DATA

int simcore.sai.MSG_EC_DATA = 0x86

Definition at line 19 of file sai.py.

◆ MSG_EC_START

int simcore.sai.MSG_EC_START = 0x81

Definition at line 18 of file sai.py.

◆ START_EXTRA_LEN

int simcore.sai.START_EXTRA_LEN = 6

Definition at line 22 of file sai.py.