Interfacing NetSim with MATLAB

NetSim now provides users the ability to interface with MATLAB in run time


Underlying Theory:
MATLAB provides API’s to start and end the MATLAB process and send data / commands to and from MATLAB. NetSim runs these functions during initialization to simultaneously start-up a MATLAB process and whenever required send data to & from MATLAB in run time. NetSim ends the MATLAB process upon completion of the simulation.

Interfacing: An interfacing file named as NetSim_MATLAB_Interface.c is used to control the MATLAB computational engine and contains the functions –

fn_netsim_matlab_init() – which starts the MATLAB Process

fn_netsim_matlab_run() – which sends data to and from MATLAB, and sends commands to be processed in MATLAB

fn_netsim_matlab_finish() – which ends the MATLAB Process

ExMATLABCall_Ver2_4web

 

Example of MATLAB call from WLAN PHY layer in NETSIM

Example Application: In this example, we replace NetSim’s default Rayleigh fading with the Nakagami fading model from MATLAB. Calls to the above functions are made at appropriate places in the NetSim code. So, for each packet, MATLAB calculates the Nakagami fading value in run time. This value returned by MATLAB is used by NetSim as the fading power instead of using the Rayleigh model. Note that instead of sending the commands directly from NetSim to MATLAB, we can also use a MATLAB .m file which will contain the commands to be executed by MATLAB.

Video: Interfacing NetSim with MATLAB is available at https://www.youtube.com/watch?v=-c9zGfwci2g

IOT : Accelerate your research using NetSim C libraries

IOT_Scenario_Blog-01
Research areas in IOT
  • Seamless integration of heterogeneous devices
  • Network architecture for IOT
  • Energy management and sustainable operation of IOT
  • 6LoWPAN based IOT design
  • Modeling and simulation of large scale IOT network
Write your own code
  • Create custom protocols using NetSim’s simulation API’s
  • Interface with other software products like MATLAB
  • Debug your code (step-in, step-out, step-over, continue) and watch your variables in sync with simulation
NetSim IOT features
  1. Create scenario , simulate and observe the performance of 6LoWPAN network
  2. Devices: Sensor Motes, 6LoWPAN Gateway, Routers, Switches, AP and Nodes can be used for the scenario building and simulation
  3. Data Link layer: Unslotted CSMA/CA, Slotted CSMA/CA, CCA
  4. Physical layer: Received Power Calculation, Fading, Shadowing, SINR calculation, BER calculation, Collision and error checking
  5. Sensor Mobility model, Sensing parameters, Packet generation, Packet Reception
  6. Radio Energy and Power Management
  7. Network layer can run both on IPV4 and IPv6
  8. Routing via AODV (RFC 3561), OLSR (RFC 3626), ZRP
  9. 6LoWPAN gateway will switch the packet from one network to another
  10. Facility to conduct various experiments for differing input / output parameters
  11. Input: Beacon Order, Super frame Order, Back off Exponent, Power Consumption, Battery life extension, CCA type, Receiver Sensitivity, ED Threshold, Channel Characteristics
  12. Output: Routing Overhead, Delay, Power Consumption, Lifetime of motes, Packet Delivery ratio, Routing Time, Actual Vs. Sensed path of agent

NetSim Emulator – Run live applications over virtual networks

Emulator_BlogWhat is a network emulator?
A NetSim emulator enables you to run real applications over virtual networks with wide selection of network conditions like error, delay, loss etc. Use of an emulator from development through pre-deployment phases obviates the need of redesigning, testing and tuning your applications, thus saving time, effort and eventually cost of setting up a network.

What you can do with NetSim Emulator?
• Network design and validation – Military radios, SCADA, Metro rail etc
• Application performance testing
• R&D in new protocol design
• Perform what-if analysis

What are the benefits of NetSim Emulator?
• Emulate a wide range of technologies – Switching, Routing, MANETs, Cognitive Radio networks, 4G-LTE networks, ZigBee networks
• A cost effective alternative to hardware emulators that have high costs and limited scale
• Reduced learning curve through agile testing in lab without complicated configuration

How does it work?
• Create the desired network in the Emulation server using NetSim GUI
• Run emulation client in the PC’s/VM’s where your live applications run
• Set the device IP addresses per the real PC/VM in the simulated network. Each live PC/VM corresponds to a node in the simulated network.
• Run your application and the emulation server
• Measure your application performance

