You are on page 1of 4

TABLE OF CONTENTS

1.

2.

University of Engineering and Technology, Peshawar


Department of Computer Systems Engineering

Manual Objectives ................................


.................................................................... 5
1.1

M/M/1 Queue .....................................................................................................5

1.2

Overview of Model Architecture ........................................................................5

Instructions ................................................................................................................9
2.1

Setup New Project and Scenario ........................................................................9

2.2

Create Node Model.............................................................................................9

2.2.1

Create Source Module ................................


.................................................9

2.2.2

Create Queue Module ................................


...............................................10

2.2.3

Create Sink Processor Module .................................................................. 11

2.2.4

Create Packet stream ................................


.................................................12

2.2.5

Node Verification ......................................................................................12

2.3

3.

2.3.1

Configure Custom Palette ................................................................


.........13

2.3.2

Specify Network Model ............................................................................14

Statistics Collection and Results Analysis ................................


..............................15
3.1

Manual

Results Collection ................................


.....................................................15

3.1.2

Simulations Execution ..............................................................................16

3.1.3

View Results .............................................................................................17

4.

safdar@uetpeshawar.edu.pk

M/D/1 queue .....................................................................................................22

3.2.1

Setup New Scenario ..................................................................................22

3.2.2

Simulation Execution ................................................................................23

3.2.3

View Results .............................................................................................23

3.3

Dr. Safdar Nawaz Khan Marwat

M/M/1 Queue ...................................................................................................15

3.1.1

3.2

OPNET Tutorial for Simulating Queuing


Models

Create Network Model ................................


.....................................................13

M/G/1 queue .....................................................................................................24

3.3.1

Setup New Scenario ..................................................................................25

3.3.2

Execute Simulation ................................


...................................................26

Tasks ................................
.......................................................................................27
4.1

Task 1 ................................................................
...............................................27

4.2

Task 2 ................................................................
...............................................28

4.2.1

4.2.2

Instructions ................................................................
................................28

4.2.3

Execute simulations ..................................................................................31

4.2.4

View results ...............................................................................................31

Explanation ...............................................................................................28

CHAPTER 1

1. Manual Objectives

n this manual, the use of the Project and Node Editors in OPNET [1] to set up queue
models (M/M/1, M/G/1 and M/D/1), collect statistics about the model, run
simulations, and mathematically analyze the statistical results of the simulation are
illustrated.

Figure 1.2: M/M/1 queue model

To create the M/M/1 queue, you will need several objects in the Node Editor, including
one queue and two processors. The source module generates packets and the sink
module is used to dispose of the packets generated by the source. The queue represents
the infinite buffer and the server.

1.1 M/M/1 Queue


An M/M/1 queue consists of a first-in-first-out (FIFO) buffer with packets arriving
randomly according to a Poisson process, and a processor, called a server, that retrieves
packets from the buffer at a specified service rate. When a packet reaches the head of
the buffer, it is processed by a server and sent to its destination. The M/M/1 queue
system is shown in Figure 1.1.

The processor module is the general -purpose building block of the node model. Setting
the process model attribute of the module determines the behavior of a particular
processor module.

Figure 1.3: Processor module

The source module (which the processor module represents) generates packets and
specifies the creation rate of generated packets in terms of packets/second. This rate is
specified by an exponential distribution of packet interarrivals (that is, the time
between packet arrivals at the queue).

Figure 1.1: M/M/1 queue

The queue module can be used to represent the infinite buffer and also the server (the
reasons for using the queue to represent the server will be discussed later).

The performance of an M/M/1 queuing system depends on the following parameters:


Packet arrival rate ( )
Packet service rate ( )
If the average packet arrival rate exceeds the average packet service rate, the queue size
will grow indefinitely. This manual shows how to build the queue model and make the
queue reach steady state for a specific arrival rate, packet size, and service capacity.

Figure 1.4: Queue module

1.2 Overview of Model Architecture

Although it is not a part of the M/M/1 queue system described earlier, a sink module
will be used in the node model to dispose of serviced packets. Destroying packets that
are no longer needed frees up memory to be reused during simulation.

The M/M/1 queue is generally depicted by a general process governing the arrival of
packets into an infinite buffer. When a packet reaches the head of the buffer, it is
processed by a server and sent to its destination. Thus, the queue model requires a mean
of generating, queuing, and serving packets, all of which can be done with existing node
modules provided in the Node Editor. The M/M/1 queue model is shown in Figure 1.2.

Packet streams are used to connect each of the modules in the Node Editor. To transfer
packets between the generator module, the queue module, and the sink module, you use
packet streams. These are the paths through which packets move from one module to
another.

CHAPTER 2
7

2. Instructions

n this chapter, the step-by-step instructions for setting up queuing models in OPNET are
provided.

2.1 Setup New Project and Scenario

Figure 1.5: Packet streams

1. Create a new project and a new scenario. Name the new project queuing_model and
the scenario mm1.
2. In the Startup Wizard, click Quit. You will set up the scenario after the node model
has been created.
3. Select File > New..., then select Node Model from the pull-down list and click OK.
The Node Editor opens as a new window.

Figure 2.1: Node editor toolbar buttons

Figure 2.2: Node editor toolbar buttons names

2.2 Create Node Model


In the node model, the first task is to create a source processor module.
2.2.1 Create Source Module
1. Click on the Create Processor toolbar button.
2. Click in the workspace where you want the module to be placed.
3. Right-click to end the operation.

10

11

12

5. Click OK to close the dialog box.


2.2.4 Create Packet stream
1. Click on the Create Packet Stream toolbar button.

Figure 2.3: Create processor toolbar button

4. Right-click on the processor module and select Edit Attributes.


5. Change the name attribute to src (for source) by left-clicking in the Value column,
typing src, then pressing Return.
6. Change the process model attribute to simple_source. You may have to scroll to see
this model.
7. Left-click in the Value column of the Packet Interarrival Time attribute to open the
Packet Interarrival Time Specification dialog box.
8. Select exponential from the Distribution Name pop-up menu. This sets the
interarrival times of gen erated packets to be exponentially distributed, as in a Poisson
process.
9. Set the Mean Outcome to 2.0 and click OK. This sets the mean interarrival time of a
packet to 2 second.
10. Change the Packet Size attribute so that Distribution Name is exponential and
Mean Outcome is 9600. This sets the size of the generated packets to be
exponentially distributed with a mean size of 9600 bits per packet.
11. Click OK to close the Attributes dialog box.
The Packet Interarrival Time attribute specifies the packet interarrival time and distribution.
The Packet Size attribute specifies the packet size and distribution.

Figure 2.6: Creating packet stream toolbar button

2. Connect the src module to the queue module by clicking on the src icon, then clicking
on the queue icon.

Figure 2.4: Changing the queue module attributes

6. Make sure the service_rate attribute is set to 9600, with generated mean packet size of
9600 bits the average service rate is 1 packet per second.
7. Click OK to close the dialog box.

2.2.2 Create Queue Module


1. Click on the Create Queue toolbar button, and place a queue module to the right of the
generator module in the workspace.
2. Right-click to end the operation.
3. Right-click on the queue module and select Edit Attributes to bring up its attributes.
4. Change the name attribute to queue.
5. Change the process model attribute to acb_fifo (the reasoning behind this is discussed
after this procedure).

Figure 2.7: Connecting src to queue

3. Connect the queue module with the sink module by clicking on the queue icon, then
clicking on the sink icon. Remember to end the Create Packet Stream operation by
right-clicking.

2.2.3 Create Sink Processor Module


For proper memory management, packets should be destroyed when they are no longer
needed.
1. Click on the Create Processor Module toolbar button and place a processor module
to the right of the queue module, as shown in the following figure.
Figure 2.8: Connecting queue to sink

2.2.5 Node Verification


Verify that the node type is fixed (not mobile or satellite).
1. Select Interfaces > Node Interfaces.
Figure 2.5: Placing the sink module

2. Right-click on the processor to open its Attributes dialog box.


