Fixed bug in IMSI retrieval for MacStats

This commit is contained in:
Jaume Nin
2011-11-18 16:06:41 +01:00
parent 75e4620cf7
commit 55feaa078c
5 changed files with 47 additions and 31 deletions

View File

@@ -210,8 +210,8 @@ main (int argc, char *argv[])
Simulator::Run();
/* GtkConfigStore config;
config.ConfigureAttributes ();*/
GtkConfigStore config;
config.ConfigureAttributes ();
Simulator::Destroy();
return 0;

View File

@@ -21,33 +21,25 @@
#include "lena-helper.h"
#include <ns3/string.h>
#include <ns3/log.h>
#include <ns3/pointer.h>
#include <ns3/lte-enb-rrc.h>
#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>
#include <ns3/lte-spectrum-phy.h>
#include <ns3/lte-sinr-chunk-processor.h>
#include <ns3/single-model-spectrum-channel.h>
#include <ns3/friis-spectrum-propagation-loss.h>
#include <ns3/lte-enb-net-device.h>
#include <ns3/lte-ue-net-device.h>
#include <ns3/ff-mac-scheduler.h>
#include <iostream>
#include <ns3/buildings-propagation-loss-model.h>
#include <ns3/lte-spectrum-value-helper.h>
@@ -335,6 +327,7 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
Ptr<NetDevice>
LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
{
NS_LOG_FUNCTION (this);
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
@@ -451,6 +444,7 @@ LenaHelper::ActivateEpsBearer (Ptr<NetDevice> 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<Object> ueInfo = match.Get (0);
NS_LOG_LOGIC ("FindImsiFromEnbRlcPath: " << path << ", " << ueInfo->GetObject<UeInfo> ()->GetImsi ());
return ueInfo->GetObject<UeInfo> ()->GetImsi ();
}
else
@@ -535,6 +529,7 @@ FindCellIdFromEnbRlcPath (std::string path)
if (match.GetN () != 0)
{
Ptr<Object> enbNetDevice = match.Get (0);
NS_LOG_LOGIC ("FindCellIdFromEnbRlcPath: " << path << ", " << enbNetDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
return enbNetDevice->GetObject<LteEnbNetDevice> ()->GetCellId ();
}
else
@@ -557,6 +552,7 @@ FindImsiFromUeRlcPath (std::string path)
if (match.GetN () != 0)
{
Ptr<Object> ueNetDevice = match.Get (0);
NS_LOG_LOGIC ("FindImsiFromUeRlcPath: " << path << ", " << ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi ());
return ueNetDevice->GetObject<LteUeNetDevice> ()->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<MacStatsCalculator> 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<MacStatsCalculator> 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);

View File

@@ -6,9 +6,11 @@
*/
#include "lte-stats-calculator.h"
#include <ns3/log.h>
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;
}

View File

@@ -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;

View File

@@ -61,12 +61,22 @@ TypeId LteUeNetDevice::GetTypeId (void)
PointerValue (),
MakePointerAccessor (&LteUeNetDevice::m_rrc),
MakePointerChecker <LteUeRrc> ())
.AddAttribute ("Imsi",
.AddAttribute ("LteUeMac",
"The MAC associated to this UeNetDevice",
PointerValue (),
MakePointerAccessor (&LteUeNetDevice::m_mac),
MakePointerChecker <LteUeMac> ())
.AddAttribute ("LteUePhy",
"The PHY associated to this UeNetDevice",
PointerValue (),
MakePointerAccessor (&LteUeNetDevice::m_phy),
MakePointerChecker <LteUePhy> ())
/* .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<uint64_t> ())
MakeUintegerChecker<uint64_t> ())*/
;
return tid;