23 #include "ns3/string.h" 24 #include <ns3/simulator.h> 34 : m_RsrpSinrFirstWrite (true),
35 m_UeSinrFirstWrite (true),
36 m_InterferenceFirstWrite (true)
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, uint8_t componentCarrierId)
118 std::ofstream outFile;
122 if (!outFile.is_open ())
128 outFile <<
"% time\tcellId\tIMSI\tRNTI\trsrp\tsinr\tComponentCarrierId";
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 <<
"\t";
147 outFile << (uint32_t)componentCarrierId << std::endl;
157 std::ofstream outFile;
161 if (!outFile.is_open ())
167 outFile <<
"% time\tcellId\tIMSI\tRNTI\tsinrLinear\tcomponentCarrierId";
168 outFile << std::endl;
173 if (!outFile.is_open ())
181 outFile << cellId <<
"\t";
182 outFile << imsi <<
"\t";
183 outFile << rnti <<
"\t";
184 outFile << sinrLinear <<
"\t";
185 outFile << (uint32_t)componentCarrierId << std::endl;
195 std::ofstream outFile;
199 if (!outFile.is_open ())
205 outFile <<
"% time\tcellId\tInterference";
206 outFile << std::endl;
211 if (!outFile.is_open ())
219 outFile << cellId <<
"\t";
220 outFile << *interference;
227 std::string path, uint16_t cellId, uint16_t rnti,
228 double rsrp,
double sinr, uint8_t componentCarrierId)
232 std::string pathUePhy = path.substr (0, path.find (
"/ComponentCarrierMapUe"));
233 if (phyStats->ExistsImsiPath (pathUePhy) ==
true)
235 imsi = phyStats->GetImsiPath (pathUePhy);
240 phyStats->SetImsiPath (pathUePhy, imsi);
243 phyStats->ReportCurrentCellRsrpSinr (cellId, imsi, rnti, rsrp, sinr, componentCarrierId);
248 uint16_t cellId, uint16_t rnti,
double sinrLinear, uint8_t componentCarrierId)
253 std::ostringstream pathAndRnti;
254 pathAndRnti << path <<
"/" << rnti;
255 std::string pathEnbMac = path.substr (0, path.find (
"/ComponentCarrierMap"));
256 pathEnbMac +=
"/LteEnbMac/DlScheduling";
257 if (phyStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
259 imsi = phyStats->GetImsiPath (pathAndRnti.str ());
264 phyStats->SetImsiPath (pathAndRnti.str (), imsi);
267 phyStats->ReportUeSinr (cellId, imsi, rnti, sinrLinear, componentCarrierId);
275 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.
#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.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
std::string m_ueSinrFilename
Name of the file where the UE SINR statistics will be saved.
#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.
Ptr< const AttributeChecker > MakeStringChecker(void)
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.
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.
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.
static Time Now(void)
Return the current simulation virtual time.
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.
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
trace sink
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)
Set the parent TypeId.
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. ...