Statechart Based Modeling and Controller Implementation of Complex Reactive Systems
Statechart Based Modeling and Controller Implementation of Complex Reactive Systems
Abstract- Statechart formalism has been a preferred choice In this paper we report research work carried out to (1) set
for modeling complex reactive systems (CRS) in recent years. It up a passenger elevator prototype conforming to industry
has inbuilt powerful features of orthogonality, hierarchy, inter- standards to serve as a test bed for design and control of
modular communication and history. Once statechart based complex reactive systems, (2) implement model-based design
system modeling is done the next issues to be addressed are (1) of the elevator control system using statecharts, (3)
modular verification of the system for failsafe operation under
demonstrate the application of a modular verification and
all possible working conditions (2) progressive controller
implementation together with the supervisory control while validation methodology developed for CRS on a real-scale
maintaining traceability and re-configurability and (3) system and do (4) hardware /software implementation of the
facilitation of controller adaptation for progressive controller and (5) modular integration of supervisory control.
incorporation of security features and supervisory specifications.
An elevator system was designed and built to reflect exigencies The elevator controller has been implemented on a PLC
of a typical CRS hardware/software platform. A controller was platform and currently being ported to Field Programmable
designed to meet the above requirements and tested on the
Gate Array (FPGA) for reconfigurability.
platform to validate the feasibility of model-based control
design/verification methodology for real scale systems.
Modularity was achieved by developing the statechart model of II. SETTING UP OF A PASSENGER ELEVATOR
the plant into a tree of communicating language generators. PROTOTYPE
Progresively verified modules were then translated into
sequential function charts (SFC) which were finally integrated In a passenger elevator system there are key performance
to form a complete flat SFC. The SFC was then implemented on parameters and critical safety requirements that have to be
a PLC platform (Telemechanique). The program was first met. The elevator specifications and performance parameters
validated in simulation using Telemechanique “Twidosuite” for mainly depend on the behavior of its electro-mechanical
different operating conditions and finally tested on the elevator
system.
system. In order to achieve such objectives the plant sensors,
drives, actuators and control hardware were selected
Index Terms— Complex Reactive Systems, Elevator, Grafcet, accordingly. Car and door travel speed profiles were
Statecharts, Supervisory control, Verification regulated to meet floor landing accuracy and passenger
comfort. Speed drives were fixed for the car and door
I. INTRODUCTION together with proximity sensors for appropriate speed
regulation. As main safety equipment electro-mechanical
Finite State machines (FSM’s) are inadequate for modeling brake system, over speed governor, over travel limit switches,
modern complex reactive systems (CRS) with safety critical car and motor overload sensors and passenger door safety
aspects that need continued verification and validation sensors were incorporated to the plant. The laboratory
throughout the design and implementation process. They
prototype elevator was built to carry 150 Kg. of pay load.
suffer from being flat and unstructured, inherently sequential
and give rise to exponential state space explosion. These
problems have been largely overcome in statecharts [1]
through a multilevel AND-OR decomposition of states
supported by an instantaneous broadcasting mechanism for
communication across hierarchical levels. A great deal has
been published about these aspects [3].
493
Authorized licensed use limited to: Universidad de los Andes. Downloaded on June 10,2020 at 21:37:50 UTC from IEEE Xplore. Restrictions apply.
2011 6th International Conference on Industrial and Information Systems, ICIIS 2011, Aug. 16-19, 2011, Sri Lanka
The elevator controller was modeled using the statechart There are temporary variables and parameters defined in
formalism. The controller model was divided in to three addition to the inputs and outputs of the system. These state
main parallel segments called PLANT, INPUTS, and variables are updated within the statechart when the system
DISPLAY as shown in Fig. 2. These parallel states represent enters a state, during a state or exits a given state.
AND operation in statechart formalism. These AND states
are then further sub divided using AND, and exclusive OR T ABLE 1
states representing parallel and sequential counterparts in the EVENTS DESCRIPTION OF THE STATECHART MODEL
model. This process is called progressive refinement in
statechart terminology. Modeling process was started with the N Description No Description
o
“PLANT” super state of the elevator statechart shown in Fig. 1 entered PLANT 41 left UP
3. This super state was divided into exclusive OR states 2 left PLANT 42 up_dir stop request is
called the “ID”, “DIR”, “DOOR” and “OVERLOAD” [4]. above immediate upper
These hierarchical sub divisions were made after considering floor ( o)
3 up_req (a) 43 up_direction arrived
the physical behaviour and the evolution of the system in requested floor (s)
response to various input conditions. 4 down_req (b) 44 up_dir there is stop
The DIR and the DOOR super states were further request at immediate
subdivided in to UP, DOWN, OPEN, CLOSE, and WAIT floor (c)
exclusive “OR” states. Input and output events were 5 leave DOOR. b (q) 45 entered DOWN_ON
6 leave DOOR. c (r) 46 left DOWN_ON
incorporated to the statechart model of the plant as shown in 7 leave DIR. a ( s) 47 door closed and there are
in Fig. 3. more up –req (q )
8 leave DIR. b (t) 48 door closed and there are
more down – req ( r )
ELEVATOR 9 Enter OPEN 49 Leave CLOSE . c ( r )
10 leave DOOR. a (I) 50 entered WAIT
PLANT INPUTS DISPLAY
11 enter UP. a (a) 51 left WAIT
ID
12 enter UP .b (q) 52 entered OVERLOAD
BUTTON
BUTTONS
LIGHTS 13 enter DOWN . a (b) 53 left OVERLOAD
DIR 14 enter DOWN . b (r) 54 leave OPEN
15 entered OPEN 55 entered DOWN
16 Left OPEN 56 left DOWN
DOOR
17 wait_over 57 down_dir there is stop
SENSORS
CAR request at immediate
POSITION
OVERLOAD floor ( d )
18 press_open (l) 58 down- direction arrived
requested floor ( t )
19 press _close (m) 59 down_dir stop request is
below immediate down
Fig. 2. Statechart for the elevator controller floor
20 entered DIR 60
21 left DIR 61 overload (j)
22 leave UP 62 overload cleared (k)
PLANT
ID 18 23 leave CLOSE . a (I) 63 entered DOWN
24 Leave CLOSE . b ( q ) 64 left DOWN
25 leave DOWN 65 entered DOWN_OFF
4
34
26 entered UP_OFF 66 left DOWN_OFF
3
OVERLOAD
27 left UP_OFF 67 Entered ID
61
62
28 entered UP 68 left ID
DIR DOOR
WAIT
29 left UP 69 entered UP_ON
UP 10 seconds
30 entered DOOR 70 left UP_ON
31 left DOOR 71 entered OP_OFF
U_ON
36
42 44 32 more up_req are left 72 left OP_OFF
35
WT_EDN
(q)
U_OFF
19
32
494
Authorized licensed use limited to: Universidad de los Andes. Downloaded on June 10,2020 at 21:37:50 UTC from IEEE Xplore. Restrictions apply.
2011 6th International Conference on Industrial and Information Systems, ICIIS 2011, Aug. 16-19, 2011, Sri Lanka
2 OVERLOAD
interconnected finite state machines (FSM’ S). Each state at 15
67
2 31 ∩ 75
ID
each non atomic level of the statechart hierarchy was 3
4 18
9
18
17
2
represented by a machine implementing the FSM 5
4
∩ 68
62
31 ∩ 67 30
`
19
corresponding to its sub states on the next immediate level. 20
6
10 76 ∩ 74∩ 30
This is illustrated in Fig. 4 for the statechart given in Fig. 3 20 ∩ 13 11
10 73
[2]. For the PLANT statechart, ten FSM’s and another ten 30 ∩ 21
7
trivial machines can be constructed by addressing the four 8 12
30 ∩ 21
7 8
hierarchical layers and their corresponding atomic states. . 13
20 31 ∩ 5 DOOR
The next step was to introduce virtual events, and an Idle DIR
state for each FSM, in order to develop the statechart into an 20 ∩ 14 14
31 ∩ 6
integrated set of FSM’s: for each module i, we introduced
virtual events, from the set ∑ ivir = { entered X, left X, leave
X, enter X) . Fig. 6. The Language generator of the PLANT FSM
The FSM and language generator corresponding to the
Processor Connection Diagram PLANT statechart and corresponding language generator of
Fig. 3 after introducing the Idle state and virtual events are
PLANT
10, 5, 6, 73, 74 , ,30,31 shown in Fig. 5 and Fig. 6, respectively. This procedure was
7, 8,13 14 ,20, 21
followed for all the nodes in Fig. 4. The process was
67, 68 75, ,76 nontrivial because the safety and control hardware choices
went hand-in-hand with model-based design of the control
logic.
ID DIR DOOR OVERLOAD
OVERLOAD
entry: 75
(computed as the intersection the two priority sets) for
ID
entry: 67
exit:: 76
prioritised synchronous composition of plant and door
73
exit:: 68
18
62 languages is given just for academic purposes: they do not
/7
3
10. 4 come into the picture when the controllability check under
4 / 13 PSC is done [6]. The non-conflicting nature of each module
2
7
DIR DOOR (LG) against its port structure (supervisor module) is verified
entry: 20 8
exit:: 21
entry: 30
exit:: 31 using the standard test for non-conflicting languages [6].
5
Δ = { 1,2,3,4,5,6,7,8,10,18, 62,73} (1)
6 / 14 PLANT
Δ ∩ ∏ = { 5,6,10,73} (3)
Fig. 5. The PLANT FSM of the ELEVATOR statechart PLANT plant _ door
495
Authorized licensed use limited to: Universidad de los Andes. Downloaded on June 10,2020 at 21:37:50 UTC from IEEE Xplore. Restrictions apply.
2011 6th International Conference on Industrial and Information Systems, ICIIS 2011, Aug. 16-19, 2011, Sri Lanka
30
very significant, and hence the lengths of corresponding PLC
73 codes. Under the hypothesis that this was possible, we then
10
5 U 6 U 10
U 31 U 73
developed the following procedure for masking virtual
74 U 30
events, which we eventually validated on the plant.
5
In the proposed method bottom-most layer states and
0 1
physical events (eg., event 43) are considered.
6
In the SFC construction process, starting and destination
74 states at the bottom-most atomic stage are merged by
31
removing the virtual events associated with a unique physical
event triggered in the plant model.
Then search through the rest of the language generators for
Fig. 7. Port structure between PLANT and DOOR modules.
virtual events which are generated starting from the physical
Once the tests for controllability and non-conflicting
events mentioned above. The process is continued until
property are done for the each LG-PS pair we can consider
another bottom-most atomic level destination state is reached.
the overall controller as verified. Then connect the respective bottom-most atomic states of the
statechart. The above process is continued for the complete
V. HARDWARE/SOFTWARE IMPLEMENTATION set of physical events. When this process is completed the
reduced grafcet for the statechart can be derived.
Once the verification process is completed the controller is In order to validate the hypothesis and the corresponding
ready for safe implementation with a suitable hardware and masking process, grafcets were developed for plant models
software platform. before and after applying the above mask. Their reachability
The verification described above being for the graphs were then compared to verify whether the effective
unsupervised plant, we need to extend the procedure to cover command sequences generated were in fact the same. The
the specification, implementation and integration of command sequences being the same, we adopted the
supervisory control. First we consider the construction of reduction strategy as a general rule. The SFC obtained for the
software code for the elevator PLANT statechart model for PLANT statechart by following the above procedure is shown
implementation on a PLC platform. Starting from the in Fig. 8. The SFC can directly be implemented in the PLC.
language generators, the required sequential function charts The SFC implementation for the PLANT statechart on a
(SFC, grafcet was the original name used by the French Telemechanique PLC is shows in Fig. 9.
developers of the language and currently used synonymously In the next phase of the experiment, supervisory control
with SFC in automation industry) were developed for the specifications for safety-critical operations and performance
PLC platform. The SFC is a flat model of the PLANT criteria were developed and implemented. Given below is
statechart which can be directly fed in to the PLC. how a typical performance specification was implemented.
Telemechanique PLCs of Schnider Electric have the “grafcet” Specification: “while the door is closing, if repetitive door-
facility and “SIEMENS” have “GRAPH” facility inbuilt for open requests are made for more than five times, the system
SFC based programming. If a particular brand of PLC does stops responding to the door-open request”. This specification
not support the SFC formalism we can easily translate the was then formalized by first obtaining the corresponding
“grafcet” into more familiar ladder logic or STL (both IEC regular language and then designing a finite state automaton
61131-3 languages, like SFC). that accepts the language.
SUPERVISOR INTEGRATION 4
3
18
DIR DOOR
Virtual events were introduced in the process of controller UP
OPEN
decomposition and in constructing language generators. They 2 UP_ON 6 OP_ON
496
Authorized licensed use limited to: Universidad de los Andes. Downloaded on June 10,2020 at 21:37:50 UTC from IEEE Xplore. Restrictions apply.
2011 6th International Conference on Industrial and Information Systems, ICIIS 2011, Aug. 16-19, 2011, Sri Lanka
Supervisor Specification
WT_OFF 10
17
11
CLOSE
CL_ON
18
1 ID 37
4 2 6
CL_OFF 12
DOWN_ON UP_ON OP_ON
48
47 34
15
MO
(# pressed < 5 )
# pressed > 5
19 18
37
Fig. 9. The SFC derived for the PLANT statechart 16 17
18 37 37
CLOSE
SUPERVISOR
The specification given here refers to the DOOR sub Supervisor Specification - When door is closing if repetitive door open
module of the elevator controller. By using the DOOR requests are made more than five times the system does not respond to the
DOOR open request
language generator and the specification language the Event definition - DOOR open request counter < 5, M0 = 1 else MO = 0;
supremal controllable sub-language (SCSL) can be derived.
The TCT (Toronto Control Technology) software
Fig. 11. The SFC derived for the PLANT statechart
automatically generates the SCSL. The Fig.10 shows the
resulting plant (D), specification language (SD) and the The DES, SUPD obtained from the TCT software generates
optimal controllable sub language using the TCT software. the supremal controllable sub-language for the given
The derived supervisor can be implemented using the SFC specification.
shown in Fig.11. The same SFC can be implemented in PLC using the ladder
In the DOOR discrete event system (DES) shown in Fig. diagram shown below.
10 the uncontrollable events 5 and 7 exiting from state 3 refer
to the door-request-counter values “less than five” and %M17
11
“greater than five”, respectively. But the specification DES, .*. 10 ( #)
SD allows only the path with the event 5.
%M18
19
.*. 11 ( #)
15
( #)
%M0
16
.*. 15 ( #)
%M18 18
.*. 16 ( #)
%M18 %X18
18
.*. 19 (#D)
6
( #)
%M18 %X19
19
.*. 18 ((#D)
6
( #)
Fig. 10. TCT supervisor obtained for the DOOR specification Fig. 12. The ladder diagram for implementing the specification
497
Authorized licensed use limited to: Universidad de los Andes. Downloaded on June 10,2020 at 21:37:50 UTC from IEEE Xplore. Restrictions apply.
2011 6th International Conference on Industrial and Information Systems, ICIIS 2011, Aug. 16-19, 2011, Sri Lanka
RESULTS & DISCUSSION [5] S. D. Dewasurendra, “Statecharts for Reconfigurable Modular Control
of Complex Reactive Systems: a new formal verification
methodology,” in Proceedings of ICIIS 2006, Peradeniya, Sri Lanka,
An integrated laboratory research facility (elevator system) 09-11 August, 2006.
[6] S. D. Dewasurendra, “Statecharts for Reconfigurable Modular Control
has been set up for model-based design, verification and
of Complex Reactive Systems: need for formal verification and
validation of controllers for large scale safety critical systems. associated problems,” in Proceedings of ICIIS 2006, Peradeniya, Sri
Lanka, 09-11 August, 2006.
Model based design and modular verification of elevator
controller was demonstrated: statechart based control
specification was developed into a tree of communicating
regular language generators (modules) where the
communication between adjacent modules was implemented
through port automata under prioritized synchronous
composition.
ACKNOWLEDGEMENTS
REFERENCES
498
Authorized licensed use limited to: Universidad de los Andes. Downloaded on June 10,2020 at 21:37:50 UTC from IEEE Xplore. Restrictions apply.