The way to do this is,


1. Open NetSim.sln file from <NetSim Installation Directory>\src\Simulation  folder.

2. Open LTE_Phy.c file in the LTE project from the list of projects displayed in the Solution Explorer.

3. Perform the following modifications in the beginning of the file (lines shown in red):


For NetSim v9:


#include "main.h"

#include "LTE.h"

#define devid(id) fn_NetSim_GetDeviceIdByConfigId(id)

char* get_modulation(UINT);

NETSIM_ID fn_NetSim_LTE_FindNearesteNB(NETSIM_ID nDeviceId);

FILE* fp;

int fn_NetSim_LTE_CalculateReceivedPower()

{

 NETSIM_ID i;

 fp=fopen("LTE_PARAMETERSv9.txt","w+");

 fprintf(fp,"\nLTE_PARAMETERS\t\t\t\t\tLTE_PARAMETERS");

 fprintf(fp,"\n****************************\t\t\t****************************\n");

 fprintf(fp,"\nUPLINK\t\t\t\t\t\tDOWNLINK");

 fprintf(fp,"\n****************************\t\t\t****************************\n");

 for(i=0;i<NETWORK->nDeviceCount;i++)

 {

  if(NETWORK->ppstruDeviceList[i]->nDeviceType==eNB ||

   DEVICE_TYPE(i+1)==RELAY)

  {

   NETSIM_ID ifid=get_eNB_Interface(i+1);

   LTE_ENB_MAC* enbMac=(LTE_ENB_MAC*)DEVICE_MACVAR(i+1,ifid);

   LTE_ASSOCIATEUE_INFO* info=enbMac->associatedUEInfo;

   while(info)

   {

    unsigned int j;

    for(j=0;j<enbMac->ca_count;j++)

    {

     fn_NetSim_LTE_CalculateRxPower(i+1,ifid,info,j);

     fn_NetSim_LTE_CalculateSNR(i+1,ifid,info,j);

     fn_NetSim_LTE_GetCQIIndex(i+1,ifid,info,j);

     fn_NetSim_LTE_GetMCS_TBS_Index(info,j);

     while(info->DLInfo[j].nCQIIndex>1 && info->ULInfo[j].nCQIIndex>1)

     {

      double ber;

      fn_NetSim_LTE_GetMCS_TBS_Index(info,j);

      ber = fn_NetSim_LTE_CalculateBER(0,info->DLInfo[j].MCSIndex,info->DLInfo[j].dSNR);

      if(ber<TARGET_BER)

       break;

      else

      {

       info->DLInfo[j].nCQIIndex--;

       info->ULInfo[j].nCQIIndex--;

      }

     }

 

  fprintf(fp,"\nENB ID: %d\t\t\t\t\tENB ID: %d",i+1,i+1);

  fprintf(fp,"\nCARRIER ID: %u\t\t\t\t\tCARRIER ID: %u",j+1,j+1);

  fprintf(fp,"\nUE ID: %d\t\t\t\t\tUE Id: %d",devid(info->nUEId),info->nUEId);

  fprintf(fp,"\nSNR: %lf\t\t\t\t\tSNR: %lf",info->ULInfo[j].dSNR,info->DLInfo[j].dSNR);

 

  fprintf(fp,"\nCQI INDEX: %d\t\t\t\t\tCQI INDEX: %d",info->ULInfo[j].nCQIIndex,info->DLInfo[j].nCQIIndex);

 

  fprintf(fp,"\nMODULATION: %s\t\t\tMODULATION: %s",get_modulation(info->ULInfo[j].modulation),get_modulation(info->DLInfo[j].modulation));

 

  fprintf(fp,"\nMCS INDEX: %d\t\t\t\t\tMCS INDEX: %d",info->ULInfo[j].MCSIndex,info->DLInfo[j].MCSIndex);

 

  fprintf(fp,"\nTBS INDEX: %d\t\t\t\t\tTBS INDEX: %d",info->ULInfo[j].TBSIndex,info->DLInfo[j].TBSIndex);

  fprintf(fp,"\n****************************\t\t\t****************************\n");

 

    }

 

 

    info=(LTE_ASSOCIATEUE_INFO*)LIST_NEXT(info);

   }

  }

 }

 fclose(fp);

 return 1;

}

char* get_modulation(UINT modulation)

{

 char* mod="\0";

 

  switch(modulation)

  {

  case 0:

   mod="Modulation_QPSK";

   break;

  case 1:

   mod="Modulation_16QAM";

   break;

  case 2:

   mod="Modulation_64QAM";

   break;

  default:

   fprintf(stderr,"\nunknown modulation type\n");

   break;

  }

  return mod;

}


For NetSim v10:


#include "main.h"

#include "LTE.h"

#define devid(id) fn_NetSim_GetDeviceIdByConfigId(id)

