From 55feaa078cb6c6318c0a89b879144b999cc8a736 Mon Sep 17 00:00:00 2001 From: Jaume Nin Date: Fri, 18 Nov 2011 16:06:41 +0100 Subject: [PATCH 1/2] Fixed bug in IMSI retrieval for MacStats --- src/lte/examples/lena-runtime-profiler.cc | 4 +- src/lte/helper/lena-helper.cc | 52 ++++++++++++----------- src/lte/helper/lte-stats-calculator.cc | 4 ++ src/lte/helper/mac-stats-calculator.cc | 4 +- src/lte/model/lte-ue-net-device.cc | 14 +++++- 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/lte/examples/lena-runtime-profiler.cc b/src/lte/examples/lena-runtime-profiler.cc index 2dc64fc5c..7179dfc5f 100644 --- a/src/lte/examples/lena-runtime-profiler.cc +++ b/src/lte/examples/lena-runtime-profiler.cc @@ -210,8 +210,8 @@ main (int argc, char *argv[]) Simulator::Run(); -/* GtkConfigStore config; - config.ConfigureAttributes ();*/ + GtkConfigStore config; + config.ConfigureAttributes (); Simulator::Destroy(); return 0; diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 6b43a91bb..bdb5d5854 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -21,33 +21,25 @@ #include "lena-helper.h" - #include #include #include - #include #include #include #include #include - #include #include #include #include #include #include - #include #include - #include - #include - #include - #include @@ -335,6 +327,7 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) Ptr LenaHelper::InstallSingleUeDevice (Ptr n) { + NS_LOG_FUNCTION (this); Ptr dlPhy = CreateObject (); Ptr ulPhy = CreateObject (); @@ -451,6 +444,7 @@ LenaHelper::ActivateEpsBearer (Ptr ueDevice, EpsBearer bearer) void LenaHelper::EnableLogComponents (void) { + LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL); LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL); LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL); LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL); @@ -507,12 +501,12 @@ FindImsiFromEnbRlcPath (std::string path) // We retrieve the UeInfo associated to the C-RNTI and perform the IMSI lookup std::string ueMapPath = path.substr (0, path.find ("/RadioBearerMap")); - NS_LOG_LOGIC ("ueMapPath = " << ueMapPath); Config::MatchContainer match = Config::LookupMatches (ueMapPath); if (match.GetN () != 0) { Ptr ueInfo = match.Get (0); + NS_LOG_LOGIC ("FindImsiFromEnbRlcPath: " << path << ", " << ueInfo->GetObject ()->GetImsi ()); return ueInfo->GetObject ()->GetImsi (); } else @@ -535,6 +529,7 @@ FindCellIdFromEnbRlcPath (std::string path) if (match.GetN () != 0) { Ptr enbNetDevice = match.Get (0); + NS_LOG_LOGIC ("FindCellIdFromEnbRlcPath: " << path << ", " << enbNetDevice->GetObject ()->GetCellId ()); return enbNetDevice->GetObject ()->GetCellId (); } else @@ -557,6 +552,7 @@ FindImsiFromUeRlcPath (std::string path) if (match.GetN () != 0) { Ptr ueNetDevice = match.Get (0); + NS_LOG_LOGIC ("FindImsiFromUeRlcPath: " << path << ", " << ueNetDevice->GetObject ()->GetImsi ()); return ueNetDevice->GetObject ()->GetImsi (); } else @@ -573,11 +569,11 @@ FindImsiFromEnbMac (std::string path, uint16_t rnti) // /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbMac/DlScheduling std::ostringstream oss; std::string p = path.substr (0, path.find ("/LteEnbMac")); - NS_LOG_LOGIC ("p = " << p); oss << rnti; p += "/LteEnbRrc/UeMap/" + oss.str (); - NS_LOG_LOGIC ("p = " << p); - return FindImsiFromEnbRlcPath (p); + uint64_t imsi = FindImsiFromEnbRlcPath (p); + NS_LOG_LOGIC ("FindImsiFromEnbMac: " << path << ", " << rnti << ", " << imsi); + return imsi; } uint16_t @@ -589,7 +585,9 @@ FindCellIdFromEnbMac (std::string path, uint16_t rnti) std::string p = path.substr (0, path.find ("/LteEnbMac")); oss << rnti; p += "/LteEnbRrc/UeMap/" + oss.str (); - return FindCellIdFromEnbRlcPath (p); + uint16_t cellId = FindCellIdFromEnbRlcPath (p); + NS_LOG_LOGIC ("FindCellIdFromEnbMac: " << path << ", "<< rnti << ", " << cellId); + return cellId; } @@ -703,25 +701,27 @@ DlSchedulingCallback (Ptr macStats, { NS_LOG_FUNCTION (macStats << path); uint64_t imsi = 0; - if (macStats->ExistsImsiPath(path) == true) + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << rnti; + if (macStats->ExistsImsiPath(pathAndRnti.str ()) == true) { - imsi = macStats->GetImsiPath (path); + imsi = macStats->GetImsiPath (pathAndRnti.str ()); } else { imsi = FindImsiFromEnbMac (path, rnti); - macStats->SetImsiPath (path, imsi); + macStats->SetImsiPath (pathAndRnti.str (), imsi); } uint16_t cellId = 0; - if (macStats->ExistsCellIdPath(path) == true) + if (macStats->ExistsCellIdPath(pathAndRnti.str ()) == true) { - cellId = macStats->GetCellIdPath (path); + cellId = macStats->GetCellIdPath (pathAndRnti.str ()); } else { cellId = FindCellIdFromEnbMac (path, rnti); - macStats->SetCellIdPath (path, cellId); + macStats->SetCellIdPath (pathAndRnti.str (), cellId); } macStats->DlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); @@ -759,24 +759,26 @@ UlSchedulingCallback (Ptr macStats, std::string path, NS_LOG_FUNCTION (macStats << path); uint64_t imsi = 0; - if (macStats->ExistsImsiPath(path) == true) + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << rnti; + if (macStats->ExistsImsiPath(pathAndRnti.str ()) == true) { - imsi = macStats->GetImsiPath (path); + imsi = macStats->GetImsiPath (pathAndRnti.str ()); } else { imsi = FindImsiFromEnbMac (path, rnti); - macStats->SetImsiPath (path, imsi); + macStats->SetImsiPath (pathAndRnti.str (), imsi); } uint16_t cellId = 0; - if (macStats->ExistsCellIdPath(path) == true) + if (macStats->ExistsCellIdPath(pathAndRnti.str ()) == true) { - cellId = macStats->GetCellIdPath (path); + cellId = macStats->GetCellIdPath (pathAndRnti.str ()); } else { cellId = FindCellIdFromEnbMac (path, rnti); - macStats->SetCellIdPath (path, cellId); + macStats->SetCellIdPath (pathAndRnti.str (), cellId); } macStats->UlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcs, size); diff --git a/src/lte/helper/lte-stats-calculator.cc b/src/lte/helper/lte-stats-calculator.cc index dc66cd63a..2e3bf40a6 100644 --- a/src/lte/helper/lte-stats-calculator.cc +++ b/src/lte/helper/lte-stats-calculator.cc @@ -6,9 +6,11 @@ */ #include "lte-stats-calculator.h" +#include namespace ns3 { +NS_LOG_COMPONENT_DEFINE ("LteStatsCalculator"); LteStatsCalculator::LteStatsCalculator () : m_dlOutputFilename (""), @@ -86,6 +88,7 @@ LteStatsCalculator::ExistsImsiPath (std::string path) void LteStatsCalculator::SetImsiPath (std::string path, uint64_t imsi) { + NS_LOG_FUNCTION(this << path << imsi); m_pathImsiMap[path] = imsi; } @@ -111,6 +114,7 @@ LteStatsCalculator::ExistsCellIdPath (std::string path) void LteStatsCalculator::SetCellIdPath (std::string path, uint16_t cellId) { + NS_LOG_FUNCTION(this << path << cellId); m_pathCellIdMap[path] = cellId; } diff --git a/src/lte/helper/mac-stats-calculator.cc b/src/lte/helper/mac-stats-calculator.cc index c360b70e5..8ffa0a02b 100644 --- a/src/lte/helper/mac-stats-calculator.cc +++ b/src/lte/helper/mac-stats-calculator.cc @@ -56,7 +56,7 @@ void MacStatsCalculator::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) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << cellId << imsi << frameNo << subframeNo << rnti << mcsTb1 << sizeTb1 << mcsTb2 << sizeTb2); NS_LOG_INFO ("Write DL Mac Stats in " << GetDlOutputFilename ().c_str ()); std::ofstream outFile; @@ -99,7 +99,7 @@ void MacStatsCalculator::UlScheduling (uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,uint8_t mcs, uint16_t size) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << cellId << imsi << frameNo << subframeNo << rnti << mcs << size); NS_LOG_INFO ("Write UL Mac Stats in " << GetUlOutputFilename ().c_str ()); std::ofstream outFile; diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index e3de6677c..8ad40bc63 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -61,12 +61,22 @@ TypeId LteUeNetDevice::GetTypeId (void) PointerValue (), MakePointerAccessor (&LteUeNetDevice::m_rrc), MakePointerChecker ()) - .AddAttribute ("Imsi", + .AddAttribute ("LteUeMac", + "The MAC associated to this UeNetDevice", + PointerValue (), + MakePointerAccessor (&LteUeNetDevice::m_mac), + MakePointerChecker ()) + .AddAttribute ("LteUePhy", + "The PHY associated to this UeNetDevice", + PointerValue (), + MakePointerAccessor (&LteUeNetDevice::m_phy), + MakePointerChecker ()) +/* .AddAttribute ("Imsi", "International Mobile Subscriber Identity assigned to this UE", TypeId::ATTR_GET, UintegerValue (0), // not used because the attribute is read-only MakeUintegerAccessor (&LteUeNetDevice::m_imsi), - MakeUintegerChecker ()) + MakeUintegerChecker ())*/ ; return tid; From b069bf6be7ddc9e1bb44d0030a21185639edf008 Mon Sep 17 00:00:00 2001 From: Jaume Nin Date: Fri, 18 Nov 2011 16:22:08 +0100 Subject: [PATCH 2/2] Removed GTK pop up on example script. Set values for profiling script to the standard ones --- src/lte/examples/lena-runtime-profiler.cc | 6 +++--- src/lte/test/lte-test-run-time.pl | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lte/examples/lena-runtime-profiler.cc b/src/lte/examples/lena-runtime-profiler.cc index ce1cb2277..46c28f92b 100644 --- a/src/lte/examples/lena-runtime-profiler.cc +++ b/src/lte/examples/lena-runtime-profiler.cc @@ -23,7 +23,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" #include #include @@ -210,8 +210,8 @@ main (int argc, char *argv[]) Simulator::Run(); - GtkConfigStore config; - config.ConfigureAttributes (); + /*GtkConfigStore config; + config.ConfigureAttributes ();*/ Simulator::Destroy(); return 0; diff --git a/src/lte/test/lte-test-run-time.pl b/src/lte/test/lte-test-run-time.pl index 93ba5592c..d257c21f2 100755 --- a/src/lte/test/lte-test-run-time.pl +++ b/src/lte/test/lte-test-run-time.pl @@ -12,8 +12,7 @@ print FILE "#sTime\tnFloors\tnEnb\tnUe\trTime\trTDev\n"; my @nUe = ( 1, 5, 10, 15, 20, 25, 30 ); my @nEnb = ( 1, 2, 4, 6, 8, 12, 14, 18, 22 ); my @nFloors = ( 0, 1 ); -#$my @simTime = ( 1, 5, 10, 20 ); -my @simTime = ( 1 ); +my @simTime = ( 1, 5, 10, 20, 30, 40 ); my $traceDirectory = "."; my $traceDirectory = getcwd() . "/";