07 Simulation Design
07 Simulation Design
Simulation Design
475-Simde
Modeling Concepts
476-Simde
Modeling Concepts Introduction
Simde.1 Introduction
Previous chapters of this manual discuss how models of networks, nodes, and
processes can be defined using OPNET. The purpose of defining the models is to
be able to exercise them in a dynamic simulation in order to study system
performance and behavior. In this chapter, we will discuss the steps that follow
model specification in order to actually run simulations and collect information
from them. The contents of this chapter are summarized in the following table:
Simulation Design
Simulation Design Chapter: Content Summary
Section Topic
477-Simde
Specifying Data Collection Modeling Concepts
Because the model developer typically needs to perform this type of work on a
fairly frequent and repetitive basis, it is important that the observables of interest
be quickly and conveniently accessible.OPNET provides features that directly
support these types of verifications, as described in subsequent sections.
478-Simde
Modeling Concepts Specifying Data Collection
Simulation Design
modeler. Numerical post-processing of sta-
tistics may also be required after simulations
complete.
479-Simde
Specifying Data Collection Modeling Concepts
Output Vectors The history of a system vari- Automatic for built-in statistics pro-
able can be captured as it var- vided by OPNET; programmatic
ies over time in the form of an for customized statistics computed
output vector. (OV) OVs pro- by user-defined code.
vide insight into the manner in
which the system evolves and
its response to particular inci-
dents during a simulation.
Each OV consists of a series of
values and associated times. A
simulation can be configured
to simultaneously collect multi-
ple independent OVs.
Output Scalars Certain metrics of interest do Automatic for built-in statistics pro-
not vary with time. Instead, vided by OPNET; programmatic
they are a single value that is for customized statistics computed
representative of the system’s by user-defined code.
performance over the course
of the simulation (e.g., the
throughput of the network).
Each of these statistics is
called an output scalar (OS).
Each output scalar is typically
recorded only once per simula-
tion. Output scalars from multi-
ple simulations are then
combined to analyze their
dependency on simulation
inputs, also recorded as sca-
lars.
480-Simde
Modeling Concepts Specifying Data Collection
Simulation Design
they complete.
Output Files
481-Simde
Specifying Data Collection Modeling Concepts
opnet also maintains a log of errors and significant events that occurred during
a simulation. This log (a tab-delimited ASCII file) may be examined using the
simulation log browser. For details, refer to the Project Editor chapter in Editor
Reference.
Simde.2.3 Statistic Collection Mechanisms
In the case of most simulations, a large number of system variables and metrics
are available for collection. Each module at the node level, as well as link at the
network level is the source of a significant number of built-in local statistics, and in
482-Simde
Modeling Concepts Specifying Data Collection
addition a simulation can generate large numbers of global and local user-defined
statistics. However, in general, only a small subset of the available data is of
interest to the simulation developer. Also, collecting all possible information
would be prohibitive in terms of storage space and would negatively impact
simulation speed. To address this problem, OPNET provides mechanisms to
selectively specify which information should be collected as a simulation runs.
These mechanisms are described in this section.
Simde.2.3.1 Probes
Simulation Design
The flow of data into output files is controlled by a special object called a
probe. Probe objects are not part of the model itself, and they do not affect the
behavior of the model during simulation in any way. Instead, they play the role of a
passive data collection device, “attached” to an object in the model that is capable
of generating information in one of the forms described above. In the sense that it
is passive, an OPNET probe is much like an ideal oscilloscope probe used in
analyzing an electronic circuit. By decoupling probes from models, OPNET
provides a powerful mechanism for quickly altering specification of data
collection, without necessitating any changes to the model itself.
Probes can be specified using the Probe Editor, which allows the
correspondence between probe objects and model objects to be established via a
graphical selection. Any number of probes may be specified and the collection of
probes is saved as a probe list. The probes of a probe list are applied as a group to a
simulation model at the time that the simulation is executed. Multiple probe lists
may be separately specified for the same model. They may then be applied to the
model during distinct simulations, but only one probe list may be used for a given
simulation run.
There are several different types of probes, corresponding to the different types
of supported output and objects in OPNET. In broad terms, there are three types of
probes: statistic probes, animation probes, and attribute probes. Within each of
these categories there may be several additional varieties of probes. Each of these
is described in this section and summarized in the following table.
483-Simde
Specifying Data Collection Modeling Concepts
Each probe is an object with a set of attributes that specify which output source
it applies to, as well as various options concerning how to collect the data. The
attributes vary for each type of probe. For details on the use of each attribute, refer
to the Probe Reference chapter of Modeling Reference.
OPNET supports local and global statistics. Local statistics are associated with
particular objects, which the statistic probes must reference in order to collect data.
The specific objects that support local statistics are nodes, links, and modules.
Node statistics actually originate in modules or submodules within the nodes, but
they are promoted to the node level by the node model specification (refer to the
Node Domain chapter of Modeling Concepts for more information on statistic
promotion). This mechanism allows users of node models (such as IT
DecisionGuru users) to access these statistics without having internal knowledge
of the node model’s components. Node and module statistics are supported by the
node statistic probe object, which provides attributes for specifying the physical
object being probed, down to the submodule level if necessary. Node statistic
probes support both built-in statistics of objects, as well as the user-defined
statistics that are declared by process models. Link statistic probes provide access
to pre-defined statistics that are computed for point-to-point and bus link objects.
For complete information on the individual statistics that are pre-defined by
OPNET for each object, refer to the Node Reference and Network Reference
chapters of Modeling Concepts.
484-Simde
Modeling Concepts Specifying Data Collection
Simulation Design
Transmitter Throughput, utilization, queue size
channels
Global statistics provide information that relates to the overall system. Many
separate objects may contribute to a single global statistic during a simulation. For
example, every node in a network model may use the same global statistic to
record the end-to-end delay experienced by the packets it receives. The result is a
single statistic for the network’s end-to-end delay performance. Global statistics
are declared by process models and are supported by the global statistic probe
object. Of course, no objects are referenced in a global statistic probe; only the
name of the statistic is specified.
485-Simde
Specifying Data Collection Modeling Concepts
received power
All statistic probes offer a set of common options that are specified via their
attributes. Each probe can act as the source of both output vector and output scalar
statistics, as specified by their vector data and scalar data toggle attributes.
Both may be simultaneously enabled. If vector data is enabled, all of the values
of the statistic are collected in an output vector in the simulation’s output file. The
vector’s statistic collection can optionally be restricted to a simulation time frame,
as specified by the values of the vector start and vector stop attributes. This
is often useful to reduce the storage requirements for very dense statistics,
particularly since only a portion of a statistic’s activity is usually of interest. Often,
this period is at the end of the simulation, or after a particular event of interest
(e.g., a component failure), in order to analyze transient behavior.
If a statistic probe’s scalar data attribute is enabled, then the probe will
generate a single scalar value in the simulation’s output scalar file at the end of the
simulation. The scalar value is computed as a function of all of the statistic’s
individual values over the course of the simulation according to a specified metric.
As with output vector collection, the scalar statistics computation can be restricted
to the values experienced by the statistic during a particular period. This period is
486-Simde
Modeling Concepts Specifying Data Collection
specified using the scalar start and scalar stop attributes of the probe. The
supported metrics are specified using the scalar type attribute and are
summarized in the following table:
sample mean The mean of the values of all the updates in the collection window
Simulation Design
(i.e., the sum of all the update values divided by the number of
updates)
time average The average value over time of the values generated during the
collection window; this average is performed assuming a “sam-
ple-and-hold” behavior of the data set (i.e., each value is
weighted by the amount of time separating it from the following
update and the sum of all the weighted values is divided by the
width of the collection window)
min value The minimum value encountered during the collection window
max value The maximum value encountered during the collection window
487-Simde
Specifying Data Collection Modeling Concepts
all values All updates to the statistic are recorded without modification.
glitch removal When multiple updates to a statistic occur at the same time,
only the last update is retained.
Normal mode data includes all up- Bucket mode data is a time average of up-
dates of the queue size, showing dates every 25 seconds. It is much sparser,
detailed changes over time. but captures the general trends over time.
Depending on the statistic and the goals of the modeler, different capture
modes or options of the capture mode may be more appropriate. The figure above
illustrates the effect of using the bucket capture mode when collecting a quickly
varying statistic, such as the size of a queue with roughly equal random arrival and
488-Simde
Modeling Concepts Specifying Data Collection
departure rates. The bucket mode results are useful because they show the general
trend of the statistic’s variations, even if they do not capture any of the rapid
changes. However, because the changes are rapid, the time-averaged bucket mode
output fails to show how high the queue size can get. With some statistics that can
quickly rise and fall, this deficiency can be even more pronounced. If a buffer is
being sized, for example, the peak values may be of interest. The result of using the
bucket mode with a maximum value computation appears below.
Simulation Design
Comparison of Normal Mode and
Bucket Mode with Maximum Value Option
489-Simde
Specifying Data Collection Modeling Concepts
Since user-defined code can access the values of attributes and has the ability to
also write values into the simulation output files, it is of course possible for process
models to save attribute values in the simulation output files. Process models can
also perform computations that combine or otherwise process the values of
multiple attributes. However, in cases where the values of numerical attributes are
of interest without further processing, special probes called attribute probes can be
used. Numerical attributes include the integer, double, toggle, and toggle
double data types. Each attribute probe applies to one object or simulation attribute
and generates a corresponding scalar value in the output scalar file. The attribute
probe has an attribute called object that allows it to refer to any object at the
network or node level in the model. If a simulation attribute is declared by any of
the process models in the system, an attribute probe can refer to it simply by
leaving the object attribute blank. The following graph shows an example of a
plot that can be obtained using an attribute probe for the independent variable (i.e.,
input), and a statistic probe for the dependent variable (i.e., output).
Each point in the plot is the result of one simulation. The value of
“Processing Speed” changes and is recorded by an attribute probe
in each simulation. The resulting value of “Peak Queue Size” is re-
corded by a statistic probe. Both are scalars and can be plotted
against each other in the Analysis Tool.
490-Simde
Modeling Concepts Specifying Data Collection
Simulation Design
Three types of animation probe objects, called automatic animation probes,
custom animation probes, and statistic animation probes, may be placed in a
simulation’s probe file to enable generation of animation data. Multiple probes of
each type may coexist within the same probe file. Automatic animation probes and
statistic animation probes both enable built-in animation capabilities of OPNET
models. They provide the simplest means of obtaining animations with an OPNET
simulation, since no additional specifications are required within the model.
Custom animation probes act as an enabling device for animation requests that are
generated by user-defined processes. Custom animations provide flexibility to
represent general information during an animation, but require programmatic
specification by the model developer.
Animation probes can be placed on objects in both the network and node
domains. Depending on the type of object affected by the probe, different types of
animations will result, as summarized in the table below. For complete
descriptions of the functionality provided by each type of automatic animation,
refer to the op_vuanim Utility chapter in Utility Programs.
Each automatic animation probe includes attributes called subnet, node, and
module used to specify the affected object. The representation attribute is then
used to select the desired form of automatic animation. In addition, each probe
includes attributes to restrict the simulation time window during which it will be
491-Simde
Specifying Data Collection Modeling Concepts
active, and to control the positioning and dimensions of the resulting animation
window. For a description of the automatic animation attributes, refer to the Probe
Reference chapter of Modeling Reference.
492-Simde
Modeling Concepts Specifying Data Collection
Simulation Design
Node (fixed, mobile, All processes executing within any processor or
or satellite) queue contained within the node; in addition all
pipeline stages associated with transmitter or
receiver modules within the node.
Custom animation probes have a set of attributes that is essentially the same as
that of automatic animation probes: attributes specifying the probed object, a time-
window of effectiveness, and the geometric properties of the display window. In
493-Simde
Specifying Data Collection Modeling Concepts
addition, an attribute called label can be used to specialize the applicability of the
probe. User-defined code can determine if a probe with a particular label exists,
and if so, which animation viewer (i.e., animation window) is associated with that
probe. The code can then enable appropriate animation requests and direct them to
the required windows. The label also serves as a rendezvous mechanism, allowing
different processes and pipeline stages to obtain the same animation viewer ID and
coordinate their activities within the same window. The meaning of probe labels
are user-defined, but the Simulation Kernel supports this feature with the KP
op_anim_lprobe_anvid(), which converts a label to an animation viewer ID. For
more information on the use of custom animation labels, refer to theAnimation
Package chapter of Simulation Kernel. For more information on the label
attribute refer to theProbe Reference chapter of Modeling Reference.
Statistic animation probes can only work in association with other statistic
probes. In other words, a statistic animation can only be provided for a statistic that
is already probed via a node, link, or global statistic probe. The statistic animation
probe uses its statistic attribute to establish an association with a statistic probe.
The value of this attribute must match the full hierarchical name of the statistic as
specified in the statistic probe (see example below), or the ordinate label of the
statistic probe, if one has been specified. Options of the corresponding statistic
probe, such as start and stop times, and capture mode, automatically apply to the
statistic animation probe. The final graph that is obtained at the end of a statistic
animation is therefore identical to the output vector that results from the statistic
probe.
494-Simde
Modeling Concepts Simulation Construction
Simulation Design
vector options
Note: The window name attribute must have a unique value for each anima-
tion probe. You cannot view multiple animations in a single window.
495-Simde
Simulation Construction Modeling Concepts
Simulation Kernel Provides the framework for all simulations including basic services
such as model loading, event scheduling and delivery, statistic col-
lection, memory allocations, etc. The Simulation Kernel contains all
Kernel Procedures (KPs) that are called by user-developed models.
Process Models Each process model that is included in a simulation is compiled into
a C language file with suffix “.pr.c”; this file is then compiled with the
host computer’s C compiler to generate an object file with suffix
“.pr.o”.
External Object Contain functions that play a supporting role for the process models
Files and pipeline stages in a simulation. This software may be devel-
oped in C or in other languages that are callable from C. They can
be compiled independently of OPNET and must have the suffix
“.ex.o”. External files can be made known to OPNET in two ways:
1) a process model’s dependency on an external file can be
expressed by declaring the external file in that model’s specifica-
tion; 2) a network model can express the dependency of any of its
included models on an external file, via a similar declaration.
External Archives Similar to external object files, but are packaged in the form of an
archive containing multiple object files. This is sometimes a more
convenient way of managing groups of object files that belong
together as part of a “package”.
Binding Approaches
496-Simde
Modeling Concepts Simulation Construction
packaged together into a single large file which is the simulation program. The
program is ready to run at any time with no further assembly work to be done.
Dynamic binding uses a more sophisticated and complex process to assemble the
simulation at the time it is executed. Each approach offers its own advantages and
disadvantages, as summarized in the table below. Refer to the documentation
provided for your host computer’s compiler and linker for more information on
issues related to the underlying static and dynamic linking mechanisms.
Simulation Design
Static vs. Dynamic Binding of Simulation Programs
Issue Details Advantage
Binary Size Ultimately, once loaded into memory, dynamic simula- Dynamic
tions must include all of the object files that static simu-
lations include. However, they offer a significant
advantage in terms of disk storage space. This is due
to the fact that each static simulation incorporates
object files that are also in other simulation programs.
In particular the Simulation Kernel, which is a large file
is redundantly included by static simulations. In con-
trast dynamic simulations include object files by refer-
ence, meaning that each object file can be stored on
disk just once.
497-Simde
Simulation Construction Modeling Concepts
OPNET’s bias toward dynamic binding is apparent in the fact that its graphical
user interface offers no support for static binding of simulations. In order to
statically bind a simulation, the op_mksim utility must be used. Refer to the
Program Descriptions chapter of External Interfaces for more information on
op_mksim.
498-Simde
Modeling Concepts Simulation Construction
Simulation Design
discusses the functions of op_runsim in more detail. Refer to the Program
Descriptions chapter of External Interfaces for more information on op_runsim.
Repositories
A repository can be maintained for each separate network model that is used
for simulation. When op_runsim is invoked to execute a simulation, it examines
the network model’s repository to determine if it is still up to date. It is considered
to be up to date if its last modification date is more recent than the modification
date of each of the source files that correspond to the repository’s object modules.
For example, for each process model included in the simulation, op_runsim
checks the repository date against the date of the process models’ portable
“.pr.m” file. If so, it can use it to save some portion of the time required to bind
the simulation. If not, it reconstructs the repository from scratch and leaves it in
place for future executions. Note that this approach partially negates the smaller-
size advantage that dynamic simulations have, since a repository file introduces
some redundant storage of object files. However, repositories are still significantly
smaller than statically-bound simulations because they do not include the
Simulation Kernel.
Note: Repositories are essentially interim files that are used for the binding
process. They can be deleted without losing model specification information.
499-Simde
Executing Simulations Modeling Concepts
500-Simde
Modeling Concepts Executing Simulations
Simulation Design
Creating Variable Behavior
The mechanism used to select new random number sequences relies on starting
the random number generator in a different state. Because it determines all future
output of the random number generator, this initial state is known as the random
number seed. For OPNET simulations the random number seed can be set with the
integer environment attribute seed; in addition, it may be designated from within
the Simulation Tool, on a per-simulation basis.
501-Simde
Executing Simulations Modeling Concepts
In both cases, random numbers are drawn from a single random number
sequence initialized with the value of the seed environment attribute. The random
number generator used to create this sequence is provided by the host computer’s
operating system and may vary on certain platforms. The following table
summarizes the random number generation sources used on each operating system
supported by OPNET. Contact OPNET Technologies for information on operating
systems other than those listed in this table.
HP HP-UX random()
The primary mechanism used to vary model configuration is based on the use
of promoted object attributes. Promoted attribute values can be altered at each
simulation, without modification of the simulation models or simulation program.
Promoted attributes are attributes of objects whose values have been left
unassigned, precisely so that these assignments could instead be completed at the
time of simulation execution. In other words, promoted attributes can be thought of
as simulation program parameters provided by the model designer. For more
502-Simde
Modeling Concepts Executing Simulations
Simulation Design
to facilitate this type of parameterization.
Both promoted attributes and simulation attributes are treated in the same
manner when a simulation’s parameters are specified. OPNET’s Simulation Tool
allows each simulation to complete a numerical attribute’s specification by
providing either a specific value, a range of values, or a set of discrete values. Non-
numerical attributes can only be assigned a specific value. When at least one
attribute is assigned a range or set of values, the user has implicitly specified
multiple simulation runs to be executed, each with a distinct value of the attribute.
When more than one attribute is assigned a range or set of values, then the
Simulation Tool executes a separate simulation for each combination of the
attribute values. Care should be taken not to launch an excessive number of
simulations in this manner. The following figure illustrates the specification of
simulation parameters in the Simulation Tool. For more information on using this
tool, refer to the Simulation Tool chapter of Editor Reference.
Note: When executing simulations outside the Simulation Tool, attributes can
be assigned via the full range of environment attribute mechanisms provided
for all OPNET programs and described in the System Environment chapter of
the External Interfaces manual . These mechanisms include assignment via the
503-Simde
Executing Simulations Modeling Concepts
command line, as well as use of one or more environment files, and the environ-
ment database (env_db) file.
Simde.4.2 Simulation Sequences
The main use of the promoted attribute and simulation attribute mechanisms
described above is for conducting studies where attributes are varied over a range
of values. For each new attribute configuration, a new simulation is executed, and
if stochastic behavior is involved in the model, multiple simulations may be run
with different random number seeds. Thus, the complete study is based on a
sequence of simulations.Each simulation in the sequence records simulation output
in vector, scalar, or animation form, for later analysis. In general, scalars are used
when sequences of simulations are executed because this is the form of output data
designed for parametric studies and that can be accumulated in a single output file
over the course of many simulations. However, it may be interesting to observe
dynamic behavior for certain simulations in the sequence by also storing vector
data.
504-Simde
Modeling Concepts Executing Simulations
Simulation Design
Network Model Name of the network model that will be simulated. The simula-
tion program loads the model to determine which objects are
present and how they are configured.
Probe File Name of an optional probe list which specifies which output
data should be collected during the simulation(s).
Vector File Name of the output vector (OV) file(s) that output vectors will
be directed to. OV files can later be loaded to create plots. For
simulation sets specifying more than one simulation, the “save
vector file for each run in set” option must be enabled in order
to specify an OV file name. This option causes a suffix to be
appended to the name in order to differentiate the OV files.
Scalar File Name of the output scalar (OS) file that all output scalars will
be directed to, for all simulations in the set. OS files can later
be loaded in the Analysis Tool to create plots. Note that output
scalar files accept cumulative data and therefore can be refer-
enced by multiple simulation objects without overwriting infor-
mation.
Seed The integer value of the random seed used to set the initial
state of the Simulation Kernel’s built-in random number gener-
ation.
505-Simde
Executing Simulations Modeling Concepts
Environment Files A set of files that support specification of attributes for the sim-
ulation program. Primarily used for model attribute specifica-
tion, but other attributes can be specified in these files as well.
Environment files have the “.ef” suffix. Refer to the Envi-
ronment Attributes chapter in External Interfaces for details
on environment files.
Default Mode The “use default values for unresolved attributes” instructs
OPNET to automatically supply default values rather than
prompt the user when an attribute’s value has been left
unspecified. Default values for attributes are inherent in their
definition. Refer to the Modeling Framework chapter of
Modeling Concepts.
506-Simde
Modeling Concepts Executing Simulations
Simulation Design
Expansion of graph in the
region where “Processing
Speed” = 0.6,shows four
separate values of “Peak
Queue Size”, correspond-
ing to the four different
random seeds.
Scripted Sequences
507-Simde
Executing Simulations Modeling Concepts
#!/bin/csh
508-Simde
Modeling Concepts Executing Simulations
#!/bin/csh
Simulation Design
# Issue update statement indicating which sim. is about to happen
echo 'executing with TTRT = ' $TTRT
509-Simde
Executing Simulations Modeling Concepts
510-Simde