This commit is contained in:
mmiozzo
2011-11-18 16:29:47 +01:00
6 changed files with 48 additions and 33 deletions

View File

@@ -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 <ns3/buildings-propagation-loss-model.h>
#include <iomanip>
@@ -210,7 +210,7 @@ main (int argc, char *argv[])
Simulator::Run();
/* GtkConfigStore config;
/*GtkConfigStore config;
config.ConfigureAttributes ();*/
Simulator::Destroy();

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;

View File

@@ -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() . "/";