23 #include "ns3/string.h"
24 #include "ns3/nstime.h"
39 : m_firstWrite (true),
40 m_pendingOutput (false),
41 m_protocolType (
"RLC")
47 : m_firstWrite (true),
48 m_pendingOutput (false)
63 TypeId (
"ns3::RadioBearerStatsCalculator")
65 .AddAttribute (
"StartTime",
"Start time of the on going epoch.",
70 .AddAttribute (
"EpochDuration",
"Epoch duration.",
75 .AddAttribute (
"DlRlcOutputFilename",
76 "Name of the file where the downlink results will be saved.",
80 .AddAttribute (
"UlRlcOutputFilename",
81 "Name of the file where the uplink results will be saved.",
85 .AddAttribute (
"DlPdcpOutputFilename",
86 "Name of the file where the downlink results will be saved.",
90 .AddAttribute (
"UlPdcpOutputFilename",
91 "Name of the file where the uplink results will be saved.",
138 NS_LOG_FUNCTION (
this <<
"UlTxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize);
153 NS_LOG_FUNCTION (
this <<
"DlTxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize);
169 NS_LOG_FUNCTION (
this <<
"UlRxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize << delay);
177 Uint64StatsMap::iterator it =
m_ulDelay.find (p);
180 NS_LOG_DEBUG (
this <<
" Creating UL stats calculators for IMSI " << p.
m_imsi <<
" and LCID " << (uint32_t) p.
m_lcId);
181 m_ulDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
182 m_ulPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
193 NS_LOG_FUNCTION (
this <<
"DlRxPDU" << cellId << imsi << rnti << (uint32_t) lcid << packetSize << delay);
201 Uint64StatsMap::iterator it =
m_dlDelay.find (p);
204 NS_LOG_DEBUG (
this <<
" Creating DL stats calculators for IMSI " << p.
m_imsi <<
" and LCID " << (uint32_t) p.
m_lcId);
205 m_dlDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
206 m_dlPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
221 std::ofstream ulOutFile;
222 std::ofstream dlOutFile;
227 if (!ulOutFile.is_open ())
234 if (!dlOutFile.is_open ())
240 ulOutFile <<
"% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
241 ulOutFile <<
"delay\tstdDev\tmin\tmax\t";
242 ulOutFile <<
"PduSize\tstdDev\tmin\tmax";
243 ulOutFile << std::endl;
244 dlOutFile <<
"% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
245 dlOutFile <<
"delay\tstdDev\tmin\tmax\t";
246 dlOutFile <<
"PduSize\tstdDev\tmin\tmax";
247 dlOutFile << std::endl;
252 if (!ulOutFile.is_open ())
259 if (!dlOutFile.is_open ())
279 std::vector < ImsiLcidPair_t > pairVector;
282 if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
284 pairVector.push_back ((*it).first);
289 for (std::vector<ImsiLcidPair_t>::iterator it = pairVector.begin (); it != pairVector.end (); ++it)
295 outFile << p.
m_imsi <<
"\t";
296 outFile <<
m_flowId[p].m_rnti <<
"\t";
297 outFile << (uint32_t)
m_flowId[p].m_lcId <<
"\t";
303 for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
305 outFile << (*it) * 1e-9 <<
"\t";
308 for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
310 outFile << (*it) <<
"\t";
312 outFile << std::endl;
324 std::vector < ImsiLcidPair_t > pairVector;
327 if (find (pairVector.begin (), pairVector.end (), (*it).first) == pairVector.end ())
329 pairVector.push_back ((*it).first);
334 for (std::vector<ImsiLcidPair_t>::iterator pair = pairVector.begin (); pair != pairVector.end (); ++pair)
340 outFile << p.
m_imsi <<
"\t";
341 outFile <<
m_flowId[p].m_rnti <<
"\t";
342 outFile << (uint32_t)
m_flowId[p].m_lcId <<
"\t";
348 for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
350 outFile << (*it) * 1e-9 <<
"\t";
353 for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
355 outFile << (*it) <<
"\t";
357 outFile << std::endl;
439 Uint64StatsMap::iterator it =
m_ulDelay.find (p);
442 NS_LOG_ERROR (
"UL delay for " << imsi <<
" - " << (uint16_t) lcid <<
" not found");
454 std::vector<double> stats;
455 Uint64StatsMap::iterator it =
m_ulDelay.find (p);
458 stats.push_back (0.0);
459 stats.push_back (0.0);
460 stats.push_back (0.0);
461 stats.push_back (0.0);
465 stats.push_back (
m_ulDelay[p]->getMean ());
466 stats.push_back (
m_ulDelay[p]->getStddev ());
467 stats.push_back (
m_ulDelay[p]->getMin ());
468 stats.push_back (
m_ulDelay[p]->getMax ());
477 std::vector<double> stats;
478 Uint32StatsMap::iterator it =
m_ulPduSize.find (p);
481 stats.push_back (0.0);
482 stats.push_back (0.0);
483 stats.push_back (0.0);
484 stats.push_back (0.0);
548 Uint64StatsMap::iterator it =
m_dlDelay.find (p);
562 std::vector<double> stats;
563 Uint64StatsMap::iterator it =
m_dlDelay.find (p);
566 stats.push_back (0.0);
567 stats.push_back (0.0);
568 stats.push_back (0.0);
569 stats.push_back (0.0);
573 stats.push_back (
m_dlDelay[p]->getMean ());
574 stats.push_back (
m_dlDelay[p]->getStddev ());
575 stats.push_back (
m_dlDelay[p]->getMin ());
576 stats.push_back (
m_dlDelay[p]->getMax ());
585 std::vector<double> stats;
586 Uint32StatsMap::iterator it =
m_dlPduSize.find (p);
589 stats.push_back (0.0);
590 stats.push_back (0.0);
591 stats.push_back (0.0);
592 stats.push_back (0.0);
Doxygen introspection did not find any typical Config paths.
keep track of time values and allow control of global simulation resolution
#define NS_LOG_FUNCTION(parameters)
Time GetStartTime() const
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
virtual ~RadioBearerStatsCalculator()
Class destructor.
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.
static TypeId GetTypeId(void)
hold variables of type string
double GetUlDelay(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC delay.
std::string GetUlPdcpOutputFilename(void)
Get the name of the file where the uplink PDCP statistics will be stored.
bool m_pendingOutput
true if any output is pending
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint32_t GetDlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
uint32_t GetUlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
void WriteDlResults(std::ofstream &outFile)
void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
RadioBearerStatsCalculator()
Class constructor.
uint32_t GetUlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink packets.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
std::vector< double > GetUlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the uplink PDU size statistics: average, min, max and standard deviation.
hold objects of type ns3::Time
void WriteUlResults(std::ofstream &outFile)
uint64_t GetDlRxData(uint64_t imsi, uint8_t lcid)
Gets the number of received downlink data bytes.
void SetUlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the uplink PDCP statistics will be stored.
double GetDlDelay(uint64_t imsi, uint8_t lcid)
Gets the downlink RLC to RLC delay.
void UlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
Notifies the stats calculator that an uplink transmission has occurred.
std::string GetDlPdcpOutputFilename(void)
Get the name of the file where the downlink PDCP statistics will be stored.
uint32_t GetUlRxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink packets.
Time m_startTime
Start time of the on going epoch.
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
void SetStartTime(Time t)
void SetDlOutputFilename(std::string outputFilename)
Set the name of the file where the downlink statistics will be stored.
bool m_firstWrite
true if output files have not been opened yet
Time m_epochDuration
Epoch duration.
static Time Now(void)
Return the "current simulation time".
uint64_t GetDlTxData(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
void DlTxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
Notifies the stats calculator that an downlink transmission has occurred.
uint32_t GetDlCellId(uint64_t imsi, uint8_t lcid)
Gets the attached Enb cellId.
void UlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
Notifies the stats calculator that an uplink reception has occurred.
Uint32StatsMap m_ulPduSize
int64_t GetNanoSeconds(void) const
std::string m_protocolType
uint64_t GetUlTxData(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted uplink data bytes.
uint64_t GetUlRxData(uint64_t imsi, uint8_t lcid)
Gets the number of received uplink data bytes.
std::vector< double > GetDlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the downlink RLC to RLC statistics: average, min, max and standard deviation.
uint32_t GetDlTxPackets(uint64_t imsi, uint8_t lcid)
Gets the number of transmitted downlink data bytes.
#define NS_LOG_DEBUG(msg)
void RescheduleEndEpoch()
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void SetDlPdcpOutputFilename(std::string outputFilename)
Set the name of the file where the downlink PDCP statistics will be stored.
#define NS_LOG_ERROR(msg)
std::vector< double > GetUlDelayStats(uint64_t imsi, uint8_t lcid)
Gets the uplink RLC to RLC statistics: average, min, max and standard deviation.
std::vector< double > GetDlPduSizeStats(uint64_t imsi, uint8_t lcid)
Gets the downlink PDU size statistics: average, min, max and standard deviation.
std::string m_ulPdcpOutputFilename
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Uint32StatsMap m_dlPduSize
void DlRxPdu(uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
Notifies the stats calculator that an downlink reception has occurred.
std::string m_dlPdcpOutputFilename
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.