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.SaiSession Class Reference

Public Member Functions

 __init__ (self, saf_session, ec_period_ms, *, seq_window=1, ec_alarm_state=3)
 start (self)
 send (self, pdu)
 recv (self)
 tick (self)

Public Attributes

 saf = saf_session
 ec_period_ms = ec_period_ms
int seq_window = seq_window or 1
int ec_alarm_state = ec_alarm_state or 3
int seq_tx = 0
int seq_rx = 0
bool seq_rx_valid = False
int ec_tx = 0
int peer_ec_period_ms = None
int ratio = None
int expected_ec = None
int last_rx_ec = 0
bool ec_initialized = False
int ec_state = 0

Protected Member Functions

 _header (self, msg_type, seq, ec)

Detailed Description

One SAI connection, layered over an already-connected :class:`simcore.saf.SafSession`.

``ec_period_ms`` is this side's own EC (execution cycle) period. ``seq_window`` is N of SS5.4.7 (up
to ``seq_window - 1`` missing messages tolerated; default 1, no gaps allowed). ``ec_alarm_state`` is
the Delta at/above which freshness fails (default 3, matching the spec's own worked example).

Definition at line 44 of file sai.py.

Constructor & Destructor Documentation

◆ __init__()

simcore.sai.SaiSession.__init__ ( self,
saf_session,
ec_period_ms,
* ,
seq_window = 1,
ec_alarm_state = 3 )

Definition at line 52 of file sai.py.

Member Function Documentation

◆ _header()

simcore.sai.SaiSession._header ( self,
msg_type,
seq,
ec )
protected

Definition at line 71 of file sai.py.

◆ recv()

simcore.sai.SaiSession.recv ( self)
Receive, unwrap and check one SAI-protected PDU. Raises :class:`SaiError`.

Definition at line 108 of file sai.py.

◆ send()

simcore.sai.SaiSession.send ( self,
pdu )

Definition at line 103 of file sai.py.

◆ start()

simcore.sai.SaiSession.start ( self)
Run the EC initialisation exchange (SS5.4.9.3): send our ExecutionCycleStart, wait for the
peer's, and compute the EC ratio. ``self.saf`` must already be in DATA (its own handshake done).

Definition at line 74 of file sai.py.

◆ tick()

simcore.sai.SaiSession.tick ( self)
Advance our own EC by one: call this once per ``ec_period_ms`` elapsed on the caller's clock.
Updates the expected-EC estimate and the freshness state (SS5.4.9.4.4-7), reporting the state
computed BEFORE advancing Ex for the next cycle (so the first tick after a fresh receive is 0).

Definition at line 136 of file sai.py.

Member Data Documentation

◆ ec_alarm_state

int simcore.sai.SaiSession.ec_alarm_state = ec_alarm_state or 3

Definition at line 58 of file sai.py.

◆ ec_initialized

bool simcore.sai.SaiSession.ec_initialized = False

Definition at line 68 of file sai.py.

◆ ec_period_ms

simcore.sai.SaiSession.ec_period_ms = ec_period_ms

Definition at line 56 of file sai.py.

◆ ec_state

int simcore.sai.SaiSession.ec_state = 0

Definition at line 69 of file sai.py.

◆ ec_tx

int simcore.sai.SaiSession.ec_tx = 0

Definition at line 63 of file sai.py.

◆ expected_ec

int simcore.sai.SaiSession.expected_ec = None

Definition at line 66 of file sai.py.

◆ last_rx_ec

int simcore.sai.SaiSession.last_rx_ec = 0

Definition at line 67 of file sai.py.

◆ peer_ec_period_ms

int simcore.sai.SaiSession.peer_ec_period_ms = None

Definition at line 64 of file sai.py.

◆ ratio

int simcore.sai.SaiSession.ratio = None

Definition at line 65 of file sai.py.

◆ saf

simcore.sai.SaiSession.saf = saf_session

Definition at line 55 of file sai.py.

◆ seq_rx

int simcore.sai.SaiSession.seq_rx = 0

Definition at line 61 of file sai.py.

◆ seq_rx_valid

bool simcore.sai.SaiSession.seq_rx_valid = False

Definition at line 62 of file sai.py.

◆ seq_tx

int simcore.sai.SaiSession.seq_tx = 0

Definition at line 60 of file sai.py.

◆ seq_window

int simcore.sai.SaiSession.seq_window = seq_window or 1

Definition at line 57 of file sai.py.


The documentation for this class was generated from the following file: