Lab Exercices Modeler

download Lab Exercices Modeler

of 268

Transcript of Lab Exercices Modeler

  • Master thesis MEE 03:24

    Master of Science Programme in Electrical Engineering Blekinge Institute of Technology Department of Telecommunications and Signal Processing I.T.S Supervisor: Prof: Arne Nilsson and Docent: Adrian Popescu I.T.S Examiner: Prof: Arne Nilsson and Docent: Adrian Popescu I.T.S

    OPNET Modeler

    Development of laboratory exercises based on OPNET Modeler

    Tommy Svensson Alex Popescu

    This thesis is presented as a part of the Master of Science Degree in Electrical Engineering with emphasis on Telecommunications and Signal Processing.

    Blekinge Institute of Technology

    June 2003

  • Master thesis MEE 03:24

    Tommy Svensson 2 Alex Popescu

    Abstract The primary purpose of this thesis is to develop laboratory exercises for use with several courses at the Blekinge Institute of Technology and to offer an insight in how real networks and protocols behave. All laboratories are developed in OPNET Modeler 9.0 simulation environment which is a network simulator that offers the tools for model design, simulation, data mining and analysis. The software package is licensed by OPNET technologies Inc [1]. The instructional material consists of a set of laboratory exercises, namely: Introduction to OPNET Modeler 9.0 environment, M/M/1, Aloha, CSMA, CSMA-CD, Slow Start, Congestion Avoidance, Fast Retransmit, Fast Recovery and OSPF, Queuing policies , Selfsimilar.

    Keywords: OPNET Modeler, Lab, M/M/1, Aloha, CSMA, CSMA-CD, Slow Start, Congestion Avoidance, Fast Retransmit, Fast Recovery, OSPF, Areas, Balanced traffic flow, Ethernet, FIFO, Preemptive priority queuing, Non preemptive queuing, WFQ, Selfsimilar. Tommy Svensson, [email protected] Alex Popescu, [email protected]

  • Master thesis MEE 03:24

    Tommy Svensson 3 Alex Popescu

    Table of contents Abstract ...........................................................................................................................................................2 Introduction .....................................................................................................................................................6

    General ........................................................................................................................................................6 Purpose ........................................................................................................................................................6

    Laboratory 1 ....................................................................................................................................................7 Introduction to Opnet ......................................................................................................................................7

    Objective .....................................................................................................................................................7 Overview .....................................................................................................................................................7 Preparations .................................................................................................................................................8

    Project Editor...........................................................................................................................................9 The Process Model Editor .....................................................................................................................11 The Link Model Editor ..........................................................................................................................12 The Path Editor......................................................................................................................................13 The Packet Format Editor......................................................................................................................14 The Probe Editor....................................................................................................................................15 The Simulation Sequence Editor ...........................................................................................................16 The Analysis Tool .................................................................................................................................17 The Project Editor Workspace...............................................................................................................18

    Begin the laboratory ..................................................................................................................................20 Laboratory 2 ..................................................................................................................................................41 M/M/1 Queue simulation ..............................................................................................................................41

    Objective ...................................................................................................................................................41 Overview ...................................................................................................................................................41 Procedure...................................................................................................................................................42

    Creation of the node model ...................................................................................................................43 Laboratory 3 ..................................................................................................................................................62 Ethernet simulation........................................................................................................................................62

    Objective ...................................................................................................................................................62 Overview ...................................................................................................................................................62 Procedure...................................................................................................................................................63 Designing the Aloha Transmitter Process Model ......................................................................................63 Creating the Aloha Transmitter Node Model ............................................................................................70 Creating the Generic Receiver Node Process Model.................................................................................73 Creating the Generic Receiver Node Model..............................................................................................77 Creating a new link model.........................................................................................................................79 Creating the network model ......................................................................................................................80 Executing the Aloha Simulation................................................................................................................83 Creating the CSMA transmitter process model .........................................................................................87 Creating the CSMA transmitter node model .............................................................................................89 Redefining the network model ..................................................................................................................91 Configuring CSMA Simulations ...............................................................................................................92 Analyzing the CSMA results .....................................................................................................................93 Viewing Both Results on the Same Graph ................................................................................................94 Ethernet network model.............................................................................................................................97

    Laboratory 4 ................................................................................................................................................104 TCP simulation............................................................................................................................................104

    Objective .................................................................................................................................................104 Overview .................................................................................................................................................104 Procedure.................................................................................................................................................104

    Slow start and congestion avoidance ...................................................................................................104 Slow start and congestion avoidance simulation .................................................................................106 Create the network...............................................................................................................................107 Create the Paris subnet ........................................................................................................................110

  • Master thesis MEE 03:24

    Tommy Svensson 4 Alex Popescu

    Create the Stockholm subnet ...............................................................................................................112 Create the IP Cloud..............................................................................................................................114 Choose Statistics..................................................................................................................................115 Slow start and Congestion avoidance simulation ................................................................................117 View the results ...................................................................................................................................117 Fast retransmit .....................................................................................................................................118 Fast recovery .......................................................................................................................................118 Fast Retransmit and Fast Recovery simulation....................................................................................119 Create the Tahoe scenario....................................................................................................................119 Create the Reno scenario .....................................................................................................................119 Simulate the scenarios .........................................................................................................................120 View results .........................................................................................................................................120

    Laboratory 5 ................................................................................................................................................123 OSPF simulation..........................................................................................................................................123

    Objective .................................................................................................................................................123 Overview .................................................................................................................................................123 Procedure.................................................................................................................................................123

    Create the network...............................................................................................................................124 Configure router interfaces ..................................................................................................................126 Assign addresses to the router interfaces. ............................................................................................128 Configure routing cost .........................................................................................................................129 Configure the traffic demands .............................................................................................................132 Configure Simulation ..........................................................................................................................132 Duplicate the scenario .........................................................................................................................132 Run the simulation...............................................................................................................................134 View the results ...................................................................................................................................135

    Laboratory 6 ................................................................................................................................................139 Queuing policies..........................................................................................................................................139

    Objective .................................................................................................................................................139 Overview .................................................................................................................................................139 Procedure.................................................................................................................................................139

    Copy files ............................................................................................................................................140 FIFO queuing.......................................................................................................................................141 Create the FIFO network .....................................................................................................................142 Duplicate scenario ...............................................................................................................................145 Collect statistics...................................................................................................................................146 Run the simulation...............................................................................................................................147 View the results ...................................................................................................................................148 Priority queuing ...................................................................................................................................152 Create the Non-preemptive priority network, infinite buffer...............................................................152 Create the Preemptive priority network, infinite buffer.......................................................................156 Run the infinite buffer simulation........................................................................................................157 View the infinite buffer simulation results ..........................................................................................158 Create the Preemptive priority network, Finite buffer.........................................................................163 Create the Preemptive priority network, Finite buffer.........................................................................163 Run the finite buffer simulation...........................................................................................................164 View the finite buffer simulation results .............................................................................................164 Weighted Fair Queuing .......................................................................................................................169 Create the Weighted Fair Queuing infinite buffer network ..............................................................169 Run the Weighted Fair Queuing infinite buffer simulation ..............................................................173 View the Weighted Fair Queuing infinite buffer results...................................................................173 Create the Weighted Fair Queuing finite buffer network .................................................................175 Run the Weighted Fair Queuing finite buffer simulation .................................................................176 View the Weighted Fair Queuing finite buffer results......................................................................176

    Laboratory 7 ................................................................................................................................................178 Self-Similar .................................................................................................................................................178

  • Master thesis MEE 03:24

    Tommy Svensson 5 Alex Popescu

    Objective .................................................................................................................................................178 Overview .................................................................................................................................................178 Procedure.................................................................................................................................................179

    Create the self similar network model .................................................................................................180 Run the simulation...............................................................................................................................190 View the results ...................................................................................................................................191 Conclusions throughput.......................................................................................................................195 Conclusions delay................................................................................................................................195

    Concluding Remarks ...................................................................................................................................196 Acknowledgments .......................................................................................................................................196 Glossary.......................................................................................................................................................197 References ...................................................................................................................................................198 Appendix 1 ..................................................................................................................................................199 Appendix 2 ..................................................................................................................................................221 Appendix 3 ..................................................................................................................................................244 Appendix 4 ..................................................................................................................................................255

  • Master thesis MEE 03:24

    Tommy Svensson 6 Alex Popescu

    Introduction

    General Today the field of computer networks all over the world has entered an exponential growth phase. These demands have made the necessity of capable network engineers extremely covet. It is therefore crucial for universities to offer networking courses that are both educational and up to date. Due to different obstacles it is unpractical for a university to be able to offer several types of networks to its students. An invaluable tool in this case consists of the network simulator OPNET Modeler that offers the tools for model design, simulation, data mining and analysis for, considering the alternatives, a reasonable cost. OPNET Modeler can simulate a wide variety of different networks which are link to each other. The students can therefore just by sitting at their workstations exercise various options available to network nodes and visually see the impact of their actions. Data message flows, packet losses, control/routing message flows, link failures, bit errors; etc can be seen by the students at visible speed. This is the most cost effective solution for universities to demonstrate the behavior of different networks and protocols.

    Purpose This thesis will implement five laboratory exercises using the OPNET Modeler simulation environment, namely:

    Lab1 Introduction (Introduction to OPNET environment) Lab2 M/M/1 (Construct an M/M/1 queue model) Lab3 Ethernet (Aloha, CSMA, CSMA-CD) Lab4 TCP (SlowStart, Congestion Avoidance, Fast Retransmit, Fast

    Recovery) Lab5 OSPF (Areas, Balanced traffic flow)

    Finally after concluding these laboratory exercises the students comprehension of protocols, networks and routing implementation and interaction will be expanded. This plays a fundamental roll in understanding how Internet works.

  • Master thesis MEE 03:24

    Tommy Svensson 7 Alex Popescu

    Laboratory 1

    Introduction to Opnet

    Objective This laboratory is about basics of using Optimized Network Engineering Tools (OPNET).

    Overview The OPNET is a very powerful network simulator. Main purposes are to optimize cost, performance and availability. The goal of this laboratory is to learn the basics of how to use Modeler interface, as well as some basic modeling theory. The following tasks are considered:

    Build and analyze models. Configure the object palette with the needed models. Set up application and profile configurations. Model a LAN as a single node. Specify background utilization that changes over a time on a link. Simulate multiple scenarios simultaneously. Apply filter to graphs of results and analyze the results.

    Before starting working on the Exercise part of this laboratory, one has to read the Preparations part.

  • Master thesis MEE 03:24

    Tommy Svensson 8 Alex Popescu

    Preparations To build a network model the workflow centers on the Project Editor. This is used to create network models, collect statistics directly from each network object or from the network as a hole, execute a simulation and view results. See Fig.1.

    Figure 1 - Workflow

  • Master thesis MEE 03:24

    Tommy Svensson 9 Alex Popescu

    Project Editor The main staging area for creating a network simulation is the Project Editor. This is used to create a network model using models from the standard library, collect statistics about the network, run the simulation and view the results. Using specialized editors accessible from the Project Editor via File New one can create node and process models, build packet formats and create filters and parameters.

    Figure 2 - A network model built in the Project Editor

    Depending on the type of network being modeled, a network model may consist of subnetworks and nodes connected by point-to-point, bus, or radio links. Subnetworks, nodes, and links can be placed within subnetworks, which can then be treated as single objects in the network model. This is useful for separating the network diagram into manageable pieces and provides a quick way of duplicating groups of nodes and links.

  • Master thesis MEE 03:24

    Tommy Svensson 10 Alex Popescu

    The Node Editor The Node Editor is used to create models of nodes. The node models are then used to create node instances within networks in the Project Editor. Internally, OPNET node models have a modular structure. You define a node by connecting various modules with packet streams and statistic wires. The connections between modules allow packets and status information to be exchanged between modules. Each module placed in a node serves a specific purpose, such as generating packets, queuing packets, processing packets, or transmitting and receiving packets.

    Figure 3 - Node Editor

  • Master thesis MEE 03:24

    Tommy Svensson 11 Alex Popescu

    The Process Model Editor To create process models which control the underlying functionality of the node models created in the Node Editor one can use the Process Editor. Process models are represented by finite state machines (FSMs) and are created with icons that represent states and lines that represent transitions between states. Operations performed in each state or for a transition are described in embedded C or C++ code blocks.

    Figure 4 - Process Model Editor

  • Master thesis MEE 03:24

    Tommy Svensson 12 Alex Popescu

    The Link Model Editor This editor enables for the possibility to create new types of link objects. Each new type of link can have different attribute interfaces and representation. Specific comments and keywords for easy recognition are also possible.

    Figure 5 - Link Model Editor

  • Master thesis MEE 03:24

    Tommy Svensson 13 Alex Popescu

    The Path Editor The Path Editor is used to create new path objects that define a traffic route. Any protocol model that uses logical connections or virtual circuits such as MPLS, ATM, Frame Relay, etc can use paths to route traffic.

    Figure 6 - Path Editor

  • Master thesis MEE 03:24

    Tommy Svensson 14 Alex Popescu

    The Packet Format Editor By making use of this editor it is possible to define the internal structure of a packet as a set of fields. A packet format contains one or more fields, represented in the editor as colored rectangular boxes. The size of the box is proportional to the number of bits specified as the fields size.

    Figure 7 - Packet Format Editor

  • Master thesis MEE 03:24

    Tommy Svensson 15 Alex Popescu

    The Probe Editor This editor is used to specify the statistics to be collected. By using different probes there are several different types of statistics that can be collected, including global statistics, link statistics, node statistics, attribute statistics, and several types of animation statistics. It is mentioned that similar possibilities for collecting statistics are also available under the Project Editor. These are however not as powerful as the Probe Editor.

    Figure 8 - Probe Editor

  • Master thesis MEE 03:24

    Tommy Svensson 16 Alex Popescu

    The Simulation Sequence Editor In the Simulation Sequence Editor additional simulation constrains can be specified. Simulation sequences are represented by simulation icons, which contain a set of attributes that control the simulations run-time characteristics.

    Figure 9 - Simulation Sequence Editor

  • Master thesis MEE 03:24

    Tommy Svensson 17 Alex Popescu

    The Analysis Tool The Analysis Tool has several useful additional features like for instance one can create scalar graphics for parametric studies, define templates for statistical data, create analysis configurations to save and view later, etc.

    Figure 10 - Analysis Tool

  • Master thesis MEE 03:24

    Tommy Svensson 18 Alex Popescu

    The Project Editor Workspace There are several areas in the Project Editor window (a.k.a. workspace) that are important for building an executing a model. See Figure 11 as an example.

    Figure 11 - Project Editor Workspace

    The Menu bar Each editor has its own menu bar. The menu bar shown below appears in the project editor.

    Figure 12 - Menu Bar

    Buttons Several of the more commonly used menu bar can also be activated through buttons. Each editor has its own set of buttons. The buttons shown below appear in the Project Editor.

  • Master thesis MEE 03:24

    Tommy Svensson 19 Alex Popescu

    1 2 3 4 5 6 7 8 9 10 11

    Figure 13 Project Editor Buttons

    1. Open object palette 2. Check link consistency 3. Fail selected objects 4. Recover selected object 5. Return to parent subnet 6. Zoom in 7. Zoom out 8. Configure discrete event simulation 9. View simulation results 10. View web-based reports 11. Hide or show all graphs

    The message area The message area is located at the bottom of the Modeler window. It provides information about the status of the tool.

    Figure 14 - Message area

    Occasionally, the messages Modeler generates may be larger than the message area. You can left-click on the icon next to the message area to open the message buffer, where the entire message displays.

    Tool tips If you place your cursor over a button or a menu selection, a help balloon soon appears.

    Figure 15 - Tool tips

    Online Documentation. Select Help => Online Documentation

  • Master thesis MEE 03:24

    Tommy Svensson 20 Alex Popescu

    Begin the laboratory The goal of the laboration is to model a WAN composed by several LANs. The task is is to model BTHs WAN. As known BTH stretches over three locations in Blekinge. These three locations are: Karlskrona, Ronneby and Karlshamn. Another task is to determine how the background traffic is affecting FTP traffic on the network. To do this the FTP performance on the network will be modeled, first without background traffic and then with background traffic. Because there is no interest in modeling the details of each LAN you will use available LAN models to model the individual LANs as single nodes. The first step in setting up the WAN is to specify the overall context for the network with the Startup Wizard. Steps: 1) Begin by starting up Modeler and create a new project. Select File -> New and click

    OK 2) Name the new project _LAN_Mod and the scenario no_back_util, then

    click OK. Write down your project name here:_____________________ 3) To create an empty scenario for the Initial Topology click next when prompted by

    the Startup Wizard. 4) Next you can specify a map to use as a background for your network. Click Choose From Maps for Network Scale and click Next. 5) Choose Europe from the list and click Next. 6) Now select Lan_Mod_Model_List to be included in your network by clicking on the Include cell and changing the value from No to Yes. Click Next. 7) Finally review your settings and click OK to finish the Startup Wizard. The workspace now shows the specified map and object palette. 8) Zoom in Sweden from the Europe map (Zoom in until you are satisfied).

  • Master thesis MEE 03:24

    Tommy Svensson 21 Alex Popescu

    To work with Modelers full set of node and link models would be overwhelming, so the object palette can be configured to show only a specific subset, or model list. Further you can use the standard model list, adapt them for your own needs, or make your own list. For this lab we created LAN_Mod_Model_List. Now you will adapt that model list by adding the LAN node model to it. 9) To open the Configure Palette dialog box click the Configure Palette button in the

    object palette.

    Figure 16 - Configure Palette dialog

    The Configure Palette dialog box lets you change the object palette and then save it 10) Click the Node Models button in the Configure Palette dialog box. Select Included Entries dialog box appears. 11) Find 10BaseT_LAN in the list and change its status from not included to included.

    Figure 17 - Select technologies dialog

    12) Click OK.

  • Master thesis MEE 03:24

    Tommy Svensson 22 Alex Popescu

    Figure 18 - Object Palette

    The 10BaseT_LAN icon appears in the object palette. 13) Click OK to close the Configuration Palette dialog box, then click OK again to save

    the model list as _LAN_Mod_Model_List-no_back_util.

  • Master thesis MEE 03:24

    Tommy Svensson 23 Alex Popescu

    You will now configure the Application Configuration Object and the Profile Configuration Object. Before you begin constructing the network its a good idea to predefine the profiles and applications that will be used by the LAN. 14) To configure the Application Configuration Object, open the object palette in the

    case it is not already open and drag an Application Config object to the project workspace.

    15) Right click and select Edit Attributes from the pop up menu. 15) Click on the question mark next to the name attribute to see a description of the

    attribute. When done close the attribute description dialog box.

    Figure 19 - Application Configuration Attributes

    16) Set the name attribute to Application Configuration. 17) Now change the Application Definitions attribute to Default by clicking in the

    attributes Value column and selecting Default from the pop-up list.

  • Master thesis MEE 03:24

    Tommy Svensson 24 Alex Popescu

    Figure 20 - Application Configuration Attributes

    Selecting Default configures the application definition object to have the eight standard applications which are: Database Access, Email, File Transfer, File Print, Telnet Session, Video conferencing, Voice over IP Call and Web Browsing. 18) Close the Attributes dialog box by clicking OK. Now you will configure the Profile Configuration Object. 19) Drag a Profile Configuration object from the object palette to project workspace. 20) Right-click on the object and select Edit Attributes.

    Figure 21 - Profile Configuration Attributes

    21) Set the name attribute to Profile Configuration as shown in the box above.

  • Master thesis MEE 03:24

    Tommy Svensson 25 Alex Popescu

    22) Change now the Profile Configuration attribute by clicking in its value column and selecting Edit from the drop down menu. The Profile Configuration Table box appears.

    Figure 22 - Profile Configuration Table

    Define a new profile and add it to the table. 23) First change the number of rows to 1. 24) Name the new profile LAN Client. 25) Click in the profiles Start Time (seconds) cell to open the Start Time Specification

    dialog box. 26) Select constant from the Distribution Name pull-down menu.

    Figure 23 - LAN Client Start Time Attributes

  • Master thesis MEE 03:24

    Tommy Svensson 26 Alex Popescu

    27) Set Mean Outcome to 100, the click OK. Since you will be modeling FTP performance, that application should be included in the profile. 28) Click in the LAN Clients Applications column and choose Edit from the pop-up

    menu 29) Change the number of rows to 1. 30) Set the name to File Transfer (Heavy) by clicking in the cell and selecting the

    application from the pop-up menu. By selecting Default as the value for the Application Definition attribute in this object, you enable this list of applications. The list includes 16 entries, a heavy and a light version for each of the eight standard applications. 31) Set the Start Time Offset to Uniform (0,300). 32) The completed dialog box should look like this. Verify and then click OK to close the

    Applications Table dialog box.

    Figure 24 Heavy File Transfer Application table

    33) Click OK to close the Profile Configuration Table, then click OK once again to

    close the Attributes dialog box. You are now ready to begin the construction of the WAN. In this scenario the network contains 2 identical subnets in Karlskrona and Karlshamn. You can create the first subnet in Karlskrona , with its nodes inside it, and then copy the subnet to Karlshamn. You will also copy it to Ronneby and modify it further.

  • Master thesis MEE 03:24

    Tommy Svensson 27 Alex Popescu

    Hint: A subnet is a single network object that contains other network objects (links, nodes and other subnets). Subnetworks allow you to simplify the display of a complex network through abstraction. Subnets are useful when organizing your network model. Subnets can be nested within subnets to an unlimited degree. 34) Open the object palette. 35) Place a subnet over Karlskrona, Right-click to turn off node creation. 36) Right-click on the subnet and select set name. Change the name to Karlskrona. The extent of the subnet needs to be modified. The subnet extent is the geographic area covered by the subnet, which may be much larger than the actual area you wish to model. 37) Right-click on the Karlskrona subnet and select Advanced Edit Attributes. 38) Change the x span and y span attributes to 0,25. The unit of measure of these attributes is determined by the unit of measure of the top-level area, degrees in this case. 39) Click OK. In order to see whats inside subnets just double-click on that subnet icon and the Modeler will change the view. By default a subnets grid properties is based on its parent subnet. You can change them to fit your network. 40) Double-click on the Karlskrona Subnet. 41) Select View => Set View Properties 42) Set units to Meters. 43) Set resolution to 10 pixels/m. 45) Uncheck the Visible checkbox for Satellite orbits. 46) Verify that Drawing is set to Dashed. 47) Set division to 10.

  • Master thesis MEE 03:24

    Tommy Svensson 28 Alex Popescu

    Figure 25 - View Properties

    48) Click the Close button. The network in BTH does not require modeling the precise nature of each node in each subnet, so you can represent the subnets with a LAN model. 49) Place a 10BaseT_LAN in the workspace. 50) Right-click on the 10BaseT_LAN and choose the Edit Attribute menu item. You can change the attributes so that it represents a network with a certain number of workstations and a particular traffic profile. 51) Change the LAN models name attribute to Office_LAN. 52) Choose Edit for the Application: Supported Profiles attribute. 53) Change the number of rows to 1. 54) Change the Profile Name to LAN Client, then click OK. This LAN will now use the LAN Client profile you created earlier. This profile includes the File Transfer (Heavy) application. The LAN will send traffic that models heavy FTP use.

  • Master thesis MEE 03:24

    Tommy Svensson 29 Alex Popescu

    55) Change the Number of Workstations attribute to 10, then click OK. 56) Close the Edit Attributes dialog box. You have now modeled a 10 workstation LAN inside the Karlskrona subnet. Further because this LAN model is composed of workstations and links only, it must be connected to a router. The router can then be connected to other routers in the network. 57) To create an router drag a BN_BLN_4s_e4_f_sl8_tr4 node from the object palette to the workstation near the Office_LAN node. 58) After naming the new node router connect it to the Office_LAN nodes with a 10BaseT link. Right click to turn off link creation. The Karlskrona subnet is now configured. Because the subnets in Karlshamn and Ronneby are identical, you can copy the Karlskrona subnet and place it appropriately. 59) To copy the subnet you must first return to the parent subnet, this is done either by

    clicking on the Go to Parent Subnetwork button or right click on the workspace to bring up the workspace pop-up menu, then choose Go to Parent subnetwork from the menu. 60) After returning to the parent subnet, select the subnet and copy it, this is done either by clicking Edit=>Copy or by pressing +c. 61) Now paste the subnet to Karlshamn and Ronneby by selecting Edit=>Paste or by pressing +v and then click on the Karlshamn and Ronneby region. When done the new subnets appears. 62) You will now have to rename the subnets. To do so right-click on each of the two subnets and choose set name. 63) Next you should connect the Karlshamn and the Karlskrona subnets to Ronneby. To do so select the LAN_Mod_PPP_DS0 link in the object palette. 64) Draw a LAN_Mod_PPP_DS0 link from Karlskrona to Ronneby. Next a Select Nodes dialog box appears asking which nodes in each subnet are to be endpoints of the link. 65) For node a, choose the Karlskrona.router node. 66) For node b, choose the Ronneby.router node.

  • Master thesis MEE 03:24

    Tommy Svensson 30 Alex Popescu

    67) Click OK to establish the link

    Figure 26 - Select Nodes dialog

    68) Repeat this process, drawing link from Karlshamn to Ronneby as well. Specify the citys router as the links endpoints. 69) When done right-click to turn of link creation. The network should resemble the one shown in the picture below.

    Figure 27 - Network overview

  • Master thesis MEE 03:24

    Tommy Svensson 31 Alex Popescu

    To complete the network, the main office in Ronneby needs to have a switch and a server added to it. 70) To configure the network in Ronneby double-click on the Ronneby subnet to enter its subnet view. 71) Place one switch and one ethernet_server node in the workspace. 72) Rename the node to switch. This is done by right-clicking on each icon and select Set name from the menu. 73) Rename the ethernet_server to FTP. 74) Connect the router and the server to the switch with 10BaseT links. Right-click to turn off link creation, and close the object palette. The Server needs to be configured to support the FTP Application. 75) Open the Attributes dialog box for the FTP server. 76) Choose Edit for the Application: Supported Services 77) Change number of rows to 1. 78) Select File Transfer (Heavy) from the Name column pop-up menu.

    Figure 28 - Application Supported Services

    79) Click OK to close the Supported Services dialog box, and then click OK to close the FTP Attributes dialog box.

  • Master thesis MEE 03:24

    Tommy Svensson 32 Alex Popescu

    Figure 29 - Ronneby subnet

    80) Return to the parent subnet view. 81) Save the project. File => Save. You have now created a model to act as a baseline for the performance of the network. Background traffic will now be added to the links connecting the cities. The results from the two scenarios will be compared. We begin with duplicating a scenario to be able to compare the results later. 82) Select Scenarios => Duplicate Scenario 83) Name the scenario back_util and click OK.

  • Master thesis MEE 03:24

    Tommy Svensson 33 Alex Popescu

    Figure 30 - Scenarios menu

    84) Select the link between Karlskrona-Ronneby. Right-click on the link and choose Similar Links from the pop-up menu. 85) Display the Edit Attributes dialog box for the link between Karlskrona-Ronneby. 86) Click in the Value cell for the Background Utilization attribute and select Edit... from the pop-up menu. 87) Click on the Rows value and change it to 3. Press Return. Network studies show that traffic rises gradually over the course of the day as employees/students arrive. 88) Complete the dialog box as shown. Then Click OK.

    Figure 31 - Background Utilization dialog

    The last step in setting background utilization is to apply the changes made to the Karlskrona-Ronneby link to all the selected links. 89) Check the Apply Changes to Selected objects check box in the Karlskorna-Ronneby Attributes dialog box.

  • Master thesis MEE 03:24

    Tommy Svensson 34 Alex Popescu

    Figure 32 - Link Attributes

    90) Click OK to close the dialog box. Note that 2 objects changed appears in the message area. 91) Save the project. File => Save. Now you have configured two scenarios, one without background utilization and one with background utilization. You are ready to collect data and analyze it. The relevant statistics for this network are:

    Utilization statistics for the links. Global FTP download time for the network.

    You will now collect statistics in the back_util scenario. 92) Right-click in the workspace to display the workspace pop-up menu, and select Choose Individual Statistics. 93) Select the Global Statistics => Ftp => Download Response Time (sec) statistic.

  • Master thesis MEE 03:24

    Tommy Svensson 35 Alex Popescu

    Figure 33 - Results dialog

    94) Select the Link Statistics => point-to-point => untilization --> Statistic.

    Figure 34 - Results dialog

    95) Click OK to close the dialog box. In order to compare the statistics in the back_util scenario to the no_back_util scenario, the same statistics must be collected in the no_back_util scenario. Change scenario and collect statistics.

  • Master thesis MEE 03:24

    Tommy Svensson 36 Alex Popescu

    96) Select Scenarios => Switch To Scenario, then choose no_back_util.

    Figure 35 - Scenarios menu

    97) Collect the same statistics that you did in the back_util scenario:

    Global Statistics => Ftp => Download Response Time (sec) Link Statistics => point-to-point => untilization -->

    98) Close the Choose Results dialog box. 99) Save the project. The statistics are now ready to be collected by running the simulations. Instead of running each simulation separately, you can batch them together to run consecutively. 100) Select Scenarios => Manage Scenarios 101) Click on the Results value for the no_back_util and back_util scenarios and change the value to . 102) Set the Sim Duration value for each scenario to 30 and the Time Units to minutes.

  • Master thesis MEE 03:24

    Tommy Svensson 37 Alex Popescu

    Figure 36 - Manage Scenarious

    103) Click OK. Modeler will now run simulations for both scenarios. A simulation Sequence dialog box shows the simulation progress. Shut down the dialog box when the simulations are done. Hint: You are now ready to view the results of the two scenarios. To view the results from two or more different scenarios against each other, you can use the Compare Results feature. With this topic you can also apply different built-in filters to the graphs. 104) Continue by comparing the results, to do so display the workspace pop-up menu and choose Compare Results. 105) In the Compare Results dialog box, select Object Statistics => Choose From Maps Network => Karlshamn Ronneby[0] => point to point => utilization ->. 106) Further you will also have to change the filter from menu from As Is to time_average. This must be done because utilization varies over the course of a simulation and it is therefore helpful to look at time average for this statistic.

  • Master thesis MEE 03:24

    Tommy Svensson 38 Alex Popescu

    Figure 37 - Compare Results dialog

    107) Click Show to display the graph. The graph should resemble the one below, though it will not match exactly.

  • Master thesis MEE 03:24

    Tommy Svensson 39 Alex Popescu

    Figure 38 - Utilization graph

    You may want to look at the utilization of other links to determine the maximum utilization of any link. Lets look at Global FTP response time. 108) Click the Unselect button in the Compare Results dialog box. 109) Check the Global Statistics => FTP => Download Response Time statistic in the Compare Statistics dialog box. 110) Verify that the filter menu shows time_average, then click Show. The graph should resemble the one below, though it will not match exactly.

  • Master thesis MEE 03:24

    Tommy Svensson 40 Alex Popescu

    Figure 39 - Download Response Time graph

    The laboration is now completed. Before you leave please remove your saved project from the computer. By default it is located on: C:\Documents and Settings\[your login name]\op_models Remove all your saved files.

  • Master thesis MEE 03:24

    Tommy Svensson 41 Alex Popescu

    Laboratory 2

    M/M/1 Queue simulation

    Objective This laboratory is important for understanding OPNET system and user interface. The lab contains a step-by-step example that shows how to use OPNET to construct an M/M/1 queue design and analysis.

    Overview The task is to construct an M/M/1 queue model and observe the performance of the queuing system as the packet arrival rates, packet sizes, and service capacities change. Two classes of statistics will be measured, Queue Delay and Queue Size. A graph of the confidence interval will also be produced. This laboratory also introduces the use of: Node Model Probe Model Simulation Tool Analysis Tool

  • Master thesis MEE 03:24

    Tommy Svensson 42 Alex Popescu

    Procedure An M/M/1 queue consists of a First-in First-Out (FIFO) buffer (queue) with packet arriving randomly according to a Poisson arrival process, and a processor, that retrieves packets from the buffer at a specified service rate. Three main parameters affects the performance of an M/M/1 queue, namely: Packet arrival rate, Packet size, 1/ Service capacity, C [7]

    Figure 40 - M/M/1 overview

    OPNET models are hierarchical. At the lowest level, the behavior of an algorithm or a protocol is encoded by a state/transition diagram, called state machine, with embedded code based on C-type language constructs. At the middle level, discrete functions such as buffering, processing, transmitting and receiving data packets are performed by separate objects. Some of these objects rely on underlying process models. In OPNET, these objects are called modules and they are created, modified and edited in the Node Editor. Modules are connected to form a higher-level node model. At the highest level, node objects are deployed and connected by links to form a network model. The network model defines the purpose of the simulation. The lower-level objects for M/M/1 queue are provided by OPNET, but they need to be combined to form a node model.

  • Master thesis MEE 03:24

    Tommy Svensson 43 Alex Popescu

    Creation of the node model The M/M/1 queue consists of several objects in the Node Editor, namely 2 processors and a queue. One processor is used for (source) packet generation. The second processor is used for the sink module. The source module generates packets and the sink module disposes the packets generated by the source. The queuing system is composed by an infinite buffer and a server. The source module generates packets at an exponential rate.

    1) Start OPNET. 2) Open a new project and a new scenario. Name the new project

    _mm1net and the scenario MM1. 3) Click Quit in the wizard. 4) Select File => New , then select Node Model from the pull-down list and click

    OK.

    The Node Editor appears.

    5) Click on the Create Processor button. 6) Place a processor module in the workspace. Right-click to end the operation. 7) Right-click on the processor and select Edit attributes. 8) Change the name attribute to Source. 9) Change the process model attribute to simple_source.

    Some new generator attributes appears in the attribute list.

    10) Left-click in the Value Column of the Packet Interarrival Time attribute to open the Packet Interarrival Time Specification dialog box.

    11) From the Distribution Name pop-up menu select Exponential, as in a Poisson

    process. 12) Set the Mean Outcome to 1.0 and click OK. This sets the mean interarrival time,

    , of a packet to 1 second.

  • Master thesis MEE 03:24

    Tommy Svensson 44 Alex Popescu

    13) Change the Packet Size attribute so that Distribution Name is exponential and Mean Outcome is 1024. Click OK.

    Figure 41 - Processor Model Attributes

    14) Click OK to close the Attributes dialog box.

    In your design you will somehow have to represent the infinite buffer and the server, this

    will be done by the queue module.

    15) To create the queue model click first on the Create Queue Module button and place then a module in the workspace to the right of the generator.

    16) When done right click to end the operation. 17) Further right-click on the queue module and select Edit Attributes to bring up its

    attributes.

  • Master thesis MEE 03:24

    Tommy Svensson 45 Alex Popescu

    Figure 42 Queue Process Model Attributes

    18) Change the name attribute to queue. 19) Change the process model attribute to acb_fifo

    The acb_fifo process is an OPNET-supplied process model that provides service in the packets arriving in the queue according to FIFO discipline. Note that when a process model is assigned to a module, the process model attributes appear in the modules attribute menu. The acb_fifo process model has an attribute called service_rate. When you select the acb_fifo process model, the service_rate attribute appears in the queue modules attribute menu with the default value 9600 bits per second. The name of the model acb_fifo reflects its major characteristics: Characteristics Indicates A Active, acts as its own server C Concentrates multiple incoming packet

    streams into its single internal queuing resource

    B Service time is a function of the number of bits in the packet

    fifo First in first out service ordering discipline 20) Right click on service rate in the attribute column. 21) Select Promote attribute to higher level. The value for this will be set later in

    the Simulation Set dialog box. 22) Click OK to close the dialog box.

    Further a sink module should be used although it is not a part of the M/M/1 queue system. The reason for using a sink is for proper memory management, packets should be

  • Master thesis MEE 03:24

    Tommy Svensson 46 Alex Popescu

    destroyed when no longer needed. The OPNET-supplied sink process module destroys the packet sent to it.

    23) To create the sink module, activate the Create Processor Module button and then place a processor module to the right of the queue model on the workspace.

    24) Open the attribute box for the processor module by right clicking the icon. 25) Change the name attribute to sink. Notice that the default value for the process

    model attribute is sink. 26) Close the dialog box.

    Figure 43 - Processor Model Attributes

    To transfer packets between the generator module, the queue module and the sink module, it will be necessary to connect them together. This is done by packet streams that provide a path for the transfer of packets between modules. They serve as one-way paths and are depicted by solid arrowed lines.

    27) Activate the Create Packet Stream button. 28) Connect the source module with the queue module by clicking the source icon,

    then clicking the queue icon. Remember that the first module you click becomes the source, and the second one the destination.

    29) Connect the queue module and the sink module. Remember to end the Create

    Packet Stream operation by right-clicking anywhere in the window. 30) Select Interface => Node Interfaces.

  • Master thesis MEE 03:24

    Tommy Svensson 47 Alex Popescu

    Figure 44 - Node Types dialog

    31) In the Node Types table, click in the Supported cell for the fixed node type. This

    toggles the value to yes. Make sure mobile and satellite nodes are not supported. 32) Click OK to close the Node Interfaces dialog box.

    The M/M/1 node model definition is complete. You are now ready to create the network model, but first you should save your work.

    33) To save select File => Save. Name the node _mm1, then click OK and close the Node Editor.

    The first step in creating the network model is to create a new model list. You can customize the palette to display only the models needed.

    34) Click on Open Object Palette button. 35) Click on the Configure Palette button in the object palette. 36) Click on the Model List radio button. 37) Click on the Clear button. 38) Click on the Node Models button.

    A list on available node models appears.

    39) Scroll in the table until you find the _mm1 node model. Change the status from not included to included.

    40) Click OK to close the table. 41) Click the Save button. Enter the name _mm1_palette. 42) Click OK.

  • Master thesis MEE 03:24

    Tommy Svensson 48 Alex Popescu

    The node model you created is now included in the object palette. Now you can create the network model.

    43) Click and drag the _mm1 node model to the workspace. Right-click to end the operation.

    44) Change the name. Right-click and select Set Name.

    45) Enter the name m1 and choose OK.

    Figure 45 - M/M/1 Node Model

    46) Save your model. File => Save. We will use the Probe Editor to set the statistics to collect during simulation. This could also be done by the Choose Result option in the object pop-up menu. The Probe Editor is a more powerful collection tool. The Probe Editor will be used to collect queue delay and queue size statistics.

    47) Select File => New ,then select Probe Model and click OK. You must specify the network model from which the Probe Model should collect statistics.

    48) Select Objects => Set Network Model. 49) Choose the _mm1net-mm1 network model.

    We will now set the probes. Specifying appropriate probes causes the statistics to be recorded at simulation time.

    50) Click the Create Node Statistics Probe button and a probe appears below.

    Figure 46 Probe Attributes We will use the automatic selection method to type in the attributes for the probe.

  • Master thesis MEE 03:24

    Tommy Svensson 49 Alex Popescu

    51) Right-click on the probe and select Choose Probed Object from the pop-up

    menu. 52) Expand the m1 node.

    53) Select the queue module and click OK.

    Figure 47 - Probe Objects

    top.m1.queue appears in the Object column.

    Figure 48 - Probe Object

    54) Right click on the probe and select Edit Attributes from the pop-up menu.

    55) Set the name to Queue Delay.

    56) Set the submodule attribute to Subqueue[0].

    57) Left-click in the Value column of the statistics row.

    The Available Statistics dialog box shows the statistics, the group it belongs to and a description.

    58) Select queue.queuing delay from the list and click OK. The group attributes changes to queue and the statistics attribute changes to queuing delay in the Edit Attributes dialog box.

    59) Set scalar data to enable. 60) Set scalar type to sample mean.

    61) Set scalar start to 14400. This is done to eliminate the unwanted initial

    oscillations.

    62) Set scalar stop to 18000. This equals one hour.

  • Master thesis MEE 03:24

    Tommy Svensson 50 Alex Popescu

    63) Set capture mode to all values.

    64) Click OK to close the probes Attribute dialog box.

    65) Click the Create Node Statistics Probe button and a probe appears below. 66) You will now have to set new values to the attributes of the probe, to do so right

    click on the new probe and select Edit Attributes. The values should be set as follows: name = Queue Size subnet = top node = mm1 module = queue submodule = subqueue [0] group = queue statistic = queue size (packets) scalar data = enabled scalar start = 14400 scalar stop = 18000 capture mode = all values

    67) When done close the probes Attribute dialog box by clicking OK. The changes will then appear in the Probe Editor.

    Figure 49 - Probe Model

    68) Click on the create attribute button . 69) Right click and select choose attributed object in the pop-up menu.

  • Master thesis MEE 03:24

    Tommy Svensson 51 Alex Popescu

    70) Select top => mm1 =>queue then click OK.

    71) Right click on the attribute probe and select edit attributes.

    72) Set attribute to service_rate.

    The probes are now set up correctly and will collect the desired statistics.

    73) Save the probe file. File => Save. Name it _mm1probe. 74) Close the Probe Editor.

    Its time to begin the simulation. We will use the Simulation Sequence Editor instead of running the simulation form the Project Editor.

    75) To open the Simulation Sequence Editor choose Simulation => Configure Discrete Event Simulation (Advanced).

    76) Now place the simulation set icon in the workspace and change its values by

    selecting Edit Attributes.

    77) The simulation Duration should be set to 7 hours and the Seed to 321.

    78) Change the value per statistic to 10000. The seed is an initial value for the random generator. You can choose your own arbitrary value.

    79) Now select the Advanced tab and then set the probe file to _mm1probe.

    80) Set Scalar File to _mm1scalar.

    81) Select the Object Attributes tab.

    82) Click the Add button.

    An Add Attributes dialog box appears.

    83) Mark Add in the column next to m1.queue.service_rate. 84) Click OK to close the dialog box.

    85) Select the m1.queue.service_rate attribute in the Simulation Set dialog box and

    click the values button.

  • Master thesis MEE 03:24

    Tommy Svensson 52 Alex Popescu

    An Attribute: m1.queue.service_rate dialog box appears.

    86) Set the value to 1050. 87) Set the Limit to 1200.

    88) Set Step to 50.

    Figure 50 - Simulation Attributes

    89) Click OK to close the Attribute: m1.queue.service_rate dialog box.

    Notice that the number of runs has changed to 4.

    Figure 51 - Simulation dialog

    90) Click OK to close the Simulation Set dialog box. 91) Click on the scenario to mark it.

    92) Select Edit => Copy in the menu.

    93) Select Edit => Paste.

    94) Place the new scenario to the right of its parent.

    95) Right click on the new scenario and select Edit Attributes.

    96) Change the Seed number to a different value, when done click OK to close the

    dialog box.

  • Master thesis MEE 03:24

    Tommy Svensson 53 Alex Popescu

    97) Create eight more scenarios by repeating steps 91 to 96.

    Notice: Its very important that each scenario has different Seed numbers.

    98) When finished creating all the scenarios begin the simulation by clicking on the

    Execute Simulation Sequence button. Wait until the simulation is completed.

    In this last portion of lab you will learn how to view your results. The tool used for this task is the Analysis Tool.

    99) Select File => New from the Project Editor.

    100) From the pull-down menu in the dialog box change the file type to Analysis Configuration, then click OK. The Analysis Tool opens in a new window.

    During the simulation the packets always experience some delay. This delay is named the mean queuing delay and is the first statistic that we are going to take a closer look at.

    101) To view the mean queuing delay left-click on the create a graph of a statistic

    button. 102) When done the View Results dialog box opens. Expand now the following

    hierarchy: File Statistics => _mm1net-mm1 => Object Statistics => mm1 => queue => subqueue [0] => queue.

    103) Select the queuing delay statistic.

    104) From the list of filters select average.

    105) Finally to show the graph click on the Show button.

  • Master thesis MEE 03:24

    Tommy Svensson 54 Alex Popescu

    Figure 52 - View results dialog

    Compare your graph with the one below, and se if it matches.

  • Master thesis MEE 03:24

    Tommy Svensson 55 Alex Popescu

    Figure 53 - Queue Delay graph

    The large deviations early in the simulation depends on the sensitivity of averages to the relatively small number of samples collected, as you can see the average stabilizes towards the end of the simulation. The results need to be validated. Calculate the following:

    Mean arrival rate, ==imeerarrivaltmean int

    1

    Mean service requirement, =1

    Service capacity, C = Mean service rate, =C

    Mean Delay, == CW1

    Does the analytic value agree with the simulated result?

  • Master thesis MEE 03:24

    Tommy Svensson 56 Alex Popescu

    Another statistic of interest is the time-averaged queue size.

    106) In the View results dialog box, remove the check next to the queuing delay.

    107) Place a check next to the queue size (packets) statistic.

    108) Select time-average from the pull-down list.

    109) Click Show.

    Figure 54 - View Results dialog

    Figure 55 - Queue Size graph

  • Master thesis MEE 03:24

    Tommy Svensson 57 Alex Popescu

    From this graph we can draw the conclusion that the system is stable. It reaches steady state after about 2 hours. Validate the result. Calculate the following:

    Ratio of Load to Capacity ==C

    Average Queue Size =

    1

    Does the analytic value agree with the simulated results? We will produce a queue size versus time averaged queue size graph.

    110) Set focus on the time averaged queue size window. 111) Right-click on the graph and choose Add statistics.

    112) Place a check next to File Statistics => _mm1net-mm1 => Object

    Statistics => m1 => queue => subqueue [0] => queue => queue size (packets).

    113) Left-click on the Add box.

    114) Save the analysis configuration as _mm1net-mm1.

  • Master thesis MEE 03:24

    Tommy Svensson 58 Alex Popescu

    Figure 56 - Queue Size, As Is and Average overlapped graph

    Its important to know the confidence intervals of the simulation results. We will now graph the confidence interval.

    115) Load the Scalar file. File => Load output scalar file 116) Select _mm1scalar.

    117) Click the Create graph of two scalars button. 118) Select top.queue.service_rate on the Horizontal roll-down menu.

    119) Select top.queue.subqueue[0].queue.queue size (packets).mean on the

    Vertical roll-down menu.

    120) Right click on the graph and select Edit Graph Properties.

  • Master thesis MEE 03:24

    Tommy Svensson 59 Alex Popescu

    121) Check the Show Confidence Interval check box.

    Figure 57 - Graph Plot properties

    122) Click OK to close the dialog.

  • Master thesis MEE 03:24

    Tommy Svensson 60 Alex Popescu

    The graph should resemble the one below.

    Figure 58 - Queue Size Confidence Intervall graph

  • Master thesis MEE 03:24

    Tommy Svensson 61 Alex Popescu

    In order to get better confidence intervals you need to run more scenarios. The graph below shows the confidence interval of 40 scenarios. The service rate is between 1024 and 1300 with step size 10.

    Figure 59 - Queue Size Confidence Interval graph

    Congratulations! You have finished the lab.

  • Master thesis MEE 03:24

    Tommy Svensson 62 Alex Popescu

    Laboratory 3

    Ethernet simulation

    Objective Networks can be generally divided into two broad categories, which are based on using point-to-point connections and on using broadcast channels. In the broadcast channel case, there could be competition for the use of the channel between two or more stations. In the common literature, broadcast channels are referred to as multi-access channels, or random-access channels. The problem of media access is therefore the most important one for this case. Multiple access protocols are implemented primarily in Local Area Networks (LANs). Todays personal computers and workstations are connected by Local Area Networks (LANs), which use a multi-access channel as the basis of their communication. An example of a popular LAN is the Ethernet which uses a random-access scheme for media access. The random-access technique was first used by the ALOHA protocol developed at the University of Hawaii in the 1970s. Another popular random-access protocol is the Carrier Sensing Multiple Access (CSMA) scheme which was developed by XEROX Parc. Further the Ethernet, which is using the Carrier Sensing Multiple Access with Collision Detection (CSMA-CD) scheme, was developed by Dr. Robert M. Metcalfe in 1978. [4]

    Overview In this laboratory we will study Multiple Access Protocols. We will look at the ALOHA, CSMA and Ethernet (CSMA-CD) protocols. The ALOHA is the simplest Multiple Access Protocol and implements therefore only the most basic functionality, which is to send packets. ALOHA has no built mechanism to check if the channel is free before it continues transmitting packets, neither the possibility to detect any collisions on the channel. These flaws limit the use of the bus. By adding carrier sense capability to the Aloha random access protocol the performance is improved. The carrier sense capability is employed in the CSMA (Carrier Sense Multiple Access) protocol. The process waits until the channel is free before transmitting a packet. Because of finite signal propagation times, it is possible for a node to be transmitting before it detects an existing transmission signal. This results in some collisions. [4] Finally the Ethernet protocol implements the capability of both transmitting and monitoring a connected bus link at the same time. It has fullduplex capability. By monitoring the bus link it can determine whether a collision condition exists. If that is the

  • Master thesis MEE 03:24

    Tommy Svensson 63 Alex Popescu

    case a retransmission sequence will commence. This operational mode is commonly referred to as Carrier-Sense Multiple Access with Collision Detection (or CSMA/CD). The objectives of our study are:

    To take a look at the performance, whichs main objective is the throughput. To study various parameters that characterizes the multi-access protocols. To assess via simulation the performance of ALOHA, CSMA and CSMA-CD

    protocols and to study the throughput of each of them.

    Procedure OPNET uses the Finite State Machine (FSM) to implement the behavior of a module. FSMs determine a modules behavior when an event occurs, detailing the actions taken in response to every possible event. A process model is a Finite State Machine (FSM). It represents a modules logic and behavior. An FSM consists of any number of states that a module may be in and the necessary criteria for changing states. A state is the condition of a module. For example the module may be waiting for a link to recover. A transition is a change of state in response of an event.

    Designing the Aloha Transmitter Process Model The Aloha transmitter process must only receive packets from the generator and send them further onto the transmitter. This process model has only two states, idle and tx_pkt. The idle state is an unforced state. That means it returns control to the simulation kernel after executing its executives. The simulation begins in the idle state where it waits for packets to arrive. In this model the FSM (Finite State Machine) begins in an unforced state. Because of that the process needs to be activated with a begin simulation interrupt. When the simulation starts the FSM will execute the idle state and will then be ready to transition with the first arriving packet. The tx_pkt state is a forced state. That means it does not return control to the simulation kernel, but instead immediately executes the exit executives and transitions to another state. The only interrupt expected is the packet arrival interrupt (the arrival of generated packets). It is therefore safe to omit the unforced state a default transition. When a packet interrupt is delivered the FSM should perform executives to acquire and transmit the packet in the tx_pkt state, then transition back to the idle state.

    1) Start Opnet. 2) Select File New then Process model.

    3) Click on the Create State button and place two states in the workspace.

  • Master thesis MEE 03:24

    Tommy Svensson 64 Alex Popescu

    The first state created is automatically the initial state and indicated by a heavy black arrow pointed towards it (figure 60). Any state can be changed to initial state by right clicking on the state and choose Make Initial state in the pop-up menu.

    Figure 60 - A initial state

    4) Right click on the initial state and choose Edit attributes. 5) Change the name to idle.

    6) Make sure the status is unforced.

    Figure 61 - State Attributes

    7) Click OK to accept the changes. 8) Right click on the other state and choose Edit attributes. 9) Change the name to tx_pkt and the status to forced.

    It is now time to specify the code for the process model starting with the header block. In the header block one usually specify macros to replace more complicated expressions in transition conditions and executives. The use of macros saves place but the key advantage is that it simplifies the task of interpreting an FSM diagram. The header block may also contain #include statements, struct and typedef definitions, extern and global variable declarations, function declarations and C-style comments.

    10) Click on the Header Block button. 11) Type in the definitions shown below.

  • Master thesis MEE 03:24

    Tommy Svensson 65 Alex Popescu

    12) Close the header block editor to save the definitions. IN_STRM and OUT_STRM will be used later to specify which stream to get packets from and to which to send the packets to. In this process model only stream number 0 will be used. It is possible to select any stream number between 0-8. To achieve the desired functionality these stream indices must be consistent with those defined in the node model later. PKT_ARVL is used to determine when a packet interrupt occurred by comparing the value returned by the Simulation Kernel Procedure op_intrpt_type() with the OPNET constant of OPC_INTRPT_STRM. If the comparison evaluates to true, this indicates that the interrupt is due to a packet arriving on an input stream. In this model there is no need to determine which input stream received the packet. A packet in only expected on input stream 0. The global variable subm_pkts will be used to keep track of the number of submitted packets.

    13) Create two transitions, one from idle state to tx_pkt state and the second one from

    tx_pkt state to idle state. Use the create transition button. 14) Right click on the idle tx_pkt transition and select edit attributes.

    15) Change the condition attribute to PKT_ARVL.

    The finished configuration should look like in figure 62.

    /* Input stream from generator module */ #define IN_STRM 0

    /* Output stream to bus transmitter module */ #define OUT_STRM 0

    /* Conditional macros */ #define PKT_ARVL (op_intrpt_type () == OPC_INTRPT_STRM)

    /* Global variable */ extern int subm_pkts;

  • Master thesis MEE 03:24

    Tommy Svensson 66 Alex Popescu

    Figure 62 - Process Model

    The condition PKT_ARVL is the macro that just has been defined in the header block. The next step is to create state executives needed in the FSM. OPNET allows one to attach code to each part of an FSM. This code is called Proto-C. There are three primary places to use Proto-C, namely:

    Enter Executives: Code executed when the module moves into a state. Exit Executives: Code executed when the module leaves a state. Transition Executives: Code executed in response to a given event.

    Although the enter executives and exit executives of forced states are executed without interruption, standard practice is to place all forced state executives in the enter executives block. To bring up the enter executives editor one double clicks on the upper half of the state. Double clicking on the lower half of the state will bring up the exit executives editor. (figure 63)

    Figure 63 - executives editor click zones

  • Master thesis MEE 03:24

    Tommy Svensson 67 Alex Popescu

    Next step is to define the actions for the idle state.

    16) Double-click on the top of the idle state to open the enter executives block 17) Enter the code shown below.

    18) Save your changes to close the text edit pad.

    op_ima_sim_attr_get (attr_type, attr_name, value_pointer) function takes three arguments. attr_type argument specifies the type of the attribute-of-interest. The acceptable values of this argument are OPC_IMA_INTEGER, OPC_IMA_DOUBLE, OPC_IMA_TOGGLE, or OPC_IMA_STRING. attr_name argument specifies the name of the attribute-of-interest. This value must specify an attribute defined in the simulation environment, or a prompt will be issued for the attributes value. value_pointer argument specifies a pointer to a variable to be filled with the specified attributes value. It can accept a pointer to an integer, a double, or a character string. In the last case, the array of characters must be large enough to contain the attributes value. The data type of the argument pointer must match the data type of the specified attribute, or an error will occur. The max_packet_count variable is not yet defined. The variable will hold the maximum number of packets to be processed in the simulation before it terminates. Variables can be declared in two places. Variables declared in the temporary variables block do not retain their values between invocations of the FSM. Variables declared in the state variables block retain their values from invocation to invocation. The max_packet_count variable value should be retained between invocations and therefore declared in the state variable block.

    19) Click the state variable block button.

    20) Add the max_packet_count variable. The default type, int, is acceptable. When you are finished click OK to close the dialog box.

    /* Get the maximum packet count, */ /* set at simulation run-time. */ op_ima_sim_attr_get (OPC_IMA_INTEGER,"max packet \ count", &max_packet_count);

  • Master thesis MEE 03:24

    Tommy Svensson 68 Alex Popescu

    Figure 64 - State variable block

    This value is set later in the simulation attributes. To be able to set the value at simulation run-time it needs to be defined.

    21) Select Interface Simulation Attributes and enter an attribute into the dialog box table.

    Figure 65 - Simulation Attributes dialog box

    22) To save your changes click on the OK button.

    Specify the actions for the tx_pkt state.

    23) Double-click on the upper half of the tx_pkt state to open the enter executives block.

    24) Enter the code shown below.

    /* A packet has arrived for transmission. Acquire */ /* the packet from the input stream, send the packet*/ /* and update the global submitted packet counter.*/ out_pkt = op_pk_get (IN_STRM); op_pk_send (out_pkt, OUT_STRM); ++subm_pkts; /*Compare the total number of packets submitted with*/ /*the maximum set for this simulation run.If equal*/ /* end the simulation run. */ if (subm_pkts == max_packet_count) { op_sim_end ("Simulation ended when max packet count \ reached.", "", "", ""); }

  • Master thesis MEE 03:24

    Tommy Svensson 69 Alex Popescu

    23) Save your changes to close the text edit pad.

    op_pk_get(instream_index) function returns a pointer to the packet taken from the input stream, instream_index. If the specified input stream does not contain any packets, the value OPC_NIL will be returned by this KP. This situation can be avoided by first calling op_strm_empty() to determine if a stream contains any packets. op_pk_send(packet_pointer, outstream_index ) function takes two arguments. packet_pointer argument specifies a pointer to the packet-of-interest. outstream_index argument specifies the index of an output packet stream. op_sim_end (line0, line1, line2, line3) function takes four arguments. These arguments are message lines. This function terminates the simulation. subm_pkts variable is declared in the header block. It is increased every time a packet is sent. The out_pkt variable is a packet pointer. This variable has not been declared yet. Since the process model acquires packets from the generator stream and immediately transmits them, it is not necessary to retain the packet pointer between process invocations. This variable will be declared in the temporary variable block. Enter the temporary variable block and state variables.

    25) Click the temporary variable block button. 26) Enter the following declarations.

    /* Outgoing packet */ Packet* out_pkt;

    27) Save your changes to close the text edit pad.

    The out_pkt entry in the temporary variable block creates a temporary packet pointer. This is used to extract packets from one stream and insert them into another. The packet pointers existence is only temporary. Since the packet is sent directly there is no need for the pointer to be retained between process invocations. The model is now complete, except for the model interface attribute. To control the attributes visible at the node level, edit the Process Interfaces. You can set initial attribute values or hide attributes.

    28) Select Interface Process Interfaces. 29) Change the Initial Value for the begsim intrpt attribute to enabled.

  • Master thesis MEE 03:24

    Tommy Svensson 70 Alex Popescu

    30) Verify that the Initial Value for each of the following attributes is set to disabled.

    endsim intrpt failure intrpts intrpt interval recovery intrpts super priority

    31) Verify that the Initial value of the priority attribute is 0.

    32) Change the status attribute to hidden for all attributes

    Figure 66 - Process Interfaces attributes

    33) Click OK to close the dialog box. All process models must be compiled before they can be used in a simulation. Compiling a model makes its object code available to a processor modules process model attribute.

    34) Compile the model by clicking on the compile process model action

    button. 35) Save the model as _aloha_tx. 36) Close the Process Model Editor when the compilation of the process model has

    finished.

    Creating the Aloha Transmitter Node Model

    37) Select File New then Node Model from the pull down menu. To accept click OK.

    38) Using the create processor action button create two processor modules.

    39) Create one bus transmitter by using the bus transmitter action button .

  • Master thesis MEE 03:24

    Tommy Svensson 71 Alex Popescu

    40) Connect the modules with packet streams using the packet stream action button.

    Figure 67 - Node model overview

    41) Right click on the first processor module and select Edit attribites.

    42) Set the name to gen and process model to simple_source.

    The value for the generators interarrival time needs to be promoted to make it possible to assign different values at simulation time.

    43) Click on Packet Interarrival Time in the left column to highlight the Attribute name, then right-click and select Promote Attribute to Higher Level from the pop-up menu.

    44) Click OK.

    Figure 68 - Generator process attributes

    45) Right click on the second processor module and select Edit attributes

    46) Set the name to tx_proc and process model to _aloha_tx.

    47) Click OK.

    48) Change the bus transmitters name to bus_tx.

  • Master thesis MEE 03:24

    Tommy Svensson 72 Alex Popescu

    Figure 69 - Alhoa transmitter node model

    Double check the module connectivity to make sure all objects in the model has been connected in the correct order.

    49) Right click on the tx_proc module and choose Show Connectivity from the Object pop-up menu. The objects should be connected as shown in figure 70.

    Figure 70 Connectivity

    The node interfaces needs to be defined.

    50) Select Interfaces Node interfaces.

    51) In the Node Types table, change the Supported value to no for the mobile and satellite types.

    52) Change the Status of all the attributes to hidden, except for the one with

    promoted status, gen.Packet Interarrival Time.

    53) Click OK to save the changes.

    54) Save the node model as _cct_tx. Aloha node model is completed.

    55) Close the editor.

  • Master thesis MEE 03:24

    Tommy Svensson 73 Alex Popescu

    Creating the Generic Receiver Node Process Model The generic receiver node process model is responsible for handling received packets for statistics gathering purposes. The goal is to count packets and record statistics. It can be used to monitor network performance whether the packets are transmitted in accordance with the Aloha or the CSMA channel access methods. To process received packets for statistics collection, the cct_rx process needs one unforced state where it waits to receive collision-free packets. Collisions are detected later in the link model. The process records the channel throughput and channel traffic values for analysis at the end of the simulation. It also handles the statistics gathering variables, which should be initiated at the simulation start.

    56) Select File New then choose process model.

    57) Click on the Create State button and place two states in the workspace.

    58) Right click on the initial state and choose Edit attributes.

    59) Change the name to init and the status to forced. Click OK.

    60) Right click on the second state and choose Edit attributes.

    61) Change the name to idle and leave the status as unforced. Click OK.

    62) Draw the transitions as shown below.

    Figure 71 - Transitions overview

  • Master thesis MEE 03:24

    Tommy Svensson 74 Alex Popescu

    Enter the code for the header block.

    63) Click the header block action button. 64) Type in the definitions shown below.

    65) Save the header block definitions. IN_STRM is the input stream definition. The macro PKT_RCVD is used to detect received packets. The END_SIM macro determines if the interrupt received by the process is associated with an end-of simulation interrupt delivered by the Simulation Kernel. The global variable subm_pkts is established so that all transmitting nodes can contribute their individual transmission attempts to this accumulator. Declaring a variable in a process model header block causes it to behave as a global variable within the executable simulation. Define the following state variable:

    66) Click the state variable action button. 67) Set the name to rcvd_pkts.

    68) Set the type to int.

    69) Click OK.

    The rcvd_pkts variable is used to keep track of the number of valid received packets. It needs to be initiated at simulation start.

    70) Double-click on the top of the init state to open the enter executives block, and enter the following code:

    71) Save the changes to close the dialog. Two functions are needed. One that receives packets and one to write statistics to a scalar file.

    /* Input stream from bus receive