char* get_modulation(UINT);

NETSIM_ID fn_NetSim_LTE_FindNearesteNB(NETSIM_ID nDeviceId);

FILE* fp;

int fn_NetSim_LTE_CalculateReceivedPower()

{

 NETSIM_ID i;

 fp=fopen("LTE_PARAMETERSv9.txt","w+");

 fprintf(fp,"\nLTE_PARAMETERS\t\t\t\t\tLTE_PARAMETERS");

 fprintf(fp,"\n****************************\t\t\t****************************\n");

 fprintf(fp,"\nUPLINK\t\t\t\t\t\tDOWNLINK");

 fprintf(fp,"\n****************************\t\t\t****************************\n");

 for(i=0;i<NETWORK->nDeviceCount;i++)

 {

  if(NETWORK->ppstruDeviceList[i]->nDeviceType==eNB ||

   DEVICE_TYPE(i+1)==RELAY)

  {

   NETSIM_ID ifid=get_eNB_Interface(i+1);

   LTE_ENB_MAC* enbMac=(LTE_ENB_MAC*)DEVICE_MACVAR(i+1,ifid);

   LTE_ASSOCIATEUE_INFO* info=enbMac->associatedUEInfo;

   while(info)

   {

    unsigned int j;

    for(j=0;j<enbMac->ca_count;j++)

    {

     fn_NetSim_LTE_CalculateRxPower(i+1,ifid,info,j);

     fn_NetSim_LTE_CalculateSNR(i+1,ifid,info,j);

     fn_NetSim_LTE_GetCQIIndex(i+1,ifid,info,j);

     fn_NetSim_LTE_GetMCS_TBS_Index(info,j);

     while(info->DLInfo[j].nCQIIndex>1 && info->ULInfo[j].nCQIIndex>1)

     {

      double ber;

      fn_NetSim_LTE_GetMCS_TBS_Index(info,j);

      ber = fn_NetSim_LTE_CalculateBER(0,info->DLInfo[j].MCSIndex,info->DLInfo[j].dSNR);

      if(ber<TARGET_BER)

       break;

      else

      {

       info->DLInfo[j].nCQIIndex--;

       info->ULInfo[j].nCQIIndex--;

      }

     }

 

  fprintf(fp,"\nENB ID: %d\t\t\t\t\tENB ID: %d",i+1,i+1);

  fprintf(fp,"\nCARRIER ID: %u\t\t\t\t\tCARRIER ID: %u",j+1,j+1);

  fprintf(fp,"\nUE ID: %d\t\t\t\t\tUE Id: %d",devid(info->nUEId),info->nUEId);

  fprintf(fp,"\nSNR: %lf\t\t\t\t\tSNR: %lf",info->ULInfo[j].dSNR,info->DLInfo[j].dSNR);

 

  fprintf(fp,"\nCQI INDEX: %d\t\t\t\t\tCQI INDEX: %d",info->ULInfo[j].nCQIIndex,info->DLInfo[j].nCQIIndex);

 

  fprintf(fp,"\nMODULATION: %s\t\t\tMODULATION: %s",get_modulation(info->ULInfo[j].modulation),get_modulation(info->DLInfo[j].modulation));

 

  fprintf(fp,"\nMCS INDEX: %d\t\t\t\t\tMCS INDEX: %d",info->ULInfo[j].MCSIndex,info->DLInfo[j].MCSIndex);

 

  fprintf(fp,"\nTBS INDEX: %d\t\t\t\t\tTBS INDEX: %d",info->ULInfo[j].TBSIndex,info->DLInfo[j].TBSIndex);

  fprintf(fp,"\n****************************\t\t\t****************************\n");

 

    }

 

 

    info=(LTE_ASSOCIATEUE_INFO*)LIST_NEXT(info);

   }

  }

 }

 fclose(fp);

 return 1;

}

char* get_modulation(UINT modulation)

{

 char* mod="\0";

 

  switch(modulation)

  {

  case 5:

   mod="Modulation_QPSK";

   break;

  case 6:

   mod="Modulation_16QAM";

   break;

  case 7:

   mod="Modulation_64QAM";

   break;

  default:

   fprintf(stderr,"\nunknown modulation type\n");

   break;

  }

  return mod;

}


4. After performing the modifications, right click on LTE project and select Rebuild.

5. Replace the newly built libLTE.dll in <NetSim Installation Directory>\bin folder after renaming the original libLTE.dll.

6. Now create a NetSim scenario in LTE network.

7. Run the scenario.


The SNR, CQI, MCS Index and TBS Index will be written to a file named LTE_PARAMETERS.txt inside the bin folder of NetSim.


Note:

The modifications suggested are related with NetSim v9.1 and V10.0 we recommend you to perform code modifications and create scenarios in the respective version that you have.