22 #include "ns3/string.h"
23 #include <ns3/simulator.h>
35 : m_RsrpSinrFirstWrite (true),
36 m_UeSinrFirstWrite (true),
37 m_InterferenceFirstWrite (true)
53 .AddConstructor<PhyStatsCalculator> ()
54 .AddAttribute (
"DlRsrpSinrFilename",
55 "Name of the file where the RSRP/SINR statistics will be saved.",
59 .AddAttribute (
"UlSinrFilename",
60 "Name of the file where the UE SINR statistics will be saved.",
64 .AddAttribute (
"UlInterferenceFilename",
65 "Name of the file where the interference statistics will be saved.",
113 double rsrp,
double sinr)
118 std::ofstream outFile;
122 if (!outFile.is_open ())
128 outFile <<
"% time\tcellId\tIMSI\tRNTI\trsrp\tsinr";
129 outFile << std::endl;
134 if (!outFile.is_open ())
142 outFile << cellId <<
"\t";
143 outFile << imsi <<
"\t";
144 outFile << rnti <<
"\t";
145 outFile << rsrp <<
"\t";
146 outFile << sinr << std::endl;
156 std::ofstream outFile;
160 if (!outFile.is_open ())
166 outFile <<
"% time\tcellId\tIMSI\tRNTI\tsinrLinear";
167 outFile << std::endl;
172 if (!outFile.is_open ())
180 outFile << cellId <<
"\t";
181 outFile << imsi <<
"\t";
182 outFile << rnti <<
"\t";
183 outFile << sinrLinear << std::endl;
193 std::ofstream outFile;
197 if (!outFile.is_open ())
203 outFile <<
"% time\tcellId\tInterference";
204 outFile << std::endl;
209 if (!outFile.is_open ())
217 outFile << cellId <<
"\t";
218 outFile << *interference;
225 std::string path, uint16_t cellId, uint16_t rnti,
226 double rsrp,
double sinr)
230 std::string pathUePhy = path.substr (0, path.find (
"/ReportCurrentCellRsrpSinr"));
231 if (phyStats->ExistsImsiPath (pathUePhy) ==
true)
233 imsi = phyStats->GetImsiPath (pathUePhy);
238 phyStats->SetImsiPath (pathUePhy, imsi);
241 phyStats->ReportCurrentCellRsrpSinr (cellId, imsi, rnti, rsrp,sinr);
246 uint16_t cellId, uint16_t rnti,
double sinrLinear)
251 std::ostringstream pathAndRnti;
252 pathAndRnti << path <<
"/" << rnti;
253 std::string pathEnbMac = path.substr (0, path.find (
"LteEnbPhy/ReportUeSinr"));
254 pathEnbMac +=
"LteEnbMac/DlScheduling";
255 if (phyStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
257 imsi = phyStats->GetImsiPath (pathAndRnti.str ());
262 phyStats->SetImsiPath (pathAndRnti.str (), imsi);
265 phyStats->ReportUeSinr (cellId, imsi, rnti, sinrLinear);
273 phyStats->ReportInterference (cellId, interference);
Doxygen introspection did not find any typical Config paths.
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)
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
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
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
Notifies the stats calculator that an UE SINR report has occurred.
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
void SetCurrentCellRsrpSinrFilename(std::string filename)
Set the name of the file where the RSRP/SINR statistics will be stored.
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)
trace sink
std::string m_interferenceFilename
bool m_InterferenceFirstWrite
void SetUeSinrFilename(std::string filename)
Set the name of the file where the UE SINR statistics will be stored.
virtual ~PhyStatsCalculator()
Destructor.
static Time Now(void)
Return the "current simulation time".
int64_t GetNanoSeconds(void) const
std::string m_RsrpSinrFilename
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)
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.
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.