You may view this introductory video on network emulation and how NetSim emulator works  https://www.youtube.com/watch?v=OwOw10LuYbQ

Static routing in NetSim

Static Routing

How to Setup Static Routes in RIP and OSPF

Step1 : In inter-networks, Static Routes can be set for any scenario having a minimum of 3 routers, 2 switches and 3 wired nodes. The easiest way to do this is to first run the scenario with routing protocol set as RIP/OSPF and save the Configuration file

Step 2 : Open the Configuration file with Visual studio. Expand the Router configuration and set the Static Routing information in Application Layer property of the device, by enabling the Static routing status. Then set the appropriate Static routing file name and file path.
RIP
By default:





Change to:





OSPF
By default:





Change to:





Note:
1. Update this information in any one of the router
2. A sample StaticRouting.txt file will be available inside “C:\Program Files\NetSim standard\Docs\Sample_Configuration\Internetworks”. Appropriately modify it for the scenario.
The StaticRouting.txt file contains
1. Device Id of the Router
2. List of entries to add in the routing table
DEVICE_ID:1
ip route 192.168.0.0 255.255.255.0 192.168.0.1 [1]
ip route 192.168.1.0 255.255.255.0 192.168.1.1 [1]
DEVICE_ID:2
ip route 192.168.2.0 255.255.255.0 192.168.2.1 [1]
ip route 192.168.3.0 255.255.255.0 192.168.3.1 [1]

The above format is per standard Cisco command for static routes
ip route dest_ip mask gateway_ip [distance ]

1. The ip route is the Cisco command to add the static route
2. The dest_ip is the Network address for the destination network
3. The mask is the Subnet mask for the destination network
4. The gateway_ip is the IP address of the next-hop router
5. The distance is the administrative distance for the route. The default is 1 .

Step 3 : After this, run this configuration file through CLI and static routes will be used for routing.

How to fail a node in NetSim

In this section we explain node failure using MANET-DSR as an example

Using Device Id, Identify the Device ID of the particular device.

The fn_NetSim_DSR_Run( ) is the main function to handle all the protocol functionalities

DSR_Run( )

strcpy(pszFilepath,pszIOPath);
strcat(pszFilepath,”/Output.txt”);
fp = fopen(pszFilepath,”r”);
i=0;
if(fp)
{
while(fgets(pszConfigInput,500,fp)!= NULL)
{
sscanf(pszConfigInput,”%d %d”,&NodeArray[i],&TimeArray[i]);
i+=1;
}
}

for(i=0;i<100;i++) if((pstruEventDetails->nDeviceId == NodeArray[i])&&(pstruEventDetails->dEventTime >= TimeArray[i]))
// Node failure happens after a value of time storted in an array
{ // This just returns instead of running DSR functionality when the node is failed
pstruEventDetails->nInterfaceId = 0;
return 0;
}

Note: Add the above lines of code after the variable declarations in the function
Build the .dll by clicking Build ->Build Solution. (The dll will be created inside the Visual studio project->Debug)

Running NetSim via Command Line Interface (CLI)

NetSim provides options to run simulations via the GUI or via CLI. The CLI mode is preferred for automated execution (batch processing) of simulations. This feature is available from v7 onwards. In v7, NetSim can be run via CLI for Internetworks, Advanced Wireless Networks – MANET, Wireless Sensor Networks, Personal Area Networks and Cognitive Radio Networks only. For other networks NetSim v7 can only be run via GUI

Prior to running NetSim through command line interface (CLI), users must understand the following –
Step 1: App Path
App path is the file location in the system in which the NetSim7.0 has been installed.
The app path can be found out by right clicking the NetSim Shortcut in the desktop and selecting Open file location (In Vista and Windows 7) or Find Target (In Windows XP). The app path will be something like “C:\Program Files\NetSim Standard\bin”, depending on where NetSim is installed. The path to the bin folder of NetSim is termed as the app path.
Step 2: IO Path
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 iopath is
%temp%/NetSim.  The Configuration.xml file for the scenrio to be simulated should be kept here prior to running the simulation. Note that the IO path must have write permission.
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. For floating/roaming licenses, type the following in the command prompt

>NetSimCore.exe<space> -apppath<space><app path><space>-iopath<space><io path><space> -license<space>5053@<Server IP Address>

