21 #include "phy-stats-calculator.h"
22 #include "ns3/string.h"
23 #include <ns3/simulator.h>
30 NS_OBJECT_ENSURE_REGISTERED (PhyStatsCalculator);
33 : m_RsrpSinrFirstWrite (true),
34 m_UeSinrFirstWrite (true),
35 m_InterferenceFirstWrite (true)
51 .AddConstructor<PhyStatsCalculator> ()
52 .AddAttribute (
"DlRsrpSinrFilename",
53 "Name of the file where the RSRP/SINR statistics will be saved.",
57 .AddAttribute (
"UlSinrFilename",
58 "Name of the file where the UE SINR statistics will be saved.",
62 .AddAttribute (
"UlInterferenceFilename",
63 "Name of the file where the interference statistics will be saved.",
74 m_RsrpSinrFilename = filename;
80 return m_RsrpSinrFilename;
86 m_ueSinrFilename = filename;
92 return m_ueSinrFilename;
98 m_interferenceFilename = filename;
104 return m_interferenceFilename;
111 double rsrp,
double sinr)
116 std::ofstream outFile;
117 if ( m_RsrpSinrFirstWrite ==
true )
120 if (!outFile.is_open ())
125 m_RsrpSinrFirstWrite =
false;
126 outFile <<
"% time\tcellId\tIMSI\tRNTI\trsrp\tsinr";
127 outFile << std::endl;
132 if (!outFile.is_open ())
140 outFile << cellId <<
"\t";
141 outFile << imsi <<
"\t";
142 outFile << rnti <<
"\t";
143 outFile << rsrp <<
"\t";
144 outFile << sinr << std::endl;
154 std::ofstream outFile;
155 if ( m_UeSinrFirstWrite ==
true )
158 if (!outFile.is_open ())
163 m_UeSinrFirstWrite =
false;
164 outFile <<
"% time\tcellId\tIMSI\tRNTI\tsinrLinear";
165 outFile << std::endl;
170 if (!outFile.is_open ())
178 outFile << cellId <<
"\t";
179 outFile << imsi <<
"\t";
180 outFile << rnti <<
"\t";
181 outFile << sinrLinear << std::endl;
191 std::ofstream outFile;
192 if ( m_InterferenceFirstWrite ==
true )
195 if (!outFile.is_open ())
200 m_InterferenceFirstWrite =
false;
201 outFile <<
"% time\tcellId\tInterference";
202 outFile << std::endl;
207 if (!outFile.is_open ())
215 outFile << cellId <<
"\t";
216 outFile << *interference;
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
hold variables of type string
std::string GetInterferenceFilename(void)
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
#define NS_LOG_COMPONENT_DEFINE(name)
void SetCurrentCellRsrpSinrFilename(std::string filename)
static TypeId GetTypeId(void)
void SetUeSinrFilename(std::string filename)
virtual ~PhyStatsCalculator()
int64_t GetNanoSeconds(void) const
void SetInterferenceFilename(std::string filename)
std::string GetUeSinrFilename(void)
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
#define NS_LOG_ERROR(msg)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
std::string GetCurrentCellRsrpSinrFilename(void)
void ReportCurrentCellRsrpSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double sinr)