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