Where,
<app path> contains all files of NetSim including NetSimCore.exe
<iopath> contains Configuration.xml and 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.

Sample configuration.xml files are available for Internetworks and Cognitive Radio Networks in the <apppath>/Docs/Sample_Configurations folder of the NetSim install directory. Rename the sample file as “Configuration.xml” before running NetSim through CLI. Depending on your system setting, the extension (.xml) might be implicitly present and not visible. In such cases do not add the extension, as that will cause the file to be named as configuration.xml.xml.

For node-locked licenses, type the following in the command prompt

>NetSimCore.exe<space> -apppath<space><app path><space>-iopath<space><io path><space>

Once Simulation is completed successfully and the metircs files that are requested by the end user in Configuration.xml will be written in the iopath. If any of the folder names contains white space, then mention the folder path within double quotes while specifying the folder name in the command prompt.

To know more about the options that are available to run NetSim via CLI, type the following in the command prompt.
>cd <app path>
>NetSimCore.exe -h

Adding Metric Variables in NetSim

There are two ways for you to get new Metrics in NetSim.

Option 1 (Easy): To get a “derived metric” from the existing NetSim output variables, then enable the packet trace & event trace and save them as XL files. Then use the XL UI or write VB scripts to get your derived metrics.

Option 2 (Hard): To get a completely new metric code will need to added in NetSim. An example is given below where new metrics have been added for LEACH (a new modification on the original DSR and code is available in a earlier blog entry) code,

Data_Packet_Received_PL is a new variable that has been defined in 802.15.4.h

#else

_declspec(dllimport) POWER** pstruDevicePower;

//For LEACH/Data Metrics
// Array size is 101 since maximum number of sensors is 100 and 1 for sink

_declspec(dllimport) int Data_Packet_Sent_NWL[101] ;
_declspec(dllimport) int Data_Packet_Received_NWL[10] ;
_declspec(dllimport) int Data_Packet_Sent_PL[101] ;
_declspec(dllimport) int Data_Packet_Received_PL[101] ;
_declspec(dllimport) double Lifetime[101];
#endif

This is used in packetprocessing.c in the section

#ifdef _LEACH
fn_NetSim_LEACH_GetNextHop(pstruEventDetails);
if(pstruEventDetails->nDeviceId == pstruEventDetails->pPacket->nSourceId)
Data_Packet_Sent_NWL[pstruEventDetails->nDeviceId-1] += 1;
return 1;
#endif
#ifdef _LEACH

This variable after having been updated during the simulation in the section above, is finally printed in DSR.c as shown below

