| Applicable Versions | NetSim Standard | NetSim Pro |
| Applicable Releases | v11.0 | v12 | v13 |
Location Aware Routing (LAR):
Routing for an ad-hoc wireless network is challenging, many routing strategies have been proposed in the literature. With the availability of affordable Global Position System-equipped devices, Location-Aware Routing provides a promising foundation for developing an efficient and practical solution for routing in the ad-hoc wireless network.
Most Forward within Fixed Radius R (MFR):
MFR protocol is a geographic Location-Aware Routing protocol. MFR forwards packets to the neighbor nodes within a set radius of the current node (not the route source) that makes the most forward progress (or the least backward progress) along the line drawn from the current node to the destination. Progress is calculated as the cosine of the distance from the current node to the neighbor node projected back onto the line from the current node to the destination.
Figure: MFR Protocol Implementation
Here,
Real-Time Interaction in NetSim:
NetSim allows users to interact with the simulation at runtime via a socket or through a file. User Interactions make the simulation more realistic by allowing command execution to view/modify certain device parameters during runtime.
Python socket interface:
Python interfacing is a method to interface custom protocols like routing-based protocols with the NetSim engine. In this project, we input NetSimCore.exe with routes generated via our routing protocol i.e., Most Forward within Fixed Radius R (MFR) which is a geographic location-aware routing protocol. The interaction between the routing protocol and the NetSimCore.exe is happening via socket programming.
The Real-Time Interaction has to be turned ‘True’ before running the simulation of the scenario. This lets the NetSimCore.exe (server) to wait for the client (Python script) to connect using the socket port. After the connection is established, we compute the routes based on our custom MFR protocol. These routes are passed as static routes to the NetSimCore.exe server by the python script.
Python Script:
The code has been divided into 2 separate files: Socket programming code (socketInterface.py) and MFR protocol code (mfrProtocol.py). The protocols are written in a separate script file like here.
socketInterface.py:
route ADD 11.1.1.6 MASK 255.255.255.255 + _ipaddr(route[each+1]) + METRIC 1 IF 1
Here 11.1.1.6 is the Destination IP and 255.255.255.255 is the Subnet Mask to denote ‘all packets’ from the Source. The Metric is 1 and the Interface (IF) is also 1 as there is only one wireless interface.
mfrProtocol.py:
Wirless_Node_1 49.760000 100.160000
with open('device_log.txt','r') as f:
Note: The Transmission range is set to 110 based on the channel conditions and device properties for this example. This may vary if any network other than the one discussed in this example is considered.
Network Configuration:
A MANET network configuration with 6 Wireless nodes is considered for this example as shown below:

Note: In Netsim v12 and v13, the path loss exponent value is set to 3.8
Running Simulations using DSR:
S(N1) -> N3 -> N5 -> D(N6)
NetSim Packet Animation to visualize packet flow in the network:

Procedure to perform routing using python interface in NetSim:
S(N1) -> N3 -> N4 -> D(N6)
NetSim Packet Animation to visualize packet flow in the network:

Analyzing the device route tables in NetSim Results Dashboard:

The static route entry for N1(Wireless_Node_1 specifies the next hop as N3 (Wireless_Node_3) which has the IP 11.1.1.3.

The static route entry for N3 (Wireless_Node_3) specifies the next hop as N4 (Wireless_Node_4) which has the IP 11.1.1.4.

The static route entry for N4 (Wireless_Node_4) specifies the next hop as the destination node N6 (Wireless_Node_6) which has the IP 11.1.1.6.
Using NetSim Packet Trace to identify the route taken by packets from the source to the destination:
NetSim Packet trace log file can be obtained by enabling the packet trace option in NetSim GUI before running the simulation.
Upon running the simulation with packet trace enabled, the packet trace log file can be accessed from the NetSim Results Window using the Open Packet Trace link.
Once the packet trace log file is loaded you can filter a specific packet id in the PACKET_ID column to view the path that the packet has taken.
Upon filtering the Packet with id 1, we can observe the following in the packet trace:
In the case of DSR:
In the case of MFR: