13#include "ns3/string.h"
15#include <ns3/simulator.h>
25 : m_dlRxFirstWrite(true),
26 m_ulRxFirstWrite(true)
49 TypeId(
"ns3::PhyRxStatsCalculator")
53 .AddAttribute(
"DlRxOutputFilename",
54 "Name of the file where the downlink results will be saved.",
58 .AddAttribute(
"UlRxOutputFilename",
59 "Name of the file where the uplink results will be saved.",
93 NS_LOG_FUNCTION(
this << params.m_cellId << params.m_imsi << params.m_timestamp << params.m_rnti
94 << params.m_layer << params.m_mcs << params.m_size << params.m_rv
95 << params.m_ndi << params.m_correctness);
108 <<
"% time\tcellId\tIMSI\tRNTI\ttxMode\tlayer\tmcs\tsize\trv\tndi\tcorrect\tccId";
129 NS_LOG_FUNCTION(
this << params.m_cellId << params.m_imsi << params.m_timestamp << params.m_rnti
130 << params.m_layer << params.m_mcs << params.m_size << params.m_rv
131 << params.m_ndi << params.m_correctness);
143 m_ulRxOutFile <<
"% time\tcellId\tIMSI\tRNTI\tlayer\tmcs\tsize\trv\tndi\tcorrect\tccId";
167 std::ostringstream pathAndRnti;
168 pathAndRnti << path <<
"/" << params.m_rnti;
169 std::string pathUePhy = path.substr(0, path.find(
"/ComponentCarrierMapUe"));
170 if (phyRxStats->ExistsImsiPath(pathAndRnti.str()))
172 imsi = phyRxStats->GetImsiPath(pathAndRnti.str());
177 phyRxStats->SetImsiPath(pathAndRnti.str(), imsi);
180 params.m_imsi = imsi;
181 phyRxStats->DlPhyReception(params);
191 std::ostringstream pathAndRnti;
192 std::string pathEnb = path.substr(0, path.find(
"/ComponentCarrierMap"));
193 pathAndRnti << pathEnb <<
"/LteEnbRrc/UeMap/" << params.m_rnti;
194 if (phyRxStats->ExistsImsiPath(pathAndRnti.str()))
196 imsi = phyRxStats->GetImsiPath(pathAndRnti.str());
201 phyRxStats->SetImsiPath(pathAndRnti.str(), imsi);
204 params.m_imsi = imsi;
205 phyRxStats->UlPhyReception(params);
Base class for ***StatsCalculator classes.
std::string GetUlOutputFilename()
Get the name of the file where the uplink statistics will be stored.
void SetDlOutputFilename(std::string outputFilename)
Set the name of the file where the downlink statistics will be stored.
static uint64_t FindImsiFromEnbRlcPath(std::string path)
Retrieves IMSI from Enb RLC path in the attribute system.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
std::string GetDlOutputFilename()
Get the name of the file where the downlink statistics will be stored.
static uint64_t FindImsiFromLteNetDevice(std::string path)
Retrieves IMSI from LteNetDevice path in the attribute system.
Takes care of storing the information generated at PHY layer regarding reception.
static TypeId GetTypeId()
Register this type.
bool m_dlRxFirstWrite
When writing DL RX PHY statistics first time to file, columns description is added.
std::ofstream m_ulRxOutFile
UL RX PHY output trace file.
PhyRxStatsCalculator()
Constructor.
bool m_ulRxFirstWrite
When writing UL RX PHY statistics first time to file, columns description is added.
static void UlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
std::string GetUlRxOutputFilename()
Get the name of the file where the UL RX PHY statistics will be stored.
void DlPhyReception(PhyReceptionStatParameters params)
Notifies the stats calculator that an downlink reception has occurred.
void SetDlRxOutputFilename(std::string outputFilename)
Set the name of the file where the DL RX PHY statistics will be stored.
std::string GetDlRxOutputFilename()
Get the name of the file where the DL RX PHY statistics will be stored.
~PhyRxStatsCalculator() override
Destructor.
static void DlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
void UlPhyReception(PhyReceptionStatParameters params)
Notifies the stats calculator that an uplink reception has occurred.
void SetUlRxOutputFilename(std::string outputFilename)
Set the name of the file where the UL Rx PHY statistics will be stored.
std::ofstream m_dlRxOutFile
DL RX PHY output trace file.
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PhyReceptionStatParameters structure.