op_dist_outcome()

Abstract

Generates a floating-point numeric outcome that has the specified distribution, using the Simulation Kernel’s built-in random number generator.

Syntax

op_dist_outcome (dist_ptr)
Argument Type Description
dist_ptr Distribution* pointer to a loaded distribution [A pointer to a distribution can only be obtained from the KP op_dist_load().]

Return Type

double

An outcome of a random variable that has the specified distribution. If a recoverable error occurs, the constant OPC_DBL_INVALID will be returned.

Example

Excerpt from: process model (frms_traf_gen); function block; function frms_traf_gen_schedule().

/* Determine the time at which to schedule the interrupt. */
next_pk_arrvl_time = op_sim_time () + op_dist_outcome (int_arrival_distptr);

/*      Check to verify that this time is within the end time   */
/*      specification for this module. */
if ((next_pk_arrvl_time < gen_end_time) || (gen_end_time == FRMSC_APPL_END_OF_SIM))
	{
	/* Schedule the self-interrupt. */
	op_intrpt_schedule_self (next_pk_arrvl_time, FRMSC_FR_APPL_TRAF_GEN);
	}

Details

The specified distribution can be either a predefined algorithmic distribution, or a numeric tabular distribution that has previously been loaded using the KP op_dist_load(). This KP performs a table lookup for tabular distributions, and performs numeric computations for algorithmic distributions (such as exponential).

The random number stream used by this KP is generated by calls to the BSD random() procedure, and is shared by all Dist package KPs and by the generator modules. The random number stream is dependent on an initial seed, which can be altered via the simulation preference “seed” (see Chapter 1 “Executing a Discrete Event Simulation” on page 1 for more information). Simulation results are repeatable if the simulation inputs are identical, including the same random seed.

Note: 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.

Purpose

Provides a mechanism to obtain a stochastic value that conforms to a probability distribution. The most common application of this capability is to compute stochastic interarrival times that occur between packets generated in a processor. However, any simulation parameter that should be stochastically distributed can be derived from the distribution facility.

A large number of repeated calls to this KP will generate a set of values that conform to the specified distribution.

Errors

  • Program Abort: Segmentation violation. (due to an invalid distribution pointer)
  • Recoverable Error: Distribution pointer is NIL.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com