Statistical Data Collectors

Using a Counter

Model Description

   
 

To demonstrate the use of statistical data collectors we will return to the simple model of the rail station of a container terminal used in the Bin sub-section of the Advanced Modelling Features section. Trains collect containers from one of four different storage areas whereas ships deliver containers to all of the storage areas.

We will first add two counters to this model:

  • One to record the number of trains leaving the terminal. Each time a train leaves, it simply has to call its parameter-less update() method to increase this counter by one.

  • A second one to record the overall number of containers loaded onto trains. Each time a train leaves, it has to pass its number of containers to the update(long n) method of this counter.

Now let us take a look at the four previously described steps to integrate the counters into the given model.



   
  http://desmoj.sourceforge.net/tutorial/statistics/counter0.html