Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

How can I plot SNR measured by UE?

: NetSim Support Portal

How can I plot SNR measured by UE?


Created by: NetSim SUPPORT TEAM
Modified on: Fri, 30 Nov, 2018 at 11:34 AM

SNR measured by UE can be logged into a single or a separate file and then be plotted as per your requirement.
Following is one such example where we log the SNR for each UE in a separate file with respect to each ENB along
with the event time.

i.Open NetSim source code in Visual Studio 2015 by double clicking on the NetSim.sln file present in
“<NetSim_Install_Directory>/src/Simulation” folder.
ii.Go to LTE project through the solution explorer and open the file LTE_Phy.c. Add the lines of code highlighted in
red as shown below:

#include "main.h"
#include "LTE.h"
#define devid(id) fn_NetSim_GetDeviceIdByConfigId(id)
NETSIM_ID fn_NetSim_LTE_FindNearesteNB(NETSIM_ID nDeviceId);
FILE* fp;
char snrlog[100];
int fn_NetSim_LTE_CalculateReceivedPower()
{
NETSIM_ID i;
//fp = fopen("LTE_UE_SNR.txt", "w+");
for(i=0;i<NETWORK->nDeviceCount;i++)
{
…………………………………………………………

if(ber<TARGET_BER)
break;
else
{
info->DLInfo[j].nCQIIndex--;
info->ULInfo[j].nCQIIndex--;
}
}
sprintf(snrlog, "LTE_UE_%d_SNR.csv", devid(info->nUEId));
fp = fopen(snrlog, "w+");
if (fp)
{
fprintf(fp, "UE_ID,ENB_ID,Time,SNR");
fclose(fp);
}
}
info=(LTE_ASSOCIATEUE_INFO*)LIST_NEXT(info);
}
} 
}
https://support.tetcos.com/support/solutions/articles/14000072645-how-can-i-plot-snr-measured-by-ue-
How can I plot SNR measured by UE? : NetSim Support Portal

return 1;
}

iii.In the file NAS.c add the lines of code highlighted in red as shown below:

#define MEASUREMENT_REPORT_SIZE 184/8.0


#define HO_REQUEST_SIZE 288/8.0
#define HO_CONFIRM_SIZE 112/8.0
#define HANDOVER_DIFF      3 //db
#define devid(id) fn_NetSim_GetDeviceIdByConfigId(id)
int fn_NetSim_LTE_InitHandover(NETSIM_ID ueId,NETSIM_ID nENBId)
{
//Prepare the measurement report
NetSim_PACKET* packet;
LTE_MAC_PACKET* macPacket;
LTE_PHY_PACKET* phyPacket;
LTE_MEASUREMENT_REPORT* report=NULL;
NETSIM_ID i;
FILE* fp=NULL;
char snrlog[100];
double dETime=0;
for(i=0;i<NETWORK->nDeviceCount;i++)
{
…………………………………………….

if(ber<TARGET_BER)
break;
else
{
info->DLInfo[j].nCQIIndex--;
info->ULInfo[j].nCQIIndex--;
}
}
temp->nCQIIndex_DL[j]=info->DLInfo[j].nCQIIndex;
temp->dSNR_DL[j]=info->DLInfo[j].dSNR;
sprintf(snrlog, "LTE_UE_%d_SNR.csv", devid(info->nUEId));
fp = fopen(snrlog, "a+");
dETime = pstruEventDetails->dEventTime;
if (fp)
{
fprintf(fp, "\n%d,%d,%lf,%lf",devid(info->nUEId),       devid(i+1), dETime, info->ULInfo[j].dSNR);
fclose(fp);
}
}
LIST_FREE((void**)&info,info);
LIST_ADD_LAST((void**)&report,temp);
}
}
iv.Now right click on LTE module in the solution explorer and select rebuild.
v.Upon successful build, you will get a new libLTE.dll file in the “<NetSim_Install_Directory>/src/Simulation/DLL” 
folder.
https://support.tetcos.com/support/solutions/articles/14000072645-how-can-i-plot-snr-measured-by-ue-
How can I plot SNR measured by UE? : NetSim Support Portal

vi.Copy this newly built DLL file and replace it in the bin folder of NetSim after you rename the original libLTE.dll
file which is already existing there(as a backup).
vii.Now on running any simulation in LTE, you will get individual SNR logs with respect to time for each UE, in the
bin folder of NetSim (“<NetSim_Install_Directory>/bin”) as shown below:

 
viii.These log files can be used to further plot the SNR of each UE with respect to time using excel plots.
 

N NetSim is the author of this solution article. 

https://support.tetcos.com/support/solutions/articles/14000072645-how-can-i-plot-snr-measured-by-ue-
How can I plot SNR measured by UE? : NetSim Support Portal

https://support.tetcos.com/support/solutions/articles/14000072645-how-can-i-plot-snr-measured-by-ue-

You might also like