| Applicable Versions | NetSim Standard | NetSim Pro |
The LTENR Radio Resource Allocation csv log file records information related to physical resource block (PRB) allocation such as the Total PRBs, Slot Start Time(ms), Slot End, BitsPerPRB, BufferFill, Allocated PRBs, Rank (scheduling metric) and more, in the DL and in the UL. All these parameters are written in every slot.
| Applicable Releases | v14.4 | or Higher Versions |
The LTENR Radio Resource Allocation log can be enabled by clicking on configure reports in top ribbon > Plots > Select LTENR Radio Resource Allocation log under Network Logs as shown below.

The log file can be accessed from the Simulations Results Window under the log file drop down in the left pane

Here, the allocated Physical Resource Blocks (PRBs) for each UE can be observed. 
| Applicable Releases | v10 | v11 | v12 |
Resource Blocks allocated to each User Equipment can be logged into a text or csv file as per the requirement. Following is one such example where we log the resource blocks allocated to each UE in a separate file 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.
(From v11.1 onwards, user must open visual studio 2017/19 through Netsim->open simulation-
>workspace option->open code)
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:
int fn_NetSim_LTE_CalculateReceivedPower()
{
NETSIM_ID i;
FILE* fp1;
char rblock[100];
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--;
}
}
//RB Log
sprintf(rblock, "LTE_UE_RB_%d.csv", fn_NetSim_GetDeviceIdByConfigId(info->nUEId));
fp1 = fopen(rblock, "w+");
if (fp1)
{
fprintf(fp1, "UE_ID,Time(micro seconds),UL_RB,DL_RB");
fclose(fp1);
}
//RB Log
}
info = (LTE_ASSOCIATEUE_INFO*)LIST_NEXT(info);
}
}
}
return 1;
}
iii.In the file CA.c add the lines of code highlighted in red as shown below:
void fn_NetSim_LTE_A_FormNextFrameForEachCarrier(NETSIM_ID enbId, NETSIM_ID enbInterface, unsigned int nSSId)
{
unsigned int i;
LTE_ENB_MAC* enbMac = get_enb_mac(enbId, enbInterface);
LTE_ASSOCIATEUE_INFO* info = enbMac->associatedUEInfo;
FILE *fp1;
char rblock[100];
while (info)
{
LTE_UE_MAC* m = get_ue_mac(info->nUEId, info->nUEInterface);
m->carrier_id = -1;
info->carrier_id = -1;
info = (LTE_ASSOCIATEUE_INFO*)LIST_NEXT(info);
}
info = enbMac->associatedUEInfo;
while (info)
{
int devicen = fn_NetSim_GetDeviceIdByConfigId(info->nUEId);
sprintf(rblock, "LTE_UE_RB_%d.csv", fn_NetSim_GetDeviceIdByConfigId(info->nUEId));
unsigned int rb_ul = 0, rb_dl = 0;
for (i = 0; i < enbMac->ca_count; i++)
{
enbMac->ca_mac[i].nAllocatedRBG = 0;
fn_NetSim_LTE_FormUPlinkFrame(enbId, enbInterface, i, nSSId);
// For each of the carriers in the eNB Resource block ground RBG is multipled by Resource Block count in group to get total
// Resource block count. This is done for uplink and downlink
unsigned int block_ul = enbMac->ca_mac[i].nAllocatedRBG*enbMac->ca_mac[i].nRBCountInGroup;
rb_ul = rb_ul + block_ul;
fn_NetSim_LTE_FormDownlinkFrame(enbId, enbInterface, i, nSSId);
unsigned int block_dl = enbMac->ca_mac[i].nAllocatedRBG*enbMac->ca_mac[i].nRBCountInGroup;
rb_dl = rb_dl + block_dl;
fp1 = fopen(rblock, "a+");
if (fp1)
{
fprintf(fp1, "\n%d,%lf,%d,%d", fn_NetSim_GetDeviceIdByConfigId(info->nUEId), pstruEventDetails->dEventTime, rb_ul, rb_dl);
fclose(fp1);
}
}
info = (LTE_ASSOCIATEUE_INFO*)LIST_NEXT(info);
}
}
iv.Now depending upon 32 bit or 64 bit built of Netsim, choose platform as win32 or x64, 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.
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).
(from v11.1 onwards, user can ignore steps 5 and 6 as dll files will get updated in binary folder of current workspace automatically)
vii.Now on running any simulation in LTE, you will get individual logs for each UE which contains the resource blocks allocated along with event time, in the bin folder of NetSim (“<NetSim_Install_Directory>/bin”) as shown below: