16
Design of Traffic Light Control Systems Using Statecharts Yi-Sheng Huang Department of Aeronautical Engineering, Chung Cheng Institute of Technology, National Defense University, Taoyuan 335, Taiwan, ROC E-mail: [email protected] Statechart has been utilized as a visual formalism for the modeling of complex systems. It illuminates the features on describing properties of causality, concurrency and synchronization. This paper focuses on the use of statecharts to model an urban traffic lights control system. The applications of statecharts to eight-phase, six-phase and two-phase traffic lights are illustrated. The advantage of the proposed approach is the clear presentation of traffic lights’ behaviors in terms of conditions and events that cause the phase alternations. Moreover, the paper also proposes a new modeling methodology, called concurrent state graphs, that allows us to present all the concurrent states in complex statecharts. The analysis of the control models is performed to demonstrate how the models enforce the lights’ transitions by reachability tree method. And then the reachability and reversibility properties of the control statecharts will be obtained. Finally, an urban traffic lights’ control system with nine intersections will be realized. To our knowledge, this is the first work that employs statecharts to obtain the models of the urban traffic light control system. Keywords: statecharts, reachability tree, traffic light and intelligent transport system Received 28 December 2005; revised 22 March 2006 1. INTRODUCTION Traffic lights for normal vehicles or pedestrians always have two main lights: a red one which means ‘stop’ and a green one which means ‘go’. In some countries, a flashing yellow light means that a motorist may go ahead with care if the road is clear. There may be additional lights, i.e. usually a green arrow, to authorize turns (called a lead light in the US, because it is usually leading the main green light). Note that three lead lights are involved in this paper. And traffic light control systems regulate, warn and guide transportation for the purpose of improving the safety and efficiency of pedestrians and vehicles. With the growing number of vehicles, the traffic congestion and transportation delay on urban arterials are increasing worldwide; hence it is impera- tive to improve the safety and efficiency of transportation. Subsequently, several research teams focus their attention in the area of Intelligent Transport System [1, 2]. In addition, they applied advanced communication, information and electronics technology to solve transportation problems such as traffic congestion, safety and transportation efficiency [3]. However, several fundamental problems remain open, among which are modeling methodologies. It is an important issue in traffic light control systems for two main reasons:(i) the traffic light control systems exhibit a high degree of concurrency (ii) the systems might make the shared resources (i.e. intersection area) conflict and cause a tendency to deadlock and overload. Obviously, an unsuitable modeling tool could make it difficult to evaluate the performance indices of traffic control systems, such as the number of vehicles that are stopped by red signals and subsequent time loss from the signal. The research topic of traffic signal control has been sepa- rated into two categories [4]: (i) determining what signal- indication sequence to follow in order to optimize the system performance and (ii) ascertaining how to implement the signal-control logic. This paper focuses on the second category. There is a vast amount of literature focused on finding optimal control strategies. And past researches have addressed successfully a variety of mathematical program- ming methodologies [5] and artificial intelligence techniques [6, 7, 8] to model the traffic flow and control logic. In order to implement or test any control strategies in a simulation environment, the control logic has to be translated into computer code. However, the published literatures did not address the way of the signal control logic be implemented [4]. Our statecharts model can overcome this drawback. In this paper, one can realize how to construct the traffic signal control logic by reachability states method. The Computer Journal, Vol. 49 No. 6, 2006 Ó The Author 2006. Published by Oxford University Press on behalf of The British Computer Society. All rights reserved. For Permissions, please email: [email protected] Advance Access published on June 14, 2006 doi:10.1093/comjnl/bxl032

Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

Design of Traffic Light Control

Systems Using Statecharts

Yi-Sheng Huang

Department of Aeronautical Engineering, Chung Cheng Institute of Technology,

National Defense University, Taoyuan 335, Taiwan, ROC

E-mail: [email protected]

Statechart has been utilized as a visual formalism for themodeling of complex systems. It illuminates

the features on describing properties of causality, concurrency and synchronization. This paper

focuses on the use of statecharts to model an urban traffic lights control system. The applications

of statecharts to eight-phase, six-phase and two-phase traffic lights are illustrated. The advantage

of the proposed approach is the clear presentation of traffic lights’ behaviors in terms of conditions

and events that cause the phase alternations. Moreover, the paper also proposes a new modeling

methodology, called concurrent state graphs, that allows us to present all the concurrent states in

complex statecharts. The analysis of the control models is performed to demonstrate how the

models enforce the lights’ transitions by reachability tree method. And then the reachability

and reversibility properties of the control statecharts will be obtained. Finally, an urban traffic

lights’ control systemwith nine intersections will be realized. To our knowledge, this is the first work

that employs statecharts to obtain the models of the urban traffic light control system.

Keywords: statecharts, reachability tree, traffic light and intelligent transport system

Received 28 December 2005; revised 22 March 2006

1. INTRODUCTION

Traffic lights for normal vehicles or pedestrians always have

two main lights: a red one which means ‘stop’ and a green

one which means ‘go’. In some countries, a flashing yellow

light means that a motorist may go ahead with care if the road

is clear. There may be additional lights, i.e. usually a green

arrow, to authorize turns (called a lead light in the US,

because it is usually leading the main green light). Note

that three lead lights are involved in this paper. And traffic

light control systems regulate, warn and guide transportation

for the purpose of improving the safety and efficiency

of pedestrians and vehicles. With the growing number of

vehicles, the traffic congestion and transportation delay on

urban arterials are increasing worldwide; hence it is impera-

tive to improve the safety and efficiency of transportation.

Subsequently, several research teams focus their attention in

the area of Intelligent Transport System [1, 2]. In addition,

they applied advanced communication, information and

electronics technology to solve transportation problems

such as traffic congestion, safety and transportation

efficiency [3]. However, several fundamental problems

remain open, among which are modeling methodologies. It

is an important issue in traffic light control systems for two

main reasons: (i) the traffic light control systems exhibit a

high degree of concurrency (ii) the systems might make the

shared resources (i.e. intersection area) conflict and cause a

tendency to deadlock and overload. Obviously, an unsuitable

modeling tool could make it difficult to evaluate the

performance indices of traffic control systems, such as the

number of vehicles that are stopped by red signals and

subsequent time loss from the signal.

The research topic of traffic signal control has been sepa-

rated into two categories [4]: (i) determining what signal-

indication sequence to follow in order to optimize the system

performance and (ii) ascertaining how to implement the

signal-control logic. This paper focuses on the second

category. There is a vast amount of literature focused on

finding optimal control strategies. And past researches have

addressed successfully a variety of mathematical program-

ming methodologies [5] and artificial intelligence techniques

[6, 7, 8] to model the traffic flow and control logic. In order

to implement or test any control strategies in a simulation

environment, the control logic has to be translated into

computer code. However, the published literatures did not

address the way of the signal control logic be implemented

[4]. Our statecharts model can overcome this drawback. In

this paper, one can realize how to construct the traffic

signal control logic by reachability states method.

The Computer Journal, Vol. 49 No. 6, 2006

� The Author 2006. Published by Oxford University Press on behalf of The British Computer Society. All rights reserved.For Permissions, please email: [email protected]

Advance Access published on June 14, 2006 doi:10.1093/comjnl/bxl032

