Java Reference
In-Depth Information
As in previous case studies the simulation is characterized by the
presence of multiple concurrent activities. In the “Manufacturing work cell”
case study (Chapter 9) we adopted a single-thread execution model, where
the evolution of the simulation is caused by the occurrence of discrete
events (ticks) generated by a centralized clock that synchronizes all the
activities. The multithread model is adequate to simulate activities charac-
terized by different temporal evolutions, as in the case of the robot sensors
and actuators in Chapter 10 and in the case of the car parking devices in
Chapter 11. In these case studies every concurrent activity is executed by
an independent thread of control.
For the car painting work cell we adopt the single-thread execution model.
The simulator repeatedly invokes the method flush() of each pump every
T
milliseconds. The flush() method pulls a micro-volume of paint from the
upstream tank and pushes the same micro-volume into the downstream
tank. We assume that the pump has an automatic mechanism that inhibits
the paint transfer when the upstream tank is empty or the downstream tank
is full.
Simulator
Tank redTank
Tank blueTank
Tank greenTank
Tank mixerTank
Pump redInputPump
Pump redOutputPump
Pump greenInputPump
Pump greenOutputPump
Pump blueInputPump
Pump blueOutputPump
Pump drainPump
Pump sprayPump
TankInterface
PumpInterface
int getLevel()
void setOutputFlow(int percent)
Tank
Pump
double color[]
int capacity
int level
Tank inputTank
Tank outputTank
int outFlow
int getLevel()
void push()
void pull()
void setOutputFlow()
void flush()
Figure 13.8 The class diagram of the simulator and its components
Search WWH ::




Custom Search