Applicable VersionsNetSim StandardNetSim Pro


Applicable Releasesv12v13


Received Power and position coordinates of vehicles in a VANET network scenario can be logged into a text or CSV file and accessed from the results dashboardNetSim. 


This involves modifying the source codes of the PHY layer protocol IEEE802.11 as explained below:


1. Create a new workspace, where users can modify the underlying source code of NetSim as is typically in research applications. The modified code will be saved in that workspace.
2. Open NetSim homepage click on Your Work (Open Simulation in v12.2) option,
 
 
3. Click on Workspace options
 
 
4. Click on More Options,
 
5. Click on New,
6. A New Workspace pop-up window appears, where you can input the Workspace Name, Description, and Workspace Path (where you want to create a new workspace). This is shown below.

Network Setup:

 
Chart, line chart 
Description automatically generated
Network diagram consists of two-vehicle nodes and we have set up the CBR traffic flow between Vehicle_1 and Vehicle_2

Code modification to get the Signal Strength for each node

Steps:
1. Click on Open Code
2. Open IEEE 802.11 project, Click on IEEE802_11.c file and go the function fn_NetSim_IEEE802_11_Init() and add the lines of code that is highlighted in the screenshot.
char s[BUFSIZ];
sprintf(s, "%s\\%s", pszIOLogPath, "Rx_Power_log.csv");
FILE* fp = fopen(s, "w+");
if (fp)

fprintf(fp, "Packet_ID, Application_ID, Transmitter_ID, Tx_X, Tx_Y, Reciever_ID, Rx_X, Rx_Y, Rx_Power\n");

fclose(fp);
}
3. Open the IEEE802_11_Phy.c file, go to the function fn_NetSim_IEEE802_11_PhyIn() and add the lines of code that is highlighted in the screenshot.
char s[BUFSIZ];
sprintf(s, "%s\\%s", pszIOLogPath, "Rx_Power_log.csv");
FILE* fp = fopen(s, "a+");
if (fp)
{
fprintf(fp, "%d, %d, %d, %lf, %lf, %d, %lf, %lf, %lf\n", packet->nPacketId, pstruEventDetails->nApplicationId, 
packet->nTransmitterId, DEVICE_POSITION(packet->nTransmitterId)->X, DEVICE_POSITION(packet->nTransmitterId)->Y, packet->nReceiverId, DEVICE_POSITION(packet->nReceiverId)->X, DEVICE_POSITION(packet->nReceiverId)->Y, pdbm);
fclose(fp);
}

     
4. After adding the lines, rebuild the IEEE802_11 project. This will update the IEEE802.11 DLL's in the bin directory.
5. Now go to the Vanet Network GUI click on the Run button present on the top ribbon, now simulation will start and after completion of simulation two new windows will come up then open the Simulation result window.
6. Click on log files, it is present on the left bottom side of the result window. Show in the screenshot below:
 
7. Click on Rx_Power_log.csv file. You can filter the Packet_ID to know the Signal strength of each packet. Similarly, the Receiver ID or Transmitter id can be filtered to get the device positions during each transmission. Simulation time can also be added to the log optionally.


Related articles:

how-can-parameters-associated-with-vehicles-be-retrieved-from-sumo-in-netsim-

how-to-obtain-a-log-of-receiver-sensitivity-received-power-and-phy-data-rate-for-802-11-based-simulations

how-to-integrate-sumo-for-5g-simulations-in-netsim-