22 #include "ns3/string.h"
23 #include <ns3/simulator.h>
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.",
111 double rsrp,
double sinr)
116 std::ofstream outFile;
120 if (!outFile.is_open ())
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;
158 if (!outFile.is_open ())
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;
195 if (!outFile.is_open ())
201 outFile <<
"% time\tcellId\tInterference";
202 outFile << std::endl;
207 if (!outFile.is_open ())
215 outFile << cellId <<
"\t";
216 outFile << *interference;
223 std::string path, uint16_t cellId, uint16_t rnti,
224 double rsrp,
double sinr)
228 std::string pathUePhy = path.substr (0, path.find (
"/ReportCurrentCellRsrpSinr"));
229 if (phyStats->ExistsImsiPath (pathUePhy) ==
true)
231 imsi = phyStats->GetImsiPath (pathUePhy);
236 phyStats->SetImsiPath (pathUePhy, imsi);
239 phyStats->ReportCurrentCellRsrpSinr (cellId, imsi, rnti, rsrp,sinr);
244 uint16_t cellId, uint16_t rnti,
double sinrLinear)
249 std::ostringstream pathAndRnti;
250 pathAndRnti << path <<
"/" << rnti;
251 std::string pathEnbMac = path.substr (0, path.find (
"LteEnbPhy/ReportUeSinr"));
252 pathEnbMac +=
"LteEnbMac/DlScheduling";
253 if (phyStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
255 imsi = phyStats->GetImsiPath (pathAndRnti.str ());
260 phyStats->SetImsiPath (pathAndRnti.str (), imsi);
263 phyStats->ReportUeSinr (cellId, imsi, rnti, sinrLinear);
271 phyStats->ReportInterference (cellId, interference);
smart pointer class similar to boost::intrusive_ptr
static uint64_t FindImsiFromUePhy(std::string path)
#define NS_LOG_FUNCTION(parameters)
static uint64_t FindImsiFromEnbMac(std::string path, uint16_t rnti)
hold variables of type string
std::string GetInterferenceFilename(void)
std::string m_ueSinrFilename
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
void SetCurrentCellRsrpSinrFilename(std::string filename)
bool m_RsrpSinrFirstWrite
static TypeId GetTypeId(void)
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr)
std::string m_interferenceFilename
bool m_InterferenceFirstWrite
void SetUeSinrFilename(std::string filename)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
virtual ~PhyStatsCalculator()
int64_t GetNanoSeconds(void) const
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
std::string m_RsrpSinrFilename
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)