Java Reference
In-Depth Information
if
(! working) {
// if the AGV is not executing a mission,
// it leaves its current position
// and moves to the unloading station
working
#
true
;
DiscreteEvent mission
#
(DiscreteEvent)
missions.remove(0);
unloadStation
#
(String) mission.value;
// activates the event that notifies its arrival
// at the unloading station
activateEvent("ARRIVED", moveTime, unloadStation);
}
}
else if
(event.name.equals("ARRIVED")) {
currentPosition
#
(String) event.value;
if
(currentPosition.equals(loadStation))
// the AGV is arrived at the drill (cutter) station
// and unloads a piece; when the unloading operation
// has been completed it notifies the machine
activateEvent("LOADED", loadTime, unloadStation);
else
// the AGV is arrived at the assembler station and
// starts loading a piece; when the loading operation
// has been completed, it notifies the assembler
activateEvent("UNLOADED", loadTime, unloadStation);
}
else if
(event.name.equals("UNLOADED")) {
// the AGV has completed the unload operation at
// the drill or cutter station
currentPosition
#
unloadStation;
loaded
#
true
;
// the AGV moves towards the assembler station
activateEvent("ARRIVED", moveTime, loadStation);
}
else if
(event.name.equals("LOADED")) {
// the AGV has loaded a nut or a screw in the
// assembler input buffer
currentPosition
#
loadStation;
loaded
#
false
;
// it starts a new mission if there is a request.
if
(missions.size() > 0) {
DiscreteEvent mission
#
(DiscreteEvent)
missions.remove(0);
unloadStation
#
(String) mission.value;
// activates the event that notifies its arrival
// at the unloading station