Java Reference
In-Depth Information
DiscreteProcess
DiscreteClock
0 .. n
1 .. 1
activeEvent
notifyEvent
scheduleEvent
1 .. 1
0 .. n
PieceSource
DicreteEvent
name
raiseTime
subscription
Figure 9.7
The analysis diagram of the first prototype
DiscreteEvent
is the basic entity that records the name of an event (e.g.
WORKDONE
) and its raise time.
DiscreteProcess
represents the generic finite
state automaton and has two main functionalities:
To update the automaton current state when an enabled event is notified.
■
To activate events when a state transition occurs.
■
DiscreteClock
represents the centralized clock and has two main function-
alities:
To schedule events. It is the bookkeeper of the current time and of the
scheduled events. It knows what event is next to be raised and when. It
also knows which processes are listening to which event.
■
To raise events when their lifetime has expired. It notifies the processes
that are listening to them.
■
PieceSource
represents the automated inventory system that feeds the drill
and cutter input buffers with raw pieces. It generates
LOADED
events at
random time instants.
The resulting application has a graphical user interface that displays the
sequence of events that are fired from the beginning to the end of the simu-
lation. For each event, the interface shows the event name, the raise time
and the name of the process that is broadcasting the event.
9.4.2
Design
We need the class
WorkCell
to represent the entire manufacturing work cell.
It encapsulates the discrete processes embedding the dynamics of the work
cell subsystems (see Figure 9.8). This class listens to all the events raised by
the work cell subsystems and manages the graphical user interface that
displays the state of the sequential processes every time a state transition
occurs.
WorkCell
encapsulates the global clock that synchronizes the event-
based communication between the discrete processes.