14#include "ns3/simulator.h" 
   15#include "ns3/string.h" 
   25    : m_dlFirstWrite(true),
 
 
   49        TypeId(
"ns3::MacStatsCalculator")
 
   53            .AddAttribute(
"DlOutputFilename",
 
   54                          "Name of the file where the downlink results will be saved.",
 
   58            .AddAttribute(
"UlOutputFilename",
 
   59                          "Name of the file where the uplink results will be saved.",
 
 
   96        this << cellId << imsi << dlSchedulingCallbackInfo.
frameNo 
   97             << dlSchedulingCallbackInfo.
subframeNo << dlSchedulingCallbackInfo.
rnti 
  112            << 
"% time\tcellId\tIMSI\tframe\tsframe\tRNTI\tmcsTb1\tsizeTb1\tmcsTb2\tsizeTb2\tccId";
 
 
  137                                 uint8_t componentCarrierId)
 
  152        m_ulOutFile << 
"% time\tcellId\tIMSI\tframe\tsframe\tRNTI\tmcs\tsize\tccId";
 
 
  174    std::ostringstream pathAndRnti;
 
  175    std::string pathEnb = path.substr(0, path.find(
"/ComponentCarrierMap"));
 
  176    pathAndRnti << pathEnb << 
"/LteEnbRrc/UeMap/" << dlSchedulingCallbackInfo.
rnti;
 
  177    if (macStats->ExistsImsiPath(pathAndRnti.str()))
 
  179        imsi = macStats->GetImsiPath(pathAndRnti.str());
 
  184        macStats->SetImsiPath(pathAndRnti.str(), imsi);
 
  187    if (macStats->ExistsCellIdPath(pathAndRnti.str()))
 
  189        cellId = macStats->GetCellIdPath(pathAndRnti.str());
 
  194        macStats->SetCellIdPath(pathAndRnti.str(), cellId);
 
  197    macStats->DlScheduling(cellId, imsi, dlSchedulingCallbackInfo);
 
 
  208                                         uint8_t componentCarrierId)
 
  213    std::ostringstream pathAndRnti;
 
  214    std::string pathEnb = path.substr(0, path.find(
"/ComponentCarrierMap"));
 
  215    pathAndRnti << pathEnb << 
"/LteEnbRrc/UeMap/" << rnti;
 
  216    if (macStats->ExistsImsiPath(pathAndRnti.str()))
 
  218        imsi = macStats->GetImsiPath(pathAndRnti.str());
 
  223        macStats->SetImsiPath(pathAndRnti.str(), imsi);
 
  226    if (macStats->ExistsCellIdPath(pathAndRnti.str()))
 
  228        cellId = macStats->GetCellIdPath(pathAndRnti.str());
 
  233        macStats->SetCellIdPath(pathAndRnti.str(), cellId);
 
  236    macStats->UlScheduling(cellId, imsi, frameNo, subframeNo, rnti, mcs, size, componentCarrierId);
 
 
Base class for ***StatsCalculator classes.
std::string GetUlOutputFilename()
Get the name of the file where the uplink statistics will be stored.
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.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
static uint16_t FindCellIdFromEnbRlcPath(std::string path)
Retrieves CellId from Enb RLC path in the attribute system.
std::string GetDlOutputFilename()
Get the name of the file where the downlink statistics will be stored.
Takes care of storing the information generated at MAC layer.
~MacStatsCalculator() override
Destructor.
static TypeId GetTypeId()
Register this type.
std::ofstream m_dlOutFile
Downlink output trace file.
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.
bool m_dlFirstWrite
When writing DL MAC statistics first time to file, columns description is added.
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source.
void SetDlOutputFilename(std::string outputFilename)
Set the name of the file where the downlink statistics will be stored.
std::ofstream m_ulOutFile
Uplink output trace file.
std::string GetUlOutputFilename()
Get the name of the file where the uplink statistics will be stored.
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.
MacStatsCalculator()
Constructor.
void DlScheduling(uint16_t cellId, uint64_t imsi, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Notifies the stats calculator that an downlink scheduling has occurred.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
bool m_ulFirstWrite
When writing UL MAC statistics first time to file, columns description is added.
std::string GetDlOutputFilename()
Get the name of the file where the downlink statistics will be stored.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Hold variables of type string.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
DlSchedulingCallbackInfo structure.
uint32_t subframeNo
subframe number
uint8_t componentCarrierId
component carrier ID
uint32_t frameNo
frame number