Package Overview

The Dist (Distribution) package is a collection of Kernel Procedures concerned with generating stochastic values according to a specified probability distribution. Such values can be applied to any simulation purpose that requires stochastic behavior, such as computing arrival times of interrupts, generating traffic destination addresses, or determining whether a node should be disabled or not.

A common form of stochastic value used in simulations is one that is uniformly distributed within a range starting at zero. The KP op_dist_uniform() provides such a value. This procedure takes a real number (double) argument, which represents the non-zero bound of the range, and returns a uniformly distributed real number between zero and the bound, exclusive. Another KP, op_dist_exponential(), provides a value based on an exponential distribution that takes a real number (double) argument to specify the distribution’s mean.

Complex modeling scenarios require stochastic values that conform to a variety of probability distributions, such as the exponential and normal distributions. In order to obtain these values in a flexible and efficient way, a two-step stochastic outcome computation system is supported by the Dist package. The KP op_dist_load() takes a specification of a probability distribution, and prepares the distribution for efficient use by future process KP calls. Both the supplied Predefined Distributions (such as exponential) and distributions created with the PDF Editor can be set up by op_dist_load(). Once loaded, a distribution can be used any number of times during the simulation. You can then call op_dist_unload() to free the memory when the distribution is no longer needed. Loaded distributions do not support any parameter changes.

Once a distribution has been loaded, a stochastic outcome can be obtained according to the distribution via the KPs op_dist_outcome() and op_dist_outcome_ext(). These KPs take a distribution pointer as an argument and return a stochastic value that conforms to the passed distribution. The KP op_dist_outcome() uses the random number generator of the Simulation Kernel as its basis for selection of a random outcome. The Kernel’s generator is itself based on the BSD random number generator random(). A preference lets you specify whether random number streams apply simulation-wide or per-module (see “per_module_random_stream“ on page 208 for details).

The KP op_dist_outcome_ext() provides an open interface that can be used in situations where you want to base outcome selection on an alternate source of random numbers. However, some distributions need more than one random drawing to generate an appropriate value. The KP op_dist_outcome_gen() lets you specify a user-defined generator, allowing complete independence from the Simulation Kernel’s internal random number generator. The op_prg_random KPs let you create independent random number generators and use them to generate random numbers (see “Random Sub-Package“ on page 6).

Two KPs allow you to estimate background work in a queue that is not caused by explicitly modeled packets. This allows you to model queueing delays without explicitly modeling the packets involved, thereby shortening overall simulation time. The KPs op_dist_qwait_gg1_handle_create() and op_dist_qwait_mg1_handle_create() set up queues for background estimation, and op_dist_qwait_estimate() provides actual estimations of background work.