NetSim User Manual
NetSim User Manual
NetSim User Manual
Contents
Ver 11.1 1
3.1 What is an Experiment and what is a workspace in NetSim? .................................. 54
3.2 How does a user create and save an experiment in workspace? ............................ 55
3.3 Should each user have a workspace? .................................................................... 57
3.4 How does a user export an experiment?................................................................. 57
3.5 How does a user delete an Experiment in a workspace? ........................................ 58
3.6 How does a user create a new workspace?............................................................ 58
3.7 How does a user switch between workspaces? ...................................................... 61
3.8 How does a user export a workspace? ................................................................... 62
3.9 How does a user import a workspace? ................................................................... 65
3.10 How does a user import an experiment?............................................................... 67
3.11 How does a user delete a workspace? ................................................................. 68
3.12 How does a user open and modify source codes? ................................................ 69
3.13 Can I use NetSim's default code for my experiments? .......................................... 70
Ver 11.1 2
4.8 Cognitive Radio ...................................................................................................... 79
Cognitive Radio Examples ....................................................................... 79
Cognitive Radio Library Documentation ................................................... 79
4.9 LTE......................................................................................................................... 80
LTE Examples.......................................................................................... 80
LTE Library Documentation...................................................................... 80
4.10 VANETs................................................................................................................ 81
VANET Examples .................................................................................... 81
VANET Library Documentation ................................................................ 81
4.11 Military Radio (TDMA/DTDMA) ............................................................................. 82
Military Radio Examples ........................................................................... 82
Military Radio (TDMA/DTDMA) Library Documentation ............................ 82
Ver 11.1 3
Analysing Packet Trace using Pivot Tables ............................................ 127
7.6 Event Trace (only in Standard/Pro Version) .......................................................... 141
NetSim Network Stack and Discrete Event Simulation working .............. 141
Calculation of Delay, Jitter and Application throughput from event trace 145
7.7 Packet Capture & analysis using Wireshark ......................................................... 156
Enabling Wireshark Capture in a node for packet capture ...................... 156
Viewing captured packets ...................................................................... 157
Filtering captured packets ...................................................................... 158
Analyzing packets in Wireshark.............................................................. 158
Window Scaling ..................................................................................... 160
Ver 11.1 4
Plot a histogram in MATLAB per a Rician distribution (using .m file) ...... 217
9.3 Interfacing tail with NetSim ................................................................................... 221
9.4 Adding Custom Performance Metrics ................................................................... 226
9.5 Adding Custom Plots ............................................................................................ 229
9.6 Environment Variables in NetSim ......................................................................... 232
Ver 11.1 5
15 NetSim FAQ/Knowledgebase................................................................................... 244
Ver 11.1 6
1 NetSim – Introduction
Building the model – Create a network with devices, links, applications etc
Running the simulation - Run the discrete event simulation (DES) and log different
performance metrics
Visualizing the simulation - Use the packet animator to view the flow of packets
Analyzing the results - Examine output performance metrics such as throughput,
delay, loss etc. at multiple levels - network, link, queue, application etc.
Developing your own protocol / algorithm - Extend existing algorithms by
modifying the simulator’s source C code
NetSim comes in three versions- Academic, Standard and Pro. The academic version is
used for lab experimentation and teaching. The standard version is used for R & D at
educations institutions while NetSim Pro version addresses the needs of defense and industry.
The standard and pro versions are available as components in NetSim v11 from which users
can choose and assemble. The academic version is available as a single product and includes
all the technologies shown below. A comparison of the features in the three versions are
tabulated below:
Ver 11.1 7
Features Academic Standard Pro
Technology Coverage
Internetworks Y Y Y
Legacy & CellularNetworks Y Y Y
Mobile Adhoc networks Y Y Y
Software Defined Networks Y Y Y
Wireless Sensor Networks Y Y Y
Internet of Things Y Y Y
Cognitive Radio Networks Y Y Y
LTE/LTE-A Networks Y Y Y
VANET N Y Y
Performance Reporting Y Y Y
Performance metrics available for Network and
Sub-network
Packet Animator Y Y Y
Used to animate the packet flow in network
Packet Trace Y Y Y
Available in tab ordered .txt format for easy post
processing
Event Trace N Y Y
Available in tab ordered .txt format for easy post
processing
Protocol Library Source Codes with N Y Y
Documentation
Protocol C source codes and appropriate header
files with extensive documentation
External Interfacing N
Interfacing with SUMO
MATLAB N Y Y
Wireshark Y
Integrated debugging N Y Y
Users can write their own code, link their code to
NetSim and debug using Visual Studio
Plots Y Y Y
Allows users to plot the value of a parameter over
simulation time
Simulation Scale 100 Nodes 500 Nodes ~ 10,000
Nodes
Ver 11.1 8
1.3 Components (Technology Libraries) in Pro and Std versions
In NetSim v11, users can choose and assemble components (Technology libraries) for Pro
and Standard version. The components are as follows:
International
Component No Networks / Protocols
Standards
Internetworks
Ethernet - Fast & Gigabit, ARP, Routing - RIP, OSPF,
WLAN - 802.11 a / b / g /p / n / ac & e,
Propagation models - HATA Urban / Suburban,
COST 231 HATA urban / Suburban, Indoor Home /
Office / Factory, Friis Free Space, Log Distance.
Shadowing - Constant, Lognormal. Fading - Rayleigh,
Nakagami
IEEE 802.3
IPv4, Firewalls, Queuing - Round Robin, FIFO,
Priority, WFQ,
IEEE 802.11
TCP, - Old Tahoe, Tahoe, Reno, New Reno, BIC,
Component 1 a/b/g/n/ac/p/e
CUBIC, Window Scaling, SACK
(Base. Required
UDP
for all
Common Modules
components)
Traffic Generator: Voice, Video, FTP, Database,
HTTP, Email, P2P, Custom,
RFCs 2453, 2328,
Virtual Network Stack,
826, 793, 2001 and
Simulation Kernel,
768
Command Line Interface
Command Line Interpreter
Metrics Engine with packet and event trace
Plot Generator
Packet Animator,
Packet Encryption
External Interfaces: MATLAB, Wireshark
Legacy & Cellular Networks
3GPP, ETSI, IMT-MC,
Aloha – (Pure & Slotted)
Component 2 IS-95 A/B, IxRTT, 1x-
GSM
EV-Do, 3xRTT
CDMA
Advanced Routing
Multicast Routing - IGMP, PIM, Access Control Lists, IETF RFC’s 1771 &
Component 3
Detailed Layer 3 switch mode, Virtual LAN (VLAN), 3121
Public IP, Network Address Translation (NAT)
Mobile Adhoc Networks IETF RFC 4728, 3561,
Component 4 MANET - DSR, AODV, OLSR, ZRP 3626
Multiple MANETs IEEE 802.16d
Ver 11.1 9
Military Radio (Only in PRO Version)
Military Radio TDMA Link 16, Dynamic TDMA, Frequencies – HF,
Add on (Pro VHF, UHF Bands, ----
version only) Frequency Hopping
Ver 11.1 10
2 Getting Started in NetSim
License Server (for running HostID/ Dongle locked floating licenses, not
applicable for node locked licenses):
Any one system will have to be made as the license server, and it is to this PC that the license
is locked, either via its MAC ID or via a dongle. The dongle is a USB device which controls the
licensing. The system (hardware / OS) requirements is same as that applicable for NetSim
clients. USB Port is required for connecting and running the dongle. Client systems should be
able to communicate with license server through the network.
Ver 11.1 11
Based on the NetSim version under installation the version type being displayed in the
following windows will change. For example, you will see NetSim Standard for a standard
version install. Click on Yes button to install the software.
Setup prepares the installation wizard and software installation begins with a Welcome
Screen.
Ver 11.1 12
Click on the Next button. In the next screen, License agreement will be displayed.
Read the agreement carefully, scroll down to read the complete license agreement. Click “I
Agree” button else quit the setup by clicking Cancel button.
If you agree with the license agreement, you will be prompted to select the components to be
installed. The list of components is available for selection and assembly only in the Standard
and Pro version. Other versions of NetSim are available as a single package.
Ver 11.1 13
Note: Select all the supporting applications for complete installation of the software. In the
next screen, you will be requested to enter the installation path. Select the path in which the
software needs to be installed and click on Next button.
On the next screen, you will be requested to enter the Start menu folder name.
Click on the Install button to start the installation. The installation process begins.
Ver 11.1 14
After the installation of required NetSim files, the installation of third party tools begin.
For NetSim Standard Version and Pro Version, Wireshark installation will start by default (if
not deselected during 3rd party software selection). Click on Next to start Wireshark
installation. In the following window, click on I Agree.
Ver 11.1 15
Select all the components and click on Next.
Ver 11.1 16
Specify the destination and click on Next.
Ver 11.1 17
Select Install USBPcap and click on Install. After the installation of the software, you will be
requested to click Next and then Finish to complete the installation process.
Select I agree and click on Install to continue installation of Microsoft Visual C++ 2015. Once
installation is completed, a message box will appear and then click on close.
Ver 11.1 18
To start Python software installation, select the checkbox of "Add python 3.7 to PATH", then
select Install Now and the Installation begins.
Ver 11.1 19
Select the Python directory and Click on Next.
Ver 11.1 20
Select “Run NetSim” and then click on the Finish button.This completes the installation of
NetSim Software.
Note: During the installation of NetSim Academic version the supporting software installed is WinPcap.
Silent installation
For example, let us take the NetSim Standard 64 bit setup. Right click on NetSim Standard
64bit setup-> go to properties and copy the location
Ver 11.1 21
Open command prompt and paste the copied location as shown below:->cd <setup
location>
NetSim_Standard_11_1_11_HW_64bit.exe/S /silent=1
><setup location><space>/S<space>/silent=1
Users can click on “Yes” as shown below to begin installation of NetSim Standard.
This section guides you to install the RLMDongle Driver software from the CD-ROM.
Each prompt displayed during the process tells you what it is about to do and prompts to either
continue or Exit.
Ver 11.1 22
Setup prepares the installation wizard and the software installation begins with a Welcome
Screen.Click on the Next button
Note: Any other program running during the installation of the Dongle will affect the proper
installation of the software.
In the next screen, the License agreement is displayed.Read the license agreement carefully,
scroll down to read the complete license agreement. If the requirement of the license
agreement is accepted select the “I accept” button else quit the setup by clicking Cancel
button.
Ver 11.1 23
Click on the Next button
After the installation of the software, you will be requested to click Finish button to complete
the installation process. Now the RLM driver software is installed successfully.
If the driver has been successfully installed then upon connecting the Dongle in the USB port
red light would glow (Refer picture below). If the driver is not correctly installed this light will
not glow when the dongle is connected to the USB port.
Ver 11.1 24
Running NetSim License Server
Copy the NetSim License Server folder and paste it on Desktop. Check that it has
the license file. If not copy the paste the license file into the License server folder
Double click on NetSim License Server folder from Desktop.
Double click on rlm.exe
For hardware dongle-based users: After the Driver Software installation, connect the
RLM dongle to the system USB port. Double click on My Computer and access the
CD Drive. This CD contents will have the NetSim License server folder.
Note: For running NetSim, rlm.exe must be running in the server (license server) system and
the server system IP address must be entered correctly. Without running rlm.exe, NetSim
won’t run. When you run rlm.exe, the screen will appear as shown below.
Ver 11.1 25
Running NetSim Software
After running rlm.exe, click the NetSim icon in the Desktop.The screen given below will be
obtained. Enter the Server IP address where the rlm.exe is running and click OK.
See the following image for an example of the NetSim Home screen.
Ver 11.1 26
9
1
2
3
7 6 5 8
1. New Simulation: Use this menu to simulate different types of networks in NetSim. You
can simulate the following the types of networks: Internetworks, Legacy Networks,
Mobile Adhoc networks (Single MANET and Multiple MANETs), Cellular Networks,
Wireless Sensor Networks, Internet of Things, Cognitive Radio Networks, LTE/LTE-A
Networks (LTE/LTE-A, LTE femtocell, LTE D2D, LTE Vanet) and VANETs.
2. Open Simulation: Use this menu to load saved configuration files from the current
workspace. You can view, modify or re-run existing simulations. Along with this users
can also export the saved files from the current workspace to their preferred location
on their PC’s.
Ver 11.1 27
This helps the users with all information about the current simulation as well as the
entire network technology.
Similarly on the other side, users can find experiments section which has various
experiments covering all the technologies in NetSim. Users can choose their
experiment by either a double click on it or by a click on the pointer arrow which will
take you the samples. Click on the sample to open the particular experiment in NetSim.
All the settings to carry out a particular experiment are already done. Users can click
on the book icon present in the right hand side of each experiment. This will open the
corresponding pdf file for the experiment which consists of detailed description of that
particular experiment.
4. License Settings: Use this menu to perform the following. Click on License Settings
provides users with three sub-menus related to License information.
License Server Information: Use this menu to view details about the NetSim License
Server that is hosted locally to check the licenses you need to run NetSim.
See the following image for an example of what the NetSim Home screen displays, if
you click the License Server Information menu item.
Ver 11.1 28
You will see the following details on the NetSim Home screen, if you click the License
Server Info menu item: the type of platform on which NetSim is running, the version of
RLM, the Dongle RLM ID, the IP address of the NetSim License Server, and the path
to the license files in the server hosting NetSim License Server.
End User License Agreement: Use this menu to view the end user license
agreement. You will see the following details on NetSim Home screen, if you click the
End User License Agreement menu item: Grant of License and Use of the Services,
License Restrictions, License Duration, Upgrade and Support Service etc.
NetSim Home screen displays libraries for components for which you have
purchased licenses.
Note: You can select or clear libraries and control access to NetSim users, only if you
are using floating licenses.
Ver 11.1 29
See the following image for an example of what the NetSim Home screen
displays, if you click the Configure Installed Components/Libraries menu item.
Select the checkboxes for the component libraries (types of networks) that
NetSim users must be allowed to simulate.
Clear the checkboxes for the component libraries (types of networks) that
NetSim users must not be allowed to simulate.
The Internetwork component is greyed out. You cannot clear the Internetworks
component because Internetworks is a base component that is required for all the
other components to work.
5. Documentation: Use this section to open the following NetSim help documents:
These include the User Manual which consists of complete description about all the
features in NetSim and how it can be used by the end users, the Technology Libraries
which provides users with an access to a detailed description of various Network
Technologies present in NetSim through individual pdf files, and NetSim Source code
help which comes along with Standard and Pro Versions of NetSim, allows users to
gain a better understanding of the underlying code structure for in-depth analysis.
6. Learn: Use this section to learn more about the software which includes the following:
Videos section can be used to view TETCOS videos on the TETCOS channel on
Ver 11.1 30
YouTube. This channel helps users by providing frequent updates on what’s new in
NetSim, topics related to various network technologies covering different versions of
NetSim, and monthly webinars. The Experiments Manual section grants you access
to a well-designed experiments manual covering various networking concepts which
helps users to easily understand different networks and also gain ideas to carry out
their own experimentations in NetSim.
7. Support: Use this section to reach TETCOS helpdesk. Contact Technical Support
link can be used to raise a trouble ticket, you can also write to us via Email to
support@tetcos.com, and Answers/FAQ link grants you access to our Knowledge
Base which contains answers to all your questions most of the time. Users can utilize
the wealth of information present in it, which are further classified into the following:
FAQs, Technologies/Protocols, Modelling/UI/Results, and Writing your own code in
NetSim.
8. Contact Us: Use this section to contact us and know more information about our
product. You can write to us via Email to sales@tetcos.com or contact us via Phone
to our official number +91 76760 54321.
9. Website: Use this link www.tetcos.com to visit our website which consists of vast
information which will assist you during all walks of NetSim.
The Simulation window loads up once user selects the desired network technology from the
New Menu.
Ver 11.1 31
Click on New Simulation and select the desired kind of network to simulate
Save
To save experiment, select File Save, then specify the Experiment Name, Description
(Optional) and click Save. The short cut for the same is Ctrl + S.
Save as
To save a previously saved experiment in a different location without overwriting the existing
copy, Save As option can be used. The short cut for the same is Shift + Ctrl + S
Settings
The settings menu provides user’s access to the simulation environment settings.
Ver 11.1 32
Environment Settings:
The Environment Settings window is used to switch between Grid View and Map View
backgrounds in supported network technologies. For Grid view, users can configure the Grid
environment length in meters whereas for Map view users can configure the latitude and
longitude respectively.
Learn
This menu contains link to NetSim Youtube Videos and NetSim Experiment manual.
Documentation
This menu contains link to NetSim user Manual, Technology Libraries and NetSim Source
code Help.
Ver 11.1 33
Creating a Network scenario
In this example, a network with two subnets is designed. Let us say the subnet 1 consists of
two wired nodes connected via a Switch and the other subnet consists of one wired node. Both
the subnets are connected using a Router. Traffic in the Network flows from a wired node in
subnet 1 to the wired node in subnet 2.
Step 1: Drop the devices. Click on Node icon and select Wired Node
Ver 11.1 34
Click on the environment (the grid) where you want the Wired Node to be placed. In this way,
place two more wired nodes. Similarly, to place a Switch and a Router, click on the respective
device and click on the environment at the desired location.
Note: The (x, y) position of any device on the grid is given by top left corner of the icon and not the center
of the icon.
Ver 11.1 35
For example, select link and the click on Switch followed by router to connect them. In this
manner, continue to link all devices.
Step 1: To configure any device, right click on the device and select properties
User can set values according to their requirement. Modify the properties of any device and
click on Ok. In this example default values are accepted.
Ver 11.1 36
Step 2: To configure the links, right click on any Link and select Properties.
Display settings
In NetSim, users can Turn-On or Turn-Off display information such as IP Address of the
devices, Link speed etc. For doing this click on Display settings as shown below
Ver 11.1 37
Copy/Paste
In NetSim simple copy paste can be used. Using this feature users can copy all the properties
of a device and create a new device with similar properties.
Right click on the device, click on copy on the device that users need to use it to drop similar
device
In this example we have considered a Wired Node for which the Device Name and Device
Icon is modified. Right click on the device and select Copy.
Ver 11.1 38
Right click on the grid environment on the appropriate position that you need to drop the device
click on Paste. A new device with similar properties will be added to the grid at the specific
location as shown below:
Remove in the device options, is used to delete the device from the grid environment. Given
below is an example of removing the device User_Device_4 which was previously pasted.
Modeling Traffic
After the network is configured, user needs to model traffic from Wired Node 2 to Wired Node
3. This is done using the application icon. Click on the Application icon present on the ribbon.
Ver 11.1 39
In screen shot shown below the Application type is set to CBR, source_ID is 2 and
Destination_ID is 3. Click on OK.
Application Configuration:
1. In a wired network with routers and switches OSPF, Spanning tree etc takes times to
converge and hence it is a good practice to set the application start time greater than
OSPF convergence time. In general, the applications can start at 20s for smaller
networks and should be increased as the size of the network grows.
If TCP is enabled TCP may stop after the re-try limit is reached (since the SYN
packets would not reach the destination)
3. For MANET networks the application start time should be a min of 5s, since that
amount of time is required for convergence of OLSR/ZRP
Ver 11.1 40
4. Jumbo Frames are not supported in NetSim Ethernet Protocol
Packet and Event Trace files are useful for detailed simulation analysis. By default, these are
not enabled since it slows down the simulation. To enable logging of Packet Trace / Event
Trace click on the icon in the tool bar as shown below. Set the file name and select the required
attributes to be logged. For more information, please refer sections 7.5 and 7.6 respectively.
Run Simulation
For simulating the network scenario created, click on Run Simulation present in the Ribbon
Ver 11.1 41
NetSim Interactive Simulation
NetSim allows users to interact with the simulation at runtime via a socket or through a file.
User Interactions make simulation more realistic by allowing command execution to
view/modify certain device parameters during runtime.
Working: This section will demonstrate how to perform Interactive simulation for a simple
network scenario.
Click & drop Wired Nodes and Router onto the Simulation Environment and link them as shown
below or otherwise Open the scenario for Interactive Simulation which is available in “<NetSim
Install Dir>\Docs\ Sample_Configuration\Internetworks\Interactive Simulation”
Click on Application icon present in the top ribbon and set the Application type as CBR.
The Source_Id is 1 and Destination_Id is 2.
Click on run simulation option and In the Run time Interaction tab set Interactive
Simulation as True and click on Accept
Ver 11.1 42
Click on run simulation and set Simulation Time as 500 sec. (It is recommended to
specify a longer simulation time to ensure that there is sufficient time for the user to
execute the various commands and see the effect of that before Simulation ends) and
click OK
Simulation (NetSimCore.exe) will start running and will display a message “waiting for
first client to connect” as shown below:
After Simulation window opens, goto Network scenario and right click on Router_3 or
any other node and select NetSim Console option
Ver 11.1 43
Now Client (NetSimCLI.exe) will start running and it will try to establish connection with
NetSimCore.exe. After connection is established the window will look similar like this
shown below:
After this the command line interface can be used to execute the supported commands
PauseAt: To pause the currently running simulation with respect to particular time (Ex: To
Pause simulation at 70.2 sec use command as PauseAt 70.2)
Ver 11.1 44
Reconnect: To reconnect client (NetSimCLI.exe) to simulation (NetSimCore.exe) when we
rerun simulation again
2. Ping Command
The ping command is one of the most often used networking utilities for troubleshooting
network problems
You can use the ping command to test the availability of a networking device (usually
a computer) on a network
When you ping a device you send that device a short message, which it then sends
back (the echo)
If you receive a reply then the device is in Network, if you don’t then the device is faulty,
disconnected, switched off, incorrectly configured
You can use the ping cmd with an IP address or Device name
ICMP_Status should be set as True in all nodes(Wired_Node and Router)
Ver 11.1 45
After simulation open packet trace and filter ICMP_EchoRequest and
ICMP_EchoReply from CONTROL_PACKET_TYPE/APP_NAME column
Open Wireshark and apply filter ICMP. we can see the ping request and reply packets
in Wireshark
3. Route Commands
1. route print
2. route delete
3. route add
In order to view the entire contents of the IP routing table, use following commands route
print
route print
Ver 11.1 46
You will see the routing table entries with network destinations and the gateways to
which packets are forwarded when they are headed to that destination. Unless you’ve
already added static routes to the table, everything you see here will be dynamically
generated
In order to delete route in the IP routing table you will type a command using the
following syntax
So, to delete the route with destination network 11.5.0.0, all we’d have to do is type this
command
To check whether route has been deleted or not check again using route print command
To add a static route to the table, you will type a command using the following syntax
So, for example, if you wanted to add a route specifying that all traffic bound for the
11.5.1.2 subnet went to a gateway at 11.5.1.1
Ver 11.1 47
If you were to use the route print command to look at the table now, you would see your
new static route
Note: Entry added in IP table by routing protocol continuously gets updated. If a user tries to remove a
route via route delete command, there is always a chance that routing protocol will re-enter this entry again.
Users can use ACL / Static route to override the routing protocol entry if required.
3. ACL Configuration:
Routers provide basic traffic filtering capabilities, such as blocking Internet traffic, with access
control lists (ACLs). An ACL is a sequential list of permit or deny statements that apply to
addresses or upper-layer protocols. These lists tell the router what types of packets to: permit
or deny. When using an access-list to filter traffic, a permit statement is used to “allow” traffic,
while a deny statement is used to “block” traffic.
Ver 11.1 48
[PERMIT, DENY] [INBOUND, OUTBOUND, BOTH] PROTO SRC DEST SPORT DPORT IFID
To create a new rule in the ACL use command as shown below to block UDP packet
in Interface_2 and Interface_3 of the Router_3
Disable TCP in all nodes(Wired Node and Router)
Click on run simulation option and In the Run time Interaction tab set Interactive
Simulation as True and click on Accept
Set the Simulation Time as 500 sec or more. Click Ok
Right click on Router_3 and select NetSim Console. Use the command as follows:
NetSim>acl enable
ACL is enable
NetSim>aclconfig
ROUTER_3/ACLCONFIG>acl print
Usage: [PERMIT, DENY] [INBOUND, OUTBOUND, BOTH] PROTO SRC DEST
SPORT DPORT IFID
ROUTER_3/ACLCONFIG>DENY BOTH UDP ANY ANY 0 0 2
OK!
ROUTER_3/ACLCONFIG>DENY BOTH UDP ANY ANY 0 0 3
OK!
ROUTER_3/ACLCONFIG>print
DENY BOTH UDP ANY/0 ANY/0 0 0 2
ROUTER_3/ACLCONFIG>exit
NetSim>acl disable
ACL is disable
NetSim>
Ver 11.1 49
ACL Results:
The impact of ACL rule applied over the simulation traffic can be observed in the
IP_Metrics_Table in the simulation results window, In Router_3 number of packets blocked by
firewall has been shown below
Note: Results will vary based on time of ACL command are executed
Check Packet animation window whether packets has been blocked in Router_3 or not
after entering ACL command to deny UDP traffic
Before applying ACL rule there is packet flow from Wired_Node_1 to Wired_Node_2
Ver 11.1 50
After applying ACL rule Packet flows up to Router_3 only
The impact of ACL rule applied over the simulation traffic can be observed in the Application
throughput plot. Throughput graph will show a drop after ACL is set. If ACL is disabled after a
while, application packets will start flowing across the router. The Application throughput plot
will show a drop and increase(Moving througput graph) in throughput after setting ACL and
disabling ACL respectively.
Example: ACL rule applied at around 50sec user can see the drop in throughput in the graph,
since router blocks UDP packets in the plot. Once ACL has been disabled at around 240sec
router permits packets and hence throughput can be observed in the plot shown below
Ver 11.1 51
2.5 Saving & Opening experiments and Printing results
Opening Saved Experiments: Open Network – All Networks
Saving an Experiment
During Simulation: Users can save by using the short cut CTRL + S
After Simulation: From Network Window: Click on File Save button on the top left. Next,
specify the Experiment Name, Description (Optional) and click on Save.
Upon saving a number of files would get saved inside the folder, including
Ver 11.1 52
2.6 NetSim Keyboard Shortcuts
NetSim keyboard shortcuts can be used for frequently performed tasks. The keyboard
shortcuts that are currently supported are listed in the table below:
Keys Function
Home Screen
Ver 11.1 53
3 Workspaces and Experiments
When you design & simulate a network in NetSim it is saved as an experiment. This
experiment is saved within a Workspace. In a logical sense, a workspace contains all
the source code files, executable files, icons, data files etc.
In general, users need not change the workspace and can use the default workspace.
1. The user wants to modify the underlying source code of NetSim as is typically
in research applications. The modified code will be saved in that workspace.
2. A user chooses to save and organize a large number of experiments. These
can be saved under different workspaces provided by that user.
3. The same PC/NetSim build is shared between multiple users
The default workspace of NetSim will have the Master Source code and the Master
Binaries (Compiled files)
A default workspace is created under current user directory (Ex: C:\Users\PC5) path if
when NetSim is run for the first time after installation. This default workspace contains
the folders
Ver 11.1 54
3.2 How does a user create and save an experiment in workspace?
To create an experiment, select New Simulation-> <Any Network> in the NetSim Home
Screen.
Create a network and save the experiment by clicking on File->Save button on the top
left.
Ver 11.1 55
A save popup window appears which contains Experiment Name, Folder Name,
Workspace path and Description.
Specify the Experiment Name and Description (Optional) and then click on Save. The
workspace path is non-editable. Hence all the experiments will be saved in the default
workspace path. After specifying the Experiment Name click on Save.
In our example we saved with the name MANET and this experiment and it can be
found in the default workspace path as shown below:
Users can also see the saved experiments in Open Simulation menu shown below:
Ver 11.1 56
Note: “Save As” option is also available to save the current experiment with a different
name.
There is no strict association between users and workspaces. A single user can have
multiple workspaces (and in turn experiments in each workspace), or multiple users
can operate in one workspace
If you click on Export, an Export Experiment pop-up window appears where you can
input the experiment name and the Export path.
Ver 11.1 57
The exported experiments would be saved with *.netsim_exp extension.
Ver 11.1 58
Then select More Options
Ver 11.1 59
And select New
A New Workspace pop-up window appears where you can input the Workspace Name,
Description and Workspace Path (where you want to create new workspace).
Ver 11.1 60
3.7 How does a user switch between workspaces?
Users can also switch from one workspace to another workspace. For doing this,
Select Open Simulation->Workspace Options->More Options and click on the
workspace you want to switch to.
Ver 11.1 61
3.8 How does a user export a workspace?
Users can export workspaces by selecting Open Simulation->Workspace Options-
>More Options. Then select Export as shown below:
Ver 11.1 62
The following window is displayed
Binaries, Source Code (available only for Standard and Pro) and Icons are added by
default as shown above. Users can add all experiments present in the current
workspace by clicking on the All Experiments check box and then click on Export as
shown below.
Ver 11.1 63
It displays a window shown below where users need to give the path to which the
workspace has to be exported and then click on OK.
Users can also have options to export individual experiments by right clicking on the
experiment and select Add to add the experiment to the export list as shown below
The added experiments will be available in the export list shown below
Ver 11.1 64
After adding the experiments click on Export and follow the same procedure as
explained above
Ver 11.1 65
It displays a window where users need to give the path of the workspace folder and
click on OK as shown below
The Imported workspace will be set as the current workspace. To see the imported
workspace, click on Open Simulation->Workspace Options->More Options as shown
below
Ver 11.1 66
3.10 How does a user import an experiment?
Users can also have option to import experiments. For this click on Open Simulation
and then select Import Experiment as shown below:
Ver 11.1 67
The following window is displayed where users need to give the path from which the
experiment has to be imported and then click on OK
The imported experiment will be available in the current workspace. To see the
imported experiment click on Open Simulation as shown below:
Ver 11.1 68
Note: Deleting current workspace is not allowed. Deleting a workspace will delete all
saved experiments and code modifications done in that workspace.
Ver 11.1 69
This opens the source codes in MS Visual Studio.
Users can then modify the protocol codes and build the solution. Then users can create
a network in NetSim or open the saved experiment which involves the protocol that
has been modified and click on run simulation. This simulation will run per the modified
code.
Note: The changes in the source codes applies to the current workspace only
Yes, each workspace will have a Reset option which would set
Ver 11.1 70
4 Simulating different networks in NetSim
When you install NetSim, you get access to inbuilt examples to help you understand how the
different types of networks work. For information on how to use the NetSim UI to simulate the
Examples and create your own simulations, see NetSim User Interface.
The following table lists what versions of NetSim you must use to simulate the networks.
VANET Available only with NetSim Standard and NetSim Pro versions
4.1 Internetworks
An Internetwork is a collection of two or more computer networks (typically Local Area
Networks or LANs) which are interconnected to form a bigger network.
Ver 11.1 71
Internetworks library in NetSim covers Ethernet, Address Resolution Protocol (ARP), Wireless
LAN – 802.11 a / b / g / n / ac, Internet Protocol (IP), Transmission Control Protocol (TCP),
Virtual LAN (VLAN), User Datagram Protocol (UDP), and routing protocols such as Routing
Information Protocol (RIP), Open Shortest Path First (OSPF), Internet Group Management
Protocol (IGMP), and Protocol Independent Multicast (PIM).
Internetworks Examples
Internetwork Documentation
To view help documentation users can either click on “Technology Libraries” under
documentation in the home screen or they can click the ‘Book’ link located next to
Internetworks in examples. The help documentation explains the following:
Simulation GUI
Model Features
Featured Examples
Reference Documents
Latest FAQ available online
Ver 11.1 72
4.2 Legacy Networks
Legacy networks cover older generation protocols which are rarely used today and not part of
the TCP/IP protocol suite. With the advent of TCP/IP as a common networking platform in the
mid-1970s, most legacy networks are no longer used.
NetSim Legacy Network librarary cover Pure Aloha and Slotted Aloha.
ALOHA is a protocol that was developed at the University of Hawaii and used for satellite
communication systems in the Pacific. ALOHA protocol was designed to send and receive
messages between multiple stations, on a shared medium. Slotted ALOHA is improvised
version of pure ALOHA designed to reduce the chances of collisions when sending data
between the sender and the receiver.
To simulate Legacy Networks, click on New Simulation and then under Legacy networks click
on either Pure Aloha or Slotted Aloha
Ver 11.1 73
4.3 Cellular Networks
A cellular network (also known as a mobile network) is a communication network where the
last link is wireless. The network is distributed over land areas called cells. Every cell is served
by at least one fixed-location transceiver known as a base station. These cells together provide
radio coverage over larger geographical areas. User equipments such as mobile phones, can
communicate even if the user is moving across different cells.
NetSim cellular networks library covers Global System for Mobile communication (GSM) and
Code-Division Multiple Access (CDMA).
To simulate Cellular Networks, click on New Simulation and then under Cellular networks click
on either GSM or CDMA.
Ver 11.1 74
4.4 MANETs
Mobile Ad-hoc Network (MANET) is an ad hoc network that can change locations and
configure itself on the fly. Because MANETS are mobile, they use wireless connections to
connect to various networks.
To simulate MANET, click on New Simulation and then under Mobile Adhoc networks click on
either Single MANETs or Multiple MANETs
MANET Examples
MANET Documentation
To view help documentation either click on “Technology Libraries” under documentation in the
home screen or click the ‘Book’ link located next MANET Networks in examples. The help
documentation explains the following:
Simulation GUI
Model Features
Featured Examples
Reference Documents
Latest FAQ available online
Ver 11.1 75
4.5 Wireless Sensor Networks (WSN)
Wireless Sensor Network (WSN) is a group of spatially dispersed sensors that monitor and
collect the physical conditions of the environment and transmit the data they collect to a central
location. WSNs measure environmental conditions such as temperature, sound, pollution
levels, humidity, wind, and so on.
WSN in NetSim is part of NetSim’s IOT library and covers 802.15.4 MAC, PHY with MANET
routing protcols.
To simulate WSN, click on New Simulation and then Wireless Sensor Networks.
Ver 11.1 76
4.6 Internet of Things
Internet of things (IoT) is a network of object such as vehicles, people, home appliances that
contain electronics, software, actuators that are accessible from the public Internet. The
objects are embedded with suitable technology and use IP addresses to interact and exchange
data without manual assistance or intervention. The objects can also be remotely monitored
and controlled.
In NetSim, IOT is modeled as a WSN that connects to the internet via a 6LowPAN Gateway.
WSN for IoT uses the following protocols: AODV with IPv6 addressing at the L3 layer and
802.15.4 at the MAC & PHY layers. WSN sends data to the LowPAN Gateway which uses a
Zigbee (802.15.4) interface and a WAN Interface. The Zigbee interface connects wirelessly to
the WSN and the WAN interface connects to the Internet. Additionally users can also simulate
and analyze energy model for IoT.
Ver 11.1 77
4.7 Software Defined Networks (SDN)
Software-defined networking (SDN) is an architecture that makes networks agile and flexible.
SDN decouples the network control and forwarding functions. SDN allows you to program your
network control and abstracts the physical infrastructure for applications and network services.
This approach enables enterprises and service providers to respond quickly to the changing
business requirements.
Unlike other technologies, and due to the way SDN works it is not available as a menu item
under New Simulation. SDN can be configured when running Internworks, MANET, IOT, WSN,
Cognitive Radio, LTE or VANETs
Ver 11.1 78
4.8 Cognitive Radio
Cognitive Radio (CR) is an adaptive, intelligent radio and network technology that
automatically detects available channels in a wireless spectrum and changes transmission
parameters to enable higher levels of communication. Cognitive Radio can be programmed
and configured dynamically to use the best wireless channels in its vicinity to avoid user
interference and congestion.
NetSim Cognitive Radio module is based on the IEEE 802.22 standard. Additionally, you can
connect a Cognitive Radio with Internetwork devices and run all the protocols supported in
Internetworks.
To simulate Cognitive Radio, click on New Simulation and then Cognitive Radio Networks
Ver 11.1 79
4.9 LTE
Long Term Evolution (LTE) is a standard for 4G wireless broadband technology that offers
increased network capacity and speed to mobile device users. LTE offers higher peak data
transfer rates -- up to 100 Mbps downstream and 30 Mbps upstream.
NetSim LTE Library support LTE/LTE-Advanced Networks along with LTE FemtoCell, LTE
D2D and LTE VANETs (which requires VANET library)
Additionally, you can connect an LTE Network with Internetwork devices and run all the
protocols supported in Internetworks.
To simulate LTE/LTE-A networks, click on New Simulation and then a suitable option under
Long Term Evolution Networks.
LTE Examples
Ver 11.1 80
4.10 VANETs
Vehicular Ad-Hoc Network (VANET) is a sub form of a Mobile Ad-Hoc Network or MANET that
allows vehicle-to-vehicle and vehicle-to-roadside communications to ensure safe
transportation.
VANET Examples
Ver 11.1 81
4.11 Military Radio (TDMA/DTDMA)
Military communications or military signals involve all aspects of communications to convey
information in armed forces. Military Communications include text, audio, facsimile, tactical
ground-based communications, terrestrial microwave, tropospheric scatter, naval, satellite
communications systems and equipment, surveillance and signal analysis, encryption and
security and direction-finding and jamming.
NetSim Military Radio module uses TDMA/DTDMA in MAC/PHY along with MANET Routing
in Layer 3.
To simulate Military Radios click on New Simulation, then click on MANET (Either Single or
Multiple) and select TDMA/DTDMA in MAC/PHY layer of the devices.
Ver 11.1 82
5 Traffic generator (Application models)
CBR
Custom
Database
FTP
Email
HTTP
PEER_TO_PEER
Video
Voice
Sensor App
Erlang Call
BSM
Emulation (Only if Emulator Add-on is present)
To set up the application click on the application icon from the tool bar as shown below.
Ver 11.1 83
This properties window allows you to model the application traffic. You can add (or) delete one
or more applications.
Application Type: It specifies the type of application such as CBR, Custom, Peer to Peer,
COAP, Email, HTTP, FTP, Voice, Video, Database, Erlang Call, Emulation, BSM and
Emulation.
Application ID: This property represents the unique identification number of the application.
Source Count: This property represents number of sources for the application. Voice, Video,
FTP, Database and Custom applications have only one source.
Source ID: This property represents the unique identification number of the source.
Destination Count: This property represents number of destinations for the application.
Voice, Video, FTP, Database and Custom applications have only one destination.
Destination ID: This property represents the unique identification numbers of the destination.
And to model, Broadcast applications users can select ‘0’ as the Destination ID.
Start time: This property represents the start time of the application in seconds.
End time: This property represents the end time of the application in seconds.
Note: Suppose Start time is 1 and end time is 10 then application starts generating traffic at 1 st second and
ends at 10th second.
Random Startup: If random start up is set true, application will start at +1s. Having a random
start-up time provides more realism to the model since all applications need not necessarily
start at time = 0 in the real world.
QoS: NetSim provides QoS differentiation for the different types of applications through four
defined scheduling service types, also called QoS classes.
Ver 11.1 84
QoS Class Description Priority
Priority: In a complex network, packets may reach a router from many directions. Priority
scheduling algorithm will allow the router to fix priority level for different sources from different
directions. Higher priority packets are processed first and sent out.
Application
Properties Units Description
Type
Packet size (Constant
distribution) – It is the size bytes
CBR – of the packet Packets of constant size are
Constant bit Inter Arrival Time generated at constant inter arrival
Rate (Constant distribution) – It times.
µs
is the gap between two
successive packets
Packet size (Constant, It is User defined application that
Custom Exponential distribution) – bytes can be configured based on user
It is the size of the packet requirements
Ver 11.1 85
Inter Arrival Time
(Constant, Exponential
distribution) – It is the time µs
gap between two
successive packets
File size distribution
(Constant, Exponential - Peer-to-peer network does not have
distribution) the notion of clients or servers but
Value – Size of the file bytes only equal peer nodes that
Peer to Peer Piece size - Each file is simultaneously functioning as both
divided into equal sized "clients" and "servers" to the other
pieces. This property bytes nodes on the network.
represents the size of Ex – Torrent, Limewire etc.
each piece
Email send/receive –
Represents the rate at
-
which emails are
sent/receive
Allows users to send/receive email
Duration (Constant,
application
Email Exponential distribution) -
Seconds Ex – Outlook, Apple mail, Gmail
Time between two
etc.
successive emails
Email size(Constant,
Exponential distribution) – Bytes
Size of an email
Inter Arrival Time HTTP is a protocol that utilizes TCP
(Constant, Exponential to transfer its information between
distribution) – It is the time seconds computers (usually Web servers
gap between two and clients). Hence in NetSim, it is
successive HTTP requests imperative that TCP is enabled in
Page size (Constant, the Source Node.
HTTP – Exponential distribution) – bytes Ex - In the URL
Hyper Text It is the size of each page http://www.nowhere123.com/docs
Transfer Page count – Represents /index.html, the communication
Protocol the number of pages protocol is HTTP; the hostname
is www.nowhere123.com. The port
number was not specified in the URL,
-
and takes on the default number,
which is TCP port 80 for HTTP. The
path and file name for the resource to
be located is "/docs/index.html".
Inter Arrival Time
(Constant, Exponential
distribution) – It is the time It is a specialized web transfer
seconds
COAP – b//w two successive protocol for use with constrained
Constrained COAP requests nodes and constrained (e.g., low-
Application power, lossy) networks and
Protocol Page size (Constant, designed for M2M applications
Exponential distribution) –
bytes
It is the size of each page
Ver 11.1 86
Response time – It is the
time taken by a device to ms
generate response
Multicast response –
Represents the server
-
responds to multicast
response or not
NSTART – Limit the
number of simultaneous
outstanding interactions -
that a client maintains to a
given server
DEFAULT_LEISURE –
This setting is only
relevant in multicast
-
scenarios, outside the
scope of the EST-coaps
draft
PROBING_RATE: A
parameter which specifies
the rate of re-sending -
Non-confirmable
messages.
Ack required – It
represents whether the
ack for the -
request/response to be
sent or not
File size (Constant, It is a standard network
Exponential distribution) – protocol used for the transfer
It is the size of the file bytes of files between a client and server
FTP – File
Note: Devices must have TCP
Transfer
enabled in Transport layer for
Protocol File Inter Arrival Time – It implementing FTP application
is the gap between two seconds successfully.
successful files Ex – Filezilla
Transaction size
(Constant, Exponential
distribution) - It represents bytes
A database application is a
the size of each
computer program whose primary
transaction
purpose is entering and retrieving
Database Transaction Inter Arrival
information from a
Time (Constant,
computerized database
Exponential distribution) –
µs Ex – MS Excel, MySQL etc.
It is the time gap between
two successful
transactions
Packet size (Constant,
It allows users to configure voice
Exponential) – It is the bytes
application between client and
size of the packet
Voice server
Packet Inter Arrival Time
Note – Distribution is constant only
(Constant, Exponential µs
for all codec types except custom
distribution) - It is the gap
Ver 11.1 87
between two successful Ex – Skype, Team Viewer, Google
packets Voice etc.
Service type – CBR, VBR -
Suppression models
available for VBR –
-
Deterministic, Markov
chain
Success ratio - Sets the
ratio of the packets that
%
are not silenced during
VBR calls
Model Type - Continuous
Normal VB, Continuous It allows users to configure video
State Autoregressive application between client and
Video Markov, Quantized State - server
Continuous Time Markov, Ex – Skype
Simple IPB Composite
Model
Packet size (Constant,
Exponential distribution) – bytes
It is the size of the packet
Packet Inter Arrival Time
(Constant, Exponential
distribution) - It is the gap µs
between two successful
packets
Call duration (Constant,
Exponential distribution) –
seconds The erlang is a unit of traffic density
It is the duration of each
in a telecommunications system.
call
One erlang is the equivalent of one
Call Inter Arrival Time
Erlang Call call
(Constant, Exponential
distribution) - It is the gap seconds
Note – Distribution is constant only
between two successful
for all codec types except custom
calls
Service type – VBR, CBR -
Suppression model
available for VBR –
-
Deterministic, Markov
chain
Success ratio - Sets the
ratio of the packets that
%
are not silenced during
VBR calls
Packet size (Constant
distribution) – It is the size bytes
of the packet Used to create application between
Sensor App Packet Inter Arrival Time two sensors
(Constant distribution) - It Ex – Smart home, Smart water etc.
µs
is the gap between two
successful packets
Ver 11.1 88
Packet size (Constant, The BSM Application class sends
Exponential distribution) – and receives the IEEE 1609 WAVE
It is the size of the packet (Wireless Access in Vehicular
bytes
Environments) Basic Safety
BSM – Basic Messages (BSMs). The BSM is a
safety 20-byte packet that is generally
message Packet Inter Arrival Time broadcast from every vehicle at a
(Constant, Exponential nominal rate of 10 Hz.
distribution) - It is the gap µs Note - Available only with VANET
between two successful component
packets Ex – Traffic management
Source Real IP -
Specifies the real IP
Address of source device
in Emulation NetSim Emulation application
Source Port - Specifies enables users to connect NetSim
the Port no used for simulator to real hardware and
transmission by interact with live applications.
Application running in Note
source device 1. Will be present only when
Emulation -
Destination Real IP - Emulator Add-on is installed.
Specifies the real IP 2. If user wants to modify
Address of destination application.dll and run emulation
device in Emulation then application.dll must be built in
Destination Port - release mode only. If built in debug
Specifies the Port no used mode then emulation won't work.
for reception by
Application running in
destination device
For Voice and Erlang call applications, Codec option is available as follows
Codec
Codec stands for Coder-decoder. Codecs are devices which encode / decode digital data
streams. Codec is the component of any voice system that translates between analog speech
and the bits used to transmit them. Every codec transmits a burst of data in a packet that can
be reconstructed into voice.
Five different standards of voice codec’s available in NetSim are G.711, G.729, G.723, GSM-
FR, GSM-EFR which can be selected depending on the variations required. Packet size and
Inter-arrival time value will vary depending on the codec value chosen.
G.711: G.711 is a Pulse code modulation (PCM) of voice frequencies on a 64 kbps channel.
G.711 uses a sampling rate of 8,000 samples per second. Non-uniform quantization with 8
Ver 11.1 89
bits is used to represent each sample, resulting in a 64 kbps bit rate. There are two types of
standard compression algorithms are used.
µ-law algorithm
A-law algorithm.
G.729: The G.729 speech codec uses audio data compression algorithm and compress the
data at bit rates that vary between 6.4 and 12.4 kbps. Coding of speech at 8 kbps using
conjugate-structure algebraic-code-excited linear prediction (CS-ACELP).
G.723: G.723 is an ITU standard for speech codecs that uses the ADPCM method and
provides good quality audio at 24 and 40 Kbps.
GSM-FR: GSM–Full Rate (GSM-FR) speech codec was developed in early 1990s and was
adopted by the 3GPP for mobile telephony. The codec operates on each 20ms frame of
speech signals sampled at 8 KHz and generates compressed bit-streams with an average bit-
rate of 13 kbps. The codec uses Regular Pulse Excited – Long Term Prediction – Linear
Predictive Coder (RPE-LTP) technique to compress speech. The codec provides voice activity
detection (VAD) and comfort noise generation (CNG) algorithms and an inherent packet loss
concealment (PLC) algorithm for handling frame erasures. The codec was primarily developed
for mobile telephony over GSM networks.
GSM-EFR: GSM enhanced full rate speech codec is a speech coding standard that was
developed in order to improve the quite poor quality of GSM-Full Rate (FR) codec. Working at
12.2 kbps the EFR provides wire like quality in any noise free and background noise
conditions. The EFR 12.2 kbps speech coding standard is compatible with the
highest AMR mode (both are ACELP).
Video Models
Model Type
Continuous Normal VBR – This model is the simplest of all models. It uses Normal
Distribution for the generation of bits per pixel. In this model, consecutive packet
sizes are independent of each other.
Frames per second – Number of frames arriving per second. This is in the
range of 10 – 50.
Ver 11.1 90
Pixels per frame -Number of pixels in each frame. This is in the range of 10000
– 100000.
Bits per pixel (µ) – Mean value of the normal distribution used to generate the
value of bits per pixel.
Bits per pixel (Σ) – Standard Deviation of the normal distribution used to
generate the value of bits per pixel.
The generation rate for video application can be calculated by using the
formula Generation Rate (bits per second) = fps * ppf * bpp
where, fps = frames per second, ppf = pixel per frame, bpp (µ) = bits per
pixel (mean)
Users can set the above-mentioned parameters in the Application
Properties
Continuous State Autoregressive Markov –This model incorporates the
autocorrelation between the frames. Also, current packet size depends on the
previous packet size via the first order autoregressive Markov process.
Frames per second – Number of frames arriving per second. This is in the
range of 10 – 50.
Pixels per frame - Number of pixels in each frame. This is in the range of
10000 – 100000.
Constants A, B– First order autoregressive Markov process λ(n) can be
generated by the recursive relation λ(n) = aλ(n-1)+bw(n).
Eta– The steady-state average E(λ)and discreet auto covariance C(n) are
given by E(λ) = (b / (1-a) ) η C(n)=(b2/(1-a2))an where η is the Gaussian
parameter.
Quantized State Continuous Time Markov –In this model the bit rate is quantized
into finite discrete levels. This model takes uniform quantization step as A bits/pixel.
There are M + 1 possible levels (0, A… MA).Transitions between levels are assumed
to occur with exponential rates that may depend on the current level. This model is
approximating the bit rate by a continuous time process λ(t) with discrete jumps at
random Poisson time.
Frames per second – Number of frames arriving per second. This is in the
range of 10 – 50.
Pixels per frame - Number of pixels in each frame. This is in the range of
10000 – 100000.
No of Multiplexed Sources– This model considers the aggregate
instantaneous input rate λN (t) instead of the single source bit rate λ (t). The
Ver 11.1 91
total rate is the sum of N independent random processes each with mean E
(λ) and variance C (0) at steady state. Therefore, the steady state- mean of
λN (t) will be E (λ N) =N x E (λ) bits/pixel.
Quantization Level– This model takes uniform quantization step as A
bits/pixel. There are M + 1 possible levels (0, A, MA). Transitions between
levels are assumed to occur with exponential rates that may depend on the
current level.
Simple IPB Composite Model–In this model, the frames are organized as
IBBPBBPBBPBBIBBPBB… i.e., 12 frames in a Group of Pictures (GOP). Generate
X0 from a Gaussian distribution N(0, y 0).Set initial value N0= 0, D0 = 1.
For k = 1, 2,…, N-1, calculate Φkj , j = 1, 2,…,k iteratively using the following formulae
Dk = Dk-1 –(N2k-1/Dk-1)
Φkk = Nk / Dk
mk = j = 1ΣkΦkjXk-j
Finally, each Xk is chosen from N (mk, y k). Thus we get a process X with ACF approximating
to r (k).
Where d= H-0.5.
Β = 2 – 2H
Distribution of these data is Gaussian. For data to be Beta distributed, the following mapping
is being used.
Ver 11.1 92
FN: The cumulative probability of normal distribution,
Frames per second – Number of frames arriving per second. This is in the
range of 10 – 50.
Gamma I, Gamma B, Gamma P, Eta I, Eta B, Eta P, Beta I, Beta P, Beta B
– Refer i-button help of Simple IPB Composite Model.
𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑅𝑎𝑡𝑒 (𝑀𝑏𝑝𝑠) = (𝑃𝑎𝑐𝑘𝑒𝑡 𝑠𝑖𝑧𝑒 (𝑏𝑦𝑡𝑒𝑠) ∗ 8) / 𝐼𝑛𝑡𝑒𝑟 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒 (µ𝑠))
Video
The traffic generation rate for Video applications are based on the
CONTINUOUS_NORMAL_VBR model. This CONTINUOUS_NORMAL_VBR model is the
simplest of all video models in NetSim. It uses Normal Distribution for the generation of bits
per pixel. In this model, consecutive packet sizes are independent of each other. The
generation rate for video application can be calculated by using the formula shown below:
Example: Frames per second = 20, pixels per frame = 10000, bits per pixel = 0.52 then the
generation rate would be
Ver 11.1 93
Generation rate (bps) = fps*ppf*bpp
Voice
𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑅𝑎𝑡𝑒 (𝑀𝑏𝑝𝑠) = (𝑃𝑎𝑐𝑘𝑒𝑡 𝑠𝑖𝑧𝑒 (𝑏𝑦𝑡𝑒𝑠) ∗ 8) / 𝐼𝑛𝑡𝑒𝑟 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒 (µ𝑠))
HTTP
𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑅𝑎𝑡𝑒 (𝑀𝑏𝑝𝑠) = (𝑃𝑎𝑔𝑒 𝑠𝑖𝑧𝑒 (𝑏𝑦𝑡𝑒𝑠) ∗ 8 ∗ 𝑃𝑎𝑔𝑒 𝑐𝑜𝑢𝑛𝑡) / 𝐼𝑛𝑡𝑒𝑟 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒 (𝑠))
Example: Page size = 20000 Bytes, Page Count = 2, Inter arrival time = 3s
FTP
𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑅𝑎𝑡𝑒 (𝑀𝑏𝑝𝑠) = (𝐹𝑖𝑙𝑒 𝑠𝑖𝑧𝑒 (𝑏𝑦𝑡𝑒𝑠) ∗ 8) / 𝐼𝑛𝑡𝑒𝑟 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒 (𝑠))
Database
𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑅𝑎𝑡𝑒 (𝑀𝑏𝑝𝑠) = (𝑃𝑎𝑐𝑘𝑒𝑡 𝑠𝑖𝑧𝑒 (𝑏𝑦𝑡𝑒𝑠) ∗ 8) / 𝐼𝑛𝑡𝑒𝑟 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒 (µ𝑠))
BSM
𝐺𝑒𝑛𝑒𝑟𝑎𝑡𝑖𝑜𝑛 𝑅𝑎𝑡𝑒 (𝑀𝑏𝑝𝑠) = (𝑃𝑎𝑐𝑘𝑒𝑡 𝑠𝑖𝑧𝑒 (𝑏𝑦𝑡𝑒𝑠) ∗ 8) / 𝐼𝑛𝑡𝑒𝑟 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 𝑡𝑖𝑚𝑒 (µ𝑠))
Ver 11.1 94
Example: Packet size = 20Bytes and Inter arrival time = 1000000µs.
Note: Priority of “Normal” has a Priority Value of 4 and “nRTPS” QoS Class. Ex: Video over TCP.
Any time you have events which occur individually at random moments, but which tend to
occur at an average rate when viewed as a group, you have a Poisson process.
For example, we can estimate that a certain node generates 1200 packets per minute. These
are randomly generated throughput the hour throughput the 60 seconds, but there are on
average 1200 packets per minute. If 1200 packets generated per minute that, on average, one
packet is generated every 60 / 1200 = 0.05 seconds. So, let’s define a variable λ = 1/ 0.05 =
20 and call it the rate parameter. The rate parameter λ is a measure of frequency: the average
rate of events (packets) per unit of time (in this case, seconds).
Knowing this, we can ask questions like, what is the probability that a packet will be generated
within the next second? What’s the probability within the next 10 seconds? There’s a well-
known function to answer such questions. It’s called the cumulative distribution function for
the exponential distribution, and it looks like this:
Ver 11.1 95
F(x) =1−e−λx
Basically, the more time passes, the more likely it is that, a packet is generated. The word
“exponential”, in this context, actually refers to exponential decay. As time passes, the
probability of having no packets generated decays towards zero – and correspondingly, the
probability of having at least one packet generated increases towards one.
The probability of generating a packet within the next 0.05 seconds is F(0.05)≈ 0.63
The probability of generating a packet within 1 second is F(1)≈ 0.999999998
In particular, note that after 0.05 seconds – the prescribed average time between packets –
the probability is F(0.05)≈ 0.63 .
We simply write a function to determine the exact amount of time until the next packet. This
function should return random numbers, but not the uniform kind of random number produced
by most generators. We want to generate random numbers in a way that follows our
exponential distribution.
Given that the inverse of the exponential function is ln, it’s pretty easy to write this analytically,
where U is the random value between 0 and 1:
This is exactly the code used in NetSim, and this is available in the source C file in
../NetSim_Standard/Simulation/Application/Distribution.c. In the case exponential distribution,
you would see
Ver 11.1 96
fFirstArg = args[0];
fFirstArg = 1 / fFirstArg;
The simple way of selecting this via the UI is to selecting exponential distribution for inter-
arrival time when modelling application properties.
Ver 11.1 97
6 Running Simulation via CLI
Application path is the current workspace location of the NetSim that you want to run. The
default application path will be something like
“C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64” for 64-bit and
“C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86” for 32-bit. For more information on
NetSim workspace refer Section 3 “Workspaces and Experiments”.
IO path (Input/output Path) is the path where the input and output files of an application is
written. This is similar to the temp path of windows OS. For NetSim, the IO path can be got by
Start Run %temp%/NetSim. Once you reach this folder, the user can notice that the path
would be something like “C:\Users\Ram\AppData\Local\Temp\NetSim”
The IO path is the path where the Configuration.netsim (NetSim Configuration file) of the
scenario, that will be simulated, should be present.
App path and IO path can also be same, i.e., Configuration.netsim can be placed inside the
app path (if the app path has write permission). Otherwise, users can create a folder for IO
path and Configuration.netsim can be placed inside that folder.
Note: Sample configuration.netsim files are available in the <NetSim installed Directory>/Docs/
Sample_Configurations folder of the NetSim install directory inside the respective protocol folder names.
Ver 11.1 98
Step 3: Running NetSim through command line for Simulation
To run NetSim through command line, copy the app path where NetSimCore.exe is present
and paste it in the command prompt.
Note: File path should be always added in the command prompt within double quotes. For example,
>cd “C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64”
For floating/roaming licenses, type the following in the command prompt.The type of license
can be seen by clicking on NetSim Help About NetSim
Where,
<app path> contains all files of NetSim including NetSimCore.exe. Specifying the
app path is optional. NetSim will take the current path as app path if not specified.
<iopath> contains Configuration.netsim and Configuration.xsd (Configuration.xsd is
available in the bin folder of NetSim’s current workspace path
<C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit folder). Refer
section 6.2.4 to know about configuration.xsd file.
5053 is the port number through which the system communicates with the license
server i.e the system in which the dongle is running (for floating license users)
<Server IP Address> is the ip address of the system where NetSim license server
(dongle) is running. Please contact your network administrator / lab in charge to know
the IP address of the PC where the NetSim license server is running.
The following screenshot is the example of running NetSim through CLI where the ip address
of the NetSim license server is 192.168.0.2
Ver 11.1 99
For node-locked licenses, type the following in the command prompt
Where,
The following screenshot is the example of running NetSim through CLI for the node locked
license.
Simulation will be completed successfully and the text files that are requested by the end user
in Configuration.netsim will be written in the <iopath>.
Note: If the folder name contains white space, then mention the folder path within double quotes while
specifying the folder name in the command prompt. For example, if app path contains white space, then
the app path must be mentioned within double quotes in the command prompt as given below.
To know more about the options that are available to run NetSim via CLI, type the following in
the command prompt.
>NetSimCore.exe –h
With Quick Edit mode, you can copy text between a command window and Windows-based
programs, and you can also paste text into a command window by using a right-click
operation. To use Quick edit mode in command prompt users can run the command prompt
Right Click the icon in the upper-left corner of the Command Prompt window, and then
Click Properties In the options, enable Quick Edit mode and select ok.
Using UI
Configur
Metrics.t
ation.Net
xt
Sim
Protocol
Engine +
Stack +
Kernel
To model a scenario in order to generate metrics in NetSim, GUI will write all the details about
the devices used in the scenario and its properties, the links used and their properties, the
properties of the environment being used, etc. in Configuration.netsim just when the user
performs the simulation.
The back-end engine that contains dlls and NetSimCore.exe will read this
Configuration.netsim, execute the simulation and write output metrics files (in .txt format) to
the IO path. Then, the GUI will display the metrics based on the text files written by the
backend.
In order to run NetSim through command line (CLI), the user has to create the
Configuration.netsim furnishing all the details about the devices, links and the environment of
the desired scenario.
In Visual Studio, XML view provides an editor for editing raw XML and provides IntelliSense
and color coding. After you type the element name and press the CTRL+ SPACE, you will be
Color coding is followed to indicate the elements and the attributes in a unique fashion.
The following screenshot displays the Configuration.netsim which is opened through the Visual
Studio.
EXPERIMENT_INFORMATION
GUI_INFORMATION
NETWORK_CONFIGURATION
SIMULATION_PARAMETER
PROTOCOL_CONFIGURATION
STATISTICS_COLLECTION
EXPERIMENT_INFORMATION:
This section contains the details about the user credentials, such as the user mode (Admin or
Exam or Practice), experiment name, date on which the experiment is created and the
comments about the experiment. This section plays a significant role while running NetSim
through GUI.
GUI_INFORMATION:
This section contains the GUI information like the environment length, view type etc. and the
network name which is desired to be run.
NETWORK_CONFIGURATION:
This section is used to configure the devices and the links of the desired network at the each
layer of the TCP/IP stack. It consists of DEVICE_CONFIGURATION, CONNECTION and
APPLICATION_CONFIGURATION. DEVICE_CONFIGURATION configures the devices in
the desired network while the CONNECTION configures the links in the desired network and
APPLICATION configures the Applications.
SIMULATION_PARAMETER:
PROTOCOL_CONFIGURATION:
IPV4 and static ARP are enabled or disabled in this section. The text files illustrating the static
routing and static ARP can be obtained by enabling the corresponding tags in the
Configuration.netsim.
The packet trace and the event trace can be observed in the text files which are created by
enabling the tags in this section. The required fields of the packet trace can be enabled in the
PACKET_TRACE while the event trace can be enabled in the EVENT_TRACE of this section.
Sample “Configuration.netsim” file will be installed in user system along with the software at
<NetSim installed Path>\Docs\ Sample_Configuration\ <Network Technology>.User can open
and edit these files using Visual Studio 2015/2017 or any XML editor. The purpose of providing
the sample “Configuration.netsim” file is to assist the user in writing a network scenario
manually by analyzing the format for that specific network technology.
Configuration.xsd file
Configuration.xsd is a XML schema Definition file which is present in the bin folder of NetSim’s
current workspace path <C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit
and <C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit.
Configuration.xsd file can be placed inside the <iopath> along with the configuration.netsim
file to verify the contents in the configuration.netsim file. This file checks and validates the
structure and vocabulary of a configuration.netsim document against the grammatical rules of
the appropriate XML language.
It is not mandatory to place the configuration.xsd file along with the Configuration.netsim file
in the iopath. But if it is done, then it will be easier to check & validate changes that are done
to the Configuration.netsim file.
After simulation of a scenario is performed, NetSim Performance Metrics are shown on the
screen as shown below:-
Prints metric as
a HTML page
Displays the
respective
metrics window
Restores to
original view with
four windows
Opens packet
trace and event
trace
Network metrics: Here users can view the values of the metrics obtained based on the overall
network and also displays the values of the metrics pertaining to each link
Link_ Id-It is the unique Id for the link.
Link_ throughput_ graph – Plots throughput vs. Simulation time
Calculation:
Total Bytes transmitted is counted for both data packets and control packets.
The calculation is based on the packet size (bytes) at the PHY layer, which would include app
layer payload plus the overheads of all layers. Error and collision packets are not included in
this calculation and only successful packets are counted for calculation of this metric.
To plot Time
average
To edit chart
title and view
Change Plot
properties
Vary X - axis
properties
Vary Y – axis
properties
Zoomgraph
Reset Zoom
to default
Change plot
line color
Moving Average: This is the average of the metric up until the current time and is defined as
Time Average: This is the average of the metric up to end of simulation current time
Packets_ Transmitted - It is the total number of packets transmitted in the link. Along
with data packets, it includes protocol control packets like ARP Request, ARP Reply,
TCP_ACK, TCP_SYN, RTS, CTS, WLAN_ACK, OSPF_ HELLO, RIP packets etc.
Packets_ errored - Total number of packets error in the link inclusive of data and
control packets.
Packets_ collided - Total number of packets collided in the link including data and
control packets.
Bytes_ Transmitted - It is the total number of bytes transmitted in the link. It is equal
to the sum of the ‘Payload_ Transmitted’ and ‘Overhead_ Transmitted’ transmitted in
the link.
Payload_ Transmitted - It is the total payload transmitted in the link.
Overhead_ Transmitted - It is the total overhead transmitted in the link. It includes the
layer wise overheads and all control packets in the link.
Queue Metrics: Displays the values of the queue metrics for the devices containing buffer
queue like routers, access points etc.
Device Id - Unique id number of the device.
Port Id - Unique id number of the port of the device. This is also called as interface id.
Queued Packet - Number of packets queued at a particular port of a device.
Dequeued Packet - Number of packets removed from the queue at a particular port of
device.
Dropped Packet - Number of packets dropped at a particular port of a device.
Protocol metrics: Displays the protocol based metrics which are implemented in Network
scenario. Metrics will vary depending upon the type of network simulated.
Source - It displays the name with ID of the source device which generates TCP
packets
Destination - It displays the name with ID of the destination device which receives
TCP packets
Local Address - It displays the local IP address with port number of the device
present in source column
Remote Address It represents the remote IP address with port number for the
source and destination
IP Metrics:
Device_Id - It represents the Id’s of the wireless devices which supports 802.11
(WLAN)
Interface_Id - It represents the interface Id’s of the wireless nodes
Frame Sent - It is the Number of frames sent by Access Point
Frame Received - It is the number of frames received by a wireless node
RTS Sent - It is the number of Request to send (RTS) packets sent by a Wireless
Node. RTS/CTS frames are sent prior to transmission when the packet size exceeds
RTS threshold. The access point receives the RTS and responds with a CTS frame.
The station must receive a CTS frame before sending the data frame. The CTS also
contains a time value that alerts other stations to hold off from accessing the medium
while the station initiating the RTS transmits its data.
RTS Received - It is the number of RTS packets received by an Access Points
CTS Sent - It is the number of Clear to send (CTS) packets sent by an Access Points
CTS Received - It is the number of CTS packets received by Wireless Nodes
Successful Backoff - It is the number of successful backoffs running at a wireless
node. In the IEEE 802.11 Wireless Local Area Networks (WLANs), network nodes
experiencing collisions on the shared channel need to backoff for a random period of
time, which is uniformly selected from the Contention Window (CW). Backoff is a
timer which is decreased as long as the medium is sensed to be idle for a DIFS, and
frozen when a transmission is detected on the medium, and resumed when the
channel is detected as idle again for a DIFS interval
Failed Backoff - It is the number of failed backoffs at wireless node
Device metrics: Displays device related metrics like ARP table, IP forwarding tables. This is
also dependent upon the type of network/technology simulated
IP_Forwarding Table:
Switch MAC Address Table: These metrics will be displayed when we run networks having
Switches
GSM/CDMA Metrics
MS Metrics
Channel metrics
Battery Model
CPE metrics
Incumbent Metrics
Channel Metrics
BS Id - It is the Id of the BS
Channel Number - It represents the channel number at which the BS is operating
Frequency - It is the frequency of the channel at which the BS is operating
Spectral efficiency - It refers to the information rate that can be transmitted over a
given bandwidth in a specific communication system. It is a measure of how
efficiently a limited frequency spectrum is utilized by the physical layer protocol, and
sometimes by the media access control protocol.
Calculation:
𝑇𝑜𝑡𝑎𝑙 𝑝𝑎𝑦𝑙𝑜𝑎𝑑 𝑑𝑒𝑙𝑖𝑣𝑒𝑟𝑒𝑑 𝑡𝑜 𝑑𝑒𝑠𝑡𝑖𝑛𝑎𝑡𝑖𝑜𝑛 (𝑏𝑦𝑡𝑒𝑠) ∗ 8
𝐴𝑝𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛 𝑇ℎ𝑟𝑜𝑢𝑔ℎ𝑝𝑢𝑡(𝑖𝑛 𝑀𝑏𝑝𝑠) =
𝑆𝑖𝑚𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑇𝑖𝑚𝑒 (𝑀𝑖𝑐𝑟𝑜 𝑠𝑒𝑐)
Delay - It is the average amount of time taken calculated for all the packets to reach
the destination from the source.
Note about metrics: NetSim uses the Douglas–Peucker algorithm for plotting the throughput
(link/application) over time. This is an iterative end-point fit algorithm, which takes a curve
composed of line segments and finds a similar curve with fewer points.
The metrics are calculated at each layer and might not be equivalent to the same metric
calculated at a different layer. For exactness and precision we recommend users also verify
the results with the event trace & packet trace generated by NetSim.
Note about packet transmission: The Network Stack forms the core of NetSim’s
architecture. The Stack consists of five IN and OUT events: PHYSICAL_IN, MAC_IN,
NETWORK_IN, TRANSPORT_IN, APPLICATION_IN and APPLICATION_OUT,
TRANSPORT_OUT, NETWORK_OUT, MAC_OUT, PHYSICAL_OUT. All the packets when
transferred between devices go through the above events in order. IN events occur when the
packet is entering a device and all the OUT events occur when packet leaves a device.
The following table lists the various files that will be written in the NetSim install directory/ IO
path on completion of simulation.
If NetSim runs via the UI, then the metrics will be displayed automatically at the end of
simulation with illustrative tables.
If NetSim runs via CLI, then the metrics will be written into Metrics.txt and MetricsGraph.txt.
7.3 Print
A web formatted (html file) report can be generated for simulations performed in NetSim, using
the Print button present in the results window.
Animation
Control
Packet Label
25 plus field
packect
Information
While viewing packet animation, user can see the flow of packets as well as the type of packet.
Blue color packet denotes control packet, green color is used for data packet and red color is
error/collided packet. Packet Animation table is also provided for users to see the flow of
packets along with packet animation. The Table Filters option available in the Packet Animator
Window allows users to filter the parameters that will be displayed in the Packet Trace Window
displayed alongside animation. The View More Animation options can be used to view plots,
IP address of devices, Battery Level, Route tables etc alongside animation.
Create a scenario with 3 wired nodes, 2 switches and 1 router and connect it based
on the following scenario.
Disable TCP in all the wired nodes.
Click on application and set Source_Id and Destination_Id as 1 and 2 respectively.
Set Simulation time = 100s. After clicking on Run Simulation, edit Static ARP
Configuration tab by setting Static ARP as Disable. Click on OK button to simulate.
Follow all the steps till Step 2 and perform the following sample.
To run the simulation, click on the Application icon and set the Source_Id and
Destination_Id as 1 and 3 respectively.
Click on Run Simulation and set Simulation time as 100 sec.
Then go to Static ARP Configuration tab and set Static ARP as Disable. Click on
OK button to simulate.
By providing a host of information and parameters of every packet that flows through the
network, packet trace provides necessary forensics for users to catch logical errors without
setting a lot of breakpoints or restarting the program often. Window size variation in TCP,
Route Table Formation in OSPF, Medium Access in Wi-fi, etc, are examples of protocol
functionalities that can be easily understood from the trace.
Note: By default packet tracing option is turned off. Turning on Packet Trace will slow down the simulation
significantly. After simulation, users would get the “open packet trace” link in the metrics window (will also
get Packet_Trace.csv file in the saved folder).
Step 1: Open the trace file. (In this example packet trace is opened)
For example, click on arrow of SOURCE_ID and uncheck the “Select all” check box and select
NODE 2 then click on OK
All the rows which are having NODE 2 as source id will be shown.
Open the packet trace file, Click the arrow in the header of the column PACKET_ID and
uncheck the “Select all” check box and select the packet id which you want to observe, for
example 1, and then click on OK.
Scenario is as shown below and traffic flow is from Wired Node 2 to Wired Node 3.
Flow of packet 1 can be observed from the packet trace as shown below.
In a scenario source and destinations are fixed but transmitter and receiver are changed. For
example, in the above scenario NODE-2 is the source and NODE-3 is the destination, but
when NODE- 2 sending the packet to the ROUTER-1 then NODE-2 is the transmitter and
ROUTER-1 is the receiver. When ROUTER-1 sending the packet to the NODE-3, ROUTER-
1 is the transmitter and NODE-3 is the receiver.
NetSim Packet trace is saved as a spread sheet. Packet Trace can be converted to an Excel
table to make the management and analysis of data easier. A table typically contains related
data in a series of worksheet rows and columns that have been formatted as a table. By using
the table features, you can then manage the data in the table rows and columns independently
from the data in other rows and columns on the worksheet
PivotTables are a great way to summarize, analyse, explore, and present your data, and you
can create them with just a few clicks. PivotTables are highly flexible and can be quickly
adjusted depending on how you need to display your results. You can also create Pivot Charts
based on PivotTables that will automatically update when your PivotTables do.
If you enable packet trace, Open Packet Trace link present in the Simulation Results
Window can be used to load the packet Trace file in MS-Excel. Formats the spread sheet as
a table for convenient analysis.
Sheet 3 of the packet trace has a black pivot table – Pivot Table (Custom) which can
be used to create additional pivot tables from scratch.
Step 1: Click on Packet Trace in the result dashboard, you can find 3 sheets will be created
i.e Packet Trace, Pivot Table (TX-RX), Pivot Table (Custom)
Once you open the sheet PivotTable (Custom), you'll need to decide which fields to add.
Each field is simply a column header from the source data. In the PivotTable Field List,
check the box for each field you want to add.
If you want to analyse packets sent from all sources to all destinations, then check
SOURCE_ID, DESTINATION_ID and CONTROL_PACKET_TYPE/APP_NAME.
The PivotTable will calculate and summarize the selected fields. In this example, the
PivotTable shows the packets sent from all sources to all destinations.
The above example shows all the packets which including data packets and control
packets.
If you wish to know how many Data and how many were control packets then, check
the PACKET_TYPE and drag it to the ROWS field.
Further, if you wish to know how many packets got errored and how many were
successful, check the PACKET_STATUS field and drag it to the ROWS field.
Create a network scenario with 1 router and 6 wired nodes. Create 3 applications as per the
following
Enable Packet Trace and simulate the scenario for 10 seconds. Open packet trace and
perform the following steps:-
Insert a column after PHY_LAYER_END_TIME, then select the whole column and
calculate delay for each and every packet by using the formula
PHY_LAYER_END_TIME – APPLICATION_LAYER_ARRIVAL_TIME
Then Press CTRL + ENTER. This will calculate delay for the whole column shown
below
Drag and drop DELAY value that we have calculated earlier to ROWS and VALUES
field
Click on Count of DELAY drop down and select Value Field settings, then Select
SUM and click on OK.
Throughput analysis: To explain how users can perform Throughput Analysis, we have used
same network design example as was used for Delay analysis above.
After loading the packet trace switch to sheet Pivot Table (Custom) , drag and drop
SOURCE_ID, RECEIVER_ID, CONTROL_PACKET_TYPE / APP_NAME and
PACKET_STATUS to FILTERS field.
Similarly drag and drop APP_LAYER_PAYLOAD to ROWS field and VALUES
field
Filter SOURCE_ID to NODE-2, CONTROL_PACKET_TYPE APP_NAME to
APP1_CBR,PACKET_STATUS to Successful and RECEIVER_ID to NODE-3
Click on Count of APP_LAYER_PAYLOAD drop down and select Value Field
settings, then Select Sum and click on OK.
The pivot table would look like
EmptyCell=GETPIVOTDATA("APP_LAYER_PAYLOAD(Bytes)",$A$6,"APP_LAYER_PAYLOAD(Bytes)",1460)*8/
10000000
In a pivot table, you can create a new field that performs a calculation on the sum of
other pivot fields.
Open Packet Trace, switch to sheet Pivot Table (Custom)
Drag and drop SOURCE_ID, RECEIVER_ID and PACKET_STATUS to FILTERS
field, then CONTROL_PACKET_TYPE/APP_NAME, APP_LAYER_PAYLOAD to
ROWS field and APP_LAYER_PAYLOAD to VALUES field as shown below
Click on Formula text box and then select APP_LAYER_PAYLOAD in the Fields list
and click on Insert Field
Calculate the throughput by using the following formula shown below and click on
OK
Select a cell in the pivot table, and on the Excel Ribbon, under the PivotTable
Tools tab, click the Options tab (Analyze tab in Excel 2013).
In the Tools group, click Pivot chart and select OK.
PHY_LAYER_START_TIME Specifies the time at which packet starts betting transmitted in the link
(μs) between Transmitter_ID and Receiver_ID
RTT (seconds) Specifies the Round Trip Time for the packet
RTO (seconds) Specifies the Retransmission Timeouts
CONNECTION_STATE Specifies the state of TCP connection
isSyn If TCP is enabled, it specifies whether the packet is TCP_SYN or not
isAck If TCP is enabled, it specifies whether the packet is
TCP_ACK/TCP_SYN_ACK or not
isFin If TCP is enabled, it specifies whether the packet is TCP_FIN or not
SEGMENT_LENGTH Specifies the segment length of the packet
SOURCE_IP Specifies the IP address of the source
DESTINATION_IP Specifies the IP address of the destination
GATEWAY_IP Specifies the IP address of the device which is transmitting a packet
NEXT_HOP_IP Specifies the IP address of the next hop
NOTE:
Each line in the packet trace represents one hop of one packet.
The packet trace is logged in ascending order of time as measured in Phy_Layer_End_Time.
NetSim’s Network Stack forms the core of NetSim and its architectural aspects are
diagrammatically explained below. It exactly mirrors the TCP/IP stack and has the following
five layers
Network Stack accepts inputs from the end-user in the form of Configuration file and the data
flows as packets from one layer to another layer in the Network Stack.
All packets, when transferred between devices move up and down the stack, and all events in
NetSim fall under one of these ten categories of events, namely, Physical IN, Data Link IN,
Network IN, Transport IN, Application IN, Application Out, Transport OUT, Network OUT,
Data Link OUT and Physical OUT. The IN events occur when the packets are entering a
device while the OUT events occur while the packet is leaving a device. In addition to these
events there can be TIMER events associated with each protocol.
Every device in NetSim has an instance of the Network Stack shown above. Switches &
Access points have a 2 layer stack, while routers have a 3 layer stack. End-nodes have a 5
layer stack.
The protocol engines are called based on the layer at which the protocols operate. For
example, TCP is called during execution of Transport IN or Transport OUT events, while
When these protocols are in operation they in turn generate events for NetSim's discrete event
engine to process. These are known as SUB EVENTS. All SUB EVENTS, fall into one of the
above 10 types of EVENTS and TIMER events if applicable.
Each event gets added in the Simulation kernel by the protocol operating at the particular layer
of the Network Stack. The required sub events are passed into the Simulation kernel. These
sub events are then fetched by the Network Stack in order to execute the functionality of each
protocol. At the end of Simulation, Network Stack writes trace files and the Metrics files that
assist the user in analyzing the performance metrics and statistical analysis.
Event Trace:
The event trace records every single event along with associated information such as time
stamp, event ID, event type etc in a text file or .csv file which can be stored at a user defined
location. Apart from a host of information, the event trace has two special information fields for
diagnostics
A log of the file name and line number from where the event was generated (Please
refer “Writing Custom Code in NetSim Debugging your code Via CLI”) and
Previous event which triggered the current event.
Note: Turning on Event Trace will slow down the simulation significantly
If NetSim runs via GUI, event trace can be turned on by clicking the Event Trace icon in the
tool bar and selecting the required fields in the event trace.
If NetSim runs via CLI, then the event trace can be turned on by enabling the event trace in
the STATISTICS_COLLECTION tag of the configuration file. Following is a screenshot of a
Configuration.netsim file with Event Trace disabled:
5. Once PivotTable worksheet open, you'll need to decide which fields to add. Each
field is simply a column header from the source data. In the PivotTable Field List,
check the box for each field you want to add.
4. A window named Value Field Settings opens then select Count option and click
OK button
5. Then finally the Pivot Table Fields will be as shown below.
And the Pivot Table created will be as shown (1 in the table is Source_Id and 10
is the Destination_Id)
𝑆𝑢𝑚 𝑜𝑓 𝑡ℎ𝑒 𝐷𝑒𝑙𝑎𝑦𝑠 𝑜𝑓 𝑡ℎ𝑒 𝑠𝑢𝑐𝑒𝑠𝑠𝑓𝑢𝑙𝑙𝑦 𝑟𝑒𝑐𝑒𝑖𝑣𝑒𝑑 𝑎𝑝𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛 𝑑𝑎𝑡𝑎 𝑝𝑎𝑐𝑘𝑒𝑡𝑠 𝑏𝑦 𝑡ℎ𝑒 𝑑𝑒𝑠𝑡𝑖𝑛𝑎𝑡𝑖𝑜𝑛
App Delay =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑠𝑢𝑐𝑒𝑠𝑠𝑓𝑢𝑙 𝑎𝑝𝑝𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛 𝑑𝑎𝑡𝑎 𝑝𝑎𝑐𝑘𝑒𝑡𝑠 𝑟𝑒𝑐𝑒𝑖𝑣𝑒𝑑 𝑏𝑦 𝑡ℎ𝑒 𝑑𝑒𝑠𝑡𝑖𝑛𝑎𝑡𝑖𝑜𝑛
Note: If the packet size is > 1500 then fragmentation occurs and the packet is received as multiple
segments. In NetSim the destination counts each segment as different packet.
Then in an empty cell enter
=SUMIF(H:H,">0")/GETPIVOTDATA("Count of Event_Time(US)2",$A$4,"Device_Id",10)
where
Compare with the Delay in Application_Metrics_Tables and it would exactly match. There
might be slight difference in the decimals due to Excel’s round offs.
In NetSim ‘jitter’ is defined as the variance of delay. Variance is statistically defined as the
square of deviation from the mean.
Note: This calculation is only valid only when there is with no packet segmentation. Packets will be
segmented in the Transport Layer if they exceed the Maximum Segment Size (MSS), which is 1460 Bytes
by default.
Sample Scenario:
3. Then select Protocol_Name(2nd Row) in the top of the sheet and select
APPLICATION only and then click Ok
5. Then it opens a window named Show Values As in that select Base Field as
Device_Id Base Item as the Source_Node_Id (1 in this case) and click OK button.
7. Place the mouse cursor on the top of Destination_Node_Id(2 in this Case) then left
click it will automatically selects the rows of the Destination_Node_Id, then select the
Name Box and name the row as Delay as shown below
9. Then in an empty cell type the following formula and press enter
=VAR.S (Row Address), where the Row Address is one that you got in the previous step.
For example =VAR.S ($C$6:$C$5005) .This will give you the Application Jitter.
𝑇𝑜𝑡𝑎𝑙𝑃𝑎𝑦𝑙𝑜𝑎𝑑𝑎𝑝𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛𝑠𝑢𝑐𝑐𝑒𝑠𝑓𝑢𝑙𝑙𝑦𝑟𝑒𝑐𝑒𝑖𝑣𝑒𝑑𝑏𝑦𝑡ℎ𝑒𝑑𝑒𝑠𝑡𝑖𝑛𝑎𝑡𝑖𝑜𝑛
2. App Throughput = 𝑆𝑖𝑚𝑢𝑙𝑎𝑡𝑖𝑜𝑛𝑡𝑖𝑚𝑒
This give the Application Throughput in Mbps (Multiplied by 8 to convert Bytes to bits, and
divided by 100000 to convert into Mega)
In NetSim, to enable packet capture in Wireshark, Right Click on the device where Wireshark
should capture packets. In the properties, go to Global_Properties and set the Wireshark
Capture parameter as Online
If enabled, Wireshark Capture automatically starts during simulation and displays all the
captured packets. To view the details of the packet displayed, click-on the packet as shown
below:
The detail of the contents of the selected packet can be seen in the below panes.
TREE
BYTE
In the above figure, the details of the packet are displayed in both tree form and bytes form. In
the tree form, user can expand the data by clicking on the part of the tree and view detailed
information about each protocol in each packet.
Display filters allow you to concentrate on the packets you are interested in while hiding the
currently uninteresting ones. Packets can be filtered by protocol, presence of a field, values of
field’s etc.To select packets based on protocol, type the protocol in which you are interested
in the Filter: field of the Wireshark window and presenter to initiate the filter. In the figure below,
tcp protocol is filtered.
Youcan also build display filters that compare values using a number of different comparison
operators like ==, != , >, <, <=, etc.Following is an example displaying filtered packets whose
SYN Flag and ACK Flag are set to 1 in a TCP Stream.
A network conversation is the traffic between two specific end points.For example, an IP
conversation is all the traffic between two IP addresses.In Wireshark, Go to Statistics Menu
Conversations
User can also analyze each of the conversation andcan create graphs by selecting them and
clicking on “Graph”.
Creating IO graphs
The flow graph feature provides a quick and easy to use way of checking connections between
a client and a server. It can show where there might be issues with a TCP connection, such
as timeouts, re-transmitted frames, or dropped connections.To access flow graph, go to
Statistics Menu Flow Graph and select the flow type. By default you can see the flow
graph of all the packets.
To get the TCP flow, select TCP flow in “Flow Type” dropdown box and you will obtain the flow
as shown:
There are various important steps in this process, and each of these steps has various options
as explained in the subsequent pages:
Modifying code
DLL is the shared library concept, implemented by Microsoft. All DLL files have a .dll file
extension. DLLs provide a mechanism for sharing code and data to upgrade functionality
without requiring applications to be re-linked or re-compiled. It is not possible to directly
execute a DLL, since it requires an EXE for the operating system to load it through an entry
point. NetSim requires Visual Studio Compiler for building DLL’s.
Note: Make sure that Visual Studio 2015 or above is installed in your system.
Refer section 3.12 section “How does a user open and modify source codes” to open NetSim
Source Codes
1. After this you may modify the source codes of any project. You can also add new files
to the project if required. As an example let us make a simple source code modification
to TCP. Inside Solution Explorer pane in Visual Studio, double click on TCP project.
Then open TCP.c file by double clicking on it. Using the drop down list of functions that
are part of the current file, choose fn_Netsim_TCP_Init().
3. Once this is done click to save the changes and overwrite the file (in case of write
protection).
Building Dlls
Based on the build of NetSim installed modify the solution platform in Visual studio from
the drop down as shown below:
Now rebuild the network by right clicking on the project header and selecting Rebuild
creates a Dll file in the bin folder of NetSim’s current workspace path
<C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit which contains your
modifications. If build is successful a message similar to the following will be displayed in
the output window:
Running Simulation
1. After rebuilding the code, user can run the simulation via GUI (Please refer section 3).
In this case, user can create a scenario in any network which involves TCP protocol.
Running the simulation with the custom DLL will initially display a warning message as
shown below:
2. The warning message lists the Dll files which have been modified in the bin folder
(bin\bin_x86 for 32-bit and bin\bin_x64 for 64-bit) of NetSim’s current workspace path.
The following are the list of projects that are part of NetSim source codes present in
<NetSim_Install_Directory>/src/Simulation directory and their dependencies:
PROJECT DEPENDENCY
Application IP
Cellular Application
CLIInterpertor Firewall, IP
Cognitive Radio Application
Ethernet Firewall
IEEE802_11 Battery Model
OSPF IP
Routing IP
RPL IP
ZigBee Battery Model
ZRP IP
Aloha -
AODV -
For Eg: To perform modfications to Application Project, IP folder will also be required in
addition to lib folder, Include folder and NetSim.sln file.
Implementation: Add fprintf (stderr, “<MESSAGE>”) statement inside the source code of TCP
as shown below to print “Hello World” when custom built dll is executing.
fprintf(stderr,”\nHello World\n”);
_getch();
Step 1: Create a file with the name NodeFailure.txt inside the bin folder of NetSim’s current
workspace path <C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit. The file will contain two
columns: one being the Node ID of the device to be failed and other being the failure time (in
microseconds).
Step 3: The function fn_NetSim_DSR_Init() will execute before the protocol execution starts.
So in this function, we will read the NodeFailure.txt and save information regarding which
nodes will fail at which time. Add the following code inside the specified function.
int i;
FILE *fp1;
char *pszFilepath;
char pszConfigInput[1000];
pszFilepath = fnpAllocateMemory(36,sizeof(char)*50);
strcpy(pszFilepath,pszAppPath);
strcat(pszFilepath,"/NodeFailure.txt");
fp1 = fopen(pszFilepath,"r");
i=0;
if(fp1)
{
while(fgets(pszConfigInput,500,fp1)!= NULL)
{
sscanf(pszConfigInput,"%d %d",&NodeArray[i],&TimeArray[i]);
i+=1;
}
fclose(fp1);
}
Step 4:The fn_NetSim_DSR_Run( ) is the main function to handle all the protocol
functionalities. So add the following code to the function at the start.
int i,nFlag=1;
if(nFlag)
{
for(i=0;i<100;i++)
if((pstruEventDetails->nDeviceId== NodeArray[i]) &&
(pstruEventDetails->dEventTime >= TimeArray[i]))
{
pstruEventDetails->nInterfaceId = 0;
pstruEventDetails->pPacket=NULL;
return 0;
Step 7: Create a scenario in MANET where data packets should be travelling from source to
destination through the mentioned node in NodeFailure.txt file. For that user can increase
the pathloss exponent value and the distance among the nodes.User can utilize Packet
Animation to check the node failure (i.e. no packets are forwarded by failed nodes) after the
mentioned time.
Via GUI
Debugging your code via GUI there are two methods available
Using _getch()
Using Environment Variables (NETSIM_BREAK)
Step 1: Perform the required modification of the protocol source code and add _getch() (used
to hold the program execution until the user enters a character) statement inside init function
of the modified protocol. For example, take DSR protocol and add the following lines of code
in the init function as shown in the below screenshot
_getch();
Step 3: In NetSim, create a network scenario where the protocol is being used and start the
simulation. In the console window user would get a warning message shown in the below
screenshot and the simulation will pause for user input (because of _getch() added in the init
function)
Step 4: In Visual Studio, put break point inside the source code where you want to debug.
To stop debugging and continue execution, press Shift+F5 (key). This then gives the control
back to NetSim, for normal execution to continue.
Note: Setting NETSIM_BREAK Environment Variable will cause the simulation to slow down and it is
recommended to remove this Environment Variables after debugging the simulation
Step 3: Click New in System variables. Type “NETSIM_BREAK” as Variable name and any
positive integer as variable value (e.g. 2). Click OK. The value of the variable is the event ID
at which you want NetSim Simulation to break. In this example we have set the value to 2,
which means that the simulation will break at the previous event.
Step 6: In this example we are placing a break point in TCP source code and thus TCP should
be enabled in Transport Layer of the devices.
Step 11: In Visual Studio, Set the breakpoint in the code by clicking on the grey area on the
left of the line or by right clicking on the line and selecting Breakpoint->Insert Breakpoint
After execution of the function, the control goes back to NetSim and then comes back to the
custom code the next time the function is called in the simulation. To stop debugging and
continue execution, press Shift+F5 (key). This then gives the control back to NetSim, for
normal execution to continue.
If NETSIM_BREAK environment variable is set, NetSim event trace file additionally logs the
file name and line number of the source code where the event was added as shown below:
Modify the DSR protocol and build the code. Create a scenario on MANET then follow the
below steps.
Step 2: To run the NetSim via CLI copy the path where “NetSimCore.exe” is present.
>cd <apppath>
>NetSimCore.exe<space>-apppath<space><apppath><space>-
iopath<space><iopath><space>-license<space>5053@<ServerIP Address><space> -d
Attach to NetSimCore.exe.
Click on Attach.
Step 6: Go to command prompt which is already opened in Step 3. Enter the Event Id.
Note: If you don’t want to stop at any event you can specify 0 as event id.
All debugging options like step over (F10), step into (F11), step out (Shift + F11), continue (F5)
are available.
After execution of the function, the control goes back to NetSim and then comes back to the
custom code the next time the function is called in the simulation.
To stop debugging press Shift+F5. This thengives the control back to NetSim, for normal
execution to continue.
To debug your own (custom) code, it is often helpful to know which section of the code (file
name & line number) generated the event under study. There are 2 ways to enable this feature.
Procedure 1
Step 1:Open configuration.netsim file and provide the file name, path and set status as Enable.
Press enter
Upon running, NetSim will write the file name and line number of the source code that
generated each event.
File Name
Line Number
Procedure 2:
To see the value of a variable, when debugging hover the mouse over the variable name in
the code. A text box with variable contents appears. If the variable is a structure and contains
other variables, then click on the plus sign which is there to the left of the text box. Users can
pin the variable to watch by clicking on the pin icon to the right of that variable in the text box.
Watch the change in the variable as the code progress by right clicking on the variable &
clicking on "add watch" tab. This is useful if to continuously monitor the change in the variable
as the code progresses.
During the process of debug users would come across variables that are defined outside the
source file being built as a .dll. Such variables cannot be viewed directly when added in the
watch tab, as this would throw the error
A program database (.pdb) file, also called a symbol file, maps the identifiers that a user
creates in source files for classes, methods, and other code to the identifiers that are used in
the compiled executables of the project. The .pdb file also maps the statements in the source
code to the execution instructions in the executables. The debugger uses this information to
determine: the source file and the line number displayed in the Visual Studio IDE and the
location in the executable to stop at when a user sets a breakpoint. A symbol file also contains
the original location of the source files, and optionally, the location of a source server where
the source files can be retrieved from.
When a user debugs a project in the Visual Studio IDE, the debugger knows exactly where to
find the .pdb and source files for the code. If the user wants to debug code outside their project
source code, such as the Windows or third-party code the project calls, the user has to specify
the location of the .pdb (and optionally, the source files of the external code) and those files
need to exactly match the build of the executables.
The pdb files are usually available in NetSim’s install directory, else write to
support@tetcos.com for the latest copy of these debug files. Go to Tools >
options>debugging>load all symbols.
In the watch window, the variable which the user has to watch should be edited by double
clicking on it and prefixing {,, NetworkStack.dll} to the variable name and pressing enter. (The
name of the respective file in which the variable is defined should be mentioned - in this case
NetworkStack.dll).
Prefixing to the
variable name
Each protocol in NetSim has a separate Dll file which contains the variables and functions
which can be shared. In case of cross layer protocol implementations variables of one protocol
may have to be accessed from another Dll.
An example is given below showing how Physical layer parameters of devices running
IEEE802.11 can be accessed in the Network Layer with DSR protocol configured.
#ifndef SHARE_VARIABLE
_declspec(dllexport) IEEE802_PHY_VAR *var1;
#else
_declspec(dllimport) IEEE802_PHY_VAR *var1;
#endif
In the example, the code line must be written in IEEE802_11_Phy.h file present inside
IEEE802_11 folder.
In the main function where a user wishes to find the dReceivedPower_mw, the variable must
be assigned the respective value. In the above case, the following line of code must be written
inside fn_NetSim_IEEE802_11_PhyIn() function in IEEE802_11_Phy.c file present inside
IEEE802_11 folder.
var1 = DEVICE_PHYVAR(pstruEventDetails->nDeviceId,pstruEventDetails-
>nInterfaceId);
Note that the parameters given in the macro or any function which assigns a value to the
variable must be defined beforehand in the code. Here nDeviceId and nInterfaceId are defined
beforehand.
The Object file IEEE802_11.lib which also got created with all file must be copied and pasted
in the lib folder located in the current workspace path
<C:\Users\PC\NetSim_11.1.7_64_std_default\src\Simulation\lib_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\src\Simulation\lib> for 32-bit.
Now expand the DSR project in solution explorer. For accessing the IEEE802_11 variable, the
following lines must be added in DSR.h file
#define SHARE_VARIABLE
#pragma comment(lib,"IEEE802_11.lib")
#include "../IEEE802_11/IEEE802_11_Phy.h"
#include "../BatteryModel/BatteryModel.h"
In the fn_NetSim_DSR_Run() function add the following lines of code to print the value of
dReceivedPower_mw variable from DSR project.
if (var1)
fprintf(stderr, "\n Remaining Energy(mJ): %lf\n"
,battery_get_remaining_energy((ptrBATTERY)var1->battery));
Users can try printing the Device ID, Application ID, Duplicate Ack Count etc.
pstruEventDetails->dEventTime,
DEVICE_POSITION(pstruEventDetails->nDeviceId)->X,
DEVICE_POSITION(pstruEventDetails->nDeviceId)->Y);
_getch();
Building Mobility project creates libMobility.dll inside the binary folder of NetSim’s current
workspace path <C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit.Create a scenario in
MANET and configure the mobility model of the nodes.During simulation users can notice
that the positions of the nodes are displayed in the console w.r.t. the simulation time.
1. Open the Source codes in Visual studio using the NetSim.sln file.
2. Go to ZigBee project and Open 802_15_4.h file and add a subevent called
“MY_EVENT” inside enum_IEEE802_15_4_Subevent_Type as shown below:
4. We assume that MY_PACKET has the same fields as a Zigbee Ack and hence we are
adding the following ack frame to 802_15_4.h file(Add this code just above the enum
enum_IEEE_802_15_4_ControlPacket_Type{} defenition):
struct stru_My_Frame
{
int nBeaconId;
int nSuperFrameId;
int nBeaconTime;
double dPayload;
double dOverhead;
double dFrameSize;
};
enum enum_IEEE_802_15_4_ControlPacket_Type
{
5. Open 802_15_4.c file, go to the case TIMER_EVENT and add the following code to
the subevent type :-
break;
Here we are adding a new event inside the timer event, and this event will occur every 1
second in the GlobalPANCoordinator. i.e sink node. In this event,
fn_NetSim_WSN_MY_PACKET() is called as explained in step 5.
6. Inside 802_15_4.c file, add the following code at the end of the file for sending ack
(broadcast):
int fn_NetSim_WSN_MY_PACKET()
{
double dTime;
NETSIM_ID nDeviceId = pstruEventDetails->nDeviceId;
NETSIM_ID nInterfaceId = pstruEventDetails->nInterfaceId;
IEEE802_15_4_MAC_VAR *pstruMacVar =
DEVICE_MACVAR(nDeviceId, nInterfaceId);
IEEE802_15_4_PHY_VAR *pstruPhyVar =
DEVICE_PHYVAR(nDeviceId, nInterfaceId);
NetSim_PACKET *pstruPacket = pstruEventDetails->pPacket;
NetSim_PACKET *pstruAckPkt;
MY_FRAME *pstruAck;
dTime = pstruEventDetails->dEventTime;
// Create MY_Frame
pstruAckPkt = fn_NetSim_Packet_CreatePacket(MAC_LAYER);
pstruAckPkt->nPacketType = PacketType_Control;
pstruAckPkt->nPacketPriority = Priority_High;
pstruAckPkt->nControlDataType = MY_PACKET;
pstruAck = fnpAllocateMemory(1, sizeof(MY_FRAME));
strcpy(pstruAckPkt->szPacketType, "MY_PACKET");
8. In 802_15_4.c file, goto fn_NetSim_Zigbee_Init() function and add the following code in red
color to call the timer_event. i.e MY_EVENT
In the above function, subevent type, “MY_EVENT” is called. So this function calls the
MY_EVENT, timer event to execute.
15. To analyse the “MY_EVENT” users can open event trace and filter the subevent
type as “MY_EVENT”. Here users can analyse that the event occurs for every
1 seconds.
Free a packet
o fn_NetSim_Packet_FreePacket_dbg(NetSim_PACKET** pstruPacket,int
line,char* file);
o fn_NetSim_Utilities_CalculateDistance(NetSim_COORDINATES*
coordinate1,NetSim_COORDINATES* coordinates2);
Stores the event details. Only one time memory is allocated. Most used variable
list.h -- Optimized list operation calls since NetSim uses lists extensively
Add elments in list
IP_Addressing.h – For setting & getting IP address per the appropriate format
Set Ip address of any node
o NETSIM_IPAddress
o isBroadcastIP(NETSIM_IPAddress ip);
o isMulticastIP(NETSIM_IPAddress ip);
Include all the header (.h) files from the include folder
NetworkStack.lib is a “import library” file and has the definitions for the functions
present in the NetworkStack.dll
When developing new protocols users should create their own protocol.h and
declare all the protocol specific variables here. Stack & packet related variables
should be used from stack.h and packet.h
Every protocol should provide the following APIs as hooks to the network stack:
It is possible to configure the traffic sources in the simulation to generate traffic in a perfectly
regular pattern. However, this is typically not the case in the real world. For example, Node
back-off’s after collisions are random to resolve contention issues. The exact bit which is
errored, based on Bit error probability of a wireless channel, is decided randomly
NetSim uses an in-built Linear Congruential Random Number Generator (RNG) to generate
the randomness. The RNG uses two seeds values to initialize the RNG.
Having the same set of seed values ensures that for a particular network configuration the
same output results will be got, irrespective of the PC or the time at which the simulation is
run. This ensures repeatability of experimentation.
Modifying the seed value will lead to the generation of a different set of random numbers and
thereby lead to a different sequence of events in NetSim. When simulations are run for a
network configuration with different seed values, the results will likely be slightly different.
More advanced users get “Confidence” by analyzing a set of results with different seed values
for the same network scenario.
In this example we will replace the default Rayleigh Fading (part of the path loss
calculation) used in NetSim, with a Fading Power calculated using the Rician
Distribution from MATLAB
Procedure:
i. Create a MATLAB_Interface.c file inside the IEEE802_11 folder which can be found in
the current workspace location of the NetSim that you are running and it would be
something like “C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64” for 64-bit and
“C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86” for 32-bit. For more
information on NetSim workspace refer Section 3 “Workspaces and Experiments”. Write
the following code inside the MATLAB_Interface.c file:
/*
*
* This is a simple program that illustrates how to call the MATLAB
* Engine functions from NetSim C Code.
*
*/
#include<windows.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include"engine.h"
#include"mat.h"
#include"mex.h"
char buf[100];
Engine *ep;
int status;
mxArray *h = NULL, *i = NULL, *j = NULL, *k = NULL;
mxArray *out;
double *result;
double fn_netsim_matlab_init()
{
/*
* Start the MATLAB engine
*/
fprintf(stderr, "\nPress any key to Initialize MATLAB\n");
_getch();
if(!(ep = engOpen(NULL))) {
MessageBox((HWND)NULL, (LPCWSTR)"Can't start MATLAB engine",
(LPCWSTR) "MATLAB_Interface.c", MB_OK);
engEvalString(ep, "desktop");
return 0;
}
double fn_netsim_matlab_run()
{
return *result;
}
double fn_netsim_matlab_finish()
{
fprintf(stderr, "\nPress any key to close MATLAB\n");
_getch();
status = engEvalString(ep, "exit");
return 0;
}
10. In the Solution Explorer double click on the IEEE802_11.h file. Add definitions
of the following functions
double fn_netsim_matlab_init();
double fn_netsim_matlab_run();
dFadingPower = propagation_calculate_fadingloss(propagationHandle,
packet->nTransmitterId,ifid,pstruEventDetails->nDeviceId,
pstruEventDetails->nInterfaceId);
dFadingPower = fn_netsim_matlab_run();
13. To compile a MATLAB engine application in the Microsoft Visual Studio (2017)
environment, Right click on the IEEE802_11 project and select PROPERTIES
in the solution explorer. Once this window has opened, make the following
changes:
NOTE: To determine path where MATLAB is installed, entering the following command in the
MATLAB command prompt:
matlabroot
o Under Linker General, add the directory to the field ADDITIONAL LIBRARY
DIRECTORIES:
<Path where MATLAB is installed>\extern\lib\win32\microsoft
o Under Linker Input, add the following names to the field marked ADDITIONAL
DEPENDENCIES: libeng.lib;libmx.lib;libmat.lib;
o Make sure that the following directory is in the environment variable PATH:
<Path where MATLAB is installed>\bin\win32
o A new libIEEE802.11.dll gets created in the bin folder of NetSim’s current workspace
path <C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit. [For more
information, follow steps provided in Section8.1 “Writing your own code”.
o Run NetSim in Administrative mode. Create a Network scenario involving IEEE802_11
say MANET, right click on the environment and select properties. Make sure that the
Channel Characteristics is set to PathLoss and Fading and Shadowing.
Note: On Windows systems, engOpen opens a COM channel to MATLAB. The MATLAB software you
registered during installation starts. If you did not register during installation, enter the following
command at the MATLAB prompt:
!matlab -regserver
9. This value of i obtained from MATLAB is used to calculate fading power instead of
the already available models in NetSim.
10. Now place another breakpoint after the line dFadingPower = fn_netsim_matlab_run()
12. Now when debugging (say by pressing F5 each time) you will find that the watch
window displays the value of dFadingPower whenever the control reaches the
recently set breakpoint. You will also find that the value of dFadingPower in the
Visual Studio Watch window and the value of i in the MATLAB workspace window are
similar.
Procedure:
1. Create a file named rician_distribution.m file inside <Path where MATLAB is installed>.
The rician_distribution.m file contains the following code:
2. Place this file in the MATLAB’s default working directory. This will usually be MATLAB’s
root directory or the bin folder in MATLAB’s installation path.
3. You will have to create a MATLAB_Interface.c file in the IEEE802_11 folder similar to
the previous example. The funcitons fn_netsim_matlab_init() and
fn_netsim_matlab_finish() will remain the same. Modify the function
fn_netsim_matlab_run() that is part of MATLAB_Interfacing.c which was used in the
previous example as shown below:
double fn_netsim_matlab_run()
{
//write your own implementation here
int rician_noncentrality = 1, rician_scale = 2;
engPutVariable(ep, "h", h);
sprintf(buf, "k=rician_distribution(%d,%d)", rician_noncentrality, rician_scale);
status = engEvalString(ep, buf);
out = engGetVariable(ep, "k");
result = mxGetPr(out);
return *result;
}
4. Follow steps 2 to 14 as explained in the section “Implement Rician Distribution of
MATLAB in NetSim without using .m file” above.
5. A call to the rician_distribution () function inside the rician_distribution.m file is made,
and rician_noncentrality and rician_scale parameters are passed from NetSim.
6. Right Click on IEEE802_11 project and select Rebuild.
function WLAN=NETSIM_MATLAB(choice,varargin)
switch(choice)
case'rician'
%use ProbDistUnivParam function for matlab 2016
h=ProbDistUnivParam('rician',[varargin{1},varargin{2}]);
%use makedist function for matlab 2017
%h=makedist('rician',varargin{1}, varargin{2});
i=random(h,1);
fid = fopen('plotvalues.txt','a+');
fprintf(fid,'%f',i);
fprintf(fid,'\r\n');
fclose('all');
WLAN=i;
case'plothistogram'
fid=fopen('plotvalues.txt');
mx=fscanf(fid,'%f');
hist(mx);
fclose('all');
end
2. Modify the function fn_netsim_matlab_run() that is part of MATLAB_Interfacing.c which
was used in the previous example.
Right Click on IEEE802_11 project and select Rebuild will create a new
libIEEE802.11. in the bin folder of NetSim’s current workspace path
<C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit and
<C:\Users\PC\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit.
Open NetSim in Administrative mode. Create a Network scenario involving
IEEE802_11 say MANET, right click on the environment and select properties. Make
sure that the Channel Characteristics is set to PathLoss and Fading and Shadowing.
You will find that once the Simulation is run MATLAB Command Window starts and
once the Simulation is over a histogram is displayed in MATLAB for the values that
were generated using rician distribution.
You can also debug the code to understand the communication between NetSim and
MATLAB as explained in the DEBUGGING section above.
The tail command is a command-line utility for outputting the last part of files given to it via
standard input. It writes results to standard output. By default tail returns the last ten lines of
each file that it is given. It may also be used to follow a file in real-time and watch as new
lines are written to it.
PART 1:
Tail options
PART 2:
tail -n 0 "C:\Users\soniya\AppData\Local\Temp\NetSim\ospf_SPF_log.txt" –f
Note: Users need to change the path of the file. In this example we are using ospf_log.txt file
Open solution file and add the following line in fn_NetSim_OSPF_Init() function in
ospf.c file present inside OSPF project
In the console window user would get a warning message shown in the below
screenshot (because of changed DLL) and then the simulation will pause for user
input (because of _getch() added in the init function)
In Visual Studio, put break point inside all the functions in OSPF_SPF.c file present
inside OSPF project
Press F5 and check the tail console to watch the ospf_SPF log would look like the
following screenshot which calculates the shortest path for Router2
Keep pressing F5 will add the ospf_SPF log to the tail console. The below screenshot
examines the WAN links connected to Router2 i.e. 11.2.1.2 and 11.5.1.2
In the above screenshot, the shortest path for Router2 is 11.2.1.2 with Metrics 0 since
it is one of the Router2’s interface
The below screenshot calculates the shortest path for Router5 and examines the
WAN links connected to Router5 i.e. 11.4.1.1 and 11.5.1.1
In the above screenshot, the shortest path for Router1 is 11.4.1.2 with Metrics 0 since
it is one of the Router5’s interface
As shown in the below screenshot, the router1 calculates another new entry i.e.
11.4.1.1 with metrics 100 since it is the next hop (Router5’s 1st interface) connected
to Router1
Every protocol has a main C file which contains a Metrics() function. For Eg: TCP project will
have a TCP.c file, UDP will have an UDP.c file etc. In the following example we have added a
new table as part of TCP protocol. TCP.c file contains fn_NetSim_TCP_Metrics() function
where code related to custom metrics is added as shown below:
Refer Section 8.1 on writing your own code, for more information
After loading the source codes in Visual Studio, perform the following modifications:
string NetSim_Node_name[100];
double NetSim_Off_Time[100];
string NetSim_Node_state[100];
Step 2:
#include "../BatteryModel/BatteryModel.h"
Step 3:
Copy the below code (in red colour) in 802_15_4.c file (inside fn_NetSim_Zigbee_Metrics()
function)
Step 4:
Copy the below code (in red colour) at the end of ChangeRadioState.c file
if(isChange)
{
phy->nOldState = nOldState;
phy->nRadioState = nNewState;
NetSim_Node_state[nDeviceId - 1] = "ON";
NetSim_Node_name[nDeviceId - 1] =
NETWORK->ppstruDeviceList [nDeviceId - 1] -> szDeviceName;
}
else
{
phy->nRadioState = RX_OFF;
WSN_MAC(nDeviceId)->nNodeStatus = OFF;
NetSim_Off_Time[nDeviceId - 1] = ldEventTime;
return isChange;
}
Step 5:
Build DLL with the modified code and run a Wireless Sensor Network scenario. After
Simulation, user will notice a new Performance metrics named “Custom Metrics” is added. The
newly added NODE_FAILURE_METRICS table is shown below:
Step 1: Open NetSim source code in NetSim current workspace. For more information, please
refer section “3.12 How does a user open and modify source codes”.
Step 2: Go to LTE project through the solution explorer and open the LTE.c file. In the
function fn_NetSim_LTE_Init(), modify the function definition as shown below:
}
}
return j;
return fn_NetSim_LTE_Init_F();
}
Step 3:In the function fn_NetSim_LTE_Metrics(), add the lines of code highlighted in red as
shown below:
Step 5: Save the changes and right click on LTE module in the solution explorer and
select Rebuild.
Step 6: Upon successful build, you will get a new libLTE.dll file in the bin folder of NetSim’s
current workspace path <C:\Users\PC\NetSim_11.1.7_64_std_default\bin\bin_x64> for 64-bit
and <C:\Users\PC5\NetSim_11.1.7_32_std_default\bin\bin_x86> for 32-bit.
Step 7: Now on running any simulation in LTE, you will get individual SNR plots for each UE,
in the NetSim Metrics window under Plots->LTE_PLOTS as shown below:
10.1 Introduction
A network simulator mimics the behavior of networks but cannot connect to real networks.
NetSim Emulator enables users to connect NetSim simulator to real hardware and interact
with live applications.
To simulate the different types of Emulations Examples such as PING (both one way and two
way communications), Video (one way communication), File trasfer using Filezilla, Skype etc
Note: While running NetSim via CLI, try to ensure that there are no errors in the
Configuration.netsim file. The file, ConfigLog.txt, written to the windows temp path would show
errors, if any, found by NetSim’s config parser.
Solution:If the folder name contains white space, then mention the folder path within double
quoteswhile specifying the folder name in the command prompt. For example, if app path
containswhite space, then the app path must be mentioned within double quotes in the
command prompt.
Simulation does not commence. “No license for product (-1)” is displayed in the command
prompt.
Example:
If ”No license for product(-1)” is displayed in the command prompt two times, then check in the
NetSim license server to know about the availability of license and adjust the number of current
users of NetSim, in order to get the license.
Reason: If the command/iopath provided by the user is first written in MS Word and then copy
pasted to Command prompt, some special characters(not visible in command prompt) gets
inserted and on execution, license config dll is not found.
11.3 Configuration.netsim
Invalid attribute in configuration file attributes:
Specific attributes in the Configuration file are highlighted with zigzag lines
Reason:If invalid input is given in the Configuration file, then the corresponding attribute is
highlighted as blue lines as shown in the figure given below.
Solution:To resolve this issue mouse over the corresponding attribute, in order to get the tool
tip that furnishes the details about the valid input for that attribute.
Note: If the schema file and the configuration file are not present in the same folder, the zigzag lines won’t
appear. So place the Configuration file and Schema File in the same location or change the path of schema
file in the configuration file.
Simulation does not commence and error is displayed at the command prompt. Also, red lines
appearing at the tag specifying the Layer in the Configuration file
Reason: This issue arises mainly when the closing tag is not specified correctly for a particular
layer in the Configuration file.
When NetSim is made to run through CLI, then the following error gets displayed in the
command prompt.
Solution: The bug can be fixed by setting the closing tag correctly in the Configuration file
Reason: This issue arises when the schema and the configuration file are not in the same
folder.
Simulation terminates and exhibits unpredictable behavior. An error message stating, “An exe
to run NetSim backend has stopped working” is thrown
Example:
This problem arises if there is any flaw in the Configuration.netsim or in the dll.
Solution: Check whether the desired scenario has been configured properly in the
Configuration.netsim.
Reason:This error will come if monitor resolution is less than 1024 and 768. For example,
1260 X 720 will also show this error
NetSim dongle is running in the server system. When running the NetSim in the Client system
showing “No License for product (-1)” error.
Possible Reasons
Solution
The installed firewall may block traffic at 5053 port used for licensing. So either the user
can stop the firewall, or may configure it to allow port 5053.
Contact the Network-in-charge and check if the Server system can be pinged from client.
Check whether License Server is running in the Server system or not.
iii. NetSim protocol engine waits for the Pipes connection to be established.
Python
SUMO_HOME Environment variable is checked. If Environment variable is not
present, Error is displayed as “key interrupt error” in SUMO_HOME.
Python File waits for Pipes connection. (“waiting for pipes to connect”).
It reads initial data as GUI enable/disable from backend.
“Checking sumo” is printed. If the environment variable SUMO_HOME points to
wrong directory, error is displayed.
Sumo Simulation is started where Sumo Binary is checked (To check Sumo.exe or
Sumo GUI are working in the system or not). Then a TCP connection is made
A while loop runs – It follows the following procedure
iii.Compare with each vehicle present in Sumo. If vehicle is present –Then write
confirmation (pipes) and read its position from NetSim (2pipes for X and Y
coordinates). Also, sumo is stepped forward for every first vehicle In the list of
current vehicles in sumo.
https://tetcos.freshdesk.com/solution/articles/14000089935-list-of-known-issues-in-netsim-
v11
13 NetSim Videos
In order to have a better understanding of NetSim, users can access YouTube channel of
Tetcos at www.youtube.com/tetcos and check out the various videos available
15 NetSim FAQ/Knowledgebase