A Discrete-Event Network Simulator
API
ns3::MacStatsCalculator Class Reference

Takes care of storing the information generated at MAC layer. More...

#include "mac-stats-calculator.h"

+ Inheritance diagram for ns3::MacStatsCalculator:
+ Collaboration diagram for ns3::MacStatsCalculator:

Public Member Functions

 MacStatsCalculator ()
 Constructor. More...
 
virtual ~MacStatsCalculator ()
 Destructor. More...
 
void DlScheduling (uint16_t cellId, uint64_t imsi, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
 Notifies the stats calculator that an downlink scheduling has occurred. More...
 
std::string GetDlOutputFilename (void)
 Get the name of the file where the downlink statistics will be stored. More...
 
std::string GetUlOutputFilename (void)
 Get the name of the file where the uplink statistics will be stored. More...
 
void SetDlOutputFilename (std::string outputFilename)
 Set the name of the file where the downlink statistics will be stored. More...
 
void SetUlOutputFilename (std::string outputFilename)
 Set the name of the file where the uplink statistics will be stored. More...
 
void UlScheduling (uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb, uint16_t sizeTb, uint8_t componentCarrierId)
 Notifies the stats calculator that an uplink scheduling has occurred. More...
 
- Public Member Functions inherited from ns3::LteStatsCalculator
 LteStatsCalculator ()
 Constructor. More...
 
virtual ~LteStatsCalculator ()
 Destructor. More...
 
bool ExistsCellIdPath (std::string path)
 Checks if there is an already stored cell id for the given path. More...
 
bool ExistsImsiPath (std::string path)
 Checks if there is an already stored IMSI for the given path. More...
 
uint16_t GetCellIdPath (std::string path)
 Retrieves the cell id information for the given path. More...
 
std::string GetDlOutputFilename (void)
 Get the name of the file where the downlink statistics will be stored. More...
 
uint64_t GetImsiPath (std::string path)
 Retrieves the imsi information for the given path. More...
 
std::string GetUlOutputFilename (void)
 Get the name of the file where the uplink statistics will be stored. More...
 
void SetCellIdPath (std::string path, uint16_t cellId)
 Stores the (path, cellId) pairs in a map. More...
 
void SetDlOutputFilename (std::string outputFilename)
 Set the name of the file where the downlink statistics will be stored. More...
 
void SetImsiPath (std::string path, uint64_t imsi)
 Stores the (path, imsi) pairs in a map. More...
 
void SetUlOutputFilename (std::string outputFilename)
 Set the name of the file where the uplink statistics will be stored. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
virtual TypeId GetInstanceTypeId (void) const =0
 Get the most derived TypeId for this Object. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static void DlSchedulingCallback (Ptr< MacStatsCalculator > macStats, std::string path, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
 Trace sink for the ns3::LteEnbMac::DlScheduling trace source. More...
 
static TypeId GetTypeId (void)
 Register this type. More...
 
static void UlSchedulingCallback (Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t size, uint8_t componentCarrierId)
 Trace sink for the ns3::LteEnbMac::UlScheduling trace source. More...
 
- Static Public Member Functions inherited from ns3::LteStatsCalculator
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Attributes

bool m_dlFirstWrite
 When writing DL MAC statistics first time to file, columns description is added. More...
 
std::ofstream m_dlOutFile
 Downlink output trace file. More...
 
bool m_ulFirstWrite
 When writing UL MAC statistics first time to file, columns description is added. More...
 
std::ofstream m_ulOutFile
 Uplink output trace file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 
- Static Protected Member Functions inherited from ns3::LteStatsCalculator
static uint16_t FindCellIdFromEnbMac (std::string path, uint16_t rnti)
 Retrieves CellId from Enb MAC path in the attribute system. More...
 
static uint16_t FindCellIdFromEnbRlcPath (std::string path)
 Retrieves CellId from Enb RLC path in the attribute system. More...
 
static uint64_t FindImsiForEnb (std::string path, uint16_t rnti)
 Retrieves IMSI from path for Enb in the attribute system. More...
 
static uint64_t FindImsiForUe (std::string path, uint16_t rnti)
 Retrieves IMSI from path for Ue in the attribute system. More...
 
static uint64_t FindImsiFromEnbMac (std::string path, uint16_t rnti)
 Retrieves IMSI from Enb MAC path in the attribute system. More...
 
static uint64_t FindImsiFromEnbRlcPath (std::string path)
 Retrieves IMSI from Enb RLC path in the attribute system. More...
 
static uint64_t FindImsiFromLteNetDevice (std::string path)
 Retrieves IMSI from LteNetDevice path in the attribute system. More...
 
static uint64_t FindImsiFromUePhy (std::string path)
 Retrieves IMSI from Ue PHY path in the attribute system. More...
 

Detailed Description

Takes care of storing the information generated at MAC layer.

Introspection did not find any typical Config paths.

Metrics saved are:

  • Timestamp (in seconds)
  • Frame index
  • Subframe index
  • C-RNTI
  • MCS for transport block 1
  • Size of transport block 1
  • MCS for transport block 2 (0 if not used)
  • Size of transport block 2 (0 if not used)


Attributes

  • DlOutputFilename: Name of the file where the downlink results will be saved.
    • Set with class: StringValue
    • Underlying type: std::string
    • Initial value: DlMacStats.txt
    • Flags: constructwrite
  • UlOutputFilename: Name of the file where the uplink results will be saved.
    • Set with class: StringValue
    • Underlying type: std::string
    • Initial value: UlMacStats.txt
    • Flags: constructwrite

No TraceSources are defined for this type.
Size of this type is 1176 bytes (on a 64-bit architecture).

Definition at line 48 of file mac-stats-calculator.h.

Constructor & Destructor Documentation

◆ MacStatsCalculator()

ns3::MacStatsCalculator::MacStatsCalculator ( )

Constructor.

Definition at line 34 of file mac-stats-calculator.cc.

References NS_LOG_FUNCTION.

◆ ~MacStatsCalculator()

ns3::MacStatsCalculator::~MacStatsCalculator ( )
virtual

Destructor.

Definition at line 42 of file mac-stats-calculator.cc.

References m_dlOutFile, m_ulOutFile, and NS_LOG_FUNCTION.

Member Function Documentation

◆ DlScheduling()

void ns3::MacStatsCalculator::DlScheduling ( uint16_t  cellId,
uint64_t  imsi,
DlSchedulingCallbackInfo  dlSchedulingCallbackInfo 
)

Notifies the stats calculator that an downlink scheduling has occurred.

Parameters
cellIdCell ID of the attached Enb
imsiIMSI of the scheduled UE
dlSchedulingCallbackInfothe structure that contains downlink scheduling fields: frameNo Frame number subframeNo Subframe number rnti C-RNTI scheduled mcsTb1 MCS for transport block 1 sizeTb1 Size of transport block 1 mcsTb2 MCS for transport block 2 (0 if not used) sizeTb2 Size of transport block 2 (0 if not used) componentCarrierId component carrier ID

Definition at line 102 of file mac-stats-calculator.cc.

References ns3::DlSchedulingCallbackInfo::componentCarrierId, ns3::DlSchedulingCallbackInfo::frameNo, GetDlOutputFilename(), ns3::Time::GetSeconds(), m_dlFirstWrite, m_dlOutFile, ns3::DlSchedulingCallbackInfo::mcsTb1, ns3::DlSchedulingCallbackInfo::mcsTb2, ns3::Simulator::Now(), NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::DlSchedulingCallbackInfo::rnti, ns3::DlSchedulingCallbackInfo::sizeTb1, ns3::DlSchedulingCallbackInfo::sizeTb2, and ns3::DlSchedulingCallbackInfo::subframeNo.

+ Here is the call graph for this function:

◆ DlSchedulingCallback()

void ns3::MacStatsCalculator::DlSchedulingCallback ( Ptr< MacStatsCalculator macStats,
std::string  path,
DlSchedulingCallbackInfo  dlSchedulingCallbackInfo 
)
static

Trace sink for the ns3::LteEnbMac::DlScheduling trace source.

Parameters
macStats
path
dlSchedulingCallbackInfoDlSchedulingCallbackInfo structure containing all downlink information that is generated what DlScheduling traces is fired

Definition at line 166 of file mac-stats-calculator.cc.

References ns3::LteStatsCalculator::FindCellIdFromEnbRlcPath(), ns3::LteStatsCalculator::FindImsiFromEnbRlcPath(), NS_LOG_FUNCTION, trim-trailing-whitespace::path, and ns3::DlSchedulingCallbackInfo::rnti.

Referenced by ns3::LteHelper::EnableDlMacTraces().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDlOutputFilename()

std::string ns3::MacStatsCalculator::GetDlOutputFilename ( void  )

Get the name of the file where the downlink statistics will be stored.

Returns
the name of the file where the downlink statistics will be stored

Definition at line 96 of file mac-stats-calculator.cc.

References ns3::LteStatsCalculator::GetDlOutputFilename().

Referenced by DlScheduling().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::MacStatsCalculator::GetTypeId ( void  )
static

Register this type.

Returns
The object TypeId.

Definition at line 57 of file mac-stats-calculator.cc.

References ns3::MakeStringAccessor(), ns3::MakeStringChecker(), SetDlOutputFilename(), ns3::TypeId::SetParent(), and SetUlOutputFilename().

+ Here is the call graph for this function:

◆ GetUlOutputFilename()

std::string ns3::MacStatsCalculator::GetUlOutputFilename ( void  )

Get the name of the file where the uplink statistics will be stored.

Returns
the name of the file where the uplink statistics will be stored

Definition at line 84 of file mac-stats-calculator.cc.

References ns3::LteStatsCalculator::GetUlOutputFilename().

Referenced by UlScheduling().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDlOutputFilename()

void ns3::MacStatsCalculator::SetDlOutputFilename ( std::string  outputFilename)

Set the name of the file where the downlink statistics will be stored.

Parameters
outputFilenamestring with the name of the file

Definition at line 90 of file mac-stats-calculator.cc.

References ns3::LteStatsCalculator::SetDlOutputFilename().

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetUlOutputFilename()

void ns3::MacStatsCalculator::SetUlOutputFilename ( std::string  outputFilename)

Set the name of the file where the uplink statistics will be stored.

Parameters
outputFilenamestring with the name of the file

Definition at line 78 of file mac-stats-calculator.cc.

References ns3::LteStatsCalculator::SetUlOutputFilename().

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UlScheduling()

void ns3::MacStatsCalculator::UlScheduling ( uint16_t  cellId,
uint64_t  imsi,
uint32_t  frameNo,
uint32_t  subframeNo,
uint16_t  rnti,
uint8_t  mcsTb,
uint16_t  sizeTb,
uint8_t  componentCarrierId 
)

Notifies the stats calculator that an uplink scheduling has occurred.

Parameters
cellIdCell ID of the attached Enb
imsiIMSI of the scheduled UE
frameNoFrame number
subframeNoSubframe number
rntiC-RNTI scheduled
mcsTbMCS for transport block
sizeTbSize of transport block
componentCarrierIdcomponent carrier ID

Definition at line 135 of file mac-stats-calculator.cc.

References ns3::Time::GetSeconds(), GetUlOutputFilename(), m_ulFirstWrite, m_ulOutFile, ns3::Simulator::Now(), NS_LOG_ERROR, NS_LOG_FUNCTION, and NS_LOG_INFO.

+ Here is the call graph for this function:

◆ UlSchedulingCallback()

void ns3::MacStatsCalculator::UlSchedulingCallback ( Ptr< MacStatsCalculator macStats,
std::string  path,
uint32_t  frameNo,
uint32_t  subframeNo,
uint16_t  rnti,
uint8_t  mcs,
uint16_t  size,
uint8_t  componentCarrierId 
)
static

Trace sink for the ns3::LteEnbMac::UlScheduling trace source.

Parameters
macStats
path
frameNo
subframeNo
rnti
mcs
size
componentCarrierId

Definition at line 197 of file mac-stats-calculator.cc.

References ns3::LteStatsCalculator::FindCellIdFromEnbRlcPath(), ns3::LteStatsCalculator::FindImsiFromEnbRlcPath(), NS_LOG_FUNCTION, and trim-trailing-whitespace::path.

Referenced by ns3::LteHelper::EnableUlMacTraces().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_dlFirstWrite

bool ns3::MacStatsCalculator::m_dlFirstWrite
private

When writing DL MAC statistics first time to file, columns description is added.

Then next lines are appended to file. This value is true if output files have not been opened yet

Definition at line 159 of file mac-stats-calculator.h.

Referenced by DlScheduling().

◆ m_dlOutFile

std::ofstream ns3::MacStatsCalculator::m_dlOutFile
private

Downlink output trace file.

Definition at line 172 of file mac-stats-calculator.h.

Referenced by ~MacStatsCalculator(), and DlScheduling().

◆ m_ulFirstWrite

bool ns3::MacStatsCalculator::m_ulFirstWrite
private

When writing UL MAC statistics first time to file, columns description is added.

Then next lines are appended to file. This value is true if output files have not been opened yet

Definition at line 167 of file mac-stats-calculator.h.

Referenced by UlScheduling().

◆ m_ulOutFile

std::ofstream ns3::MacStatsCalculator::m_ulOutFile
private

Uplink output trace file.

Definition at line 177 of file mac-stats-calculator.h.

Referenced by ~MacStatsCalculator(), and UlScheduling().


The documentation for this class was generated from the following files: