ST0
, ST1
, ST2
and ST3
, respectively.
Each station, ST0
, ST1
, ST2
and ST3
,
is an instance of Station
class derived from Atomic
such that it has an input event set
= {?vehicle
,
?pull
} and an output event set
={!vehicle
,
!pull
} and two state variables: phase
{Empty (E
), Loading (L
), Sending (S
),
Waiting (W
), Collided (C
)}, and nso
{false(f
), true(t
)} indicating ``next station is
NOT occupied'' for nso=f
or ``next station is occupied''
for nso=t
.
To avoid collisions that can occur when more than one vehicle
attempts to occupy a station (let's call it
) at the same time,
the station prior to
(let's call it
) should dispatch the
vehicle ONLY when
's nso = f
. The phase
transition diagram of a single station is shown in Figure
3.4 where an arc is augmented by
(pre-condition),(post-condition). For example, when a
station receives ?p
at phase=E
, it makes
nso=f
; if phase=L
and nso=f
, then when it
receives ?p
, it changes into phase=S
internally
without any output indicated by !
. The symbols
?v
, ?p
, and !v
in Figure 3.2 stand
for ?vehicle
, ?pull
, and !vehicle
,
respectively.
The loading time
is assigned as
for ST0
,
ST2
, ST3
;
for ST1
(because ST1
is bigger than the rest other three stations). The initial state
for each station is
for ST0
and
ST2
,
for ST1
and
ST3
.
To model and simulate this monorail system, we build
Station
as follows.