Java Reference
In-Depth Information
activateEvent("ARRIVED", moveTime, unloadStation);
working # false ;
Class Assembler extends the DiscreteProcess class and implements the state
transitions triggered by the events WORKDONE , LOADED and UNLOADED .
The first event is raised by the assembler, the second by the AGV and the
third by the inventory. The current state is represented by two variables:
working is true when the assembler is executing an assembling operation;
outputEmpty is true when the assembler's output buffer is empty. This imple-
mentation of class Transport does not manage the synchronization with the
transport since it does not activate the events FULL and NOTFULL that notify
the state of the input buffer. It also does not verify if the output buffer is
getting full.
package workcell;
import java.util.ArrayList;
public class Assembler extends DiscreteProcess {
ArrayList nutBuffer # new ArrayList();
ArrayList screwBuffer # new ArrayList();
ArrayList boltBuffer # new ArrayList();
double maxRate; // maximum number of pieces per minute
int inputSize; // the size of the input buffer
int outputSize; // the size of the output buffer
boolean working # false ;
boolean outputEmpty # true ;
public Assembler(String name, DiscreteClock clock,
double rate, int in, int out){
super (name, clock);
this .maxRate # rate / 60000;
this .inputSize # in;
this .outputSize # out;
attachTo("WORKDONE", this );
protected void notifyEvent(DiscreteEvent event) {
if ("LOADED")) {
// a nut or a screw has been loaded in the input buffer
if (event.value.equals("Drill"))
else if (event.value.equals("Cutter"))
// if the machine is not working and there is at least
// a nut and a screw it starts a new manufacturing
// operation
Search WWH ::

Custom Search