Applicable Versions | NetSim Standard | NetSim Professional |
Applicable Releases | v13.3 | v14.0 |
By default the log entries in the 5G radio measurements log file are written for every 1 ms. However, this time interval can be changed by modifying the underlying source codes. Let us consider a case where the user wants the logs to be written for every second instead of every millisecond.
In order to restrict the logging of PDSCH/PUSCH/SSB radio measurements to once in every second, instead of each millisecond, the source codes of the functions responsible for logging will have to be modified. Please follow the steps explained below:
1. Open NetSim source codes associated with the current workspace by going to Your Work -> Source Code -> Open Code option in the Home Screen of NetSim.
2. Once the source codes are loaded in Visual Studio, expand the LTE_NR source code project, in the solution explorer and double-click on the LTENR_PHY.h file to open it.
3. Modify the stru_LTENR_propagationInfo structure declaration as highlighted below:
typedef struct stru_LTENR_propagationInfo
{
__IN__ NETSIM_ID gnbId;
__IN__ NETSIM_ID gnbIf;
{
__IN__ NETSIM_ID gnbId;
__IN__ NETSIM_ID gnbIf;
.
.
.
.
UINT* beamFormingIndex;
//Radio Measurement logging
double currentTime;
double lastExecutionTime;
double SSBcurrentTime;
double SSBlastExecutionTime;
}uplink, downlink;
UINT* beamFormingIndex;
//Radio Measurement logging
double currentTime;
double lastExecutionTime;
double SSBcurrentTime;
double SSBlastExecutionTime;
}uplink, downlink;
.
.
.
.
double dist2Doutdoor;
}LTENR_PROPAGATIONINFO, * ptrLTENR_PROPAGATIONINFO;
double dist2Doutdoor;
}LTENR_PROPAGATIONINFO, * ptrLTENR_PROPAGATIONINFO;
4. Open the LTENR_RadioMeasurements.c file and modify the functions LTENR_RadioMeasurements_PDSCH_Log(), LTENR_RadioMeasurements_PUSCH_Log(), and LTENR_RadioMeasurements_PBSCH_Log() by adding an if condition that encloses the existing function code, as highlighted below:
void LTENR_RadioMeasurements_PDSCH_Log(ptrLTENR_GNBPHY phy, int CA_ID,
ptrLTENR_ASSOCIATEDUEPHYINFO info)
{
if (fpRMlog == NULL || !validate_log(info->ueId)) return;
UINT layerCount;
ptrLTENR_PROPAGATIONCONFIG propagation = phy->propagationConfig;
ptrLTENR_PROPAGATIONINFO pinfo = info->propagationInfo[CA_ID];
string pszassoc_status = info->isAssociated ? "true" : "false";
ptrLTENR_CA ca = phy->spectrumConfig->CA[CA_ID];
LTENR_LOS_NLOS_STATE los_state = pinfo->propagationConfig->state;
// Get the current time
pinfo->downlink.currentTime = ldEventTime / SECOND;
// Check if one second has passed since the last execution
if (pinfo->downlink.currentTime - pinfo->downlink.lastExecutionTime >= 1)
{
//Update the last execution time to the current time
pinfo->downlink.lastExecutionTime = pinfo->downlink.currentTime;
if (!info->isAssociated || (ca->configSlotType == SLOT_UPLINK)) return;
layerCount = pinfo->downlink.layerCount;
for (UINT i = 0; i < layerCount; i++)
{
fprintf(fpRMlog, "%.2lf,%s,%s,%lf,",
ldEventTime / MILLISECOND, DEVICE_NAME(phy->gnbId),
DEVICE_NAME(info->ueId),
DEVICE_DISTANCE(phy->gnbId, info->ueId));
.
.
.
.
fprintf(fpRMlog, "\n");
if (nDbgFlag) fflush(fpRMlog);
}
}
}
void LTENR_RadioMeasurements_PUSCH_Log(ptrLTENR_GNBPHY phy, int CA_ID,
ptrLTENR_ASSOCIATEDUEPHYINFO info)
{
if (fpRMlog == NULL || !validate_log(info->ueId)) return;
UINT layerCount;
ptrLTENR_PROPAGATIONCONFIG propagation = phy->propagationConfig;
ptrLTENR_PROPAGATIONINFO pinfo = info->propagationInfo[CA_ID];
string pszassoc_status = info->isAssociated ? "true" : "false";
ptrLTENR_CA ca = phy->spectrumConfig->CA[CA_ID];
LTENR_LOS_NLOS_STATE los_state = pinfo->propagationConfig->state;
// Get the current time
pinfo->uplink.currentTime = ldEventTime / SECOND;
// Check if one second has passed since the last execution
if (pinfo->uplink.currentTime - pinfo->uplink.lastExecutionTime >= 1)
{
//Update the last execution time to the current time
pinfo->uplink.lastExecutionTime = pinfo->uplink.currentTime;
if (!info->isAssociated || (ca->configSlotType == SLOT_DOWNLINK)) return;
layerCount = pinfo->uplink.layerCount;
for (UINT i = 0; i < layerCount; i++)
{
fprintf(fpRMlog, "%.2lf,%s,%s,%lf,",
ldEventTime / MILLISECOND, DEVICE_NAME(phy->gnbId),
DEVICE_NAME(info->ueId),
DEVICE_DISTANCE(phy->gnbId, info->ueId));
fprintf(fpRMlog, "\n");
if (nDbgFlag) fflush(fpRMlog);
}
}
}
void LTENR_RadioMeasurements_PUSCH_Log(ptrLTENR_GNBPHY phy, int CA_ID,
ptrLTENR_ASSOCIATEDUEPHYINFO info)
{
if (fpRMlog == NULL || !validate_log(info->ueId)) return;
UINT layerCount;
ptrLTENR_PROPAGATIONCONFIG propagation = phy->propagationConfig;
ptrLTENR_PROPAGATIONINFO pinfo = info->propagationInfo[CA_ID];
string pszassoc_status = info->isAssociated ? "true" : "false";
ptrLTENR_CA ca = phy->spectrumConfig->CA[CA_ID];
LTENR_LOS_NLOS_STATE los_state = pinfo->propagationConfig->state;
// Get the current time
pinfo->uplink.currentTime = ldEventTime / SECOND;
// Check if one second has passed since the last execution
if (pinfo->uplink.currentTime - pinfo->uplink.lastExecutionTime >= 1)
{
//Update the last execution time to the current time
pinfo->uplink.lastExecutionTime = pinfo->uplink.currentTime;
if (!info->isAssociated || (ca->configSlotType == SLOT_DOWNLINK)) return;
layerCount = pinfo->uplink.layerCount;
for (UINT i = 0; i < layerCount; i++)
{
fprintf(fpRMlog, "%.2lf,%s,%s,%lf,",
ldEventTime / MILLISECOND, DEVICE_NAME(phy->gnbId),
DEVICE_NAME(info->ueId),
DEVICE_DISTANCE(phy->gnbId, info->ueId));
.
.
.
.
fprintf(fpRMlog, "\n");
if (nDbgFlag) fflush(fpRMlog);
}
}
}
void LTENR_RadioMeasurements_PBSCH_Log(ptrLTENR_GNBPHY phy, int CA_ID,
ptrLTENR_ASSOCIATEDUEPHYINFO info)
{
if (fpRMlog == NULL || !validate_log(info->ueId)) return;
ptrLTENR_PROPAGATIONCONFIG propagation = phy->propagationConfig;
ptrLTENR_PROPAGATIONINFO pinfo = info->propagationInfo[CA_ID];
string pszassoc_status = info->isAssociated ? "true" : "false";
ptrLTENR_CA ca = phy->spectrumConfig->CA[CA_ID];
LTENR_LOS_NLOS_STATE los_state = pinfo->propagationConfig->state;
// Get the current time
pinfo->downlink.SSBcurrentTime = ldEventTime / SECOND;
// Check if one second has passed since the last execution
if (pinfo->downlink.SSBcurrentTime - pinfo->downlink.SSBlastExecutionTime >= 1)
{
//Update the last execution time to the current time
pinfo->downlink.SSBlastExecutionTime = pinfo->downlink.SSBcurrentTime;
if ((ca->configSlotType == SLOT_UPLINK)) return;
fprintf(fpRMlog, "%.2lf,%s,%s,%lf,",
ldEventTime / MILLISECOND, DEVICE_NAME(phy->gnbId),
DEVICE_NAME(info->ueId),
DEVICE_DISTANCE(phy->gnbId, info->ueId));
if (nDbgFlag) fflush(fpRMlog);
}
}
}
void LTENR_RadioMeasurements_PBSCH_Log(ptrLTENR_GNBPHY phy, int CA_ID,
ptrLTENR_ASSOCIATEDUEPHYINFO info)
{
if (fpRMlog == NULL || !validate_log(info->ueId)) return;
ptrLTENR_PROPAGATIONCONFIG propagation = phy->propagationConfig;
ptrLTENR_PROPAGATIONINFO pinfo = info->propagationInfo[CA_ID];
string pszassoc_status = info->isAssociated ? "true" : "false";
ptrLTENR_CA ca = phy->spectrumConfig->CA[CA_ID];
LTENR_LOS_NLOS_STATE los_state = pinfo->propagationConfig->state;
// Get the current time
pinfo->downlink.SSBcurrentTime = ldEventTime / SECOND;
// Check if one second has passed since the last execution
if (pinfo->downlink.SSBcurrentTime - pinfo->downlink.SSBlastExecutionTime >= 1)
{
//Update the last execution time to the current time
pinfo->downlink.SSBlastExecutionTime = pinfo->downlink.SSBcurrentTime;
if ((ca->configSlotType == SLOT_UPLINK)) return;
fprintf(fpRMlog, "%.2lf,%s,%s,%lf,",
ldEventTime / MILLISECOND, DEVICE_NAME(phy->gnbId),
DEVICE_NAME(info->ueId),
DEVICE_DISTANCE(phy->gnbId, info->ueId));
.
.
.
.
fprintf(fpRMlog, "\n");
if (nDbgFlag) fflush(fpRMlog);
}
}
if (nDbgFlag) fflush(fpRMlog);
}
}
5. Save changes done to the LTENR_PHY.h and LTENR_RadioMeasurements.c files, right-click on the LTE_NR source code project and select rebuild. Upon successful, build, the changes done to the source codes will be successfully applied for subsequent simulations.
Note: The frequency of PBSCH, i.e. SSB channel entries in the log will not exactly be at intervals of 1 second, but instead be based on the UE measurement report interval set in the gNB RAN Interface's Data Link layer properties. The parameter takes input in milliseconds starting from 120 ms to 40960 ms. However, it is ensured that there will be only one entry in the log file for every second. Similarly, there will be variation in time entries associated with PDSCH and PUSCH channels, whenever there is a handover.
In this case, the UE Measurement report interval considered is 120 ms, due to which you can see a 120 ms additional difference in time between each SSB channel entries.