23 #include "ns3/string.h"
24 #include <ns3/simulator.h>
34 : m_RsrpSinrFirstWrite (true),
35 m_UeSinrFirstWrite (true),
36 m_InterferenceFirstWrite (true)
68 .AddAttribute (
"DlRsrpSinrFilename",
69 "Name of the file where the RSRP/SINR statistics will be saved.",
73 .AddAttribute (
"UlSinrFilename",
74 "Name of the file where the UE SINR statistics will be saved.",
78 .AddAttribute (
"UlInterferenceFilename",
79 "Name of the file where the interference statistics will be saved.",
127 double rsrp,
double sinr, uint8_t componentCarrierId)
141 m_rsrpOutFile <<
"% time\tcellId\tIMSI\tRNTI\trsrp\tsinr\tComponentCarrierId";
169 m_ueSinrOutFile <<
"% time\tcellId\tIMSI\tRNTI\tsinrLinear\tcomponentCarrierId";
207 std::string path, uint16_t cellId, uint16_t rnti,
208 double rsrp,
double sinr, uint8_t componentCarrierId)
212 std::string pathUePhy = path.substr (0, path.find (
"/ComponentCarrierMapUe"));
213 if (phyStats->ExistsImsiPath (pathUePhy) ==
true)
215 imsi = phyStats->GetImsiPath (pathUePhy);
220 phyStats->SetImsiPath (pathUePhy, imsi);
223 phyStats->ReportCurrentCellRsrpSinr (cellId, imsi, rnti, rsrp, sinr, componentCarrierId);
228 uint16_t cellId, uint16_t rnti,
double sinrLinear, uint8_t componentCarrierId)
233 std::ostringstream pathAndRnti;
234 pathAndRnti << path <<
"/" << rnti;
235 std::string pathEnbMac = path.substr (0, path.find (
"/ComponentCarrierMap"));
236 pathEnbMac +=
"/LteEnbMac/DlScheduling";
237 if (phyStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
239 imsi = phyStats->GetImsiPath (pathAndRnti.str ());
244 phyStats->SetImsiPath (pathAndRnti.str (), imsi);
247 phyStats->ReportUeSinr (cellId, imsi, rnti, sinrLinear, componentCarrierId);
255 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 GetUeSinrFilename(void)
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.
virtual ~PhyStatsCalculator()
Destructor.
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::string GetInterferenceFilename(void)
Get the name of the file where the interference statistics will be stored.
std::ofstream m_interferenceOutFile
Interference statistics output trace file.
std::ofstream m_ueSinrOutFile
UE SINR statistics output trace file.
static TypeId GetTypeId(void)
Register this type.
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
std::string GetCurrentCellRsrpSinrFilename(void)
Get the name of the file where the RSRP/SINR statistics will be stored.
static Time Now(void)
Return the current simulation virtual time.
Hold variables of type string.
double GetSeconds(void) 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.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeStringChecker(void)
#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.