A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lte-test-pf-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  */
21 
22 #include <iostream>
23 #include <sstream>
24 #include <string>
25 
26 #include <ns3/object.h>
27 #include <ns3/spectrum-interference.h>
28 #include <ns3/spectrum-error-model.h>
29 #include <ns3/log.h>
30 #include <ns3/test.h>
31 #include <ns3/simulator.h>
32 #include <ns3/packet.h>
33 #include <ns3/ptr.h>
34 #include "ns3/radio-bearer-stats-calculator.h"
35 #include <ns3/constant-position-mobility-model.h>
36 #include <ns3/eps-bearer.h>
37 #include <ns3/node-container.h>
38 #include <ns3/mobility-helper.h>
39 #include <ns3/net-device-container.h>
40 #include <ns3/lte-ue-net-device.h>
41 #include <ns3/lte-enb-net-device.h>
42 #include <ns3/lte-ue-rrc.h>
43 #include <ns3/lte-helper.h>
44 #include "ns3/string.h"
45 #include "ns3/double.h"
46 #include <ns3/lte-enb-phy.h>
47 #include <ns3/lte-ue-phy.h>
48 #include <ns3/boolean.h>
49 #include <ns3/enum.h>
50 
52 
53 NS_LOG_COMPONENT_DEFINE ("LenaTestPfFfMacCheduler");
54 
55 namespace ns3 {
56 
58  : TestSuite ("lte-pf-ff-mac-scheduler", SYSTEM)
59 {
60  NS_LOG_INFO ("creating LenaTestPfFfMacSchedulerSuite");
61 
62  //Test Case 1: AMC works in PF
63 
64  // DOWNLINK - DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
65  // 1 user -> 24 PRB at Itbs 26 -> 2196 -> 2196000 bytes/sec
66  // 3 users -> 2196000 among 3 users -> 732000 bytes/sec
67  // 6 users -> 2196000 among 6 users -> 366000 bytes/sec
68  // 12 users -> 2196000 among 12 users -> 183000 bytes/sec
69  // 15 users -> 2196000 among 15 users -> 146400 bytes/sec
70  // UPLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
71  // 1 user -> 25 PRB at Itbs 26 -> 2292 -> 2292000 bytes/sec
72  // 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 bytes/sec
73  // 6 users -> 4 PRB at Itbs 26 -> 373 -> 373000 bytes/sec
74  // 12 users -> 2 PRB at Itbs 26 -> 185 -> 185000 bytes/sec
75  // 15 users -> 1 PRB at Itbs 26 -> 89 -> 89000 bytes/sec
76  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,0,2196000,2292000));
77  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,0,732000,749000));
78  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,0,366000,373000));
79  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,0,183000,185000));
80  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,0,146400,89000));
81 
82  // DOWNLINK - DISTANCE 3000 -> MCS 24 -> Itbs 30 (from table 7.1.7.2.1-1 of 36.213)
83  // 1 user -> 24 PRB at Itbs 20 -> 1383 -> 1383000 bytes/sec
84  // 3 users -> 1383000 among 3 users -> 461000 bytes/sec
85  // 6 users -> 1383000 among 6 users -> 230500 bytes/sec
86  // 12 users -> 1383000 among 12 users -> 115250 bytes/sec
87  // 15 users -> 1383000 among 15 users -> 92200 bytes/sec
88  // UPLINK - DISTANCE 3000 -> MCS 20 -> Itbs 18 (from table 7.1.7.2.1-1 of 36.213)
89  // 1 user -> 25 PRB at Itbs 18 -> 1239 -> 1239000 bytes/sec
90  // 3 users -> 8 PRB at Itbs 18 -> 389 -> 389000 bytes/sec
91  // 6 users -> 4 PRB at Itbs 18 -> 193 -> 193000 bytes/sec
92  // 12 users -> 2 PRB at Itbs 18 -> 97 -> 97000 bytes/sec
93  // 15 users -> 1 PRB at Itbs 18 -> 47 -> 47000 bytes/sec
94  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,3000,1383000,1239000));
95  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,3000,461000,389000));
96  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,3000,230500,193000));
97  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,3000,115250,97000));
98  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,3000,92200,47000));
99 
100  // DOWNLINK - DISTANCE 6000 -> MCS 16 -> Itbs 15 (from table 7.1.7.2.1-1 of 36.213)
101  // 1 user -> 24 PRB at Itbs 15 -> 903 -> 903000 bytes/sec
102  // 3 users -> 903000 among 3 users -> 301000 bytes/sec
103  // 6 users -> 903000 among 6 users -> 150500 bytes/sec
104  // 12 users -> 903000 among 12 users -> 75250 bytes/sec
105  // 15 users -> 903000 among 15 users -> 60200 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 -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec
111  // 15 users -> 1 PRB at Itbs 11 -> 22 -> 22000 bytes/sec
112  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,6000,903000,621000));
113  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,6000,301000,201000));
114  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,6000,150500,97000));
115  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,6000,75250,47000));
116  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,6000,60200,22000));
117 
118  // DOWNLINK - DISTANCE 9000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213)
119  // 1 user -> 24 PRB at Itbs 11 -> 597 -> 597000 bytes/sec
120  // 3 users -> 597000 among 3 users -> 199000 bytes/sec
121  // 6 users -> 597000 among 6 users -> 99500 bytes/sec
122  // 12 users -> 597000 among 12 users -> 49750 bytes/sec
123  // 15 users -> 597000 among 15 users -> 39800 bytes/sec
124  // UPLINK - DISTANCE 9000 -> MCS 8 -> Itbs 8 (from table 7.1.7.2.1-1 of 36.213)
125  // 1 user -> 24 PRB at Itbs 8 -> 437 -> 437000 bytes/sec
126  // 3 users -> 8 PRB at Itbs 8 -> 137 -> 137000 bytes/sec
127  // 6 users -> 4 PRB at Itbs 8 -> 67 -> 67000 bytes/sec
128  // 12 users -> 2 PRB at Itbs 8 -> 32 -> 32000 bytes/sec
129  // 15 users -> 1 PRB at Itbs 8 -> 15 -> 15000 bytes/sec
130  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,9000,597000,437000));
131  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,9000,199000,137000));
132  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,9000,99500,67000));
133  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,9000,49750,32000));
134  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,9000,39800,15000));
135 
136  // DONWLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213)
137  // 1 user -> 24 PRB at Itbs 6 -> 309 -> 309000 bytes/sec
138  // 3 users -> 309000 among 3 users -> 103000 bytes/sec
139  // 6 users -> 309000 among 6 users -> 51500 bytes/sec
140  // 12 users -> 309000 among 12 users -> 25750 bytes/sec
141  // 15 users -> 309000 among 15 users -> 20600 bytes/sec
142  // UPLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213)
143  // 1 user -> 25 PRB at Itbs 6 -> 233 -> 233000 bytes/sec
144  // 3 users -> 8 PRB at Itbs 6 -> 69 -> 69000 bytes/sec
145  // 6 users -> 4 PRB at Itbs 6 -> 32 -> 32000 bytes/sec
146  // 12 users -> 2 PRB at Itbs 6 -> 15 -> 15000 bytes/sec
147  // 15 users -> 1 PRB at Itbs 6 -> 7 -> 7000 bytes/sec
148  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,15000,309000,233000));
149  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,15000,103000,69000));
150  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,15000,51500,32000));
151  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,15000,25750,15000));
152  AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,15000,20600,7000));
153 
154  // Test Case 2: fairness check
155 
156  std::vector<uint16_t> dist;
157  dist.push_back (0); // User 0 distance --> MCS 28
158  dist.push_back (3000); // User 1 distance --> MCS 24
159  dist.push_back (6000); // User 2 distance --> MCS 16
160  dist.push_back (9000); // User 3 distance --> MCS 12
161  dist.push_back (15000); // User 4 distance --> MCS 6
162  std::vector<uint32_t> estThrPfDl;
163  estThrPfDl.push_back (89000); // User 0 estimated TTI throughput from PF
164  estThrPfDl.push_back (55000); // User 1 estimated TTI throughput from PF
165  estThrPfDl.push_back (35000); // User 2 estimated TTI throughput from PF
166  estThrPfDl.push_back (22000); // User 3 estimated TTI throughput from PF
167  estThrPfDl.push_back (11000); // User 4 estimated TTI throughput from PF
168  std::vector<uint32_t> estThrPfUl;
169  estThrPfUl.push_back (469000); // User 0 estimated TTI throughput from PF
170  estThrPfUl.push_back (249000); // User 1 estimated TTI throughput from PF
171  estThrPfUl.push_back (125000); // User 2 estimated TTI throughput from PF
172  estThrPfUl.push_back (85000); // User 3 estimated TTI throughput from PF
173  estThrPfUl.push_back (41000); // User 4 estimated TTI throughput from PF
174  AddTestCase (new LenaPfFfMacSchedulerTestCase2 (dist, estThrPfDl, estThrPfUl));
175 
176 
177 }
178 
180 
181 
182 // --------------- T E S T - C A S E # 1 ------------------------------
183 
184 
185 std::string
186 LenaPfFfMacSchedulerTestCase1::BuildNameString (uint16_t nUser, uint16_t dist)
187 {
188  std::ostringstream oss;
189  oss << nUser << " UEs, distance " << dist << " m";
190  return oss.str ();
191 }
192 
193 LenaPfFfMacSchedulerTestCase1::LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl)
194  : TestCase (BuildNameString (nUser, dist)),
195  m_nUser (nUser),
196  m_nLc (nLc),
197  m_dist (dist),
198  m_thrRefDl (thrRefDl),
199  m_thrRefUl (thrRefUl)
200 {
201 }
202 
204 {
205 }
206 
207 void
209 {
210  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
211  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
212  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
213  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); LogComponentDisableAll (LOG_LEVEL_ALL);
214 
216  //LogComponentEnable ("LenaTestPfFfMacCheduler", LOG_LEVEL_ALL);
217 
222  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
223 
224  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
225 
226  // Create Nodes: eNodeB and UE
227  NodeContainer enbNodes;
228  NodeContainer ueNodes;
229  enbNodes.Create (1);
230  ueNodes.Create (m_nUser);
231 
232  // Install Mobility Model
233  MobilityHelper mobility;
234  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
235  mobility.Install (enbNodes);
236  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
237  mobility.Install (ueNodes);
238 
239  // Create Devices and install them in the Nodes (eNB and UE)
240  NetDeviceContainer enbDevs;
241  NetDeviceContainer ueDevs;
242  lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler");
243  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
244  ueDevs = lteHelper->InstallUeDevice (ueNodes);
245 
246  // Attach a UE to a eNB
247  lteHelper->Attach (ueDevs, enbDevs.Get (0));
248 
249  // Activate an EPS bearer
251  EpsBearer bearer (q);
252  lteHelper->ActivateEpsBearer (ueDevs, bearer, EpcTft::Default ());
253 
254  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
255  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
256  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
257  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
258 
259  // Set UEs' position and power
260  for (int i = 0; i < m_nUser; i++)
261  {
263  mm->SetPosition (Vector (m_dist, 0.0, 0.0));
264  Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
265  Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
266  uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
267  uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
268  }
269 
270  lteHelper->EnableRlcTraces ();
271 
272  double simulationTime = 1.0;
273  double tolerance = 0.1;
274  Simulator::Stop (Seconds (simulationTime));
275 
276  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
277  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
278 
279  Simulator::Run ();
280 
284  NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
285  std::vector <uint64_t> dlDataRxed;
286  for (int i = 0; i < m_nUser; i++)
287  {
288  // get the imsi
289  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
290  // get the lcId
291  uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
292  dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
293  NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_thrRefDl);
294  }
301  for (int i = 0; i < m_nUser; i++)
302  {
303  NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
304  }
305 
309  NS_LOG_INFO ("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
310  std::vector <uint64_t> ulDataRxed;
311  for (int i = 0; i < m_nUser; i++)
312  {
313  // get the imsi
314  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
315  // get the lcId
316  uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
317  ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
318  NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl);
319  }
326  for (int i = 0; i < m_nUser; i++)
327  {
328  NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
329  }
331 
332 }
333 
334 
335 
336 // --------------- T E S T - C A S E # 2 ------------------------------
337 
338 
339 std::string
340 LenaPfFfMacSchedulerTestCase2::BuildNameString (uint16_t nUser, std::vector<uint16_t> dist)
341 {
342  std::ostringstream oss;
343  oss << "distances (m) = [ " ;
344  for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
345  {
346  oss << *it << " ";
347  }
348  oss << "]";
349  return oss.str ();
350 }
351 
352 
353 LenaPfFfMacSchedulerTestCase2::LenaPfFfMacSchedulerTestCase2 (std::vector<uint16_t> dist, std::vector<uint32_t> estThrPfDl, std::vector<uint32_t> estThrPfUl)
354  : TestCase (BuildNameString (dist.size (), dist)),
355  m_nUser (dist.size ()),
356  m_dist (dist),
357  m_estThrPfDl (estThrPfDl),
358  m_estThrPfUl (estThrPfUl)
359 {
360 }
361 
363 {
364 }
365 
366 void
368 {
370  //LogComponentEnable ("LenaTestPfFfMacCheduler", LOG_LEVEL_ALL);
371 
376  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
377 
378  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
379 
380  // Create Nodes: eNodeB and UE
381  NodeContainer enbNodes;
382  NodeContainer ueNodes;
383  enbNodes.Create (1);
384  ueNodes.Create (m_nUser);
385 
386  // Install Mobility Model
387  MobilityHelper mobility;
388  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
389  mobility.Install (enbNodes);
390  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
391  mobility.Install (ueNodes);
392 
393  // Create Devices and install them in the Nodes (eNB and UE)
394  NetDeviceContainer enbDevs;
395  NetDeviceContainer ueDevs;
396  lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler");
397  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
398  ueDevs = lteHelper->InstallUeDevice (ueNodes);
399 
400  // Attach a UE to a eNB
401  lteHelper->Attach (ueDevs, enbDevs.Get (0));
402 
403  // Activate an EPS bearer
405  EpsBearer bearer (q);
406  lteHelper->ActivateEpsBearer (ueDevs, bearer, EpcTft::Default ());
407 
408  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
409  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
410  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
411  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
412 
413  // Set UEs' position and power
414  for (int i = 0; i < m_nUser; i++)
415  {
417  mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0));
418  Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
419  Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
420  uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
421  uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
422  }
423 
424  lteHelper->EnableRlcTraces ();
425 
426  double simulationTime = 0.4;
427  double tolerance = 0.1;
428  Simulator::Stop (Seconds (simulationTime));
429 
430  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
431  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
432 
433  Simulator::Run ();
434 
435  NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)");
436  std::vector <uint64_t> dlDataRxed;
437  double totalData = 0;
438  double totalEstThrPf = 0;
439  for (int i = 0; i < m_nUser; i++)
440  {
441  // get the imsi
442  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
443  // get the lcId
444  uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
445  dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
446  totalData += (double)dlDataRxed.at (i);
447  NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_nUser);
448  totalEstThrPf += m_estThrPfDl.at (i);
449  }
450 
456  for (int i = 0; i < m_nUser; i++)
457  {
458  double thrRatio = (double)dlDataRxed.at (i) / totalData;
459  double estThrRatio = (double)m_estThrPfDl.at (i) / totalEstThrPf;
460  NS_LOG_INFO ("\tUser " << i << " thrRatio " << thrRatio << " estThrRatio " << estThrRatio);
461  NS_TEST_ASSERT_MSG_EQ_TOL (estThrRatio, thrRatio, tolerance, " Unfair Throughput!");
462  }
463 
468  NS_LOG_INFO ("UL - Test with " << m_nUser);
469  std::vector <uint64_t> ulDataRxed;
470  for (int i = 0; i < m_nUser; i++)
471  {
472  // get the imsi
473  uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
474  // get the lcId
475  uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
476  ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
477  NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << (double)m_estThrPfUl.at (i));
478  NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, (double)m_estThrPfUl.at (i), (double)m_estThrPfUl.at (i) * tolerance, " Unfair Throughput!");
479  }
481 
482 }
483 
484 
485 } // namespace ns3
486 
487 
488 
489