fixed buggy CheckStatsAWhileAfterHandover in lte-x2-handover test
authorNicola Baldo <nbaldo@cttc.es>
Tue, 19 Mar 2013 17:11:46 +0100
changeset 10014 e637fc4ba604
parent 10013 48a4b87cd5de
child 10016 a775fb1546a4
fixed buggy CheckStatsAWhileAfterHandover in lte-x2-handover test
src/lte/test/test-lte-x2-handover.cc
--- a/src/lte/test/test-lte-x2-handover.cc	Fri Mar 08 16:18:10 2013 +0100
+++ b/src/lte/test/test-lte-x2-handover.cc	Tue Mar 19 17:11:46 2013 +0100
@@ -95,7 +95,9 @@
   std::vector<UeData> m_ueDataVector;
 
   const Time m_maxHoDuration; 
-  const Time m_statsDuration; 
+  const Time m_statsDuration;
+  const Time m_udpClientInterval;
+  const uint32_t m_udpClientPktSize;
 
 };
 
@@ -132,7 +134,10 @@
     m_admitHo (admitHo),
     m_useIdealRrc (useIdealRrc),
     m_maxHoDuration (Seconds (0.1)),
-    m_statsDuration (Seconds (0.5))
+    m_statsDuration (Seconds (0.1)),
+    m_udpClientInterval (Seconds (0.01)),
+    m_udpClientPktSize (100)
+    
 {
 }
 
@@ -142,9 +147,9 @@
   NS_LOG_FUNCTION (this << BuildNameString (m_nUes, m_nDedicatedBearers, m_handoverEventListName, m_useUdp, m_schedulerType, m_admitHo, m_useIdealRrc));
 
   Config::Reset ();
-  Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds(100)));
-  Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue(1000000));  
-  Config::SetDefault ("ns3::UdpClient::PacketSize", UintegerValue(100));  
+  Config::SetDefault ("ns3::UdpClient::Interval",  TimeValue (m_udpClientInterval));
+  Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue (1000000));  
+  Config::SetDefault ("ns3::UdpClient::PacketSize", UintegerValue (m_udpClientPktSize));  
 
   int64_t stream = 1;
   
@@ -405,20 +410,18 @@
                            enbDevices.Get (m_admitHo ? hoEventIt->targetEnbDeviceIndex : hoEventIt->sourceEnbDeviceIndex));
       Simulator::Schedule (hoEndTime, &LteX2HandoverTestCase::SaveStatsAfterHandover,
                            this, hoEventIt->ueDeviceIndex);
+
       Time checkStatsAfterHoTime = hoEndTime + m_statsDuration;
       Simulator::Schedule (checkStatsAfterHoTime, &LteX2HandoverTestCase::CheckStatsAWhileAfterHandover, 
                            this, hoEventIt->ueDeviceIndex);      
-      if (stopTime <= hoEndTime)
+      if (stopTime <= checkStatsAfterHoTime)
         {
-          stopTime = hoEndTime + MilliSeconds (1);
+          stopTime = checkStatsAfterHoTime + MilliSeconds (1);
         }
     }
   
-  m_lteHelper->EnableRlcTraces ();
-  Ptr<RadioBearerStatsCalculator> rlcStats = m_lteHelper->GetRlcStats ();
-  rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (0.101)));
-  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.1)));
-  m_lteHelper->EnablePdcpTraces();
+  // m_lteHelper->EnableRlcTraces ();
+  // m_lteHelper->EnablePdcpTraces();
 
  
   Simulator::Stop (stopTime);
@@ -517,9 +520,8 @@
        ++it)
     {
       uint32_t dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx;
-      uint32_t ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;
-      //             udpclient pktsize interval 
-      uint32_t expectedBytes = 100.0 * (0.100 / m_statsDuration.GetSeconds ());
+      uint32_t ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;                       
+      uint32_t expectedBytes = m_udpClientPktSize * (m_statsDuration.GetSeconds () / m_udpClientInterval.GetSeconds ());
       //                           tolerance
       NS_TEST_ASSERT_MSG_GT (dlRx,   0.500 * expectedBytes, "too few RX bytes in DL, ue=" << ueIndex << ", b=" << b);
       NS_TEST_ASSERT_MSG_GT (ulRx,   0.500 * expectedBytes, "too few RX bytes in UL, ue=" << ueIndex << ", b=" << b);