PhyStats calculator implementation. All code needed added to LteHelper. Prototype order changed in order to respect cellId,IMSI, rnti
This commit is contained in:
@@ -46,10 +46,10 @@ int main (int argc, char *argv[])
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
lteHelper->EnableTraces ();
|
||||
|
||||
|
||||
// Uncomment to enable logging
|
||||
//lteHelper->EnableLogComponents ();
|
||||
// lteHelper->EnableLogComponents ();
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
@@ -80,13 +80,14 @@ int main (int argc, char *argv[])
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q);
|
||||
lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
|
||||
|
||||
Simulator::Stop (Seconds (0.010));
|
||||
// Uncomment next line to enable traces
|
||||
//lteHelper->EnableTraces ();
|
||||
Simulator::Stop (Seconds (1.010));
|
||||
|
||||
Simulator::Run ();
|
||||
|
||||
//GtkConfigStore config;
|
||||
//config.ConfigureAttributes ();
|
||||
/* GtkConfigStore config;
|
||||
config.ConfigureAttributes ();*/
|
||||
|
||||
Simulator::Destroy ();
|
||||
return 0;
|
||||
|
||||
@@ -112,6 +112,7 @@ LteHelper::DoStart (void)
|
||||
m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
}
|
||||
m_phyStats = CreateObject<PhyStatsCalculator> ();
|
||||
m_macStats = CreateObject<MacStatsCalculator> ();
|
||||
m_rlcStats = CreateObject<RadioBearerStatsCalculator> ("RLC");
|
||||
m_pdcpStats = CreateObject<RadioBearerStatsCalculator> ("PDCP");
|
||||
@@ -679,11 +680,16 @@ LteHelper::EnableLogComponents (void)
|
||||
|
||||
LogComponentEnable ("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("MacStatsCalculator", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("PhyStatsCalculator", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("Config", LOG_LEVEL_ALL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
LteHelper::EnableTraces (void)
|
||||
{
|
||||
EnablePhyTraces ();
|
||||
EnableMacTraces ();
|
||||
EnableRlcTraces ();
|
||||
EnablePdcpTraces ();
|
||||
@@ -747,6 +753,30 @@ FindImsiFromEnbRlcPath (std::string path)
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
FindImsiFromUePhy (std::string path)
|
||||
{
|
||||
NS_LOG_FUNCTION (path);
|
||||
// Sample path input:
|
||||
// /NodeList/#NodeId/DeviceList/#DeviceId/LteUePhy
|
||||
|
||||
// We retrieve the UeInfo associated to the C-RNTI and perform the IMSI lookup
|
||||
std::string ueRlcPath = path.substr (0, path.find ("/LteUePhy"));
|
||||
ueRlcPath += "/LteUeRrc";
|
||||
Config::MatchContainer match = Config::LookupMatches (ueRlcPath);
|
||||
|
||||
if (match.GetN () != 0)
|
||||
{
|
||||
Ptr<Object> ueRrc = match.Get (0);
|
||||
return ueRrc->GetObject<LteUeRrc> ()->GetImsi ();
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_FATAL_ERROR ("Lookup " << ueRlcPath << " got no matches");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
FindCellIdFromEnbRlcPath (std::string path)
|
||||
{
|
||||
@@ -980,6 +1010,7 @@ LteHelper::EnableMacTraces (void)
|
||||
void
|
||||
LteHelper::EnableDlMacTraces (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbMac/DlScheduling",
|
||||
MakeBoundCallback (&DlSchedulingCallback, m_macStats));
|
||||
}
|
||||
@@ -1020,10 +1051,92 @@ UlSchedulingCallback (Ptr<MacStatsCalculator> macStats, std::string path,
|
||||
void
|
||||
LteHelper::EnableUlMacTraces (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbMac/UlScheduling",
|
||||
MakeBoundCallback (&UlSchedulingCallback, m_macStats));
|
||||
}
|
||||
|
||||
void
|
||||
LteHelper::EnablePhyTraces (void)
|
||||
{
|
||||
EnableDlPhyTraces ();
|
||||
EnableUlPhyTraces ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ReportCurrentCellRsrpRsrqCallback (Ptr<PhyStatsCalculator> phyStats,
|
||||
std::string path, uint16_t cellId, uint16_t rnti,
|
||||
double rsrp, double rsrq)
|
||||
{
|
||||
NS_LOG_FUNCTION (phyStats << path);
|
||||
uint64_t imsi = 0;
|
||||
std::string pathUePhy = path.substr (0, path.find ("/ReportCurrentCellRsrpRsrq"));
|
||||
if (phyStats->ExistsImsiPath (pathUePhy) == true)
|
||||
{
|
||||
imsi = phyStats->GetImsiPath (pathUePhy);
|
||||
}
|
||||
else
|
||||
{
|
||||
imsi = FindImsiFromUePhy (pathUePhy);
|
||||
phyStats->SetImsiPath (pathUePhy, imsi);
|
||||
}
|
||||
|
||||
phyStats->ReportCurrentCellRsrpRsrq (cellId, imsi, rnti, rsrp,rsrq);
|
||||
}
|
||||
|
||||
void
|
||||
LteHelper::EnableDlPhyTraces (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/ReportCurrentCellRsrpRsrq",
|
||||
MakeBoundCallback (&ReportCurrentCellRsrpRsrqCallback, m_phyStats));
|
||||
}
|
||||
|
||||
void
|
||||
ReportUeSinr (Ptr<PhyStatsCalculator> phyStats, std::string path,
|
||||
uint16_t cellId, uint16_t rnti, double sinrLinear)
|
||||
{
|
||||
NS_LOG_FUNCTION (phyStats << path);
|
||||
|
||||
uint64_t imsi = 0;
|
||||
std::ostringstream pathAndRnti;
|
||||
pathAndRnti << path << "/" << rnti;
|
||||
std::string pathEnbMac = path.substr (0, path.find ("LteEnbPhy/ReportUeSinr"));
|
||||
pathEnbMac += "LteEnbMac/DlScheduling";
|
||||
if (phyStats->ExistsImsiPath (pathAndRnti.str ()) == true)
|
||||
{
|
||||
imsi = phyStats->GetImsiPath (pathAndRnti.str ());
|
||||
}
|
||||
else
|
||||
{
|
||||
imsi = FindImsiFromEnbMac (pathEnbMac, rnti);
|
||||
phyStats->SetImsiPath (pathAndRnti.str (), imsi);
|
||||
}
|
||||
|
||||
phyStats->ReportUeSinr (cellId, imsi, rnti, sinrLinear);
|
||||
}
|
||||
|
||||
void
|
||||
ReportInterference (Ptr<PhyStatsCalculator> phyStats, std::string path,
|
||||
uint16_t cellId, Ptr<SpectrumValue> interference)
|
||||
{
|
||||
NS_LOG_FUNCTION (phyStats << path);
|
||||
phyStats->ReportInterference (cellId, interference);
|
||||
}
|
||||
|
||||
void
|
||||
LteHelper::EnableUlPhyTraces (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/ReportUeSinr",
|
||||
MakeBoundCallback (&ReportUeSinr, m_phyStats));
|
||||
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/ReportInterference",
|
||||
MakeBoundCallback (&ReportInterference, m_phyStats));
|
||||
// value /$ns3::NodeListPriv/NodeList/1/$ns3::Node/DeviceList/0/$ns3::LteUeNetDevice/LteUePhy/$ns3::LteUePhy/RsrpRsrqSamplePeriod "2"
|
||||
|
||||
}
|
||||
|
||||
Ptr<RadioBearerStatsCalculator>
|
||||
LteHelper::GetRlcStats (void)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ns3/node.h>
|
||||
#include <ns3/node-container.h>
|
||||
#include <ns3/eps-bearer.h>
|
||||
#include <ns3/phy-stats-calculator.h>
|
||||
#include <ns3/mac-stats-calculator.h>
|
||||
#include <ns3/radio-bearer-stats-calculator.h>
|
||||
#include <ns3/epc-tft.h>
|
||||
@@ -291,10 +292,27 @@ public:
|
||||
void EnableLogComponents (void);
|
||||
|
||||
/**
|
||||
* Enables trace sinks for MAC, RLC and PDCP
|
||||
* Enables trace sinks for PHY, MAC, RLC and PDCP. To make sure all nodes are
|
||||
* traced, traces should be enabled once all UEs and eNodeBs are in place and
|
||||
* connected, just before starting the simulation.
|
||||
*/
|
||||
void EnableTraces (void);
|
||||
|
||||
/**
|
||||
* Enable trace sinks for PHY layer
|
||||
*/
|
||||
void EnablePhyTraces (void);
|
||||
|
||||
/**
|
||||
* Enable trace sinks for DL PHY layer
|
||||
*/
|
||||
void EnableDlPhyTraces (void);
|
||||
|
||||
/**
|
||||
* Enable trace sinks for UL PHY layer
|
||||
*/
|
||||
void EnableUlPhyTraces (void);
|
||||
|
||||
/**
|
||||
* Enable trace sinks for MAC layer
|
||||
*/
|
||||
@@ -400,6 +418,7 @@ private:
|
||||
std::string m_fadingModelType;
|
||||
ObjectFactory m_fadingModelFactory;
|
||||
|
||||
Ptr<PhyStatsCalculator> m_phyStats;
|
||||
Ptr<MacStatsCalculator> m_macStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_rlcStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_pdcpStats;
|
||||
|
||||
@@ -90,7 +90,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 << cellId << imsi << frameNo << subframeNo << rnti << mcsTb1 << sizeTb1 << mcsTb2 << sizeTb2);
|
||||
NS_LOG_FUNCTION (this << cellId << imsi << frameNo << subframeNo << rnti << (uint32_t) mcsTb1 << sizeTb1 << (uint32_t) mcsTb2 << sizeTb2);
|
||||
NS_LOG_INFO ("Write DL Mac Stats in " << GetDlOutputFilename ().c_str ());
|
||||
|
||||
std::ofstream outFile;
|
||||
@@ -133,7 +133,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 << cellId << imsi << frameNo << subframeNo << rnti << mcs << size);
|
||||
NS_LOG_FUNCTION (this << cellId << imsi << frameNo << subframeNo << rnti << (uint32_t) mcs << size);
|
||||
NS_LOG_INFO ("Write UL Mac Stats in " << GetUlOutputFilename ().c_str ());
|
||||
|
||||
std::ofstream outFile;
|
||||
|
||||
220
src/lte/helper/phy-stats-calculator.cc
Normal file
220
src/lte/helper/phy-stats-calculator.cc
Normal file
@@ -0,0 +1,220 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Jaume Nin <jnin@cttc.es>
|
||||
*/
|
||||
|
||||
#include "phy-stats-calculator.h"
|
||||
#include "ns3/string.h"
|
||||
#include <ns3/simulator.h>
|
||||
#include <ns3/log.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("PhyStatsCalculator");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (PhyStatsCalculator);
|
||||
|
||||
PhyStatsCalculator::PhyStatsCalculator ()
|
||||
: m_RsrpRsrqFirstWrite (true),
|
||||
m_UeSinrFirstWrite (true),
|
||||
m_InterferenceFirstWrite (true)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
}
|
||||
|
||||
PhyStatsCalculator::~PhyStatsCalculator ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
TypeId
|
||||
PhyStatsCalculator::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::PhyStatsCalculator")
|
||||
.SetParent<LteStatsCalculator> ()
|
||||
.AddConstructor<PhyStatsCalculator> ()
|
||||
.AddAttribute ("RsrpRsrqFilename",
|
||||
"Name of the file where the RSRP/RSRQ statistics will be saved.",
|
||||
StringValue ("DlRsrpRsrqStats.txt"),
|
||||
MakeStringAccessor (&PhyStatsCalculator::SetCurrentCellRsrpRsrqFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("UeSinrFilename",
|
||||
"Name of the file where the UE SINR statistics will be saved.",
|
||||
StringValue ("UlSinrStats.txt"),
|
||||
MakeStringAccessor (&PhyStatsCalculator::SetUeSinrFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("InterferenceFilename",
|
||||
"Name of the file where the interference statistics will be saved.",
|
||||
StringValue ("UlInterferenceStats.txt"),
|
||||
MakeStringAccessor (&PhyStatsCalculator::SetInterferenceFilename),
|
||||
MakeStringChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
void
|
||||
PhyStatsCalculator::SetCurrentCellRsrpRsrqFilename (std::string filename)
|
||||
{
|
||||
m_RsrpRsrqFilename = filename;
|
||||
}
|
||||
|
||||
std::string
|
||||
PhyStatsCalculator::GetCurrentCellRsrpRsrqFilename (void)
|
||||
{
|
||||
return m_RsrpRsrqFilename;
|
||||
}
|
||||
|
||||
void
|
||||
PhyStatsCalculator::SetUeSinrFilename (std::string filename)
|
||||
{
|
||||
m_ueSinrFilename = filename;
|
||||
}
|
||||
|
||||
std::string
|
||||
PhyStatsCalculator::GetUeSinrFilename (void)
|
||||
{
|
||||
return m_ueSinrFilename;
|
||||
}
|
||||
|
||||
void
|
||||
PhyStatsCalculator::SetInterferenceFilename (std::string filename)
|
||||
{
|
||||
m_interferenceFilename = filename;
|
||||
}
|
||||
|
||||
std::string
|
||||
PhyStatsCalculator::GetInterferenceFilename (void)
|
||||
{
|
||||
return m_interferenceFilename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
PhyStatsCalculator::ReportCurrentCellRsrpRsrq (uint16_t cellId, uint64_t imsi, uint16_t rnti,
|
||||
double rsrp, double rsrq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << cellId << imsi << rnti << rsrp << rsrq);
|
||||
NS_LOG_INFO ("Write RSRP/RSRQ Phy Stats in " << GetCurrentCellRsrpRsrqFilename ().c_str ());
|
||||
|
||||
std::ofstream outFile;
|
||||
if ( m_RsrpRsrqFirstWrite == true )
|
||||
{
|
||||
outFile.open (GetCurrentCellRsrpRsrqFilename ().c_str ());
|
||||
if (!outFile.is_open ())
|
||||
{
|
||||
NS_LOG_ERROR ("Can't open file " << GetCurrentCellRsrpRsrqFilename ().c_str ());
|
||||
return;
|
||||
}
|
||||
m_RsrpRsrqFirstWrite = false;
|
||||
outFile << "% time\tcellId\tIMSI\tRNTI\trsrp\trsrq";
|
||||
outFile << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
outFile.open (GetCurrentCellRsrpRsrqFilename ().c_str (), std::ios_base::app);
|
||||
if (!outFile.is_open ())
|
||||
{
|
||||
NS_LOG_ERROR ("Can't open file " << GetCurrentCellRsrpRsrqFilename ().c_str ());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
|
||||
outFile << cellId << "\t";
|
||||
outFile << imsi << "\t";
|
||||
outFile << rnti << "\t";
|
||||
outFile << rsrp << "\t";
|
||||
outFile << rsrq << std::endl;
|
||||
outFile.close ();
|
||||
}
|
||||
|
||||
void
|
||||
PhyStatsCalculator::ReportUeSinr (uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << cellId << imsi << rnti << sinrLinear);
|
||||
NS_LOG_INFO ("Write SINR Linear Phy Stats in " << GetUeSinrFilename ().c_str ());
|
||||
|
||||
std::ofstream outFile;
|
||||
if ( m_UeSinrFirstWrite == true )
|
||||
{
|
||||
outFile.open (GetUeSinrFilename ().c_str ());
|
||||
if (!outFile.is_open ())
|
||||
{
|
||||
NS_LOG_ERROR ("Can't open file " << GetUeSinrFilename ().c_str ());
|
||||
return;
|
||||
}
|
||||
m_UeSinrFirstWrite = false;
|
||||
outFile << "% time\tcellId\tIMSI\tRNTI\tsinrLinear";
|
||||
outFile << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
outFile.open (GetUeSinrFilename ().c_str (), std::ios_base::app);
|
||||
if (!outFile.is_open ())
|
||||
{
|
||||
NS_LOG_ERROR ("Can't open file " << GetUeSinrFilename ().c_str ());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
|
||||
outFile << cellId << "\t";
|
||||
outFile << imsi << "\t";
|
||||
outFile << rnti << "\t";
|
||||
outFile << sinrLinear << std::endl;
|
||||
outFile.close ();
|
||||
}
|
||||
|
||||
void
|
||||
PhyStatsCalculator::ReportInterference (uint16_t cellId, Ptr<SpectrumValue> interference)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << cellId << interference);
|
||||
NS_LOG_INFO ("Write Interference Phy Stats in " << GetInterferenceFilename ().c_str ());
|
||||
|
||||
std::ofstream outFile;
|
||||
if ( m_InterferenceFirstWrite == true )
|
||||
{
|
||||
outFile.open (GetInterferenceFilename ().c_str ());
|
||||
if (!outFile.is_open ())
|
||||
{
|
||||
NS_LOG_ERROR ("Can't open file " << GetInterferenceFilename ().c_str ());
|
||||
return;
|
||||
}
|
||||
m_InterferenceFirstWrite = false;
|
||||
outFile << "% time\tcellId\tInterference";
|
||||
outFile << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
outFile.open (GetInterferenceFilename ().c_str (), std::ios_base::app);
|
||||
if (!outFile.is_open ())
|
||||
{
|
||||
NS_LOG_ERROR ("Can't open file " << GetInterferenceFilename ().c_str ());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
|
||||
outFile << cellId << "\t";
|
||||
outFile << *interference;
|
||||
outFile.close ();
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
146
src/lte/helper/phy-stats-calculator.h
Normal file
146
src/lte/helper/phy-stats-calculator.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Jaume Nin <jnin@cttc.es>
|
||||
*/
|
||||
|
||||
#ifndef PHY_STATS_CALCULATOR_H_
|
||||
#define PHY_STATS_CALCULATOR_H_
|
||||
|
||||
#include "ns3/lte-stats-calculator.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/spectrum-value.h"
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* Takes care of storing the information generated at PHY layer. Metrics saved are:
|
||||
* - RSRP/RSRQ for DL
|
||||
* - Timestamp (in seconds)
|
||||
* - IMSI
|
||||
* - C-RNTI
|
||||
* - RSRP
|
||||
* - RSRQ
|
||||
* - UE SINR
|
||||
* - Timestamp (in seconds)
|
||||
* - Cell ID of the reported Enb
|
||||
* - IMSI
|
||||
* - C-RNTI
|
||||
* - measured and reported SINR value in linear
|
||||
* - Interference for UL
|
||||
* - Cell ID of the reported Enb
|
||||
* - IMSI of the scheduled UE
|
||||
* - C-RNTI scheduled
|
||||
* - Measured interference for each RB
|
||||
*/
|
||||
class PhyStatsCalculator : public LteStatsCalculator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
PhyStatsCalculator ();
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~PhyStatsCalculator ();
|
||||
|
||||
/**
|
||||
* Inherited from ns3::Object
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
/**
|
||||
* Set the name of the file where the RSRP/RSRQ statistics will be stored.
|
||||
*
|
||||
* \param filename string with the name of the file
|
||||
*/
|
||||
void SetCurrentCellRsrpRsrqFilename (std::string filename);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the RSRP/RSRQ statistics will be stored.
|
||||
*/
|
||||
std::string GetCurrentCellRsrpRsrqFilename (void);
|
||||
|
||||
/**
|
||||
* Set the name of the file where the UE SINR statistics will be stored.
|
||||
*
|
||||
* @param filename string with the name of the file
|
||||
*/
|
||||
void SetUeSinrFilename (std::string filename);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the UE SINR statistics will be stored.
|
||||
*/
|
||||
std::string GetUeSinrFilename (void);
|
||||
|
||||
/**
|
||||
* Set the name of the file where the interference statistics will be stored.
|
||||
*
|
||||
* @param filename string with the name of the file
|
||||
*/
|
||||
void SetInterferenceFilename (std::string filename);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the interference statistics will be stored.
|
||||
*/
|
||||
std::string GetInterferenceFilename (void);
|
||||
|
||||
/**
|
||||
* Notifies the stats calculator that an RSRP and RSRQ report has occurred.
|
||||
* @param imsi IMSI of the scheduled UE
|
||||
* @param rnti C-RNTI scheduled
|
||||
* @param rsrp Reference Signal Received Power
|
||||
* @param rsrq Reference Signal Received Quality
|
||||
*/
|
||||
void ReportCurrentCellRsrpRsrq (uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double rsrq);
|
||||
|
||||
/**
|
||||
* Notifies the stats calculator that an UE SINR report has occurred.
|
||||
* @param cellId Cell ID of the reported Enb
|
||||
* @param imsi IMSI of the scheduled UE
|
||||
* @param rnti C-RNTI scheduled
|
||||
* @param sinrLinear measured and reported SINR value in linear
|
||||
*/
|
||||
void ReportUeSinr (uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear);
|
||||
/**
|
||||
* Notifies the stats calculator that an interference report has occurred.
|
||||
* @param imsi IMSI of the scheduled UE
|
||||
* @param rnti C-RNTI scheduled
|
||||
* @param cellId Cell ID of the reported Enb
|
||||
* @param interference Measured interference for each RB
|
||||
*/
|
||||
void ReportInterference (uint16_t cellId, Ptr<SpectrumValue> interference);
|
||||
|
||||
private:
|
||||
bool m_RsrpRsrqFirstWrite;
|
||||
bool m_UeSinrFirstWrite;
|
||||
bool m_InterferenceFirstWrite;
|
||||
|
||||
std::string m_RsrpRsrqFilename;
|
||||
std::string m_ueSinrFilename;
|
||||
std::string m_interferenceFilename;
|
||||
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* PHY_STATS_CALCULATOR_H_ */
|
||||
@@ -47,6 +47,7 @@ NS_LOG_COMPONENT_DEFINE ("LteEnbPhy");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (LteEnbPhy);
|
||||
|
||||
// duration of the data part of a subframe in DL
|
||||
// = 0.001 / 14 * 11 (fixed to 11 symbols) -1ns as margin to avoid overlapping simulator events
|
||||
@@ -135,9 +136,6 @@ EnbMemberLteEnbPhySapProvider::SetSrsConfigurationIndex (uint16_t rnti, uint16_
|
||||
|
||||
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (LteEnbPhy);
|
||||
|
||||
|
||||
LteEnbPhy::LteEnbPhy ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
@@ -768,7 +766,7 @@ LteEnbPhy::CreateSrsReport(uint16_t rnti, double srs)
|
||||
(*it).second++;
|
||||
if ((*it).second == m_srsSamplePeriod)
|
||||
{
|
||||
m_reportUeSinr (rnti, m_cellId, srs);
|
||||
m_reportUeSinr (m_cellId, rnti, srs);
|
||||
(*it).second = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ private:
|
||||
|
||||
/**
|
||||
* Trace reporting the linear average of SRS SINRs
|
||||
* uint16_t rnti, uint16_t cellId, double sinrLinear
|
||||
* uint16_t cellId, uint16_t rnti, double sinrLinear
|
||||
*/
|
||||
TracedCallback<uint16_t, uint16_t, double> m_reportUeSinr;
|
||||
uint16_t m_srsSamplePeriod;
|
||||
|
||||
@@ -421,7 +421,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
|
||||
// Generate RSRP and RSRQ traces (dummy values, real valeus TBD)
|
||||
double rsrp = 0.0;
|
||||
double rsrq = 0.0;
|
||||
m_reportCurrentCellRsrpRsrqTrace (m_rnti, m_cellId, rsrp, rsrq);
|
||||
m_reportCurrentCellRsrpRsrqTrace (m_cellId, m_rnti, rsrp, rsrq);
|
||||
m_rsrpRsrqSampleCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ private:
|
||||
|
||||
/**
|
||||
* Trace information regarding RSRP and RSRQ (see TS 36.214)
|
||||
* uint16_t rnti, uint16_t cellId, double rsrp, double rsrq
|
||||
* uint16_t cellId, uint16_t rnti, double rsrp, double rsrq
|
||||
*/
|
||||
TracedCallback<uint16_t, uint16_t, double, double> m_reportCurrentCellRsrpRsrqTrace;
|
||||
uint16_t m_rsrpRsrqSamplePeriod;
|
||||
|
||||
@@ -185,6 +185,12 @@ LteUeRrc::SetImsi (uint64_t imsi)
|
||||
m_imsi = imsi;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
LteUeRrc::GetImsi (void)
|
||||
{
|
||||
return m_imsi;
|
||||
}
|
||||
|
||||
void
|
||||
LteUeRrc::SetupRadioBearer (EpsBearer bearer, TypeId rlcTypeId, uint8_t lcid)
|
||||
{
|
||||
|
||||
@@ -123,12 +123,18 @@ public:
|
||||
LteAsSapProvider* GetAsSapProvider ();
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* \param imsi the unique UE identifier
|
||||
*/
|
||||
void SetImsi (uint64_t imsi);
|
||||
|
||||
/**
|
||||
*
|
||||
* \return imsi the unique UE identifier
|
||||
*/
|
||||
uint64_t GetImsi (void);
|
||||
|
||||
|
||||
/**
|
||||
* Set UE RRC parameters
|
||||
*
|
||||
|
||||
@@ -37,6 +37,7 @@ def build(bld):
|
||||
'helper/lte-stats-calculator.cc',
|
||||
'helper/epc-helper.cc',
|
||||
'helper/radio-bearer-stats-calculator.cc',
|
||||
'helper/phy-stats-calculator.cc',
|
||||
'helper/mac-stats-calculator.cc',
|
||||
'helper/radio-environment-map-helper.cc',
|
||||
'helper/lte-hex-grid-enb-topology-helper.cc',
|
||||
@@ -143,6 +144,7 @@ def build(bld):
|
||||
'helper/lte-helper.h',
|
||||
'helper/lte-stats-calculator.h',
|
||||
'helper/epc-helper.h',
|
||||
'helper/phy-stats-calculator.h',
|
||||
'helper/mac-stats-calculator.h',
|
||||
'helper/radio-bearer-stats-calculator.h',
|
||||
'helper/radio-environment-map-helper.h',
|
||||
|
||||
Reference in New Issue
Block a user