Java Reference
In-Depth Information
activateEvent("NOTFULL", 0, null );
}
}
}
}
}
Class Transport extends the DiscreteProcess class and implements the state
transitions triggered by the events WORKDONE , ARRIVED , UNLOADED and
LOADED . The first event is raised by the drill or cutter, while the other three
events are raised by the AGV itself. The current state is represented by two
variables: working is true when the transport is executing a mission; loaded
is true when the transport is carrying a piece. This implementation of class
Transport does not manage the synchronization with the assembler. In fact,
it might happen that the assembler's input buffer gets full. In this case the
AGV should suspend the execution of its missions until the input buffer
starts emptying.
package workcell;
import java.util.ArrayList;
public class Transport extends DiscreteProcess {
ArrayList missions # new ArrayList();
// the list of missions
long moveTime; // travel time between two stations
long loadTime; // duration of loading/unloading operations
String loadStation # "Assembler"; // the assembler station
String unloadStation; // the drill or cutter station
String currentPosition; // the AGV's current position
boolean working # false ;
// true if it is executing a mission
boolean loaded # false ; // true if it is carrying a piece
public Transport(String name, DiscreteClock clock,
long moveTime, long loadTime){
super (name, clock);
this .moveTime # moveTime;
this .loadTime # loadTime;
this .currentPosition # loadStation;
attachTo("LOADED", this );
attachTo("UNLOADED", this );
attachTo("ARRIVED", this );
}
protected void notifyEvent(DiscreteEvent event) {
if (event.name.equals("WORKDONE")) {
// drill or cutter have completed a manufacturing
// operation. This event notification corresponds
// to a mission request to the AGV
missions.add(event);
Search WWH ::




Custom Search