Advanced Modelling Features

Bin

The Model Class

   
 

In the description of the implementation, we will focus on the Bin construct and its use. As usual, we derive our own model class from desmoj.core.simulator.Model, define the necessary attributes (in this case: distributions and a Bin object for each of the four destinations), and implement a constructor and the required methods description(), init() and doInitialSchedules() as well as a main() method. To be able to use the Bin construct we will have to import the desmoj.core.advancedModellingFeatures package.

The following code snippet shows only the parts of the model class relevant to the Bin objects.

import desmoj.core.simulator.*;
import desmoj.core.dist.*;
import desmoj.core.advancedModellingFeatures.Bin;

/**
 * This is the model class. It is the main class of a simple process-oriented
 * model of the railway station inside a container terminal using bins to represent
 * different storage areas.
 */
public class BinExample extends desmoj.core.simulator.Model {

   /** A Bin construct used to used to keep the Northern Europe bound containers */
   Bin north;
   /** A Bin construct used to used to keep the Central Europe bound containers */
   Bin central;
   /** A Bin construct used to used to keep the Eastern Europe bound containers */
   Bin east;
   /** A Bin construct used to used to keep the Germany bound containers */
   Bin germany;

   // additional model attributes, e.g. distributions
   ...

   // constructor
   ...

   /**
    * initialises static model components like distributions and queues.
    */
   public void init() {

      // initialise distributions
      ...

      // initialise the Bin constructs, one for each destination
      // each with an initial number of 50 containers already stored in them
      north = new Bin(this, "Northern Europe", 50, true, true);
      central = new Bin(this, "Central Europe", 50, true, true);
      east = new Bin(this, "Eastern Europe", 50, true, true);
      germany = new Bin(this, "Germany", 50, true, true);
   }


   // additional required methods
   ...

}

We will now take a look at the two dynamic model components that use the bins. Let us start with the ship.



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