22 #include "ns3/string.h"
23 #include <ns3/simulator.h>
33 : m_RsrpSinrFirstWrite (true),
34 m_UeSinrFirstWrite (true),
35 m_InterferenceFirstWrite (true)
53 .AddAttribute (
"DlRsrpSinrFilename",
54 "Name of the file where the RSRP/SINR statistics will be saved.",
58 .AddAttribute (
"UlSinrFilename",
59 "Name of the file where the UE SINR statistics will be saved.",
63 .AddAttribute (
"UlInterferenceFilename",
64 "Name of the file where the interference statistics will be saved.",
112 double rsrp,
double sinr)
117 std::ofstream outFile;
121 if (!outFile.is_open ())
127 outFile <<
"% time\tcellId\tIMSI\tRNTI\trsrp\tsinr";
128 outFile << std::endl;
133 if (!outFile.is_open ())
141 outFile << cellId <<
"\t";
142 outFile << imsi <<
"\t";
143 outFile << rnti <<
"\t";
144 outFile << rsrp <<
"\t";
145 outFile << sinr << std::endl;
155 std::ofstream outFile;
159 if (!outFile.is_open ())
165 outFile <<
"% time\tcellId\tIMSI\tRNTI\tsinrLinear";
166 outFile << std::endl;
171 if (!outFile.is_open ())
179 outFile << cellId <<
"\t";
180 outFile << imsi <<
"\t";
181 outFile << rnti <<
"\t";
182 outFile << sinrLinear << std::endl;
192 std::ofstream outFile;
196 if (!outFile.is_open ())
202 outFile <<
"% time\tcellId\tInterference";
203 outFile << std::endl;
208 if (!outFile.is_open ())
216 outFile << cellId <<
"\t";
217 outFile << *interference;
224 std::string path, uint16_t cellId, uint16_t rnti,
225 double rsrp,
double sinr)
229 std::string pathUePhy = path.substr (0, path.find (
"/ReportCurrentCellRsrpSinr"));
230 if (phyStats->ExistsImsiPath (pathUePhy) ==
true)
232 imsi = phyStats->GetImsiPath (pathUePhy);
237 phyStats->SetImsiPath (pathUePhy, imsi);
240 phyStats->ReportCurrentCellRsrpSinr (cellId, imsi, rnti, rsrp,sinr);
245 uint16_t cellId, uint16_t rnti,
double sinrLinear)
250 std::ostringstream pathAndRnti;
251 pathAndRnti << path <<
"/" << rnti;
252 std::string pathEnbMac = path.substr (0, path.find (
"LteEnbPhy/ReportUeSinr"));
253 pathEnbMac +=
"LteEnbMac/DlScheduling";
254 if (phyStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
256 imsi = phyStats->GetImsiPath (pathAndRnti.str ());
261 phyStats->SetImsiPath (pathAndRnti.str (), imsi);
264 phyStats->ReportUeSinr (cellId, imsi, rnti, sinrLinear);
272 phyStats->ReportInterference (cellId, interference);
Ptr< const AttributeChecker > MakeStringChecker(void)
Base class for ***StatsCalculator classes.
static uint64_t FindImsiFromUePhy(std::string path)
Retrieves IMSI from Ue PHY path in the attribute system.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static uint64_t FindImsiFromEnbMac(std::string path, uint16_t rnti)
Retrieves IMSI from Enb MAC path in the attribute system.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Hold variables of type string.
std::string GetInterferenceFilename(void)
Get the name of the file where the interference statistics will be stored.
std::string m_ueSinrFilename
Name of the file where the UE SINR statistics will be saved.
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
Notifies the stats calculator that an UE SINR report has occurred.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
void SetCurrentCellRsrpSinrFilename(std::string filename)
Set the name of the file where the RSRP/SINR statistics will be stored.
bool m_RsrpSinrFirstWrite
When writing RSRP SINR statistics first time to file, columns description is added.
static TypeId GetTypeId(void)
Register this type.
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr)
trace sink
std::string m_interferenceFilename
Name of the file where the interference statistics will be saved.
bool m_InterferenceFirstWrite
When writing interference statistics first time to file, columns description is added.
void SetUeSinrFilename(std::string filename)
Set the name of the file where the UE SINR statistics will be stored.
Takes care of storing the information generated at PHY layer.
virtual ~PhyStatsCalculator()
Destructor.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Time Now(void)
Return the current simulation virtual time.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
std::string m_RsrpSinrFilename
Name of the file where the RSRP/SINR statistics will be saved.
void SetInterferenceFilename(std::string filename)
Set the name of the file where the interference statistics will be stored.
std::string GetUeSinrFilename(void)
Get the name of the file where the UE SINR statistics will be stored.
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
Notifies the stats calculator that an interference report has occurred.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
std::string GetCurrentCellRsrpSinrFilename(void)
Get the name of the file where the RSRP/SINR statistics will be stored.
PhyStatsCalculator()
Constructor.
bool m_UeSinrFirstWrite
When writing UE SINR statistics first time to file, columns description is added. ...
void ReportCurrentCellRsrpSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double sinr)
Notifies the stats calculator that an RSRP and SINR report has occurred.