A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lte-test-fdbet-ff-mac-scheduler.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Marco Miozzo <marco.miozzo@cttc.es>,
19  * Nicola Baldo <nbaldo@cttc.es>
20  * Dizhi Zhou <dizhi.zhou@gmail.com>
21  */
22 
23 #include <iostream>
24 #include <sstream>
25 #include <string>
26 
27 #include <ns3/object.h>
28 #include <ns3/spectrum-interference.h>
29 #include <ns3/spectrum-error-model.h>
30 #include <ns3/log.h>
31 #include <ns3/test.h>
32 #include <ns3/simulator.h>
33 #include <ns3/packet.h>
34 #include <ns3/ptr.h>
35 #include "ns3/radio-bearer-stats-calculator.h"
36 #include <ns3/constant-position-mobility-model.h>
37 #include <ns3/eps-bearer.h>
38 #include <ns3/node-container.h>
39 #include <ns3/mobility-helper.h>
40 #include <ns3/net-device-container.h>
41 #include <ns3/lte-ue-net-device.h>
42 #include <ns3/lte-enb-net-device.h>
43 #include <ns3/lte-ue-rrc.h>
44 #include <ns3/lte-helper.h>
45 #include "ns3/string.h"
46 #include "ns3/double.h"
47 #include <ns3/lte-enb-phy.h>
48 #include <ns3/lte-ue-phy.h>
49 #include <ns3/boolean.h>
50 #include <ns3/enum.h>
51 
53 
54 NS_LOG_COMPONENT_DEFINE ("LenaTestFdBetFfMacScheduler");
55 
56 namespace ns3 {
57 
59  : TestSuite ("lte-fdbet-ff-mac-scheduler", SYSTEM)
60 {
61  NS_LOG_INFO ("creating LenaTestFdBetFfMacSchedulerSuite");
62 
63  bool errorModel = false;
64 
65  //Test Case 1: AMC works in FDBET
66 
67  //Note: here the MCS is calculated by the wideband CQI
68 
69  // DOWNLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
70  // 1 user -> 24 PRB at Itbs 26 -> 2196 -> 2196000 bytes/sec
71  // 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 bytes/sec
72  // 6 users -> 4 PRB at Itbs 26 -> 373 -> 373000 bytes/sec
73  // 12 users -> 2 PRB at Itbs 26 -> 185 -> 185000 bytes/sec
74  // UPLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
75  // 1 user -> 25 PRB at Itbs 26 -> 2292 -> 2292000 bytes/sec
76  // 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 bytes/sec
77  // 6 users -> 4 PRB at Itbs 26 -> 373 -> 373000 bytes/sec
78  // after the patch enforcing min 3 PRBs per UE:
79  // 12 users -> 3 PRB at Itbs 26 -> 277 bytes * 8/12 UE/TTI -> 184670 bytes/sec
80  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (1,0,2196000,2292000, errorModel), TestCase::EXTENSIVE);
81  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (3,0,749000,749000, errorModel), TestCase::EXTENSIVE);
82  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (6,0,373000,373000, errorModel), TestCase::EXTENSIVE);
83  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (12,0,185000,184670, errorModel), TestCase::EXTENSIVE);
84 
85  // DOWNLINK - DISTANCE 4800 -> MCS 22 -> Itbs 20 (from table 7.1.7.2.1-1 of 36.213)
86  // 1 user -> 24 PRB at Itbs 20 -> 1383 -> 1383000 bytes/sec
87  // 3 users -> 8 PRB at Itbs 20 -> 469 -> 469000 bytes/sec
88  // 6 users -> 4 PRB at Itbs 20 -> 233 -> 233000 bytes/sec
89  // 12 users -> 2 PRB at Itbs 20 -> 113 -> 113000 bytes/sec
90  // UPLINK - DISTANCE 4800 -> MCS 14 -> Itbs 13 (from table 7.1.7.2.1-1 of 36.213)
91  // 1 user -> 25 PRB at Itbs 13 -> 807 -> 807000 bytes/sec
92  // 3 users -> 8 PRB at Itbs 13 -> 253 -> 253000 bytes/sec
93  // 6 users -> 4 PRB at Itbs 13 -> 125 -> 125000 bytes/sec
94  // after the patch enforcing min 3 PRBs per UE:
95  // 12 users -> 3 PRB at Itbs 13 -> 93 bytes * 8/12 UE/TTI -> 62000 bytes/sec
96  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (1,4800,1383000,807000, errorModel), TestCase::EXTENSIVE);
97  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (3,4800,469000,253000, errorModel), TestCase::EXTENSIVE);
98  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (6,4800,233500,125000, errorModel), TestCase::EXTENSIVE);
99  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (12,4800,113000,62000, errorModel), TestCase::EXTENSIVE);
100 
101  // DOWNLINK - DISTANCE 6000 -> MCS 20 -> Itbs 18 (from table 7.1.7.2.1-1 of 36.213)
102  // 1 user -> 24 PRB at Itbs 18 -> 1191 -> 1191000 byte/sec
103  // 3 users -> 8 PRB at Itbs 18 -> 389 -> 389000 bytes/sec
104  // 6 users -> 4 PRB at Itbs 18 -> 193 -> 193000 bytes/sec
105  // 12 users -> 2 PRB at Itbs 18 -> 97 -> 97000 bytes/sec
106  // UPLINK - DISTANCE 6000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213)
107  // 1 user -> 25 PRB at Itbs 11 -> 621 -> 621000 bytes/sec
108  // 3 users -> 8 PRB at Itbs 11 -> 201 -> 201000 bytes/sec
109  // 6 users -> 4 PRB at Itbs 11 -> 97 -> 97000 bytes/sec
110  // 12 users -> 3 PRB at Itbs 11 -> 73 bytes * 8/12 UE/TTI -> 48667 bytes/sec
111  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (1,6000,1191000,621000,errorModel), TestCase::EXTENSIVE);
112  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (3,6000,389000,201000,errorModel), TestCase::EXTENSIVE);
113  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (6,6000,193000,97000,errorModel), TestCase::EXTENSIVE);
114  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (12,6000,97000,48667,errorModel), TestCase::EXTENSIVE);
115 
116  // DOWNLINK - DISTANCE 10000 -> MCS 14 -> Itbs 13 (from table 7.1.7.2.1-1 of 36.213)
117  // 1 user -> 24 PRB at Itbs 13 -> 775 -> 775000 byte/sec
118  // 3 users -> 8 PRB at Itbs 13 -> 253 -> 253000 bytes/sec
119  // 6 users -> 4 PRB at Itbs 13 -> 125 -> 125000 bytes/sec
120  // 12 users -> 2 PRB at Itbs 13 -> 61 -> 61000 bytes/sec
121  // UPLINK - DISTANCE 9000 -> MCS 8 -> Itbs 8 (from table 7.1.7.2.1-1 of 36.213)
122  // 1 user -> 24 PRB at Itbs 8 -> 421 -> 421000 bytes/sec
123  // 3 users -> 8 PRB at Itbs 8 -> 137 -> 137000 bytes/sec
124  // 6 users -> 4 PRB at Itbs 8 -> 67 -> 67000 bytes/sec
125  // after the patch enforcing min 3 PRBs per UE:
126  // 12 users -> 3 PRB at Itbs 8 -> 49 bytes * 8/12 UE/TTI -> 32667 bytes/sec
127  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (1,10000,775000,421000,errorModel), TestCase::EXTENSIVE);
128  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (3,10000,253000,137000,errorModel), TestCase::EXTENSIVE);
129  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (6,10000,125000,67000,errorModel), TestCase::EXTENSIVE);
130  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (12,10000,61000,32667,errorModel), TestCase::EXTENSIVE);
131 
132  // DOWNLINK - DISTANCE 20000 -> MCS 8 -> Itbs 8 (from table 7.1.7.2.1-1 of 36.213)
133  // 1 user -> 24 PRB at Itbs 8 -> 421 -> 421000 bytes/sec
134  // 3 users -> 8 PRB at Itbs 8 -> 137 -> 137000 bytes/sec
135  // 6 users -> 4 PRB at Itbs 8 -> 67 -> 67000 bytes/sec
136  // 12 users -> 2 PRB at Itbs 8 -> 32 -> 32000 bytes/sec
137  // UPLINK - DISTANCE 20000 -> MCS 2 -> Itbs 2 (from table 7.1.7.2.1-1 of 36.213)
138  // 1 user -> 25 PRB at Itbs 2 -> 137 -> 137000 bytes/sec
139  // 3 users -> 8 PRB at Itbs 2 -> 41 -> 41000 bytes/sec
140  // 6 users -> 4 PRB at Itbs 2 -> 22 -> 22000 bytes/sec
141  // after the patch enforcing min 3 PRBs per UE:
142  // 12 users -> 3 PRB at Itbs 2 -> 18 bytes * 8/12 UE/TTI -> 12000 bytes/sec
143  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (1,20000,421000,137000,errorModel), TestCase::EXTENSIVE);
144  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (3,20000,137000,41000,errorModel), TestCase::EXTENSIVE);
145  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (6,20000,67000,22000,errorModel), TestCase::EXTENSIVE);
146  AddTestCase (new LenaFdBetFfMacSchedulerTestCase1 (12,20000,32000,12000,errorModel), TestCase::EXTENSIVE);
147 
148  // Test Case 2: fairness check
149 
150  std::vector<uint16_t> dist;
151  dist.push_back (0); // User 0 distance --> MCS 28
152  dist.push_back (4800); // User 1 distance --> MCS 22
153  dist.push_back (6000); // User 2 distance --> MCS 14
154  dist.push_back (10000); // User 3 distance --> MCS 8
155  dist.push_back (20000); // User 4 distance --> MCS 8
156  std::vector<uint32_t> estAchievableRateDl;
157  estAchievableRateDl.push_back (2196000);
158  estAchievableRateDl.push_back (1383000);
159  estAchievableRateDl.push_back (775000);
160  estAchievableRateDl.push_back (421000);
161  estAchievableRateDl.push_back (421000);
162  std::vector<uint32_t> estThrFdBetUl;
163  estThrFdBetUl.push_back (469000); // User 0 estimated TTI throughput from FDBET
164  estThrFdBetUl.push_back (157000); // User 1 estimated TTI throughput from FDBET
165  estThrFdBetUl.push_back (125000); // User 2 estimated TTI throughput from FDBET
166  estThrFdBetUl.push_back (85000); // User 3 estimated TTI throughput from FDBET
167  estThrFdBetUl.push_back (26000); // User 4 estimated TTI throughput from FDBET
168  AddTestCase (new LenaFdBetFfMacSchedulerTestCase2 (dist, estAchievableRateDl, estThrFdBetUl, errorModel), TestCase::QUICK);
169 }
170 
172 
173 
174 // --------------- T E S T - C A S E # 1 ------------------------------
175 
176 
177 std::string
179 {
180  std::ostringstream oss;
181  oss << nUser << " UEs, distance " << dist << " m";
182  return oss.str ();
183 }
184 
185 LenaFdBetFfMacSchedulerTestCase1::LenaFdBetFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t dist, double thrRefDl, double thrRefUl, bool errorModelEnabled)
186  : TestCase (BuildNameString (nUser, dist)),
187  m_nUser (nUser),
188  m_dist (dist),
189  m_thrRefDl (thrRefDl),
190  m_thrRefUl (thrRefUl),
191  m_errorModelEnabled (errorModelEnabled)
192 {
193 }
194 
196 {
197 }
198 
199 void
201 {
202  if (!m_errorModelEnabled)
203  {
204  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
205  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
206  }
207 
208  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
209 
214  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
215 
216  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
217 
218  // Create Nodes: eNodeB and UE
219  NodeContainer enbNodes;
220  NodeContainer ueNodes;
221  enbNodes.Create (1);
222  ueNodes.Create (m_nUser);
223 
224  // Install Mobility Model
225  MobilityHelper mobility;
226  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
227  mobility.Install (enbNodes);
228  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
229  mobility.Install (ueNodes);
230 
231  // Create Devices and install them in the Nodes (eNB and UE)
232  NetDeviceContainer enbDevs;
233  NetDeviceContainer ueDevs;
234  lteHelper->SetSchedulerType ("ns3::FdBetFfMacScheduler");
235  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
236  ueDevs = lteHelper->InstallUeDevice (ueNodes);
237 
238  // Attach a UE to a eNB
239  lteHelper->Attach (ueDevs, enbDevs.Get (0));
240 
241  // Activate an EPS bearer
243  EpsBearer bearer (q);
244  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
245 
246  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
247  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
248  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
249  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
250 
251  // Set UEs' position and power
252  for (int i = 0; i < m_nUser; i++)
253  {
255  mm->SetPosition (Vector (m_dist, 0.0, 0.0));
256  Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
257  Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
258  uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
259  uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
260  }
261 
262  double statsStartTime = 0.300; // need to allow for RRC connection establishment + SRS
263  double statsDuration = 0.6;
264  double tolerance = 0.1;
265  Simulator::Stop (Seconds (statsStartTime + statsDuration - 0.000001));
266 
267  lteHelper->EnableMacTraces ();
268  lteHelper->EnableRlcTraces ();
269  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
270  rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
271  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
272 
273  Simulator::Run ();
274 
278  NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
279  std::vector <uint64_t> dlDataRxed;
280  for (int i = 0; i < m_nUser; i++)
281  {
282  // get the imsi
283  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
284  // get the lcId
285  uint8_t lcId = 3;
286  dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
287  NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / statsDuration << " ref " << m_thrRefDl);
288  }
295  for (int i = 0; i < m_nUser; i++)
296  {
297  NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / statsDuration, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
298  }
299 
303  NS_LOG_INFO ("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
304  std::vector <uint64_t> ulDataRxed;
305  for (int i = 0; i < m_nUser; i++)
306  {
307  // get the imsi
308  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
309  // get the lcId
310  uint8_t lcId = 3;
311  ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
312  NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / statsDuration << " ref " << m_thrRefUl);
313  }
320  for (int i = 0; i < m_nUser; i++)
321  {
322  NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / statsDuration, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
323  }
325 
326 }
327 
328 
329 
330 // --------------- T E S T - C A S E # 2 ------------------------------
331 
332 
333 std::string
334 LenaFdBetFfMacSchedulerTestCase2::BuildNameString (uint16_t nUser, std::vector<uint16_t> dist)
335 {
336  std::ostringstream oss;
337  oss << "distances (m) = [ " ;
338  for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
339  {
340  oss << *it << " ";
341  }
342  oss << "]";
343  return oss.str ();
344 }
345 
346 
347 LenaFdBetFfMacSchedulerTestCase2::LenaFdBetFfMacSchedulerTestCase2 (std::vector<uint16_t> dist, std::vector<uint32_t> estAchievableRateDl, std::vector<uint32_t> estThrFdBetUl, bool errorModelEnabled)
348  : TestCase (BuildNameString (dist.size (), dist)),
349  m_nUser (dist.size ()),
350  m_dist (dist),
351  m_achievableRateDl (estAchievableRateDl),
352  m_estThrFdBetUl (estThrFdBetUl),
353  m_errorModelEnabled (errorModelEnabled)
354 {
355 }
356 
358 {
359 }
360 
361 void
363 {
364 
365  NS_LOG_FUNCTION (this);
366 
367  if (!m_errorModelEnabled)
368  {
369  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
370  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
371  }
372  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false));
373 
378  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
379 
380  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
381 
382  // Create Nodes: eNodeB and UE
383  NodeContainer enbNodes;
384  NodeContainer ueNodes;
385  enbNodes.Create (1);
386  ueNodes.Create (m_nUser);
387 
388  // Install Mobility Model
389  MobilityHelper mobility;
390  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
391  mobility.Install (enbNodes);
392  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
393  mobility.Install (ueNodes);
394 
395  // Create Devices and install them in the Nodes (eNB and UE)
396  NetDeviceContainer enbDevs;
397  NetDeviceContainer ueDevs;
398  lteHelper->SetSchedulerType ("ns3::FdBetFfMacScheduler");
399  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
400  ueDevs = lteHelper->InstallUeDevice (ueNodes);
401 
402  // Attach a UE to a eNB
403  lteHelper->Attach (ueDevs, enbDevs.Get (0));
404 
405  // Activate an EPS bearer
407  EpsBearer bearer (q);
408  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
409 
410  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
411  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
412  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
413  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
414 
415  // Set UEs' position and power
416  for (int i = 0; i < m_nUser; i++)
417  {
419  mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0));
420  Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
421  Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
422  uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
423  uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
424  }
425 
426 
427  double statsStartTime = 0.300; // need to allow for RRC connection establishment + SRS
428  double statsDuration = 0.4;
429  double tolerance = 0.1;
430  Simulator::Stop (Seconds (statsStartTime + statsDuration - 0.000001));
431 
432  lteHelper->EnableMacTraces ();
433  lteHelper->EnableRlcTraces ();
434  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
435  rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
436  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
437 
438  Simulator::Run ();
439 
440  NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)");
441  std::vector <uint64_t> dlDataRxed;
442  double totalData = 0;
443  double estTotalThr = 0;
444  double estUeThr = 0;
445  for (int i = 0; i < m_nUser; i++)
446  {
447  // get the imsi
448  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
449  // get the lcId
450  uint8_t lcId = 3;
451  dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
452  totalData += (double)dlDataRxed.at (i);
453  estTotalThr += 1 / m_achievableRateDl.at (i);
454  NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / statsDuration << " ref " << m_nUser);
455  }
456 
457  estTotalThr = m_nUser * (1 / estTotalThr);
458  estUeThr = estTotalThr / m_nUser;
463  for (int i = 0; i < m_nUser; i++)
464  {
465  double thrRatio = (double) 1 / m_nUser;
466  double estThrRatio = (double)dlDataRxed.at (i) / totalData;
467  NS_LOG_INFO ("\tUser " << i << " thrRatio " << thrRatio << " estThrRatio " << estThrRatio);
468  NS_TEST_ASSERT_MSG_EQ_TOL (estThrRatio, thrRatio, tolerance, " Unfair Throughput!");
469  NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / statsDuration, estUeThr, estUeThr * tolerance, " Unfair Throughput!");
470 
471  }
472 
477  NS_LOG_INFO ("UL - Test with " << m_nUser);
478  std::vector <uint64_t> ulDataRxed;
479  for (int i = 0; i < m_nUser; i++)
480  {
481  // get the imsi
482  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
483  // get the lcId
484  uint8_t lcId = 3;
485  ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
486  NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / statsDuration << " ref " << (double)m_estThrFdBetUl.at (i));
487  NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / statsDuration, (double)m_estThrFdBetUl.at (i), (double)m_estThrFdBetUl.at (i) * tolerance, " Unfair Throughput!");
488  }
490 
491 }
492 
493 
494 } // namespace ns3
495 
496 
497 
498 
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
Hold a bool native type.
Definition: boolean.h:38
hold variables of type string
Definition: string.h:19
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition: test.h:326
A suite of tests to run.
Definition: test.h:1025
Mobility model for which the current position does not change once it has been set and until it is se...
static std::string BuildNameString(uint16_t nUser, std::vector< uint16_t > dist)
This system test program creates different test cases with a single eNB and several UEs...
static void Run(void)
Run the simulation until one of:
Definition: simulator.cc:157
LenaFdBetFfMacSchedulerTestCase2(std::vector< uint16_t > dist, std::vector< uint32_t > m_achievableRateDl, std::vector< uint32_t > estThrFdBetUl, bool m_errorModelEnabled)
static LenaTestFdBetFfMacSchedulerSuite lenaTestFdBetFfMacSchedulerSuite
#define NS_LOG_INFO(msg)
Definition: log.h:298
encapsulates test code
Definition: test.h:849
a 3d vector
Definition: vector.h:31
virtual void DoRun(void)
Implementation to actually run this TestCase.
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
hold objects of type ns3::Time
Definition: nstime.h:961
Medium length test.
Definition: test.h:858
holds a vector of ns3::NetDevice pointers
LenaFdBetFfMacSchedulerTestCase1(uint16_t nUser, uint16_t dist, double thrRefDl, double thrRefUl, bool errorModelEnabled)
static std::string BuildNameString(uint16_t nUser, uint16_t dist)
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Definition: simulator.cc:121
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:667
keep track of a set of node pointers.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition: test.cc:173
Fast test.
Definition: test.h:857
Helper class used to assign positions and mobility models to nodes.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Definition: simulator.cc:165
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
NS_LOG_COMPONENT_DEFINE("LenaTestFdBetFfMacScheduler")
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Hold a floating point type.
Definition: double.h:41
The eNodeB device implementation.
Ptr< T > GetObject(void) const
Definition: object.h:361
Qci
QoS Class Indicator.
Definition: eps-bearer.h:77
The LteUeNetDevice class implements the UE net device.