Added CellId output to RlcStats file

This commit is contained in:
jnin
2011-06-27 14:28:58 +02:00
parent 0b1bbb8868
commit 3e92b10940
6 changed files with 213 additions and 113 deletions

View File

@@ -24,7 +24,7 @@
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
#include "ns3/gtk-config-store.h"
using namespace ns3;
@@ -73,7 +73,7 @@ int main (int argc, char *argv[])
EpsBearer bearer (q);
lena->ActivateEpsBearer (ueDevs, bearer);
Simulator::Stop (Seconds (2));
Simulator::Stop (Seconds (5));
lena->EnableMacTraces ();
lena->EnableRlcTraces ();
@@ -86,13 +86,13 @@ int main (int argc, char *argv[])
{
Ptr<ConstantPositionMobilityModel> mm = ueNodes.Get (i)->GetObject<ConstantPositionMobilityModel> ();
mm->SetPosition (Vector (userDistance[i], 0.0, 0.0));
} // rkwan
} // rkwan
Simulator::Run ();
// Uncomment to show available paths
/*GtkConfigStore config;
config.ConfigureAttributes ();*/
GtkConfigStore config;
config.ConfigureAttributes ();
Simulator::Destroy ();

View File

@@ -29,6 +29,7 @@
#include <ns3/lte-ue-rrc.h>
#include <ns3/lte-ue-mac.h>
#include <ns3/lte-enb-mac.h>
#include <ns3/lte-enb-net-device.h>
#include <ns3/lte-enb-phy.h>
#include <ns3/lte-ue-phy.h>
@@ -420,7 +421,7 @@ FindImsiFromEnbRlcPath (std::string path)
// Sample path input:
// /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbRrc/UeMap/#C-RNTI/RadioBearerMap/#LCID/LteRlc/RxPDU
// We retrieve the UeInfo accociated to the C-RNTI and perform the IMSI lookup
// We retrieve the UeInfo associated to the C-RNTI and perform the IMSI lookup
std::string ueMapPath = path.substr (0, path.find ("/RadioBearerMap"));
Config::MatchContainer match = Config::LookupMatches (ueMapPath);
@@ -435,11 +436,31 @@ FindImsiFromEnbRlcPath (std::string path)
}
}
uint64_t
FindImsiFromUeRlc (std::string path)
uint16_t
FindCellIdFromEnbRlcPath (std::string path)
{
// Sample path input:
// /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbRrc/UeMap/#C-RNTI/RadioBearerMap/#LCID/LteRlc/RxPDU
// We retrieve the CellId associated to the Enb
std::string enbNetDevicePath = path.substr (0, path.find ("/LteEnbRrc"));
Config::MatchContainer match = Config::LookupMatches (enbNetDevicePath);
if (match.GetN () != 0)
{
Ptr<Object> enbNetDevice = match.Get (0);
return enbNetDevice->GetObject<LteEnbNetDevice> ()->GetCellId ();
}
else
{
NS_FATAL_ERROR ("Lookup " << enbNetDevicePath << " got no matches");
}
}
uint64_t
FindImsiFromUeRlcPath (std::string path)
{
// Sample path input:
// /NodeList/1/DeviceList/0/LteUeRrc/RlcMap/1/RxPDU
// /NodeList/#NodeId/DeviceList/#DeviceId/LteUeRrc/RlcMap/#LCID/RxPDU
// We retrieve the LteUeNetDevice path
@@ -458,20 +479,20 @@ FindImsiFromUeRlc (std::string path)
}
void
DlTxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
uint64_t imsi = FindImsiFromEnbRlcPath (path);
m_rlcStats->DlTxPdu (imsi, rnti, lcid, packetSize);
uint16_t cellId = FindCellIdFromEnbRlcPath (path);
m_rlcStats->DlTxPdu (cellId, imsi, rnti, lcid, packetSize);
}
void
DlRxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
uint64_t imsi = FindImsiFromUeRlc (path);
uint64_t imsi = FindImsiFromUeRlcPath (path);
m_rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay);
}
@@ -488,7 +509,7 @@ void
UlTxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
uint64_t imsi = FindImsiFromUeRlc (path);
uint64_t imsi = FindImsiFromUeRlcPath (path);
m_rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize);
}
@@ -497,7 +518,8 @@ UlRxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
uint64_t imsi = FindImsiFromEnbRlcPath (path);
m_rlcStats->UlRxPdu (imsi, rnti, lcid, packetSize, delay);
uint16_t cellId = FindCellIdFromEnbRlcPath (path);
m_rlcStats->UlRxPdu (cellId, imsi, rnti, lcid, packetSize, delay);
}