Page 2: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

In the past decade, finite state machines (FSMs) have been

used for the modeling of discrete event systems because of

their inherent simplicity. Based on FMSs, Ramadge and

Wonham [9, 10] and the work that followed [11] analyze

control problems in the framework of state machines.

However, in other control problems where a large number

of components operate concurrently, the state-machine-

based modeling approach becomes awkward as the resultant

number of states will grow exponentially with the number

of parallel components. This problem of state explosion

constitutes a severe shortcoming of the state-machine

modeling framework [12]. To alleviate the modeling

complexity of the state-machine formalism while preserving

many of its appealing features, a statechart modeling

framework is introduced by Harel [13, 14]. It extends

ordinary state-machines by endowing them with natural

constructs of orthogonality, depth, broadcast synchroniza-

tion and many other sophisticated features that strengthen

its modeling power. In summary, Harel’s statechart is best

described as follows:

Statecharts ¼ FSM + depth + orthogonality + broadcast.

In particular, (i) states are organized in a hierarchy of

superstates and substates thereby achieving depth. (ii) States

are composed in parallel thereby achieving concurrency.

(iii) Transitions are allowed to take place at all levels of

the hierarchical structure, thereby achieving descriptive

economy. Overall, statechart provides insights into causality,

concurrency and synchronization of the modeled systems.

Based on Harel’s statecharts, the related study includes the

following. Brave and Heymann [12] proposed hierarchical

state machines (HSMs), which is a simplified version of

statecharts that extend state-machines by adding only

hierarchy and orthogonality features. HSMs are well suited

for modeling and specification of complex processes such as

manufacturing systems, communication network and air

traffic control systems etc. In modeling analysis, Masiero

et al. [15] proposed an algorithm to create a reachability

tree for statecharts and also showed how to use this tree

to analyze dynamic properties of statecharts. Related to

software implementation of statechart-based systems, Harel

et al. [16] introduced a set of STATEMATE tools, with a

heavy graphical orientation, intended for the specification,

analysis, design and complex reactive systems. In [13] it

is proposed that statecharts can be beneficially used as

a behavioral hardware description language. Although a

traffic-light-controller has been presented using statechart

[13], it just presented a simple traffic light. Coleman et al.

[17] showed us how to use statecharts in object-oriented

design. And Huang et al. [18] submitted a methodology of

elevators control by statecharts. Moreover, Borges et al. [19]

and Sowmya and Ramesh [20, 21] extended statecharts to

deal with reactive systems. Other developments involving

traffic light control method using Petri nets were reported

in [22, 23, 24, 25]. In summary, there are several modeling

tools (i.e. Petri net [22], timed Petri net [24], stochastic timed

Petri net [26], Hybrid Petri net [22] and fuzzy logic [8])

applied in traffic light control domain. From the modeling

point, they are hard to present clearly their phase alter-

nations. Especially, they are hired in an urban traffic lights

system. However, this paper focuses on the use of statecharts

to model an urban traffic lights control system. The

applications of statecharts to eight-phase, six-phase and

two-phase traffic lights are illustrated. The advantage of the

proposed approach is the clear presentation of traffic lights’

behaviors in terms of conditions and events that cause the

phase alternations.

As mentioned above, there is only one type of phase

transition discussed in an urban net [4]. The variation of a

vehicle’s direction in a four-way intersection is always two

phases [25, 26], four phases [26] or even eight phases [4].

Recently, DiFebbraro et al. [22] proposed an urban traffic

controller which includes four-phase and three-phase

transitions. However, they did not address the comparat-

ively complicated movement direction of traffic flow in

intersections. For example, a traffic light has not only red,

yellow and green lights, but also has a left turn arrow on

green, a right turn arrow on green and a straight arrow on

green. As a result, it is possible to have both of a right

turn arrow on green and a red signals turn on in an

eastbound traffic light and also a green signal turns on in

the northbound traffic light. The phase transition of the

preceding example has been considered in our eight-phase

transition. The situation is usually envisioned in urban

traffic lights. In addition, an analysis method of reachability

states is employed in our statecharts models.

The rest of the paper is organized as follows: Section 2

provides a brief description of statecharts. Section 3 presents

an urban traffic network and their phase transitions. Section 4

depicts how to model the traffic light systems using state-

charts. And Section 5 presents the urban traffic network

controller. Conclusions are present in Section 6.

2. THE STATECHART FORMALISM

The statecharts method was introduced as a visual formalism

for specifying the behavior of complex reactive systems [14].

The notion of states constitutes the basic component of

statecharts. States in a statechart can be repeatedly combined

into higher level states (or, alternatively, high-level states can

be refined into lower-level ones) using AND and OR modes of

clustering [13]. As a result, states may be embedded into

superstates thus creating hierarchies of states. Superstates

may be one of two types: AND-state or XOR-state. The

former captures the notion of independence, e.g. image

and sound may be at the same time in a television. The

latter corresponds to refinement of states, e.g. a light bulb

either stays on OFF or ON state. The components of an

Traffic Light Control Systems Using Statecharts 635

The Computer Journal, Vol. 49 No. 6, 2006

Page 3: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

AND-state are called orthogonal components and have the

distinctive feature that a system in an AND-state is also in

all its orthogonal components. Figure 1 shows a state U

whose meaning is to be in U the system must be in

precisely one of A, B or C. Likewise, a state V whose

meaning is to be in V the system must be in precisely one

of D, E or F. And Figure 1 shows a state W whose meaning is

to be in W the system must be both in U and in V. Note that

U and V are themselves OR states. As a result, the actual

possibilities are the state configurations (A, D), (A, E),

(A, F), (B, D), (B, E), (B, F), (C, D), (C, E) and (C, F). We

say that A, B and C (D, E and F) are exclusive and U and V

are orthogonal. In summary, a state W is described as

consisting of two or more orthogonal components, and to

be in state W entails being in all of those components

simultaneously. The notation is represented by a dashed

line that partitions the state into its components.

Conversely, if the system is in an XOR-state, it has to be in

only one of its substates.

States interact through transitions, which consist of three

basic parts: an event expression, a condition and action

statements. The general syntax of an expression labeling a

transition in a statechart is

a½C�b

where a is the event that triggers the transition, C is a

condition that guards the transition from being taken unless

it is true when a occurs and b is an action that is carried

out if the transition is taken. All of these are optional. Events

and conditions can be considered as inputs, and actions as

outputs. For example, if b appears as an action along some

transitions, but it also appears as a triggering event of a tran-

sition in some orthogonal component, then executing the

action in the first transition will immediately cause the second

transition to be taken simultaneously. In fact, a transition is

relevant in a time step if its source states are active and it

fires when both the event expression and the condition are

evaluated to be true in the same time step. Execution of an

action may generate other events, which are broadcasted to

the orthogonal components, possibly firing new transitions.

Statecharts also allow a transition to leave a superstate, i.e.

to leave all the substates in the superstate. Conditions are

formed by a combination of logical and relational operators

involving variables and special conditions, e.g. being in a

state. Event-expressions are formed from a basic set of

primitive events, which can be combined using logical dis-

junctions and conjunctions. Other special conditions and

events, as in(s) and en(s), are not taken into account in this

paper. In short, transitions in a statechart are not level-

