simulation-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 Magister Solutions
4  * Copyright (c) 2018 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Lauri Sormunen <lauri.sormunen@magister.fi>
20  * Author: Mathias Ettinger <mettinger@viveris.toulouse.fr>
21  * Modified by: Patrice Raveneau <patrice.raveneau@cnes.fr>
22  *
23  */
24 
25 #include "simulation-helper.h"
26 
27 #include <ns3/address.h>
28 #include <ns3/cbr-helper.h>
29 #include <ns3/config-store.h>
30 #include <ns3/config.h>
31 #include <ns3/enum.h>
32 #include <ns3/log.h>
33 #include <ns3/lora-periodic-sender.h>
34 #include <ns3/nrtv-helper.h>
35 #include <ns3/packet-sink-helper.h>
36 #include <ns3/packet-sink.h>
37 #include <ns3/pointer.h>
38 #include <ns3/random-variable-stream.h>
39 #include <ns3/satellite-env-variables.h>
40 #include <ns3/satellite-on-off-helper.h>
41 #include <ns3/singleton.h>
42 #include <ns3/string.h>
43 #include <ns3/three-gpp-http-satellite-helper.h>
44 #include <ns3/uinteger.h>
45 
46 NS_LOG_COMPONENT_DEFINE("SimulationHelper");
47 
48 namespace ns3
49 {
50 
51 NS_OBJECT_ENSURE_REGISTERED(SimulationHelperConf);
52 
67 #define SIM_ADD_TRAFFIC_MODEL_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6) \
68  AddAttribute("Traffic" TOSTRING(index) "Percentage", \
69  "Percentage of final users that will use this traffic model", \
70  DoubleValue(a1), \
71  MakeDoubleAccessor(&SimulationHelperConf::SetTraffic##index##Percentage, \
72  &SimulationHelperConf::GetTraffic##index##Percentage), \
73  MakeDoubleChecker<double>(0, 1)) \
74  .AddAttribute("Traffic" TOSTRING(index) "Protocol", \
75  "Network protocol that this traffic model will use", \
76  EnumValue(a2), \
77  MakeEnumAccessor(&SimulationHelperConf::SetTraffic##index##Protocol, \
78  &SimulationHelperConf::GetTraffic##index##Protocol), \
79  MakeEnumChecker(SimulationHelperConf::PROTOCOL_UDP, \
80  "UDP", \
81  SimulationHelperConf::PROTOCOL_TCP, \
82  "TCP", \
83  SimulationHelperConf::PROTOCOL_BOTH, \
84  "BOTH")) \
85  .AddAttribute("Traffic" TOSTRING(index) "Direction", \
86  "Satellite link direction that this traffic model will use", \
87  EnumValue(a3), \
88  MakeEnumAccessor(&SimulationHelperConf::SetTraffic##index##Direction, \
89  &SimulationHelperConf::GetTraffic##index##Direction), \
90  MakeEnumChecker(SimulationHelperConf::RTN_LINK, \
91  "ReturnLink", \
92  SimulationHelperConf::FWD_LINK, \
93  "ForwardLink", \
94  SimulationHelperConf::BOTH_LINK, \
95  "BothLinks")) \
96  .AddAttribute( \
97  "Traffic" TOSTRING(index) "StartTime", \
98  "Time into the simulation when this traffic model will be started on each user", \
99  TimeValue(a4), \
100  MakeTimeAccessor(&SimulationHelperConf::SetTraffic##index##StartTime, \
101  &SimulationHelperConf::GetTraffic##index##StartTime), \
102  MakeTimeChecker(Seconds(0))) \
103  .AddAttribute("Traffic" TOSTRING(index) "StopTime", \
104  "Time into the simulation when this traffic model will be stopped " \
105  "on each user. 0 means endless traffic generation.", \
106  TimeValue(a5), \
107  MakeTimeAccessor(&SimulationHelperConf::SetTraffic##index##StopTime, \
108  &SimulationHelperConf::GetTraffic##index##StopTime), \
109  MakeTimeChecker(Seconds(0))) \
110  .AddAttribute("Traffic" TOSTRING(index) "StartDelay", \
111  "Cummulative delay for each user before starting this traffic model", \
112  TimeValue(a6), \
113  MakeTimeAccessor(&SimulationHelperConf::SetTraffic##index##StartDelay, \
114  &SimulationHelperConf::GetTraffic##index##StartDelay), \
115  MakeTimeChecker(Seconds(0)))
116 
117 TypeId
119 {
120  static TypeId tid =
121  TypeId("ns3::SimulationHelperConf")
122  .SetParent<Object>()
123  .AddConstructor<SimulationHelperConf>()
124  .AddAttribute("SimTime",
125  "Simulation time",
126  TimeValue(Seconds(100)),
127  MakeTimeAccessor(&SimulationHelperConf::m_simTime),
128  MakeTimeChecker(Seconds(1)))
129  .AddAttribute("BeamsIDs",
130  "Enabled Beams IDs",
131  StringValue("10 11 12 23 24 25"),
132  MakeStringAccessor(&SimulationHelperConf::m_enabledBeams),
133  MakeStringChecker())
134  .AddAttribute("UserCountPerUt",
135  "Amount of user per User Terminal",
136  StringValue("ns3::ConstantRandomVariable[Constant=1]"),
137  MakePointerAccessor(&SimulationHelperConf::m_utUserCount),
138  MakePointerChecker<RandomVariableStream>())
139  .AddAttribute("UserCountPerMobileUt",
140  "Amount of user per mobile User Terminal",
141  StringValue("ns3::ConstantRandomVariable[Constant=1]"),
142  MakePointerAccessor(&SimulationHelperConf::m_utMobileUserCount),
143  MakePointerChecker<RandomVariableStream>())
144  .AddAttribute("UtCountPerBeam",
145  "Amount of User Terminal associated to each Beam",
146  StringValue("ns3::ConstantRandomVariable[Constant=1]"),
147  MakePointerAccessor(&SimulationHelperConf::m_utCount),
148  MakePointerChecker<RandomVariableStream>())
149  .AddAttribute("ActivateStatistics",
150  "Enable outputing values from stats helpers",
151  BooleanValue(true),
152  MakeBooleanAccessor(&SimulationHelperConf::m_activateStatistics),
153  MakeBooleanChecker())
154  .AddAttribute("ActivateProgressLogs",
155  "Enable outputing progress of the simulation",
156  BooleanValue(true),
158  MakeBooleanChecker())
159  .AddAttribute("MobileUtsFolder",
160  "Select the folder where mobile UTs traces should be found",
161  StringValue(Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
162  "/utpositions/mobiles/"),
163  MakeStringAccessor(&SimulationHelperConf::m_mobileUtsFolder),
164  MakeStringChecker())
166  1.0,
167  PROTOCOL_UDP,
168  RTN_LINK,
169  Seconds(0.1),
170  Seconds(0),
171  MilliSeconds(10))
173  0,
174  PROTOCOL_TCP,
175  RTN_LINK,
176  Seconds(0.1),
177  Seconds(0),
178  MilliSeconds(10))
180  0,
181  PROTOCOL_UDP,
182  RTN_LINK,
183  Seconds(0.1),
184  Seconds(0),
185  MilliSeconds(10))
187  0,
188  PROTOCOL_TCP,
189  RTN_LINK,
190  Seconds(0.1),
191  Seconds(0),
192  MilliSeconds(10));
193  return tid;
194 }
195 
196 TypeId
198 {
199  NS_LOG_FUNCTION(this);
200 
201  return GetTypeId();
202 }
203 
205  : m_simTime(0),
206  m_enabledBeams(""),
207  m_utCount(0),
208  m_utUserCount(0),
209  m_utMobileUserCount(0),
210  m_activateStatistics(false),
211  m_activateProgressLogging(false)
212 {
213  NS_LOG_FUNCTION(this);
214 }
215 
217 {
218  NS_LOG_FUNCTION(this);
219 }
220 
221 NS_OBJECT_ENSURE_REGISTERED(SimulationHelper);
222 
223 TypeId
225 {
226  static TypeId tid =
227  TypeId("ns3::SimulationHelper").SetParent<Object>().AddConstructor<SimulationHelper>();
228  return tid;
229 }
230 
231 TypeId
233 {
234  NS_LOG_FUNCTION(this);
235 
236  return GetTypeId();
237 }
238 
240  : m_satHelper(NULL),
241  m_statContainer(NULL),
242  m_commonUtPositions(),
243  m_utPositionsByBeam(),
244  m_simulationName(""),
245  m_enabledBeamsStr(""),
246  m_enabledBeams(),
247  m_outputPath(""),
248  m_utCount(),
249  m_utUserCount(0),
250  m_utMobileUserCount(0),
251  m_simTime(0),
252  m_numberOfConfiguredFrames(0),
253  m_randomAccessConfigured(false),
254  m_enableInputFileUtListPositions(false),
255  m_inputFileUtPositionsCheckBeams(true),
256  m_gwUserId(0),
257  m_progressLoggingEnabled(false),
258  m_progressUpdateInterval(Seconds(0.5))
259 {
260  NS_FATAL_ERROR(
261  "SimulationHelper: Default constructor not in use. Please create with simulation name. ");
262 }
263 
264 SimulationHelper::SimulationHelper(std::string simulationName)
265  : m_satHelper(NULL),
266  m_statContainer(NULL),
267  m_commonUtPositions(),
268  m_utPositionsByBeam(),
269  m_simulationName(""),
270  m_enabledBeamsStr(""),
271  m_enabledBeams(),
272  m_outputPath(""),
273  m_utCount(),
274  m_utUserCount(0),
275  m_utMobileUserCount(0),
276  m_simTime(0),
277  m_numberOfConfiguredFrames(0),
278  m_randomAccessConfigured(false),
279  m_enableInputFileUtListPositions(false),
280  m_inputFileUtPositionsCheckBeams(true),
281  m_gwUserId(0),
282  m_progressLoggingEnabled(false),
283  m_progressUpdateInterval(Seconds(0.5))
284 {
285  NS_LOG_FUNCTION(this);
286 
287  ObjectBase::ConstructSelf(AttributeConstructionList());
288 
289  m_simulationName = simulationName;
290  Config::SetDefault("ns3::SatEnvVariables::SimulationCampaignName",
291  StringValue(m_simulationName));
292  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
293 
294  // NCC configuration
295  Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType", StringValue("ConfigType_2"));
296  Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(true));
297 
298  // RBDC
299  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
300  BooleanValue(false));
301  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed", BooleanValue(true));
302  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_MinimumServiceRate",
303  UintegerValue(16));
304  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
305  BooleanValue(false));
306 }
307 
309 {
310  NS_LOG_FUNCTION(this);
311 }
312 
313 void
315 {
316  NS_LOG_FUNCTION(this);
317 
318  m_commonUtPositions = NULL;
319  m_utPositionsByBeam.clear();
320 }
321 
322 void
324 {
325  NS_LOG_FUNCTION(this << count);
326 
327  Ptr<RandomVariableStream> utCount = CreateObject<ConstantRandomVariable>();
328  utCount->SetAttribute("Constant", DoubleValue(count));
329 
330  m_utCount.insert(std::make_pair(0, utCount));
331 }
332 
333 void
334 SimulationHelper::SetUtCountPerBeam(Ptr<RandomVariableStream> rs)
335 {
336  NS_LOG_FUNCTION(this << &rs);
337 
338  m_utCount.insert(std::make_pair(0, rs));
339 }
340 
341 void
342 SimulationHelper::SetUtCountPerBeam(uint32_t beamId, uint32_t count)
343 {
344  NS_LOG_FUNCTION(this << beamId << count);
345 
346  Ptr<RandomVariableStream> utCount = CreateObject<ConstantRandomVariable>();
347  utCount->SetAttribute("Constant", DoubleValue(count));
348 
349  m_utCount.insert(std::make_pair(beamId, utCount));
350 }
351 
352 void
353 SimulationHelper::SetUtCountPerBeam(uint32_t beamId, Ptr<RandomVariableStream> rs)
354 {
355  NS_LOG_FUNCTION(this << &rs);
356 
357  m_utCount.insert(std::make_pair(beamId, rs));
358 }
359 
360 void
362 {
363  NS_LOG_FUNCTION(this << count);
364 
365  m_utUserCount = CreateObject<ConstantRandomVariable>();
366  m_utUserCount->SetAttribute("Constant", DoubleValue(count));
367 }
368 
369 void
370 SimulationHelper::SetUserCountPerUt(Ptr<RandomVariableStream> rs)
371 {
372  NS_LOG_FUNCTION(this << &rs);
373 
374  m_utUserCount = rs;
375 }
376 
377 void
379 {
380  NS_LOG_FUNCTION(this << count);
381 
382  m_utMobileUserCount = CreateObject<ConstantRandomVariable>();
383  m_utMobileUserCount->SetAttribute("Constant", DoubleValue(count));
384 }
385 
386 void
387 SimulationHelper::SetUserCountPerMobileUt(Ptr<RandomVariableStream> rs)
388 {
389  NS_LOG_FUNCTION(this << &rs);
390 
391  m_utMobileUserCount = rs;
392 }
393 
394 void
395 SimulationHelper::SetGwUserCount(uint32_t gwUserCount)
396 {
397  NS_LOG_FUNCTION(this << gwUserCount);
398 
399  Config::SetDefault("ns3::SatHelper::GwUsers", UintegerValue(gwUserCount));
400 }
401 
402 void
404 {
405  NS_LOG_FUNCTION(this << seconds);
406 
407  m_simTime = Seconds(seconds);
408 }
409 
410 void
412 {
413  NS_LOG_FUNCTION(this << tag);
414 
415  // Set simulation output details
416  m_simulationTag = tag;
417 }
418 
419 void
421 {
422  NS_LOG_FUNCTION(this << path);
423 
424  // Set simulation output details
425  m_outputPath = path;
426 }
427 
428 void
429 SimulationHelper::AddDefaultUiArguments(CommandLine& cmd, std::string& xmlInputFile)
430 {
431  NS_LOG_FUNCTION(this);
432 
434  cmd.AddValue("InputXml", "Input attributes in XML file", xmlInputFile);
435 }
436 
437 void
439 {
440  NS_LOG_FUNCTION(this);
441 
442  // Create a customizable output path
443  cmd.AddValue("OutputPath", "Output path for storing the simulation statistics", m_outputPath);
444 }
445 
446 void
448 {
449  NS_LOG_FUNCTION(this);
450 
452  Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_OFF));
453 
454  Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0", StringValue("Configuration_0"));
455  Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType", StringValue("ConfigType_2"));
456  Config::SetDefault("ns3::SatSuperframeSeq::TargetDuration", TimeValue(MilliSeconds(100)));
457 
458  Config::SetDefault("ns3::SatRequestManager::EvaluationInterval", TimeValue(MilliSeconds(100)));
459  Config::SetDefault("ns3::SatRequestManager::EnableOnDemandEvaluation", BooleanValue(false));
460 
461  Config::SetDefault("ns3::SatBbFrameConf::BBFrameUsageMode", StringValue("NormalFrames"));
462 
464  ConfigureFrame(0, 20e5, 5e5, 0.2, 0.3, false);
465 
468 
469  // ACM enabled
472 
474  EnableOnlyVbdc(3);
475 
476  EnablePeriodicalControlSlots(MilliSeconds(100));
477 
478  Config::SetDefault("ns3::SatUtHelper::EnableChannelEstimationError", BooleanValue(true));
479  Config::SetDefault("ns3::SatGwHelper::EnableChannelEstimationError", BooleanValue(true));
480 
481  Config::SetDefault("ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled", BooleanValue(false));
482 
483  Config::SetDefault("ns3::SatQueue::MaxPackets", UintegerValue(10000));
484 }
485 
486 void
488 {
489  NS_LOG_FUNCTION(this);
490 
491  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaServiceCount", UintegerValue(4));
492  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
493  BooleanValue(false));
494  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
495  BooleanValue(false));
496  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
497  BooleanValue(false));
498  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
499  BooleanValue(false));
500  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
501  BooleanValue(false));
502  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
503  BooleanValue(false));
504  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
505  BooleanValue(false));
506  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
507  BooleanValue(false));
508  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
509  BooleanValue(false));
510  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
511  BooleanValue(false));
512  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
513  BooleanValue(false));
514  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
515  BooleanValue(false));
516 }
517 
518 void
519 SimulationHelper::EnableOnlyConstantRate(uint32_t rcIndex, double rateKbps)
520 {
521  NS_LOG_FUNCTION(this << rcIndex << rateKbps);
522 
523  std::stringstream ss;
524  ss << rcIndex;
525  std::string attributeDefault("ns3::SatLowerLayerServiceConf::DaService" + ss.str());
526 
527  Config::SetDefault(attributeDefault + "_ConstantAssignmentProvided", BooleanValue(true));
528  Config::SetDefault(attributeDefault + "_RbdcAllowed", BooleanValue(false));
529  Config::SetDefault(attributeDefault + "_VolumeAllowed", BooleanValue(false));
530 }
531 
532 void
534 {
535  NS_LOG_FUNCTION(this << rcIndex);
536 
537  std::stringstream ss;
538  ss << rcIndex;
539  std::string attributeDefault("ns3::SatLowerLayerServiceConf::DaService" + ss.str());
540 
541  Config::SetDefault(attributeDefault + "_ConstantAssignmentProvided", BooleanValue(false));
542  Config::SetDefault(attributeDefault + "_RbdcAllowed", BooleanValue(true));
543  Config::SetDefault(attributeDefault + "_VolumeAllowed", BooleanValue(false));
544 
545  Config::SetDefault("ns3::SatLowerLayerServiceConf::DynamicRatePersistence", UintegerValue(10));
546 }
547 
548 void
550 {
551  NS_LOG_FUNCTION(this << rcIndex);
552 
553  std::stringstream ss;
554  ss << rcIndex;
555  std::string attributeDefault("ns3::SatLowerLayerServiceConf::DaService" + ss.str());
556 
557  Config::SetDefault(attributeDefault + "_ConstantAssignmentProvided", BooleanValue(false));
558  Config::SetDefault(attributeDefault + "_RbdcAllowed", BooleanValue(false));
559  Config::SetDefault(attributeDefault + "_VolumeAllowed", BooleanValue(true));
560 
561  Config::SetDefault("ns3::SatLowerLayerServiceConf::VolumeBacklogPersistence",
562  UintegerValue(10));
563 }
564 
565 void
567 {
568  NS_LOG_FUNCTION(this);
569 
570  Config::SetDefault("ns3::SatSuperframeAllocator::FcaEnabled", BooleanValue(true));
571 }
572 
573 void
575 {
576  NS_LOG_FUNCTION(this);
577 
578  Config::SetDefault("ns3::SatSuperframeAllocator::FcaEnabled", BooleanValue(false));
579 }
580 
581 void
583 {
584  NS_LOG_FUNCTION(this << periodicity.GetSeconds());
585 
586  // Controls slots
587  Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(true));
588  Config::SetDefault("ns3::SatBeamScheduler::ControlSlotInterval", TimeValue(periodicity));
589 }
590 
591 void
593 {
594  NS_LOG_FUNCTION(this << dir);
595 
596  switch (dir)
597  {
598  case SatEnums::LD_FORWARD: {
599  Config::SetDefault("ns3::SatLlc::FwdLinkArqEnabled", BooleanValue(true));
600 
601  Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::MaxNoOfRetransmissions",
602  UintegerValue(2));
603  Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::RetransmissionTimer",
604  TimeValue(MilliSeconds(600)));
605  Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::WindowSize", UintegerValue(10));
606  Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::ArqHeaderSize", UintegerValue(1));
607  Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::RxWaitingTime",
608  TimeValue(Seconds(1.8)));
609  break;
610  }
611  case SatEnums::LD_RETURN: {
612  Config::SetDefault("ns3::SatLlc::RtnLinkArqEnabled", BooleanValue(true));
613 
614  Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::MaxRtnArqSegmentSize",
615  UintegerValue(38));
616  Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::MaxNoOfRetransmissions",
617  UintegerValue(2));
618  Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::RetransmissionTimer",
619  TimeValue(MilliSeconds(600)));
620  Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::WindowSize", UintegerValue(10));
621  Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::ArqHeaderSize", UintegerValue(1));
622  Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::RxWaitingTime",
623  TimeValue(Seconds(1.8)));
624  break;
625  }
626  default: {
627  NS_FATAL_ERROR("Unsupported SatLinkDir_t!");
628  break;
629  }
630  }
631 }
632 
633 void
635 {
636  Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_OFF));
637  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel",
639  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
641  Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
643  Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
644  BooleanValue(false));
645 }
646 
647 void
649 {
650  NS_LOG_FUNCTION(this);
651 
652  if (m_randomAccessConfigured == true)
653  {
654  NS_FATAL_ERROR("Random access already configured!");
655  }
656 
657  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
658  UintegerValue(1));
660 }
661 
662 void
664 {
665  NS_LOG_FUNCTION(this);
666 
667  if (m_randomAccessConfigured == true)
668  {
669  NS_FATAL_ERROR("Random access already configured!");
670  }
671 
672  Config::SetDefault("ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(false));
673  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
674  UintegerValue(3));
676 }
677 
678 void
680 {
681  NS_LOG_FUNCTION(this);
682 
683  Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
684 
685  Config::SetDefault("ns3::SatLowerLayerServiceConf::DefaultControlRandomizationInterval",
686  TimeValue(MilliSeconds(100)));
687  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaServiceCount", UintegerValue(1));
688  Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
690  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel",
692  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
694  Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
696  Config::SetDefault("ns3::SatBeamHelper::RaConstantErrorRate", DoubleValue(0.0));
697 
698  Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
699  BooleanValue(false));
700  Config::SetDefault(
701  "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
702  UintegerValue(10));
703 
704  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
705  UintegerValue(3));
706  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
707  UintegerValue(6));
708  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
709  UintegerValue(2));
710  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
711  UintegerValue(50));
712  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
713  UintegerValue(1));
714  Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
715  UintegerValue(1));
716  Config::SetDefault(
717  "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
718  DoubleValue(0.99));
719 
721 
722  ConfigureFrame(0, 1.25e6, 1.25e6, 0.2, 0.3, true);
723 }
724 
725 void
727 {
728  NS_LOG_FUNCTION(this);
729 
730  Config::SetDefault("ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(false));
731  Config::SetDefault("ns3::SatChannel::ForwardingMode", StringValue("OnlyDestNode"));
732  Config::SetDefault("ns3::SatChannel::RxPowerCalculationMode",
733  StringValue("RxPowerCalculation"));
734  Config::SetDefault("ns3::SatBeamHelper::FadingModel", StringValue("FadingOff"));
735  Config::SetDefault("ns3::SatUtHelper::EnableChannelEstimationError", BooleanValue(false));
736  Config::SetDefault("ns3::SatGwHelper::EnableChannelEstimationError", BooleanValue(false));
737  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel", StringValue("Constant"));
738  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
739  StringValue("Perfect"));
740  Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
741  StringValue("RaCollisionNotDefined"));
742 
745 }
746 
747 void
749 {
750  NS_LOG_FUNCTION(this << dir);
751 
752  switch (dir)
753  {
754  case SatEnums::LD_FORWARD: {
755  Config::SetDefault("ns3::SatBbFrameConf::AcmEnabled", BooleanValue(true));
756  Config::SetDefault("ns3::SatBbFrameConf::DefaultModCod", StringValue("QPSK_1_TO_2"));
757  Config::SetDefault("ns3::SatRequestManager::CnoReportInterval", TimeValue(Seconds(0.1)));
758  Config::SetDefault("ns3::SatFwdLinkScheduler::CnoEstimationMode",
759  StringValue("AverageValueInWindow"));
760  Config::SetDefault("ns3::SatFwdLinkScheduler::CnoEstimationWindow", TimeValue(Seconds(2)));
761  break;
762  }
763  case SatEnums::LD_RETURN: {
764  Config::SetDefault("ns3::SatBeamScheduler::CnoEstimationMode",
765  StringValue("MinimumValueInWindow"));
766  Config::SetDefault("ns3::SatBeamScheduler::CnoEstimationWindow", TimeValue(Seconds(2)));
767  Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(true));
768  Config::SetDefault("ns3::SatWaveformConf::DefaultWfId", UintegerValue(3));
769  break;
770  }
771  default: {
772  NS_FATAL_ERROR("Unsupported SatLinkDir_t!");
773  break;
774  }
775  }
776 }
777 
778 void
780 {
781  NS_LOG_FUNCTION(this << dir);
782 
783  switch (dir)
784  {
785  case SatEnums::LD_FORWARD: {
786  Config::SetDefault("ns3::SatBbFrameConf::AcmEnabled", BooleanValue(false));
787  Config::SetDefault("ns3::SatBbFrameConf::DefaultModCod", StringValue("QPSK_1_TO_2"));
788  Config::SetDefault("ns3::SatRequestManager::CnoReportInterval", TimeValue(Seconds(100)));
789  break;
790  }
791  case SatEnums::LD_RETURN: {
792  Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(false));
793  Config::SetDefault("ns3::SatWaveformConf::DefaultWfId", UintegerValue(3));
794  break;
795  }
796  default: {
797  NS_FATAL_ERROR("Unsupported SatLinkDir_t!");
798  break;
799  }
800  }
801 }
802 
803 void
805 {
806  std::cout << "Progress: " << Simulator::Now().GetSeconds() << "/" << GetSimTime().GetSeconds()
807  << std::endl;
809  Simulator::Schedule(m_progressUpdateInterval, &SimulationHelper::ProgressCb, this);
810 }
811 
812 void
814 {
815  NS_ASSERT_MSG(m_satHelper != nullptr, "Satellite scenario not created yet!");
816 
817  if (!m_statContainer)
818  {
819  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
820  BooleanValue(true));
821  m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
822  }
823 
826 }
827 
828 void
830 {
831  NS_LOG_FUNCTION(this);
832 
833  if (!m_statContainer)
834  {
835  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
836  BooleanValue(true));
837  m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
838  }
839 
840  // Throughput
841  m_statContainer->AddAverageUtUserFwdAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
842  m_statContainer->AddAverageUtFwdUserPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
843  m_statContainer->AddAverageBeamFwdAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
844 
845  m_statContainer->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
846  m_statContainer->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
847  m_statContainer->AddGlobalFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
848  m_statContainer->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
849  m_statContainer->AddGlobalFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
850  m_statContainer->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
851  m_statContainer->AddGlobalFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
852  m_statContainer->AddGlobalFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
853  m_statContainer->AddGlobalFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
854  m_statContainer->AddGlobalFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
855 
856  m_statContainer->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
857  m_statContainer->AddPerBeamFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
858  m_statContainer->AddPerBeamFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
859  m_statContainer->AddPerBeamFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
860  m_statContainer->AddPerBeamFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
861  Config::SetDefault("ns3::SatStatsThroughputHelper::AveragingMode", BooleanValue(true));
862  m_statContainer->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
863  m_statContainer->AddPerBeamFwdFeederMacThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
864  m_statContainer->AddPerBeamFwdUserMacThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
865  m_statContainer->AddPerBeamFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
866  m_statContainer->AddPerBeamFwdUserPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
867 
868  // SINR
869  m_statContainer->AddGlobalFwdCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
870  m_statContainer->AddGlobalFwdCompositeSinr(SatStatsHelper::OUTPUT_SCATTER_FILE);
871 
872  // Delay
874  m_statContainer->AddGlobalFwdAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
875 
876  // Packet error
877  m_statContainer->AddGlobalFwdUserDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
878  m_statContainer->AddPerBeamFwdUserDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
879  m_statContainer->AddPerBeamRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
880  m_statContainer->AddPerBeamFeederCrdsaPacketCollision(SatStatsHelper::OUTPUT_SCALAR_FILE);
881  m_statContainer->AddPerBeamFeederCrdsaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
882  m_statContainer->AddPerBeamFeederSlottedAlohaPacketCollision(
884  m_statContainer->AddPerBeamFeederSlottedAlohaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
885 
886  // Marsala
887  m_statContainer->AddPerBeamMarsalaCorrelation(SatStatsHelper::OUTPUT_SCALAR_FILE);
888  m_statContainer->AddPerBeamMarsalaCorrelation(SatStatsHelper::OUTPUT_SCATTER_FILE);
889 
890  // Frame type usage
891  Config::SetDefault("ns3::SatStatsFrameTypeUsageHelper::Percentage", BooleanValue(true));
892  m_statContainer->AddGlobalFrameTypeUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
893  m_statContainer->AddPerGwFrameTypeUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
894  m_statContainer->AddPerBeamFrameTypeUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
895 
896  // Beam service time
897  m_statContainer->AddPerBeamBeamServiceTime(SatStatsHelper::OUTPUT_SCALAR_FILE);
898 }
899 
900 void
902 {
903  NS_LOG_FUNCTION(this);
904 
905  if (!m_statContainer)
906  {
907  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
908  BooleanValue(true));
909  m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
910  }
911 
912  // Throughput
913  m_statContainer->AddAverageUtUserRtnAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
914  m_statContainer->AddAverageUtRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
915  m_statContainer->AddAverageBeamRtnAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
916  m_statContainer->AddPerUtUserRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
917 
918  m_statContainer->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
919  m_statContainer->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
920  m_statContainer->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
921  m_statContainer->AddGlobalRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
922  m_statContainer->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
923  m_statContainer->AddGlobalRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
924  m_statContainer->AddGlobalRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
925  m_statContainer->AddGlobalRtnUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
926  m_statContainer->AddGlobalRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
927  m_statContainer->AddGlobalRtnUserPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
928 
929  m_statContainer->AddPerBeamRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
930  m_statContainer->AddPerBeamRtnFeederDevThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
931  m_statContainer->AddPerBeamRtnUserDevThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
932  m_statContainer->AddPerBeamRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
933  m_statContainer->AddPerBeamRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
934  m_statContainer->AddPerBeamRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
935  m_statContainer->AddPerBeamRtnUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
936 
937  // Granted resources
938  m_statContainer->AddGlobalResourcesGranted(SatStatsHelper::OUTPUT_SCATTER_FILE);
939  m_statContainer->AddGlobalResourcesGranted(SatStatsHelper::OUTPUT_SCALAR_FILE);
940  m_statContainer->AddGlobalResourcesGranted(SatStatsHelper::OUTPUT_CDF_FILE);
941  m_statContainer->AddPerBeamResourcesGranted(SatStatsHelper::OUTPUT_CDF_FILE);
942  m_statContainer->AddPerBeamResourcesGranted(SatStatsHelper::OUTPUT_CDF_PLOT);
943  m_statContainer->AddPerUtResourcesGranted(SatStatsHelper::OUTPUT_SCATTER_FILE);
944 
945  // Frame load
946  m_statContainer->AddGlobalFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
947  m_statContainer->AddPerBeamFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
948 
949  m_statContainer->AddGlobalRtnFeederLinkSinr(SatStatsHelper::OUTPUT_CDF_FILE);
950  m_statContainer->AddGlobalRtnUserLinkSinr(SatStatsHelper::OUTPUT_CDF_FILE);
951 
952  // SINR
953  m_statContainer->AddGlobalRtnCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
954  m_statContainer->AddGlobalRtnCompositeSinr(SatStatsHelper::OUTPUT_SCATTER_FILE);
955  m_statContainer->AddPerBeamRtnCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
956  m_statContainer->AddPerBeamRtnCompositeSinr(SatStatsHelper::OUTPUT_CDF_PLOT);
957 
958  // Delay
960  m_statContainer->AddGlobalRtnAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
961 
962  m_statContainer->AddPerBeamRtnAppDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
963  m_statContainer->AddPerBeamRtnDevDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
964  m_statContainer->AddPerBeamRtnPhyDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
965  m_statContainer->AddPerBeamRtnMacDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
966 
967  m_statContainer->AddPerBeamRtnAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
968  m_statContainer->AddPerBeamRtnDevDelay(SatStatsHelper::OUTPUT_CDF_FILE);
969  m_statContainer->AddPerBeamRtnPhyDelay(SatStatsHelper::OUTPUT_CDF_FILE);
970  m_statContainer->AddPerBeamRtnMacDelay(SatStatsHelper::OUTPUT_CDF_FILE);
971 
972  // Packet error
973  m_statContainer->AddGlobalRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
974  m_statContainer->AddPerBeamRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
975  m_statContainer->AddPerBeamFeederCrdsaPacketCollision(SatStatsHelper::OUTPUT_SCALAR_FILE);
976  m_statContainer->AddPerBeamFeederCrdsaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
977  m_statContainer->AddPerBeamFeederSlottedAlohaPacketCollision(
979  m_statContainer->AddPerBeamFeederSlottedAlohaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
980 
981  // Waveform
982  m_statContainer->AddPerBeamWaveformUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
983  m_statContainer->AddPerBeamFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
984 
985  // Capacity request
986  m_statContainer->AddPerUtCapacityRequest(SatStatsHelper::OUTPUT_SCATTER_FILE);
987  m_statContainer->AddPerBeamCapacityRequest(SatStatsHelper::OUTPUT_SCATTER_FILE);
988 }
989 
990 void
992 {
993  NS_LOG_FUNCTION(this << em << errorRate);
994 
995  Config::SetDefault("ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
996  Config::SetDefault("ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
997 
998  if (errorRate == SatPhyRxCarrierConf::EM_CONSTANT)
999  {
1000  Config::SetDefault("ns3::SatGwHelper::RtnLinkConstantErrorRate", DoubleValue(errorRate));
1001  Config::SetDefault("ns3::SatUtHelper::FwdLinkConstantErrorRate", DoubleValue(errorRate));
1002  }
1003 }
1004 
1005 void
1007  double constantIf)
1008 {
1009  NS_LOG_FUNCTION(this << ifModel << constantIf);
1010 
1011  Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel", EnumValue(ifModel));
1012  Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel", EnumValue(ifModel));
1013 
1014  if (ifModel == SatPhyRxCarrierConf::IF_CONSTANT)
1015  {
1016  Config::SetDefault("ns3::SatConstantInterference::ConstantInterferencePower",
1017  DoubleValue(constantIf));
1018  }
1019 }
1020 
1021 void
1022 SimulationHelper::ConfigureFrame(uint32_t superFrameId,
1023  double bw,
1024  double carrierBw,
1025  double rollOff,
1026  double carrierSpacing,
1027  bool isRandomAccess)
1028 {
1029  NS_LOG_FUNCTION(this << bw << carrierBw << rollOff << carrierSpacing << isRandomAccess);
1030 
1031  std::stringstream sfId, fId;
1032  sfId << superFrameId;
1034  std::string attributeDefault("ns3::SatSuperframeConf" + sfId.str() + "::Frame" + fId.str());
1035 
1036  Config::SetDefault(attributeDefault + "_AllocatedBandwidthHz", DoubleValue(bw));
1037  Config::SetDefault(attributeDefault + "_CarrierAllocatedBandwidthHz", DoubleValue(carrierBw));
1038  Config::SetDefault(attributeDefault + "_CarrierRollOff", DoubleValue(rollOff));
1039  Config::SetDefault(attributeDefault + "_CarrierSpacing", DoubleValue(carrierSpacing));
1040  Config::SetDefault(attributeDefault + "_RandomAccessFrame", BooleanValue(isRandomAccess));
1041 
1043 
1044  Config::SetDefault("ns3::SatSuperframeConf" + sfId.str() + "::FrameCount",
1045  UintegerValue(m_numberOfConfiguredFrames));
1046 }
1047 
1048 void
1050 {
1051  NS_LOG_FUNCTION(this);
1052 
1053  Config::SetDefault("ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(2e+09));
1054  Config::SetDefault("ns3::SatConf::FwdFeederLinkBaseFrequency", DoubleValue(2.75e+10));
1055  Config::SetDefault("ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(5e+08));
1056  Config::SetDefault("ns3::SatConf::FwdUserLinkBaseFrequency", DoubleValue(1.97e+10));
1057 
1058  Config::SetDefault("ns3::SatConf::RtnFeederLinkBandwidth", DoubleValue(2e+09));
1059  Config::SetDefault("ns3::SatConf::RtnFeederLinkBaseFrequency", DoubleValue(1.77e+10));
1060  Config::SetDefault("ns3::SatConf::RtnUserLinkBandwidth", DoubleValue(5e+08));
1061  Config::SetDefault("ns3::SatConf::RtnUserLinkBaseFrequency", DoubleValue(2.95e+10));
1062 
1063  Config::SetDefault("ns3::SatConf::FwdUserLinkChannels", UintegerValue(4));
1064  Config::SetDefault("ns3::SatConf::FwdFeederLinkChannels", UintegerValue(16));
1065  Config::SetDefault("ns3::SatConf::RtnUserLinkChannels", UintegerValue(4));
1066  Config::SetDefault("ns3::SatConf::RtnFeederLinkChannels", UintegerValue(16));
1067 
1068  Config::SetDefault("ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1.25e+08));
1069  Config::SetDefault("ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.2));
1070  Config::SetDefault("ns3::SatConf::FwdCarrierSpacing", DoubleValue(0.0));
1071 }
1072 
1073 void
1075 {
1076  NS_LOG_FUNCTION(this);
1077 
1078  // Enable flag
1079  Config::SetDefault("ns3::SatBeamHelper::EnableFwdLinkBeamHopping", BooleanValue(true));
1080 
1081  // Channel configuration for 500 MHz user link bandwidth
1082  Config::SetDefault("ns3::SatHelper::SatFwdConfFileName",
1083  StringValue("beamhopping/Scenario72FwdConf_BH.txt"));
1084 
1085  Config::SetDefault("ns3::SatBstpController::BeamHoppingMode",
1086  EnumValue(SatBstpController::BH_STATIC));
1087  Config::SetDefault("ns3::SatBstpController::StaticBeamHoppingConfigFileName",
1088  StringValue("beamhopping/SatBstpConf_GW1.txt"));
1089  Config::SetDefault("ns3::SatBstpController::SuperframeDuration", TimeValue(MilliSeconds(1)));
1090 
1091  // Frequency configuration for 500 MHz user link bandwidth
1092  Config::SetDefault("ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(2e+09));
1093  Config::SetDefault("ns3::SatConf::FwdFeederLinkBaseFrequency", DoubleValue(2.75e+10));
1094  Config::SetDefault("ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(5e+08));
1095  Config::SetDefault("ns3::SatConf::FwdUserLinkBaseFrequency", DoubleValue(1.97e+10));
1096 
1097  Config::SetDefault("ns3::SatConf::FwdUserLinkChannels", UintegerValue(1));
1098  Config::SetDefault("ns3::SatConf::FwdFeederLinkChannels", UintegerValue(4));
1099 
1100  Config::SetDefault("ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(5e+08));
1101  Config::SetDefault("ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.2));
1102  Config::SetDefault("ns3::SatConf::FwdCarrierSpacing", DoubleValue(0.0));
1103 }
1104 
1105 void
1107 {
1108  NS_LOG_FUNCTION(this);
1109 
1110  Config::SetDefault("ns3::SatPhyRxCarrier::EnableCompositeSinrOutputTrace", BooleanValue(true));
1111  Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
1112  Config::SetDefault("ns3::SatChannel::EnableRxPowerOutputTrace", BooleanValue(true));
1113  Config::SetDefault("ns3::SatChannel::EnableFadingOutputTrace", BooleanValue(true));
1114 }
1115 
1116 void
1118 {
1119  NS_LOG_FUNCTION(this);
1120 
1121  Config::SetDefault("ns3::SatGeoFeederPhy::RxTemperatureDbk", DoubleValue(28.4));
1122  Config::SetDefault("ns3::SatGeoFeederPhy::RxMaxAntennaGainDb", DoubleValue(54));
1123  Config::SetDefault("ns3::SatGeoFeederPhy::TxMaxAntennaGainDb", DoubleValue(54));
1124  Config::SetDefault("ns3::SatGeoFeederPhy::TxMaxPowerDbw", DoubleValue(-4.38));
1125  Config::SetDefault("ns3::SatGeoFeederPhy::TxOutputLossDb", DoubleValue(1.75));
1126  Config::SetDefault("ns3::SatGeoFeederPhy::TxPointingLossDb", DoubleValue(0));
1127  Config::SetDefault("ns3::SatGeoFeederPhy::TxOboLossDb", DoubleValue(4));
1128  Config::SetDefault("ns3::SatGeoFeederPhy::TxAntennaLossDb", DoubleValue(1));
1129  Config::SetDefault("ns3::SatGeoFeederPhy::RxAntennaLossDb", DoubleValue(1));
1130  Config::SetDefault("ns3::SatGeoFeederPhy::DefaultFadingValue", DoubleValue(1));
1131  Config::SetDefault("ns3::SatGeoFeederPhy::ExtNoisePowerDensityDbwhz", DoubleValue(-207));
1132  Config::SetDefault("ns3::SatGeoFeederPhy::ImIfCOverIDb", DoubleValue(27));
1133  Config::SetDefault("ns3::SatGeoFeederPhy::FixedAmplificationGainDb", DoubleValue(82));
1134  Config::SetDefault("ns3::SatGeoUserPhy::RxTemperatureDbk", DoubleValue(28.4));
1135  Config::SetDefault("ns3::SatGeoUserPhy::RxMaxAntennaGainDb", DoubleValue(54));
1136  Config::SetDefault("ns3::SatGeoUserPhy::TxMaxAntennaGainDb", DoubleValue(54));
1137  Config::SetDefault("ns3::SatGeoUserPhy::TxMaxPowerDbw", DoubleValue(15));
1138  Config::SetDefault("ns3::SatGeoUserPhy::TxOutputLossDb", DoubleValue(2.85));
1139  Config::SetDefault("ns3::SatGeoUserPhy::TxPointingLossDb", DoubleValue(0));
1140  Config::SetDefault("ns3::SatGeoUserPhy::TxOboLossDb", DoubleValue(0));
1141  Config::SetDefault("ns3::SatGeoUserPhy::TxAntennaLossDb", DoubleValue(1));
1142  Config::SetDefault("ns3::SatGeoUserPhy::RxAntennaLossDb", DoubleValue(1));
1143  Config::SetDefault("ns3::SatGeoUserPhy::DefaultFadingValue", DoubleValue(1));
1144  Config::SetDefault("ns3::SatGeoUserPhy::OtherSysIfCOverIDb", DoubleValue(27.5));
1145  Config::SetDefault("ns3::SatGeoUserPhy::AciIfCOverIDb", DoubleValue(17));
1146  Config::SetDefault("ns3::SatGwPhy::RxTemperatureDbk", DoubleValue(24.62));
1147  Config::SetDefault("ns3::SatGwPhy::RxMaxAntennaGainDb", DoubleValue(61.5));
1148  Config::SetDefault("ns3::SatGwPhy::TxMaxAntennaGainDb", DoubleValue(65.2));
1149  Config::SetDefault("ns3::SatGwPhy::TxMaxPowerDbw", DoubleValue(8.97));
1150  Config::SetDefault("ns3::SatGwPhy::TxOutputLossDb", DoubleValue(2));
1151  Config::SetDefault("ns3::SatGwPhy::TxPointingLossDb", DoubleValue(1.1));
1152  Config::SetDefault("ns3::SatGwPhy::TxOboLossDb", DoubleValue(6));
1153  Config::SetDefault("ns3::SatGwPhy::TxAntennaLossDb", DoubleValue(0));
1154  Config::SetDefault("ns3::SatGwPhy::RxAntennaLossDb", DoubleValue(0));
1155  Config::SetDefault("ns3::SatGwPhy::DefaultFadingValue", DoubleValue(1));
1156  Config::SetDefault("ns3::SatGwPhy::ImIfCOverIDb", DoubleValue(22));
1157  Config::SetDefault("ns3::SatGwPhy::AciIfWrtNoisePercent", DoubleValue(10));
1158  Config::SetDefault("ns3::SatUtPhy::RxTemperatureDbk", DoubleValue(24.6));
1159  Config::SetDefault("ns3::SatUtPhy::RxMaxAntennaGainDb", DoubleValue(44.6));
1160  Config::SetDefault("ns3::SatUtPhy::TxMaxAntennaGainDb", DoubleValue(45.2));
1161  Config::SetDefault("ns3::SatUtPhy::TxMaxPowerDbw", DoubleValue(4));
1162  Config::SetDefault("ns3::SatUtPhy::TxOutputLossDb", DoubleValue(0.5));
1163  Config::SetDefault("ns3::SatUtPhy::TxPointingLossDb", DoubleValue(1));
1164  Config::SetDefault("ns3::SatUtPhy::TxOboLossDb", DoubleValue(0.5));
1165  Config::SetDefault("ns3::SatUtPhy::TxAntennaLossDb", DoubleValue(1));
1166  Config::SetDefault("ns3::SatUtPhy::RxAntennaLossDb", DoubleValue(0));
1167  Config::SetDefault("ns3::SatUtPhy::DefaultFadingValue", DoubleValue(1));
1168  Config::SetDefault("ns3::SatUtPhy::OtherSysIfCOverIDb", DoubleValue(24.7));
1169 }
1170 
1171 void
1173 {
1174  NS_LOG_FUNCTION(this);
1175 
1176  Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_OFF));
1177 
1178  // Set index files defining external tracing input files for UTs
1179  // Given index files must locate in /satellite/data/ext-fadingtraces/input folder
1180  Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
1181  StringValue("BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
1182  Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
1183  StringValue("BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
1184 
1185  // Set external fading input trace container mode as list mode
1186  // Now external fading input file used for UT1 is input file defined in row one in set index
1187  // file, for UT2 second input file defined in row two in set index file etc. Position info in
1188  // index file is ignored by list mode
1189  Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtInputMode",
1190  StringValue("ListMode"));
1191 
1192  // enable/disable external fading input on SatChannel as user requests
1193  Config::SetDefault("ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(true));
1194 }
1195 
1196 void
1197 SimulationHelper::SetCommonUtPositionAllocator(Ptr<SatListPositionAllocator> posAllocator)
1198 {
1199  NS_LOG_FUNCTION(this);
1200  m_commonUtPositions = posAllocator;
1201 }
1202 
1203 void
1205  Ptr<SatListPositionAllocator> posAllocator)
1206 {
1207  NS_LOG_FUNCTION(this << beamId);
1208  m_utPositionsByBeam[beamId] = posAllocator;
1209 }
1210 
1211 void
1212 SimulationHelper::EnableUtListPositionsFromInputFile(std::string inputFile, bool checkBeams)
1213 {
1214  NS_LOG_FUNCTION(this << inputFile);
1215 
1216  // Set user specific UT position file (UserDefinedUtPos.txt) to be utilized by SatConf.
1217  // Given file must locate in /satellite/data folder
1218  //
1219  // This enables user defined positions used instead of default positions (default position file
1220  // UtPos.txt replaced),
1221  Config::SetDefault("ns3::SatConf::UtPositionInputFileName", StringValue(inputFile));
1223  m_inputFileUtPositionsCheckBeams = checkBeams;
1224 }
1225 
1226 Ptr<SatStatsHelperContainer>
1228 {
1229  NS_LOG_FUNCTION(this);
1230 
1231  if (!m_statContainer)
1232  {
1233  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
1234  BooleanValue(true));
1235  m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
1236  }
1237 
1238  return m_statContainer;
1239 }
1240 
1241 Ptr<SatTrafficHelper>
1243 {
1244  NS_LOG_FUNCTION(this);
1245 
1246  if (!m_trafficHelper)
1247  {
1248  m_trafficHelper =
1249  CreateObject<SatTrafficHelper>(GetSatelliteHelper(), GetStatisticsContainer());
1250  }
1251 
1252  return m_trafficHelper;
1253 }
1254 
1255 Ptr<SatGroupHelper>
1257 {
1258  NS_LOG_FUNCTION(this);
1259 
1260  if (!m_groupHelper)
1261  {
1262  m_groupHelper = CreateObject<SatGroupHelper>();
1263  }
1264 
1265  return m_groupHelper;
1266 }
1267 
1268 Ptr<SatCnoHelper>
1270 {
1271  NS_LOG_FUNCTION(this);
1272 
1273  if (!m_cnoHelper)
1274  {
1275  m_cnoHelper = CreateObject<SatCnoHelper>(m_satHelper);
1276  }
1277 
1278  return m_cnoHelper;
1279 }
1280 
1281 void
1283 {
1284  NS_LOG_FUNCTION(this);
1285  if (m_outputPath == "")
1286  {
1287  m_outputPath = Singleton<SatEnvVariables>::Get()->LocateDataDirectory() + "/sims/" +
1288  m_simulationName + "/";
1289  // Create the simulation campaign output directory in data/sims/
1290  if (!Singleton<SatEnvVariables>::Get()->IsValidDirectory(m_outputPath))
1291  {
1292  Singleton<SatEnvVariables>::Get()->CreateDirectory(m_outputPath);
1293  }
1294  if (m_simulationTag != "")
1295  {
1296  m_outputPath += m_simulationTag + "/";
1297  Config::SetDefault("ns3::SatEnvVariables::SimulationTag", StringValue(m_simulationTag));
1298 
1299  // Create the simulation output directory by tag name in
1300  // data/sims/simulation-campaign-directory/
1301  if (!Singleton<SatEnvVariables>::Get()->IsValidDirectory(m_outputPath))
1302  {
1303  Singleton<SatEnvVariables>::Get()->CreateDirectory(m_outputPath);
1304  }
1305  }
1306  }
1307  Singleton<SatEnvVariables>::Get()->SetOutputPath(m_outputPath);
1308 }
1309 
1310 Ptr<SatHelper>
1312  const std::string& mobileUtsFolder)
1313 {
1314  NS_LOG_FUNCTION(this);
1315 
1316  std::stringstream ss;
1317  ss << "Created scenario: " << std::endl;
1318 
1319  // Set final output path
1320  SetupOutputPath();
1321 
1322  m_satHelper = CreateObject<SatHelper>();
1323 
1324  m_satHelper->SetGroupHelper(
1325  GetGroupHelper()); // If not done in user scenario, group helper is created here
1326  Ptr<SatAntennaGainPatternContainer> antennaGainPatterns = m_satHelper->GetAntennaGainPatterns();
1327  m_satHelper->GetBeamHelper()->SetAntennaGainPatterns(antennaGainPatterns);
1328 
1329  // Set UT position allocators, if any
1330  if (!m_enableInputFileUtListPositions && !m_satHelper->IsSatConstellationEnabled())
1331  {
1332  if (m_commonUtPositions)
1333  {
1334  m_satHelper->SetCustomUtPositionAllocator(m_commonUtPositions);
1335  }
1336  for (auto it : m_utPositionsByBeam)
1337  {
1338  m_satHelper->SetUtPositionAllocatorForBeam(it.first, it.second);
1339  }
1340  }
1341 
1342  if (m_satHelper->IsSatConstellationEnabled())
1343  {
1345  for (uint32_t satId = 0; satId < m_satHelper->GeoSatNodes().GetN(); satId++)
1346  {
1347  // Set beamInfo to indicate enabled beams
1348  for (uint32_t i = 1; i <= m_satHelper->GetBeamCount(); i++)
1349  {
1350  if (IsBeamEnabled(i))
1351  {
1352  SatBeamUserInfo info;
1353  beamInfo.insert(std::make_pair(std::make_pair(satId, i), info));
1354  }
1355  }
1356  }
1357 
1358  m_satHelper->CreateConstellationScenario(
1359  beamInfo,
1360  MakeCallback(&SimulationHelper::GetNextUtUserCount, this));
1361  }
1362 
1363  // Determine scenario
1364  else if (scenario == SatHelper::NONE)
1365  {
1366  // Create beam scenario
1368 
1369  for (uint32_t i = 1; i <= m_satHelper->GetBeamCount(); i++)
1370  {
1371  if (IsBeamEnabled(i))
1372  {
1373  SatBeamUserInfo info;
1374  uint32_t utCount = GetNextUtCount(i);
1375 
1376  ss << " Beam " << i << ": UT count= " << utCount;
1377 
1378  for (uint32_t j = 1; j < utCount + 1; j++)
1379  {
1380  uint32_t utUserCount = GetNextUtUserCount();
1381  info.AppendUt(utUserCount);
1382  ss << ", " << j << ". UT user count= " << utUserCount;
1383  }
1384 
1385  beamInfo.insert(std::make_pair(std::make_pair(0, i), info));
1386 
1387  ss << std::endl;
1388  }
1389  }
1390 
1391  std::vector<std::pair<GeoCoordinate, uint32_t>> additionalNodesVector =
1392  m_groupHelper->GetAdditionalNodesPerBeam();
1393  std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>> additionalNodes;
1394  for (std::vector<std::pair<GeoCoordinate, uint32_t>>::iterator it =
1395  additionalNodesVector.begin();
1396  it != additionalNodesVector.end();
1397  it++)
1398  {
1399  uint32_t bestBeamId = antennaGainPatterns->GetBestBeamId(0, it->first, false);
1400  additionalNodes[bestBeamId].push_back(*it);
1401  }
1402 
1403  for (std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>>::iterator it =
1404  additionalNodes.begin();
1405  it != additionalNodes.end();
1406  it++)
1407  {
1408  if (!IsBeamEnabled(it->first))
1409  {
1410  NS_LOG_WARN("Beam ID " << it->first << " is not enabled, cannot add "
1411  << it->second.size() << " UTs from SatGroupHelper");
1412  std::cout << "Beam ID " << it->first << " is not enabled, cannot add "
1413  << it->second.size() << " UTs from SatGroupHelper" << std::endl;
1414  continue;
1415  }
1416  beamInfo[std::make_pair(0, it->first)].SetPositions(it->second);
1417  for (uint32_t i = 0; i < it->second.size(); i++)
1418  {
1419  beamInfo[std::make_pair(0, it->first)].AppendUt(GetNextUtUserCount());
1420  }
1421  }
1422 
1423  if (mobileUtsFolder != "")
1424  {
1425  m_satHelper->LoadMobileUTsFromFolder(0, mobileUtsFolder, m_utMobileUserCount);
1426  }
1427 
1428  // Now, create either a scenario based on list positions in input file
1429  // or create a generic scenario with UT positions configured by other ways..
1431  {
1432  m_satHelper->CreateUserDefinedScenarioFromListPositions(
1433  0,
1434  beamInfo,
1436  }
1437  else
1438  {
1439  m_satHelper->CreateUserDefinedScenario(beamInfo);
1440  }
1441  }
1442  else
1443  {
1444  m_satHelper->CreatePredefinedScenario(scenario);
1445  }
1446 
1447  NS_LOG_INFO(ss.str());
1448 
1449  m_groupHelper->Init(m_satHelper->UtNodes());
1450 
1451  return m_satHelper;
1452 }
1453 
1454 bool
1455 SimulationHelper::HasSinkInstalled(Ptr<Node> node, uint16_t port)
1456 {
1457  NS_LOG_FUNCTION(this << node->GetId() << port);
1458 
1459  for (uint32_t i = 0; i < node->GetNApplications(); i++)
1460  {
1461  auto sink = DynamicCast<PacketSink>(node->GetApplication(i));
1462  if (sink != NULL)
1463  {
1464  AddressValue av;
1465  sink->GetAttribute("Local", av);
1466  if (InetSocketAddress::ConvertFrom(av.Get()).GetPort() == port)
1467  {
1468  return true;
1469  }
1470  }
1471  }
1472  return false;
1473 }
1474 
1475 void
1477  TransportLayerProtocol_t protocol,
1478  TrafficDirection_t direction,
1479  Time startTime,
1480  Time stopTime,
1481  Time startDelay,
1482  double percentage)
1483 {
1484  NS_LOG_FUNCTION(this);
1485 
1486  std::string socketFactory =
1487  protocol == SimulationHelper::TCP ? "ns3::TcpSocketFactory" : "ns3::UdpSocketFactory";
1488 
1489  // get users
1490  NodeContainer utAllUsers = m_satHelper->GetUtUsers();
1491  NodeContainer gwUsers = m_satHelper->GetGwUsers();
1492  NS_ASSERT_MSG(m_gwUserId < gwUsers.GetN(),
1493  "The number of GW users configured was too low. " << m_gwUserId << " "
1494  << gwUsers.GetN());
1495 
1496  // Filter UT users to keep only a given percentage on which installing the application
1497  Ptr<UniformRandomVariable> rng = CreateObject<UniformRandomVariable>();
1498  NodeContainer utUsers;
1499  for (uint32_t i = 0; i < utAllUsers.GetN(); ++i)
1500  {
1501  if (rng->GetValue(0.0, 1.0) < percentage)
1502  {
1503  utUsers.Add(utAllUsers.Get(i));
1504  }
1505  }
1506 
1507  std::cout << "Installing traffic model on " << utUsers.GetN() << "/" << utAllUsers.GetN()
1508  << " UT users" << std::endl;
1509 
1510  switch (trafficModel)
1511  {
1512  case SimulationHelper::CBR: {
1513  uint16_t port = 9;
1514  InetSocketAddress gwUserAddr =
1515  InetSocketAddress(m_satHelper->GetUserAddress(gwUsers.Get(m_gwUserId)), port);
1516 
1517  PacketSinkHelper sinkHelper(socketFactory, Address());
1518  CbrHelper cbrHelper(socketFactory, Address());
1519  ApplicationContainer sinkContainer;
1520  ApplicationContainer cbrContainer;
1521  if (direction == SimulationHelper::RTN_LINK)
1522  {
1523  // create sink application on GW user
1524  if (!HasSinkInstalled(gwUsers.Get(m_gwUserId), port))
1525  {
1526  sinkHelper.SetAttribute("Local", AddressValue(Address(gwUserAddr)));
1527  sinkContainer.Add(sinkHelper.Install(gwUsers.Get(m_gwUserId)));
1528  }
1529 
1530  cbrHelper.SetAttribute("Remote", AddressValue(Address(gwUserAddr)));
1531 
1532  // create CBR applications on UT users
1533  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1534  {
1535  auto app = cbrHelper.Install(utUsers.Get(i)).Get(0);
1536  app->SetStartTime(startTime + (i + 1) * startDelay);
1537  cbrContainer.Add(app);
1538  }
1539  }
1540  else if (direction == SimulationHelper::FWD_LINK)
1541  {
1542  // create CBR applications on UT users
1543  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1544  {
1545  InetSocketAddress utUserAddr =
1546  InetSocketAddress(m_satHelper->GetUserAddress(utUsers.Get(i)), port);
1547  if (!HasSinkInstalled(utUsers.Get(i), port))
1548  {
1549  sinkHelper.SetAttribute("Local", AddressValue(Address(utUserAddr)));
1550  sinkContainer.Add(sinkHelper.Install(utUsers.Get(i)));
1551  }
1552 
1553  cbrHelper.SetAttribute("Remote", AddressValue(Address(utUserAddr)));
1554  auto app = cbrHelper.Install(gwUsers.Get(m_gwUserId)).Get(0);
1555  app->SetStartTime(startTime + (i + 1) * startDelay);
1556  cbrContainer.Add(app);
1557  }
1558  }
1559  sinkContainer.Start(startTime);
1560  sinkContainer.Stop(stopTime);
1561  }
1562  break;
1563 
1564  case SimulationHelper::ONOFF: {
1565  uint16_t port = 9;
1566  InetSocketAddress gwUserAddr =
1567  InetSocketAddress(m_satHelper->GetUserAddress(gwUsers.Get(m_gwUserId)), port);
1568 
1569  PacketSinkHelper sinkHelper(socketFactory, Address());
1570  SatOnOffHelper onOffHelper(socketFactory, Address());
1571  ApplicationContainer sinkContainer;
1572  ApplicationContainer onOffContainer;
1573  if (direction == SimulationHelper::RTN_LINK)
1574  {
1575  // create sink application on GW user
1576  if (!HasSinkInstalled(gwUsers.Get(m_gwUserId), port))
1577  {
1578  sinkHelper.SetAttribute("Local", AddressValue(Address(gwUserAddr)));
1579  sinkContainer.Add(sinkHelper.Install(gwUsers.Get(m_gwUserId)));
1580  }
1581 
1582  onOffHelper.SetAttribute("Remote", AddressValue(Address(gwUserAddr)));
1583 
1584  // create OnOff applications on UT users
1585  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1586  {
1587  auto app = onOffHelper.Install(utUsers.Get(i)).Get(0);
1588  app->SetStartTime(startTime + (i + 1) * startDelay);
1589  onOffContainer.Add(app);
1590  }
1591  }
1592  else if (direction == SimulationHelper::FWD_LINK)
1593  {
1594  // create OnOff applications on UT users
1595  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1596  {
1597  InetSocketAddress utUserAddr =
1598  InetSocketAddress(m_satHelper->GetUserAddress(utUsers.Get(i)), port);
1599 
1600  if (!HasSinkInstalled(utUsers.Get(i), port))
1601  {
1602  sinkHelper.SetAttribute("Local", AddressValue(Address(utUserAddr)));
1603  sinkContainer.Add(sinkHelper.Install(utUsers.Get(i)));
1604  }
1605 
1606  onOffHelper.SetAttribute("Remote", AddressValue(Address(utUserAddr)));
1607  auto app = onOffHelper.Install(gwUsers.Get(m_gwUserId)).Get(0);
1608  app->SetStartTime(startTime + (i + 1) * startDelay);
1609  onOffContainer.Add(app);
1610  }
1611  }
1612  sinkContainer.Start(startTime);
1613  sinkContainer.Stop(stopTime);
1614  }
1615  break;
1616 
1617  case SimulationHelper::HTTP: {
1618  ThreeGppHttpHelper httpHelper;
1619  // Since more content should be transferred from server to clients,
1620  // we call server behind GW and clients behind UTs scenario DOWNLINK
1621  if (direction == SimulationHelper::FWD_LINK)
1622  {
1623  auto apps = httpHelper.InstallUsingIpv4(gwUsers.Get(m_gwUserId), utUsers);
1624  for (uint32_t i = 1; i < apps.GetN(); i++)
1625  {
1626  apps.Get(i)->SetStartTime(startTime + (i + 1) * startDelay);
1627  }
1628  }
1629  // An unlikely, but possible scenario where a HTTP server
1630  // (e.g. web user interface of a device) is reachable only by satellite.
1631  // Note that parameters should be defined by user.
1632  // We also assume that a single gateway user accesses all HTTP servers.
1633  // Modify this if other scenarios are required.
1634  else if (direction == SimulationHelper::RTN_LINK)
1635  {
1636  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1637  {
1638  auto apps = httpHelper.InstallUsingIpv4(utUsers.Get(i), gwUsers.Get(m_gwUserId));
1639  apps.Get(1)->SetStartTime(startTime + (i + 1) * startDelay);
1640  }
1641  }
1642  httpHelper.GetServer().Start(startTime);
1643  httpHelper.GetServer().Stop(stopTime);
1644  }
1645  break;
1646 
1647  case SimulationHelper::NRTV: {
1648  NrtvHelper nrtvHelper(TypeId::LookupByName(socketFactory));
1649  // Since more content should be transferred from server to clients,
1650  // we call server behind GW and clients behind UTs scenario DOWNLINK
1651  if (direction == SimulationHelper::FWD_LINK)
1652  {
1653  auto apps = nrtvHelper.InstallUsingIpv4(gwUsers.Get(m_gwUserId), utUsers);
1654  for (uint32_t i = 1; i < apps.GetN(); i++)
1655  {
1656  apps.Get(i)->SetStartTime(startTime + (i + 1) * startDelay);
1657  }
1658  }
1659  // An unlikely, but possible scenario where an NRTV server
1660  // (e.g. video surveillance feed) is reachable only by satellite.
1661  // Note that parameters should be defined by user.
1662  // We also assume that a single gateway user accesses all NRTV servers.
1663  // Modify this if other scenarios are required.
1664  else if (direction == SimulationHelper::RTN_LINK)
1665  {
1666  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1667  {
1668  auto apps = nrtvHelper.InstallUsingIpv4(utUsers.Get(i), gwUsers.Get(m_gwUserId));
1669  apps.Get(1)->SetStartTime(startTime + (i + 1) * startDelay);
1670  }
1671  }
1672  nrtvHelper.GetServer().Start(startTime);
1673  nrtvHelper.GetServer().Stop(stopTime);
1674  }
1675  break;
1676 
1677  default:
1678  NS_FATAL_ERROR("Invalid traffic model");
1679  break;
1680  }
1681 }
1682 
1683 void
1685  Time interval,
1686  uint32_t packetSize,
1687  Time startTime,
1688  Time stopTime,
1689  Time startDelay)
1690 {
1691  NS_LOG_FUNCTION(this << trafficModel << interval << packetSize << startTime << stopTime);
1692 
1693  NodeContainer nodes = GetSatelliteHelper()->UtNodes();
1694  NodeContainer utUsers = m_satHelper->GetUtUsers();
1695  Ptr<Node> node;
1696 
1697  std::cout << "Installing Lora traffic model on " << nodes.GetN() << " UTs" << std::endl;
1698 
1699  switch (trafficModel)
1700  {
1702  for (uint32_t i = 0; i < nodes.GetN(); i++)
1703  {
1704  node = nodes.Get(i);
1705  Ptr<LoraPeriodicSender> app = Create<LoraPeriodicSender>();
1706 
1707  app->SetInterval(interval);
1708  NS_LOG_DEBUG("Created an application with interval = " << interval.GetHours()
1709  << " hours");
1710 
1711  app->SetStartTime(startTime + (i + 1) * startDelay);
1712  app->SetStopTime(stopTime);
1713  app->SetPacketSize(packetSize);
1714 
1715  app->SetNode(node);
1716  node->AddApplication(app);
1717  }
1718  break;
1719  }
1721  NodeContainer gwUsers = m_satHelper->GetGwUsers();
1722 
1723  uint16_t port = 9;
1724  InetSocketAddress gwUserAddr =
1725  InetSocketAddress(m_satHelper->GetUserAddress(gwUsers.Get(m_gwUserId)), port);
1726 
1727  PacketSinkHelper sinkHelper("ns3::UdpSocketFactory", Address());
1728  CbrHelper cbrHelper("ns3::UdpSocketFactory", Address());
1729  ApplicationContainer sinkContainer;
1730  ApplicationContainer cbrContainer;
1731 
1732  // create sink application on GW user
1733  if (!HasSinkInstalled(gwUsers.Get(m_gwUserId), port))
1734  {
1735  sinkHelper.SetAttribute("Local", AddressValue(Address(gwUserAddr)));
1736  sinkContainer.Add(sinkHelper.Install(gwUsers.Get(m_gwUserId)));
1737  }
1738 
1739  cbrHelper.SetAttribute("Remote", AddressValue(Address(gwUserAddr)));
1740 
1741  // create CBR applications on UT users
1742  for (uint32_t i = 0; i < utUsers.GetN(); i++)
1743  {
1744  auto app = cbrHelper.Install(utUsers.Get(i)).Get(0);
1745  app->SetStartTime(startTime + (i + 1) * startDelay);
1746  cbrContainer.Add(app);
1747  }
1748 
1749  sinkContainer.Start(startTime);
1750  sinkContainer.Stop(stopTime);
1751  break;
1752  }
1754  default:
1755  NS_FATAL_ERROR("Traffic Model for Lora not implemented yet");
1756  }
1757 }
1758 
1759 void
1761 {
1762  switch (crTxConf)
1763  {
1764  case CR_PERIODIC_CONTROL: {
1765  Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
1766  EnumValue(SatEnums::RA_MODEL_OFF));
1767  Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(true));
1768  break;
1769  }
1770  case CR_SLOTTED_ALOHA: {
1771  Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
1773  Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
1774  break;
1775  }
1776  case CR_CRDSA_LOOSE_RC_0: {
1777  Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
1778  EnumValue(SatEnums::RA_MODEL_CRDSA));
1779  Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
1780  Config::SetDefault("ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(false));
1781  break;
1782  }
1783  default: {
1784  NS_FATAL_ERROR("Unsupported crTxConf: " << crTxConf);
1785  break;
1786  }
1787  }
1788 }
1789 
1790 void
1791 SimulationHelper::SetBeams(const std::string& enabledBeams)
1792 {
1793  NS_LOG_FUNCTION(this << enabledBeams);
1794 
1795  m_enabledBeamsStr = enabledBeams;
1796  m_enabledBeams.clear();
1797  std::stringstream bss(enabledBeams);
1798 
1799  while (!bss.eof())
1800  {
1801  uint32_t beamId;
1802  bss >> beamId;
1803  if (bss.fail())
1804  {
1805  bss.clear();
1806  std::string garbage;
1807  bss >> garbage;
1808  }
1809  else
1810  {
1811  m_enabledBeams.insert(beamId);
1812  }
1813  }
1814 }
1815 
1816 void
1817 SimulationHelper::SetBeamSet(std::set<uint32_t> beamSet)
1818 {
1819  NS_LOG_FUNCTION(this);
1820 
1821  m_enabledBeams = beamSet;
1822  std::stringstream bss;
1823  for (auto beamId : beamSet)
1824  {
1825  bss << beamId << " ";
1826  }
1827  m_enabledBeamsStr = bss.str();
1828 }
1829 
1830 const std::set<uint32_t>&
1832 {
1833  NS_LOG_FUNCTION(this);
1834 
1835  return m_enabledBeams;
1836 }
1837 
1838 bool
1839 SimulationHelper::IsBeamEnabled(uint32_t beamId) const
1840 {
1841  NS_LOG_FUNCTION(this << beamId);
1842 
1843  bool beamEnabled = false;
1844 
1845  if (m_enabledBeams.find(beamId) != m_enabledBeams.end())
1846  {
1847  beamEnabled = true;
1848  }
1849 
1850  return beamEnabled;
1851 }
1852 
1853 uint32_t
1854 SimulationHelper::GetNextUtCount(uint32_t beamId) const
1855 {
1856  NS_LOG_FUNCTION(this << beamId);
1857 
1858  auto iter = m_utCount.find(beamId);
1859  if (iter != m_utCount.end())
1860  {
1861  return m_utCount.at(beamId)->GetInteger();
1862  }
1863 
1864  return m_utCount.at(0)->GetInteger();
1865 }
1866 
1867 void
1869 {
1870  NS_LOG_FUNCTION(this);
1871 
1872  NS_LOG_INFO("--- " << m_simulationName << "---");
1873  NS_LOG_INFO(" Simulation length: " << m_simTime.GetSeconds());
1874  NS_LOG_INFO(" Enabled beams: " << m_enabledBeamsStr);
1875  NS_LOG_INFO(" Number of UTs: " << m_satHelper->GetGwUsers().GetN());
1876  NS_LOG_INFO(" Number of end users: " << m_satHelper->GetUtUsers().GetN());
1877 
1878  Simulator::Stop(m_simTime);
1879  Simulator::Run();
1880 
1881  Simulator::Destroy();
1882 }
1883 
1884 void
1886 {
1887  NS_LOG_FUNCTION(this);
1888 
1890  {
1891  if (GetSimTime().GetSeconds() > 20)
1892  {
1893  m_progressUpdateInterval = Seconds(GetSimTime().GetSeconds() / 100);
1894  }
1895  else
1896  {
1897  m_progressUpdateInterval = Seconds(0.2);
1898  }
1900  Simulator::Schedule(m_progressUpdateInterval, &SimulationHelper::ProgressCb, this);
1901  m_progressLoggingEnabled = true;
1902  }
1903 }
1904 
1905 void
1907 {
1908  NS_LOG_FUNCTION(this);
1909 
1910  m_progressLoggingEnabled = false;
1911  m_progressReportEvent.Cancel();
1912 }
1913 
1914 void
1916  bool overrideManualConfiguration)
1917 {
1918  ReadInputAttributesFromFile(filePath);
1919  Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
1920 
1921  if (overrideManualConfiguration)
1922  {
1923  SetBeams(simulationConf->m_enabledBeams);
1924  SetUtCountPerBeam(simulationConf->m_utCount);
1925  SetUserCountPerUt(simulationConf->m_utUserCount);
1926  SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
1927  SetSimulationTime(simulationConf->m_simTime);
1928  }
1929 
1930  CreateSatScenario(SatHelper::NONE, simulationConf->m_mobileUtsFolder);
1931  if (simulationConf->m_activateProgressLogging)
1932  {
1934  }
1935 
1936  for (const auto& trafficModel : simulationConf->m_trafficModel)
1937  {
1938  TrafficModel_t modelName;
1939  if (trafficModel.first == "Cbr")
1940  {
1941  modelName = CBR;
1942  }
1943  else if (trafficModel.first == "OnOff")
1944  {
1945  modelName = ONOFF;
1946  }
1947  else if (trafficModel.first == "Http")
1948  {
1949  modelName = HTTP;
1950  }
1951  else if (trafficModel.first == "Nrtv")
1952  {
1953  modelName = NRTV;
1954  }
1955  else
1956  {
1957  NS_FATAL_ERROR("Unknown traffic model has been configured: " << trafficModel.first);
1958  }
1959 
1960  std::vector<SimulationHelper::TransportLayerProtocol_t> protocols;
1961  switch (trafficModel.second.m_protocol)
1962  {
1964  protocols.push_back(SimulationHelper::UDP);
1965  break;
1966  }
1968  protocols.push_back(SimulationHelper::TCP);
1969  break;
1970  }
1972  protocols.push_back(SimulationHelper::TCP);
1973  protocols.push_back(SimulationHelper::UDP);
1974  break;
1975  }
1976  default: {
1977  NS_FATAL_ERROR("Unknown traffic protocol");
1978  }
1979  }
1980 
1981  std::vector<SimulationHelper::TrafficDirection_t> directions;
1982  switch (trafficModel.second.m_direction)
1983  {
1985  directions.push_back(SimulationHelper::RTN_LINK);
1986  break;
1987  }
1989  directions.push_back(SimulationHelper::FWD_LINK);
1990  break;
1991  }
1993  directions.push_back(SimulationHelper::FWD_LINK);
1994  directions.push_back(SimulationHelper::RTN_LINK);
1995  break;
1996  }
1997  default: {
1998  NS_FATAL_ERROR("Unknown traffic protocol");
1999  }
2000  }
2001 
2002  if (trafficModel.second.m_percentage > 0.0)
2003  {
2004  Time startTime = trafficModel.second.m_startTime;
2005  if (startTime > m_simTime)
2006  {
2007  NS_FATAL_ERROR("Traffic model "
2008  << trafficModel.first
2009  << " configured to start after the simulation ended");
2010  }
2011 
2012  Time stopTime = trafficModel.second.m_stopTime;
2013  if (stopTime == Seconds(0))
2014  {
2015  stopTime = m_simTime + Seconds(1);
2016  }
2017  if (stopTime < startTime)
2018  {
2019  NS_FATAL_ERROR("Traffic model " << trafficModel.first
2020  << " configured to stop before it is started");
2021  }
2022 
2023  for (auto& protocol : protocols)
2024  {
2025  for (auto& direction : directions)
2026  {
2027  InstallTrafficModel(modelName,
2028  protocol,
2029  direction,
2030  startTime,
2031  stopTime,
2032  trafficModel.second.m_startDelay);
2033  }
2034  }
2035  }
2036  }
2037 
2038  if (simulationConf->m_activateStatistics)
2039  {
2041  }
2042 }
2043 
2044 void
2046 {
2047  NS_LOG_FUNCTION(this << filePath);
2048 
2049  // To read attributes from file
2050  Config::SetDefault("ns3::ConfigStore::Filename", StringValue(filePath));
2051  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Load"));
2052  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
2053  ConfigStore inputConfig;
2054  inputConfig.ConfigureDefaults();
2055 }
2056 
2057 std::string
2058 SimulationHelper::StoreAttributesToFile(std::string fileName, bool outputAttributes)
2059 {
2060  NS_LOG_FUNCTION(this);
2061 
2062  std::string outputPath;
2063  outputPath = Singleton<SatEnvVariables>::Get()->GetOutputPath();
2064 
2065  // Store set attribute values to XML output file
2066  Config::SetDefault("ns3::ConfigStore::Filename", StringValue(outputPath + "/" + fileName));
2067  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
2068  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
2069  ConfigStore outputConfig;
2070  outputConfig.ConfigureDefaults();
2071 
2072  if (outputAttributes)
2073  {
2074  outputConfig.ConfigureAttributes();
2075  }
2076 
2077  return outputPath;
2078 }
2079 
2080 } // namespace ns3
Class that holds information for each beam regarding UTs and their users camped in each beam.
void AppendUt(uint32_t userCount)
Appends new UT to end of the list with given user count for the appended UT.
SatLinkDir_t
Link direction used for packet tracing.
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
@ NONE
NONE Not used.
std::map< std::pair< uint32_t, uint32_t >, SatBeamUserInfo > BeamUserInfoMap_t
definition for beam map key is pair sat ID / beam ID and value is UT/user info.
A helper to make it easier to instantiate an ns3::SatOnOffApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::SatOnOffApplication on each node of the input container configured with all the attri...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
InterferenceModel
Interference model enum.
Ptr< RandomVariableStream > m_utCount
Ptr< RandomVariableStream > m_utUserCount
Ptr< RandomVariableStream > m_utMobileUserCount
TypeId GetInstanceTypeId(void) const
Derived from Object.
SimulationHelperConf()
Default constructor.
static TypeId GetTypeId(void)
Derived from Object.
virtual ~SimulationHelperConf()
Destructor.
A helper to make it easier to create example simulation cases.
uint32_t GetNextUtCount(uint32_t beamId=0) const
Get next UT count from internal random variable stream.
void EnableCrdsa()
Enable CRDSA random access.
Ptr< SatCnoHelper > m_cnoHelper
void ProgressCb()
Callback that prints simulation progress to stdout.
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction, Time startTime, Time stopTime, Time startDelay, double percentage)
Install simple traffic model from GW users to UT users or vice versa.
void SetErrorModel(SatPhyRxCarrierConf::ErrorModel em, double errorRate=0.0)
Set simulation error model.
Ptr< SatTrafficHelper > m_trafficHelper
void SetupOutputPath()
Check if output path has been set.
void SetUserCountPerMobileUt(uint32_t count)
Set user count per mobile UT.
void EnableAcm(SatEnums::SatLinkDir_t dir)
Enable ACM for a simulation direction.
Time & GetSimTime()
Get simulation time.
void DoDispose(void)
Disposing.
SimulationHelper()
Default constructor, which is not used.
void ConfigureFrequencyBands()
Configure the default setting for the forward and return link frequencies.
virtual ~SimulationHelper()
Destructor.
void DisableAcm(SatEnums::SatLinkDir_t dir)
Disable ACM for a simulation direction.
void ConfigureAttributesFromFile(std::string filePath, bool overrideManualConfiguration=true)
Configure this instance after reading input attributes from XML file.
std::map< uint32_t, Ptr< RandomVariableStream > > m_utCount
Ptr< SatCnoHelper > GetCnoHelper()
Get the C/N0 helper to customize C/N0 on some nodes.
void DisableProgressLogs()
Disables simulation progress logs.
void SetIdealPhyParameterization()
Set ideal channel/physical layer parameterization.
void DisableFca()
Disable free capacity allocation.
Ptr< SatHelper > m_satHelper
Ptr< SatHelper > CreateSatScenario(SatHelper::PreDefinedScenario_t scenario=SatHelper::NONE, const std::string &mobileUtsFolder="")
Create the satellite scenario.
void CreateDefaultRtnLinkStats()
Create stats collectors if needed and set default statistics settings for both RTN link.
Ptr< SatGroupHelper > m_groupHelper
Ptr< SatListPositionAllocator > m_commonUtPositions
void RunSimulation()
Run the simulation.
void SetSimulationTime(double seconds)
Set simulation time in seconds.
void EnableFca()
Enable free capacity allocation.
std::string StoreAttributesToFile(std::string fileName, bool outputAttributes=false)
Store all used attributes.
void SetCrTxConf(CrTxConf_t crTxConf)
void SetGwUserCount(uint32_t gwUserCount)
Set the number of GW users in the scenario.
void EnableOnlyConstantRate(uint32_t rcIndex, double rateKbps)
Enable only CRA for a given RC index.
void EnableExternalFadingInputTrace()
Enable external fading input.
void EnableOutputTraces()
Enable all output traces.
void ConfigureLinkBudget()
Configure all link budget related attributes.
void EnableSlottedAloha()
Enable slotted ALOHA random access.
void DisableAllCapacityAssignmentCategories()
Disable all capacity allocation categories: CRA/VBDC/RBDC.
void EnableArq(SatEnums::SatLinkDir_t dir)
Enable ARQ.
void ConfigureFrame(uint32_t superFrameId, double bw, double carrierBw, double rollOff, double carrierSpacing, bool isRandomAccess=false)
Configure a frame for a certain superframe id.
void EnableOnlyRbdc(uint32_t rcIndex)
Enable only RBDC for a given RC index.
void EnableOnlyVbdc(uint32_t rcIndex)
Enable only VBDC for a given RC index.
void SetUtPositionAllocatorForBeam(uint32_t beamId, Ptr< SatListPositionAllocator > posAllocator)
Set a list position allocator for UTs of a specific beam.
void SetUtCountPerBeam(uint32_t count)
Set UT count per beam.
void InstallLoraTrafficModel(LoraTrafficModel_t trafficModel, Time interval, uint32_t packetSize, Time startTime, Time stopTime, Time startDelay)
Ptr< SatHelper > GetSatelliteHelper()
If lower layer API access is required, use this to access SatHelper.
Ptr< SatTrafficHelper > GetTrafficHelper()
Get the traffic helper to create more complex traffics.
TypeId GetInstanceTypeId(void) const
Derived from Object.
void ReadInputAttributesFromFile(std::string filePath)
Read input attributes from XML file.
void CreateDefaultFwdLinkStats()
Create stats collectors if needed and set default statistics settings for both FWD link.
void DisableRandomAccess()
Disable random access.
void EnablePeriodicalControlSlots(Time periodicity)
Enable periodical control slots.
Ptr< SatStatsHelperContainer > GetStatisticsContainer()
Get the statistics container of this helper.
void EnableRandomAccess()
Enable random access.
void EnableUtListPositionsFromInputFile(std::string inputFile, bool checkBeams=true)
Enable reading UT list positions from input file.
std::set< uint32_t > m_enabledBeams
void SetUserCountPerUt(uint32_t count)
Set user count per UT.
void CreateDefaultStats()
Create stats collectors and set default statistics settings for both FWD and RTN links.
void SetOutputPath(std::string path)
Force a output file path to this simulation instead of default satellite/data/sims/.
uint32_t GetNextUtUserCount() const
Get next UT user count from internal random variable stream.
Ptr< SatGroupHelper > GetGroupHelper()
Get the group helper.
void SetInterferenceModel(SatPhyRxCarrierConf::InterferenceModel ifModel, double constantIf=0.0)
Set simulation interference model.
void SetBeams(const std::string &beamList)
Ptr< RandomVariableStream > m_utMobileUserCount
const std::set< uint32_t > & GetBeams()
Get enabled beams in integer format.
bool HasSinkInstalled(Ptr< Node > node, uint16_t port)
Check if node has a PacketSink installed at certain port.
std::map< uint32_t, Ptr< SatListPositionAllocator > > m_utPositionsByBeam
void EnableProgressLogs()
Enables simulation progress logging.
bool IsBeamEnabled(uint32_t beamId) const
Check if a beam is enabled.
void SetCommonUtPositionAllocator(Ptr< SatListPositionAllocator > posAllocator)
Set common UT position allocator for all beams.
void ConfigureFwdLinkBeamHopping()
Configure the beam hopping functionality for the FWD link.
void AddDefaultUiArguments(CommandLine &cmd)
Add default command line arguments for the simulation.
Ptr< SatStatsHelperContainer > m_statContainer
void SetOutputTag(std::string tag)
Set simulation output tag, which is the basename of the directory where output files are stored.
Ptr< RandomVariableStream > m_utUserCount
static TypeId GetTypeId(void)
Derived from Object.
void SetDefaultValues()
Set default values shared by all examples using SimulationHelper.
void SetBeamSet(std::set< uint32_t > beamSet)
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
#define SIM_ADD_TRAFFIC_MODEL_ATTRIBUTES(index, a1, a2, a3, a4, a5, a6)
SIM_ADD_TRAFFIC_MODEL_ATTRIBUTES macro helps defining specific attribute for traffic models in method...