View File

@@ -40,16 +40,16 @@ ImsiLcidPair::ImsiLcidPair (const uint64_t a, const uint8_t b)
bool
operator == (const ImsiLcidPair &a, const ImsiLcidPair &b)
{
return ( (a.m_imsi == b.m_imsi) && (a.m_lcId == b.m_lcId) );
return ((a.m_imsi == b.m_imsi) && (a.m_lcId == b.m_lcId));
}
bool
operator < (const ImsiLcidPair& a, const ImsiLcidPair& b)
{
return ( (a.m_imsi < b.m_imsi) || ( (a.m_imsi == b.m_imsi) && (a.m_lcId < b.m_lcId) ) );
return ((a.m_imsi < b.m_imsi) || ((a.m_imsi == b.m_imsi) && (a.m_lcId
< b.m_lcId)));
}
NS_LOG_COMPONENT_DEFINE ("RlcStatsCalculator");
NS_OBJECT_ENSURE_REGISTERED (RlcStatsCalculator);
@@ -72,29 +72,23 @@ RlcStatsCalculator::~RlcStatsCalculator ()
TypeId
RlcStatsCalculator::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::RlcStatsCalculator")
.SetParent<Object> ()
.AddConstructor<RlcStatsCalculator> ()
.AddAttribute ("DlOutputFilename",
"Name of the file where the downlink results will be saved.",
StringValue ("DlRlcStats.csv"),
MakeStringAccessor (&RlcStatsCalculator::SetDlOutputFilename),
MakeStringChecker ())
.AddAttribute ("UlOutputFilename",
"Name of the file where the uplink results will be saved.",
StringValue ("UlRlcStats.csv"),
MakeStringAccessor (&RlcStatsCalculator::SetUlOutputFilename),
MakeStringChecker ())
.AddAttribute ("StartTime",
"Start time of the on going epoch.",
TimeValue ( Seconds (0.) ),
MakeTimeAccessor (&RlcStatsCalculator::m_startTime),
MakeTimeChecker ())
.AddAttribute ("EpochDuration",
"Epoch duration.", TimeValue (Seconds (0.25)),
MakeTimeAccessor (&RlcStatsCalculator::m_epochDuration),
MakeTimeChecker ())
;
static TypeId
tid =
TypeId ("ns3::RlcStatsCalculator").SetParent<Object> ().AddConstructor<
RlcStatsCalculator> ().AddAttribute ("DlOutputFilename",
"Name of the file where the downlink results will be saved.",
StringValue ("DlRlcStats.csv"), MakeStringAccessor (
&RlcStatsCalculator::SetDlOutputFilename),
MakeStringChecker ()).AddAttribute ("UlOutputFilename",
"Name of the file where the uplink results will be saved.",
StringValue ("UlRlcStats.csv"), MakeStringAccessor (
&RlcStatsCalculator::SetUlOutputFilename),
MakeStringChecker ()).AddAttribute ("StartTime",
"Start time of the on going epoch.", TimeValue (Seconds (0.)),
MakeTimeAccessor (&RlcStatsCalculator::m_startTime),
MakeTimeChecker ()).AddAttribute ("EpochDuration",
"Epoch duration.", TimeValue (Seconds (0.25)), MakeTimeAccessor (
&RlcStatsCalculator::m_epochDuration), MakeTimeChecker ());
return tid;
}
@@ -111,11 +105,12 @@ RlcStatsCalculator::SetDlOutputFilename (std::string outputFilename)
}
void
RlcStatsCalculator::UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
RlcStatsCalculator::UlTxPdu (uint64_t imsi, uint16_t rnti,
uint8_t lcid, uint32_t packetSize)
{
NS_LOG_FUNCTION (this << "UlTxPDU" << imsi << rnti << (uint32_t) lcid << packetSize);
ImsiLcidPair p (imsi, lcid);
if (Simulator::Now () > m_startTime )
if (Simulator::Now () > m_startTime)
{
m_flowId[p] = LteFlowId_t (rnti, lcid);
m_ulTxPackets[p]++;
@@ -125,26 +120,51 @@ RlcStatsCalculator::UlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_
}
void
RlcStatsCalculator::DlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize)
RlcStatsCalculator::DlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti,
uint8_t lcid, uint32_t packetSize)
{
NS_LOG_FUNCTION (this << "DlTxPDU" << imsi << rnti << (uint32_t) lcid << packetSize);
NS_LOG_FUNCTION (this << "DlTxPDU" << imsi << rnti << (uint32_t) lcid << packetSize);
ImsiLcidPair p (imsi, lcid);
if (Simulator::Now () > m_startTime )
bool forceEpoch = false;
if (Simulator::Now () > m_startTime)
{
// If the UE hands off to another cell, restart the epoch automatically
if (m_dlCellId[p] != 0 && m_dlCellId[p] != cellId)
{
forceEpoch = true;
}
else
{
m_dlCellId[p] = cellId;
}
m_flowId[p] = LteFlowId_t (rnti, lcid);
m_dlTxPackets[p]++;
m_dlTxData[p] += packetSize;
}
CheckEpoch ();
CheckEpoch (forceEpoch);
}
void
RlcStatsCalculator::UlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
RlcStatsCalculator::UlRxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti,
uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
NS_LOG_FUNCTION (this << "UlRxPDU" << imsi << rnti << (uint32_t) lcid << packetSize << delay);
ImsiLcidPair p (imsi, lcid);
if (Simulator::Now () > m_startTime )
bool forceEpoch = false;
if (Simulator::Now () > m_startTime)
{
// If the UE hands off to another cell, restart the epoch automatically
if (m_ulCellId[p] != 0 && m_ulCellId[p] != cellId)
{
forceEpoch = true;
}
else
{
m_ulCellId[p] = cellId;
}
m_ulRxPackets[p]++;
m_ulRxData[p] += packetSize;
@@ -159,15 +179,16 @@ RlcStatsCalculator::UlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_
m_ulPduSize[p]->Update (packetSize);
}
CheckEpoch ();
CheckEpoch (forceEpoch);
}
void
RlcStatsCalculator::DlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
RlcStatsCalculator::DlRxPdu (uint64_t imsi, uint16_t rnti,
uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
NS_LOG_FUNCTION (this << "DlRxPDU" << imsi << rnti << (uint32_t) lcid << packetSize << delay);
ImsiLcidPair p (imsi, lcid);
if (Simulator::Now () > m_startTime )
if (Simulator::Now () > m_startTime)
{
m_dlRxPackets[p]++;
m_dlRxData[p] += packetSize;
@@ -189,14 +210,14 @@ void
RlcStatsCalculator::ShowResults (void)
{
NS_LOG_FUNCTION (this << m_ulOutputFilename.c_str () << m_dlOutputFilename.c_str () );
NS_LOG_FUNCTION (this << m_ulOutputFilename.c_str () << m_dlOutputFilename.c_str () );
NS_LOG_INFO ("Write Rlc Stats in " << m_ulOutputFilename.c_str () <<
" and in " << m_dlOutputFilename.c_str ());
std::ofstream ulOutFile;
std::ofstream dlOutFile;
if ( m_firstWrite == true )
if (m_firstWrite == true)
{
ulOutFile.open (m_ulOutputFilename.c_str ());
if (!ulOutFile.is_open ())
@@ -212,25 +233,27 @@ RlcStatsCalculator::ShowResults (void)
return;
}
m_firstWrite = false;
ulOutFile << "% start\tend\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
ulOutFile
<< "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
ulOutFile << "delay\tstdDev\tmin\tmax\t";
ulOutFile << "PduSize\tstdDev\tmin\tmax";
ulOutFile << std::endl;
dlOutFile << "% start\tend\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
dlOutFile
<< "% start\tend\tCellId\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
dlOutFile << "delay\tstdDev\tmin\tmax\t";
dlOutFile << "PduSize\tstdDev\tmin\tmax";
dlOutFile << std::endl;
}
else
{
ulOutFile.open (m_ulOutputFilename.c_str (), std::ios_base::app);
ulOutFile.open (m_ulOutputFilename.c_str (), std::ios_base::app);
if (!ulOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
dlOutFile.open (m_dlOutputFilename.c_str (), std::ios_base::app);
dlOutFile.open (m_dlOutputFilename.c_str (), std::ios_base::app);
if (!dlOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
@@ -248,35 +271,39 @@ RlcStatsCalculator::WriteUlResults (std::ofstream& outFile)
{
// Get the unique IMSI / LCID list
std::vector<ImsiLcidPair > pairVector;
for (Uint32Map::iterator it = m_ulTxPackets.begin (); it != m_ulTxPackets.end (); ++it)
std::vector<ImsiLcidPair> pairVector;
for (Uint32Map::iterator it = m_ulTxPackets.begin (); it
!= m_ulTxPackets.end (); ++it)
{
if (find (pairVector.begin (), pairVector.end (), (*it).first ) == pairVector.end () )
if (find (pairVector.begin (), pairVector.end (), (*it).first)
== pairVector.end ())
{
pairVector.push_back ((*it).first);
}
}
Time endTime = m_startTime + m_epochDuration;
for (std::vector<ImsiLcidPair>::iterator it = pairVector.begin (); it != pairVector.end (); ++it)
for (std::vector<ImsiLcidPair>::iterator it = pairVector.begin (); it
!= pairVector.end (); ++it)
{
ImsiLcidPair p = *it;
outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << p.m_imsi << "\t";
outFile << m_flowId[p].m_rnti << "\t";
outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
outFile << GetUlTxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlTxData (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlRxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlRxData (p.m_imsi, p.m_lcId) << "\t";
outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << GetUlCellId (p.m_imsi, p.m_lcId) << "\t";
outFile << p.m_imsi << "\t";
outFile << m_flowId[p].m_rnti << "\t";
outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
outFile << GetUlTxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlTxData (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlRxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlRxData (p.m_imsi, p.m_lcId) << "\t";
std::vector<double> stats = GetUlDelayStats (p.m_imsi, p.m_lcId);
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
{
outFile << (*it) * 1e-9 << "\t";
}
stats = GetUlPduSizeStats (p.m_imsi, p.m_lcId);
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
{
outFile << (*it) << "\t";
}
@@ -290,35 +317,39 @@ void
RlcStatsCalculator::WriteDlResults (std::ofstream& outFile)
{
// Get the unique IMSI list
std::vector<ImsiLcidPair > pairVector;
for (Uint32Map::iterator it = m_dlTxPackets.begin (); it != m_dlTxPackets.end (); ++it)
std::vector<ImsiLcidPair> pairVector;
for (Uint32Map::iterator it = m_dlTxPackets.begin (); it
!= m_dlTxPackets.end (); ++it)
{
if (find (pairVector.begin (), pairVector.end (), (*it).first ) == pairVector.end () )
if (find (pairVector.begin (), pairVector.end (), (*it).first)
== pairVector.end ())
{
pairVector.push_back ((*it).first);
}
}
Time endTime = m_startTime + m_epochDuration;
for (std::vector<ImsiLcidPair>::iterator pair = pairVector.begin (); pair != pairVector.end (); ++pair)
for (std::vector<ImsiLcidPair>::iterator pair = pairVector.begin (); pair
!= pairVector.end (); ++pair)
{
ImsiLcidPair p = *pair;
outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << p.m_imsi << "\t";
outFile << m_flowId[p].m_rnti << "\t";
outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
outFile << GetDlTxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlTxData (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlRxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlRxData (p.m_imsi, p.m_lcId) << "\t";
outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << GetDlCellId (p.m_imsi, p.m_lcId) << "\t";
outFile << p.m_imsi << "\t";
outFile << m_flowId[p].m_rnti << "\t";
outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
outFile << GetDlTxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlTxData (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlRxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlRxData (p.m_imsi, p.m_lcId) << "\t";
std::vector<double> stats = GetDlDelayStats (p.m_imsi, p.m_lcId);
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
{
outFile << (*it) * 1e-9 << "\t";
}
stats = GetDlPduSizeStats (p.m_imsi, p.m_lcId);
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for (std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it)
{
outFile << (*it) << "\t";
}
@@ -331,27 +362,26 @@ RlcStatsCalculator::WriteDlResults (std::ofstream& outFile)
void
RlcStatsCalculator::ResetResults (void)
{
m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end () );
m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end () );
m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end () );
m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end () );
m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end () );
m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end () );
m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end ());
m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end ());
m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end ());
m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end ());
m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end ());
m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end ());
m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end () );
m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end () );
m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end () );
m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end () );
m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end () );
m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end () );
m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end ());
m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end ());
m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end ());
m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end ());
m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end ());
m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end ());
}
void
RlcStatsCalculator::CheckEpoch (void)
RlcStatsCalculator::CheckEpoch (bool forceEpoch)
{
if ( Simulator::Now () > m_startTime + m_epochDuration )
if (Simulator::Now () > m_startTime + m_epochDuration /*|| forceEpoch == true*/)
{
std::cout << "JNNNNNNNNNG New epoch! startTime " << m_startTime << " epoch duration " << m_epochDuration << std::endl;
ShowResults ();
ResetResults ();
StartEpoch ();
@@ -398,7 +428,7 @@ RlcStatsCalculator::GetUlDelay (uint64_t imsi, uint8_t lcid)
{
ImsiLcidPair p (imsi, lcid);
Uint64StatsMap::iterator it = m_ulDelay.find (p);
if ( it == m_ulDelay.end () )
if (it == m_ulDelay.end ())
{
NS_LOG_ERROR ("UL delay for " << imsi << " - " << lcid << " not found");
return 0;
@@ -413,9 +443,9 @@ RlcStatsCalculator::GetUlDelayStats (uint64_t imsi, uint8_t lcid)
ImsiLcidPair p (imsi, lcid);
std::vector<double> stats;
Uint64StatsMap::iterator it = m_ulDelay.find (p);
if ( it == m_ulDelay.end () )
if (it == m_ulDelay.end ())
{
NS_LOG_ERROR ("UL delay for " << imsi << " - " << lcid << " not found");
NS_LOG_ERROR ("UL delay for " << imsi << " - " << lcid << " not found");
return stats;
}
@@ -432,7 +462,7 @@ RlcStatsCalculator::GetUlPduSizeStats (uint64_t imsi, uint8_t lcid)
ImsiLcidPair p (imsi, lcid);
std::vector<double> stats;
Uint32StatsMap::iterator it = m_ulPduSize.find (p);
if ( it == m_ulPduSize.end () )
if (it == m_ulPduSize.end ())
{
NS_LOG_ERROR ("UL PDU Size for " << imsi << " - " << lcid << " not found");
return stats;
@@ -473,12 +503,26 @@ RlcStatsCalculator::GetDlRxData (uint64_t imsi, uint8_t lcid)
return m_dlRxData[p];
}
uint32_t
RlcStatsCalculator::GetUlCellId (uint64_t imsi, uint8_t lcid)
{
ImsiLcidPair p (imsi, lcid);
return m_ulCellId[p];
}
uint32_t
RlcStatsCalculator::GetDlCellId (uint64_t imsi, uint8_t lcid)
{
ImsiLcidPair p (imsi, lcid);
return m_dlCellId[p];
}
double
RlcStatsCalculator::GetDlDelay (uint64_t imsi, uint8_t lcid)
{
ImsiLcidPair p (imsi, lcid);
Uint64StatsMap::iterator it = m_dlDelay.find (p);
if ( it == m_dlDelay.end () )
if (it == m_dlDelay.end ())
{
NS_LOG_ERROR ("DL delay for " << imsi << " not found");
return 0;
@@ -492,10 +536,10 @@ RlcStatsCalculator::GetDlDelayStats (uint64_t imsi, uint8_t lcid)
ImsiLcidPair p (imsi, lcid);
std::vector<double> stats;
Uint64StatsMap::iterator it = m_dlDelay.find (p);
if ( it == m_dlDelay.end () )
if (it == m_dlDelay.end ())
{
NS_LOG_ERROR ("DL delay for " << imsi << " not found");
NS_LOG_ERROR ("DL delay for " << imsi << " not found");
return stats;
}
@@ -512,7 +556,7 @@ RlcStatsCalculator::GetDlPduSizeStats (uint64_t imsi, uint8_t lcid)
ImsiLcidPair p (imsi, lcid);
std::vector<double> stats;
Uint32StatsMap::iterator it = m_dlPduSize.find (p);
if ( it == m_dlPduSize.end () )
if (it == m_dlPduSize.end ())
{
NS_LOG_ERROR ("DL delay for " << imsi << " not found");

View File

@@ -106,22 +106,24 @@ public:
/**
* Notifies the stats calculator that an uplink reception has occurred.
* @param cellId CellId of the attached Enb
* @param imsi IMSI of the UE who received the PDU
* @param rnti C-RNTI of the UE who received the PDU
* @param lcid LCID through which the PDU has been received
* @param packetSize size of the PDU in bytes
* @param delay RLC to RLC delay in nanoseconds
*/
void UlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay);
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 downlink transmission has occurred.
* @param cellId CellId of the attached Enb
* @param imsi IMSI of the UE who is receiving the PDU
* @param rnti C-RNTI of the UE who is receiving the PDU
* @param lcid LCID through which the PDU has been transmitted
* @param packetSize size of the PDU in bytes
*/
void DlTxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize);
void DlTxPdu (uint16_t cellId, uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_t packetSize);
/**
* Notifies the stats calculator that an downlink reception has occurred.
@@ -165,6 +167,14 @@ public:
*/
uint64_t GetUlRxData (uint64_t imsi, uint8_t lcid);
/**
* Gets the attached Enb cellId.
* @param imsi IMSI of the UE
* @param lcid LCID
* @return Enb cellId
*/
uint32_t GetUlCellId (uint64_t imsi, uint8_t lcid);
/**
* Gets the uplink RLC to RLC delay
* @param imsi IMSI of the UE
@@ -221,6 +231,14 @@ public:
*/
uint64_t GetDlRxData (uint64_t imsi, uint8_t lcid);
/**
* Gets the attached Enb cellId.
* @param imsi IMSI of the UE
* @param lcid LCID
* @return Enb cellId
*/
uint32_t GetDlCellId (uint64_t imsi, uint8_t lcid);
/**
* Gets the downlink RLC to RLC delay
* @param imsi IMSI of the UE
@@ -252,11 +270,12 @@ private:
void ResetResults (void);
void StartEpoch (void);
void CheckEpoch (void);
void CheckEpoch (bool forceEpoch = false);
FlowIdMap m_flowId;
std::string m_dlOutputFilename;
Uint32Map m_dlCellId;
Uint32Map m_dlTxPackets;
Uint32Map m_dlRxPackets;
Uint64Map m_dlTxData;
@@ -265,6 +284,7 @@ private:
Uint32StatsMap m_dlPduSize;
std::string m_ulOutputFilename;
Uint32Map m_ulCellId;
Uint32Map m_ulTxPackets;
Uint32Map m_ulRxPackets;
Uint64Map m_ulTxData;

View File

@@ -72,7 +72,8 @@ NS_OBJECT_ENSURE_REGISTERED (LteUeRrc);
LteUeRrc::LteUeRrc ()
: m_cmacSapProvider (0),
m_macSapProvider (0)
m_macSapProvider (0),
m_cellId (0)
{
NS_LOG_FUNCTION (this);
m_cmacSapUser = new UeMemberLteUeCmacSapUser (this);
@@ -116,7 +117,6 @@ LteUeRrc::GetTypeId (void)
return tid;
}
void
LteUeRrc::SetLteUeCmacSapProvider (LteUeCmacSapProvider * s)
{
@@ -191,6 +191,13 @@ LteUeRrc::GetRnti ()
return m_rnti;
}
uint16_t
LteUeRrc::GetCellId ()
{
NS_LOG_FUNCTION (this);
return m_cellId;
}
std::vector<uint8_t>
LteUeRrc::GetLcIdVector ()
{

View File

@@ -122,6 +122,13 @@ public:
*/
uint16_t GetRnti ();
/**
*
* \return the CellId of the attached Enb
*/
uint16_t GetCellId ();
/**
*
* @return a vector with the allocated LCID