restricted and can lead from a state on any level of clustering

to any other. A transition whose source state is a superstate

means the system leaves this state no matter which is the

present configuration within it. In this way, an event l exem-

plifies a concise way of causing the system to leave B or C.

To summarize the definitions above, a statechart example

is modeled and is shown in Figure 1. This statechart contains

a state W, consisting of the two orthogonal components U

and V; being in W is being in both. Both components are

XOR-state: the first consisting of A, B and C, and the other

consisting of D, E and F. They then follow that to be in W is

to be in one of A, B or C, and at the same time being in one of

D, E or F. Such a tuple of states, each from a different

orthogonal component, is called a state configuration. We

say that W is the parent of the components U and V, or that

U and V are the substate of W. Note that the components U

and V are not different from any other states; they may have

their own substates, default entrances, internal transition and

so forth. Entering W from outside is tantamount to entering

the configuration (A, D) by the default arrows. If a occurs

in (A, D), the system transfers simultaneously to (B, E),

a transition that is effectively a form of synchronized concur-

rency. That is, a single event a triggers two simultaneous

transitions. If g now occurs, the new configuration is

changed to (B, F); the transition g is taking place in the V

component, independently of what might be happening in the

U component. Likewise, if b performs, the new one is

changed to (C, F). Now, if event l occurs, the system

exits B and then the new configuration is changed to (A, F).

It is worthy to notice that the configuration (C, F) will be

changed to (B, F) automatically in 5 s. At this moment, an

action d is carried out such that the configuration (C, F) will

be changed to (B, E).

Note that the present formalism treats time restrictions

using implicit timers, as the state C in Figure 1. Formally,

this is done using the event expression timeout (i.e. the

event timeout has to be replaced by the events an1_tm,

an2_tm, as1_tm, as2_tm, . . . and so forth), which represents

the event that occurs precisely when the specified numbers

of time units have elapsed from the occurrence of the

specified event. Some of the statechart properties are

described above, but the reader is hoped to consult [14] for

a fuller treatment. In this paper, the dynamic properties

were verified through the reachability tree method.

FIGURE 1. A statechart example.

636 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 4: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

The reachability tree can be used to analyze two properties

of a given statechart. The two properties will be informally

described below. A statechart is said to be reachable if a state

configuration Ak is reachable from another state configura-

tion Ai. A statechart is said to be reversible when for each

state configuration Ai reached from the initial configuration

A0, there is a sequence of events that leads back to A0.

3. AN URBAN TRAFFIC NETWORK

3.1. Intersection models

Figure 2 shows an urban traffic network with nine intersec-

tions. In this paper, the nine intersections are divided into

three categories: (i) main road intersection, called A; (ii)

minor road intersection, called B; (iii) tertiary road intersec-

tion, called C. In Figure 2, only one (i.e. A) belongs to the

main road intersection, four intersections (i.e. B) belong to the

minor road intersection, and four intersections (i.e. C) belong

to the tertiary road intersection. Regularly, there are four traf-

fic lights, i.e. northbound, southbound, eastbound and west-

bound traffic lights, placed at each intersection. Here two

types of traffic lights are hired. The first type consists of

five signal lights (i.e. Figure 3a): a red light signal (R), a

yellow (Y), a left turn arrow on green (GL), a right turn

arrow on green (GR) and a straight arrow on green (GS).

There are either eight-phase or six-phase transitions available

from this kind of the traffic light. The second type, as shown

in Figure 3b, consists of three signal lights, i.e. R, Y and a

green signal (G). Only two-phase transitions can be derived

from this simple kind of the traffic light. Considering the

traffic flow, we assume the traffic light has eight-phase

transitions at A. While the traffic lights have six-phase tran-

sitions at B. And the traffic lights have two-phase transitions

at C. It is worthy to notice that there is only one type of

phase transition presented in earlier literatures [13, 21, 26].

However, three types of phase transitions will be discussed

later.

3.2. Phase transition models

Consider the traffic area reported in Figure 1, which consists

of intersection A, B and C. Flows at the intersection A are

assumed to be ruled by an eight-phase traffic light. The

rules of the phases are shown in Figure 4a, which are defined

FIGURE 2. A traffic network with nine intersections.FIGURE 3. (a) Five-light signal. (b) Three-light signal.

FIGURE 4. (a) The eight-phase transition. (b) The phases’ alter-

nating order.

Traffic Light Control Systems Using Statecharts 637

The Computer Journal, Vol. 49 No. 6, 2006

Page 5: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

as follows. And their alternating order is depicted in

Figure 4b by an FSM.

Phase A1: the GL signals turn on in the northbound and in

the southbound traffic lights. The signal R’s are displayed in

the east-westward traffic directions.

Phase A2: the northbound traffic lights signal GL, GR and

GS signals. The eastbound traffic lights indicate GR signal.

Notice that this phase does not seem to be addressed in the

past literatures.

Phase A3: both the northbound and the southbound traffic

lights signal GS and GR signals.

Phase A4: the southbound traffic light signal GL, GR

and GS signals. In the same time, the GR signal is displayed

in the westward traffic direction.

Notice that Phases A5–A8 are similar to phases A1–A4

respectively. And they are only different in the heading

directions.

Here, the author assumes the phase transition time is 45 s

for each phase transition. For convenience, we defined ‘set

cycle time’ as the period for a set of traffic lights to operate

one cycle. Since there are nine sets of traffic lights in the

urban traffic network, we defined further ‘system cycle

time’ as the period for all sets to operate one cycle. As a

result, it needs 360 s for a set cycle time. It is easy to know

that phase A1 (i.e. initial state in Figure 4b) should be

changed to phase A2 after 45 s.

Considering the second category intersection, the vehicle

flows at the intersection B are required to be ruled by a six-

phase traffic light. Figure 5 shows the phases’ definitions

and their alternating order.

Phase B1: the GL, GS and GL signals turn on in the north-

bound traffic light. The signal Rs are displayed in the other

traffic directions.

Phase B2: both the northbound and the southbound traffic

lights are showing the GS and GR signals.

Phase B3: the GL, GS and GL signals turn on in the south-

bound traffic light. The signal Rs are displayed in the other

traffic directions.

For intersection B, phases B4–B6 are similar to phases

B1–B3 respectively. Note that the phase’s transition time

is 45 s for phase B1 and phase B4. And the other phases’

transition time is 90 s.

Finally, the two-phase transitions of the traffic lights

located at the intersections C are presented in Figure 6.

The detailed information is shown as follows:

Phase C1: both the northbound and the southbound traffic

lights signal G signals. This phase transition time is 90 s.

Phase C2: both the westbound and the eastbound traffic

lights are showing the G signals. This phase transition time

is also 90 s.

The three-phase transition models illustrate the application

of the urban traffic network control criteria. For the control

objects, the author proposes a new modeling methodology to

meet the control criteria in the next section.

4. MODELING THE PHASE TRANSITIONS OF

THE TRAFFIC LIGHTS BY STATECHARTS

Statecharts have been applied to model various kinds of dis-

crete event systems. In this section some physical traffic

lights control systems are described with statecharts to

demonstrate its superb modeling capabilities. In addition,

the various components needed to make up the control

systems will become more evident. Some of the general capa-

