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.c File Reference

Implementation of ERTMS Subset-026 5.6 Shunting initiated by driver. More...

#include "ab_gp_proc_shunting.h"
#include "../state_machines/ab_gp_dispatch.h"
#include "../state_machines/session/ab_gp_session_fsm.h"
#include "../ma_logic/ab_gp_logic.h"
#include "rte/oal/memory/rte_mem_util.h"
Include dependency graph for ab_gp_proc_shunting.c:

Go to the source code of this file.

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

Implementation of ERTMS Subset-026 5.6 Shunting initiated by driver.

Definition in file ab_gp_proc_shunting.c.

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.