This section describes the formal Event-B model development of a cyber-physical railway signalling. First, the section revisits our previous work [
31] on a formal development of the hybrid Event-B model of the rolling stock model for which we used hybridised Event-B (described in Section
2.2). The following section describes the Event-B model of a cyber-physical railway signalling system that was developed by refining of the hybrid rolling stock Event-B model. The refined Event-B model formally models other signalling sub-systems (e.g., communication centres, interlocking boxes), infrastructure elements and a signalling communication protocol. In this refinement level, we prove that the issued movement authority distance to rolling stock is ensures safe rolling stock separation and prevents derailment.
15.1 Event-B Model of a Cyber-physical Railway Signalling System: Rolling Stock
The train speed controller controls the engine power (\(f\)) of the train, depending on its status (position, speed, acceleration) and, in particular, its distance to the \(\mathsf {EoA}\).
The train speed controller has two modes: \(\mathsf {free \; mode}\) and \(\mathsf {restricted \; mode}\). If the stopping distance (plus a safety offset) of the train is shorter than \(\mathsf {EoA}\), then the train is said to be in \(\mathsf {free \; mode}\) and it can choose arbitrary values for \(\mathsf {f}\). Whenever the stopping distance (\(\mathsf {+offset}\)) of the train becomes greater than \(\mathsf {EoA}\), the train enters \(\mathsf {restricted \; mode}\), and the controller is required to provide values for \(\mathsf {f}\) such that it can stop before \(\mathsf {EoA}\).
The train speed controller hybrid automaton model is visualised in Figure
8. In the following sections, we present a formal Event-B implementation of the informally presented hybrid signalling model.
5.1.1 Train Domain Theory.
Common properties of the train are gathered in the
Train domain theory, an extract of which is given in Listing
6. This theory mainly defines the
Davis equation (
\(\mathsf {DavisEquation}\)) of coefficient
\(a\),
\(b\), and
\(c\) and for a traction force of
\(f\), with initial condition
\(p(t_0) = p_0\) and
\(v(t_0) = v_0\). This equation corresponds to Equation (
1).
The theory also defines a few properties, that are useful when proving the models. In particular, a theorem is given that allows to deduce solvability of the Davis equation, which is crucial in establishing that the dynamics of the system are always feasible.
5.1.2 Train Model Static Informations.
In addition to the train’s dynamics, we gathered model-specific information in the
TrainCtx context (see Listing
7). The context defines several constants of the system, as well as constraints on them. In particular, Davis coefficients are given (
\(a\),
\(b\),
\(c\)), as well as the bounds on the train’s traction power (
\(f_{min}\),
\(f_{max}\)).
Furthermore, we define a train stopping distance function \(\mathsf {StopDist}\) as a function of the current speed and acceleration with associated function constraining axioms. Finally, we define train controller modes \(\mathsf {free\_move}\) and \(\mathsf {restricted\_move}\) by refining the \(\mathsf {STATES}\) set with an enumerated set.
5.1.3 Hybrid Rolling Model.
In the first refinement of the generic hybrid model, we introduce several new events that instantiate generic events presented in Section
2.2. Because of the similarity of events, we only provide a single event for each of the generic event type. As specified in the previous subsection, in this refinement, we model the speed controller where the end movement authority is regularly updated, without specifying exactly how it is issued at this level of abstraction.
Machine header. Listing
8 presents the train model header. The train model features five variables in addition to time. The train itself is modelled using its position, speed, and acceleration (
\(tp\),
\(tv\) and
\(ta\), respectively), as well as its traction power (
\(f\)). Additionally, the end of authority is modelled by a real variable,
\(\mathsf {EoA}\). Each variable is associated to a number of constraints (invariants 1 to 4), plus a gluing invariant that links the concrete and abstract continuous states (
\(\mathsf {inv_5}\)). In addition, both safety requirements proposed in Section
4.2 (invariants
\(\mathsf {saf_1}\) and
\(\mathsf {saf_2}\)).
Discrete events. The
\(\mathsf {Transition\_restricted\_move}\) (see Listing
9) event models the change in the speed controller by adjusting trains traction effort when the train is in the restricted move mode. The event is simply guarded by a single predicate that enables event if and only if the status variable
\(\mathsf {x_\mathit {st}}\) is set to
\(\mathsf {restricted\_move}\). To control train’s speed, we created a variable
\(f\) that denotes the traction force and is modified by the action such that the stopping distance would not overshoot the end of the movement authority. One must then prove an open proof obligation that such traction force value can be found.
Another internal controller event that changes controllers mode based on the input from the plant is sense event—
\(\mathsf {Sense\_to\_restricted}\) (see Listing
10). One of the two sense events will change the train state variable
\(\mathsf {x_\mathit {st}}\) if the end of movement authority has not been extended and train must decelerate to remain within issued movement authority.
Continuous Events. The
\(\mathsf {Actuate\_move}\) event (see Listing
11) is the main continuous event of the model. It models the dynamics of the train, using the CBAP operator (see Section
2.2.1) together with the Davis equation defined in the
Train theory (see Section
5.1.1). The proposed evolution domain ensures that (1) the train remains before the end of authority, and (2) the train’s speed remains positive, in accordance with the system’s safety invariants.
Note that the parameters of the generic model are refined using witnesses (WITH clause) as to match the CBAP of \(\mathsf {act_1}\) and the gluing invariant (\(\mathsf {inv_5}\)).
5.2 Event-B Model of a Cyber-physical Railway Signalling System: Other Sub-Systems
To introduce other sub-systems and a communication protocol of the signalling system, the train speed controller model was further refined based on communication modelling patterns [
32] (and diagram visualised in Figure
5) by introducing new context and machine models. According to the patterns, we first created a new context model (Listing
12) where new finite carrier sets representing trains (
\(\mathsf {TRN}\)), communication centres (
\(\mathsf {CCS}\)), interlocking boxes (
\(\mathsf {IXL}\)), and points (
\(\mathsf {PNT}\)) with their status were introduced. In the following paragraphs, we describe a part of the cyber-physical railway signalling model, which captures a train requesting movement authority extension and a communication-centre responding.
Following the message modelling pattern (see Section IV.B of Reference [
32]), for each type of protocol message, an individual context will be introduced that defines the new message type with constant functions defining source, destination and
value of the message. In context excerpt (Listing
13), the
\(\mathsf {ma\_extension}\) message is defined, which is sent by a communications centre to a train (
\(\mathsf {movement\_authority\_extension}\) in Figure
7) with an updated movement authority. The constant (surjective) functions are used to select an appropriate message, which includes a source, destination and value of the message. In the case of
\(\mathsf {movement\_authority\_extension}\) message: ranges of source
\(\mathsf {exts}\) (
\(\mathsf {axm_1}\)) and destination
\(\mathsf {extd}\) (
\(\mathsf {axm_2}\)) functions are, respectively, communication centre and range train sets, while the range of value function
\(\mathsf {extv}\) is a set of real numbers (
\(\mathsf {axm_3}\)).
In the dynamic model (machine) part, we introduce communication channels for the new messages, which includes one for the
\(\mathsf {movement\_authority\_extension}\) message
\(\mathsf {ext}\) (see Listing
14). The model excerpt also contains another channel
\(\mathsf {req}\) for requesting movement authority extension messages and a variable
\(\mathsf {reqt}\). The latter variable is simply used to track sent messages
locally as messages are added and removed from the channel. Once communication channel variables are introduced, events can be refined or new events introduced to capture the process of message sending and receiving.
2The
\(\mathsf {Trains\_sense\_to\_restricted}\) event (see Listing
15) which models the controller state change once the train enters the area where it must decelerate to stay within the movement authority. For a train to continue to travel, it must request the movement authority extension by sending a message to the communication centre. We model that by refining the
\(\mathsf {Sense\_to\_restricted}\) event by first adding additional event parameters denoting a train
\(\mathsf {tr}\), communication centre
\(\mathsf {rb}\), and a request message
\(\mathsf {rq}\). Then, we include new guards
\(\mathsf {grd_{2..6}}\), which define variable types and state that
\(\mathsf {rq}\) must be a new message with destination to specific communication centre
\(\mathsf {rb}\) and source of the train of interest
\(\mathsf {rq}\). The message
\(\mathsf {rq}\) also includes the current position of the train at time
\(t\) (
\(\mathsf {grd_7}\)), which can be accessed via train position function
\(\mathsf {ntp(tr)}\). New actions of the events
\(\mathsf {act_{2..3}}\) add the new message to the request message channel
\(\mathsf {req}\) and saves a sent message receipt locally.
To model
\(\mathsf {movement\_authority\_extension}\) message sending, we apply a reply message modelling pattern that adds a new message to the channel and removes the replied message. To avoid having a single
super-event, it was decided to split message sending into two events that, respectively, model movement authority extension over a line and over a point. Listing
16 describes an event for movement extension over a line. First, the guards (
\(\mathsf {grd_{1..6}}\)) check if an adequate request
\(\mathsf {rq}\) message has been received and new extension message
\(\mathsf {ex}\) will be sent to the source train
\(\mathsf {grd_5}\). The value of the reply message contains a distance value, which is shorter than a distance to the next train and point (
\(\mathsf {grd_{8..9}}\)), but greater than the current end of the movement authority (
\(\mathsf {grd_7}\)). The event actions simply create a new extension message and remove the responded message. A similar event was created to capture the second branch when a point must be locked by communicating with an interlocking.
The final event in the message exchange cycle for requesting movement authority extension is the refined event
\(\mathsf {Trains\_transition\_eoa}\) (Listing
17). Originally, this event was introduced in modelling train speed controller to abstractly represent the internally updated movement authority. To introduce communication aspect to this event, we extend it with additional guards to check if an extension message
\(\mathsf {ex}\) has been received to the specific train
\(\mathsf {tr}\) (
\(\mathsf {grd_{3..5}}\)). The new end of the movement authority value (
\(\mathsf {nEoA}\)) is constrained by the value of extension message (
\(\mathsf {grd_6}\)). The action of the event simply update trains end of authority variable
\(\mathsf {EoA(tr)}\) and deletes the extension message
\(\mathsf {ex}\).
5.3 Event-B Model of a Cyber-physical Railway Signalling System: Proof Statistics
The generic model is proved once and for all, and in this work, we refined the abstract hybrid controller model. The hybrid railway signalling model is itself a reusable artefact, which could be further refined to capture a specific signalling configuration (e.g., by defining a specific railway schema) or modelling railway protocols (e.g., signalling handover).
As discussed by Alur in Reference [
3], the verification of hybrid systems remains a challenge. The verification approaches based on the reachability analysis aim to provide a fully automatic verification approach, but due to the real-valued variables, these approaches are limited to linear systems. In this and other related works, authors have tried to address the verification scalability problem, by developing alternative proof-based verification approaches. Still, as our verification results suggest (Table
3) and also similar works [
4,
12,
15], the proof automation of hybrid Event-B models is still low and must be improved for more practical applications. In spite of improved verification tools, a refinement plan for hybrid models should be reconsidered. Perhaps, a top-down approach (particularly, for this model), where continuous system’s aspects are introduced in later refinement steps is more suitable.
An important feature of this hybrid system development approach is the requirement of explicitly stating the system’s dynamic properties. In our opinion, this problem is often overlooked and could lead to miscommunication between, for instance, control engineers and software engineers. With our proposed approach, a formal hybrid artefact is created, which can be used between different types of engineers. However, the approach currently requires some understanding of formal methods (e.g., mathematical syntax) and could benefit with connection to more visual widely used tool like Simulink or other similar tools via Functional Mock-up Interface [
11].