Professional Documents
Culture Documents
06 22 PR
06 22 PR
6 Process Editor
A process in the context of computer systems and communications networks
can be viewed as a series of logical operations performed on data, and the
conditions that cause these operations. Processes may be implemented in
terms of both hardware or software components.
OPNET process models describe the logic of real-world processes, such as:
• Queuing disciplines
• Operating systems
The Process Editor provides the necessary features for specifying process
models that consist of both graphical and textual components. It uses state
transition diagrams (STDs) to graphically depict the overall logical organization
of the process model. Icons within an STD are used to represent logical states,
and lines are used to represent transitions between states. The operations
performed by a process model are described in statements based on the C or
C++ languages; these statements can be associated with states, transitions, or
special blocks within the process model. Editing pads are used to enter the
statements associated with states and blocks.
The combination of graphical and text entry components within the Process
Editor has two key benefits:
• The graphical components allow you to visualize the modes of the process
and the flow of control between these modes. This representation assists
those responsible for maintaining the model by inherently documenting
certain aspects of its structure.
• The provision for direct entry of C or C++ statements ensures that there are
few limitations to the complexity and fidelity of the model.
For more information about forced and unforced states, see State Transition
Diagrams on page MC-5-22
File Contains operations that relate to high-level File Menu on page ER-2-2
functions such as opening and closing
projects, saving scenarios, importing
models, and printing graphics and reports.
Edit Contains operations that allow you to edit Edit Menu on page ER-2-5
the preferences that control program
operation and to manipulate text and
objects.
FSM Contains operations for creating a state FSM Menu on page ER-6-6
transition diagram of the finite state
machine that defines the process model.
Code Blocks Contains operations that allow you to Code Block Menu on
specify the C/C++ code that implements a page ER-6-7
process.
Windows Lists all open editor windows and allows Windows Menu on
you to make one active. page ER-2-7
Note—The editor menus on your machine may vary from those described here,
particularly if there has been any UI customization or use of ETS.
In addition to the menu bar menus, several pop-up menus are available within
the Process Editor:
Note—Changes to Enter or Exit Execs are not saved to disk until you save the
process model. Save the process model by selecting Save from the Process
Editor’s File menu.
There is also an operation available within the Process Editor that does not
appear on a menu:
Interfaces Menu
The Interfaces menu includes operations that allow you to edit a process
model’s interfaces to other processes and to the project as a whole.
Model Attributes Defines attributes for the process model. Model Attributes on
These attributes are promoted to page ER-6-12
processor or queue modules at the node
level.
Local Statistics Declares named statistics that are scoped Local Statistics on
to the queue or processor module and that page ER-6-12
the process computes and generates.
Global Statistics Declares named statistics that are scoped Global Statistics on
to the simulation as a whole and are page ER-6-10
computed and generated by this process
model. Global statistics usually represent
system-wide metrics.
FSM Menu
The FSM menu includes operations for creating a state transition diagram of the
finite state machine that defines the process model.
Create State Creates a new state within the process Create State on
model. page ER-6-15
Set Initial State Sets the selected state in the process to Set Initial State on
be the initial one. page ER-6-17
Note—Changes to code blocks are not saved until you save the process model.
Save the process model by selecting Save from the Process Editor’s File menu.
State Variables Defines variables that retain their value State Variables on
from one process invocation to the next. page ER-6-21
Temporary Variables Defines variables that retain their value Temporary Variables
only during the span of a single process on page ER-6-22
invocation.
Termination Block Defines C/C++ statements that run just Termination Block on
before a process is destroyed. page ER-6-23
Compile Menu
The Compile menu includes operations for processing the C/C++ code of a
process model.
Enable C++ Code When selected, causes the Process Editor Enable C++ Code
Generation to generate C++ code instead of C code. Generation on
page ER-6-25
Compile Code Generates the C or C++ source file and Compile Code on
object code for the process model; saves page ER-6-24
the model.
Compile Code Same as the Compile Code operation, but Compile Code
(Advanced) allows additional control over the (Advanced) on
compilation process and the types of page ER-6-25
object files created.
List Code Displays the C/C++ source file generated List Code on
by compiling the process model. page ER-6-26
Toolbar Buttons
The Process Editor has toolbar buttons for frequently-used operations. For each
toolbar button—the name appears as a tooltip when you rest the cursor on the
button.
To configure the toolbar buttons, see Configuring the Toolbar on page ER-1-7.
Global Attributes
This operation allows you to define new global attributes and to edit or delete
existing ones. Global attributes are not associated with any particular object, but
are scoped globally to the simulation as a whole. Typically, global attributes are
needed by an entire class of objects in a simulation, such as all of the processes
of a particular type. These processes share the global attribute and so are
guaranteed to agree on its value (as opposed to process model attributes, which
provide each process model instance with its own independent value).
• Modeling Concepts
Global Statistics
This operation declares named global statistics that can be recorded during
simulation and viewed as results. Global statistics are scoped to the simulation
as a whole, in contrast to local statistics, which are scoped to a particular queue
or processor. In other words, multiple processes, as well as pipeline stages, all
at different locations in the model’s system, can contribute to the same shared
statistic. This is done by referring to the statistic by name and obtaining a
statistic handle. See Chapter 1 Introduction on page DES-1-1 for more
information about statistic handles. Global statistics cannot be used as the
sources of statistic wires.
When you choose this operation, the Declare Global Statistics dialog box
appears. In this dialog box, you can create a new global statistic, delete an
existing statistic, or modify some aspects of a statistic. To sort the table, click in
a heading cell. Repeated clicks toggle the sort order.
The following table lists the fields in the Declare Global Statistics dialog box.
Description Brief description of the statistic. Left-click to display the full description in
a text edit pad.
Group Group the statistic belongs to. This group is used to organize the statistic
in the hierarchy shown in the statistic browser.
Low Bound The lowest ordinate shown on a graph when the statistic is plotted. The
low and high bounds are considered when drawing graphs, although the
bounds are not absolute limits.
Most statistics do not collect negative values, so you can usually set this
value to 0. Built-in statistics have a low bound of 0.
High Bound The highest ordinate shown on a graph when the statistic is plotted, as
long as the actual results are less than the high bound value. If a value
collected for the statistic is higher than the high bound you set, the vertical
axis will be expanded so the highest data point can be graphed correctly.
• Modeling Concepts
Local Statistics
This operation declares named statistics that can act as sources of statistic
wires at the node level, as well as node statistic probes defined in the Probe
Editor. Local statistics are scoped to the queue or process module in which a
process operates. In other words, each separate instance of the process model
can individually maintain a local statistic with the same name. These statistics
vary independently over time, can be separately probed, and can be used to
feed statistic wires.
When you choose this operation, the Declare Local Statistics dialog box
appears. In this dialog box, you can create a new local statistic, delete an
existing statistic, or modify some aspects of a statistic. To sort the table, click in
a heading cell. Repeated clicks toggle the sort order.
The fields in this table are the same as for the Declare Global Statistics dialog
box, as listed in Table 6-6 on page ER-6-11.
• Modeling Concepts
Model Attributes
This operation allows you to define new process model attributes and to edit or
delete existing ones.
For more information about process model attributes, see Process Domain on
page MC-5-1.
ODB Labels
This operation lets you associate descriptions with any labels used in a process
model. This information can be displayed in the OPNET Debugger. (See the
ODB command lmap on page DES-4-52.) The labels and descriptions you
define here should reflect the labels used in process model code. However,
there is no enforcement on the validity of the defined labels, nor do they affect
compilation of the process model or its use in ODB.
• Model Safety Has Not Been Studied—MT safety is unknown. Whether the
code will be run in parallel or sequential mode is determined by the
parallel_sim.unknown_process_mt_safety_handling preference.
WARNING—Do not select the Support Parallel Execution option unless the
process model code is MT safe, as described in Making Models Parallel-Safe
on page MC-10-50.
Process Interfaces
This operation allows you to set values for and specify the behavior of the
built-in attributes of queues and processors. The functions supported by this
operation are a subset of those supported by the node model interface for
built-in attributes of node objects. See Node Interfaces on page ER-5-7 for a
description of these functions.
The process model attribute interface therefore applies only to control of built-in
attributes of queues and processors. This mechanism is useful to simplify the
attribute lists of queues and processors and to enforce particular attribute
settings that the process model relies on. For example, a process model
implementing a statistic collection process may rely on the receipt of an end
simulation interrupt. The process model developer can guarantee that a
processor module will provide this service by enabling and hiding the “endsim
intrpt” attribute of the processor via the process model attribute interface. By
hiding the attribute, the process model developer prevents its value from being
changed at the node level.
Not all built-in attributes of queues and processors can be controlled in this way.
For more information about specific built-in attributes that can be affected by
lower-level model attribute interfaces, see Modeling Concepts.
Create State
This operation creates a new state within the process model being edited. If the
newly created state is the first state created in the process model, then the state
is set to be the initial state. This is indicated by the white arrow (black arrow on
monochrome monitors) to the left of the state. Newly created states are named
by default, but do not contain executive statements or have transitions. These
elements can be added via the state’s attribute menu (name and executives) or
via the Create Transition operation.
Newly created states are unforced by default. They appear red on color displays
and white on monochrome displays. Unforced states allow the process model
to release control back to the Simulation Kernel and “rest” while the Simulation
Kernel attends to other tasks. Forced states bypass the rest phase and force the
FSM to continue through and execute with no logical breaks.
For more information about forced versus unforced states, see Process Domain
on page MC-5-1.
Create Transition
This operation creates transitions between states in a process model. A
transition is depicted by an arc (or alternatively, a series of straight segments)
connecting two states, and defines the possible progress of the FSM from one
state to another. The beginning state of the transition is called the source state;
the ending state is the destination state.
For detailed information about transitions, see Process Editor on page ER-6-1.
Multiple-Segment Transitions
It is possible to draw transitions with more than one line segment. The presence
of additional line segments does not affect the process model logic in any way.
If a transition has multiple line segments, you can use the mouse to move it to
a new location (the end segments change to reflect the new location).
1 Choose FSM > Create Transition and left-click on the source state.
2 Left-click on the desired location of the first vertex. This location must be within the
Process Editor window and not over a state.
➥ OPNET follows with a “rubber band” line extending from the last vertex to the
current location of the pointer.
• It is used to set the initial values of key variables in the process. These
variables are initialized when the process is first “awakened”. Awakening
may occur at the beginning of the simulation if the “begsim interrupt” is
enabled on the module associated with the process. Otherwise, awakening
may occur when the first interrupt arrives at the process.
• The initial state of a process is usually executed only once in the course of
the simulation.
Note—Changes to code blocks are not saved until you select File > Save.
Diagnostic Block
This operation presents a dialog box that allows the diagnostic block to be
defined for a process model. The diagnostic block contains C or C++ language
statements that send diagnostic information to the standard output device.
Often, this is done by making calls to the standard I/O function printf() or to
OPNET KPs that print messages. Statements in the diagnostic block have full
access to the process’s state variables, but not the temporary variables.
Diagnostic statements can thus generate a report of the process’s internal state.
The diagnostic block procedure is called by the Simulation Kernel via the
OPNET simulation debugger (ODB). ODB is accessed by running a simulation
with the -debug command line flag, and is described in OPNET Simulation
Debugger (ODB) on page DES-3-1.
The diagnostic block dialog box supports the addition, deletion, or modification
of C or C++ language statements. A typical diagnostic block editing pad is
shown in the following figure.
Function Block
This operation presents a dialog box that allows a function block to be defined
for a process. The function block contains C or C++ language functions that are
associated with the process, and that can be called by any of the statements in
the process, including statements associated with states, transitions, and other
blocks.
The function block supports the addition, deletion, or modification of any number
of C or C++ language functions. A typical function block dialog box is shown in
the following figure.
Header Block
This operation presents a dialog box that allows you to define a header block for
the current process. The header block in process model definitions usually
contains one or more of the following elements:
• comments
The header block is primarily useful for declaring the symbolic constants,
macros, and data types that will be referenced within the process model
executive and conditional statements.
State Variables
This operation presents a table in which you can declare state variables for the
process. State variables are those variables that retain their value from one
process invocation to the next. They are distinct from temporary variables
(described in Temporary Variables on page ER-6-22), which retain their values
only during the span of a single process model invocation. For a more detailed
description of state variables, see Variables on page MC-5-33.
To sort the state variables table by type or name, click in a heading cell.
Repeated clicks toggle the sort order. To find a text string in the table, enter the
string in the field below the Name column and click the Find Next button. The
“Ignore case” checkbox controls case sensitivity for the find operation.
The Edit Ascii button opens an edit pad containing state variables in the variable
declaration syntax of the C or C++ language. In the edit pad, you can add,
delete, or modify state variable declarations. However, note that each state
variable declaration must be contained on a single line of the state variable
editing pad. Also, the name of each state variable must be immediately
preceded by a backslash character (“\”), as shown in the following figure.
Temporary Variables
This operation presents a dialog box that allows temporary variables to be
declared for the process. Temporary variables are those variables that do not
retain their value from one invocation of the process to the next. They store
values only during the span of a single process invocation and are typically used
as “scratch” variables. Temporary variables can be accessed only in state
executives, as described in Variables on page MC-5-33.
Temporary variables are distinct from state variables (see State Variables on
page ER-6-21), which retain their values from one process invocation to the
next. When the process is resumed later in the simulation, state variables still
have their previous value, whereas temporary variables do not. Temporary
variables are implemented in C or C++ language as automatic variables of the
process model function. They are declared according to the same rules which
C and C++ apply to automatic variables.
Temporary variables can be available only in the process code or included also
in the termination or diagnostic blocks. See Include Temporary Variables in
Diagnostic/Termination Block on page ER-6-25 for details.
The Temporary Variables dialog box allows for the addition, modification, or
deletion of temporary variable declarations. A typical Temporary Variables
dialog box is shown in the following figure.
Termination Block
This operation presents an edit pad that allows you to define the termination
block for a process model. The termination block contains C or C++ language
statements that execute just before a dynamic process is destroyed. For
example, if a dynamic process has allocated memory (such as lists), the
termination block can be used to deallocate the memory before the process is
destroyed. The termination block does not execute for root processes.
Compile Code
This operation assembles all the separate code elements from the process
model (executives, code blocks, and so on) to create a single C or C++ source
code file for the process. It then uses the host machine’s C or C++ compiler to
generate object code, as specified by the current preference settings
(comp_target_type.development_sequential_32, comp_prog,
comp_flags_common, and so on).
When you click the Compile button, all the separate code elements from the
process model are assembled to create a single source code file for the
process. It then uses the host machine’s C or C++ compiler to produce one
object file for each target simulation kernel selected.
List Code
This operation presents a dialog box showing the C or C++ language source
code generated for the entire process. When a process model is created, you
enter C or C++ language instructions in the form of:
Successful completion of this operation requires that the process model has
already been compiled using the Compile Code operation. When compiling the
model, all the separate elements of C or C++ code for the model are pulled
together into a single C or C++ source file. Then the host machine’s C or C++
compiler generates the object code for the process model.
When you choose the List Code operation, a dialog box displays containing the
C or C++ source code that was generated the last time the process model was
compiled. If any changes have been made to the model since then, they are
reflected in the displayed code.
Although you can edit the C or C++ code shown in the editing pad, the changes
do not have any effect on the process model. In other words, the edits do not
modify the state executives, transitions, or C or C++ code in the various blocks
of the process model.