_declspec(dllexport) int fn_NetSim_DSR_Metrics(char* filename)
{
//This #ifdef…..#endif block defines the LEACH Metrics, which shows the packets
//sent and received by the Network Layer and the Physicaal Layer
//To enable LEACH, uncomment the line “#define _LEACH” in DSR.h
#ifdef _LEACH
FILE* fp;
int i;
fp=fopen(filename,”a+”);
fprintf(fp,”#LEACH Metrics\n”);
fprintf(fp,”DeviceID\tData Sent(Network Layer)\tData Sent(Physical Layer)\tData Received(Network Layer)\tData Received(Physical Layer)\tLifetime(sec)\n”);
for(i=0; i<NETWORK->nDeviceCount; i++)
{
fprintf(fp,”%d\t%d\t%d\t%d\t%d\t%f\n”,NETWORK->ppstruDeviceList[i]->nDeviceId,Data_Packet_Sent_NWL[NETWORK->ppstruDeviceList[i]->nDeviceId-1],Data_Packet_Sent_PL[NETWORK->ppstruDeviceList[i]->nDeviceId-1],Data_Packet_Received_NWL[NETWORK->ppstruDeviceList[i]->nDeviceId-1],Data_Packet_Received_PL[NETWORK->ppstruDeviceList[i]->nDeviceId-1],Lifetime[NETWORK->ppstruDeviceList[i]->nDeviceId-1]/1000000);
}
fclose(fp);
#endif
return fn_NetSim_DSR_Metrics_F(filename);
}

If you face difficulty debugging code, please read the section in NetSim Help “Debugging when running NetSim via CLI (Only for Internetworks, Cognitive Radio
networks, MANET, Wireless Sensor Networks and Personal Area Network)”. Also ensure you are running as Visual studio in the administrator mode

Programming a SinkHole Attack in MANET

Introduction

SinkHole attacks are one of the intrusion attacks that a MANET faces. In a SinkHole attack, the intruder node/malicious node sends fake routing information claiming that it has an optimum route to the target which causes other nodes in the Ad Hoc Network to route data packets through it. Thus, the malicious node gets access to all the traffic and is free to tamper the data as it wishes. In this example, we show how to implement a SinkHole attack on Manet running the DSR routing Protocol using Netsim by a simple modification of the DSR Protocol source code.

Code Modification

We create a file Malicious.c in which we write the following  three functions.

int fn_NetSim_DSR_MaliciousNode(NetSim_EVENTDETAILS* ); — This function returns 1 if the current Device is the Malicious node that we have set.

int fn_NetSim_DSR_MaliciousRouteAddToCache(NetSim_EVENTDETAILS* ,DSR_PRIMITIVES* ); — This function adds the route from the current node to the target in the current nodes’ route cache.

int n_NetSim_DSR_MaliciousProcessSourceRouteOption(NetSim_EVENTDETAILS * ,DSR_PRIMITIVES* ); — This function receives the data packet from the transmitting node, sends an acknowledge request and then receives the data.

In the existing file DSR.c, in the case ctrlPacket_Route_Request in Network_In_Event, we add a false route from the present node to target in the route cache of a malicious node. Thus the malicious node will send a fake route reply. In the default case of a data packet, the malicious node will receive the data packet and then it generates an acknowledge request.

Source Code 

The following files are attached:

Visit: www.tetcos.com E-Mail: sales@tetcos.com

Accessing protocol metrics when writing custom code in NetSim

Given below is a brief example of how users can access NetSim protocol / device metrics when writing custom code. This example is based on DSR protocol in NetSim v7.1

The various DSR metrics are available in the DSR.h file, under the following structures –

struct stru_DSR_DeviceVar
{
unsigned int nRREQIdentification;
struct stru_DSR_RouteCache* pstruRouteCache;
struct stru_DSR_SendBuffer* pstruSendBuffer;
struct stru_DSR_RouteRequestTable* pstruRREQTable;
enum
{
LINK_LAYER_ACK,
NETWORK_LAYER_ACK,
}AckType;
DSR_MAINT_BUFFER* pstruMaintBuffer;
struct stru_DSR_Metrics dsrMetrics;   // This structure is defined below
};

struct stru_DSR_Metrics
{
unsigned int rreqSent;
unsigned int rreqForwarded;
unsigned int rrepSent;
unsigned int rrepForwarded;
unsigned int rerrSent;
unsigned int rerrForwarded;
unsigned int routeBreak;
unsigned int packetTransmitted;
unsigned int packetOrginated;
unsigned int packetReceived;
unsigned int packetDropped;
};

These have been type def’ed for ease of use and you can add the following code in DSR.c in fn_NetSim_DSR_Run() to get packets received

// CODE TO BE ADDED

DSR_DEVICE_VAR* device1 =  DSR_DEV_VAR(1)

/* Enter the device ID whose metrics you need. The ID of present device being executed can be got by pstruEventDetails>nDeviceID */

printf(“%d”,device1->dsrMetrics.packetReceived);

/* Similarly you can access different metrics for each of the devices */

// END OF CODE

Note that

printf(“%d\n”,devVar1->dsrMetrics.rreqSent);  //  Writes to log file available in the I/O path where the configuration file is present

fprintf(stderr,”%d\n”,devVar1->dsrMetrics.rreqSent); // Writes to command prompt.

WSN LEACH Protocol — User Contributed Code

To implement LEACH in WSN, all the sensors in the network are divided into different Clusters. For this implementation, we have used 4 clusters. The clusters are fixed in the sense that its members don’t change over time.

Each cluster has a sensor which acts as a Cluster Head (CH). The sensor with the maximum remaining energy is selected as the Cluster Head. The Cluster Head changes after some fixed number of packet receptions, which in this case is taken as 4.

The member sensors in the cluster communicate only with the Cluster Head. The sensors transmit their packets directly to the Cluster Head in a single hop. The Cluster Head, in turn, forwards these packets to the Sink either directly or via other Cluster Heads. The route from the Cluster Head to the sink has been defined as static routes.

Source Files:

Netsim’s default WSN libraries only have AoDV and DSR in layer 3. To run LEACH protocol, a few changes have been made in some of the files in DSR dll and Zigbee dll, and a new file LEACH.c containing the LEACH function is added.

A new DSR.dll should be built and placed in NetSim’s bin path. For this follow instructions provided in NetSim’s help on how to write custom code. For this new DSR dll to run LEACH, copy the following files in DSR dll

  • LEACH.c
  • StaticARP.c
  • DSR.h
  • DSR.c
  • PacketProcessing.c
  • SourceRoute.c

Follow a similar procedure for Zigbee dll by including the following files:

  • 802_15_4.h
  • 802_15_4.c
  • Sensor.c
  • ChangeRadioState.c
  • AgentModel.c

Next, to enable LEACH, uncomment the line “#define _LEACH” at the beginning of the DSR.h file. Next, to enable Static ARP, uncomment the “#define _STATIC_ARP” line in the same DSR.h file. This is done to prevent loss of power / time in setting up the ARP table initially.

Now, rebuild the DSR dll and Zigbee dll using Visual Studio, and copy the updated dlls in the Bin folder of NetSim.

Implementation Logic:

For running LEACH, we have divided the network into 4 clusters. The sensor with the maximum energy is selected as the cluster head, and is updated after every 4 packet transmissions by the cluster head.

Since we are using Static ARP, the nodes do not need to send ARP control packets. Packet transmission can start immediately.

The sensors generate the first packet at a random time less than the sensing interval. After that each sensor generates a packet after every sensing interval.

Static routes have been defined between the Cluster heads as given below:

  • Cluster Head 1            Cluster Head 3            Sink
  • Cluster Head 2            Cluster Head 4            Sink
  • Cluster Head 3            Sink
  • Cluster Head 4            Sink

When a Network Out event is generated, the nodes just need to identify the next hop. The next hop is selected in the following manner:

  • First of all, it checks whether the Device ID is the same as the Source ID to determine whether the present node is the source or an intermediate node.
  • If the node itself is the source, then the next hop is the Cluster Head of that cluster.
  • If the current node is not the source, then it must be the cluster head when the packet was forwarded to it by the source or the previous cluster head. It then checks its cluster number. Then the next hop is selected according to the static routes mentioned above.

Similarly, when a Network In event is generated, the node checks whether it’s Device ID is the same as the Destination ID. If not, it generates a Network Out event which again finds the next hop as explained previously. If it is the Destination, then a Transport In event is created.

Source Codes are attached below

Zigbee — Source C Code

DSR — Source C Code

Visit: www.tetcos.com Email: sales@tetcos.com

 

TETCOS Releases NetSim v7.1

TETCOS is pleased to announce the latest release of Network Simulation Software, NetSim v7.1, which comes with several exciting features including:
  • Network Emulator add-on module
    • Allows you to connect real systems running live applications to the emulator
    • Application traffic is transmitted through the simulator and real metrics are calculated
  • Packet animator
    • Animates packet flow over wired and wireless links
    • Color variation for control, data and error packets
    • Play, pause and speed controls and node movement
  • MANET – AoDV protocol per IETF RFC 3561
  • 802.11 n and 802.11 e additions to the existing W-LAN suite of 11 a, b and g
    • Phy channel models with pathloss shadowing & fading, power and BER models
    • MAC throughput of upto 600 Mbps
    • OFDM transmission type and MIMO antennas
    • Four spatial streams
  • Special NetSim code utilities are shipped along with with necessary help and config files for:
    • Low Energy Adaptive Clustering Hierarchy (LEACH) with inter and intra clustering routing for Wireless Sensor Networks
    • Node failure and reliability in MANETs
    • Spectrum Management in Cognitive Radio Networks

NetSim Simplifies Custom Code Development

Most simulation software demand considerable knowledge of the tool by the users before starting to develop code. This is a daunting task. An objective of NetSim is to make code modification and development simpler with a much shorter learning curve. Here are three simple steps on how to start customization of code.
Example: Printing “Hello world” inside NetSim’s TCP protocol.Step 1: Set up your project: Set your compiler such that your project code compiles into a Dynamic Link Library (DLL).Step 2: Copy source code: NetSim’s installation directory contains the source code for all protocols in folder ../NetSim/Simulation/src Copy paste the following files:
a. Header files related to TCP from the path ../src/simulation/include
b. Lib files related to TCP from the path ../src/simulation/lib
c. Source files related to TCP from the path ../src/Simulation/tcp
Step 3: Modify code and replace the binary: Open TCP.c and write the Hello World print statement just after the TCP init function. Then build your code and replace the existing binary of NetSim (libTCP.dll in../NetSim/Simulation/bin) with your libTCP.dll. Next, run a simulation you would see “Hello World” in command line.
Watch this video to see how to write custom code in NetSim

NetSim v7 — Batch Processing

NetSim batch processing allows users to execute of a series of simulations without manual intervention.

Consider the example, where a user wishes to create and simulate thousands of network scenarios and store and analyze the performance metrics of each simulation run. It is impossible to do this manually using the GUI. However, this can be done by writing a batch processing program which runs NetSim via CLI.

An example C program for batch processing of NetSim is available with us and existing customers of NetSim v7 can write to us for a copy. This batch program can be customized by users as desired.

Given below are important sections of the source code of this batch program.

#define apppath “C:\\Program Files (x86)\\NetSim pro7\\bin” // change to your app path
#define iopath “F:\\NetSim_Batch_Processing”                   // change to your IO Path
#define license “5053@192.168.0.10”                             // change to where your license server is running

main ( )
{
{// iterate from MIN to MAX for all of the devices to create configuration files
If { /* If certain network validation conditions are not met write the name of configuration file to                           NetSim_Batch_Log.txt. This file contains all the config files that did not meet the
necessary validation conditions and were not created during the batch execution */
}
Else {
//Create configuration file
fnCreateNetworkConfiguration(fpConfigurationFilePointer);
fnCreateSimulationParameter(fpConfigurationFilePointer);
fnCreateStatisticsCollection(fpConfigurationFilePointer);
}

      } // End of creation of all config files

Create batch file RunAll.bat
// Loop over number of configuration files, call NetSim executable which will write the output files
Run the batch file RunAll.bat
} // Main end

 

TETCOS Releases NetSim v7

TETCOS is pleased to announce the latest release of Network Simulation Software, NetSim v7, which comes with several exciting features including:

  • Cognitive Radio per IEEE 802.22
    • MAC Layer Control plane: TDD, Super Frame, DS-MAP, US-MAP, BW Request, Quiet Period, and Normal mode operation
    • MAC Layer Cognitive plane: Spectrum manager, Spectrum sensing function, Spectrum sensing automaton, Channel Modes
    • PHY layer: OFDMA
    • Incumbent model with incumbent detection and channel switching
  • Internetworks with combined LAN, WAN and Wireless modeling
    • Phy channel models with pathloss shadowing & fading, Power models and BER models in L1
    • Ethernet Switching, WLAN (802.11 a, b and g) in L2
    • IP, Queue Scheduling in L3
    • TCP, UDP in L4
    • RIP, OSPF Routing modules with Video, Voice, FTP, DB and Custom Traffic in L5
  • NetSim Command Line Interface (CLI)
    • Use a more concise and powerful means of control
    • Run batch simulations with automated scripts
    • Model via xml based config fil

Click on the image to enlarge

Network Stack

NetSim v7 features a virtual implementation of the protocol stack thereby providing closer to real world modeling and analysis capability. The network stack features an in-built config file parser, error handler, config error logger, memory manager, metrics module and modularized in IN and OUT events for layered protocol implementation.


Click on the image to enlarge

Please contact us for more information about functionality or pricing, or to arrange a demonstration.e

Case Study: WSN Term Project at IIT-M with NetSim

Wireless Sensor Networks (WSN) is an active area of research and given below is a case study of a WSN term project done at Indian Institute of Technology (IIT) Madras using NetSim, titled “Estimation of Carrier Sense Range and its effect on IEEE 802.15.4 Sensor Networks”

Challenge

  • Building probability models: The attenuation of IEEE 802.15.4 signals was to be observed and probability models for decoding range and carrier sense range were to be developed.
  • Estimating decoding range: This is the threshold below which packets sent from the transmitter are always received, and was to be estimated in terms of the probability that two devices separated by a distance are in decoding range.
         
Use Case
  • Developing custom code: Source C files, Sensor.c, CheckRoute.c and CCA.c of NetSim WSN library were modified. These codes were linked and debugged using NetSim’s project work environment.
  • Modeling network configurations: Custom Sensor network configurations were created using NetSim’s XML based network configuration files
  • Generating performance metrics: Packet and event traces were used for analyzing network performance metrics such as Throughput, Probability of packet discard, Average service rate and Mean Backoff duration
Results
  • Creating dependency graphs

  • These are directed graphs representing the probability of link establishment between sensors.These graphs were generated by sampling the probability model for each link.
  • Statistically analyzing performance: Variation in network performance, from simulation, for different dependency graphs were plotted for the 10 most likely and 10 least likely DG’s
  • Establishing confidence interval: This provides the probability that a network will operate in a corresponding range. The confidence interval for operation of the 802.15.4 Wireless Sensor network with limits of performance, i.e. throughput and packet failure probability, was established.
The complete report (1.3 Mb) is available at http://tetcos.com/WSN_Project_Report_IITM.pdf

Simulation of 802.22 Cognitive Radio Networks with NetSim

IEEE 802.22 Wireless Regional Area Networks (WRANs) are designed to provide broadband access to data networks. The WRAN systems will use vacant channels in the VHF and UHF bands allocated to the Television Broadcasting Service in the frequency range between 54 MHz and 862 MHz while avoiding interference to the broadcast incumbents in these bands.

NetSim v7, expected to be released in April, covers simulation of 802.22 WRAN based cognitive radio networks featuring: MAC layer model containing Super frame, DS-MAP, US-MAP, BW request, Quiet period and Normal mode operation

  1. PHY layer operating through OFDMA.
  2. CR Base station with interfaces to connect with Switch or Router and CPE’s  with a Max 512 CPE’s in each BS
  3. UGS, nrtPS, rtPS and BE QoS classes
  4. Incumbent model, Incumbent detection and channel switching
  5. Connection establishment via CID consisting of a 9-bit station ID (SID) and a 3-bit flow ID (FID).
  6. The cognitive plane consisting of Spectrum Manager, Spectrum Sensing Function, Spectrum Sensing Automaton, Channel Model.


802.22 Primitives with source C Code
The following protocol functionalities are available with source C code for extending existing algorithms: Transmit_SCH, Transmit_FCH, Transmit_DS_MAP, Transmit_US_MAP, Request_BW, Access_Phy_OFDMA, Spectrum_Manager, Spectrum_Sensing_Fn, Spectrum_Sensing_Automation, apart from various Channel_models

Metrics
Network metrics such as Network Throughput, Packet Delay plus CR specific metrics such as throughputs for each QoS class, incumbent detection rate, channel switching rate etc are available.
Packet Trace & Event Trace for CR simulations are also available for performance validation, statistical analysis and custom code de-bugging.

 

NetSim: Packet Trace and Event Trace

NetSim allows users to generate trace files which provide detailed packet & event information useful for performance validation, statistical analysis and custom code de-bugging. The two traces that can be logged in NetSim are:

1. The Event trace: This records every single event along with associated information such as time stamp, event ID, event type etc.

2. The Packet trace: This logs a set of chosen parameters for every packet as it flows through the network such as arrival times, queuing times, departure times, payload, overhead, errors, collisions etc.

How is the trace useful?

a. Learn protocol internals: 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.

bLog chosen parameters: NetSim’s trace option features a checkbox based filter where users can select only those packet / event level parameters / information which they want to log.

c. Import easily into spread sheets: Tab ordering enables the trace data to be imported into spreadsheets programs such as excel with ease for statistical analysis. Further, the events / packets are printed per line and have a unique ID and time stamp. This enables users to quickly write custom scripts to parse, inspect, plot and analyze protocol parameters.

d. Debug custom protocol implementations: Users need diagnostics that can catch logical errors without having to set a lot of breakpoints or restarting the program often. A host of information is available in the trace files and in addition the event trace has two special information fields for diagnostics a) A log of the file name and line number from where the event was generated and b) Future event (s) generated while processing the current event.

