RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Loading...
Searching...
No Matches
ab_gp_proc_shunting.h File Reference

ERTMS Subset-026 5.6 Shunting initiated by driver (Level 2). More...

Include dependency graph for ab_gp_proc_shunting.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  ab_gp_shunting_decision_t {
  AB_GP_SHUNTING_AUTHORISED = 0 , AB_GP_SHUNTING_REFUSED_NO_SESSION , AB_GP_SHUNTING_REFUSED_NOT_AT_STANDSTILL , AB_GP_SHUNTING_REFUSED_SESSION_STATE ,
  AB_GP_SHUNTING_REFUSED_BY_GA , AB_GP_SHUNTING_REFUSED_INVALID
}

Functions

bool ab_gp_proc_shunting_request (ab_gp_ertms_train_context_t *ctx)
 Handles inbound Shunting Request (Msg 130).
bool ab_gp_proc_shunting_authorize (ab_gp_ertms_train_context_t *ctx, bool authorized)
 Authorizes or rejects shunting mode for the train.
ab_gp_shunting_decision_t ab_gp_proc_shunting_handle_request (ab_gp_ertms_train_context_t *ctx, uint8_t train_id, uint32_t v_train_kmh)
 Decides one Msg 130 Request for Shunting and applies the outcome.
bool ab_gp_proc_shunting_build_reply (ab_gp_shunting_decision_t decision, rbc_timestamp_ms_t t_train_reply, rbc_timestamp_ms_t t_train_request, rbc_nid_lrbg_t nid_lrbg, rbc_train_outbound_msg_t *out)
 Builds the answer to a Msg 130: Msg 28 SH Authorised or Msg 27 SH Refused.
const char * ab_gp_proc_shunting_decision_name (ab_gp_shunting_decision_t decision)

Detailed Description

ERTMS Subset-026 5.6 Shunting initiated by driver (Level 2).

Implements SIL 4 C99 shunting mode request handling (Msg 130) and shunting authorization state transitions. The train sends Msg 130 Request for Shunting with a position report; the RBC answers Msg 28 SH Authorised or Msg 27 SH Refused. The decision and the reply are built here, without a channel, so both are unit-testable; ab_gp_proc_dispatch.c stages the reply.

Definition in file ab_gp_proc_shunting.h.

Enumeration Type Documentation

◆ ab_gp_shunting_decision_t

Outcome of one Msg 130 Request for Shunting.

Enumerator
AB_GP_SHUNTING_AUTHORISED 

Msg 28 - session is (now) SHUNTING.

AB_GP_SHUNTING_REFUSED_NO_SESSION 

No established communication session.

AB_GP_SHUNTING_REFUSED_NOT_AT_STANDSTILL 

Reported V_TRAIN is not 0.

AB_GP_SHUNTING_REFUSED_SESSION_STATE 

Session state does not allow SH (e.g. emergency stop).

AB_GP_SHUNTING_REFUSED_BY_GA 

A GA validator refused, or none is registered.

AB_GP_SHUNTING_REFUSED_INVALID 

NULL context.

Definition at line 23 of file ab_gp_proc_shunting.h.

Function Documentation

◆ ab_gp_proc_shunting_request()

bool ab_gp_proc_shunting_request ( ab_gp_ertms_train_context_t * ctx)

Handles inbound Shunting Request (Msg 130).

Parameters
[in,out]ctxTrain ERTMS context.
Returns
true if request registered, false otherwise.

Definition at line 13 of file ab_gp_proc_shunting.c.

◆ ab_gp_proc_shunting_authorize()

bool ab_gp_proc_shunting_authorize ( ab_gp_ertms_train_context_t * ctx,
bool authorized )

Authorizes or rejects shunting mode for the train.

Parameters
[in,out]ctxTrain ERTMS context.
[in]authorizedTrue = Grant shunting authority, False = Reject.
Returns
true if state transition applied, false otherwise.

Definition at line 24 of file ab_gp_proc_shunting.c.

◆ ab_gp_proc_shunting_handle_request()

ab_gp_shunting_decision_t ab_gp_proc_shunting_handle_request ( ab_gp_ertms_train_context_t * ctx,
uint8_t train_id,
uint32_t v_train_kmh )

Decides one Msg 130 Request for Shunting and applies the outcome.

Checks, in order: an established session (not IDLE / INITIATED), standstill (v_train_kmh == 0), a session state that allows SHUNTING_AUTHORIZED, and every GA shunting validator (ab_gp_logic_shunting_allowed(), default-deny). On approval the session moves to SHUNTING. A refusal changes no state: a train already in SHUNTING is never taken out of it by a refused request, and a repeated request while already SHUNTING is answered as authorised. Depends only on replicated state, so channels A and B decide identically.

Parameters
[in,out]ctxTrain ERTMS context.
[in]train_idTrain slot (1..RTE_EXAMPLE_MAX_TRAINS), passed to GA.
[in]v_train_kmhV_TRAIN from the Msg 130 position report.
Returns
The decision; AB_GP_SHUNTING_AUTHORISED only if the session is SHUNTING.

Definition at line 61 of file ab_gp_proc_shunting.c.

◆ ab_gp_proc_shunting_build_reply()

bool ab_gp_proc_shunting_build_reply ( ab_gp_shunting_decision_t decision,
rbc_timestamp_ms_t t_train_reply,
rbc_timestamp_ms_t t_train_request,
rbc_nid_lrbg_t nid_lrbg,
rbc_train_outbound_msg_t * out )

Builds the answer to a Msg 130: Msg 28 SH Authorised or Msg 27 SH Refused.

Parameters
[in]decisionResult of ab_gp_proc_shunting_handle_request().
[in]t_train_replyT_TRAIN of the reply header (the train's own time stamp, see the dispatcher).
[in]t_train_requestT_TRAIN of the Msg 130 being answered (carried by Msg 27 and Msg 28).
[in]nid_lrbgLRBG reported in the Msg 130 position report.
[out]outOutbound message, fully overwritten. Must not be NULL.
Returns
false if out is NULL.

Definition at line 112 of file ab_gp_proc_shunting.c.

◆ ab_gp_proc_shunting_decision_name()

const char * ab_gp_proc_shunting_decision_name ( ab_gp_shunting_decision_t decision)
Returns
A short name for logs ("AUTHORISED", "NOT_AT_STANDSTILL", ...).

Definition at line 143 of file ab_gp_proc_shunting.c.