Change RSRQ stats for average SINR ones
authorMarco Miozzo <marco.miozzo@cttc.es>
Tue, 27 Nov 2012 11:54:29 +0100
changeset 9390 d51829659a57
parent 9389 4bd2725add01
child 9391 322e3bcd10d6
Change RSRQ stats for average SINR ones
src/lte/helper/lte-helper.cc
src/lte/helper/phy-stats-calculator.cc
src/lte/helper/phy-stats-calculator.h
src/lte/model/lte-ue-phy.cc
src/lte/model/lte-ue-phy.h
--- a/src/lte/helper/lte-helper.cc	Tue Nov 13 17:54:50 2012 +0100
+++ b/src/lte/helper/lte-helper.cc	Tue Nov 27 11:54:29 2012 +0100
@@ -1068,13 +1068,13 @@
 
 
 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 @@
       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
--- a/src/lte/helper/phy-stats-calculator.cc	Tue Nov 13 17:54:50 2012 +0100
+++ b/src/lte/helper/phy-stats-calculator.cc	Tue Nov 27 11:54:29 2012 +0100
@@ -30,7 +30,7 @@
 NS_OBJECT_ENSURE_REGISTERED (PhyStatsCalculator);
 
 PhyStatsCalculator::PhyStatsCalculator ()
-  :  m_RsrpRsrqFirstWrite (true),
+  :  m_RsrpSinrFirstWrite (true),
     m_UeSinrFirstWrite (true),
     m_InterferenceFirstWrite (true)
 {
@@ -49,10 +49,10 @@
   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 @@
 }
 
 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 @@
 
 
 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 @@
   outFile << imsi << "\t";
   outFile << rnti << "\t";
   outFile << rsrp << "\t";
-  outFile << rsrq << std::endl;
+  outFile << sinr << std::endl;
   outFile.close ();
 }
 
--- a/src/lte/helper/phy-stats-calculator.h	Tue Nov 13 17:54:50 2012 +0100
+++ b/src/lte/helper/phy-stats-calculator.h	Tue Nov 27 11:54:29 2012 +0100
@@ -32,12 +32,12 @@
 
 /**
  * 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 @@
   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 @@
   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 @@
   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;
 
--- a/src/lte/model/lte-ue-phy.cc	Tue Nov 13 17:54:50 2012 +0100
+++ b/src/lte/model/lte-ue-phy.cc	Tue Nov 27 11:54:29 2012 +0100
@@ -129,7 +129,7 @@
     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 @@
                   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 @@
   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 @@
           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;
     }
 
 
--- a/src/lte/model/lte-ue-phy.h	Tue Nov 13 17:54:50 2012 +0100
+++ b/src/lte/model/lte-ue-phy.h	Tue Nov 27 11:54:29 2012 +0100
@@ -273,12 +273,12 @@
   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;
 
 };