A Discrete-Event Network Simulator
API
lena-dual-stripe.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2012 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: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #include <ns3/core-module.h>
22 #include <ns3/network-module.h>
23 #include <ns3/mobility-module.h>
24 #include <ns3/internet-module.h>
25 #include <ns3/lte-module.h>
26 #include <ns3/config-store-module.h>
27 #include <ns3/buildings-module.h>
28 #include <ns3/point-to-point-helper.h>
29 #include <ns3/applications-module.h>
30 #include <ns3/log.h>
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 
45 bool AreOverlapping (Box a, Box b)
46 {
47  return !((a.xMin > b.xMax) || (b.xMin > a.xMax) || (a.yMin > b.yMax) || (b.yMin > a.yMax));
48 }
49 
51 {
52 public:
53  FemtocellBlockAllocator (Box area, uint32_t nApartmentsX, uint32_t nFloors);
54  void Create (uint32_t n);
55  void Create ();
56 
57 private:
58  bool OverlapsWithAnyPrevious (Box);
60  uint32_t m_nApartmentsX;
61  uint32_t m_nFloors;
62  std::list<Box> m_previousBlocks;
63  double m_xSize;
64  double m_ySize;
67 
68 };
69 
70 FemtocellBlockAllocator::FemtocellBlockAllocator (Box area, uint32_t nApartmentsX, uint32_t nFloors)
71  : m_area (area),
72  m_nApartmentsX (nApartmentsX),
73  m_nFloors (nFloors),
74  m_xSize (nApartmentsX*10 + 20),
75  m_ySize (70)
76 {
77  m_xMinVar = CreateObject<UniformRandomVariable> ();
78  m_xMinVar->SetAttribute ("Min", DoubleValue (area.xMin));
79  m_xMinVar->SetAttribute ("Max", DoubleValue (area.xMax - m_xSize));
80  m_yMinVar = CreateObject<UniformRandomVariable> ();
81  m_yMinVar->SetAttribute ("Min", DoubleValue (area.yMin));
82  m_yMinVar->SetAttribute ("Max", DoubleValue (area.yMax - m_ySize));
83 }
84 
85 void
87 {
88  for (uint32_t i = 0; i < n; ++i)
89  {
90  Create ();
91  }
92 }
93 
94 void
96 {
97  Box box;
98  uint32_t attempt = 0;
99  do
100  {
101  NS_ASSERT_MSG (attempt < 100, "Too many failed attemtps to position apartment block. Too many blocks? Too small area?");
102  box.xMin = m_xMinVar->GetValue ();
103  box.xMax = box.xMin + m_xSize;
104  box.yMin = m_yMinVar->GetValue ();
105  box.yMax = box.yMin + m_ySize;
106  ++attempt;
107  }
108  while (OverlapsWithAnyPrevious (box));
109 
110  NS_LOG_LOGIC ("allocated non overlapping block " << box);
111  m_previousBlocks.push_back (box);
112  Ptr<GridBuildingAllocator> gridBuildingAllocator;
113  gridBuildingAllocator = CreateObject<GridBuildingAllocator> ();
114  gridBuildingAllocator->SetAttribute ("GridWidth", UintegerValue (1));
115  gridBuildingAllocator->SetAttribute ("LengthX", DoubleValue (10*m_nApartmentsX));
116  gridBuildingAllocator->SetAttribute ("LengthY", DoubleValue (10*2));
117  gridBuildingAllocator->SetAttribute ("DeltaX", DoubleValue (10));
118  gridBuildingAllocator->SetAttribute ("DeltaY", DoubleValue (10));
119  gridBuildingAllocator->SetAttribute ("Height", DoubleValue (3*m_nFloors));
120  gridBuildingAllocator->SetBuildingAttribute ("NRoomsX", UintegerValue (m_nApartmentsX));
121  gridBuildingAllocator->SetBuildingAttribute ("NRoomsY", UintegerValue (2));
122  gridBuildingAllocator->SetBuildingAttribute ("NFloors", UintegerValue (m_nFloors));
123  gridBuildingAllocator->SetAttribute ("MinX", DoubleValue (box.xMin + 10));
124  gridBuildingAllocator->SetAttribute ("MinY", DoubleValue (box.yMin + 10));
125  gridBuildingAllocator->Create (2);
126 }
127 
128 bool
130 {
131  for (std::list<Box>::iterator it = m_previousBlocks.begin (); it != m_previousBlocks.end (); ++it)
132  {
133  if (AreOverlapping (*it, box))
134  {
135  return true;
136  }
137  }
138  return false;
139 }
140 
141 void
143 {
144  std::ofstream outFile;
145  outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
146  if (!outFile.is_open ())
147  {
148  NS_LOG_ERROR ("Can't open file " << filename);
149  return;
150  }
151  uint32_t index = 0;
152  for (BuildingList::Iterator it = BuildingList::Begin (); it != BuildingList::End (); ++it)
153  {
154  ++index;
155  Box box = (*it)->GetBoundaries ();
156  outFile << "set object " << index
157  << " rect from " << box.xMin << "," << box.yMin
158  << " to " << box.xMax << "," << box.yMax
159  << " front fs empty "
160  << std::endl;
161  }
162 }
163 
164 void
165 PrintGnuplottableUeListToFile (std::string filename)
166 {
167  std::ofstream outFile;
168  outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
169  if (!outFile.is_open ())
170  {
171  NS_LOG_ERROR ("Can't open file " << filename);
172  return;
173  }
174  for (NodeList::Iterator it = NodeList::Begin (); it != NodeList::End (); ++it)
175  {
176  Ptr<Node> node = *it;
177  int nDevs = node->GetNDevices ();
178  for (int j = 0; j < nDevs; j++)
179  {
180  Ptr<LteUeNetDevice> uedev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
181  if (uedev)
182  {
183  Vector pos = node->GetObject<MobilityModel> ()->GetPosition ();
184  outFile << "set label \"" << uedev->GetImsi ()
185  << "\" at "<< pos.x << "," << pos.y << " left font \"Helvetica,4\" textcolor rgb \"grey\" front point pt 1 ps 0.3 lc rgb \"grey\" offset 0,0"
186  << std::endl;
187  }
188  }
189  }
190 }
191 
192 void
193 PrintGnuplottableEnbListToFile (std::string filename)
194 {
195  std::ofstream outFile;
196  outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
197  if (!outFile.is_open ())
198  {
199  NS_LOG_ERROR ("Can't open file " << filename);
200  return;
201  }
202  for (NodeList::Iterator it = NodeList::Begin (); it != NodeList::End (); ++it)
203  {
204  Ptr<Node> node = *it;
205  int nDevs = node->GetNDevices ();
206  for (int j = 0; j < nDevs; j++)
207  {
208  Ptr<LteEnbNetDevice> enbdev = node->GetDevice (j)->GetObject <LteEnbNetDevice> ();
209  if (enbdev)
210  {
211  Vector pos = node->GetObject<MobilityModel> ()->GetPosition ();
212  outFile << "set label \"" << enbdev->GetCellId ()
213  << "\" at "<< pos.x << "," << pos.y
214  << " left font \"Helvetica,4\" textcolor rgb \"white\" front point pt 2 ps 0.3 lc rgb \"white\" offset 0,0"
215  << std::endl;
216  }
217  }
218  }
219 }
220 
221 
222 static ns3::GlobalValue g_nBlocks ("nBlocks",
223  "Number of femtocell blocks",
224  ns3::UintegerValue (1),
225  ns3::MakeUintegerChecker<uint32_t> ());
226 static ns3::GlobalValue g_nApartmentsX ("nApartmentsX",
227  "Number of apartments along the X axis in a femtocell block",
228  ns3::UintegerValue (10),
229  ns3::MakeUintegerChecker<uint32_t> ());
230 static ns3::GlobalValue g_nFloors ("nFloors",
231  "Number of floors",
232  ns3::UintegerValue (1),
233  ns3::MakeUintegerChecker<uint32_t> ());
234 static ns3::GlobalValue g_nMacroEnbSites ("nMacroEnbSites",
235  "How many macro sites there are",
236  ns3::UintegerValue (3),
237  ns3::MakeUintegerChecker<uint32_t> ());
238 static ns3::GlobalValue g_nMacroEnbSitesX ("nMacroEnbSitesX",
239  "(minimum) number of sites along the X-axis of the hex grid",
240  ns3::UintegerValue (1),
241  ns3::MakeUintegerChecker<uint32_t> ());
242 static ns3::GlobalValue g_interSiteDistance ("interSiteDistance",
243  "min distance between two nearby macro cell sites",
244  ns3::DoubleValue (500),
245  ns3::MakeDoubleChecker<double> ());
246 static ns3::GlobalValue g_areaMarginFactor ("areaMarginFactor",
247  "how much the UE area extends outside the macrocell grid, "
248  "expressed as fraction of the interSiteDistance",
249  ns3::DoubleValue (0.5),
250  ns3::MakeDoubleChecker<double> ());
251 static ns3::GlobalValue g_macroUeDensity ("macroUeDensity",
252  "How many macrocell UEs there are per square meter",
253  ns3::DoubleValue (0.00002),
254  ns3::MakeDoubleChecker<double> ());
255 static ns3::GlobalValue g_homeEnbDeploymentRatio ("homeEnbDeploymentRatio",
256  "The HeNB deployment ratio as per 3GPP R4-092042",
257  ns3::DoubleValue (0.2),
258  ns3::MakeDoubleChecker<double> ());
259 static ns3::GlobalValue g_homeEnbActivationRatio ("homeEnbActivationRatio",
260  "The HeNB activation ratio as per 3GPP R4-092042",
261  ns3::DoubleValue (0.5),
262  ns3::MakeDoubleChecker<double> ());
263 static ns3::GlobalValue g_homeUesHomeEnbRatio ("homeUesHomeEnbRatio",
264  "How many (on average) home UEs per HeNB there are in the simulation",
265  ns3::DoubleValue (1.0),
266  ns3::MakeDoubleChecker<double> ());
267 static ns3::GlobalValue g_macroEnbTxPowerDbm ("macroEnbTxPowerDbm",
268  "TX power [dBm] used by macro eNBs",
269  ns3::DoubleValue (46.0),
270  ns3::MakeDoubleChecker<double> ());
271 static ns3::GlobalValue g_homeEnbTxPowerDbm ("homeEnbTxPowerDbm",
272  "TX power [dBm] used by HeNBs",
273  ns3::DoubleValue (20.0),
274  ns3::MakeDoubleChecker<double> ());
275 static ns3::GlobalValue g_macroEnbDlEarfcn ("macroEnbDlEarfcn",
276  "DL EARFCN used by macro eNBs",
277  ns3::UintegerValue (100),
278  ns3::MakeUintegerChecker<uint16_t> ());
279 static ns3::GlobalValue g_homeEnbDlEarfcn ("homeEnbDlEarfcn",
280  "DL EARFCN used by HeNBs",
281  ns3::UintegerValue (100),
282  ns3::MakeUintegerChecker<uint16_t> ());
283 static ns3::GlobalValue g_macroEnbBandwidth ("macroEnbBandwidth",
284  "bandwidth [num RBs] used by macro eNBs",
285  ns3::UintegerValue (25),
286  ns3::MakeUintegerChecker<uint16_t> ());
287 static ns3::GlobalValue g_homeEnbBandwidth ("homeEnbBandwidth",
288  "bandwidth [num RBs] used by HeNBs",
289  ns3::UintegerValue (25),
290  ns3::MakeUintegerChecker<uint16_t> ());
291 static ns3::GlobalValue g_simTime ("simTime",
292  "Total duration of the simulation [s]",
293  ns3::DoubleValue (0.25),
294  ns3::MakeDoubleChecker<double> ());
295 static ns3::GlobalValue g_generateRem ("generateRem",
296  "if true, will generate a REM and then abort the simulation;"
297  "if false, will run the simulation normally (without generating any REM)",
298  ns3::BooleanValue (false),
300 static ns3::GlobalValue g_remRbId ("remRbId",
301  "Resource Block Id of Data Channel, for which REM will be generated;"
302  "default value is -1, what means REM will be averaged from all RBs of "
303  "Control Channel",
304  ns3::IntegerValue (-1),
305  MakeIntegerChecker<int32_t> ());
306 static ns3::GlobalValue g_epc ("epc",
307  "If true, will setup the EPC to simulate an end-to-end topology, "
308  "with real IP applications over PDCP and RLC UM (or RLC AM by changing "
309  "the default value of EpsBearerToRlcMapping e.g. to RLC_AM_ALWAYS). "
310  "If false, only the LTE radio access will be simulated with RLC SM. ",
311  ns3::BooleanValue (false),
313 static ns3::GlobalValue g_epcDl ("epcDl",
314  "if true, will activate data flows in the downlink when EPC is being used. "
315  "If false, downlink flows won't be activated. "
316  "If EPC is not used, this parameter will be ignored.",
317  ns3::BooleanValue (true),
319 static ns3::GlobalValue g_epcUl ("epcUl",
320  "if true, will activate data flows in the uplink when EPC is being used. "
321  "If false, uplink flows won't be activated. "
322  "If EPC is not used, this parameter will be ignored.",
323  ns3::BooleanValue (true),
325 static ns3::GlobalValue g_useUdp ("useUdp",
326  "if true, the UdpClient application will be used. "
327  "Otherwise, the BulkSend application will be used over a TCP connection. "
328  "If EPC is not used, this parameter will be ignored.",
329  ns3::BooleanValue (true),
331 static ns3::GlobalValue g_fadingTrace ("fadingTrace",
332  "The path of the fading trace (by default no fading trace "
333  "is loaded, i.e., fading is not considered)",
334  ns3::StringValue (""),
336 static ns3::GlobalValue g_numBearersPerUe ("numBearersPerUe",
337  "How many bearers per UE there are in the simulation",
338  ns3::UintegerValue (1),
339  ns3::MakeUintegerChecker<uint16_t> ());
340 static ns3::GlobalValue g_srsPeriodicity ("srsPeriodicity",
341  "SRS Periodicity (has to be at least "
342  "greater than the number of UEs per eNB)",
343  ns3::UintegerValue (80),
344  ns3::MakeUintegerChecker<uint16_t> ());
345 static ns3::GlobalValue g_outdoorUeMinSpeed ("outdoorUeMinSpeed",
346  "Minimum speed value of macor UE with random waypoint model [m/s].",
347  ns3::DoubleValue (0.0),
348  ns3::MakeDoubleChecker<double> ());
349 static ns3::GlobalValue g_outdoorUeMaxSpeed ("outdoorUeMaxSpeed",
350  "Maximum speed value of macor UE with random waypoint model [m/s].",
351  ns3::DoubleValue (0.0),
352  ns3::MakeDoubleChecker<double> ());
353 
354 int
355 main (int argc, char *argv[])
356 {
357  // change some default attributes so that they are reasonable for
358  // this scenario, but do this before processing command line
359  // arguments, so that the user is allowed to override these settings
360  Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds (1)));
361  Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue (1000000));
362  Config::SetDefault ("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue (10 * 1024));
363 
365  cmd.Parse (argc, argv);
366  ConfigStore inputConfig;
367  inputConfig.ConfigureDefaults ();
368  // parse again so you can override input file default values via command line
369  cmd.Parse (argc, argv);
370 
371  // the scenario parameters get their values from the global attributes defined above
372  UintegerValue uintegerValue;
373  IntegerValue integerValue;
374  DoubleValue doubleValue;
375  BooleanValue booleanValue;
376  StringValue stringValue;
377  GlobalValue::GetValueByName ("nBlocks", uintegerValue);
378  uint32_t nBlocks = uintegerValue.Get ();
379  GlobalValue::GetValueByName ("nApartmentsX", uintegerValue);
380  uint32_t nApartmentsX = uintegerValue.Get ();
381  GlobalValue::GetValueByName ("nFloors", uintegerValue);
382  uint32_t nFloors = uintegerValue.Get ();
383  GlobalValue::GetValueByName ("nMacroEnbSites", uintegerValue);
384  uint32_t nMacroEnbSites = uintegerValue.Get ();
385  GlobalValue::GetValueByName ("nMacroEnbSitesX", uintegerValue);
386  uint32_t nMacroEnbSitesX = uintegerValue.Get ();
387  GlobalValue::GetValueByName ("interSiteDistance", doubleValue);
388  double interSiteDistance = doubleValue.Get ();
389  GlobalValue::GetValueByName ("areaMarginFactor", doubleValue);
390  double areaMarginFactor = doubleValue.Get ();
391  GlobalValue::GetValueByName ("macroUeDensity", doubleValue);
392  double macroUeDensity = doubleValue.Get ();
393  GlobalValue::GetValueByName ("homeEnbDeploymentRatio", doubleValue);
394  double homeEnbDeploymentRatio = doubleValue.Get ();
395  GlobalValue::GetValueByName ("homeEnbActivationRatio", doubleValue);
396  double homeEnbActivationRatio = doubleValue.Get ();
397  GlobalValue::GetValueByName ("homeUesHomeEnbRatio", doubleValue);
398  double homeUesHomeEnbRatio = doubleValue.Get ();
399  GlobalValue::GetValueByName ("macroEnbTxPowerDbm", doubleValue);
400  double macroEnbTxPowerDbm = doubleValue.Get ();
401  GlobalValue::GetValueByName ("homeEnbTxPowerDbm", doubleValue);
402  double homeEnbTxPowerDbm = doubleValue.Get ();
403  GlobalValue::GetValueByName ("macroEnbDlEarfcn", uintegerValue);
404  uint16_t macroEnbDlEarfcn = uintegerValue.Get ();
405  GlobalValue::GetValueByName ("homeEnbDlEarfcn", uintegerValue);
406  uint16_t homeEnbDlEarfcn = uintegerValue.Get ();
407  GlobalValue::GetValueByName ("macroEnbBandwidth", uintegerValue);
408  uint16_t macroEnbBandwidth = uintegerValue.Get ();
409  GlobalValue::GetValueByName ("homeEnbBandwidth", uintegerValue);
410  uint16_t homeEnbBandwidth = uintegerValue.Get ();
411  GlobalValue::GetValueByName ("simTime", doubleValue);
412  double simTime = doubleValue.Get ();
413  GlobalValue::GetValueByName ("epc", booleanValue);
414  bool epc = booleanValue.Get ();
415  GlobalValue::GetValueByName ("epcDl", booleanValue);
416  bool epcDl = booleanValue.Get ();
417  GlobalValue::GetValueByName ("epcUl", booleanValue);
418  bool epcUl = booleanValue.Get ();
419  GlobalValue::GetValueByName ("useUdp", booleanValue);
420  bool useUdp = booleanValue.Get ();
421  GlobalValue::GetValueByName ("generateRem", booleanValue);
422  bool generateRem = booleanValue.Get ();
423  GlobalValue::GetValueByName ("remRbId", integerValue);
424  int32_t remRbId = integerValue.Get ();
425  GlobalValue::GetValueByName ("fadingTrace", stringValue);
426  std::string fadingTrace = stringValue.Get ();
427  GlobalValue::GetValueByName ("numBearersPerUe", uintegerValue);
428  uint16_t numBearersPerUe = uintegerValue.Get ();
429  GlobalValue::GetValueByName ("srsPeriodicity", uintegerValue);
430  uint16_t srsPeriodicity = uintegerValue.Get ();
431  GlobalValue::GetValueByName ("outdoorUeMinSpeed", doubleValue);
432  uint16_t outdoorUeMinSpeed = doubleValue.Get ();
433  GlobalValue::GetValueByName ("outdoorUeMaxSpeed", doubleValue);
434  uint16_t outdoorUeMaxSpeed = doubleValue.Get ();
435 
436  Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (srsPeriodicity));
437 
438  Box macroUeBox;
439  double ueZ = 1.5;
440  if (nMacroEnbSites > 0)
441  {
442  uint32_t currentSite = nMacroEnbSites -1;
443  uint32_t biRowIndex = (currentSite / (nMacroEnbSitesX + nMacroEnbSitesX + 1));
444  uint32_t biRowRemainder = currentSite % (nMacroEnbSitesX + nMacroEnbSitesX + 1);
445  uint32_t rowIndex = biRowIndex*2 + 1;
446  if (biRowRemainder >= nMacroEnbSitesX)
447  {
448  ++rowIndex;
449  }
450  uint32_t nMacroEnbSitesY = rowIndex;
451  NS_LOG_LOGIC ("nMacroEnbSitesY = " << nMacroEnbSitesY);
452 
453  macroUeBox = Box (-areaMarginFactor*interSiteDistance,
454  (nMacroEnbSitesX + areaMarginFactor)*interSiteDistance,
455  -areaMarginFactor*interSiteDistance,
456  (nMacroEnbSitesY -1)*interSiteDistance*sqrt (0.75) + areaMarginFactor*interSiteDistance,
457  ueZ, ueZ);
458  }
459  else
460  {
461  // still need the box to place femtocell blocks
462  macroUeBox = Box (0, 150, 0, 150, ueZ, ueZ);
463  }
464 
465  FemtocellBlockAllocator blockAllocator (macroUeBox, nApartmentsX, nFloors);
466  blockAllocator.Create (nBlocks);
467 
468 
469  uint32_t nHomeEnbs = round (4 * nApartmentsX * nBlocks * nFloors * homeEnbDeploymentRatio * homeEnbActivationRatio);
470  NS_LOG_LOGIC ("nHomeEnbs = " << nHomeEnbs);
471  uint32_t nHomeUes = round (nHomeEnbs * homeUesHomeEnbRatio);
472  NS_LOG_LOGIC ("nHomeUes = " << nHomeUes);
473  double macroUeAreaSize = (macroUeBox.xMax - macroUeBox.xMin) * (macroUeBox.yMax - macroUeBox.yMin);
474  uint32_t nMacroUes = round (macroUeAreaSize * macroUeDensity);
475  NS_LOG_LOGIC ("nMacroUes = " << nMacroUes << " (density=" << macroUeDensity << ")");
476 
477  NodeContainer homeEnbs;
478  homeEnbs.Create (nHomeEnbs);
479  NodeContainer macroEnbs;
480  macroEnbs.Create (3 * nMacroEnbSites);
481  NodeContainer homeUes;
482  homeUes.Create (nHomeUes);
483  NodeContainer macroUes;
484  macroUes.Create (nMacroUes);
485 
487  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
488 
489 
490  Ptr <LteHelper> lteHelper = CreateObject<LteHelper> ();
491  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::HybridBuildingsPropagationLossModel"));
492  lteHelper->SetPathlossModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0));
493  lteHelper->SetPathlossModelAttribute ("ShadowSigmaOutdoor", DoubleValue (1));
494  lteHelper->SetPathlossModelAttribute ("ShadowSigmaIndoor", DoubleValue (1.5));
495  // use always LOS model
496  lteHelper->SetPathlossModelAttribute ("Los2NlosThr", DoubleValue (1e6));
497  lteHelper->SetSpectrumChannelType ("ns3::MultiModelSpectrumChannel");
498 
499 // lteHelper->EnableLogComponents ();
500 // LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
501 
502  if (!fadingTrace.empty ())
503  {
504  lteHelper->SetAttribute ("FadingModel", StringValue ("ns3::TraceFadingLossModel"));
505  lteHelper->SetFadingModelAttribute ("TraceFilename", StringValue (fadingTrace));
506  }
507 
508  Ptr<PointToPointEpcHelper> epcHelper;
509  if (epc)
510  {
511  NS_LOG_LOGIC ("enabling EPC");
512  epcHelper = CreateObject<PointToPointEpcHelper> ();
513  lteHelper->SetEpcHelper (epcHelper);
514  }
515 
516  // Macro eNBs in 3-sector hex grid
517 
518  mobility.Install (macroEnbs);
519  BuildingsHelper::Install (macroEnbs);
520  Ptr<LteHexGridEnbTopologyHelper> lteHexGridEnbTopologyHelper = CreateObject<LteHexGridEnbTopologyHelper> ();
521  lteHexGridEnbTopologyHelper->SetLteHelper (lteHelper);
522  lteHexGridEnbTopologyHelper->SetAttribute ("InterSiteDistance", DoubleValue (interSiteDistance));
523  lteHexGridEnbTopologyHelper->SetAttribute ("MinX", DoubleValue (interSiteDistance/2));
524  lteHexGridEnbTopologyHelper->SetAttribute ("GridWidth", UintegerValue (nMacroEnbSitesX));
525  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (macroEnbTxPowerDbm));
526  lteHelper->SetEnbAntennaModelType ("ns3::ParabolicAntennaModel");
527  lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (70));
528  lteHelper->SetEnbAntennaModelAttribute ("MaxAttenuation", DoubleValue (20.0));
529  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (macroEnbDlEarfcn));
530  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (macroEnbDlEarfcn + 18000));
531  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (macroEnbBandwidth));
532  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (macroEnbBandwidth));
533  NetDeviceContainer macroEnbDevs = lteHexGridEnbTopologyHelper->SetPositionAndInstallEnbDevice (macroEnbs);
534 
535  if (epc)
536  {
537  // this enables handover for macro eNBs
538  lteHelper->AddX2Interface (macroEnbs);
539  }
540 
541  // HomeEnbs randomly indoor
542 
543  Ptr<PositionAllocator> positionAlloc = CreateObject<RandomRoomPositionAllocator> ();
544  mobility.SetPositionAllocator (positionAlloc);
545  mobility.Install (homeEnbs);
546  BuildingsHelper::Install (homeEnbs);
547  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (homeEnbTxPowerDbm));
548  lteHelper->SetEnbAntennaModelType ("ns3::IsotropicAntennaModel");
549  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (homeEnbDlEarfcn));
550  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (homeEnbDlEarfcn + 18000));
551  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (homeEnbBandwidth));
552  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (homeEnbBandwidth));
553  lteHelper->SetEnbDeviceAttribute ("CsgId", UintegerValue (1));
554  lteHelper->SetEnbDeviceAttribute ("CsgIndication", BooleanValue (true));
555  NetDeviceContainer homeEnbDevs = lteHelper->InstallEnbDevice (homeEnbs);
556 
557  // home UEs located in the same apartment in which there are the Home eNBs
558  positionAlloc = CreateObject<SameRoomPositionAllocator> (homeEnbs);
559  mobility.SetPositionAllocator (positionAlloc);
560  mobility.Install (homeUes);
561  BuildingsHelper::Install (homeUes);
562  // set the home UE as a CSG member of the home eNodeBs
563  lteHelper->SetUeDeviceAttribute ("CsgId", UintegerValue (1));
564  NetDeviceContainer homeUeDevs = lteHelper->InstallUeDevice (homeUes);
565 
566  // macro Ues
567  NS_LOG_LOGIC ("randomly allocating macro UEs in " << macroUeBox << " speedMin " << outdoorUeMinSpeed << " speedMax " << outdoorUeMaxSpeed);
568  if (outdoorUeMaxSpeed!=0.0)
569  {
570  mobility.SetMobilityModel ("ns3::SteadyStateRandomWaypointMobilityModel");
571 
572  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::MinX", DoubleValue (macroUeBox.xMin));
573  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::MinY", DoubleValue (macroUeBox.yMin));
574  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::MaxX", DoubleValue (macroUeBox.xMax));
575  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::MaxY", DoubleValue (macroUeBox.yMax));
576  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::Z", DoubleValue (ueZ));
577  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::MaxSpeed", DoubleValue (outdoorUeMaxSpeed));
578  Config::SetDefault ("ns3::SteadyStateRandomWaypointMobilityModel::MinSpeed", DoubleValue (outdoorUeMinSpeed));
579 
580  // this is not used since SteadyStateRandomWaypointMobilityModel
581  // takes care of initializing the positions; however we need to
582  // reset it since the previously used PositionAllocator
583  // (SameRoom) will cause an error when used with homeDeploymentRatio=0
584  positionAlloc = CreateObject<RandomBoxPositionAllocator> ();
585  mobility.SetPositionAllocator (positionAlloc);
586  mobility.Install (macroUes);
587 
588  // forcing initialization so we don't have to wait for Nodes to
589  // start before positions are assigned (which is needed to
590  // output node positions to file and to make AttachToClosestEnb work)
591  for (NodeContainer::Iterator it = macroUes.Begin ();
592  it != macroUes.End ();
593  ++it)
594  {
595  (*it)->Initialize ();
596  }
597  }
598  else
599  {
600  positionAlloc = CreateObject<RandomBoxPositionAllocator> ();
601  Ptr<UniformRandomVariable> xVal = CreateObject<UniformRandomVariable> ();
602  xVal->SetAttribute ("Min", DoubleValue (macroUeBox.xMin));
603  xVal->SetAttribute ("Max", DoubleValue (macroUeBox.xMax));
604  positionAlloc->SetAttribute ("X", PointerValue (xVal));
605  Ptr<UniformRandomVariable> yVal = CreateObject<UniformRandomVariable> ();
606  yVal->SetAttribute ("Min", DoubleValue (macroUeBox.yMin));
607  yVal->SetAttribute ("Max", DoubleValue (macroUeBox.yMax));
608  positionAlloc->SetAttribute ("Y", PointerValue (yVal));
609  Ptr<UniformRandomVariable> zVal = CreateObject<UniformRandomVariable> ();
610  zVal->SetAttribute ("Min", DoubleValue (macroUeBox.zMin));
611  zVal->SetAttribute ("Max", DoubleValue (macroUeBox.zMax));
612  positionAlloc->SetAttribute ("Z", PointerValue (zVal));
613  mobility.SetPositionAllocator (positionAlloc);
614  mobility.Install (macroUes);
615  }
616  BuildingsHelper::Install (macroUes);
617 
618  NetDeviceContainer macroUeDevs = lteHelper->InstallUeDevice (macroUes);
619 
620  Ipv4Address remoteHostAddr;
621  NodeContainer ues;
622  Ipv4StaticRoutingHelper ipv4RoutingHelper;
623  Ipv4InterfaceContainer ueIpIfaces;
624  Ptr<Node> remoteHost;
625  NetDeviceContainer ueDevs;
626 
627  if (epc)
628  {
629  NS_LOG_LOGIC ("setting up internet and remote host");
630 
631  // Create a single RemoteHost
632  NodeContainer remoteHostContainer;
633  remoteHostContainer.Create (1);
634  remoteHost = remoteHostContainer.Get (0);
635  InternetStackHelper internet;
636  internet.Install (remoteHostContainer);
637 
638  // Create the Internet
639  PointToPointHelper p2ph;
640  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
641  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
642  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
643  Ptr<Node> pgw = epcHelper->GetPgwNode ();
644  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
645  Ipv4AddressHelper ipv4h;
646  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
647  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
648  // in this container, interface 0 is the pgw, 1 is the remoteHost
649  remoteHostAddr = internetIpIfaces.GetAddress (1);
650 
651  Ipv4StaticRoutingHelper ipv4RoutingHelper;
652  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
653  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
654 
655  // for internetworking purposes, consider together home UEs and macro UEs
656  ues.Add (homeUes);
657  ues.Add (macroUes);
658  ueDevs.Add (homeUeDevs);
659  ueDevs.Add (macroUeDevs);
660 
661  // Install the IP stack on the UEs
662  internet.Install (ues);
663  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
664 
665  // attachment (needs to be done after IP stack configuration)
666  // using initial cell selection
667  lteHelper->Attach (macroUeDevs);
668  lteHelper->Attach (homeUeDevs);
669  }
670  else
671  {
672  // macro UEs attached to the closest macro eNB
673  lteHelper->AttachToClosestEnb (macroUeDevs, macroEnbDevs);
674 
675  // each home UE is attached explicitly to its home eNB
678  for (ueDevIt = homeUeDevs.Begin (), enbDevIt = homeEnbDevs.Begin ();
679  ueDevIt != homeUeDevs.End (); ++ueDevIt, ++enbDevIt)
680  {
681  // this because of the order in which SameRoomPositionAllocator
682  // will place the UEs
683  if (enbDevIt == homeEnbDevs.End ())
684  {
685  enbDevIt = homeEnbDevs.Begin ();
686  }
687  lteHelper->Attach (*ueDevIt, *enbDevIt);
688  }
689  }
690 
691  if (epc)
692  {
693  NS_LOG_LOGIC ("setting up applications");
694 
695  // Install and start applications on UEs and remote host
696  uint16_t dlPort = 10000;
697  uint16_t ulPort = 20000;
698 
699  // randomize a bit start times to avoid simulation artifacts
700  // (e.g., buffer overflows due to packet transmissions happening
701  // exactly at the same time)
702  Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable> ();
703  if (useUdp)
704  {
705  startTimeSeconds->SetAttribute ("Min", DoubleValue (0));
706  startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010));
707  }
708  else
709  {
710  // TCP needs to be started late enough so that all UEs are connected
711  // otherwise TCP SYN packets will get lost
712  startTimeSeconds->SetAttribute ("Min", DoubleValue (0.100));
713  startTimeSeconds->SetAttribute ("Max", DoubleValue (0.110));
714  }
715 
716  for (uint32_t u = 0; u < ues.GetN (); ++u)
717  {
718  Ptr<Node> ue = ues.Get (u);
719  // Set the default gateway for the UE
720  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
721  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
722 
723  for (uint32_t b = 0; b < numBearersPerUe; ++b)
724  {
725  ++dlPort;
726  ++ulPort;
727 
730 
731  if (useUdp)
732  {
733  if (epcDl)
734  {
735  NS_LOG_LOGIC ("installing UDP DL app for UE " << u);
736  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
737  clientApps.Add (dlClientHelper.Install (remoteHost));
738  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory",
739  InetSocketAddress (Ipv4Address::GetAny (), dlPort));
740  serverApps.Add (dlPacketSinkHelper.Install (ue));
741  }
742  if (epcUl)
743  {
744  NS_LOG_LOGIC ("installing UDP UL app for UE " << u);
745  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
746  clientApps.Add (ulClientHelper.Install (ue));
747  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory",
748  InetSocketAddress (Ipv4Address::GetAny (), ulPort));
749  serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
750  }
751  }
752  else // use TCP
753  {
754  if (epcDl)
755  {
756  NS_LOG_LOGIC ("installing TCP DL app for UE " << u);
757  BulkSendHelper dlClientHelper ("ns3::TcpSocketFactory",
758  InetSocketAddress (ueIpIfaces.GetAddress (u), dlPort));
759  dlClientHelper.SetAttribute ("MaxBytes", UintegerValue (0));
760  clientApps.Add (dlClientHelper.Install (remoteHost));
761  PacketSinkHelper dlPacketSinkHelper ("ns3::TcpSocketFactory",
762  InetSocketAddress (Ipv4Address::GetAny (), dlPort));
763  serverApps.Add (dlPacketSinkHelper.Install (ue));
764  }
765  if (epcUl)
766  {
767  NS_LOG_LOGIC ("installing TCP UL app for UE " << u);
768  BulkSendHelper ulClientHelper ("ns3::TcpSocketFactory",
769  InetSocketAddress (remoteHostAddr, ulPort));
770  ulClientHelper.SetAttribute ("MaxBytes", UintegerValue (0));
771  clientApps.Add (ulClientHelper.Install (ue));
772  PacketSinkHelper ulPacketSinkHelper ("ns3::TcpSocketFactory",
773  InetSocketAddress (Ipv4Address::GetAny (), ulPort));
774  serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
775  }
776  } // end if (useUdp)
777 
778  Ptr<EpcTft> tft = Create<EpcTft> ();
779  if (epcDl)
780  {
782  dlpf.localPortStart = dlPort;
783  dlpf.localPortEnd = dlPort;
784  tft->Add (dlpf);
785  }
786  if (epcUl)
787  {
789  ulpf.remotePortStart = ulPort;
790  ulpf.remotePortEnd = ulPort;
791  tft->Add (ulpf);
792  }
793 
794  if (epcDl || epcUl)
795  {
796  EpsBearer bearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT);
797  lteHelper->ActivateDedicatedEpsBearer (ueDevs.Get (u), bearer, tft);
798  }
799  Time startTime = Seconds (startTimeSeconds->GetValue ());
800  serverApps.Start (startTime);
801  clientApps.Start (startTime);
802 
803  } // end for b
804  }
805 
806  }
807  else // (epc == false)
808  {
809  // for radio bearer activation purposes, consider together home UEs and macro UEs
810  NetDeviceContainer ueDevs;
811  ueDevs.Add (homeUeDevs);
812  ueDevs.Add (macroUeDevs);
813  for (uint32_t u = 0; u < ueDevs.GetN (); ++u)
814  {
815  Ptr<NetDevice> ueDev = ueDevs.Get (u);
816  for (uint32_t b = 0; b < numBearersPerUe; ++b)
817  {
818  enum EpsBearer::Qci q = EpsBearer::NGBR_VIDEO_TCP_DEFAULT;
819  EpsBearer bearer (q);
820  lteHelper->ActivateDataRadioBearer (ueDev, bearer);
821  }
822  }
823  }
824 
825  BuildingsHelper::MakeMobilityModelConsistent ();
826 
828  if (generateRem)
829  {
830  PrintGnuplottableBuildingListToFile ("buildings.txt");
831  PrintGnuplottableEnbListToFile ("enbs.txt");
832  PrintGnuplottableUeListToFile ("ues.txt");
833 
834  remHelper = CreateObject<RadioEnvironmentMapHelper> ();
835  remHelper->SetAttribute ("ChannelPath", StringValue ("/ChannelList/0"));
836  remHelper->SetAttribute ("OutputFile", StringValue ("lena-dual-stripe.rem"));
837  remHelper->SetAttribute ("XMin", DoubleValue (macroUeBox.xMin));
838  remHelper->SetAttribute ("XMax", DoubleValue (macroUeBox.xMax));
839  remHelper->SetAttribute ("YMin", DoubleValue (macroUeBox.yMin));
840  remHelper->SetAttribute ("YMax", DoubleValue (macroUeBox.yMax));
841  remHelper->SetAttribute ("Z", DoubleValue (1.5));
842 
843  if (remRbId >= 0)
844  {
845  remHelper->SetAttribute ("UseDataChannel", BooleanValue (true));
846  remHelper->SetAttribute ("RbId", IntegerValue (remRbId));
847  }
848 
849  remHelper->Install ();
850  // simulation will stop right after the REM has been generated
851  }
852  else
853  {
854  Simulator::Stop (Seconds (simTime));
855  }
856 
857  lteHelper->EnableMacTraces ();
858  lteHelper->EnableRlcTraces ();
859  if (epc)
860  {
861  lteHelper->EnablePdcpTraces ();
862  }
863 
864  Simulator::Run ();
865 
866  //GtkConfigStore config;
867  //config.ConfigureAttributes ();
868 
869  lteHelper = 0;
870  Simulator::Destroy ();
871  return 0;
872 }
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition: string.cc:30
holds a vector of ns3::Application pointers.
Introspection did not find any typical Config paths.
Definition: config-store.h:54
bool Get(void) const
Definition: boolean.cc:51
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:157
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:299
an Inet address class
double zMin
The z coordinate of the down bound of the box.
Definition: box.h:101
bool AreOverlapping(Box a, Box b)
std::string Get(void) const
Definition: string.cc:31
void PrintGnuplottableEnbListToFile(std::string filename)
AttributeValue implementation for Boolean.
Definition: boolean.h:34
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:382
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
holds a vector of std::pair of Ptr and interface index.
uint16_t GetCellId() const
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())
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
static ns3::GlobalValue g_macroEnbTxPowerDbm("macroEnbTxPowerDbm","TX power [dBm] used by macro eNBs", ns3::DoubleValue(46.0), ns3::MakeDoubleChecker< double >())
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:462
static ns3::GlobalValue g_homeEnbBandwidth("homeEnbBandwidth","bandwidth [num RBs] used by HeNBs", ns3::UintegerValue(25), ns3::MakeUintegerChecker< uint16_t >())
Hold variables of type string.
Definition: string.h:41
Ptr< UniformRandomVariable > m_xMinVar
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
static ns3::GlobalValue g_outdoorUeMaxSpeed("outdoorUeMaxSpeed","Maximum speed value of macor UE with random waypoint model [m/s].", ns3::DoubleValue(0.0), ns3::MakeDoubleChecker< double >())
static ns3::GlobalValue g_interSiteDistance("interSiteDistance","min distance between two nearby macro cell sites", ns3::DoubleValue(500), ns3::MakeDoubleChecker< double >())
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:315
uint64_t GetImsi() const
Hold a signed integer type.
Definition: integer.h:44
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:716
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:903
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1102
aggregate IP/TCP/UDP functionality to existing Nodes.
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:115
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE devices (LteUeNetDevice) to be created.
Definition: lte-helper.cc:329
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 >())
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
void SetLteHelper(Ptr< LteHelper > h)
Set the LteHelper to be used to actually create the EnbNetDevices.
Build a set of PointToPointNetDevice objects.
FemtocellBlockAllocator(Box area, uint32_t nApartmentsX, uint32_t nFloors)
Hold a so-called 'global value'.
Definition: global-value.h:70
double xMax
The x coordinate of the right bound of the box.
Definition: box.h:95
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1046
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
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:824
NetDeviceContainer SetPositionAndInstallEnbDevice(NodeContainer c)
Position the nodes on a hex grid and install the corresponding EnbNetDevices with antenna boresight c...
static ns3::GlobalValue g_macroUeDensity("macroUeDensity","How many macrocell UEs there are per square meter", ns3::DoubleValue(0.00002), ns3::MakeDoubleChecker< double >())
tuple cmd
Definition: second.py:35
Ptr< UniformRandomVariable > m_yMinVar
tuple clientApps
Definition: first.py:54
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())
a 3d box
Definition: box.h:34
double yMax
The y coordinate of the top bound of the box.
Definition: box.h:99
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Class for representing data rates.
Definition: data-rate.h:88
void EnablePdcpTraces(void)
Enable trace sinks for PDCP layer.
Definition: lte-helper.cc:1239
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 >())
uint64_t Get(void) const
Definition: uinteger.cc:35
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:792
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())
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())
Keep track of the current position and velocity of an object.
int64_t Get(void) const
Definition: integer.cc:35
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
static ns3::GlobalValue g_homeEnbActivationRatio("homeEnbActivationRatio","The HeNB activation ratio as per 3GPP R4-092042", ns3::DoubleValue(0.5), ns3::MakeDoubleChecker< double >())
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
AttributeValue implementation for Time.
Definition: nstime.h:957
static ns3::GlobalValue g_simTime("simTime","Total duration of the simulation [s]", ns3::DoubleValue(0.25), ns3::MakeDoubleChecker< double >())
static ns3::GlobalValue g_nMacroEnbSites("nMacroEnbSites","How many macro sites there are", ns3::UintegerValue(3), ns3::MakeUintegerChecker< uint32_t >())
static ns3::GlobalValue g_homeEnbDeploymentRatio("homeEnbDeploymentRatio","The HeNB deployment ratio as per 3GPP R4-092042", ns3::DoubleValue(0.2), ns3::MakeDoubleChecker< double >())
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
BuildingContainer Create(uint32_t n) const
Create a set of buildings allocated on a grid.
Hold an unsigned integer type.
Definition: uinteger.h:44
static ns3::GlobalValue g_numBearersPerUe("numBearersPerUe","How many bearers per UE there are in the simulation", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint16_t >())
Vector3D Vector
Definition: vector.h:166
double startTime
static ns3::GlobalValue g_outdoorUeMinSpeed("outdoorUeMinSpeed","Minimum speed value of macor UE with random waypoint model [m/s].", ns3::DoubleValue(0.0), ns3::MakeDoubleChecker< double >())
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
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 >())
std::vector< Ptr< Building > >::const_iterator Iterator
Definition: building-list.h:36
static ns3::GlobalValue g_homeEnbDlEarfcn("homeEnbDlEarfcn","DL EARFCN used by HeNBs", ns3::UintegerValue(100), ns3::MakeUintegerChecker< uint16_t >())
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
double yMin
The y coordinate of the bottom bound of the box.
Definition: box.h:97
Parse command-line arguments.
Definition: command-line.h:205
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
double Get(void) const
Definition: double.cc:35
void SetEnbAntennaModelType(std::string type)
Set the type of antenna model to be used by eNodeB devices.
Definition: lte-helper.cc:315
void SetSpectrumChannelType(std::string type)
Set the type of spectrum channel to be used in both DL and UL.
Definition: lte-helper.cc:368
tuple serverApps
Definition: first.py:45
void ConfigureDefaults(void)
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
uint32_t GetNDevices(void) const
Definition: node.cc:150
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:362
void PrintGnuplottableUeListToFile(std::string filename)
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 >())
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:113
static ns3::GlobalValue g_nApartmentsX("nApartmentsX","Number of apartments along the X axis in a femtocell block", ns3::UintegerValue(10), ns3::MakeUintegerChecker< uint32_t >())
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())
virtual Ipv4Address GetUeDefaultGatewayAddress()
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())
static ns3::GlobalValue g_nBlocks("nBlocks","Number of femtocell blocks", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Hold objects of type Ptr.
Definition: pointer.h:36
static ns3::GlobalValue g_nFloors("nFloors","Number of floors", ns3::UintegerValue(1), ns3::MakeUintegerChecker< uint32_t >())
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-list.h:44
static ns3::GlobalValue g_homeEnbTxPowerDbm("homeEnbTxPowerDbm","TX power [dBm] used by HeNBs", ns3::DoubleValue(20.0), ns3::MakeDoubleChecker< double >())
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
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())
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
void Install()
Deploy the RemSpectrumPhy objects that generate the map according to the specified settings...
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:976
Ptr< T > Create(void)
Create class instances by constructors with varying numbers of arguments and return them by Ptr...
Definition: ptr.h:514
double zMax
The z coordinate of the up bound of the box.
Definition: box.h:103
std::list< Box > m_previousBlocks
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
#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:90
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:397
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
void SetBuildingAttribute(std::string n, const AttributeValue &v)
Set an attribute to be used for each new building to be created.
Helper class used to assign positions and mobility models to nodes.
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
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...
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:218
static ns3::GlobalValue g_macroEnbBandwidth("macroEnbBandwidth","bandwidth [num RBs] used by macro eNBs", ns3::UintegerValue(25), ns3::MakeUintegerChecker< uint16_t >())
Helper class that adds ns3::Ipv4StaticRouting objects.
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
void PrintGnuplottableBuildingListToFile(std::string filename)
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB antenna model to be created.
Definition: lte-helper.cc:322
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 >())
void Parse(int argc, char *argv[])
Parse the program arguments.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:220
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void EnableMacTraces(void)
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1190
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:191
The eNodeB device implementation.
static ns3::GlobalValue g_macroEnbDlEarfcn("macroEnbDlEarfcn","DL EARFCN used by macro eNBs", ns3::UintegerValue(100), ns3::MakeUintegerChecker< uint16_t >())
Qci
QoS Class Indicator.
Definition: eps-bearer.h:77
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:112
double xMin
The x coordinate of the left bound of the box.
Definition: box.h:93
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:73
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:307
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:114
The LteUeNetDevice class implements the UE net device.