How to turn on the tracing options

By default, the packet tracing option is turned off. Users can edit the config file and “enable” packet-trace, or users can turn them on using the trace button in the UI. Event-traces are “always-on” and are available with our kernel’s debug library.

 

NetSim – A look at the simulation config file

Sophisticated users model their simulation via a config file that is independent of the GUI. The config file contains all required information to run the simulation including the network topology, devices, links, traffic, statistics, traces etc. Given below are important features of NetSim’s config file:

Model in XML format

Unlike, traditional simulators that use a flat text file, NetSim uses XML format given its advantages.

a. Quicker Understanding: It is easier to understand what the document holds at a glance and has moreprecise declarations of content allowing for more meaningful search results

b. Better Presentation: XML enables the separation of presentation from data and is suitable as a description for complex hierarchical data as is typical in a simulation config file

c. Automatic Format Verification: MSVC allows you to switch between XML view and Data View, and helps to locate syntax error. The schema we provide along with enables statement completion feature, as well as an option to validate the XML data.

Mirror Real Networks

Various network technologies are supported including LAN, WAN, PAN, WSN, Mobile, Cellular, Wireless and Inter-network.

Devices are modeled per the 5 layer TCP / IP stack. Users can set protocol properties in each of these layers in all devices.

Traffic can be configured as applications like FTP, Database, Voice, Video etc. Further, lower level mathematical distributions are available for packet size and inter-arrival time for users to model custom apps.

