Change RSRQ stats for average SINR ones

This commit is contained in:
Marco Miozzo
2012-11-27 11:54:29 +01:00
parent a45d3cfa70
commit 1c95b22c76
5 changed files with 57 additions and 57 deletions

View File

@@ -1068,13 +1068,13 @@ LteHelper::EnablePhyTraces (void)
void
ReportCurrentCellRsrpRsrqCallback (Ptr<PhyStatsCalculator> phyStats,
ReportCurrentCellRsrpSinrCallback (Ptr<PhyStatsCalculator> phyStats,
std::string path, uint16_t cellId, uint16_t rnti,
double rsrp, double rsrq)
double rsrp, double sinr)
{
NS_LOG_FUNCTION (phyStats << path);
uint64_t imsi = 0;
std::string pathUePhy = path.substr (0, path.find ("/ReportCurrentCellRsrpRsrq"));
std::string pathUePhy = path.substr (0, path.find ("/ReportCurrentCellRsrpSinr"));
if (phyStats->ExistsImsiPath (pathUePhy) == true)
{
imsi = phyStats->GetImsiPath (pathUePhy);
@@ -1085,15 +1085,15 @@ ReportCurrentCellRsrpRsrqCallback (Ptr<PhyStatsCalculator> phyStats,
phyStats->SetImsiPath (pathUePhy, imsi);
}
phyStats->ReportCurrentCellRsrpRsrq (cellId, imsi, rnti, rsrp,rsrq);
phyStats->ReportCurrentCellRsrpSinr (cellId, imsi, rnti, rsrp,sinr);
}
void
LteHelper::EnableDlPhyTraces (void)
{
NS_LOG_FUNCTION_NOARGS ();
Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/ReportCurrentCellRsrpRsrq",
MakeBoundCallback (&ReportCurrentCellRsrpRsrqCallback, m_phyStats));
Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/ReportCurrentCellRsrpSinr",
MakeBoundCallback (&ReportCurrentCellRsrpSinrCallback, m_phyStats));
}
void

View File

