Fixed RSRQ measurements not working when initial cell selection is enabled
authorBudiarto Herman <budiarto.herman@magister.fi>
Thu, 19 Sep 2013 18:55:49 +0300
changeset 10363 d16eb03a0b1b
parent 10362 a1a21fe57b61
child 10364 d7735b3a00c6
Fixed RSRQ measurements not working when initial cell selection is enabled
src/lte/model/lte-ue-phy.cc
src/lte/model/lte-ue-rrc.cc
--- a/src/lte/model/lte-ue-phy.cc	Sun Sep 15 22:43:30 2013 +0300
+++ b/src/lte/model/lte-ue-phy.cc	Thu Sep 19 18:55:49 2013 +0300
@@ -672,9 +672,16 @@
     {
       double avg_rsrp = (*it).second.rsrpSum / (double)(*it).second.rsrpNum;
       double avg_rsrq = (*it).second.rsrqSum / (double)(*it).second.rsrqNum;
+      /*
+       * In CELL_SEARCH state, this may result in avg_rsrq = 0/0 = -nan.
+       * UE RRC must take this into account when receiving measurement reports.
+       * TODO remove this shortcoming by calculating RSRQ during CELL_SEARCH
+       */
       NS_LOG_DEBUG (this << " CellId " << (*it).first
-                         << " RSRP " << avg_rsrp << " (nSamples " << (uint16_t)(*it).second.rsrpNum
-                         << ") RSRQ " << avg_rsrq << " (nSamples " << (uint16_t)(*it).second.rsrpNum << ")");
+                         << " RSRP " << avg_rsrp
+                         << " (nSamples " << (uint16_t)(*it).second.rsrpNum << ")"
+                         << " RSRQ " << avg_rsrq
+                         << " (nSamples " << (uint16_t)(*it).second.rsrqNum << ")");
 
       LteUeCphySapUser::UeMeasurementsElement newEl;
       newEl.m_cellId = (*it).first;
@@ -1098,7 +1105,7 @@
 LteUePhy::DoSetDlBandwidth (uint8_t dlBandwidth)
 {
   NS_LOG_FUNCTION (this << (uint32_t) dlBandwidth);
-  if (m_dlBandwidth != dlBandwidth)
+  if (m_dlBandwidth != dlBandwidth or !m_dlConfigured)
     {
       m_dlBandwidth = dlBandwidth;
 
--- a/src/lte/model/lte-ue-rrc.cc	Sun Sep 15 22:43:30 2013 +0300
+++ b/src/lte/model/lte-ue-rrc.cc	Thu Sep 19 18:55:49 2013 +0300
@@ -402,7 +402,6 @@
 {
   NS_LOG_FUNCTION (this << packet);
 
-
   uint8_t drbid = Bid2Drbid (bid);
 
   std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it =   m_drbMap.find (drbid);
@@ -413,10 +412,14 @@
   params.rnti = m_rnti;
   params.lcid = it->second->m_logicalChannelIdentity;
 
-  NS_LOG_LOGIC (this << " RNTI=" << m_rnti << " sending " << packet << "on DRBID " << (uint32_t) drbid << " (LCID" << params.lcid << ")" << " (" << packet->GetSize () << " bytes)");
+  NS_LOG_LOGIC (this << " RNTI=" << m_rnti << " sending packet " << packet
+                     << " on DRBID " << (uint32_t) drbid
+                     << " (LCID " << (uint32_t) params.lcid << ")"
+                     << " (" << packet->GetSize () << " bytes)");
   it->second->m_pdcp->GetLtePdcpSapProvider ()->TransmitPdcpSdu (params);
 }
 
+
 void
 LteUeRrc::DoDisconnect ()
 {
@@ -1223,7 +1226,7 @@
         {
           NS_LOG_INFO ("request to modify existing DRBID");
           Ptr<LteDataRadioBearerInfo> drbInfo = drbMapIt->second;
-          // TODO: currently not implemented. Would need to modify drbInfo, and then propagate changes to the MAC
+          /// \todo currently not implemented. Would need to modify drbInfo, and then propagate changes to the MAC
         }
     }
   
@@ -1474,8 +1477,17 @@
           // F_n = (1-a) F_{n-1} + a M_n
           storedMeasIt->second.rsrp = (1 - m_varMeasConfig.aRsrp) * storedMeasIt->second.rsrp
             + m_varMeasConfig.aRsrp * rsrp;
-          storedMeasIt->second.rsrq = (1 - m_varMeasConfig.aRsrq) * storedMeasIt->second.rsrq
-            + m_varMeasConfig.aRsrq * rsrq;
+
+          if (std::isnan (storedMeasIt->second.rsrq))
+            {
+              // the previous RSRQ measurements provided UE PHY are invalid
+              storedMeasIt->second.rsrq = rsrq; // replace it with unfiltered value
+            }
+          else
+            {
+              storedMeasIt->second.rsrq = (1 - m_varMeasConfig.aRsrq) * storedMeasIt->second.rsrq
+                + m_varMeasConfig.aRsrq * rsrq;
+            }
         }
       else
         {