And finally, the config file provides a simple interface for linking external libraries.

Log traces and analyze metrics

The config file allows you to choose end-to-end metrics you wish to analyze and traces you want to log. A range of statistics is available including throughput, utilization, delay, error, loss etc. The packet trace can be logged in .txt or .csv format and an event trace can be generated for those using our debug libraries.

TETCOS Releases NetSim v 6.2

TETCOS is pleased to announce the latest release of Network Simulation Software, NetSim ver 6.2, which comes with several new and exciting features. Given below is a quick snapshot:

All new license roaming

Increasingly, users want to take their work “on the road.” NetSim now provides built-in license roaming capability allowing users to check out a license from a server, physically disconnect from the server and continue to use the license for a period of 24 hours after which the license is automatically returned to the server when it expires on the mobile computer.

Additional platforms and java language support

v 6.2 has been tested on 32 and 64 bit Win OS: XP, Vista, 7 and beta tested on Win 8.

In addition to C & C++ with v6.2 NetSim programming exercises now support Java based user codes.

Easier coding – More API’s and simpler debug

Several API’s have been added  in the standard version. These include RIP’s Distance Vector algorithm, Periodic, Expiration and Garbage Timers and OSPF’s Hello Packets, LSA Packets, Designated Router Selection, LSDB Formation and Djikstra’s Algorithm