bilities offered by statecharts are listed below.

(i) Hierarchical description: the ability to provide

hierarchical descriptions becomes possible as the

FIGURE 5. The models of the six-phase transition.

FIGURE 6. The models of the two-phase transition.

638 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 6: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

complexity of the described system grows. The

hierarchical decomposition offered by statecharts

uses a mechanism that condenses information.

(ii) Concurrency descriptions: the ability to describe con-

currency is crucial. Statecharts support a natural way

of describing concurrency at any hierarchical level,

without causing awkward sequential descriptions.

(iii) Timing specifications: statecharts offer local-looking

capabilities for timing specification in states. How-

ever, since such timing constraints can appear in states

on any level and also in any orthogonal component,

this actually admits global timing constraints.

For convenience, the following discussions of the urban

traffic lights control system models are alleviated while the

author abbreviates some of the states’ names as follows:

� TRAFFIC_LIGHT_CONTROLLER_A becomes A;

� TRAFFIC_LIGHT_CONTROLLER_B1–B4 becomes

B1–B4;

� TRAFFIC_LIGHT_CONTROLLER_C1–C4 becomes

C1–C4.

To clarify relations among these substates of statecharts,

we employ the definitions [12] to describe the behavior of

the statecharts. Notice that the definitions are involved in

our hierarchical trees (i.e. such as Figure 7). Here, we

introduce the definitions by a compact way as follows.

S is the finite set of states of H, consisting of S+, the

subset of XOR-states, S?, the subset of AND-states and Sbasic,

the subset of basic states. The hierarchical structure of H’s

states is represented by the binary relation ‘ on S, called

the hierarchy relation and satisfies the following conditions:

(i) There exists a unique state, called the root state of

H and denoted r ¼ (r(H)), such that for no state

a 2 S, a ‘ r.

(ii) For every state a 2 S, a 6¼ r. There exists a unique

state b 2 S such that b ‘ a. The state b is called the

immediate superstate of a, whereas a is an immediate

substate of b.

(iii) A state a 2 S has no immediate substates if and only if

a is a basic.

(iv) If b‘ a then either b 2 S+ ^ a =2 S+ or b 2 S? ^ a 2 S+.

It is clear that the pair (S, ‘) defines a tree called the

hierarchy of H. The transitive closure of ‘ is denoted ‘+.

Thus a ‘+ b means that b is a (not necessarily immediate)

substate of a. For a state a with immediate substates

a1, a2, . . . , ak, we shall sometimes identify a with its set of

immediate substates by writing a ffi a1 · � � � · ak whenever

a is an AND-state and a ffi a1 + � � � + ak whenever a is an

OR-state. Based on the above definitions, we can construct

any target system’s model accordingly by hierarchical tree

and their mathematical models. In the following paragraphs,

we will show how to construct traffic light control system

models using our hierarchy trees.

4.1. A statechart of the eight-phase traffic light

First, we construct a hierarchical tree diagram as shown in

Figure 7 based on the eight-phase traffic light’s hardware

FIGURE 7. The hierarchical tree diagram of the traffic_light_controller_A.

Traffic Light Control Systems Using Statecharts 639

The Computer Journal, Vol. 49 No. 6, 2006

Page 7: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

equipment. It is worthy to notice that the hierarchical tree

diagram can assist in designing its statechart. Each node of

the hierarchical tree should be considered as a state in a state-

chart model. Using the hierarchical tree, we can easily obtain

the configuration of the statechart model. For convenience,

the author describes the states of the hierarchical tree with

some notations. And the notations are abbreviated to three/

four upper case characters. Note that the fourth character is

optional. For examples, the notations ANR, ANY and ANGL

correspond to the R, Y and GL signals turning on in the north-

bound traffic light at intersection A. Based on the preceding

definitions, one can point out the root state of the hierarchy

tree (i.e. Figure 7) is r ¼ (r(A)).

Moreover, the hierarchical tree diagram contains useful

information of designing statechart like the following:

(i) The root state A with AND is decomposed into 4

states, i.e. the state A consists of four sets of traffic

lights: N_A, S_A, W_A and E_A. In other words, we

say that A is the parent of the components N_A, S_A,

W_A and E_A, or that N_A, S_A,W_A and E_A are the

substates of A. In terms of statecharts modeling, all of

the substates are viewed as AND-states. As such, the

parent state A is an AND-state, i.e. A ffi N_A · S_A ·W_A · E_A. Note that the states N_A, S_A, W_A and

E_A are also called the substates of the superstate

state A in the statechart model.

(ii) The state N_A with XOR is decomposed into six

substates. The northbound traffic light of intersect A

consists of five signal lights denoted as R, Y, GL, GR

and GS. And the eight-phase is composed of the five

signal lights. As discussion above, the state N_A can

be at any of the six states, i.e. N_A ffi ANR + ANGL +ANY + (ANR ^ ANGL) + (ANGL ^ ANGS ^ ANGR) +(ANGS ^ ANGR). In terms of statechart modeling, the

superstate N_A is called an XOR-state. Likewise, we

can obtain the other XOR-states (i.e. S_A, W_A and

E_A) of this level in the same way above. It is worthy

to mention that the state ANR ^ ANGL means the R

and the GL signals turn on in the southbound traffic

light of the intersection A simultaneously.

(iii) The states at the bottom of the hierarchical tree

are called basic states. Hence, we have A‘+ ANR,

A‘+ ANGL, A‘+ ANY, A‘+ (ANR ^ ANGL),

A‘+ (ANGL ^ ANGS ^ ANGR), A‘+ (ANGS ^ANGR), . . . , and so forth.

In summary, we describe the AND relation of the hierar-

chical tree diagram as {N_A, S_A, W_A, E_A 2 A?}. And the

XOR relation is {ANR, ANGL, ANY, (ANR ^ ANGL), (ANGL

^ ANGS ^ ANGR), (ANGS ^ ANGR) 2 N_A+}. And we

obtain {ANRbasic, ANGLbasic, ANYbasic, (ANR ^ ANGL)basic,

(ANGL ^ ANGS ^ ANGR)basic, (ANGS ^ ANGR)basic2 A+}.Based on the useful information, the statechart model can

be constructed easily.

Figure 8 shows the statechart model of the traffic light con-

troller, called TRAFFIC_LIGHT_CONTROLLER_A based

on the hierarchical tree. There are four sets of traffic lights

facing four directions of an intersection. For example, the one

positioned at the southbound of intersect A, is called the

southbound traffic light, denoted as N_A, and S_A south-

bound, W_A westbound, E_A eastbound. Thus the four states

are formally called four superstates N_A, S_A, W_A and E_A.

Note that all the four sets of traffic light have five-light sig-

nals. According to the default entrances, the initial state con-

figuration (ANR, ASR, AWR, AER, T1) is called state A0,

whose means that the four sets traffic lights are signaling R.

Especially, the initial state should be changed 1 s later,

because the duration time of the initial state is limited to

1 s. In this paper, two global timers are employed: T1’s

upper bound is 1 s and T2’s is seconds. For analysis purposes,

T1 of the initial state configuration should be omitted.

Therefore, the state configuration A0 is revised as (ANR,

ASR, AWR, AER). That is the element T1 is omitted. In this