@@ -30,7 +30,7 @@ NS_LOG_COMPONENT_DEFINE ("PhyStatsCalculator");
NS_OBJECT_ENSURE_REGISTERED (PhyStatsCalculator);
PhyStatsCalculator::PhyStatsCalculator ()
: m_RsrpRsrqFirstWrite (true),
: m_RsrpSinrFirstWrite (true),
m_UeSinrFirstWrite (true),
m_InterferenceFirstWrite (true)
{
@@ -49,10 +49,10 @@ PhyStatsCalculator::GetTypeId (void)
static TypeId tid = TypeId ("ns3::PhyStatsCalculator")
.SetParent<LteStatsCalculator> ()
.AddConstructor<PhyStatsCalculator> ()
.AddAttribute ("DlRsrpRsrqFilename",
"Name of the file where the RSRP/RSRQ statistics will be saved.",
StringValue ("DlRsrpRsrqStats.txt"),
MakeStringAccessor (&PhyStatsCalculator::SetCurrentCellRsrpRsrqFilename),
.AddAttribute ("DlRsrpSinrFilename",
"Name of the file where the RSRP/SINR statistics will be saved.",
StringValue ("DlRsrpSinrStats.txt"),
MakeStringAccessor (&PhyStatsCalculator::SetCurrentCellRsrpSinrFilename),
MakeStringChecker ())
.AddAttribute ("UlSinrFilename",
"Name of the file where the UE SINR statistics will be saved.",
@@ -69,15 +69,15 @@ PhyStatsCalculator::GetTypeId (void)
}
void
PhyStatsCalculator::SetCurrentCellRsrpRsrqFilename (std::string filename)
PhyStatsCalculator::SetCurrentCellRsrpSinrFilename (std::string filename)
{
m_RsrpRsrqFilename = filename;
m_RsrpSinrFilename = filename;
}
std::string
PhyStatsCalculator::GetCurrentCellRsrpRsrqFilename (void)
PhyStatsCalculator::GetCurrentCellRsrpSinrFilename (void)
{
return m_RsrpRsrqFilename;
return m_RsrpSinrFilename;
}
void
@@ -107,31 +107,31 @@ PhyStatsCalculator::GetInterferenceFilename (void)
void
PhyStatsCalculator::ReportCurrentCellRsrpRsrq (uint16_t cellId, uint64_t imsi, uint16_t rnti,
double rsrp, double rsrq)
PhyStatsCalculator::ReportCurrentCellRsrpSinr (uint16_t cellId, uint64_t imsi, uint16_t rnti,
double rsrp, double sinr)
{
NS_LOG_FUNCTION (this << cellId << imsi << rnti << rsrp << rsrq);
NS_LOG_INFO ("Write RSRP/RSRQ Phy Stats in " << GetCurrentCellRsrpRsrqFilename ().c_str ());
NS_LOG_FUNCTION (this << cellId << imsi << rnti << rsrp << sinr);
NS_LOG_INFO ("Write RSRP/SINR Phy Stats in " << GetCurrentCellRsrpSinrFilename ().c_str ());
std::ofstream outFile;
if ( m_RsrpRsrqFirstWrite == true )
if ( m_RsrpSinrFirstWrite == true )
{
outFile.open (GetCurrentCellRsrpRsrqFilename ().c_str ());
outFile.open (GetCurrentCellRsrpSinrFilename ().c_str ());
if (!outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << GetCurrentCellRsrpRsrqFilename ().c_str ());
NS_LOG_ERROR ("Can't open file " << GetCurrentCellRsrpSinrFilename ().c_str ());
return;
}
m_RsrpRsrqFirstWrite = false;
outFile << "% time\tcellId\tIMSI\tRNTI\trsrp\trsrq";
m_RsrpSinrFirstWrite = false;
outFile << "% time\tcellId\tIMSI\tRNTI\trsrp\tsinr";
outFile << std::endl;
}
else
{
outFile.open (GetCurrentCellRsrpRsrqFilename ().c_str (), std::ios_base::app);
outFile.open (GetCurrentCellRsrpSinrFilename ().c_str (), std::ios_base::app);
if (!outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << GetCurrentCellRsrpRsrqFilename ().c_str ());
NS_LOG_ERROR ("Can't open file " << GetCurrentCellRsrpSinrFilename ().c_str ());
return;
}
}
@@ -141,7 +141,7 @@ PhyStatsCalculator::ReportCurrentCellRsrpRsrq (uint16_t cellId, uint64_t imsi, u
outFile << imsi << "\t";
outFile << rnti << "\t";
outFile << rsrp << "\t";
outFile << rsrq << std::endl;
outFile << sinr << std::endl;
outFile.close ();
}

View File

@@ -32,12 +32,12 @@ namespace ns3 {
/**
* Takes care of storing the information generated at PHY layer. Metrics saved are:
* - RSRP/RSRQ for DL
* - RSRP and average SINR for DL
* - Timestamp (in seconds)
* - IMSI
* - C-RNTI
* - RSRP
* - RSRQ
* - SINR
* - UE SINR
* - Timestamp (in seconds)
* - Cell ID of the reported Enb
@@ -69,16 +69,16 @@ public:
static TypeId GetTypeId (void);
/**
* Set the name of the file where the RSRP/RSRQ statistics will be stored.
* Set the name of the file where the RSRP/SINR statistics will be stored.
*
* \param filename string with the name of the file
*/
void SetCurrentCellRsrpRsrqFilename (std::string filename);
void SetCurrentCellRsrpSinrFilename (std::string filename);
/**
* Get the name of the file where the RSRP/RSRQ statistics will be stored.
* Get the name of the file where the RSRP/SINR statistics will be stored.
*/
std::string GetCurrentCellRsrpRsrqFilename (void);
std::string GetCurrentCellRsrpSinrFilename (void);
/**
* Set the name of the file where the UE SINR statistics will be stored.
@@ -105,13 +105,13 @@ public:
std::string GetInterferenceFilename (void);
/**
* Notifies the stats calculator that an RSRP and RSRQ report has occurred.
* Notifies the stats calculator that an RSRP and SINR 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
* @param sinr SINR averaged among RBs
*/
void ReportCurrentCellRsrpRsrq (uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double rsrq);
void ReportCurrentCellRsrpSinr (uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double sinr);
/**
* Notifies the stats calculator that an UE SINR report has occurred.
@@ -131,11 +131,11 @@ public:
void ReportInterference (uint16_t cellId, Ptr<SpectrumValue> interference);
private:
bool m_RsrpRsrqFirstWrite;
bool m_RsrpSinrFirstWrite;
bool m_UeSinrFirstWrite;
bool m_InterferenceFirstWrite;
std::string m_RsrpRsrqFilename;
std::string m_RsrpSinrFilename;
std::string m_ueSinrFilename;
std::string m_interferenceFilename;

View File

@@ -129,7 +129,7 @@ LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
m_rnti (0),
m_srsPeriodicity (0),
m_rsReceivedPowerUpdated (false),
m_rsrpRsrqSampleCounter (0)
m_rsrpSinrSampleCounter (0)
{
m_amc = CreateObject <LteAmc> ();
m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
@@ -226,13 +226,13 @@ LteUePhy::GetTypeId (void)
DoubleValue (0.0),
MakeDoubleAccessor (&LteUePhy::SetTxMode7Gain ),
MakeDoubleChecker<double> ())
.AddTraceSource ("ReportCurrentCellRsrpRsrq",
"RSRP and RSRQ statistics.",
MakeTraceSourceAccessor (&LteUePhy::m_reportCurrentCellRsrpRsrqTrace))
.AddAttribute ("RsrpRsrqSamplePeriod",
"The sampling period for reporting RSRP-RSRQ stats (default value 1)",
.AddTraceSource ("ReportCurrentCellRsrpSinr",
"RSRP and SINR statistics.",
MakeTraceSourceAccessor (&LteUePhy::m_reportCurrentCellRsrpSinrTrace))
.AddAttribute ("RsrpSinrSamplePeriod",
"The sampling period for reporting RSRP-SINR stats (default value 1)",
UintegerValue (1),
MakeUintegerAccessor (&LteUePhy::m_rsrpRsrqSamplePeriod),
MakeUintegerAccessor (&LteUePhy::m_rsrpSinrSamplePeriod),
MakeUintegerChecker<uint16_t> ())
;
return tid;
@@ -424,8 +424,8 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
SpectrumValue newSinr = sinr;
newSinr *= m_txModeGain.at (m_transmissionMode);
m_rsrpRsrqSampleCounter++;
if (m_rsrpRsrqSampleCounter==m_rsrpRsrqSamplePeriod)
m_rsrpSinrSampleCounter++;
if (m_rsrpSinrSampleCounter==m_rsrpSinrSamplePeriod)
{
NS_ASSERT_MSG (m_rsReceivedPowerUpdated, " RS received power info obsolete");
// RSRP evaluated as averaged received power among RBs
@@ -438,17 +438,17 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
rbNum++;
}
double rsrp = sum / (double)rbNum;
// RSRQ evaluated as averaged SINR among RBs
// averaged SINR among RBs
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
{
sum += (*it);
rbNum++;
}
double rsrq = sum / (double)rbNum;
NS_LOG_INFO (this << " cellId " << m_cellId << " rnti " << m_rnti << " RSRP " << rsrp << " RSRQ " << rsrq);
double avSinr = sum / (double)rbNum;
NS_LOG_INFO (this << " cellId " << m_cellId << " rnti " << m_rnti << " RSRP " << rsrp << " SINR " << avSinr);
m_reportCurrentCellRsrpRsrqTrace (m_cellId, m_rnti, rsrp, rsrq);
m_rsrpRsrqSampleCounter = 0;
m_reportCurrentCellRsrpSinrTrace (m_cellId, m_rnti, rsrp, avSinr);
m_rsrpSinrSampleCounter = 0;
}

View File

@@ -273,12 +273,12 @@ private:
Ptr<LteHarqPhy> m_harqPhyModule;
/**
* Trace information regarding RSRP and RSRQ (see TS 36.214)
* uint16_t cellId, uint16_t rnti, double rsrp, double rsrq
* Trace information regarding RSRP and average SINR (see TS 36.214)
* uint16_t cellId, uint16_t rnti, double rsrp, double sinr
*/
TracedCallback<uint16_t, uint16_t, double, double> m_reportCurrentCellRsrpRsrqTrace;
uint16_t m_rsrpRsrqSamplePeriod;
uint16_t m_rsrpRsrqSampleCounter;
TracedCallback<uint16_t, uint16_t, double, double> m_reportCurrentCellRsrpSinrTrace;
uint16_t m_rsrpSinrSamplePeriod;
uint16_t m_rsrpSinrSampleCounter;
};