24 #include "ns3/string.h" 25 #include <ns3/simulator.h> 35 : m_dlTxFirstWrite (true),
36 m_ulTxFirstWrite (true)
54 .AddAttribute (
"DlTxOutputFilename",
55 "Name of the file where the downlink results will be saved.",
59 .AddAttribute (
"UlTxOutputFilename",
60 "Name of the file where the uplink results will be saved.",
98 std::ofstream outFile;
102 if (!outFile.is_open ())
109 outFile <<
"% time\tcellId\tIMSI\tRNTI\tlayer\tmcs\tsize\trv\tndi\tccId";
110 outFile << std::endl;
115 if (!outFile.is_open ())
124 outFile << (uint32_t) params.
m_cellId <<
"\t";
125 outFile << params.
m_imsi <<
"\t";
126 outFile << params.
m_rnti <<
"\t";
128 outFile << (uint32_t) params.
m_layer <<
"\t";
129 outFile << (uint32_t) params.
m_mcs <<
"\t";
130 outFile << params.
m_size <<
"\t";
131 outFile << (uint32_t) params.
m_rv <<
"\t";
132 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 ())
154 outFile <<
"% time\tcellId\tIMSI\tRNTI\tlayer\tmcs\tsize\trv\tndi\tccId";
155 outFile << std::endl;
160 if (!outFile.is_open ())
169 outFile << (uint32_t) params.
m_cellId <<
"\t";
170 outFile << params.
m_imsi <<
"\t";
171 outFile << params.
m_rnti <<
"\t";
173 outFile << (uint32_t) params.
m_layer <<
"\t";
174 outFile << (uint32_t) params.
m_mcs <<
"\t";
175 outFile << params.
m_size <<
"\t";
176 outFile << (uint32_t) params.
m_rv <<
"\t";
177 outFile << (uint32_t) params.
m_ndi <<
"\t";
178 outFile << (uint32_t) params.
m_ccId << std::endl;
188 std::ostringstream pathAndRnti;
189 std::string pathEnb = path.substr (0, path.find (
"/ComponentCarrierMap"));
190 pathAndRnti << pathEnb <<
"/LteEnbRrc/UeMap/" << params.
m_rnti;
191 if (phyTxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
193 imsi = phyTxStats->GetImsiPath (pathAndRnti.str ());
198 phyTxStats->SetImsiPath (pathAndRnti.str (), imsi);
202 phyTxStats->DlPhyTransmission (params);
211 std::ostringstream pathAndRnti;
212 pathAndRnti << path <<
"/" << params.
m_rnti;
213 std::string pathUePhy = path.substr (0, path.find (
"/ComponentCarrierMapUe"));
214 if (phyTxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
216 imsi = phyTxStats->GetImsiPath (pathAndRnti.str ());
221 phyTxStats->SetImsiPath (pathAndRnti.str (), imsi);
225 phyTxStats->UlPhyTransmission (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 "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Hold variables of type string.
bool m_dlTxFirstWrite
When writing DL TX PHY statistics first time to file, columns description is added.
PhyTxStatsCalculator()
Constructor.
#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.
uint8_t m_rv
the redundancy version (HARQ)
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
uint64_t m_imsi
IMSI of the scheduled UE.
void SetDlTxOutputFilename(std::string outputFilename)
Set the name of the file where the DL TX PHY statistics will be stored.
std::string GetDlTxOutputFilename(void)
Get the name of the file where the DL TX PHY statistics will be stored.
void DlPhyTransmission(PhyTransmissionStatParameters params)
Notifies the stats calculator that an downlink transmission has occurred.
uint8_t m_mcs
MCS for transport block.
std::string GetUlTxOutputFilename(void)
Get the name of the file where the UL RX PHY statistics will be stored.
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
Takes care of storing the information generated at PHY layer regarding transmission.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool m_ulTxFirstWrite
When writing UL TX PHY statistics first time to file, columns description is added.
static void DlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
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.
uint16_t m_size
Size of transport block.
virtual ~PhyTxStatsCalculator()
Destructor.
uint8_t m_ndi
new data indicator flag
static void UlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
uint16_t m_cellId
Cell ID of the attached Enb.
uint8_t m_layer
the layer (cw) of the transmission
void SetUlTxOutputFilename(std::string outputFilename)
Set the name of the file where the UL Tx PHY statistics will be stored.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
uint8_t m_ccId
component carrier id
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
PhyTransmissionStatParameters structure.
int64_t m_timestamp
in millisecond
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint16_t m_rnti
C-RNTI scheduled.
static TypeId GetTypeId(void)
Register this type.
void UlPhyTransmission(PhyTransmissionStatParameters params)
Notifies the stats calculator that an uplink transmission has occurred.
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.