3. Change the name attribute to sink.
4. Note that the default value of the process model attribute is sink.

13

14

CHAPTER 3

3. Statistics Collection and Results Analysis


This chapter discusses methods of collecting statistics and viewing results in different ways.
Figure 2.10: Open Object Palette Toolbar Button

2. Make sure that the palette is in the Icon view (instead of the Tree view) by placing the
mouse cursor on the icon at the top left corner of the Object Palette. Clicking on this
icon enables toggling between tree and icon views.

3.1 M/M/1 Queue


For the M/M/1 queue, there are several statistics to be collected, including:
The average time a packet is delayed in the infinite buffer ( queue delay).
The average number of packets that are in the queue (queue size, in packets).
These two statistics are necessary to answer the two primary questions for this network
model.

Figure 2.11

3. Click on the Configure Palette... button in the object palette. This brings up a
number of options that allow you to customize your palette.
4. Click on the Model list radio button if it is not already selected.

Does the average time a packet waits in the queue exceed an acceptable limit?
Does the queue size increase monotonically, or does it reach steady state? If the queue
size does not reach steady state, that may be an indication that the system (especially
the server, in this case) is overloaded.
3.1.1 Results Collection
To collect these statistics, the following steps have to be taken.
1. Right-click on the M_M_1 node model and go to Choose Individual DES Statistics
2. Select Module Statistics -> queue -> queue -> queue size (packets) and queuing
delay (sec). (it is possible to right click on the chosen statistics and look at the statistic
description, collection mode, etc.)

Figure 2.9: S upporting the fixed node type

2. In the Node Types table, change the Supported value to no for the mobile and
satellite types.
3. Click OK to close the Node Interfaces dialog box.
Select File > Save. Name the node mm1_model, then click Save and Close the Node Editor.

2.3 Create Network Model


Because the M/M/1 model requires only a single non-communicating node, the node location
is irrelevant. The network model for the M/M/1 queue can be built as a single node obj ect in
the Project Editor. The network model setup focuses on:
Creating a custom object palette
Specifying the network model
The first step in building this network model is to create a new model list. You can then
specify this list, customizing the palette to display only the network objects you need.
2.3.1 Configure Custom Palette
1. Click on the Open Object Palette toolbar button.

Figure 2.12: Selecting model list

5. Click on the Clear button in the Configure Palette dialog box. This removes all
models from the palette except for the subnet icon, which is always present.
6. Click on the Node Models button to bring up the list of available node models.
7. Scroll in the table until you find the mm1_model node model. Click in the Status
column next to mm1_model to change it from not included to included.
8. Click OK to close the table.
9. Click OK in the Configure Palette dial og box to save the palette configuration. Enter
the name mm1_palette at the prompt and click Save.
2.3.2 Specify Network Model
1. Click and drag the mm1_model node model from the object palette to the projector
editor workspace. Remember to right-click to end the operation.
2. Right-click on the node objects and selects Set Name from the Object pop-up menu.
3. Enter M_M_1 as the name and then click OK.
4. Select File > Save. Click Save to accept the existing name queuing_model.

16

17

18

Figure 3.2: Configuring simulation parameters

3. Click Run to begin the simulation.


3.1.3 View Results
Figure 3.1: Selecting statistics to be collected

3.1.2 Simulations Execution


1.
2. Set the following values in the Configure Discrete Event Simulation dialog box .
Duration: 7 hours
Seed: 431
Values Per Statistic: 100

1. In the Project Editor, choose DES > Results > View Results
2. Select the queuing delay (sec) statistic.
3. From the pull-down list under Presentation, select average.

Figure 3.3

filter

4. Click on the Show button (the graph is shown in the following figure).

19

20

Figure 3.4: Average queuing delay (sec)

The large change early in the simulation reflects the sensitivity of averages to the relatively
small number of samples collected. Towards the end of the simulation, the average stabilizes.

Figure 3.5: Selecting the queue size (packets) statistic

6. Click on the Show button. The graph of the time-averaged queue size appears in the
following figure:

