24 #include "ns3/string.h" 25 #include <ns3/simulator.h> 35 : m_dlRxFirstWrite (true),
36 m_ulRxFirstWrite (true)
54 .AddAttribute (
"DlRxOutputFilename",
55 "Name of the file where the downlink results will be saved.",
59 .AddAttribute (
"UlRxOutputFilename",
60 "Name of the file where the uplink results will be saved.",
98 std::ofstream outFile;
102 if (!outFile.is_open ())
108 outFile <<
"% time\tcellId\tIMSI\tRNTI\ttxMode\tlayer\tmcs\tsize\trv\tndi\tcorrect\tccId";
109 outFile << std::endl;
114 if (!outFile.is_open ())
123 outFile << (uint32_t) params.
m_cellId <<
"\t";
124 outFile << params.
m_imsi <<
"\t";
125 outFile << params.
m_rnti <<
"\t";
126 outFile << (uint32_t) params.
m_txMode <<
"\t";
127 outFile << (uint32_t) params.
m_layer <<
"\t";
128 outFile << (uint32_t) params.
m_mcs <<
"\t";
129 outFile << params.
m_size <<
"\t";
130 outFile << (uint32_t) params.
m_rv <<
"\t";
131 outFile << (uint32_t) params.
m_ndi <<
"\t";
133 outFile << (uint32_t) params.
m_ccId << std::endl;
143 std::ofstream outFile;
147 if (!outFile.is_open ())
153 outFile <<
"% time\tcellId\tIMSI\tRNTI\tlayer\tmcs\tsize\trv\tndi\tcorrect\tccId";
154 outFile << std::endl;
159 if (!outFile.is_open ())
168 outFile << (uint32_t) params.
m_cellId <<
"\t";
169 outFile << params.
m_imsi <<
"\t";
170 outFile << params.
m_rnti <<
"\t";
171 outFile << (uint32_t) params.
m_layer <<
"\t";
172 outFile << (uint32_t) params.
m_mcs <<
"\t";
173 outFile << params.
m_size <<
"\t";
174 outFile << (uint32_t) params.
m_rv <<
"\t";
175 outFile << (uint32_t) params.
m_ndi <<
"\t";
177 outFile << (uint32_t) params.
m_ccId <<std::endl;
187 std::ostringstream pathAndRnti;
188 pathAndRnti << path <<
"/" << params.
m_rnti;
189 std::string pathUePhy = path.substr (0, path.find (
"/ComponentCarrierMapUe"));
190 if (phyRxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
192 imsi = phyRxStats->GetImsiPath (pathAndRnti.str ());
197 phyRxStats->SetImsiPath (pathAndRnti.str (), imsi);
201 phyRxStats->DlPhyReception (params);
210 std::ostringstream pathAndRnti;
211 std::string pathEnb = path.substr (0, path.find (
"/ComponentCarrierMap"));
212 pathAndRnti << pathEnb <<
"/LteEnbRrc/UeMap/" << params.
m_rnti;
213 if (phyRxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
215 imsi = phyRxStats->GetImsiPath (pathAndRnti.str ());
220 phyRxStats->SetImsiPath (pathAndRnti.str (), imsi);
224 phyRxStats->UlPhyReception (params);
Ptr< const AttributeChecker > MakeStringChecker(void)
Base class for ***StatsCalculator classes.
static uint64_t FindImsiFromLteNetDevice(std::string path)
Retrieves IMSI from LteNetDevice path in the attribute system.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t m_mcs
MCS for transport block.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Hold variables of type string.
bool m_dlRxFirstWrite
When writing DL RX PHY statistics first time to file, columns description is added.
uint8_t m_rv
the redundancy version (HARQ)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void DlPhyReception(PhyReceptionStatParameters params)
Notifies the stats calculator that an downlink reception has occurred.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
int64_t m_timestamp
in millisecond
std::string GetUlRxOutputFilename(void)
Get the name of the file where the UL RX PHY statistics will be stored.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
virtual ~PhyRxStatsCalculator()
Destructor.
void UlPhyReception(PhyReceptionStatParameters params)
Notifies the stats calculator that an uplink reception has occurred.
uint8_t m_layer
the layer (cw) of the transmission
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
uint8_t m_ndi
new data indicator flag
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PhyReceptionStatParameters structure.
PhyRxStatsCalculator()
Constructor.
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.
uint8_t m_txMode
the transmission Mode
uint16_t m_size
Size of transport block.
static void DlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
static void UlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
uint8_t m_ccId
component carrier id
uint8_t m_correctness
correctness of the TB received
uint16_t m_rnti
C-RNTI scheduled.
uint16_t m_cellId
Cell ID of the attached Enb.
std::string GetDlRxOutputFilename(void)
Get the name of the file where the DL RX PHY statistics will be stored.
#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...
void SetUlRxOutputFilename(std::string outputFilename)
Set the name of the file where the UL Rx PHY statistics will be stored.
void SetDlRxOutputFilename(std::string outputFilename)
Set the name of the file where the DL RX PHY statistics will be stored.
uint64_t m_imsi
IMSI of the scheduled UE.
static TypeId GetTypeId(void)
Register this type.
a unique identifier for an interface.
bool m_ulRxFirstWrite
When writing UL RX PHY statistics first time to file, columns description is added.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Takes care of storing the information generated at PHY layer regarding reception. ...
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.