Distributions

General Use

   
 

We will just give a general outline of how to use distributions in DESMO-J. It doesn't make much sense to have a special example model with only distributions as components since we need dynamic model components to drive a simulation. Moreover, each of the example simulation models discussed in this tutorial uses distributions so they already provide the necessary examples.

In general, you will need to apply the following if you want to use a distribution in a DESMO-J model:

  1. Import the package desmoj.core.dist into your model class.
  2. Add a field (an attribute) of the desired distribution type to your model class.
  3. Initialise your distribution object in the init() method of the model class.
  4. Throughout your dynamic model components (processes or events), call the sample() method of the distribution object whenever you need a new random sample.

Note: If you want to use the sample values of a numerical distribution as simulation time values to schedule a new event or activate a simulation process after some time-consuming activity is finished, it is a good idea to call the distribution object's setNonNegative(true) method directly after initialising. This will prevent the random number stream from producing negative samples which won't be accepted as parameter values for TimeSpan objects.

We recommend you refer to either the Processes Step by Step or the Events Step by Step sections for an example on how to use distributions in DESMO-J.



   
  http://desmoj.sourceforge.net/tutorial/distributions/1.html