It is important to validate your simulation results for accuracy. Note that the mean queuing
delay for this simulation is around 2 seconds.
Another statistic of interest is the time -averaged queue size. This statistic can be viewed by
applying the time average filter to the queue size statistic collected during simulation.

21

Figure 3.6: Average queue size (packets) statistic

It should be noticed that the queue reaches steady state at about 3 hours in the above figure.
You may have noticed that the graphs of the mean queuing delay and the time -averaged queue
size are very similar. It turns out that for this model, because of the large number of well dispersed queue insertions and removals that occur during the simulation, the difference
between the final values of the two statistics is negligible.
The final graph for this lesson is of the queue size versus the time-averaged queue size,
plotted on the same graph:

5. Select queue size (packets) statistic. From the pull -down list under Presentation,
select average.

1. Close the existing View Results dialog box.


2. Right-click on the graph of the time -averaged queue size, then choose Add Statistic
from the pop-up menu. A new View Results dialog box appears.
3. Place a check next to Graph Output Files >mm1 > Object Statistics >M_M_1 >
queue > queue > queue size (packets) in the View Results dialog box.
4. Left-click on the Add box.
The graph of the queue size (packets) is added to the existing time-averaged queue size
graph (as shown in Figure 3.7).

22

23

8. Select File > Save to save the modified node model md1_model, and then Close the
Node Editor.
9. Right click on the M_M_1 node in the network model; change the name to M_D_1
and the model to md1_model, as shown in the following figure.
10. Click OK to close the dialog box.

24

1. Right-click on the graph of the time -averaged queue size, then choose Add Statistic
from the pop-up menu. A new View Results dialog box appears.
2. From the pull-down list Results for, select Current Project and place a check next to
queuing_model >mm1. Select Object Statistics >M_M_1 > queue > queue >
queuing delay (sec) in the View Results dialog box.
3. From the pull-down list under Presentation, select Cumulative Distribution (CDF).
4. Left-click on the Add box.
5. The graph of the CDF of queuing delay (sec) from mm1 scenario is added to the
existing time-averaged queue size graph (as shown in the following figure).

Figure 3.7: Comparison of current vs. average queue size over time
Figure 3.8: Changing node attributes

3.2 M/D/1 queue


Compared to the M/M/1 queue, the arrival of packets is still P oisson process with a mean
distribution (Let the service rate be equal to 1).
3.2.1

3.2.2 Simulation Execution


1.
2. Set the following values in the Configure Discrete Event Simulation dialog box:

Setup New Scenario

1. Duplicate the mm1 scenario (created in the last section) to a new s cenario. Name the
new scenario md1.
2. Select File > Open > Node Model > mm1_model
3. Select
to duplicate a new node model named md1_model
4. Right-click on the src processor to open its Attributes dialog box
5. Left-click in the Value column of the Packet Size attributes to open the Packet Size
Specification dialog box.
6. Change the Packet Size attribute so that Distribution Name is constant and Mean
Outcome is 9600. This sets the size of the generated packets to be constantly
distributed with a fixed size of 9600 bits per packet.
7. Click OK to close the Attributes dialog box.

Duration: 7 hours
Seed: 431
Values Per Statistic: 100
3. Click Run to begin the simulation.

Figure 3.9: Comparison of results from different scenarios

3.2.3 View Results


1.
2.
3.
4.

In the Project Editor, choose DES > Results > View Results.
Select the queuing delay (sec) statistic.
From the pull-down list under Presentation, select Cumulative Distribution (CDF).
Click on the Show button.

Compare with queuing delay (sec) of mm1 scenario.

25

Task: compare the average queue size (packets) with that in mm1 scenario.

3.3 M/G/1 queue


The M/G/1 queue is generally depicted by a Poisson process governing the arrival of p ackets
into an infinite buffer, and an arbitrarily distributed service rate in the server. The service rate
distribution is set to uniform distribution between 0 to 1. The arrival of packets is still Poisson
process with a mean arrival rate of 2.

26
CHAPTER 4

3.3.1

Setup New Scenario

