Introduction to OPNET Modeler

Transcription

Introduction to OPNET Modeler
1572
Introduction to OPNET Modeler®
CONFIDENTIAL — RESTRICTED ACCESS:
This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2010 OPNET Technologies, Inc.
1572 Introduction to OPNET Modeler®
Lab 1: Workspace Navigation
Purpose: To provide hands-on experience exploring a completed network. You will practice loading
a map, zooming, navigating through subnets, viewing the attributes of a node, and opening the
corresponding node models and process models.
Time allotted: 15 minutes
1) Open the project: choose Ctrl+O. For “Files of Type”, make sure Project is selected, and then
drill down into the project_environment_ref.project folder. Open the project
“project_environment_ref”.
.
2) Practice moving between subnets.
a. To enter a subnet, simply double-click on the subnet. Double-click on the “North
America” subnet icon to enter it.
b. To return to the upper, or “parent” subnet:
1. Right-click anywhere in the workspace (except on an icon), and choose “Go to
Parent Subnet”.
OR
2. Click once (do not double-click) on the toolbar button:
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2008 OPNET Technologies, Inc.
1
1572 Introduction to OPNET Modeler®
3) Use zooming features to identify U.S. cities: From the top level (keep going to “parent subnet”
until you cannot go any further), enter the subnet labeled “North America”, and then enter the
“United States” subnet. Now use the various zoom features to identify each subnet.
a. Zoom button: If you choose Zoom > To Rectangle from the View menu or click on the
Zoom to Rectangle button on the toolbar, you can click and drag a rectangle in the
workspace to define a region to be magnified.
b. Zoom Out (on the toolbar).
c. Page-Up and Page-Down keys (or the scroll wheel on your mouse).
4) Add a MIF map image.
a. Click on View > Background > Add MIF Map….
b. Click on usa_highway (at first you will not see a difference).
c. Click Close.
5) Adjust the “layers” of the background images so that the highways are on top.
a. Click on View > Background > Set Properties.
1. Select the MIF Map (usa_highway) layer.
2. Click the Move Forward button twice to place it just before “Background
Images in the list.
3. You should see the screen below.
4. Close the Background Properties dialog box.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2008 OPNET Technologies, Inc.
2
1572 Introduction to OPNET Modeler®
6) One of the common things you will do with Modeler is to change the attributes of an object.
Let’s practice this by changing the Datagram Switching Rate on the router in Chicago.
a. Find and enter the Chicago subnet. Remember, to enter a subnet, double-click it.
b. Right-click on the router and choose Edit Attributes from the menu.
c. Expand the attribute IP by clicking on the plus sign to the left of it, and then expand the
attribute IP Processing Information.
d. Change the value of Datagram Switching Rate to 250,000.
e. Click OK accept the change.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2008 OPNET Technologies, Inc.
3
1572 Introduction to OPNET Modeler®
7) Double-click on the router to view its node model. Later labs will show you how to create and
edit a node model.
8) Double-click on the processor labeled IP at the center of the router. This is the process model for
that queue. Later labs will show you how to create and edit a process model.
9) Close all editors.
End of Lab 1
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2008 OPNET Technologies, Inc.
4
1572 Introduction to OPNET Modeler®
Lab 2: Creating a Packet Format
Purpose: To create a new packet format
Time allotted: 10 minutes
1) Select Ctrl+N. Under the pull-down menu, choose Packet Format (the fourth
choice from the bottom).
2)
Left-click on the Create New Field button, and then leftclick in the workspace to create a field. You will notice that your mouse cursor is
still ready to create another packet field. In the space underneath the previous
field, left-click again to create another packet field. Once you have the two packet
fields, right-click to stop dropping packet fields. You should have something
like the following:
3) Right-click on field_0 to access its attributes; set the name to Source Node, and
the size to 64 bits, then click OK.
4) Right-click on field_1 to access its attributes; set the name to Destination Node,
and the size to 64 bits, and then click OK.
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 5
1572 Introduction to OPNET Modeler®
5) Save the packet: Choose File > Save and name the packet
<your_initials>_trans_pkt (for example, if your initials were abc, you would
name the packet format abc_trans_pkt).
You have now created a new packet format with two headers: Source Node and
Destination Node. Each is 64 bits in size, for a total of 128 bits. When we actually
create an instance of this packet in a simulation, we can also set the payload size. We
will learn how a model creates a packet based on this packet format in later labs.
6) Close the Packet Format Editor.
End of Lab 2
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 6
1572 Introduction to OPNET Modeler®
Lab 3: Creating a Node Model
Purpose: Create two node models, one representing the transmitter node in Washington
DC, and the other representing the receiver node in Philadelphia
Time allotted: 30 minutes
Note: Throughout this lab and others, screenshots have been included. As you are going
through the steps in the labs, look for these to help guide you.
Part 1: Create the Transmitter Node.
Build a node model to represent the transmitter of bank transactions originating in
Washington, D.C.
1) Select Ctrl+N, select Node Model from the pull-down list.
2) You will create a node model that looks like the diagram below, using the buttons
circled. We will have a simple packet generator sending packets to a transmitter.
3) Create a processor: Click the Create Processor button on the toolbar and leftclick in the workspace. Right-click to stop creating processor modules.
4) Create a point-to-point transmitter: Click the Create Point-to-point Transmitter
button on the toolbar and left-click in the workspace. Right-click to stop
creating transmitter modules.
5) Create packet stream: Click the Create Packet Stream button on the toolbar and
left-click on the processor and then the transmitter. Right-click to stop creating
packet streams.
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 7
1572 Introduction to OPNET Modeler®
6) We don’t need a mobile or satellite versions of this node, so we’ll only need a
stationary version of this node.
a. Configure Node Interfaces: Select Interfaces > Node Interfaces.
b. In the Node Types table, set the Supported column to No for both mobile
and satellite.
7) Change the icon for the node.
a. Under the Default Icon column, click on fixed_comm.
b. Change the icon palette to stdmod.
c. Click on the icon called server_client.
8) Click OK.
9) Save the node model: choose File > Save and name the model
<your_initials>_transmitter_nd.
10) Configure the Processor. One of the most important attributes of a processor is
what process model it uses. That determines its overall behavior and what other
attributes it can have. Right-click on the processor object and select Edit
Attributes, then enter these values:
a. name = gen
b. process model = simple_source
c. packet format = <initials>_trans_pkt (the packet format you created
before)
d. Packet Interarrival Time:
i. Distribution name = exponential
ii. Mean outcome = 0.5
e. Packet Size:
i. Distribution Name = normal
ii. Mean Outcome = 3200
iii. Variance = 400
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 8
1572 Introduction to OPNET Modeler®
f. Verify it looks like the following (except with your packet format):
g. Click OK.
11) Set the data rate of the transmitter:
a. Edit the attributes of the transmitter module.
b. Set the name to trans.
c. Expand the channel attribute, and then the Row 0 attribute.
d. Set the data rate to unspecified (you’ll have to type it in).
e. Click OK.
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 9
1572 Introduction to OPNET Modeler®
Note: By entering a data rate of “unspecified”, we are telling the transmitter to use the
data rate of whatever link gets connected to it.
Ultimately, statistic collection is done in the process models. Each process model can
have any number of statistics defined, so the processes you include in your node model
determine which statistics can be collected for the node. In our example, we only have
two modules, and they are fairly simple, so the number of statistics defined in them is
relatively small. In more complex, sophisticated node models, there may be dozens, if not
hundreds of statistics defined in the processes.
It is up to the node model developer to determine which of these statistics are going to be
available for collection to the user of the node. The Node Statistics table is the interface
for which to specify these.
12) Specify Node Statistics to collect queue size and throughput statistics (screenshots
for the following steps are below)
a. Select Interfaces > Node Statistics.
b. Left-click in the Orig. Name column of the first row.
c. Holding down the Control key, select the statistics:
i. point-to-point transmitter.trans.channel [0].queue size (bits)
ii. point-to-point transmitter.trans.channel[0].throughput
(bits/sec)
d. Click the Promote button.
e. Click OK.
We have now specified that when someone uses this node in their network, there will be
two statistics available for them to collect.
13) Save the node model, and close the Node Editor window. The transmitter node is
now finished.
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 10
1572 Introduction to OPNET Modeler®
Lab 3, Part 2: Create the Receiver Node
1) Create a new node model (Ctrl+N - Node Model).
2) Place one point-to-point receiver (not transmitter) and one processor in the
workspace.
3) Connect them with a packet stream.
4) Your node should look like this:
5) Configure Node Interfaces (Interfaces > Node Interfaces).
a. Just as you did for the transmitter node, set the “Node Types” to support
only fixed nodes (you can refer back to the last lab if you don’t remember
how).
b. Change the icon for the node:
i. Under default icon click on fixed_comm.
ii. Choose the server icon from the icon palette stdmod.
c. Click OK.
6) Name the receiver object rec, and the processor object sink by right-clicking each
of them and choosing Set Name.
7) Save the node model, again naming it with your initials:
<your_initials>_receiver_nd.
8) Select the Node Statistics of interest:
i. Select Interfaces > Node Statistics.
ii. Promote the statistic throughput (bits/sec) (for the receiver’s
channel [0]).
9) On the receiver module, set the data rate of the channel to be “unspecified”, as
you did when creating the transmitter node.
10) Save the node, and close the Node Editor window.
The Receiver Node is now complete.
End of Lab 3
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 11
1572 Introduction to OPNET Modeler®
Lab 4: Creating a Link Model
Purpose: To create a link model
Time allotted: 10 minutes
1) Create a new link model (Ctrl+N - Link Model).
2) Change “yes” to “no” for the “bus” and “bus tap” in the “Supported Link Types”
table (we are creating a point-to-point link).
3) Click on the attribute “data rate”, and enter 9600.
A link model includes a set of attributes that specify which “Pipeline Stages” the link will
use. The Pipeline Stages specify how packets are transmitted from source to destination
over the physical layer. They determine such things as the transmission delay,
propagation delay, bit errors, interference, etc. There are Pipeline Stages available to
model the three types of transmission mechanisms available in Modeler:
•
Point-to-point
•
Bus
•
Radio
We will not go into detail on exactly how these behave in this course, but it is available in
the product documentation and also in OPNETWORK sessions 1530 Modeling Custom
Wireless Effects — Introduction and 1580 Modeling Custom Wireless Effects —
Advanced.
For the purposes of this lab, we are going to set this link to use the default behavior for
point-to-point links by setting these attributes:
4) In the Attributes table, set the following Pipeline Stages:
a. ecc model = dpt_ecc
b. error model = dpt_error
c. propdel model = dpt_propdel
d. txdel model = dpt_txdel
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 12
1572 Introduction to OPNET Modeler®
Some of the Pipeline Stage models call some functions from an external code file
“link_delay”. When you create a link that uses the above pipeline stages, you need to tell
Modeler to “include” the code for that file when starting the simulation. Below is how
you declare an external code file in a link model.
5) Include the link_delay external file.
a. Choose File > Declare External Files….
b. Find link_delay in the list.
c. Click on the gray box to select it.
d. Make sure you see the green check mark in the checkbox
e. Click OK.
6) Save the new link model with the name <initials>_pt_base_9600.
7) Close the Link Editor.
End of Lab 4
CONFIDENTIAL INFORMATION: DO NOT DISCLOSE, FORWARD, DISTRIBUTE, SHARE, OR MAKE COPIES OF THIS DOCUMENT IN WHOLE OR IN PART.
© Copyright 2003 OPNET Technologies, Inc.
Page 13
1572 Introduction to OPNET Modeler®
Lab 5: Creating a Project and Scenario
Purpose: To create a project to include the bank network discussed
Time allotted: 15 minutes
In previous labs, we created nodes to represent the Philadelphia bank and the Washington DC bank
(<your_initials>_receiver_nd and <your_initials>_transmitter_nd). We also created a type of
link to connect them. We will now create this simple network, run a simulation, and view our results.
1) Create a new project.
a. Choose Ctrl+N > Project.
b. Name the new project bank_net. Name the initial scenario baseline.
c. When the Startup Wizard appears, select Quit.
2) Zoom in on Wash/Phil. Region. (Remember how to zoom from Lab 1?)
a. Click the Zoom to Rectangle button and draw a box around the region.
b. Or, use the Page-Up and Page-Down keys to zoom in and out.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 14
1572 Introduction to OPNET Modeler®
3) Open Object Palette by clicking on the fifth button on the toolbar.
4) Create a custom Object Palette, so that only the nodes and links we need are in the palette.
a. Click the button Open Palette in Icon View.
b. Click the Configure Palette button.
c. Click the Clear button.
d. Click the Node Models button.
i. Find the receiver node you created in an earlier lab in the list and change its
status from not included to included. The node should be named with your
initials: <your_initials>_receiver_nd.
ii. Find the transmitter node you created earlier, and change its status to
included.
e. Click the Link Models button and include <your_initials>_pt_base_9600.
f. Select Save As in the Configure Palette dialog box.
g. When prompted, name the palette Bank_net_palette.
h. Click OK (Save window).
i. Click OK again (Configure Palette window).
j. Accept the default palette name and location.
k. Your palette should look like this:
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 15
1572 Introduction to OPNET Modeler®
5) Place nodes and connect them:
a. Place a <your_initials>_transmitter_nd near Washington, D.C., by dragging and
dropping its icon from the Object Palette
b. Place a <your_initials>_receiver_nd near Philadelphia.
c. Name the two WDC_src and Philly_dest.
d. Draw a simplex link (<your_initials>_pt_base_9600) from Washington to
Philadelphia (make sure you are not using the duplex link, which has an arrowhead at
both ends).
6) Switch the Object Palette back to the treeview by clicking the upper-left button. The palette
should now look like this:
As you see, the Object Palette has two views: Icon View and Treeview. Both present the same
information, but in a different layout. Which one you use is up to you; just remember you can
switch between them by using the upper-left button.
The Verify Links operation does a quick check on your network to make sure you haven’t
hooked up links to incompatible nodes. It checks things such as data rate and protocol.
7) Verify links.
a. Under the Topology menu, you will see Verify Links… toward the bottom. You will
also notice it has a shortcut key: Ctl+L.
b. Use Ctl+L to verify if your links are connected properly.
c. If the link between Washington and Philadelphia becomes marked with a red “X”,
check the following:
i. Make sure you are using a simplex link.
ii. Is the link pointing from Washington to Philadelphia?
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 16
1572 Introduction to OPNET Modeler®
iii. Is the Washington DC node of the type “<your_initials>_transmitter_nd”?
iv. Is the Philadelphia node of the type “<your_initials>_receiver_nd”?
d. If you can’t get “Verify Links” to be successful, a TA or the instructor can help you.
Use the screenshot below to determine how the network is supposed to look.
8) Save the project.
Now that we have drawn the topology, we need to tell Modeler what statistics we are interested in
collecting.
9) In the Project Editor, choose Choose Individual Statistics from the DES menu. This brings
up the Choose Results dialog box.
10) In the Choose Results dialog box, select the following:
a. Node Statistics
i. point-to-point receiver > throughput (bits/sec)
ii. point-to-point transmitter > queue size (bits)
iii. point-to-point transmitter / throughput (bits/sec)
b. Link Statistics
i. point-to-point > utilization
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 17
1572 Introduction to OPNET Modeler®
Your window should look like the following:
11) Click OK.
The node statistics available should look familiar. When we created the transmitter_nd and
receiver_nd nodes, these are the statistics we specified in the “Node Statistics” dialog box (see Lab
#3). By selecting them there, we told Modeler that those were the statistics that would be of most
interest to someone using that node. They therefore show up in the “Choose Individual Statistics”
dialog box in the previous steps.
You may remember that there were other statistics available, which we did not add to that list (again,
see Lab 3 if you want to see the steps again). Where are these statistics?
The statistics you do not add to the “Node Statistics” list (when creating a node model) are still
available for collection, it just requires a different method. If you want to collect a statistic that does
not show up in the “Choose Results” dialog box, you need to either edit the node to “promote” those
statistics, or use the Probe Editor. The Probe Editor will not be covered in this session.
12) Configure and run the Simulation.
a. Click on the Configure/Run Simulation button on the toolbar.
b. Set the duration to 30 minutes.
c. Click on the Run button in the dialog box.
d. When the simulation is done, click the Close button.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 18
1572 Introduction to OPNET Modeler®
Before looking at the graphs, let’s review the attributes of the Washington, D.C., node (packets/sec,
size of the packets) and the link (data rate) to help predict what the results should be. Double-click
the Washington D.C. node to open its node model, and edit the attributes of the gen module. This is
what you should see:
Also remember the data rate of the link is 9600 bps.
•
What should be the throughput (in bits/second) at the WDC transmitter? ________
bits/second
•
What should be the throughput (in bits/second) at the Philadelphia receiver?
________ bits/second
•
What should be the utilization of the D.C. to Philadelphia link? ________
•
Should the queue size of the WDC transmitter steadily increase? ________
To figure answers, we need to look at the load offered to the 9600-baud modem at the WDC node.
Load = (1 pk/ 0.5 sec)(3200 bits/pk) = 6400 bits/sec.
Expected results:
What is the throughput (in bits/second) at the WDC transmitter? 6400 bits/second Since the
load is less than data rate of transmitter, throughput = load.
What is the throughput (in bits/second) at the Philadelphia receiver?
6400 bits/second Whatever is transmitted is received. For point-to-point links, throughput at a
transmitter should always equal throughput at the respective receiver.
What is the utilization of the D.C. to Philadelphia link?
67% [Calculated by figuring load over capacity, (6400 bits/sec) / (9600 bits/sec).]
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 19
1572 Introduction to OPNET Modeler®
Does the queue size of the WDC transmitter steadily increase? No. Clearly, 6400 bits/sec is less
than 9600 bits/sec.] In a later lab, we'll learn how to filter the raw data and take a running average
of this data to see if it is really increasing.
13) Once the simulation is complete, graph the results for the statistics we collected, to verify our
predictions.
a. Click on the View Results button toward the right side of the toolbar.
b. In general, to view a statistic by itself in one graph, follow these steps:
i. Uncheck other statistics you may already have checked.
ii. Check the statistic of interest.
iii. Choose a filter (average, As is, CDF, etc.).
iv. Click the Show button.
For instance, this shows what you would choose to get the graph for the throughput on the WDC_src
transmitter, using an “average” filter.
Statistic
Filter selection
The above is the preview for the graph. Click the “Show” button on the bottom right to display it in a
separate window, so you can choose a different stat.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 20
1572 Introduction to OPNET Modeler®
c. Using the above method, graph the following statistics:
i. Average of Object Statistics/Philly_dest/point-to-point receiver/throughput
ii. Average of Object Statistics/WDC_src/point-to-point transmitter/queue size
iii. Average of Object Statistics/WDC_src/point-to-point transmitter/throughput
iv. Average of Object Statistics/WDC_src->Philly_dest [0]/point-to-point
/utilization
d. Let’s have Modeler arrange the panels for us.
i. Select DES > Panel Operations > Arrange Panels > Tile.
Your graphs should look similar to the figures below. The peaks and valleys may be different, but
you should be getting approximately the same averages:
If your results do not look similar to these, a TA or the instructor can help you determine why.
End of Lab 5
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 21
1572 Introduction to OPNET Modeler®
Lab 6: Using Multiple Random Seeds
Purpose: To re-run the bank-net simulation using varying random seeds.
At this point, the simulation has been run a single time. We will now run a series of simulations
using a different random seed for each run. By plotting a single statistic per run, the sample mean of
the link utilization, we can gain a better appreciation for the stochastic nature of our traffic generator.
1) Configure multiple Simulation runs.
a. Click on the Configure/Run Simulation button on the toolbar.
b. Verify the duration is set to 30 minutes.
c. Select Enter Multiple Seed Values button.
d. Enter 128 in the Value column.
e. Enter 137 in the Limit column.
f. Enter 1 in the Step column.
g. Click on the OK button in the dialog box.
The resulting Configure/Run DES dialog box should match the following:
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 22
1572 Introduction to OPNET Modeler®
We have now set up 10 simulation runs that will complete in order.
2) Click on Run.
3) Once the simulations are complete, graph the results for the statistics we collected to verify
our calculations.
a. Click on the View Results button toward the right side of the toolbar.
b. Select the DES Parametric Studies Tab.
c. Expand Scalar Statistics and expand Execution.
d. Highlight seed and click the Set as X-Series button.
e. Expand Object Statistics and expand WDC_src->Philly_dest and point-to-point
utilization.
f. Highlight sample mean and click the Set as Y-Series button.
End of Lab 6
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 23
1572 Introduction to OPNET Modeler®
Lab 7: Modifying a Process Model
Purpose: To expand our original bank network to include more sources and destinations, and to
include a new switch node. We will modify an existing process model to match the behavior we
want from our new switch.
Time allotted: 30 minutes
The bank’s new network looks like this:
Before creating this topology, we need to create a new node to represent our switch. Here are the
specs we have for this switch:
•
It is a stationary node that supports 4 inputs and 2 outputs
•
It takes a packet from any input port and sends it to a random output port
•
The internal queue behaves as acb_fifo, with a processing rate of 76,800 bits per second
Create a new node model, <your_initials>_switch_node, that looks like the following picture. The
transmitters and receivers should take any packet format and have a data rate of unspecified. The
queue module uses the process acb_fifo, with a service rate of 76800.
Try to create it without the step-by-step instructions on the following page. Refer back to Lab 3 for
reminders on the general steps for creating a node model.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 24
1572 Introduction to OPNET Modeler®
1) Create a new node model by choosing Ctrl+N – Node Model.
2) Place and connect the appropriate modules.
a. Place four point-to-point receivers as shown.
b. Place a queue module as shown.
c. Place two point-to-point transmitters.
d. Connect the modules with packet streams.
3) Edit the queue’s attributes.
a. Change its process model from pc_fifo to acb_fifo.
b. Set the service rate to 76800.
c. Name the queue fifo_queue.
4) Change the channel data rates.
a. Select all the transceivers.
b. Edit attributes of one of the transceivers.
c. Select the Apply Changes to Selected Objects checkbox.
d. Change the data rate of the channel from 1024 to unspecified.
e. Click OK.
5) In the Interfaces > Node Interfaces menu:
a. Change mobile and satellite to no.
b. Change the node icon to switch (under <All Icon Databases>).
6) Save the node model as <your_initials>_switch_node.
At first glance, this node model seems to be finished. However, the acb_fifo process model is
designed to accept packets from any number of sources and autonomously forward them to a single
destination module. In other words, if we leave it like it is, it will forward all packets to the first
transmitter. What we want is for it to randomly choose between the two transmitters. We will need
to create our own version of the acb_fifo process model to do this.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 25
1572 Introduction to OPNET Modeler®
Lab 7, Part 2: Create a Modified acb_fifo Process Model
To modify an existing model, we will follow these steps:
•
Open the model
•
Save a copy, giving it a new name
•
Modify the new model
Create the modified acb_fifo process model.
1) Choose Ctrl+O and select Process Model as the file type.
2) Click the std button to take you to the folder that contains the standard model library.
3) acb_fifo is in the “base” folder.
4) Once you have the acb_fifo process model open, choose File > Save As.
a. Click the op_models button to take you to your op_models folder.
b. Name it <your_initials>_switch_process.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 26
1572 Introduction to OPNET Modeler®
5) Open the svc_compl enter executive block by double-clicking on the top half of the
svc_compl state.
6) Modify line 7 to read op_pk_send_forced (pkptr, (int)op_dist_uniform (2.0));
7) Save the enter executives window. Click Ctrl+S (in the Enter Execs window), and close the
Enter Execs code block so you are back to the process model state machine.
8) Since we are making modifications anyway, let’s change the default service rate to meet our
specifications:
a. Under the menu Interfaces, choose Model Attributes.
b. Change the service rate default value from 9600 to 76800.
c. Click OK.
9) Under Interfaces > Process Interfaces, you will see a “Comments” block. In here, you will
see where it states that it forwards packets to a single destination. Change it to state that it
will randomly send it to one of two outgoing links. This step is not necessary for the process
to work, but it is a good practice to get into.
10) Save the process model by clicking Ctrl+S.
11) Compile it with the green button on the right of the taskbar.
12) You should get a message like the this:
If you get any errors, or you get the message “done with warnings”, double-check that you typed the
code in correctly.
13) Close the Process Editor.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 27
1572 Introduction to OPNET Modeler®
Now that we have a new process to replace acb_fifo, we need to update our switch node to use it.
1) Open the project bank_net, if it’s not already open
2) Add our new switch node to our object palette.
a. Open the Object Palette (the far left button on the Project toolbar).
b. Bank_net_palette should be highlighted, and you should see that your two node
models and your link model are in the palette.
c. In the Search by name box at the top, type switch_node, and then click the Find
Next button
d. Once you have located your <initials>_switch_node, right click it, and select Add to
Default Palette: bank_net_palette.
3) Choose Scenario > Duplicate Scenario. Name the new scenario switched.
4) Change the switch model to use our new modified acb_fifo process
a. Open the <your_initials>_switch_node node model.
b. Modify the queue’s attributes to use the new process model.
i. Edit the queue’s attributes.
ii. Change the process model from acb_fifo to <your_initials>_switch_process.
c. Save the node model, and close it.
5) Add source, switch, and destination nodes to the network, and connect them with links:
a. It is not necessary for your network to look exactly like the one shown at the
beginning of the lab, but these rules need to be followed:
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 28
1572 Introduction to OPNET Modeler®
i. There are four transmitter nodes.
ii. There are twelve switch nodes.
iii. There are three receiver nodes.
iv. Each switch must have two outgoing links and no more than four incoming
links.
v. Use Verify Links to help make sure you have proper connections.
b. Name the servers Philly_dest, Philly_dest_0, and Philly_dest_1.
6) Since you duplicated the previous scenario, statistics are already chosen. Run the simulation
to collect the same statistics for this new topology. Remember to change the seed value back
to a single seed of 128.
7) When the simulation is complete, use the View Results button to graph the Point-to-Point
Receiver Throughput for the three destination nodes (results are from one topology; yours
may differ). To graph many statistics together on one panel, follow these steps:
a. Unselect statistics you are not interested in.
b. Select all of the statistics you want to view in one graph.
c. Select Overlaid Statistics from the pull-down menu in the Presentation section.
d. Select a filter (As Is, average, etc).
e. Click on the Show button.
8) Save your project.
End of Lab 7
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 29
1572 Introduction to OPNET Modeler®
Lab 8: Creating a Process Model
Purpose: To create a new process model from scratch. You will learn how to write your own
statistics in a process model.
Time allotted: 30 minutes
There is more than one way to create any process model. The instructions in this lab will create the
desired model using three states, which will look like this:
•
The INIT state, specified as a forced (green) state, for initial operations, like initializing
variables and statistic “registration”.
•
ETE_Destroy, specified as a forced (green) state, to process a packet (in this case, compute
its ETE delay and destroy it).
•
WAIT, specified as an unforced (red) state because the process is waiting for an interrupt.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 30
1572 Introduction to OPNET Modeler®
1) Create a new process model (Ctrl+N - Process Model.)
2) Create three states in the work space.
3) Connect the states in the following manner.
Note: Left-clicking along a path while drawing a transition will add vertices to your transition.
When you reach the next state, left-click again and the transition will have a curved shape if you
have not drawn a straight line.
a. Left-click on the Create Transition button. Starting at st_0, connect st_0 to st_1.
b. Starting at st_1 create a transition to st_2.
d. Starting at st_2, create a transition back to st_1.
4) Right-click on each state and make the following changes.
a. st_0
i. Set Name to INIT.
ii. Make status forced.
b. st_1
i. Set Name to ETE_Destroy.
ii. Make status forced.
c. st_2
i. Set Name to WAIT.
ii. Leave status unforced.
5) Edit the attributes of the transition going from the “WAIT” state to the “ETE_destroy” state,
and set the condition attribute to: PK_ARRIVAL
(This is the name of the macro for this transition.)
6) Double check your states look like the screenshot at the start of this lab.
7) Click on the Header Block (HB) button. Enter the following line of code to define the macro:
#define PK_ARRIVAL (op_intrpt_type () == OPC_INTRPT_STRM)
8) Choose File > Save in the Header Block window.
9) Save your progress thus far. Save the Process model with the name
<initials>_ETE_Destroy.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 31
1572 Introduction to OPNET Modeler®
We have now defined that the value of PK_ARRIVAL will be true if the interrupt type we get is a
stream interrupt. Otherwise, PK_ARRIVAL is false. You will see its usage later.
Next, we will create some variables that our process will be using. Variables in a Process Model can
be declared as state, temporary, or global.
-
State variable
i. Private to the process
ii. Retains its value between invocations
iii. Needed to store persistent information
iv. Declared in the State Variable Block
-
Temporary variable
i. Private to the process
ii. Retains its value only until control is returned to the Simulation Kernel
iii. Useful to support transient calculations
iv. Declared in the Temporary Variable Block
-
Global variable
i. Provides means for multiple processes to store information in a common
location
ii. Declared in the Header Block
10) Create Temporary Variables
a. Click the TV button and enter the following:
b. Choose File > Commit or Ctrl-S (In the “temporary variables” dialog box).
These are temporary variables because we do not need to remember their values from the last
interrupt. Every interrupt we receive will give us new values for these. We will see them used later
in this lab.
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 32
1572 Introduction to OPNET Modeler®
11) Create State Variables:
a. Click on the State Variables (SV) button.
b. In the state variables table enter:
i. Type = Stathandle
ii. Name = ete_gsh
c. Click OK.
The OPNET data type “Stathandle” is used to store a “handle” or pointer to a statistic. We will use
this variable to write our statistic values throughout the simulation. Since we will be using this
Stathandle throughout the simulation, we need to make it a State Variable, so we can refer to it
whenever we want to write a value to it.
There are four steps required for writing out statistics in a process model:
1. Create a State Variable of type Stathandle
2. Declare the statistic (Under the Interfaces menu)
3. Use op_stat_reg() to tie 1 and 2 together
4. Use op_stat_write() to actually write values to it
Steps 1 – 3 need only be done once in your code for each statistic. We will do this in our “INIT”
state.
For our End-To-End Delay Statistic, we have just finished step 1. Now for the rest:
12) Declare the ETE Delay statistic.
a. Select Interfaces > Global Statistics.
b. In the Declare Global Statistics table enter the following:
i. Stat Name = ETE Delay
ii. Draw Style = linear
iii. Leave other settings at their default.
c. Click OK. (This completes step 2 for using our ETE Delay stat.)
Note: Note exactly how you typed in “ETE Delay”. The next step will refer to this text string, so
they must match exactly (capitalization, number of spaces between words, spelling, etc.).
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 33
1572 Introduction to OPNET Modeler®
13) Double-click on the top half of the “INIT” state.
a. Enter the following:
/* Register handle for statistic collection. */
ete_gsh = op_stat_reg("ETE Delay", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
Again, make sure the “ETE Delay” above matches exactly how you typed it in the previous step
b. Choose File > Commit or Ctrl-S (in the “Enter Execs” window). (This completes
step 3 for using our ETE Delay stat. The last step of statistic writing, using
op_stat_write, will be part of the next code block).
14) Double-click the top half of the ETE_Destroy state. This is the state that is going to handle
getting the packet, writing statistics, and destroying the packet.
a. Enter the following in the Enter Execs window.
/* Get stream index number. */
stream_index = op_intrpt_strm();
/* Get pointer to packet from stream index. */
pkptr = op_pk_get(stream_index);
/* Get creation time of packet. */
creation_time = op_pk_creation_time_get(pkptr);
/* Get current simulation time. */
current_time = op_sim_time();
/* Calculate ETE Delay. */
ete_delay = (current_time - creation_time);
/* Write statistics. */
op_stat_write(ete_gsh, ete_delay);
/* Destroy packet. */
op_pk_destroy(pkptr);
b.
Choose File > Commit (in the Enter Execs window).
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 34
1572 Introduction to OPNET Modeler®
15) Compile the Process Model.
16) Close the Process Editor window.
Compile the
Process Model by
left-clicking on
this button.
Look for status and error
messages. If the compiler
encounters any problems,
compiler report windows
will open in the main
workspace.
If you get compile errors, try to figure out what the problem is, correct it, and recompile.
Now that we have a new Process Model to calculate our ETE delay, we need to modify our
<your_initials>_receiver_nd node model to use this new process.
17) Open the bank_net project and switch to the baseline scenario.
a. Ctrl+O > Project – bank_net
b. Scenarios > Switch To Scenario – baseline
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 35
1572 Introduction to OPNET Modeler®
18) Double-click on the Philly_dest node to enter the Node Editor.
19) Right-click on the sink module and edit its attributes.
a. Change the following:
i. name = ETE_Destroy
ii. process model = <initials>_ETE_Destroy
b. Click OK.
c. Save and close the Node Editor.
We have now modified our destination node so that it will use our new process model instead of
the standard “sink” model. Let’s test it out. First, let’s collect that statistic we have defined in our
process model…
20) Choose the global statistic ETE Delay:
a. DES > Choose Individual Statistics
b. Global Statistics > ETE Delay
21) Save the project.
22) Run the simulation. (Remember to change the seed value back to a single seed of 128.)
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 36
1572 Introduction to OPNET Modeler®
23) When the simulation is finished, graph the ETE Delay statistics.
a. Click the View Results button.
b. Graph Global Statistics > ETE Delay (Average).
c. Graph Global Statistics > ETE Delay (As Is).
24) What is the probability the ETE Delay will be less than one second? A CDF graph will show
us…
a. In the View Results window select: Global Statistics > ETE Delay (Cumulative
Distribution [CDF]).
b. Place the mouse pointer on the point where the blue curve intersects with the 1second mark on the horizontal axis. The “tool tips” box will appear and tell you the
values of the horizontal and vertical axes where your mouse pointer is located.
Did your results match the graphs below?
What did you get for the following?
The average end-to-end delay for all packets? ________
The % of packets incurring an end-to-end delay of less than 1 second? ________%
End of Lab 8
CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.
© 2007 OPNET Technologies, Inc.
Page 37