Advanced Modelling Features

Bin

The Ship Process

   
 

Ships are modelled as simulation processes. The Ship class carries four attributes to store the number of containers this ship delivers to each of the four different storage areas (bins); they are called numNorth, numCentral, numEast, and numGermany. Let's have a look at the lifeCycle() of this process:

/**
 * Describes this ship's life cycle:
 *
 * On arrival, the ship will deliver a number of containers to each of
 * the four storage areas. The duration of the unloading is not modelled.
 * After unloading it leaves the system.
 */
public void lifeCycle() throws SuspendExecution {

   // the ship arrives and delivers containers to each bin
   // east
   myModel.east.store(numEast);
   sendTraceNote("number of containers in east: " + myModel.east.getAvail());

   // north
   myModel.north.store(numNorth);
   sendTraceNote("number of containers in north: " + myModel.north.getAvail());

   // central
   myModel.central.store(numCentral);
   sendTraceNote("number of containers in central: " + myModel.central.getAvail());

   // Germany
   myModel.germany.store(numGermany);
   sendTraceNote("number of containers in german: " + myModel.germany.getAvail());

   // send a message into the trace after service
   sendTraceNote("leaves the port");

   // ship finished and dismissed...
}

The lifeCycle() of a ship is exceptionally simple. The activated ship just delivers its stored containers to the corresponding bins and...   terminates. Simple as that.



   
  http://desmoj.sourceforge.net/tutorial/advanced/bin3.html