1. Duplicate the mm1 scenario (created in the last section) to a new scenario. Name the
new scenario mg1.
2. Select File > Open > Node Model > mm1_model
3. Select
to duplicate a new node model named mg1_model
4. Right-click on the src processor to open its Attributes dialog box
5. Left-click in the Value column of the Packet Size attributes to open the Packet Size
Specification dialog box.
6. Change the Packet Size attribute so that Distribution Name is uniform_int,
Minimum outcome is set to 0 and Maximum Outcome is 19200, as shown in
following figure.

4. Tasks
4.1 Task 1
Compare the queuing delay (sec) and queue size (packets) with previous two scenarios.
Fill in the following table.

M/M/1

M/D/1

Average system
delay
Figure 3.11: Changing node attributes
Figure 3.10: Setting packet size

7. Click OK to close the Attributes dialog box.


8. Select File > Save to save the modified node model mg1_model, and then Close the
Node Editor.
9. Right click on the M_M_1 node in the network model; change the name to M_G_1
and the model to mg1_model, as shown in the following figure.

10. Click OK to close the dialog box.


3.3.2 Execute Simulation
1.
2. Set the following values in the Configure Discrete Event Simulation dialog box:
Duration: 7 hours
Seed: 431
Values Per Statistic: 100
3. Click Run to begin the simulation.

Average number of
packets in the
system
Compare the simulation results with the theoretical calculations.

M/G/1

28

4.2 Task 2
Set up an M/M/1/N Queue with finite buffer.

29

30

7. Select File > Save to save the modified node model mm1n_model, and then
Close the Node Editor.
8. Right click on the M_M_1 node in the network model; change the name to
M_M_1_N and the model to mm1n_model, as shown in the following figure.

4.2.1 Explanation
Set up an M/M/1/N Queue with finite buffer size (max. 6 packets) to simulate a delay loss system. Since the buffer capacity is limited, there will be packet loss happening
when the buffer is overflow.
4.2.2 Instructions
1.
2.
3.
4.
5.

Duplicate a scenario, name mm1n and then save.


Select File > Open > Node Model > mm1
Select
to duplicate a new node model named mm1n_model
Right-click on the queue processor to open its Attributes dialog box
Change subqueue > pk capacity (pks) from infinity to 6 packets, as shown in
the following figure:

Figure 4.2: Changing node attributes

9. Click OK to close the dialog box.


10. Right-click on the M_M_1_N node model and go to Choose Individual DES
Statistics
11. Select Module Statistics -> queue -> queue -> overflows, as shown in the
following figure

Figure 4.3: Collecting statistics

12. Right click on the overflow statistic, choose change collection mode to open
overflow capture mode dialog box and make sure that Advanced is checked.
Select all values in the capture mode, as shown in Figure 4.4.

Figure 4.1: Changing process attributes

6. Click OK to close the Attributes dialog box

31

32

33

Figure 4.4: Setting statistics collection mode

13. Click OK to close the dialog box.


14. Do the same steps on the queue size (packets) statistic.
4.2.3 Execute simulations
Figure 4.5: Viewing overflow results

1. In the Project Editor, choose DES > Configure/Run Discrete Event


2. Set the following values in the Configure Discrete Event Simulation dialog box:

4. Select the queue size (packets) statistic.


5. Click on the Show button (the graph is shown in the Figure 4.6).

Duration: 7 hours
Seed: 431
Values Per Statistic: 100
3. Click Run to begin the simulation.
4.2.4 View results
1. In the Project Editor, choose DES > Results > View Results
2. Select the overflows statistic.
3. Click on the Show button (the graph is shown in Figure 4.5).

BIBLIOGRAPHY

[1] "Application and Network Performance with OPNET (Last accessed: 20 January
2016)," [Online]. Available: http://www.opnet.com.

Figure 4.6: Viewing queue size results

1. How to get the ratio of overflow?


2. Which is the maximum queue size? How are its CDF and PMF?
3. Compare the results of queue delay with mm1 scenario where the buffer size is
set to infinite.

You might also like