Professional Documents
Culture Documents
Abstract: This paper deals with the development of manufacturing machinery subjected
to strong dependability and safety properties. In this context, IEC 61508 standard
recommends the use of formal methods to control the complexity of software intensive
applications. This paper focuses on model refinement to ensure safety requirements
traceability. A mechanical press case study illustrates a way to bridge the gap for using
the B method within such an automation-oriented context. Copyright © 2006 IFAC
281
2004)(Abrial et al, 2005). This study has clearly when in up position. Moreover, if the operator
shown the benefit of using B for proved code releases the hand command during the falling phase,
generation. Nevertheless, applying this approach or if emergency stop occurs, the press is stopped.
within an industrial automation engineering
framework requires the definition of a system formal Mechanical press environment
engineering rationale:
- to better detail how the safety requirements are O
p
taken into account all along the development e Clutch side
Motor
C
o
r
process and to ensure their traceability, a Brake side steering wheel n
t
t
- to enlarge software engineering to system i Mobile
Disc
r
o
engineering including software, hardware, man- n
g
l
that illustrates a way to bridge the gap for using the B Clutching-braking system
282
A model has a name m; the clause SETS contains physical variables). It means that specification does
definitions of sets of the problem; the clause not differentiate cause (such as input action by
CONSTANTS allows the designer to introduce human operator) from consequence (such as press
information related to the mathematical structure of movement). As an example, a first situation of the
the problem to be solved; and the clause press can be characterised by two system variables:
PROPERTIES contains the effective definitions of press stopped and no operator’s action. These two
the constants. The second section of the model variables are observed in a next situation as
defines the dynamic aspects of the state variables and following: the press is now moving and the two hand
properties of variables using the invariant. Events command is pushed.
O1…On are used to describe state variable
modifications due to generalized substitutions; Si(x) Consequently, variables of the first specification
contains the new value of variable x after the level are the following: state1 represent the press
occurrence of Oi. The substitution of a variable is abstract state which is considered as stopped1,
feasible with respect to its guard. The invariant I(x) falling1, rising1; start and emergency model the
states that variable x is always in a given set of Boolean operator’s actions. This gives rise to the
possible values, which is assumed to be initialized declaration section of the first B machine:
with respect to the initial conditions and which is
preserved by any event of the list of events. MODEL Press_System 1
Conditions of verification, called proof obligations SETS STATES1= {stopped1, falling1, rising1};
are generated from the text of the model, and they PIN= {on, off}
express underlying hypotheses required for the VARIABLES state1, start, emergency
preservation of invariant properties: INITIALISATION
state1= stopped1 || start = off || emergency = off
(INV1) Init(x) fi I(x)
(INV2) I(x) ¶ P(x) fi I( S(x)) Invariant is related to the type of each variable and
(INV1) states the initial condition that should express also S1 and S2 properties.
establish the invariant. (INV2) should be checked for INVARIANT
every event Oi of the model; it states that starting start ∈ PIN ∧ emergency ∈ PIN ∧ state1 ∈ STATES1 ∧
from a situation where the guard of event Oi and the (state1= rising1 ⇒ emergency= off) ∧ (S1)
invariant are verified, the variable transformation (state1= falling1 ⇒ start= on ∧ emergency= off) (S2)
leads to a new value of x where the invariant is still
preserved. The B proof mechanism is founded on The press behaviour is described using three events
rule-bases using an inference engine supported by the that define a cyclic sequence:
Atelier B tool. - when the operator pushes the start button, the
The refinement calculus is used to relate models at press is going down,
varying levels of abstraction by enriching variables - when the press reaches its bottom point, the
and event descriptions while preserving the already movement direction is changing and the press
proven invariants. We summarize the approach as begins to rise,
follows: - when the press reaches its top point, it is
(M1,G1) refined by (M2,G2) refined by … (Mn,Gn) stopped.
Mi is the ith model iteration that satisfies the goal Gi EVENTS
and the goals of lower iteration number. The refined
by relationship ensures the preservation of goals, but Starting =
the proof of refinement must be given. This means Select state1= stopped1 ∧ start= off
that if a new model is derived from (Mn, Gn), we Then state1:= falling1 || start:= on || emergency:= off
should prove that the new model refines the previous End;
model and preserves the new properties. Consider a Direction_shift =
refinement of the machine shown in Fig.2 given by Select state1= falling1
variable y, invariant J(x,y), event Oi(y) Í Select Then state1:= rising1
End;
Qi(y) then Ti(y), where J represents the formal link
between the abstract variable x and the refined Stop_up =
variable y and some local properties over y. Select state1= rising1
Then state1:= stopped1 || start ∈ PIN
4. PRESS SPECIFICATION End;
283
Start_relax_stop = EVENTS
Select state1 = falling1 ∧ start = on …
Rising_restart =
Then state1 := stopped1 || start = off
Select state2= rising_stop2 ∧ emergency= on
End;
Then state2:= rising2 || start :∈ PIN || emergency:=off
End;
Emergency_stop = …
Select state1= falling1 ∧ emergency= off END
Then state1:= stopped1 || emergency= on
When state1= rising1 ∧ emergency= off 4.2 Press automated system specification
Then state1:= stopped1 || emergency= on
Next refinement aims at transforming the initial
When state1= stopped1 ∧ emergency= off system requirements (Goal) into software/hardware
Then state1:= stopped1 || emergency= on components (Control rules and dynamics) that
End; constrain the behaviour of a physical system
according to solicitations from the environment. This
At least, following operations describe restarting is done according to Fusaoka’s predicate and its B
conditions after abnormal stop. Two cases have to be formalisation (Pétin et al., 2006) where refinement is
taken into account: restarting from stop state to used to verify compliance between goal and
falling phase and restarting from stop to rising phase. automated system specifications.
Rising_restart = The B model Press_System_3 refines
Select state1= stopped1 ∧ emergency= on Press_System_2 by introducing a clear distinction
Then state1:= rising1 || start :∈ PIN || emergency:=off between events that produces stimuli, events that
End; model the dynamics of the physical part of the press
and events that control the behaviour of the press
Falling_restart = (Fig. 3). The control operations receive stimuli from
Select state1= stopped1 ∧ start= off ∧ emergency= on operator (start and emergency buttons) and from
Then state1:= falling1 || start= on || emergency:= off press physical position (top or bottom dead centres)
End; and decide to actuate or not the clutching system
(sending pressure to clutch makes move the
These two last events introduce an non deterministic crankshaft and the tool).
situation due to the possibility of having tdc
Falling_restart and Rising_restart guards bdc
simultaneously triggered. It can be explained by the
fact the movement direction when an abnormal stop start3
occurs is not memorised. pressure Physical
Physical
Operator’s
Operator’scontrol
control Command
Command part
part
This justifies the refinement of the first press Emergency3
specification to detail the STATES1 set by adding
stopped at the top, stopped when falling and stopped Fig. 3. System’s structural decomposition
when rising states. This replacement of variable
state1 by variable state2 is effective in all clauses of Modelling of environment changes (modification of
the B machine and provokes guard and event start and emergency variables) is very simple
modifications: when a value of state1 is equal to because they are assumed to be uncontrollable. It
stopped in a guard or in the effect of an event, we means that any operator command may occur
have to precise which kind of stop is concerned: whatever the system states are.
top_stopped, falling_stopped or rising_stopped. The
link between the variable state1 and its refinement Operator_actions =
state2 is defined within the invariant in a section Begin start3 :∈ PIN || emergency3 :∈ PIN
called gluing invariant. End;
284
Dead_centres = - control system is able to correctly evaluate the
if α = 0 then bdc := off || tdc = on physical state of the press using top and bottom
else if α = 180 then bdc=on || tdc= off dead centres information and to compute an
else bdc=off|| tdc=off appropriate pressure order,
End; - physical system behaviour is compliant with the
control stimuli.
Introducing environment and physical part events
modify the guard of control events of These proof obligations constitute actually the
press_system_3, in order to include rising and falling intrinsic invariant properties:
edges of the operator’s stimuli. To this end, two - of the control
memory variables are created: old_emergency3 and state = rising 3 ⇒ pressure = on ∧
old_start3. After each control events, these variables 180 ≤α< 359 ⇔ state3∈ {rising3, rising_stopped3}
are updated by respectively the emergency3 and - of the physical subsystems
start3 values. For example, the guard of starting pressure = on ⇔ crank = on
event requires now the rising edge of start button
when the press is stopped as following: If the specification of control and process verify
these underlying hypotheses, then it proves that the
Starting = control and physical system events safely behave
Select state3= top_stopped3 ∧ according to the initial requirements S1 and S2.
start3= on ∧ oldstart3= off /* Start rising edge */
Then state3:= falling3 || start3:= on || emergency3:= off ||
5. VERIFICATION ISSUES
oldemergency3:=emergency3 || oldstart3:=start3 ||
pressure:= on
End; A B model is composed of a list of events.
Verification of a B model consists in proving that any
Note that state3 is an internal memory computed by event preserves the invariant. This is well adapted
the control system, which is expected to be consistent for describing software operations that always
with the press abstract state2. maintain safety invariant properties.
This structural decomposition into basic components However, B model does contain any operation
(control software, user interface, and physical scheduler that could sequence the execution of the B
system) guides designer into progressive operations. Consequently, if analysis of a safety
specification of properties. A gluing invariant links property is needed at the beginning of the sequence
the abstract state2 to the properties of control and and at the end of the sequence, the concept of B
physical variables as following: invariant must be handled carefully. This ability to
model invariant properties with the concept of
INVARIANT action/reaction is very important when modelling
State2 ∈{falling_stopped2, rising_stopped2, top_stopped2} reactive systems where B model describes control
⇔ crank = off ∧ part and its environment. Indeed, proving invariant
state3 ∈{falling_stopped3, rising_stopped3, top_stopped3} within such a machine requires playing a game where
∧ control and process operations have successively the
state2=falling2 ⇔ crank= on ∧ 0≤α<180 ∧ state3 = falling3 token. For example, if we consider an operator’s
∧ stimulus, the invariant safety properties S1 and S2
state2=rising2 ⇔ crank=on ∧ 180≤α<359 ∧ state3 = rising3 cannot be checked before having observed the
∧… associated reaction by control and process
subsystems. It means that starting from a situation
Safety properties are also projected into all the sub- where S1 and S2 invariants are true, execution of a
component of the press. The term state2 = rising2 of stimuli operation leads to a temporary situation
the predicate S1 becomes state3= rising3 (control where S1 and S2 are false until the control and
process operations are executed.
point of view) and crank = on ∧ 180 ≤α< 359
(physical system point of view). Same rational is
The way of modelling proposed to cope with this
applied for predicate S2. It completes the previous
verification problem is based on the definition of
invariant by:
flags that model the operation scheduler. Flags are
evaluated by the guard of operations and valued by
(state3= rising3) ∧ (crank= on ∧ 180 ≤α< 359) ⇒ theirs substitutions in order to define an ordered list
emergency3 = off) ∧ (S1) of operation. In this case, invariant can be specified
(state3 = falling3) ∧ (crank= on ∧ 0 ≤α< 180) ⇒ true for only a subset of flag value.
start= on ∧ emergency = off) For reactive system modelling, we propose the set of
∧… (S2) flag value to be divided into three parts, related to
stimuli, control and process operations, noted Fij
Proving this invariant is based on underlying where i denotes the type of operation (1 for stimuli, 2
hypotheses that assume: for control and 3 for process) and j the number of
operation within the sub-lists. The legal sequence of
285
operation execution is composed of three operations: 7. REFERENCES
one stimuli operation followed by one control
operation and then one process operation. This can be Abrial J.R., Borger E., Langmaack editors (1991). Formal
noted as following: methods for industrial applications : specifying and
programming the steam boiler control, Lecture Notes
in Computer Science, Springer Verlag.
Event ij = Abrial J.R. (1996). The B Book: Assigning Programs to
Select Flag=Fi(j-1) Meanings. Cambridge Univ. Press
Then If Gij Then Sij || Flag:=F(i+1)1 Abrial J.R (2005), Case study of a complete reactive
Else Flag:=Fi(j-1) system in Event-B: a mechanical press controller,
End; tutorial 3 of ZB’2005, Guildford, UK, 13-15/04/2005
where Gij and Sij denotes respectively the guard and Blaise, J. C., Lhoste, P., Ciccotelli, J.(2003).
substitution of the operation ij. Formalisation of normative knowledge for safe
design. In : Safety Science, 41, 241-261.
In this case, invariant will only be considered when Clarke E.M., Grunberg O., Peled D.A. (2000) Model
Flag = F10, i.e. when the flag has just been valued by Checking. The MIT Press
one process operation (sequence stimuli/control Craigen D., Gerhart S., Ralston T. (1995). Formal
reaction/physical effect has been ended). methods technology transfer: implements and
innovation. Formal Methods by Hinchey M.G.,
Bowen J.P., pp. 399-419, Prentice Hall International
6. CONCLUSION & PROSPECTS Diallo D., Vailly A., (1998) Paraphrasing of specification
written in B, Networking and Information Systems
There is a growing interest in methods and tools that Journal (NISJ), Vol. 1 n°2-3/1998.
facilitate the validation of software-intensive Feldmann K., Colombo A.W., Schnur C., Stöckel T.
automation systems. This interest is reinforced by the (1999). Specification, Design, and Implementation of
IEC 61508 safety-related standard that strongly Logic Controllers based on Coloured Petri Net
recommends the use of formal methods, but without Models and the Standard IEC 1131. In : IEEE Trans.
defining how they can be applied. on Control Systems Technology. Volume 7, N°6.
Main contribution of this paper is a system Fusaoka A., Seki H., Takahashi K. (1983). A description
and reasoning of plant controllers in temporal logic.
engineering methodology based on the use of the B International Joint Conference on Artificial
method to ensure a safer automation by checking a Intelligence. pp 405-408. Karlsruhe, 8-12 aug. 1983.
priori proved properties from the earlier phases of Johnson T. L. (2004). Improving automation software
specification. Major added value of our approach is dependability: a role for formal methods? In proc. of
related to: 11th IFAC/INCOM, Salvador-Bahia, Brazil,4-7/04/04
- the use of a system engineering rationale based Laleau R., Pollack F., (2002) Coming and going from
on the Fusaoka’s predicate to identify system UML to B: a proposal to support traceability in
safety requirements and to ensure their rigorous IS development. In Proc of ZB’2002, LNCS
traceability all along the development process, vol. 2272, pp 517–534, Grenoble, France.
Lamy P., Bello J.P., (2004). Realization of a control
- the definition of consistent relations between the software of a mechanical press using B method, in
components safety properties and the way they proc. of the 15th International Symposium on
are aggregated to satisfy the system properties, Software Reliability Engineering, St Malo, France.
- the extension of B modelling to cope with the Ledang H., (2002). Automatic translation from UML
verification of tightly coupled hardware and specifications to B, in proceedings of the Int.
software components in system engineering. Workshop on Refinement of Critical Systems:
Methods, Tools and Experience, 2nd Conf. on B and
Although these interdisciplinary experiences between Z, 23-25/01/2002, Grenoble, France.
computer and automation sciences demonstrate that Lhote F., Chazelet Ph., Dulmet M. (1999). The extension
of principles of cybernetics towards engineering and
the proposed approach may allow one to verify the manufacturing. IFAC Annual Reviews in Control.
highest levels of safety integrity of automation Volume 23 (1), pp 1-11.
systems, the lab-scale case study emphasizes the Pétin J.F., Morel G., Panetto H., (2006), Formal
efforts which should still be deployed in order to specification method for systems automation,
make the proposed engineering framework effective European Journal of Control, to be published
in practice. An important limitation for the Roussel J.-M., Faure J.-M. (2002). An algebraic
acceptance of the proposed approach into a well- approach for PLC programs verification, in
established automation engineering process is the proceedings of IFAC WODES'02, Zaragoza, Spain, 2-
mathematically oriented notation of the B language. 4 October, 2002, pp. 303-308.
Shell T. (2001) Systems functions implementation and
A means of bridging this gap at the specification behavioural modelling: system theoretic approach,
level is to propose equivalent representations of a B International Journal of Systems Engineering, 4/1.
specification using more accepted formalisms. To
this end, translations of UML diagrams into B
machines have been proposed (Ledang,
2002)(Laleau and Pollack, 2002), as well as
paraphrasing of the B model into a natural language
text to facilitate its understanding (Diallo and Vailly,
98).
286