5#include "nr-bearer-stats-simple.h"
14NS_LOG_COMPONENT_DEFINE(
"NrBearerStatsSimple");
15NS_OBJECT_ENSURE_REGISTERED(NrBearerStatsBase);
16NS_OBJECT_ENSURE_REGISTERED(NrBearerStatsSimple);
21 static TypeId tid = TypeId(
"ns3::NrBearerStatsBase").SetParent<Object>().SetGroupName(
"nr");
26NrBearerStatsBase::DoDispose()
28 NS_LOG_FUNCTION(
this);
33 : m_protocolType(
"RLC")
35 NS_LOG_FUNCTION(
this);
40 NS_LOG_FUNCTION(
this);
41 m_protocolType = protocolType;
46 NS_LOG_FUNCTION(
this);
53 TypeId(
"ns3::NrBearerStatsSimple")
55 .AddConstructor<NrBearerStatsSimple>()
57 .AddAttribute(
"DlRlcTxOutputFilename",
58 "Name of the file where the RLC downlink TX results will be saved.",
59 StringValue(
"NrDlTxRlcStats.txt"),
60 MakeStringAccessor(&NrBearerStatsSimple::m_dlRlcTxOutputFilename),
62 .AddAttribute(
"DlRlcRxOutputFilename",
63 "Name of the file where the RLC downlink RX results will be saved.",
64 StringValue(
"NrDlRxRlcStats.txt"),
65 MakeStringAccessor(&NrBearerStatsSimple::m_dlRlcRxOutputFilename),
67 .AddAttribute(
"UlRlcTxOutputFilename",
68 "Name of the file where the RLC uplink RX results will be saved.",
69 StringValue(
"NrUlRlcTxStats.txt"),
70 MakeStringAccessor(&NrBearerStatsSimple::m_ulRlcTxOutputFilename),
72 .AddAttribute(
"UlRlcRxOutputFilename",
73 "Name of the file where the RLC uplink TX results will be saved.",
74 StringValue(
"NrUlRlcRxStats.txt"),
75 MakeStringAccessor(&NrBearerStatsSimple::m_ulRlcRxOutputFilename),
77 .AddAttribute(
"DlPdcpTxOutputFilename",
78 "Name of the file where the downlink PDCP TX results will be saved.",
79 StringValue(
"NrDlPdcpTxStats.txt"),
80 MakeStringAccessor(&NrBearerStatsSimple::m_dlPdcpTxOutputFilename),
82 .AddAttribute(
"DlPdcpRxOutputFilename",
83 "Name of the file where the downlink PDCP RX results will be saved.",
84 StringValue(
"NrDlPdcpRxStats.txt"),
85 MakeStringAccessor(&NrBearerStatsSimple::m_dlPdcpRxOutputFilename),
87 .AddAttribute(
"UlPdcpTxOutputFilename",
88 "Name of the file where the uplink PDCP TX results will be saved.",
89 StringValue(
"NrUlPdcpTxStats.txt"),
90 MakeStringAccessor(&NrBearerStatsSimple::m_ulPdcpTxOutputFilename),
92 .AddAttribute(
"UlPdcpRxOutputFilename",
93 "Name of the file where the uplink PDCP RX results will be saved.",
94 StringValue(
"NrUlPdcpRxStats.txt"),
95 MakeStringAccessor(&NrBearerStatsSimple::m_ulPdcpRxOutputFilename),
103 NS_LOG_FUNCTION(
this);
104 m_dlTxOutFile.close();
105 m_dlRxOutFile.close();
106 m_ulTxOutFile.close();
107 m_ulRxOutFile.close();
108 NrBearerStatsBase::DoDispose();
118 NS_LOG_FUNCTION(
this << cellId << imsi << rnti << (uint32_t)lcid << packetSize);
120 if (!m_ulTxOutFile.is_open())
123 m_ulTxOutFile <<
"time(s)"
131 <<
"packetSize" << std::endl;
133 m_ulTxOutFile << Simulator::Now().GetSeconds() <<
"\t" << cellId <<
"\t" << rnti <<
"\t"
134 << (uint32_t)lcid <<
"\t" << packetSize << std::endl;
144 NS_LOG_FUNCTION(
this << cellId << imsi << rnti << (uint32_t)lcid << packetSize);
146 if (!m_dlTxOutFile.is_open())
149 m_dlTxOutFile <<
"time(s)"
157 <<
"packetSize" << std::endl;
160 m_dlTxOutFile << Simulator::Now().GetSeconds() <<
"\t" << cellId <<
"\t" << rnti <<
"\t"
161 << (uint32_t)lcid <<
"\t" << packetSize << std::endl;
172 NS_LOG_FUNCTION(
this << cellId << imsi << rnti << (uint32_t)lcid << packetSize << delay);
174 if (!m_ulRxOutFile.is_open())
177 m_ulRxOutFile <<
"time(s)"
187 <<
"delay(s)" << std::endl;
190 m_ulRxOutFile << Simulator::Now().GetSeconds() <<
"\t" << cellId <<
"\t" << rnti <<
"\t"
191 << (uint32_t)lcid <<
"\t" << packetSize <<
"\t" << delay * 1e-9 << std::endl;
202 NS_LOG_FUNCTION(
this << cellId << imsi << rnti << (uint32_t)lcid << packetSize << delay);
204 if (!m_dlRxOutFile.is_open())
207 m_dlRxOutFile <<
"time(s)"
217 <<
"delay(s)" << std::endl;
220 m_dlRxOutFile << Simulator::Now().GetSeconds() <<
"\t" << cellId <<
"\t" << rnti <<
"\t"
221 << (uint32_t)lcid <<
"\t" << packetSize <<
"\t" << delay * 1e-9 << std::endl;
227 if (m_protocolType ==
"RLC")
229 return m_ulRlcTxOutputFilename;
233 return m_ulPdcpTxOutputFilename;
240 if (m_protocolType ==
"RLC")
242 return m_ulRlcRxOutputFilename;
246 return m_ulPdcpRxOutputFilename;
253 if (m_protocolType ==
"RLC")
255 return m_dlRlcTxOutputFilename;
259 return m_dlPdcpTxOutputFilename;
266 if (m_protocolType ==
"RLC")
268 return m_dlRlcRxOutputFilename;
272 return m_dlPdcpRxOutputFilename;
static TypeId GetTypeId()
~NrBearerStatsSimple() override
void UlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) override
void DlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize) override
std::string GetDlTxOutputFilename()
std::string GetUlTxOutputFilename()
std::string GetUlRxOutputFilename()
void DoDispose() override
void UlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize) override
void DlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay) override
std::string GetDlRxOutputFilename()
static TypeId GetTypeId()