24 #include "ns3/string.h"
26 #include <ns3/simulator.h>
36 : m_RsrpSinrFirstWrite(true),
37 m_UeSinrFirstWrite(true),
38 m_InterferenceFirstWrite(true)
66 TypeId(
"ns3::PhyStatsCalculator")
70 .AddAttribute(
"DlRsrpSinrFilename",
71 "Name of the file where the RSRP/SINR statistics will be saved.",
75 .AddAttribute(
"UlSinrFilename",
76 "Name of the file where the UE SINR statistics will be saved.",
80 .AddAttribute(
"UlInterferenceFilename",
81 "Name of the file where the interference statistics will be saved.",
130 uint8_t componentCarrierId)
144 m_rsrpOutFile <<
"% time\tcellId\tIMSI\tRNTI\trsrp\tsinr\tComponentCarrierId";
162 uint8_t componentCarrierId)
176 m_ueSinrOutFile <<
"% time\tcellId\tIMSI\tRNTI\tsinrLinear\tcomponentCarrierId";
218 uint8_t componentCarrierId)
222 std::string pathUePhy = path.substr(0, path.find(
"/ComponentCarrierMapUe"));
223 if (phyStats->ExistsImsiPath(pathUePhy))
225 imsi = phyStats->GetImsiPath(pathUePhy);
230 phyStats->SetImsiPath(pathUePhy, imsi);
233 phyStats->ReportCurrentCellRsrpSinr(cellId, imsi, rnti, rsrp, sinr, componentCarrierId);
242 uint8_t componentCarrierId)
247 std::ostringstream pathAndRnti;
248 pathAndRnti << path <<
"/" << rnti;
249 std::string pathEnbMac = path.substr(0, path.find(
"/ComponentCarrierMap"));
250 pathEnbMac +=
"/LteEnbMac/DlScheduling";
251 if (phyStats->ExistsImsiPath(pathAndRnti.str()))
253 imsi = phyStats->GetImsiPath(pathAndRnti.str());
258 phyStats->SetImsiPath(pathAndRnti.str(), imsi);
261 phyStats->ReportUeSinr(cellId, imsi, rnti, sinrLinear, componentCarrierId);
271 phyStats->ReportInterference(cellId, interference);
Base class for ***StatsCalculator classes.
static uint64_t FindImsiFromLteNetDevice(std::string path)
Retrieves IMSI from LteNetDevice path in the attribute system.
static uint64_t FindImsiFromEnbMac(std::string path, uint16_t rnti)
Retrieves IMSI from Enb MAC path in the attribute system.
Takes care of storing the information generated at PHY layer.
bool m_UeSinrFirstWrite
When writing UE SINR statistics first time to file, columns description is added.
bool m_InterferenceFirstWrite
When writing interference statistics first time to file, columns description is added.
std::string GetInterferenceFilename()
Get the name of the file where the interference statistics will be stored.
std::string GetUeSinrFilename()
Get the name of the file where the UE SINR statistics will be stored.
void SetInterferenceFilename(std::string filename)
Set the name of the file where the interference statistics will be stored.
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
Notifies the stats calculator that an UE SINR report has occurred.
bool m_RsrpSinrFirstWrite
When writing RSRP SINR statistics first time to file, columns description is added.
std::string m_interferenceFilename
Name of the file where the interference statistics will be saved.
std::string m_ueSinrFilename
Name of the file where the UE SINR statistics will be saved.
void SetCurrentCellRsrpSinrFilename(std::string filename)
Set the name of the file where the RSRP/SINR statistics will be stored.
PhyStatsCalculator()
Constructor.
void ReportCurrentCellRsrpSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
Notifies the stats calculator that an RSRP and SINR report has occurred.
void SetUeSinrFilename(std::string filename)
Set the name of the file where the UE SINR statistics will be stored.
std::ofstream m_interferenceOutFile
Interference statistics output trace file.
std::string GetCurrentCellRsrpSinrFilename()
Get the name of the file where the RSRP/SINR statistics will be stored.
static TypeId GetTypeId()
Register this type.
std::ofstream m_ueSinrOutFile
UE SINR statistics output trace file.
std::string m_RsrpSinrFilename
Name of the file where the RSRP/SINR statistics will be saved.
std::ofstream m_rsrpOutFile
RSRP statistics output trace file.
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
Notifies the stats calculator that an interference report has occurred.
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
trace sink
~PhyStatsCalculator() override
Destructor.
static Time Now()
Return the current simulation virtual time.
Hold variables of type string.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)