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

Discrete Event Simulation and Event Programming in NetSim

The entire source code of NetSim is based on Event Programming since NetSim is a Discrete Event Simulator (DES)

Discrete-event simulation (DES), models the operation of a system as a discrete sequence of events in time. Each event occurs at a particular instant in time and marks a change of state in the system. Between consecutive events, no change in the system is assumed to occur; thus the simulation can directly jump in time from one event to the next.

Event-driven programming is a programming paradigm where flow of program is determined by different events. Thus, Event Programming is the favored method of coding a DES.

In NetSim there are different specific events and its sub-events
and the simulation kernel does the entire event handling. While, inserting an event into the kernel its event time should be mentioned since all events are executed in increasing order of their event time.

The link http://tetcos.com/netsim_gen.html explains in detail how to model, run, visualize and analyze a Discrete Event Simulation of various networks.

NetSim wins award at IEEE COMSNETS 2015

We are happy to announce that NetSim was awarded the best demo runner up at COMSNETS 2015.

Coms

COMSNETS is a premier international conference dedicated to advances in Networking and Communications Systems. COMSNETS 2015 (Jan 6 – 10) featured a “Demos and Exhibits” session designed to allow start-ups, industries and researchers to showcase their latest industrial applications and research prototypes in all communications and networking related topics.

Beta version of NetSim v8.2 simulator and NetSim emulator were featured at COMSNETS. The emulator allows for connecting of real hardware running live applications to NetSim Simulator. The demo included emulation of video streams over wireless  (Wi-fi, LTE, Cognitive Radio etc) networks and compared source & destination streams (after simulating impairments via NetSim simulator). The packet captures of the two streams were available in hex format and difference between the captured packets & re-injected packets, after the network effects, were shown

image1764848

 

Saastra University Leverages NetSim for Research on Securing Femtocells

Femtocells have been proposed as solution for high-speed mobile network (i.e. LTE) bandwidth requirements. In this paper, researchers try to identify and mitigate a possible attack in femtocells where locational information about a femtocell user is disclosed

Challenge

Developing the Multihop Algorithm for privacy: An algorithm is to be developed to provide privacy to the sender which would require no additional hardware.

Simulating and Analyzing the algorithm: This algorithm should then be implemented into the device code, simulated and analyzed for performance.

Use Case

Developing custom code: Source C files, Cellular.c, GSM.c, Handover.c and GSM_Channel.c of NetSim’s GSM library were modified . These codes were linked and debugged using NetSim’s project work environment.

Modeling network configurations: Custom network configurations were created using NetSim’s XML based network configuration files. Alcatel Lucent home cell v2 was modeled with a radius of 25 meters and with 15 users.

Generating performance metrics: Packet and event traces were used for calculating the sought network performance metrics namely, Average Number of Reflections, and Average Time Spent in Femto Cell.

Results

Statistically analyzing performance: Since the trade off of the algorithm was increased delay, this was studied and found to be approx 50 ms, which could be afforded by the network architecture
“We chose NetSim given its extensive R & D capabilities in MANETs, WSNs, Cognitive Radio Networks and Cellular networks. NetSim has an easy to use UI for creating scenarios and modeling protocol & device parameters. The protocol library source codes are written in C and easily understandable. NetSim’s product features and quick support from their technical team makes it easier to simulate complex networking protocols which results in publishing quality research articles”
Sriram
Dr.V.S.Shankar Sriram,
SAASTRA University, Thanjavur
The published research paper is available at http://tetcos.com/downloads/Femto_Cell.pdf 

Please contact us for more information about functionality or pricing, or to arrange a demonstration.                                 Email: sales@tetcos.com, Visit: www.tetcos.com

Simulation of LTE Networks in NetSim

LTE, an acronym for Long Term Evolution, commonly known as 4G LTE, is a standard for wireless communication of high-speed data for mobile phones and data terminals. It is based on the GSM/EDGE and UMTS/HSPA network technologies, increasing the capacity and speed using a different radio interface together with core network improvements.

  • NetSim LTE implementation is per 3GPP TS 36.xxx standards covering
  • Devices – User Equipment (UE), E-UTRAN Node B (eNB), Mobility Management Entity (MME)
  • Protocol Stack covering NAS (Non access stratum), PDCP (Packet data convergence protocol), RRC (Radio resource control), RLC (Radio link control), Concatenation
  • LTE MAC
  1. Mapping between logical channels and transport channels
  2. Multiplexing of MAC SDUs from one or different logical channels onto transport blocks (TB)
  3. De multiplexing of MAC SDUs from one or different logical channels from transport blocks (TB)
  4. Priority handling between UEs by means of dynamic scheduling
  5. Priority handling between logical channels of one UE
  6. Logical Channel prioritization
  • LTE PHY – OFDM-MIMO Downlink and SC-FDMA uplink, CQI – SNR

LTE

The complete white paper explaining the implementation of LTE in NetSim and detailed comparison against NS-3 test suite is available at http://www.tetcos.com/LTE_Vertification_v8.pdf

LTE is available with NetSim v8 which is expected to be shipped from mid august ’14.

Please contact us for more information about functionality or pricing, or to arrange a demonstration. Email: sales@tetcos.com, Visit: www.tetcos.com

Simulation of 802.11n and 802.11 ac based networks in NetSim

802.11n is an amendment to the IEEE 802.11 wireless networking standards to improve network throughput over the two previous standards—802.11a and 802.11g—with a significant increase in the maximum net data rate from 54 Mbps to 600 Mbps.

IEEE 802.11ac is the fifth generation in Wi-Fi networking standards and will bring fast, high quality video streaming with dramatic improvements in transmission speeds. Entry-level IEEE 802.11ac products will provide a data rate of 433 Mbps, which is at least three times faster than IEEE 802.11n and high-speed IEEE 802.11ac devices will offer wireless transmission in excess of 1 Gbps.
Network_Scenario
802.11n and 802.11 ac features in NetSim v8 (Beta)

Comparison_11n_11ac
Source C codes for 802.11 n and 802.11 ac are provided along with for user modifications

Please contact us for more information about functionality or pricing, or to arrange a demonstration.
(Visit: www.tetcos.com, email: sales@tetcos.com, Ph: + 91 80 2663 0624)

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

 

The “Virtual” Network Stack in NetSim v7

The Network stack is an implementation of the computer networking protocol suite. NetSim v7 features a virtual implementation of the protocol stack thereby providing closer to real world modeling and analysis capability.
The stack is a five layer TCP/IP design, with modularized IN and OUT events for layered protocol implementation, and a set of clean and well organized interfaces. The network stack also features in-built config file parser, error handler, config error logger, memory manager and metrics module.
NetSim’s virtual stack interfaces with network protocols which are modeled as Finite State Machines (FSM) and the simulation kernel which is a discrete event engine accelerated by a heuristic algorithm.NetSim v7 stack features application programming interfaces at multiple points for custom code development:

  • Network stack API’s – for designing new layers and for cross layer optimization
  • Metrics API’s – for developing new statistical measures
Apart from these API’s, protocol source code is available for designing custom protocols or extending standards-based protocols.

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