All codes now take install directory and windows temp folder as Command line arguments and NetSim programming exercises now allow you put break points in your code and de-bug in runtime

IIT Kharagpur Licenses NetSim

TETCOS is happy to announce the Indian Institute of Technology (IIT) Kharagpur has licensed NetSim.


IIT Kharagpur’s motivation to License NetSim

IIT Kharagpur evaluated several competitive & open source network simulators available. They focused on level of end-user friendliness, product flexibility and technical support. Flexibility was important since their students wanted to write, link and de-bug customized code for project work. Direct technical support from the developer (and not the distributor), in terms of on-site support, telephone and e-mail support, from experienced developers, was paramount to IIT Kharagpur. In both these aspects, NetSim stood out in comparison to other simulators.

Perpetual Floating License

IIT Kharagpur also wanted the perpetual floating license option available with NetSim. The floating license option offers several advantages. First, the NetSim client licenses are not tied to any one computer. Second, the license server is also not tied to any server / computer but rather tied to a USB / Parallel port dongle. And finally, any number of NetSim client installations can be carried out. Only simultaneous running of NetSim clients is checked against the number of licenses purchased.

This means there is no effort required to move the license to a new computer or even move the license server & clients to a completely new lab. The perpetual license implies that there is no expiry date on the licenses and that IIT Kharagpur can upgrade NetSim to newer releases.

Customers

It has taken Tetcos eight years to get our first IIT to license NetSim. We wanted to take a moment to thank all our customers and partners for making NetSim successful.

Today, over 250 institutions now actively use NetSim, including BITS Pilani: Hyderabad Campus, Delhi Technical University (previously DCE), NIT Rourkela, NIT Jamshedpur, NIT Suratkal, NIT Surat, NIT Bhopal, NIT Kurukshetra and NIT Durgapur.