paper, all state configurations are simplified as initial one.

FIGURE 8. A statechart controller of the eight-phase transitions.

640 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 8: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

Besides, all state configurations of this paper are defined and

are listed in Table 1.

In Figure 8, we have five orthogonal sates (e.g. N_A, S_A,

W_A, E_A and TIMER) and we have default entrances. And

we have time bounds on the duration of being in a state (e.g.

precisely 3 s in four of the states in N_A, S_A, W_A and E_A

respectively). Actions can appear along transitions as in

Mealy automata (e.g. a is generated when making the transi-

tion between two states of N_A, triggered by the d event.

Some of similar capabilities of Figure 1 are explained

below. Once T1 reaches 1 s, an event T1_tm triggers and an

action l is taken. The action l causes the initial state con-

figuration changing to (ANGL, ASGL, AWR, AER), called

state A1. In the meantime, the phase A1 is derived. Once T2

reaches 45 s, an event T2_tm triggers and an action d is

taken. The action d immediately forces the state configuration

A1 to change to ((ANGL ^ ANGS ^ ANGR), ASR, AWR,

(AEGR ^ AER)), called state A2. In fact, in this period, the

substate ASGL of S_A is changed to ASR via ASY. It means

that the left turn arrow on green signals for 42 s and then the

yellow light signals 3 s. Although the yellow light (ASY) does

not involve in the phase transitions, the state configuration

exists still. Hence, such state configurations are called

transient states. For another example, a state configuration

(ANGL, ASY, AWR, AER) is also a transient state (i.e. TA1),

since one of the elements of the configuration is with a

yellow light.

It is interesting that the substate T2 of TIMER will generate

periodically an event T2_tm with an action d. Once the next

action d is generated, the state configuration A2 should be

immediately change to ((ANGS ^ ANGR), (ASGS ^ ASGR),

AWR, AER), called state A3. It is worthy to notice that the

action d stimulates another action p simultaneously. The two

actions cause the state A2 to be changed to state A3. Finally, a

state configuration (ANR, (ASR ^ ASGR), AWR, (AEGL ^AEGS ^ AEGR)), called A8, is obtained via several events

and/or actions. Once the next action d is generated, the

state A8 should be changed to the initial state A0. At this

moment, the substate T2 of TIMER should be brought to

T1 since an event m is triggered by an event be2_tm (i.e.

introduced in Figure 11). Briefly, the initial state will hold

for 1 s. It means the four sets of traffic lights signal red lights

for 1 s simultaneously.

For clarity, a reachability tree of the statechart model is

depicted in Figure 9. Based on the foregoing notation, we

introduce the reachability tree as follows. The reachability

tree includes one initial state A0, eight phase states and six

transient states. First, the initial state A0 should be changed

to A1 when an event l is taken. In the meantime, the new

state should be held for 42 s. Then the state is changed to a

transient state TA1. Till the event d is generated again,

the transient state is changed to A2. And then a new event

d is generated, the state A2 should be passed to the state A3.

The state A3 should be changed to a new transient state

(i.e. (ANY, ASR, AWR, (AER ^ AEGR)) automatically after

42 s. Finally, the state should come back to the initial state

by an action m. It is worthy to mention that the eight phase

states meet the eight-phase transitions. In summary, we can

TABLE 1. The state configurations of the statecharts.

State configuration (N_A, S_A, W_A, E_A) for the intersections A, Bi and Ci (i.e. i ¼ 1, 2, 3, 4)

A0 ¼ (ANR, ASR, AWR, AER) Bi2 ¼ (BNGS ^ BNGR, BSGS ^ BSGR,

BWR, BER)

TA4 ¼ (ANR, ASR, AWGL, AEY)

A1 ¼ (ANGL, ASGL, AWR, AER) Bi3 ¼ (BNR, BSGL ^ BSGS ^ BSGR,

BWR, BER)

TA5 ¼ (ANR, ASR, AWY, AEGS ^ AEGR)

A2 ¼ (ANGL ^ ANGS ^ ANGR, ASR,

AWR, AEGR ^ AER)

Bi4 ¼ (BNR, BSR, BWGL ^ BWGS ^BWGR, BER)

TA6 ¼ (ANR, ASGR ^ ASR, AWR, AEY)

A3 ¼ (ANGS ^ ANGR, ASGS ^ ASGR,

AWR, AER)

Bi5 ¼ (BNR, BSR, BWGS ^ BWGR,

BEGS ^ BEGR)

TBi1 ¼ (BNY, BSGS ^ BSGR, BWR, BER)

A4 ¼ (ANR, ASGL ^ ASGS ^ ASGR,

AWGR ^ AWR, AER)

Bi6 ¼ (BNR, BSR, BWR, BEGL ^BEGS ^ BEGR)

TBi2 ¼ (BNR, BSY, BWR, BER)

A5 ¼ (ANR, ASR, AWGL, AEGL) Ci0 ¼ (CNR, CSR, CWR, CER) TBi3 ¼ (BNR, BSR, BWY, BEGS ^ BEGR)

A6 ¼ (ANGL ^ ANR, ASR, AWGL ^AWGS ^ AWGR, AER)

Ci1 ¼ (CNG, CSG, CWR, CER) TBi4 ¼ (BNR, BSR, BWR, BEY)

A7 ¼ (ANR, ASR, AWGS ^ AWGR,

AEGS ^ AEGR)

Ci2 ¼ (CNR, CSR, CWG, CEG) TCi1 ¼ (CNY, CSY, CWR, CER)

A8 ¼ (ANR, ASGR ^ ASR, AWR,

AEGL ^ AEGS ^ AEGR)

TA1 ¼ (ANGL, ASY, AWR, AER) TCi2 ¼ (CNR, CSR, CWY, CEY)

Bi0 ¼ (BNR, BSR, BWR, BER) TA2 ¼ (ANY, ANGL ^ ANGS ^ ANGR,

AWR, AER)

Bi1 ¼ (BNGL ^ BNGS ^ BNGR, BSR,

BWR, BER)

TA3 ¼ (ANR, ASY, AWGR ^ AWR, AER)

Traffic Light Control Systems Using Statecharts 641

The Computer Journal, Vol. 49 No. 6, 2006

Page 9: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

conclude that the eight-phase model is with reachability and

reversibility.

4.2. A statechart of the six-phase traffic light

The preceding subsection illustrates the development of the

hierarchical tree and the statechart models of the eight-phase

traffic light. As discussion earlier, the B1, B2, B3 and B4 in

Figure 10 are the six-phase transitions’ behavior of traffic

light controllers modeled by a hierarchical tree. For conve-

nience, we focus on B1 in this subsection. Based on the pre-

ceding discussion, obviously the root state of the hierarchy

tree shown in Figure 10 is r ¼ (r(B1)).

To design the statechart, one can utilize the useful informa-

tion from the hierarchical tree diagram as follows.

(i) The root state B1 with AND is decomposed into four

states, i.e. the state B1 consists of four sets of traffic

lights: N_B1, S_B1, W_B1 and E_B1. In terms of

statechart modeling, all of the states are viewed as

AND-states. As such, the parent state B1 is an

AND-state, i.e. B1 ffi N_B1 · S_B1 · W_B1 · E_B1.

(ii) The N_B1 state with XOR is decomposed into four

states, i.e. the northbound traffic light of intersect

B1 consists of five signal lights: R, Y, GL, GR and

GS. And the six-phase is composed of the five signal

lights. As discussion earlier, the state N_B1 can be at

any of the four states, i.e. N_B1 ffi BNR + BNY +(BNGS ^ BNGR) + (BNGL ^ BNGS ^ BNGR). In

terms of statechart modeling, the state N_A is called

an XOR-state.

Likewise, we can obtain the others XOR –states (i.e. S_B1,

W_B1 and E_B1) of this level in the same way above.

(iii) The states at the bottom of the hierarchical tree

are called basic states. In summary, we have A ‘+

BNR, A ‘+ BNY, A ‘+ (BNGS ^ BNGR), A ‘+

(BNGL ^ BNGS ^ BNGR), . . . , and so forth.

In short, we can make a summary of the case. The relations

of the hierarchical tree diagram are {N_B1, S_B1, W_B1,

E_B1 2 B1?}, {BNR, BNY, (BNGS ^ BNGR), (BNGL ^BNGS ^ BNGR) 2 N_B1+} and {BNRbasic, BNYbasic, (BNGS

^ BNGR)basic, (BNGL ^ BNGS ^ BNGR)basic2 B1+}.

FIGURE 9. The reachability tree of the eight-phase transition statechart.

FIGURE 10. The hierarchical tree diagram of the traffic_light_controller_Bi.

642 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 10: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

Likewise the foregoing subsection, the statechart

of the traffic light controller (i.e. TRAFFIC_LIGHT_

CONTROLLER_B1) is modeled in Figure 11 using the hier-

archical tree. The statechart consists of four superstates:

N_B1, S_B1, W_B1 and E_B1. They correspond to with

the four-way of the traffic light. It is very important to note

that some of events/actions are related to the statechart A.

According to the preceding discussion, the system should

be passed from the initial state configuration B0 into the

state configuration B6. Figure 12 depicts the more detail

operations of the statechart model in a reachability tree. In

summary, the reachability tree includes: one initial state B0,

six phase states (i.e. B1 � B6) and four transient states (i.e.

TB1 � TB4). And the six phase states again meet the six-phase

transitions. As a result, the six-phase statechart model is with

reachability and reversibility.

4.3. A statechart of the two-phase traffic light

In this subsection, the author demonstrates the development

of the hierarchical tree and statechart models of a two-phase

traffic light by a compact way. Generally, this kind of traffic

lights is used in a general road. The two-phase traffic light

system’s models are shown in Figures 13 and 14 respectively.

Likewise, a reachability tree of the statechart is also obtained

and shown in Figure 15. The reachability tree includes one

initial state C0, two phase states (i.e. C1 � C2) and two tran-

sient states (i.e. TC1 � TC2). And also the two phase states

meet the two-phase transitions.

It is worthy to notice that the two-phase traffic light needs

180 s for a set cycle time. On the other hand, the system cycle

of the urban traffic network system needs 360 s. Hence,

the event g or event m can bring the transient state TC1 to

state C1 or state C0 respectively.

5. THE URBAN TRAFFIC NETWORK

CONTROLLER BY STATECHARTS

In this subsection, we attempt to control an urban traffic net-

work which consists of nine intersections. As mentioned

above, the nine intersections are divided into three groups:

main street intersection, minor street intersection and tertiary

street intersection. Obviously, we have to design a different

control system for each traffic light. Nevertheless, it is a

tough work to design a mechanism for coordinating the firing

sequences of the traffic lights as we want.

5.1. Modeling of the urban traffic lights controller

Figure 2 shows the urban traffic network with nine inter-

sections. The traffic network consists of three different

types of intersections. There are one intersection A, four inter-

sections B and four intersections C. Based on the foregoing

discussion, we can construct the associated hierarchical tree

in Figure 16, which serves as overview of the urban traffic

network system. Note that parts of the hierarchical trees have

been presented in the Section 4.

Intuitively, one can realize the relations of the states in

the hierarchical tree as the previous example. The top-level

state of the hierarchical tree is decomposed into 10 states,

which are for the nine traffic lights except the state TIMER.

The root state r ¼ (r(URBAN TRAFFIC CONTROLLER))

with AND is decomposed into 10 states. And the relation of

the root state is described as r ffi A · B1 · B2 · B3 · B4 ·C1 · C2 · C3 · C4 · TIMER. In terms of statechart model-

ing, all of the states are viewed as AND-states. We describe

the AND relation as follows:

{A, B1, B2, B3, B4, C1, C2, C3, C4, TIMER 2 URBAN

TRAFFIC CONTROLLER?}.Again we can construct the associated statechart model

accordingly by hierarchical tree and their mathematical mod-

els. In the next paragraph, we will show how to construct

the urban traffic network system’s statechart model through

top-down procedure. According to the hierarchical tree (i.e.

Figure 16), the associated statechart can be constructed

and shown in Figure 17 which describes the overview of

the statechart model of the urban traffic network. The system

of the URBAN TRAFFIC CONTROLLER consists of 10 sub-

states. Based on the concept of AND-state, we know these

FIGURE 11. A statechart controller of the six-phase transitions.

Traffic Light Control Systems Using Statecharts 643

The Computer Journal, Vol. 49 No. 6, 2006

Page 11: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

substates are all orthogonal components. And the urban traffic

controller statechart is depicted as rectilinear box with

rounded corners. We know the six dash lines are used to

divide it into the 10 orthogonal behavioral components.

The substate A is decomposed into four parallel behavioral

components, N_A, S_A, W_A, E_A; each of these is further

decomposed into six exclusive substates that have been

shown in Figure 8. Likewise, the substates B1–B4 and

substates C1–C4 are decomposed into four parallel

behavioral components; each of these substates is further

decomposed into four and three exclusive substates respec-

tively. Please notice that the substates B1–B4 are the same

as the substate B. And also the substates C1–C4 are the

same as the substate C. The more detail information is

shown in Figures 11 and 14 respectively. Besides, the sub-

state TIMER is decomposed into two exclusive substates

that are depicted in Figure 8.

We specify the initial state by using a small arrow emanat-

ing from a small solid circle, meaning that the system must be

in the initial states of the 10 substates simultaneously. Briefly,

FIGURE 12. The reachability tree of the six-phase transition statechart.

FIGURE 13. The hierarchical tree diagram of the traffic_light_

controller_Ci.

FIGURE 14. A statechart controller of the two-phase transitions.

FIGURE 15. The reachability tree of the two-phase transition

statechart.

644 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 12: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

the name of the state appears inside their rectilinear box. The

transitions are drawn as splined arrows with the triggers

severing as labels. The triggers of the transitions in this

paper are events/actions to be regarded as instantaneous.

Here, the initial state shows us all the traffic lights are

going red light. In the next subsection, we can check of the

scenarios of the URBAN TRAFFIC CONTROLLER statechart

system by a zoom way.

5.2. Analysis of the urban traffic lights controller

In this subsection, we attempt to analyze the urban traffic

network. Based on the foregoing discussion, we know the

substates of the URBAN TRAFFIC CONTROLLER statechart

system are all orthogonal components. However, it is a

tough work to present all concurrent states together. For

this reason, we propose a new modeling tool, called con-

current state graphs, to model all the concurrent states in

FIGURE 16. The hierarchical tree diagram of the urban traffic system.

FIGURE 17. The urban traffic network controller by statechart.

Traffic Light Control Systems Using Statecharts 645

The Computer Journal, Vol. 49 No. 6, 2006

Page 13: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

complex statecharts. The basic idea behind concurrent state

graph is to construct a graph containing a node for each

reachable concurrent state and an event/action for each con-

current state. We also hire the default entrance of the state-

chart to describe the initial node. Here, an occurrence state

graph shown in Figure 18 is obtained from the URBAN

TRAFFIC CONTROLLER statechart. The concurrent state

graph generates 17 nodes in a system cycle. Each node con-

sists of nine elements which are for the nine intersections of

the urban traffic network. For example, N0, i.e. phase

state_0 ¼ (A0, B10, B20, B30, B40, C10, C20, C30, C40),

means that the traffic lights’ states of intersect A, B1–B4,

and C1–C4 are in the initial states. And all the notations

of the state configurations are listed in Table 1. It is worthy

to notice that the triggering sequences of the traffic light

system’s concurrent events can be understood easily by an

occurrence state graph. Moreover, Figure 18 also shows us

all the phase transitions and all the signal lights’ statuses in

the urban traffic lights system. The phase transitions include

nine transition states (i.e. phase state_0–phase state_8) and

six transient states (i.e. transient state_1–transient state_6). It

needs 360 s of the statechart models to complete a system

cycle. It means the urban traffic lights system needs 360 s

for the system to return to the initial state. More precisely,

the two-phase, the six-phase and the eight-phase transitions

need 180, 360, 360 s for each set cycle time respectively.

Therefore, the eight-phase transition needs 45 s for each

phase transition time. And this is the reason why Figure 18

is triggered by eight events.

Considering the statechart of the urban traffic controller,

the initial state configuration is represented by phase state_0.

. It means all the traffic lights signal R due to the default

FIGURE 18. The concurrent state graphs of the urban traffic network.

646 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 14: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

entrances. According to the foregoing discussion, the system

should be changed from phase state_0 into phase state_1,

once an event l is triggered. Indeed, the system should

come back to the initial state in a system cycle time. We

would like to emphasize all the transient states should be

held active for 3 s. That is the yellow lights go flashing for

3 s. More precisely, phase state_1 should be changed into

transient state_0 after 42 s. And then the transient state_0

should be changed into phase state_2 after 3 s. The physical

meaning is that the phase’s change of traffic lights is needed

via Y lights. Note that the other elements are remaining their

current states in the meantime. For example, A1 ¼ (ANGL,

ASGL, AWR, AER) is changed to TA1 ¼ (ANGL, ASY, AWR,

AER) and then is changed to A2 ¼ (ANGL, ASR, AWR, AER).

As the foregoing discussion, we can conclude that the occur-

rent state graph forms a cycle. It hints that the initial node

is reachable from the other nodes. As a result, the rever-

sibility and reachability properties can be derived from the

method.

5.3. Implementation of the Urban Traffic Lights

Controller

The block diagram of the urban traffic network control system

is shown in Figure 19. In this control system, a number of

sensors (i.e. timers) are used to determine the statuses of the

traffic lights. The primary function of an urban traffic lights

controller, modeled by the statecharts, is to coordinate the

traffic lights of the nine intersections.

We defined the plant of the control system as the part of the

system that is to be controlled. Traffic lights’s statues are

changed by triggering events and/or active actions. As the

control objective, we want the system output, i.e. changes

of the traffic lights, to correspond to the phase transitions.

In this way, each of the operation sequences can be regarded

as a concatenation of operations performed at the traffic light

network system. In terms of statechart modeling, each opera-

tion can be constructed by

(i) a triggered event signifying the ‘event’ of the intended

operation is initiated and followed by

(ii) an active action representing the status of concurrent

transitions being taken.

The traffic lights’ states are changed by the events. It is

interesting to note that an event can be labeled not only

with the trigger that causes it to happen, but also optionally

with an action. If an action is present when the event takes

place, the specified action is carried out instantaneously.

To illustrate how these three components of the control

block work together, let us consider the following example:

First, the traffic lights system stays at an initial state, i.e. all

the R signals turn on in the initial states. When T1 reaches 1 s,

an event T1_tm triggers and an action l would take place

concurrently. Figure 20 helps us understand the operation

of the events and actions.

In this example, we use three elements (i.e. (ANR, BNR,

CWR)) to represent the part of the initial configuration. Once

an action l is generated, the action should be broadcasted

to the other orthogonal components. Hence, the action l

causes the initial state configuration (ANR, BNR, CWR)

changed to (ANGL, BNGL ^ BNGS ^ BNGR, CWR). In the

meantime, all the statuses of the traffic network are shown in

Figure 21a. Next, when T2 reaches 45 s, an event T2_tm

triggers and an action d would take place concurrently.

In the same time, an action a is also generated (i.e. d/a).

Both actions d and a are broadcasted to the other orthogonal

components concurrently. Hence, the action d causes the

state configuration (ANGL, BNGL ^ BNGS ^ BNGR, CWR)

changed to (ANGL ^ ANGS ^ ANGR, BNGL ^ BNGS ^BNGR, CWR) and the action a causes the state configuration

(ANGL, BNGL ^ BNGS ^ BNGR, CWR) changed to (ANGL,

BNGS ^ BNGR, CWR). Because both state transitions are

changed in the same time, the final state configuration will

become (ANGL ^ ANGS ^ ANGR, BNGS ^ BNGR, CWR)

after d/a triggering. In the meantime, all statuses of the traffic

network are shown in Figure 21b. This is all the control

sequence of this example. In order to design and implement

the traffic network control system, the object-orient program-

ming technique is used. The demonstration program is written

with Visual Basic 6.0 taking about 350 Kbytes, whose opera-

tion flow is modeled by statecharts. The nine pictures in

Figure 21 are the phase transitions of the traffic lights for

the nine intersections in Figure 2 respectively. Figure 21

also shows two phase transitions’ statuses of the traffic lights

of the urban traffic network.

FIGURE 19. The block diagram of the urban traffic network control system.

Traffic Light Control Systems Using Statecharts 647

The Computer Journal, Vol. 49 No. 6, 2006

Page 15: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

6. CONCLUSIONS

This paper presents the modeling, control and implemen-

tation of an urban traffic lights system using statecharts.

Especially, this paper also proposes hierarchical tree dia-

grams which can assist in designing their statecharts. The

complexity nature due to state aggregation and the imposi-

tion of underlying control policy is modeled by statechart

with emphasis on event synchronization among states of

ifferent depth. Based on the operational flow of the traffic

lights systems, we derive the associated statecharts model

by looking into the inherent hierarchical structure of the

traffic systems. The advantage of the proposed approach is

the clear presentation of system behavior and readiness for

implementation. To summarize, this paper has the following

contributions.

(i) This paper has demonstrated how to use statecharts to

model the traffic lights of the urban networks. And

then the applications of statecharts to eight-phase,

six-phase and two-phase traffic lights have been

realized.

(ii) Structural analysis of the statecharts model was

performed.

(iii) The hierarchical tree diagrams are successful to

convert statechart models. These examples are helpful

to us to obtain a statechart model for a complex traffic

network system.

(iv) To our knowledge, it is the first time that concurrent

state graphs are used to model all the concurrent

states in complex statecharts. It becomes easy to

present all concurrent states together in a complex

system using concurrent state graphs.

We believe that our research using statecharts to model

traffic light systems will become a lot more important in

this field due to the increasing demands for more features

of the traffic light systems.

FIGURE 20. The parts of the phase transitions of the controller.

(a)

(b)

FIGURE 21. Two snapshots of the phase transition of the traffic

network control system. (a) Phase_state_1. (b) Phase_state_2.

648 Y.-S. Huang

The Computer Journal, Vol. 49 No. 6, 2006

Page 16: Design of Traffic Light Control Systems Using Statecharts · analysis, design and complex reactive systems. In [13] it is proposed that statecharts can be beneficially used as a

ACKNOWLEDGEMENTS

This work was supported in part by the National

Science Council of Taiwan, ROC, under Grant NSC93-

2218-E-014-002.

REFERENCES

[1] Lee, J. H. and Lee-Kwang, H. (1999) Distributed and coopera-

tive fuzzy controllers for traffic intersection group. IEEETrans. Syst. Man Cybern., 29, 263–271.

[2] Robertson, D. I. and Bretherton, R. D. (1991) Optimizing net-

works of traffic signals in real time-the SCOOT method. IEEETrans. Veh. Technol., 40, 11–15.

[3] Figureiredo, L., Jesus, I., Machado, J. A. T., Ferreira, J. R. and

Martins de Carvalho, J. L. (2001) Towards the development of

intelligent transportation systems. In Proc. IEEE Intelligent

Transportation Systems, Oakland, CA, August 25–29,

pp. 1206–1211, IEEE, Piscataway, New Jersey.

[4] List, G. F. and Cetin, M. (2004) Modeling traffic signal control

using Petri nets. IEEE Trans. Intell. Transport. Syst., 5,

177–187.

[5] Dinopoulou, V., Diakaki, C. and Papageorgiou, M. (2002)

Simulation investigations of the traffic-responsive urban

control strategy TUC. In Proc. IEEE Intelligent Transportation

Systems, Dearborn, MI, October 1–3, pp. 458–463. IEEE,

Piscataway, New Jersey.

[6] Abu-Lebdeh, G. and Benekohal, R. F. (2000) Genetic algo-

rithms for traffic signal control and queue management of

oversaturated two-way arterials. J. Transport. Res. Board,1727, 61–67.

[7] Chin, D. C., Spall, J. C. and Smith, R. H. (1999) Evaluation of

system-wide traffic signal control using stochastic optimization

and neural networks. In Proc. ACC 99, San Diego, CA, June

2–4, pp. 2188–2194. IEEE, Piscataway, New Jersey.

[8] Lin, Q., Kwan, B. W. and Tung, L. J. (1997) Traffic signal

control using fuzzy logic. In Proc. IEEE Systems, Man and

Cybernetics, Orlando, FL, October 12–15, pp. 1644–1649.

IEEE, Piscataway, New Jersey.

[9] Ramadge, P. J. and Wonham, W. M. (1987) Supervisory

control of a class of discrete event processes. SIAM J. Contr.Optimiz., 25, 206–230.

[10] Ramadge, P. J. and Wonham, W. M. (1987) On the supremal

controllable sublanguage of a given language. SIAM J. Contr.Optimiz., 25, 637–659.

[11] Ramadge, P. J. (1989) Some tractable supervisor control prob-

lems for discrete event systems modeled by Buchi automata.

IEEE Trans. Automat. Contr., 34, 10–19.

[12] Brave, Y. and Heymann, M. (1993) Control of discrete event

systems modeled as hierarchical state machines. IEEE Trans.Automat. Contr., 38, 1803–1819.

[13] Drusinsky, D. and Harel, D. (1989) Using statecharts for hard-

ware description and synthesis. IEEE Trans. Comput.-AidedDes., 8, 798–807.

[14] Harel, D. (1987) Statecharts: a visual formalism for complex

system. Sci. Comput. Program., 8, 231–274.

[15] Masiero, P. C., Maldonado, J. C. and Boaventura, I. G. (1994)

A reachability tree for statecharts and analysis of some

properties. Inform. Softw. Technol., 36, 615–624.

[16] Harel, D., Lachover, H., Naamad, A., Pnueli, A., Politi, M.,

Sherman, R., Shtull-Trauring, A. and Trakhtenbrot, M.

(1990) STATEMATE: a working environment for the develop-

ment of complex reactive systems. IEEE Trans. Softw. Eng.,16, 403–414.

[17] Coleman, D., Hayes, F. and Bear, S. (1992) Introducing

objectcharts or how to use statecharts in object-oriented design.

IEEE Trans. Softw. Eng., 18, 9–18.

[18] Huang, Y. S., Chung, S. L. and Jeng, M. D. (2004) Modeling

and control of elevators by statecharts. Asian J. Contr., 6,

242–352.

[19] Borges, P. F., Masiero, P. C. and Ferreira de Oliveira, M. C.

(1999) Hypercharts: extended statecharts to support

hypermedia specification. IEEE Trans. Softw. Eng., 25,

33–49.

[20] Sowmya, A. and Ramesh, S. (1998) Extending statecharts with

temporal logic. IEEE Trans. Softw. Eng., 24, 216–231.

[21] Tzes, A., Kim, S. and McShane, W. R. (1996) Application of

Petri networks to transportation network modeling. IEEETrans. Veh. Technol., 45, 391–400.

[22] DiFebbraro, A., Giglio, D. and Sacco, N. (2004) Urban traffic

control structure based on hybrid Petri nets. IEEE Trans. Intell.Transport. Syst., 5, 224–237.

[23] Lin, L., Nan, T., Xiangyang, M. and Fubing, S. (2003)

Implementation of traffic lights control based on Petri nets.

In Proc. IEEE Intelligent Transportation Systems, Shanghai,

China, October 12–15, pp. 1087–1090. IEEE, Piscataway,

New Jersey.

[24] Wang, H., List, G. F. and DiCesare, F. (1993) Modeling and

evaluation of traffic signal control using timed Petri nets. In

Proc. IEEE Systems, Man and Cybernetics, Le Touquet,

France, October 17–20, pp. 180–185. IEEE, Piscataway, New

Jersey.

[25] Tolba, C., Thomas, P., ElMoudni, A. and Lefebvre, D. (2003)

Performances evaluation of the traffic control in a single cross-

road by Petri nets. In Proc. IEEE Emerging Technologies and

Factory Automation, Lisbon, Portugal, September 16–19,

pp. 157–160. IEEE, Piscataway, New Jersey.

[26] Wang, J., Jin, C. and Deng, Y. (1999) Performance analysis of

traffic networks based on stochastic timed Petri net models. In

Proc. IEEE Engineering of Complex Computer Systems, Las

Vegas, NE, October 18–21, pp. 77–85. IEEE, Piscataway,

New Jersey.

Traffic Light Control Systems Using Statecharts 649

The Computer Journal, Vol. 49 No. 6, 2006