A Discrete-Event Network Simulator
API
lena-dual-stripe.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Nicola Baldo <nbaldo@cttc.es>
18  */
19 
20 #include <ns3/applications-module.h>
21 #include <ns3/buildings-module.h>
22 #include <ns3/config-store-module.h>
23 #include <ns3/core-module.h>
24 #include <ns3/internet-module.h>
25 #include <ns3/log.h>
26 #include <ns3/lte-module.h>
27 #include <ns3/mobility-module.h>
28 #include <ns3/network-module.h>
29 #include <ns3/point-to-point-helper.h>
30 
31 #include <iomanip>
32 #include <ios>
33 #include <string>
34 #include <vector>
35 
36 // The topology of this simulation program is inspired from
37 // 3GPP R4-092042, Section 4.2.1 Dual Stripe Model
38 // note that the term "apartments" used in that document matches with
39 // the term "room" used in the BuildingsMobilityModel
40 
41 using namespace ns3;
42 
43 NS_LOG_COMPONENT_DEFINE("LenaDualStripe");
44 
52 bool
54 {
55  return !((a.xMin > b.xMax) || (b.xMin > a.xMax) || (a.yMin > b.yMax) || (b.yMin > a.yMax));
56 }
57 
64 {
65  public:
72  FemtocellBlockAllocator(Box area, uint32_t nApartmentsX, uint32_t nFloors);
77  void Create(uint32_t n);
79  void Create();
80 
81  private:
88  bool OverlapsWithAnyPrevious(Box box);
90  uint32_t m_nApartmentsX;
91  uint32_t m_nFloors;
92  std::list<Box> m_previousBlocks;
93  double m_xSize;
94  double m_ySize;
97 };
98 
99 FemtocellBlockAllocator::FemtocellBlockAllocator(Box area, uint32_t nApartmentsX, uint32_t nFloors)
100  : m_area(area),
101  m_nApartmentsX(nApartmentsX),
102  m_nFloors(nFloors),
103  m_xSize(nApartmentsX * 10 + 20),
104  m_ySize(70)
105 {
106  m_xMinVar = CreateObject<UniformRandomVariable>();
107  m_xMinVar->SetAttribute("Min", DoubleValue(area.xMin));
108  m_xMinVar->SetAttribute("Max", DoubleValue(area.xMax - m_xSize));
109  m_yMinVar = CreateObject<UniformRandomVariable>();
110  m_yMinVar->SetAttribute("Min", DoubleValue(area.yMin));
111  m_yMinVar->SetAttribute("Max", DoubleValue(area.yMax - m_ySize));
112 }
113 
114 void
116 {
117  for (uint32_t i = 0; i < n; ++i)
118  {
119  Create();
120  }
121 }
122 
123 void
125 {
126  Box box;
127  uint32_t attempt = 0;
128  do
129  {
130  NS_ASSERT_MSG(attempt < 100,
131  "Too many failed attempts to position apartment block. Too many blocks? Too "
132  "small area?");
133  box.xMin = m_xMinVar->GetValue();
134  box.xMax = box.xMin + m_xSize;
135  box.yMin = m_yMinVar->GetValue();
136  box.yMax = box.yMin + m_ySize;
137  ++attempt;
138  } while (OverlapsWithAnyPrevious(box));
139 
140  NS_LOG_LOGIC("allocated non overlapping block " << box);
141  m_previousBlocks.push_back(box);
142  Ptr<GridBuildingAllocator> gridBuildingAllocator;
143  gridBuildingAllocator = CreateObject<GridBuildingAllocator>();
144  gridBuildingAllocator->SetAttribute("GridWidth", UintegerValue(1));
145  gridBuildingAllocator->SetAttribute("LengthX", DoubleValue(10 * m_nApartmentsX));
146  gridBuildingAllocator->SetAttribute("LengthY", DoubleValue(10 * 2));
147  gridBuildingAllocator->SetAttribute("DeltaX", DoubleValue(10));
148  gridBuildingAllocator->SetAttribute("DeltaY", DoubleValue(10));
149  gridBuildingAllocator->SetAttribute("Height", DoubleValue(3 * m_nFloors));
150  gridBuildingAllocator->SetBuildingAttribute("NRoomsX", UintegerValue(m_nApartmentsX));
151  gridBuildingAllocator->SetBuildingAttribute("NRoomsY", UintegerValue(2));
152  gridBuildingAllocator->SetBuildingAttribute("NFloors", UintegerValue(m_nFloors));
153  gridBuildingAllocator->SetAttribute("MinX", DoubleValue(box.xMin + 10));
154  gridBuildingAllocator->SetAttribute("MinY", DoubleValue(box.yMin + 10));
155  gridBuildingAllocator->Create(2);
156 }
157 
158 bool
160 {
161  for (auto it = m_previousBlocks.begin(); it != m_previousBlocks.end(); ++it)
162  {
163  if (AreOverlapping(*it, box))
164  {
165  return true;
166  }
167  }
168  return false;
169 }
170 
176 void
178 {
179  std::ofstream outFile;
180  outFile.open(filename, std::ios_base::out | std::ios_base::trunc);
181  if (!outFile.is_open())
182  {
183  NS_LOG_ERROR("Can't open file " << filename);
184  return;
185  }
186  uint32_t index = 0;
187  for (auto it = BuildingList::Begin(); it != BuildingList::End(); ++it)
188  {
189  ++index;
190  Box box = (*it)->GetBoundaries();
191  outFile << "set object " << index << " rect from " << box.xMin << "," << box.yMin << " to "
192  << box.xMax << "," << box.yMax << " front fs empty " << std::endl;
193  }
194 }
195 
201 void
202 PrintGnuplottableUeListToFile(std::string filename)
203 {
204  std::ofstream outFile;
205  outFile.open(filename, std::ios_base::out | std::ios_base::trunc);
206  if (!outFile.is_open())
207  {
208  NS_LOG_ERROR("Can't open file " << filename);
209  return;
210  }
211  for (auto it = NodeList::Begin(); it != NodeList::End(); ++it)
212  {
213  Ptr<Node> node = *it;
214  int nDevs = node->GetNDevices();
215  for (int j = 0; j < nDevs; j++)
216  {
217  Ptr<LteUeNetDevice> uedev = node->GetDevice(j)->GetObject<LteUeNetDevice>();
218  if (uedev)
219  {
220  Vector pos = node->GetObject<MobilityModel>()->GetPosition();
221  outFile << "set label \"" << uedev->GetImsi() << "\" at " << pos.x << "," << pos.y
222  << " left font \"Helvetica,4\" textcolor rgb \"grey\" front point pt 1 ps "
223  "0.3 lc rgb \"grey\" offset 0,0"
224  << std::endl;
225  }
226  }
227  }
228 }
229 
235 void
236 PrintGnuplottableEnbListToFile(std::string filename)
237 {
238  std::ofstream outFile;
239  outFile.open(filename, std::ios_base::out | std::ios_base::trunc);
240  if (!outFile.is_open())
241  {
242  NS_LOG_ERROR("Can't open file " << filename);
243  return;
244  }
245  for (auto it = NodeList::Begin(); it != NodeList::End(); ++it)
246  {
247  Ptr<Node> node = *it;
248  int nDevs = node->GetNDevices();
249  for (int j = 0; j < nDevs; j++)
250  {
251  Ptr<LteEnbNetDevice> enbdev = node->GetDevice(j)->GetObject<LteEnbNetDevice>();
252  if (enbdev)
253  {
254  Vector pos = node->GetObject<MobilityModel>()->GetPosition();
255  outFile << "set label \"" << enbdev->GetCellId() << "\" at " << pos.x << ","
256  << pos.y
257  << " left font \"Helvetica,4\" textcolor rgb \"white\" front point pt 2 "
258  "ps 0.3 lc rgb \"white\" offset 0,0"
259  << std::endl;
260  }
261  }
262  }
263 }
264 
266 static ns3::GlobalValue g_nBlocks("nBlocks",
267  "Number of femtocell blocks",
269  ns3::MakeUintegerChecker<uint32_t>());
270 
272 static ns3::GlobalValue g_nApartmentsX("nApartmentsX",
273  "Number of apartments along the X axis in a femtocell block",
274  ns3::UintegerValue(10),
275  ns3::MakeUintegerChecker<uint32_t>());
276 
278 static ns3::GlobalValue g_nFloors("nFloors",
279  "Number of floors",
281  ns3::MakeUintegerChecker<uint32_t>());
282 
284 static ns3::GlobalValue g_nMacroEnbSites("nMacroEnbSites",
285  "How many macro sites there are",
287  ns3::MakeUintegerChecker<uint32_t>());
288 
291  "nMacroEnbSitesX",
292  "(minimum) number of sites along the X-axis of the hex grid",
294  ns3::MakeUintegerChecker<uint32_t>());
295 
297 static ns3::GlobalValue g_interSiteDistance("interSiteDistance",
298  "min distance between two nearby macro cell sites",
299  ns3::DoubleValue(500),
300  ns3::MakeDoubleChecker<double>());
301 
305  "areaMarginFactor",
306  "how much the UE area extends outside the macrocell grid, "
307  "expressed as fraction of the interSiteDistance",
308  ns3::DoubleValue(0.5),
309  ns3::MakeDoubleChecker<double>());
310 
312 static ns3::GlobalValue g_macroUeDensity("macroUeDensity",
313  "How many macrocell UEs there are per square meter",
314  ns3::DoubleValue(0.00002),
315  ns3::MakeDoubleChecker<double>());
316 
318 static ns3::GlobalValue g_homeEnbDeploymentRatio("homeEnbDeploymentRatio",
319  "The HeNB deployment ratio as per 3GPP R4-092042",
320  ns3::DoubleValue(0.2),
321  ns3::MakeDoubleChecker<double>());
322 
324 static ns3::GlobalValue g_homeEnbActivationRatio("homeEnbActivationRatio",
325  "The HeNB activation ratio as per 3GPP R4-092042",
326  ns3::DoubleValue(0.5),
327  ns3::MakeDoubleChecker<double>());
328 
331  "homeUesHomeEnbRatio",
332  "How many (on average) home UEs per HeNB there are in the simulation",
333  ns3::DoubleValue(1.0),
334  ns3::MakeDoubleChecker<double>());
335 
337 static ns3::GlobalValue g_macroEnbTxPowerDbm("macroEnbTxPowerDbm",
338  "TX power [dBm] used by macro eNBs",
339  ns3::DoubleValue(46.0),
340  ns3::MakeDoubleChecker<double>());
341 
343 static ns3::GlobalValue g_homeEnbTxPowerDbm("homeEnbTxPowerDbm",
344  "TX power [dBm] used by HeNBs",
345  ns3::DoubleValue(20.0),
346  ns3::MakeDoubleChecker<double>());
347 
349 static ns3::GlobalValue g_macroEnbDlEarfcn("macroEnbDlEarfcn",
350  "DL EARFCN used by macro eNBs",
351  ns3::UintegerValue(100),
352  ns3::MakeUintegerChecker<uint16_t>());
353 
355 static ns3::GlobalValue g_homeEnbDlEarfcn("homeEnbDlEarfcn",
356  "DL EARFCN used by HeNBs",
357  ns3::UintegerValue(100),
358  ns3::MakeUintegerChecker<uint16_t>());
359 
361 static ns3::GlobalValue g_macroEnbBandwidth("macroEnbBandwidth",
362  "bandwidth [num RBs] used by macro eNBs",
363  ns3::UintegerValue(25),
364  ns3::MakeUintegerChecker<uint16_t>());
365 
367 static ns3::GlobalValue g_homeEnbBandwidth("homeEnbBandwidth",
368  "bandwidth [num RBs] used by HeNBs",
369  ns3::UintegerValue(25),
370  ns3::MakeUintegerChecker<uint16_t>());
371 
373 static ns3::GlobalValue g_simTime("simTime",
374  "Total duration of the simulation [s]",
375  ns3::DoubleValue(0.25),
376  ns3::MakeDoubleChecker<double>());
377 
380  "generateRem",
381  "if true, will generate a REM and then abort the simulation;"
382  "if false, will run the simulation normally (without generating any REM)",
383  ns3::BooleanValue(false),
385 
388  "remRbId",
389  "Resource Block Id of Data Channel, for which REM will be generated;"
390  "default value is -1, what means REM will be averaged from all RBs of "
391  "Control Channel",
392  ns3::IntegerValue(-1),
393  MakeIntegerChecker<int32_t>());
394 
397  "epc",
398  "If true, will setup the EPC to simulate an end-to-end topology, "
399  "with real IP applications over PDCP and RLC UM (or RLC AM by changing "
400  "the default value of EpsBearerToRlcMapping e.g. to RLC_AM_ALWAYS). "
401  "If false, only the LTE radio access will be simulated with RLC SM.",
402  ns3::BooleanValue(false),
404 
407  "epcDl",
408  "if true, will activate data flows in the downlink when EPC is being used. "
409  "If false, downlink flows won't be activated. "
410  "If EPC is not used, this parameter will be ignored.",
411  ns3::BooleanValue(true),
413 
416  "epcUl",
417  "if true, will activate data flows in the uplink when EPC is being used. "
418  "If false, uplink flows won't be activated. "
419  "If EPC is not used, this parameter will be ignored.",
420  ns3::BooleanValue(true),
422 
425  "useUdp",
426  "if true, the UdpClient application will be used. "
427  "Otherwise, the BulkSend application will be used over a TCP connection. "
428  "If EPC is not used, this parameter will be ignored.",
429  ns3::BooleanValue(true),
431 
434 static ns3::GlobalValue g_fadingTrace("fadingTrace",
435  "The path of the fading trace (by default no fading trace "
436  "is loaded, i.e., fading is not considered)",
437  ns3::StringValue(""),
439 
441 static ns3::GlobalValue g_numBearersPerUe("numBearersPerUe",
442  "How many bearers per UE there are in the simulation",
444  ns3::MakeUintegerChecker<uint16_t>());
445 
447 static ns3::GlobalValue g_srsPeriodicity("srsPeriodicity",
448  "SRS Periodicity (has to be at least "
449  "greater than the number of UEs per eNB)",
450  ns3::UintegerValue(80),
451  ns3::MakeUintegerChecker<uint16_t>());
452 
455  "outdoorUeMinSpeed",
456  "Minimum speed value of macro UE with random waypoint model [m/s].",
457  ns3::DoubleValue(0.0),
458  ns3::MakeDoubleChecker<double>());
459 
462  "outdoorUeMaxSpeed",
463  "Maximum speed value of macro UE with random waypoint model [m/s].",
464  ns3::DoubleValue(0.0),
465  ns3::MakeDoubleChecker<double>());
466 
467 int
468 main(int argc, char* argv[])
469 {
470  // change some default attributes so that they are reasonable for
471  // this scenario, but do this before processing command line
472  // arguments, so that the user is allowed to override these settings
473  Config::SetDefault("ns3::UdpClient::Interval", TimeValue(MilliSeconds(1)));
474  Config::SetDefault("ns3::UdpClient::MaxPackets", UintegerValue(1000000));
475  Config::SetDefault("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue(10 * 1024));
476 
477  CommandLine cmd(__FILE__);
478  cmd.Parse(argc, argv);
479  ConfigStore inputConfig;
480  inputConfig.ConfigureDefaults();
481  // parse again so you can override input file default values via command line
482  cmd.Parse(argc, argv);
483 
484  // the scenario parameters get their values from the global attributes defined above
485  UintegerValue uintegerValue;
486  IntegerValue integerValue;
487  DoubleValue doubleValue;
488  BooleanValue booleanValue;
489  StringValue stringValue;
490  GlobalValue::GetValueByName("nBlocks", uintegerValue);
491  uint32_t nBlocks = uintegerValue.Get();
492  GlobalValue::GetValueByName("nApartmentsX", uintegerValue);
493  uint32_t nApartmentsX = uintegerValue.Get();
494  GlobalValue::GetValueByName("nFloors", uintegerValue);
495  uint32_t nFloors = uintegerValue.Get();
496  GlobalValue::GetValueByName("nMacroEnbSites", uintegerValue);
497  uint32_t nMacroEnbSites = uintegerValue.Get();
498  GlobalValue::GetValueByName("nMacroEnbSitesX", uintegerValue);
499  uint32_t nMacroEnbSitesX = uintegerValue.Get();
500  GlobalValue::GetValueByName("interSiteDistance", doubleValue);
501  double interSiteDistance = doubleValue.Get();
502  GlobalValue::GetValueByName("areaMarginFactor", doubleValue);
503  double areaMarginFactor = doubleValue.Get();
504  GlobalValue::GetValueByName("macroUeDensity", doubleValue);
505  double macroUeDensity = doubleValue.Get();
506  GlobalValue::GetValueByName("homeEnbDeploymentRatio", doubleValue);
507  double homeEnbDeploymentRatio = doubleValue.Get();
508  GlobalValue::GetValueByName("homeEnbActivationRatio", doubleValue);
509  double homeEnbActivationRatio = doubleValue.Get();
510  GlobalValue::GetValueByName("homeUesHomeEnbRatio", doubleValue);
511  double homeUesHomeEnbRatio = doubleValue.Get();
512  GlobalValue::GetValueByName("macroEnbTxPowerDbm", doubleValue);
513  double macroEnbTxPowerDbm = doubleValue.Get();
514  GlobalValue::GetValueByName("homeEnbTxPowerDbm", doubleValue);
515  double homeEnbTxPowerDbm = doubleValue.Get();
516  GlobalValue::GetValueByName("macroEnbDlEarfcn", uintegerValue);
517  uint32_t macroEnbDlEarfcn = uintegerValue.Get();
518  GlobalValue::GetValueByName("homeEnbDlEarfcn", uintegerValue);
519  uint32_t homeEnbDlEarfcn = uintegerValue.Get();
520  GlobalValue::GetValueByName("macroEnbBandwidth", uintegerValue);
521  uint16_t macroEnbBandwidth = uintegerValue.Get();
522  GlobalValue::GetValueByName("homeEnbBandwidth", uintegerValue);
523  uint16_t homeEnbBandwidth = uintegerValue.Get();
524  GlobalValue::GetValueByName("simTime", doubleValue);
525  double simTime = doubleValue.Get();
526  GlobalValue::GetValueByName("epc", booleanValue);
527  bool epc = booleanValue.Get();
528  GlobalValue::GetValueByName("epcDl", booleanValue);
529  bool epcDl = booleanValue.Get();
530  GlobalValue::GetValueByName("epcUl", booleanValue);
531  bool epcUl = booleanValue.Get();
532  GlobalValue::GetValueByName("useUdp", booleanValue);
533  bool useUdp = booleanValue.Get();
534  GlobalValue::GetValueByName("generateRem", booleanValue);
535  bool generateRem = booleanValue.Get();
536  GlobalValue::GetValueByName("remRbId", integerValue);
537  int32_t remRbId = integerValue.Get();
538  GlobalValue::GetValueByName("fadingTrace", stringValue);
539  std::string fadingTrace = stringValue.Get();
540  GlobalValue::GetValueByName("numBearersPerUe", uintegerValue);
541  uint16_t numBearersPerUe = uintegerValue.Get();
542  GlobalValue::GetValueByName("srsPeriodicity", uintegerValue);
543  uint16_t srsPeriodicity = uintegerValue.Get();
544  GlobalValue::GetValueByName("outdoorUeMinSpeed", doubleValue);
545  uint16_t outdoorUeMinSpeed = doubleValue.Get();
546  GlobalValue::GetValueByName("outdoorUeMaxSpeed", doubleValue);
547  uint16_t outdoorUeMaxSpeed = doubleValue.Get();
548 
549  Config::SetDefault("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue(srsPeriodicity));
550 
551  Box macroUeBox;
552  double ueZ = 1.5;
553  if (nMacroEnbSites > 0)
554  {
555  uint32_t currentSite = nMacroEnbSites - 1;
556  uint32_t biRowIndex = (currentSite / (nMacroEnbSitesX + nMacroEnbSitesX + 1));
557  uint32_t biRowRemainder = currentSite % (nMacroEnbSitesX + nMacroEnbSitesX + 1);
558  uint32_t rowIndex = biRowIndex * 2 + 1;
559  if (biRowRemainder >= nMacroEnbSitesX)
560  {
561  ++rowIndex;
562  }
563  uint32_t nMacroEnbSitesY = rowIndex;
564  NS_LOG_LOGIC("nMacroEnbSitesY = " << nMacroEnbSitesY);
565 
566  macroUeBox = Box(-areaMarginFactor * interSiteDistance,
567  (nMacroEnbSitesX + areaMarginFactor) * interSiteDistance,
568  -areaMarginFactor * interSiteDistance,
569  (nMacroEnbSitesY - 1) * interSiteDistance * sqrt(0.75) +
570  areaMarginFactor * interSiteDistance,
571  ueZ,
572  ueZ);
573  }
574  else
575  {
576  // still need the box to place femtocell blocks
577  macroUeBox = Box(0, 150, 0, 150, ueZ, ueZ);
578  }
579 
580  FemtocellBlockAllocator blockAllocator(macroUeBox, nApartmentsX, nFloors);
581  blockAllocator.Create(nBlocks);
582 
583  uint32_t nHomeEnbs = round(4 * nApartmentsX * nBlocks * nFloors * homeEnbDeploymentRatio *
584  homeEnbActivationRatio);
585  NS_LOG_LOGIC("nHomeEnbs = " << nHomeEnbs);
586  uint32_t nHomeUes = round(nHomeEnbs * homeUesHomeEnbRatio);
587  NS_LOG_LOGIC("nHomeUes = " << nHomeUes);
588  double macroUeAreaSize =
589  (macroUeBox.xMax - macroUeBox.xMin) * (macroUeBox.yMax - macroUeBox.yMin);
590  uint32_t nMacroUes = round(macroUeAreaSize * macroUeDensity);
591  NS_LOG_LOGIC("nMacroUes = " << nMacroUes << " (density=" << macroUeDensity << ")");
592 
593  NodeContainer homeEnbs;
594  homeEnbs.Create(nHomeEnbs);
595  NodeContainer macroEnbs;
596  macroEnbs.Create(3 * nMacroEnbSites);
597  NodeContainer homeUes;
598  homeUes.Create(nHomeUes);
599  NodeContainer macroUes;
600  macroUes.Create(nMacroUes);
601 
603  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
604 
605  Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
606  lteHelper->SetAttribute("PathlossModel",
607  StringValue("ns3::HybridBuildingsPropagationLossModel"));
608  lteHelper->SetPathlossModelAttribute("ShadowSigmaExtWalls", DoubleValue(0));
609  lteHelper->SetPathlossModelAttribute("ShadowSigmaOutdoor", DoubleValue(1));
610  lteHelper->SetPathlossModelAttribute("ShadowSigmaIndoor", DoubleValue(1.5));
611  // use always LOS model
612  lteHelper->SetPathlossModelAttribute("Los2NlosThr", DoubleValue(1e6));
613  lteHelper->SetSpectrumChannelType("ns3::MultiModelSpectrumChannel");
614 
615  // lteHelper->EnableLogComponents ();
616  // LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
617 
618  if (!fadingTrace.empty())
619  {
620  lteHelper->SetAttribute("FadingModel", StringValue("ns3::TraceFadingLossModel"));
621  lteHelper->SetFadingModelAttribute("TraceFilename", StringValue(fadingTrace));
622  }
623 
624  Ptr<PointToPointEpcHelper> epcHelper;
625  if (epc)
626  {
627  NS_LOG_LOGIC("enabling EPC");
628  epcHelper = CreateObject<PointToPointEpcHelper>();
629  lteHelper->SetEpcHelper(epcHelper);
630  }
631 
632  // Macro eNBs in 3-sector hex grid
633 
634  mobility.Install(macroEnbs);
635  BuildingsHelper::Install(macroEnbs);
636  Ptr<LteHexGridEnbTopologyHelper> lteHexGridEnbTopologyHelper =
637  CreateObject<LteHexGridEnbTopologyHelper>();
638  lteHexGridEnbTopologyHelper->SetLteHelper(lteHelper);
639  lteHexGridEnbTopologyHelper->SetAttribute("InterSiteDistance", DoubleValue(interSiteDistance));
640  lteHexGridEnbTopologyHelper->SetAttribute("MinX", DoubleValue(interSiteDistance / 2));
641  lteHexGridEnbTopologyHelper->SetAttribute("GridWidth", UintegerValue(nMacroEnbSitesX));
642  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(macroEnbTxPowerDbm));
643  lteHelper->SetEnbAntennaModelType("ns3::ParabolicAntennaModel");
644  lteHelper->SetEnbAntennaModelAttribute("Beamwidth", DoubleValue(70));
645  lteHelper->SetEnbAntennaModelAttribute("MaxAttenuation", DoubleValue(20.0));
646  lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(macroEnbDlEarfcn));
647  lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(macroEnbDlEarfcn + 18000));
648  lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(macroEnbBandwidth));
649  lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(macroEnbBandwidth));
650  NetDeviceContainer macroEnbDevs =
651  lteHexGridEnbTopologyHelper->SetPositionAndInstallEnbDevice(macroEnbs);
652 
653  if (epc)
654  {
655  // this enables handover for macro eNBs
656  lteHelper->AddX2Interface(macroEnbs);
657  }
658 
659  // HomeEnbs randomly indoor
660 
661  Ptr<PositionAllocator> positionAlloc = CreateObject<RandomRoomPositionAllocator>();
662  mobility.SetPositionAllocator(positionAlloc);
663  mobility.Install(homeEnbs);
664  BuildingsHelper::Install(homeEnbs);
665  Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(homeEnbTxPowerDbm));
666  lteHelper->SetEnbAntennaModelType("ns3::IsotropicAntennaModel");
667  lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(homeEnbDlEarfcn));
668  lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(homeEnbDlEarfcn + 18000));
669  lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(homeEnbBandwidth));
670  lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(homeEnbBandwidth));
671  lteHelper->SetEnbDeviceAttribute("CsgId", UintegerValue(1));
672  lteHelper->SetEnbDeviceAttribute("CsgIndication", BooleanValue(true));
673  NetDeviceContainer homeEnbDevs = lteHelper->InstallEnbDevice(homeEnbs);
674 
675  // home UEs located in the same apartment in which there are the Home eNBs
676  positionAlloc = CreateObject<SameRoomPositionAllocator>(homeEnbs);
677  mobility.SetPositionAllocator(positionAlloc);
678  mobility.Install(homeUes);
679  BuildingsHelper::Install(homeUes);
680  // set the home UE as a CSG member of the home eNodeBs
681  lteHelper->SetUeDeviceAttribute("CsgId", UintegerValue(1));
682  NetDeviceContainer homeUeDevs = lteHelper->InstallUeDevice(homeUes);
683 
684  // macro Ues
685  NS_LOG_LOGIC("randomly allocating macro UEs in " << macroUeBox << " speedMin "
686  << outdoorUeMinSpeed << " speedMax "
687  << outdoorUeMaxSpeed);
688  if (outdoorUeMaxSpeed != 0.0)
689  {
690  mobility.SetMobilityModel("ns3::SteadyStateRandomWaypointMobilityModel");
691 
692  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::MinX",
693  DoubleValue(macroUeBox.xMin));
694  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::MinY",
695  DoubleValue(macroUeBox.yMin));
696  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::MaxX",
697  DoubleValue(macroUeBox.xMax));
698  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::MaxY",
699  DoubleValue(macroUeBox.yMax));
700  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::Z", DoubleValue(ueZ));
701  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::MaxSpeed",
702  DoubleValue(outdoorUeMaxSpeed));
703  Config::SetDefault("ns3::SteadyStateRandomWaypointMobilityModel::MinSpeed",
704  DoubleValue(outdoorUeMinSpeed));
705 
706  // this is not used since SteadyStateRandomWaypointMobilityModel
707  // takes care of initializing the positions; however we need to
708  // reset it since the previously used PositionAllocator
709  // (SameRoom) will cause an error when used with homeDeploymentRatio=0
710  positionAlloc = CreateObject<RandomBoxPositionAllocator>();
711  mobility.SetPositionAllocator(positionAlloc);
712  mobility.Install(macroUes);
713 
714  // forcing initialization so we don't have to wait for Nodes to
715  // start before positions are assigned (which is needed to
716  // output node positions to file and to make AttachToClosestEnb work)
717  for (auto it = macroUes.Begin(); it != macroUes.End(); ++it)
718  {
719  (*it)->Initialize();
720  }
721  }
722  else
723  {
724  positionAlloc = CreateObject<RandomBoxPositionAllocator>();
725  Ptr<UniformRandomVariable> xVal = CreateObject<UniformRandomVariable>();
726  xVal->SetAttribute("Min", DoubleValue(macroUeBox.xMin));
727  xVal->SetAttribute("Max", DoubleValue(macroUeBox.xMax));
728  positionAlloc->SetAttribute("X", PointerValue(xVal));
729  Ptr<UniformRandomVariable> yVal = CreateObject<UniformRandomVariable>();
730  yVal->SetAttribute("Min", DoubleValue(macroUeBox.yMin));
731  yVal->SetAttribute("Max", DoubleValue(macroUeBox.yMax));
732  positionAlloc->SetAttribute("Y", PointerValue(yVal));
733  Ptr<UniformRandomVariable> zVal = CreateObject<UniformRandomVariable>();
734  zVal->SetAttribute("Min", DoubleValue(macroUeBox.zMin));
735  zVal->SetAttribute("Max", DoubleValue(macroUeBox.zMax));
736  positionAlloc->SetAttribute("Z", PointerValue(zVal));
737  mobility.SetPositionAllocator(positionAlloc);
738  mobility.Install(macroUes);
739  }
740  BuildingsHelper::Install(macroUes);
741 
742  NetDeviceContainer macroUeDevs = lteHelper->InstallUeDevice(macroUes);
743 
744  Ipv4Address remoteHostAddr;
745  NodeContainer ues;
746  Ipv4StaticRoutingHelper ipv4RoutingHelper;
747  Ipv4InterfaceContainer ueIpIfaces;
748  Ptr<Node> remoteHost;
749  NetDeviceContainer ueDevs;
750 
751  if (epc)
752  {
753  NS_LOG_LOGIC("setting up internet and remote host");
754 
755  // Create a single RemoteHost
756  NodeContainer remoteHostContainer;
757  remoteHostContainer.Create(1);
758  remoteHost = remoteHostContainer.Get(0);
760  internet.Install(remoteHostContainer);
761 
762  // Create the Internet
763  PointToPointHelper p2ph;
764  p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
765  p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
766  p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
767  Ptr<Node> pgw = epcHelper->GetPgwNode();
768  NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
769  Ipv4AddressHelper ipv4h;
770  ipv4h.SetBase("1.0.0.0", "255.0.0.0");
771  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
772  // in this container, interface 0 is the pgw, 1 is the remoteHost
773  remoteHostAddr = internetIpIfaces.GetAddress(1);
774 
775  Ipv4StaticRoutingHelper ipv4RoutingHelper;
776  Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
777  ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
778  remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"),
779  Ipv4Mask("255.0.0.0"),
780  1);
781 
782  // for internetworking purposes, consider together home UEs and macro UEs
783  ues.Add(homeUes);
784  ues.Add(macroUes);
785  ueDevs.Add(homeUeDevs);
786  ueDevs.Add(macroUeDevs);
787 
788  // Install the IP stack on the UEs
789  internet.Install(ues);
790  ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
791 
792  // attachment (needs to be done after IP stack configuration)
793  // using initial cell selection
794  lteHelper->Attach(macroUeDevs);
795  lteHelper->Attach(homeUeDevs);
796  }
797  else
798  {
799  // macro UEs attached to the closest macro eNB
800  lteHelper->AttachToClosestEnb(macroUeDevs, macroEnbDevs);
801 
802  // each home UE is attached explicitly to its home eNB
805  for (ueDevIt = homeUeDevs.Begin(), enbDevIt = homeEnbDevs.Begin();
806  ueDevIt != homeUeDevs.End();
807  ++ueDevIt, ++enbDevIt)
808  {
809  // this because of the order in which SameRoomPositionAllocator
810  // will place the UEs
811  if (enbDevIt == homeEnbDevs.End())
812  {
813  enbDevIt = homeEnbDevs.Begin();
814  }
815  lteHelper->Attach(*ueDevIt, *enbDevIt);
816  }
817  }
818 
819  if (epc)
820  {
821  NS_LOG_LOGIC("setting up applications");
822 
823  // Install and start applications on UEs and remote host
824  uint16_t dlPort = 10000;
825  uint16_t ulPort = 20000;
826 
827  // randomize a bit start times to avoid simulation artifacts
828  // (e.g., buffer overflows due to packet transmissions happening
829  // exactly at the same time)
830  Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable>();
831  if (useUdp)
832  {
833  startTimeSeconds->SetAttribute("Min", DoubleValue(0));
834  startTimeSeconds->SetAttribute("Max", DoubleValue(0.010));
835  }
836  else
837  {
838  // TCP needs to be started late enough so that all UEs are connected
839  // otherwise TCP SYN packets will get lost
840  startTimeSeconds->SetAttribute("Min", DoubleValue(0.100));
841  startTimeSeconds->SetAttribute("Max", DoubleValue(0.110));
842  }
843 
844  for (uint32_t u = 0; u < ues.GetN(); ++u)
845  {
846  Ptr<Node> ue = ues.Get(u);
847  // Set the default gateway for the UE
848  Ptr<Ipv4StaticRouting> ueStaticRouting =
849  ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
850  ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
851 
852  for (uint32_t b = 0; b < numBearersPerUe; ++b)
853  {
854  ++dlPort;
855  ++ulPort;
856 
859 
860  if (useUdp)
861  {
862  if (epcDl)
863  {
864  NS_LOG_LOGIC("installing UDP DL app for UE " << u);
865  UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
866  clientApps.Add(dlClientHelper.Install(remoteHost));
867  PacketSinkHelper dlPacketSinkHelper(
868  "ns3::UdpSocketFactory",
869  InetSocketAddress(Ipv4Address::GetAny(), dlPort));
870  serverApps.Add(dlPacketSinkHelper.Install(ue));
871  }
872  if (epcUl)
873  {
874  NS_LOG_LOGIC("installing UDP UL app for UE " << u);
875  UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
876  clientApps.Add(ulClientHelper.Install(ue));
877  PacketSinkHelper ulPacketSinkHelper(
878  "ns3::UdpSocketFactory",
879  InetSocketAddress(Ipv4Address::GetAny(), ulPort));
880  serverApps.Add(ulPacketSinkHelper.Install(remoteHost));
881  }
882  }
883  else // use TCP
884  {
885  if (epcDl)
886  {
887  NS_LOG_LOGIC("installing TCP DL app for UE " << u);
888  BulkSendHelper dlClientHelper(
889  "ns3::TcpSocketFactory",
890  InetSocketAddress(ueIpIfaces.GetAddress(u), dlPort));
891  dlClientHelper.SetAttribute("MaxBytes", UintegerValue(0));
892  clientApps.Add(dlClientHelper.Install(remoteHost));
893  PacketSinkHelper dlPacketSinkHelper(
894  "ns3::TcpSocketFactory",
895  InetSocketAddress(Ipv4Address::GetAny(), dlPort));
896  serverApps.Add(dlPacketSinkHelper.Install(ue));
897  }
898  if (epcUl)
899  {
900  NS_LOG_LOGIC("installing TCP UL app for UE " << u);
901  BulkSendHelper ulClientHelper("ns3::TcpSocketFactory",
902  InetSocketAddress(remoteHostAddr, ulPort));
903  ulClientHelper.SetAttribute("MaxBytes", UintegerValue(0));
904  clientApps.Add(ulClientHelper.Install(ue));
905  PacketSinkHelper ulPacketSinkHelper(
906  "ns3::TcpSocketFactory",
907  InetSocketAddress(Ipv4Address::GetAny(), ulPort));
908  serverApps.Add(ulPacketSinkHelper.Install(remoteHost));
909  }
910  } // end if (useUdp)
911 
912  Ptr<EpcTft> tft = Create<EpcTft>();
913  if (epcDl)
914  {
916  dlpf.localPortStart = dlPort;
917  dlpf.localPortEnd = dlPort;
918  tft->Add(dlpf);
919  }
920  if (epcUl)
921  {
923  ulpf.remotePortStart = ulPort;
924  ulpf.remotePortEnd = ulPort;
925  tft->Add(ulpf);
926  }
927 
928  if (epcDl || epcUl)
929  {
930  EpsBearer bearer(EpsBearer::NGBR_VIDEO_TCP_DEFAULT);
931  lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
932  }
933  Time startTime = Seconds(startTimeSeconds->GetValue());
934  serverApps.Start(startTime);
935  clientApps.Start(startTime);
936 
937  } // end for b
938  }
939  }
940  else // (epc == false)
941  {
942  // for radio bearer activation purposes, consider together home UEs and macro UEs
943  NetDeviceContainer ueDevs;
944  ueDevs.Add(homeUeDevs);
945  ueDevs.Add(macroUeDevs);
946  for (uint32_t u = 0; u < ueDevs.GetN(); ++u)
947  {
948  Ptr<NetDevice> ueDev = ueDevs.Get(u);
949  for (uint32_t b = 0; b < numBearersPerUe; ++b)
950  {
951  EpsBearer::Qci q = EpsBearer::NGBR_VIDEO_TCP_DEFAULT;
952  EpsBearer bearer(q);
953  lteHelper->ActivateDataRadioBearer(ueDev, bearer);
954  }
955  }
956  }
957 
959  if (generateRem)
960  {
961  PrintGnuplottableBuildingListToFile("buildings.txt");
962  PrintGnuplottableEnbListToFile("enbs.txt");
964 
965  remHelper = CreateObject<RadioEnvironmentMapHelper>();
966  remHelper->SetAttribute("Channel", PointerValue(lteHelper->GetDownlinkSpectrumChannel()));
967  remHelper->SetAttribute("OutputFile", StringValue("lena-dual-stripe.rem"));
968  remHelper->SetAttribute("XMin", DoubleValue(macroUeBox.xMin));
969  remHelper->SetAttribute("XMax", DoubleValue(macroUeBox.xMax));
970  remHelper->SetAttribute("YMin", DoubleValue(macroUeBox.yMin));
971  remHelper->SetAttribute("YMax", DoubleValue(macroUeBox.yMax));
972  remHelper->SetAttribute("Z", DoubleValue(1.5));
973 
974  if (remRbId >= 0)
975  {
976  remHelper->SetAttribute("UseDataChannel", BooleanValue(true));
977  remHelper->SetAttribute("RbId", IntegerValue(remRbId));
978  }
979 
980  remHelper->Install();
981  // simulation will stop right after the REM has been generated
982  }
983  else
984  {
985  Simulator::Stop(Seconds(simTime));
986  }
987 
988  lteHelper->EnableMacTraces();
989  lteHelper->EnableRlcTraces();
990  if (epc)
991  {
992  lteHelper->EnablePdcpTraces();
993  }
994 
995  Simulator::Run();
996 
997  // GtkConfigStore config;
998  // config.ConfigureAttributes ();
999 
1000  lteHelper = nullptr;
1001  Simulator::Destroy();
1002  return 0;
1003 }
Class that takes care of installing blocks of the buildings in a given area.
std::list< Box > m_previousBlocks
previous bocks
Ptr< UniformRandomVariable > m_xMinVar
X minimum variance.
Ptr< UniformRandomVariable > m_yMinVar
Y minimum variance.
uint32_t m_nApartmentsX
X apartments.
FemtocellBlockAllocator(Box area, uint32_t nApartmentsX, uint32_t nFloors)
Constructor.
uint32_t m_nFloors
number of floors
bool OverlapsWithAnyPrevious(Box box)
Function that checks if the box area is overlapping with some of previously created building blocks.
void Create()
Create function.
holds a vector of ns3::Application pointers.
bool Get() const
Definition: boolean.cc:55
a 3d box
Definition: box.h:35
double yMax
The y coordinate of the top bound of the box.
Definition: box.h:116
double xMin
The x coordinate of the left bound of the box.
Definition: box.h:110
double yMin
The y coordinate of the bottom bound of the box.
Definition: box.h:114
double xMax
The x coordinate of the right bound of the box.
Definition: box.h:112
double zMin
The z coordinate of the down bound of the box.
Definition: box.h:118
double zMax
The z coordinate of the up bound of the box.
Definition: box.h:120
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
Parse command-line arguments.
Definition: command-line.h:232
void ConfigureDefaults()
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
double Get() const
Definition: double.cc:37
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
Qci
QoS Class Indicator.
Definition: eps-bearer.h:106
Hold a so-called 'global value'.
Definition: global-value.h:76
an Inet address class
Hold a signed integer type.
Definition: integer.h:45
int64_t Get() const
Definition: integer.cc:37
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:80
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
The eNodeB device implementation.
uint16_t GetCellId() const
void SetEpcHelper(Ptr< EpcHelper > h)
Set the EpcHelper to be used to setup the EPC network in conjunction with the setup of the LTE radio ...
Definition: lte-helper.cc:285
Ptr< SpectrumChannel > GetDownlinkSpectrumChannel() const
Definition: lte-helper.cc:224
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:485
void EnablePdcpTraces()
Enable trace sinks for PDCP layer.
Definition: lte-helper.cc:1707
void SetEnbAntennaModelType(std::string type)
Set the type of antenna model to be used by eNodeB devices.
Definition: lte-helper.cc:419
void SetSpectrumChannelType(std::string type)
Set the type of spectrum channel to be used in both DL and UL.
Definition: lte-helper.cc:472
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
Definition: lte-helper.cc:1039
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:405
void EnableRlcTraces()
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1558
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB antenna model to be created.
Definition: lte-helper.cc:426
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:412
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1436
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:500
void EnableMacTraces()
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1659
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1313
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE devices (LteUeNetDevice) to be created.
Definition: lte-helper.cc:433
void SetFadingModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the fading model to be created (both DL and UL).
Definition: lte-helper.cc:466
void AttachToClosestEnb(NetDeviceContainer ueDevices, NetDeviceContainer enbDevices)
Manual attachment of a set of UE devices to the network via the closest eNodeB (with respect to dista...
Definition: lte-helper.cc:1122
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices.
Definition: lte-helper.cc:1154
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Ptr< Node > GetPgwNode() const override
Get the PGW node.
Ipv4Address GetUeDefaultGatewayAddress() override
Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices) override
Assign IPv4 addresses to UE devices.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t GetNDevices() const
Definition: node.cc:162
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:152
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:204
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Hold variables of type string.
Definition: string.h:56
std::string Get() const
Definition: string.cc:31
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Hold an unsigned integer type.
Definition: uinteger.h:45
uint64_t Get() const
Definition: uinteger.cc:37
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
Definition: vector.h:324
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:890
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:327
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition: ptr.h:442
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
static ns3::GlobalValue g_macroEnbTxPowerDbm("macroEnbTxPowerDbm", "TX power [dBm] used by macro eNBs", ns3::DoubleValue(46.0), ns3::MakeDoubleChecker< double >())
TX power [dBm] used by macro eNBs.
static ns3::GlobalValue g_nMacroEnbSites("nMacroEnbSites", "How many macro sites there are", ns3::UintegerValue(3), ns3::MakeUintegerChecker< uint32_t >())
How many macro sites there are.
bool AreOverlapping(Box a, Box b)
Check if two boxes are overlapping.
static ns3::GlobalValue g_generateRem("generateRem", "if true, will generate a REM and then abort the simulation;" "if false, will run the simulation normally (without generating any REM)", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
If true, will generate a REM and then abort the simulation.
static ns3::GlobalValue g_homeEnbDeploymentRatio("homeEnbDeploymentRatio", "The HeNB deployment ratio as per 3GPP R4-092042", ns3::DoubleValue(0.2), ns3::MakeDoubleChecker< double >())
The HeNB deployment ratio as per 3GPP R4-092042.
static ns3::GlobalValue g_srsPeriodicity("srsPeriodicity", "SRS Periodicity (has to be at least " "greater than the number of UEs per eNB)", ns3::UintegerValue(80), ns3::MakeUintegerChecker< uint16_t >())
SRS Periodicity (has to be at least greater than the number of UEs per eNB)
static ns3::GlobalValue g_fadingTrace("fadingTrace", "The path of the fading trace (by default no fading trace " "is loaded, i.e., fading is not considered)", ns3::StringValue(""), ns3::MakeStringChecker())
The path of the fading trace (by default no fading trace is loaded, i.e., fading is not considered)
static ns3::GlobalValue g_outdoorUeMaxSpeed("outdoorUeMaxSpeed", "Maximum speed value of macro UE with random waypoint model [m/s].", ns3::DoubleValue(0.0), ns3::MakeDoubleChecker< double >())
Maximum speed value of macro UE with random waypoint model [m/s].
static ns3::GlobalValue g_macroUeDensity("macroUeDensity", "How many macrocell UEs there are per square meter", ns3::DoubleValue(0.00002), ns3::MakeDoubleChecker< double >())
How many macrocell UEs there are per square meter.
static ns3::GlobalValue g_homeEnbTxPowerDbm("homeEnbTxPowerDbm", "TX power [dBm] used by HeNBs", ns3::DoubleValue(20.0), ns3::MakeDoubleChecker< double >())
TX power [dBm] used by HeNBs.
static ns3::GlobalValue g_homeEnbBandwidth("homeEnbBandwidth", "bandwidth [num RBs] used by HeNBs", ns3::UintegerValue(25), ns3::MakeUintegerChecker< uint16_t >())
Bandwidth [num RBs] used by HeNBs.
static ns3::GlobalValue g_simTime("simTime", "Total duration of the simulation [s]", ns3::DoubleValue(0.25), ns3::MakeDoubleChecker< double >())
Total duration of the simulation [s].
static ns3::GlobalValue g_outdoorUeMinSpeed("outdoorUeMinSpeed", "Minimum speed value of macro UE with random waypoint model [m/s].", ns3::DoubleValue(0.0), ns3::MakeDoubleChecker< double >())
Minimum speed value of macro UE with random waypoint model [m/s].
static ns3::GlobalValue g_homeEnbDlEarfcn("homeEnbDlEarfcn", "DL EARFCN used by HeNBs", ns3::UintegerValue(100), ns3::MakeUintegerChecker< uint16_t >())
DL EARFCN used by HeNBs.
static ns3::GlobalValue g_nApartmentsX("nApartmentsX", "Number of apartments along the X axis in a femtocell block", ns3::UintegerValue(10), ns3::MakeUintegerChecker< uint32_t >())
Number of apartments along the X axis in a femtocell block.
void PrintGnuplottableEnbListToFile(std::string filename)
Print a list of ENBs that can be plotted using Gnuplot.
static ns3::GlobalValue g_homeEnbActivationRatio("homeEnbActivationRatio", "The HeNB activation ratio as per 3GPP R4-092042", ns3::DoubleValue(0.5), ns3::MakeDoubleChecker< double >())
The HeNB activation ratio as per 3GPP R4-092042.
static ns3::GlobalValue g_nMacroEnbSitesX("nMacroEnbSitesX", "(minimum) number of sites along the X-axis of the hex grid", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
(minimum) number of sites along the X-axis of the hex grid
static ns3::GlobalValue g_nFloors("nFloors", "Number of floors", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
Number of floors.
void PrintGnuplottableBuildingListToFile(std::string filename)
Print a list of buildings that can be plotted using Gnuplot.
static ns3::GlobalValue g_macroEnbBandwidth("macroEnbBandwidth", "bandwidth [num RBs] used by macro eNBs", ns3::UintegerValue(25), ns3::MakeUintegerChecker< uint16_t >())
Bandwidth [num RBs] used by macro eNBs.
static ns3::GlobalValue g_remRbId("remRbId", "Resource Block Id of Data Channel, for which REM will be generated;" "default value is -1, what means REM will be averaged from all RBs of " "Control Channel", ns3::IntegerValue(-1), MakeIntegerChecker< int32_t >())
Resource Block Id of Data Channel, for which REM will be generated.
static ns3::GlobalValue g_epcDl("epcDl", "if true, will activate data flows in the downlink when EPC is being used. " "If false, downlink flows won't be activated. " "If EPC is not used, this parameter will be ignored.", ns3::BooleanValue(true), ns3::MakeBooleanChecker())
if true, will activate data flows in the downlink when EPC is being used.
static ns3::GlobalValue g_homeUesHomeEnbRatio("homeUesHomeEnbRatio", "How many (on average) home UEs per HeNB there are in the simulation", ns3::DoubleValue(1.0), ns3::MakeDoubleChecker< double >())
How many (on average) home UEs per HeNB there are in the simulation.
static ns3::GlobalValue g_nBlocks("nBlocks", "Number of femtocell blocks", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
Number of femtocell blocks.
static ns3::GlobalValue g_useUdp("useUdp", "if true, the UdpClient application will be used. " "Otherwise, the BulkSend application will be used over a TCP connection. " "If EPC is not used, this parameter will be ignored.", ns3::BooleanValue(true), ns3::MakeBooleanChecker())
if true, the UdpClient application will be used.
static ns3::GlobalValue g_numBearersPerUe("numBearersPerUe", "How many bearers per UE there are in the simulation", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint16_t >())
How many bearers per UE there are in the simulation.
static ns3::GlobalValue g_epc("epc", "If true, will setup the EPC to simulate an end-to-end topology, " "with real IP applications over PDCP and RLC UM (or RLC AM by changing " "the default value of EpsBearerToRlcMapping e.g. to RLC_AM_ALWAYS). " "If false, only the LTE radio access will be simulated with RLC SM.", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
If true, will setup the EPC to simulate an end-to-end topology.
static ns3::GlobalValue g_areaMarginFactor("areaMarginFactor", "how much the UE area extends outside the macrocell grid, " "expressed as fraction of the interSiteDistance", ns3::DoubleValue(0.5), ns3::MakeDoubleChecker< double >())
how much the UE area extends outside the macrocell grid, expressed as fraction of the interSiteDistan...
void PrintGnuplottableUeListToFile(std::string filename)
Print a list of UEs that can be plotted using Gnuplot.
static ns3::GlobalValue g_interSiteDistance("interSiteDistance", "min distance between two nearby macro cell sites", ns3::DoubleValue(500), ns3::MakeDoubleChecker< double >())
min distance between two nearby macro cell sites
static ns3::GlobalValue g_epcUl("epcUl", "if true, will activate data flows in the uplink when EPC is being used. " "If false, uplink flows won't be activated. " "If EPC is not used, this parameter will be ignored.", ns3::BooleanValue(true), ns3::MakeBooleanChecker())
if true, will activate data flows in the uplink when EPC is being used.
static ns3::GlobalValue g_macroEnbDlEarfcn("macroEnbDlEarfcn", "DL EARFCN used by macro eNBs", ns3::UintegerValue(100), ns3::MakeUintegerChecker< uint16_t >())
DL EARFCN used by macro eNBs.
serverApps
Definition: first.py:54
clientApps
Definition: first.py:64
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeChecker > MakeStringChecker()
Definition: string.cc:30
cmd
Definition: second.py:40
mobility
Definition: third.py:105
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:71
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:132
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:130
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:129
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:131