24 #include "ns3/string.h" 
   25 #include <ns3/simulator.h> 
   35   : m_dlFirstWrite (true),
 
   54     .AddAttribute (
"DlOutputFilename",
 
   55                    "Name of the file where the downlink results will be saved.",
 
   59     .AddAttribute (
"UlOutputFilename",
 
   60                    "Name of the file where the uplink results will be saved.",
 
   96           dlSchedulingCallbackInfo.
rnti << (uint32_t) dlSchedulingCallbackInfo.
mcsTb1 << dlSchedulingCallbackInfo.
sizeTb1 << (uint32_t) dlSchedulingCallbackInfo.
mcsTb2 << dlSchedulingCallbackInfo.
sizeTb2);
 
   99   std::ofstream outFile;
 
  103       if (!outFile.is_open ())
 
  109       outFile << 
"% time\tcellId\tIMSI\tframe\tsframe\tRNTI\tmcsTb1\tsizeTb1\tmcsTb2\tsizeTb2\tccId";
 
  110       outFile << std::endl;
 
  115       if (!outFile.is_open ())
 
  123   outFile << (uint32_t) cellId << 
"\t";
 
  124   outFile << imsi << 
"\t";
 
  125   outFile << dlSchedulingCallbackInfo.
frameNo << 
"\t";
 
  126   outFile << dlSchedulingCallbackInfo.
subframeNo << 
"\t";
 
  127   outFile << dlSchedulingCallbackInfo.
rnti << 
"\t";
 
  128   outFile << (uint32_t) dlSchedulingCallbackInfo.
mcsTb1 << 
"\t";
 
  129   outFile << dlSchedulingCallbackInfo.
sizeTb1 << 
"\t";
 
  130   outFile << (uint32_t) dlSchedulingCallbackInfo.
mcsTb2 << 
"\t";
 
  131   outFile << dlSchedulingCallbackInfo.
sizeTb2 << 
"\t";
 
  138                                   uint32_t subframeNo, uint16_t rnti,uint8_t mcsTb, uint16_t size, uint8_t componentCarrierId)
 
  140   NS_LOG_FUNCTION (
this << cellId << imsi << frameNo << subframeNo << rnti << (uint32_t) mcsTb << size);
 
  143   std::ofstream outFile;
 
  147       if (!outFile.is_open ())
 
  153       outFile << 
"% time\tcellId\tIMSI\tframe\tsframe\tRNTI\tmcs\tsize\tccId";
 
  154       outFile << std::endl;
 
  159       if (!outFile.is_open ())
 
  167   outFile << (uint32_t) cellId << 
"\t";
 
  168   outFile << imsi << 
"\t";
 
  169   outFile << frameNo << 
"\t";
 
  170   outFile << subframeNo << 
"\t";
 
  171   outFile << rnti << 
"\t";
 
  172   outFile << (uint32_t) mcsTb << 
"\t";
 
  173   outFile << size << 
"\t";
 
  174   outFile << (uint32_t) componentCarrierId << std::endl;
 
  183   std::ostringstream pathAndRnti;
 
  184   std::string pathEnb  = path.substr (0, path.find (
"/ComponentCarrierMap"));
 
  185   pathAndRnti << pathEnb << 
"/LteEnbRrc/UeMap/" << dlSchedulingCallbackInfo.
rnti;
 
  186   if (macStats->ExistsImsiPath (pathAndRnti.str ()) == 
true)
 
  188       imsi = macStats->GetImsiPath (pathAndRnti.str ());
 
  193       macStats->SetImsiPath (pathAndRnti.str (), imsi);
 
  196   if (macStats->ExistsCellIdPath (pathAndRnti.str ()) == 
true)
 
  198       cellId = macStats->GetCellIdPath (pathAndRnti.str ());
 
  203       macStats->SetCellIdPath (pathAndRnti.str (), cellId);
 
  206   macStats->DlScheduling (cellId, imsi, dlSchedulingCallbackInfo);
 
  211                       uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
 
  212                       uint8_t mcs, uint16_t size, uint8_t componentCarrierId)
 
  217   std::ostringstream pathAndRnti;
 
  218   std::string pathEnb  = path.substr (0, path.find (
"/ComponentCarrierMap"));
 
  219   pathAndRnti << pathEnb << 
"/LteEnbRrc/UeMap/" << rnti;
 
  220   if (macStats->ExistsImsiPath (pathAndRnti.str ()) == 
true)
 
  222       imsi = macStats->GetImsiPath (pathAndRnti.str ());
 
  227       macStats->SetImsiPath (pathAndRnti.str (), imsi);
 
  230   if (macStats->ExistsCellIdPath (pathAndRnti.str ()) == 
true)
 
  232       cellId = macStats->GetCellIdPath (pathAndRnti.str ());
 
  237       macStats->SetCellIdPath (pathAndRnti.str (), cellId);
 
  240   macStats->UlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcs, size, componentCarrierId);
 
Ptr< const AttributeChecker > MakeStringChecker(void)
 
Base class for ***StatsCalculator classes. 
 
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. 
 
uint32_t frameNo
frame number 
 
#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. 
 
static uint16_t FindCellIdFromEnbRlcPath(std::string path)
Retrieves CellId from Enb RLC path in the attribute system. 
 
Takes care of storing the information generated at MAC layer. 
 
uint8_t componentCarrierId
component carrier ID 
 
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. 
 
bool m_ulFirstWrite
When writing UL MAC statistics first time to file, columns description is added. 
 
void SetUlOutputFilename(std::string outputFilename)
Set 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 TypeId GetTypeId(void)
Register this type. 
 
uint32_t subframeNo
subframe number 
 
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
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. 
 
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored. 
 
bool m_dlFirstWrite
When writing DL MAC statistics first time to file, columns description is added. 
 
static Time Now(void)
Return the current simulation virtual time. 
 
int64_t GetNanoSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
 
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. 
 
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored. 
 
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source. 
 
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR. 
 
virtual ~MacStatsCalculator()
Destructor. 
 
DlSchedulingCallbackInfo structure. 
 
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
a unique identifier for an interface. 
 
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored. 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
void DlScheduling(uint16_t cellId, uint64_t imsi, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Notifies the stats calculator that an downlink scheduling has occurred. 
 
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.