Java Reference
In-Depth Information
numPieces !! ;
}
}
}
Class WorkCell creates and initializes all the subsystems. For the sake of
simplicity, the process data characterizing the subsystems' behaviour
(transport time, processing time, etc.) are hard coded in the current imple-
mentation. The work cell listens to all the events raised by the subsystems in
order to refresh the graphical user interface that displays the evolution of
the simulation every time an event is broadcast.
package workcell;
public class WorkCell extends DiscreteProcess {
WorkCellGUI gui;
PieceSource nutSource;
PieceSource screwSource;
Machine drill;
Machine cutter;
Assembler assembler;
Transport transport;
PieceSink sink;
public WorkCell(String name, DiscreteClock clock,
WorkCellGUI gui) {
super (name, clock);
this .gui # gui;
// creates the work cell subsystems
nutSource # new PieceSource("NutSource", "Nut",
clock, 80);
screwSource # new PieceSource("ScrewSource", "Screw",
clock, 70);
drill # new Machine("Drill", clock, 40, 4, 4);
cutter # new Machine("Cutter", clock, 30, 4, 4);
transport # new Transport("AGV", clock, 650, 300);
assembler # new Assembler("Assembler",
clock, 35, 4, 4);
sink # new PieceSink("Sink", clock, 50);
// attaches the listeners to the events raised by the
// broadcasters
drill.attachTo("LOADED", nutSource);
drill.attachTo("UNLOADED", transport);
cutter.attachTo("LOADED", screwSource);
cutter.attachTo("UNLOADED", transport);
assembler.attachTo("LOADED", transport);
assembler.attachTo("UNLOADED", sink);
transport.attachTo("WORKDONE", drill);
transport.attachTo("WORKDONE", cutter);
Search WWH ::




Custom Search