22 #include "ns3/string.h"
23 #include <ns3/simulator.h>
35 : m_dlFirstWrite (true),
52 .AddConstructor<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.",
93 uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
95 NS_LOG_FUNCTION (
this << cellId << imsi << frameNo << subframeNo << rnti << (uint32_t) mcsTb1 << sizeTb1 << (uint32_t) mcsTb2 << sizeTb2);
98 std::ofstream outFile;
102 if (!outFile.is_open ())
108 outFile <<
"% time\tcellId\tIMSI\tframe\tsframe\tRNTI\tmcsTb1\tsizeTb1\tmcsTb2\tsizeTb2";
109 outFile << std::endl;
114 if (!outFile.is_open ())
122 outFile << (uint32_t) cellId <<
"\t";
123 outFile << imsi <<
"\t";
124 outFile << frameNo <<
"\t";
125 outFile << subframeNo <<
"\t";
126 outFile << rnti <<
"\t";
127 outFile << (uint32_t) mcsTb1 <<
"\t";
128 outFile << sizeTb1 <<
"\t";
129 outFile << (uint32_t) mcsTb2 <<
"\t";
130 outFile << sizeTb2 << std::endl;
136 uint32_t subframeNo, uint16_t rnti,uint8_t mcsTb, uint16_t size)
138 NS_LOG_FUNCTION (
this << cellId << imsi << frameNo << subframeNo << rnti << (uint32_t) mcsTb << size);
141 std::ofstream outFile;
145 if (!outFile.is_open ())
151 outFile <<
"% time\tcellId\tIMSI\tframe\tsframe\tRNTI\tmcs\tsize";
152 outFile << std::endl;
157 if (!outFile.is_open ())
165 outFile << (uint32_t) cellId <<
"\t";
166 outFile << imsi <<
"\t";
167 outFile << frameNo <<
"\t";
168 outFile << subframeNo <<
"\t";
169 outFile << rnti <<
"\t";
170 outFile << (uint32_t) mcsTb <<
"\t";
171 outFile << size << std::endl;
177 std::string path, uint32_t frameNo, uint32_t subframeNo,
178 uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1,
179 uint8_t mcsTb2, uint16_t sizeTb2)
183 std::ostringstream pathAndRnti;
184 pathAndRnti << path <<
"/" << rnti;
185 if (macStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
187 imsi = macStats->GetImsiPath (pathAndRnti.str ());
192 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, frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
211 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
212 uint8_t mcs, uint16_t size)
217 std::ostringstream pathAndRnti;
218 pathAndRnti << path <<
"/" << rnti;
219 if (macStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
221 imsi = macStats->GetImsiPath (pathAndRnti.str ());
226 macStats->SetImsiPath (pathAndRnti.str (), imsi);
229 if (macStats->ExistsCellIdPath (pathAndRnti.str ()) ==
true)
231 cellId = macStats->GetCellIdPath (pathAndRnti.str ());
236 macStats->SetCellIdPath (pathAndRnti.str (), cellId);
239 macStats->UlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcs, size);
Doxygen introspection did not find any typical Config paths.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
static uint64_t FindImsiFromEnbMac(std::string path, uint16_t rnti)
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
hold variables of type string
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source.
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
MacStatsCalculator()
Constructor.
static uint16_t FindCellIdFromEnbMac(std::string path, uint16_t rnti)
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)
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
void DlScheduling(uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
Notifies the stats calculator that an downlink scheduling has occurred.
void SetDlOutputFilename(std::string outputFilename)
Set the name of the file where the downlink statistics will be stored.
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.
static Time Now(void)
Return the "current simulation time".
static void UlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t size)
Trace sink for the ns3::LteEnbMac::UlScheduling trace source.
int64_t GetNanoSeconds(void) const
std::string GetUlOutputFilename(void)
Get the name of the file where the uplink statistics will be stored.
void UlScheduling(uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb, uint16_t sizeTb)
Notifies the stats calculator that an uplink scheduling has occurred.
#define NS_LOG_ERROR(msg)
virtual ~MacStatsCalculator()
Destructor.
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)
std::string GetDlOutputFilename(void)
Get the name of the file where the downlink statistics will be stored.