Loading...
Searching...
No Matches
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
28
29#include "ns3/address.h"
30#include "ns3/cbr-helper.h"
31#include "ns3/config-store.h"
32#include "ns3/config.h"
33#include "ns3/enum.h"
34#include "ns3/log.h"
35#include "ns3/nrtv-helper.h"
36#include "ns3/packet-sink-helper.h"
37#include "ns3/packet-sink.h"
38#include "ns3/pointer.h"
39#include "ns3/random-variable-stream.h"
40#include "ns3/satellite-env-variables.h"
41#include "ns3/satellite-topology.h"
42#include "ns3/singleton.h"
43#include "ns3/string.h"
44#include "ns3/three-gpp-http-satellite-helper.h"
45#include "ns3/uinteger.h"
46
47#include <iostream>
48#include <map>
49#include <set>
50#include <sstream>
51#include <string>
52#include <utility>
53#include <vector>
54
55NS_LOG_COMPONENT_DEFINE("SimulationHelper");
56
57namespace ns3
58{
59
60NS_OBJECT_ENSURE_REGISTERED(SimulationHelperConf);
61
62TypeId
64{
65 static TypeId tid =
66 TypeId("ns3::SimulationHelperConf")
67 .SetParent<Object>()
68 .AddConstructor<SimulationHelperConf>()
69 .AddAttribute("SimTime",
70 "Simulation time",
71 TimeValue(Seconds(100)),
72 MakeTimeAccessor(&SimulationHelperConf::m_simTime),
73 MakeTimeChecker(Seconds(1)))
74 .AddAttribute("BeamsIDs",
75 "Enabled Beams IDs",
76 StringValue("10 11 12 23 24 25"),
77 MakeStringAccessor(&SimulationHelperConf::m_enabledBeams),
78 MakeStringChecker())
79 .AddAttribute("UserCountPerUt",
80 "Amount of user per User Terminal",
81 StringValue("ns3::ConstantRandomVariable[Constant=1]"),
82 MakePointerAccessor(&SimulationHelperConf::m_utUserCount),
83 MakePointerChecker<RandomVariableStream>())
84 .AddAttribute("UserCountPerMobileUt",
85 "Amount of user per mobile User Terminal",
86 StringValue("ns3::ConstantRandomVariable[Constant=1]"),
88 MakePointerChecker<RandomVariableStream>())
89 .AddAttribute("UtCountPerBeam",
90 "Amount of User Terminal associated to each Beam",
91 StringValue("ns3::ConstantRandomVariable[Constant=1]"),
92 MakePointerAccessor(&SimulationHelperConf::m_utCount),
93 MakePointerChecker<RandomVariableStream>())
94 .AddAttribute("ActivateStatistics",
95 "Enable outputing values from stats helpers",
96 BooleanValue(true),
98 MakeBooleanChecker())
99 .AddAttribute("ActivateProgressLogs",
100 "Enable outputing progress of the simulation",
101 BooleanValue(true),
103 MakeBooleanChecker())
104 .AddAttribute("MobileUtsFolder",
105 "Select the folder where mobile UTs traces should be found",
106 StringValue(SatEnvVariables::GetInstance()->LocateDataDirectory() +
107 "/utpositions/mobiles/"),
108 MakeStringAccessor(&SimulationHelperConf::m_mobileUtsFolder),
109 MakeStringChecker());
110
111 return tid;
112}
113
115 : m_simTime(0),
116 m_enabledBeams(""),
117 m_utCount(0),
118 m_utUserCount(0),
122{
123 NS_LOG_FUNCTION(this);
124}
125
127{
128 NS_LOG_FUNCTION(this);
129}
130
131NS_OBJECT_ENSURE_REGISTERED(SimulationHelper);
132
133TypeId
135{
136 static TypeId tid =
137 TypeId("ns3::SimulationHelper").SetParent<Object>().AddConstructor<SimulationHelper>();
138 return tid;
139}
140
142 : m_satHelper(nullptr),
143 m_statContainer(nullptr),
146 m_scenarioPath(""),
150 m_outputPath(""),
151 m_utCount(),
152 m_utUserCount(0),
154 m_simTime(0),
160 m_progressUpdateInterval(Seconds(0.5))
161{
162 NS_FATAL_ERROR(
163 "SimulationHelper: Default constructor not in use. Please create with simulation name. ");
164}
165
166SimulationHelper::SimulationHelper(std::string simulationName)
167 : m_satHelper(nullptr),
168 m_statContainer(nullptr),
174 m_outputPath(""),
175 m_utCount(),
176 m_utUserCount(0),
178 m_simTime(0),
184 m_progressUpdateInterval(Seconds(0.5))
185{
186 NS_LOG_FUNCTION(this << simulationName);
187
188 m_simulationName = simulationName;
189 Config::SetDefault("ns3::SatEnvVariables::SimulationCampaignName",
190 StringValue(m_simulationName));
191 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
192
193 // NCC configuration
194 Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType", StringValue("ConfigType_2"));
195 Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(true));
196
197 // RBDC
198 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
199 BooleanValue(false));
200 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed", BooleanValue(true));
201 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_MinimumServiceRate",
202 UintegerValue(16));
203 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
204 BooleanValue(false));
205}
206
208{
209 NS_LOG_FUNCTION(this);
210}
211
212void
214{
215 NS_LOG_FUNCTION(this);
216
217 m_commonUtPositions = nullptr;
218 m_utPositionsByBeam.clear();
219}
220
221void
223{
224 NS_LOG_FUNCTION(this << count);
225
226 Ptr<RandomVariableStream> utCount = CreateObject<ConstantRandomVariable>();
227 utCount->SetAttribute("Constant", DoubleValue(count));
228
229 m_utCount.insert(std::make_pair(0, utCount));
230}
231
232void
233SimulationHelper::SetUtCountPerBeam(Ptr<RandomVariableStream> rs)
234{
235 NS_LOG_FUNCTION(this << &rs);
236
237 m_utCount.insert(std::make_pair(0, rs));
238}
239
240void
241SimulationHelper::SetUtCountPerBeam(uint32_t beamId, uint32_t count)
242{
243 NS_LOG_FUNCTION(this << beamId << count);
244
245 Ptr<RandomVariableStream> utCount = CreateObject<ConstantRandomVariable>();
246 utCount->SetAttribute("Constant", DoubleValue(count));
247
248 m_utCount.insert(std::make_pair(beamId, utCount));
249}
250
251void
252SimulationHelper::SetUtCountPerBeam(uint32_t beamId, Ptr<RandomVariableStream> rs)
253{
254 NS_LOG_FUNCTION(this << &rs);
255
256 m_utCount.insert(std::make_pair(beamId, rs));
257}
258
259void
261{
262 NS_LOG_FUNCTION(this << count);
263
264 m_utUserCount = CreateObject<ConstantRandomVariable>();
265 m_utUserCount->SetAttribute("Constant", DoubleValue(count));
266}
267
268void
269SimulationHelper::SetUserCountPerUt(Ptr<RandomVariableStream> rs)
270{
271 NS_LOG_FUNCTION(this << &rs);
272
273 m_utUserCount = rs;
274}
275
276void
278{
279 NS_LOG_FUNCTION(this << count);
280
281 m_utMobileUserCount = CreateObject<ConstantRandomVariable>();
282 m_utMobileUserCount->SetAttribute("Constant", DoubleValue(count));
283}
284
285void
286SimulationHelper::SetUserCountPerMobileUt(Ptr<RandomVariableStream> rs)
287{
288 NS_LOG_FUNCTION(this << &rs);
289
291}
292
293void
295{
296 NS_LOG_FUNCTION(this << gwUserCount);
297
298 Config::SetDefault("ns3::SatHelper::GwUsers", UintegerValue(gwUserCount));
299}
300
301void
303{
304 NS_LOG_FUNCTION(this << seconds);
305
306 m_simTime = Seconds(seconds);
307}
308
309void
311{
312 NS_LOG_FUNCTION(this << tag);
313
314 // Set simulation output details
315 m_simulationTag = tag;
316}
317
318void
320{
321 NS_LOG_FUNCTION(this << path);
322
323 // Set simulation output details
324 m_outputPath = path;
325}
326
327void
328SimulationHelper::AddDefaultUiArguments(CommandLine& cmd, std::string& xmlInputFile)
329{
330 NS_LOG_FUNCTION(this);
331
333 cmd.AddValue("InputXml", "Input attributes in XML file", xmlInputFile);
334}
335
336void
338{
339 NS_LOG_FUNCTION(this);
340
341 // Create a customizable output path
342 cmd.AddValue("OutputPath", "Output path for storing the simulation statistics", m_outputPath);
343}
344
345void
347{
348 NS_LOG_FUNCTION(this);
349
351 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_OFF));
352
353 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0", StringValue("Configuration_0"));
354 Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType", StringValue("ConfigType_2"));
355 Config::SetDefault("ns3::SatSuperframeSeq::TargetDuration", TimeValue(MilliSeconds(100)));
356
357 Config::SetDefault("ns3::SatRequestManager::EvaluationInterval", TimeValue(MilliSeconds(100)));
358 Config::SetDefault("ns3::SatRequestManager::EnableOnDemandEvaluation", BooleanValue(false));
359
360 Config::SetDefault("ns3::SatBbFrameConf::BBFrameUsageMode", StringValue("NormalFrames"));
361
363 ConfigureFrame(0, 20e5, 5e5, 0.2, 0.3, false);
364
367
368 // ACM enabled
371
374
375 EnablePeriodicalControlSlots(MilliSeconds(100));
376
377 Config::SetDefault("ns3::SatUtHelper::EnableChannelEstimationError", BooleanValue(true));
378 Config::SetDefault("ns3::SatGwHelper::EnableChannelEstimationError", BooleanValue(true));
379
380 Config::SetDefault("ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled", BooleanValue(false));
381
382 Config::SetDefault("ns3::SatQueue::MaxPackets", UintegerValue(10000));
383}
384
385void
387{
388 NS_LOG_FUNCTION(this);
389
390 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaServiceCount", UintegerValue(4));
391 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
392 BooleanValue(false));
393 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
394 BooleanValue(false));
395 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
396 BooleanValue(false));
397 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
398 BooleanValue(false));
399 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
400 BooleanValue(false));
401 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
402 BooleanValue(false));
403 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
404 BooleanValue(false));
405 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
406 BooleanValue(false));
407 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
408 BooleanValue(false));
409 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
410 BooleanValue(false));
411 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
412 BooleanValue(false));
413 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
414 BooleanValue(false));
415}
416
417void
418SimulationHelper::EnableOnlyConstantRate(uint32_t rcIndex, double rateKbps)
419{
420 NS_LOG_FUNCTION(this << rcIndex << rateKbps);
421
422 std::stringstream ss;
423 ss << rcIndex;
424 std::string attributeDefault("ns3::SatLowerLayerServiceConf::DaService" + ss.str());
425
426 Config::SetDefault(attributeDefault + "_ConstantAssignmentProvided", BooleanValue(true));
427 Config::SetDefault(attributeDefault + "_RbdcAllowed", BooleanValue(false));
428 Config::SetDefault(attributeDefault + "_VolumeAllowed", BooleanValue(false));
429}
430
431void
433{
434 NS_LOG_FUNCTION(this << rcIndex);
435
436 std::stringstream ss;
437 ss << rcIndex;
438 std::string attributeDefault("ns3::SatLowerLayerServiceConf::DaService" + ss.str());
439
440 Config::SetDefault(attributeDefault + "_ConstantAssignmentProvided", BooleanValue(false));
441 Config::SetDefault(attributeDefault + "_RbdcAllowed", BooleanValue(true));
442 Config::SetDefault(attributeDefault + "_VolumeAllowed", BooleanValue(false));
443
444 Config::SetDefault("ns3::SatLowerLayerServiceConf::DynamicRatePersistence", UintegerValue(10));
445}
446
447void
449{
450 NS_LOG_FUNCTION(this << rcIndex);
451
452 std::stringstream ss;
453 ss << rcIndex;
454 std::string attributeDefault("ns3::SatLowerLayerServiceConf::DaService" + ss.str());
455
456 Config::SetDefault(attributeDefault + "_ConstantAssignmentProvided", BooleanValue(false));
457 Config::SetDefault(attributeDefault + "_RbdcAllowed", BooleanValue(false));
458 Config::SetDefault(attributeDefault + "_VolumeAllowed", BooleanValue(true));
459
460 Config::SetDefault("ns3::SatLowerLayerServiceConf::VolumeBacklogPersistence",
461 UintegerValue(10));
462}
463
464void
466{
467 NS_LOG_FUNCTION(this);
468
469 Config::SetDefault("ns3::SatSuperframeAllocator::FcaEnabled", BooleanValue(true));
470}
471
472void
474{
475 NS_LOG_FUNCTION(this);
476
477 Config::SetDefault("ns3::SatSuperframeAllocator::FcaEnabled", BooleanValue(false));
478}
479
480void
482{
483 NS_LOG_FUNCTION(this << periodicity.GetSeconds());
484
485 // Controls slots
486 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(true));
487 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotInterval", TimeValue(periodicity));
488}
489
490void
492{
493 NS_LOG_FUNCTION(this << dir);
494
495 switch (dir)
496 {
498 Config::SetDefault("ns3::SatLlc::FwdLinkArqEnabled", BooleanValue(true));
499
500 Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::MaxNoOfRetransmissions",
501 UintegerValue(2));
502 Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::RetransmissionTimer",
503 TimeValue(MilliSeconds(600)));
504 Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::WindowSize", UintegerValue(10));
505 Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::ArqHeaderSize", UintegerValue(1));
506 Config::SetDefault("ns3::SatGenericStreamEncapsulatorArq::RxWaitingTime",
507 TimeValue(Seconds(1.8)));
508 break;
509 }
510 case SatEnums::LD_RETURN: {
511 Config::SetDefault("ns3::SatLlc::RtnLinkArqEnabled", BooleanValue(true));
512
513 Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::MaxRtnArqSegmentSize",
514 UintegerValue(38));
515 Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::MaxNoOfRetransmissions",
516 UintegerValue(2));
517 Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::RetransmissionTimer",
518 TimeValue(MilliSeconds(600)));
519 Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::WindowSize", UintegerValue(10));
520 Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::ArqHeaderSize", UintegerValue(1));
521 Config::SetDefault("ns3::SatReturnLinkEncapsulatorArq::RxWaitingTime",
522 TimeValue(Seconds(1.8)));
523 break;
524 }
525 default: {
526 NS_FATAL_ERROR("Unsupported SatLinkDir_t!");
527 break;
528 }
529 }
530}
531
532void
534{
535 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_OFF));
536 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel",
538 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
540 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
542 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
543 BooleanValue(false));
544}
545
546void
548{
549 NS_LOG_FUNCTION(this);
550
551 if (m_randomAccessConfigured == true)
552 {
553 NS_FATAL_ERROR("Random access already configured!");
554 }
555
556 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
557 UintegerValue(1));
559}
560
561void
563{
564 NS_LOG_FUNCTION(this);
565
566 if (m_randomAccessConfigured == true)
567 {
568 NS_FATAL_ERROR("Random access already configured!");
569 }
570
571 Config::SetDefault("ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(false));
572 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
573 UintegerValue(3));
575}
576
577void
579{
580 NS_LOG_FUNCTION(this);
581
582 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
583
584 Config::SetDefault("ns3::SatLowerLayerServiceConf::DefaultControlRandomizationInterval",
585 TimeValue(MilliSeconds(100)));
586 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaServiceCount", UintegerValue(1));
587 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
589 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel",
591 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
593 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
595 Config::SetDefault("ns3::SatBeamHelper::RaConstantErrorRate", DoubleValue(0.0));
596
597 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
598 BooleanValue(false));
599 Config::SetDefault(
600 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
601 UintegerValue(10));
602
603 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
604 UintegerValue(3));
605 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
606 UintegerValue(6));
607 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
608 UintegerValue(2));
609 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
610 UintegerValue(50));
611 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
612 UintegerValue(1));
613 Config::SetDefault("ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
614 UintegerValue(1));
615 Config::SetDefault(
616 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
617 DoubleValue(0.99));
618
620
621 ConfigureFrame(0, 1.25e6, 1.25e6, 0.2, 0.3, true);
622}
623
624void
626{
627 NS_LOG_FUNCTION(this);
628
629 Config::SetDefault("ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(false));
630 Config::SetDefault("ns3::SatChannel::ForwardingMode", StringValue("OnlyDestNode"));
631 Config::SetDefault("ns3::SatChannel::RxPowerCalculationMode",
632 StringValue("RxPowerCalculation"));
633 Config::SetDefault("ns3::SatBeamHelper::FadingModel", StringValue("FadingOff"));
634 Config::SetDefault("ns3::SatUtHelper::EnableChannelEstimationError", BooleanValue(false));
635 Config::SetDefault("ns3::SatGwHelper::EnableChannelEstimationError", BooleanValue(false));
636 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel", StringValue("Constant"));
637 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
638 StringValue("Perfect"));
639 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
640 StringValue("RaCollisionNotDefined"));
641
644}
645
646void
648{
649 NS_LOG_FUNCTION(this << dir);
650
651 switch (dir)
652 {
654 Config::SetDefault("ns3::SatBbFrameConf::AcmEnabled", BooleanValue(true));
655 Config::SetDefault("ns3::SatBbFrameConf::DefaultModCod", StringValue("QPSK_1_TO_2"));
656 Config::SetDefault("ns3::SatRequestManager::CnoReportInterval", TimeValue(Seconds(0.1)));
657 Config::SetDefault("ns3::SatFwdLinkScheduler::CnoEstimationMode",
658 StringValue("AverageValueInWindow"));
659 Config::SetDefault("ns3::SatFwdLinkScheduler::CnoEstimationWindow", TimeValue(Seconds(2)));
660 break;
661 }
662 case SatEnums::LD_RETURN: {
663 Config::SetDefault("ns3::SatBeamScheduler::CnoEstimationMode",
664 StringValue("MinimumValueInWindow"));
665 Config::SetDefault("ns3::SatBeamScheduler::CnoEstimationWindow", TimeValue(Seconds(2)));
666 Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(true));
667 break;
668 }
669 default: {
670 NS_FATAL_ERROR("Unsupported SatLinkDir_t!");
671 break;
672 }
673 }
674}
675
676void
678{
679 NS_LOG_FUNCTION(this << dir);
680
681 switch (dir)
682 {
684 Config::SetDefault("ns3::SatBbFrameConf::AcmEnabled", BooleanValue(false));
685 Config::SetDefault("ns3::SatBbFrameConf::DefaultModCod", StringValue("QPSK_1_TO_2"));
686 Config::SetDefault("ns3::SatRequestManager::CnoReportInterval", TimeValue(Seconds(100)));
687 break;
688 }
689 case SatEnums::LD_RETURN: {
690 Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(false));
691 break;
692 }
693 default: {
694 NS_FATAL_ERROR("Unsupported SatLinkDir_t!");
695 break;
696 }
697 }
698}
699
700void
702{
703 std::cout << "Progress: " << Simulator::Now().GetSeconds() << "/" << GetSimTime().GetSeconds()
704 << std::endl;
706 Simulator::Schedule(m_progressUpdateInterval, &SimulationHelper::ProgressCb, this);
707}
708
709void
711{
712 NS_ASSERT_MSG(m_satHelper != nullptr, "Satellite scenario not created yet!");
713
714 if (!m_statContainer)
715 {
716 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
717 BooleanValue(true));
718 m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
719 }
720
723}
724
725void
727{
728 NS_LOG_FUNCTION(this);
729
730 if (!m_statContainer)
731 {
732 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
733 BooleanValue(true));
734 m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
735 }
736
737 // Throughput
738 m_statContainer->AddAverageUtUserFwdAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
739 m_statContainer->AddAverageUtFwdUserPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
740 m_statContainer->AddAverageBeamFwdAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
741
742 m_statContainer->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
743 m_statContainer->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
744 m_statContainer->AddGlobalFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
745 m_statContainer->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
746 m_statContainer->AddGlobalFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
747 m_statContainer->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
748 m_statContainer->AddGlobalFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
749 m_statContainer->AddGlobalFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
750 m_statContainer->AddGlobalFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
751 m_statContainer->AddGlobalFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
752
753 m_statContainer->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
754 m_statContainer->AddPerBeamFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
755 m_statContainer->AddPerBeamFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
756 m_statContainer->AddPerBeamFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
757 m_statContainer->AddPerBeamFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
758 Config::SetDefault("ns3::SatStatsThroughputHelper::AveragingMode", BooleanValue(true));
759 m_statContainer->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
760 m_statContainer->AddPerBeamFwdFeederMacThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
761 m_statContainer->AddPerBeamFwdUserMacThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
762 m_statContainer->AddPerBeamFwdFeederPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
763 m_statContainer->AddPerBeamFwdUserPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
764
765 // SINR
766 m_statContainer->AddGlobalFwdCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
767 m_statContainer->AddGlobalFwdCompositeSinr(SatStatsHelper::OUTPUT_SCATTER_FILE);
768
769 // Delay
772
773 // Packet error
774 m_statContainer->AddGlobalFwdUserDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
775 m_statContainer->AddPerBeamFwdUserDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
776 m_statContainer->AddPerBeamRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
777 m_statContainer->AddPerBeamFeederCrdsaPacketCollision(SatStatsHelper::OUTPUT_SCALAR_FILE);
778 m_statContainer->AddPerBeamFeederCrdsaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
779 m_statContainer->AddPerBeamFeederSlottedAlohaPacketCollision(
781 m_statContainer->AddPerBeamFeederSlottedAlohaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
782
783 // Marsala
784 m_statContainer->AddPerBeamMarsalaCorrelation(SatStatsHelper::OUTPUT_SCALAR_FILE);
785 m_statContainer->AddPerBeamMarsalaCorrelation(SatStatsHelper::OUTPUT_SCATTER_FILE);
786
787 // Frame type usage
788 Config::SetDefault("ns3::SatStatsFrameTypeUsageHelper::Percentage", BooleanValue(true));
789 m_statContainer->AddGlobalFrameTypeUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
791 m_statContainer->AddPerBeamFrameTypeUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
792
793 // Beam service time
794 m_statContainer->AddPerBeamBeamServiceTime(SatStatsHelper::OUTPUT_SCALAR_FILE);
795}
796
797void
799{
800 NS_LOG_FUNCTION(this);
801
802 if (!m_statContainer)
803 {
804 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
805 BooleanValue(true));
806 m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
807 }
808
809 // Throughput
810 m_statContainer->AddAverageUtUserRtnAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
811 m_statContainer->AddAverageUtRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
812 m_statContainer->AddAverageBeamRtnAppThroughput(SatStatsHelper::OUTPUT_CDF_FILE);
813 m_statContainer->AddPerUtUserRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
814
815 m_statContainer->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
816 m_statContainer->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
817 m_statContainer->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
818 m_statContainer->AddGlobalRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
819 m_statContainer->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
820 m_statContainer->AddGlobalRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
821 m_statContainer->AddGlobalRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
822 m_statContainer->AddGlobalRtnUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
823 m_statContainer->AddGlobalRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
824 m_statContainer->AddGlobalRtnUserPhyThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
825
826 m_statContainer->AddPerBeamRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
827 m_statContainer->AddPerBeamRtnFeederDevThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
828 m_statContainer->AddPerBeamRtnUserDevThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
829 m_statContainer->AddPerBeamRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
830 m_statContainer->AddPerBeamRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
831 m_statContainer->AddPerBeamRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
832 m_statContainer->AddPerBeamRtnUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
833
834 // Granted resources
835 m_statContainer->AddGlobalResourcesGranted(SatStatsHelper::OUTPUT_SCATTER_FILE);
836 m_statContainer->AddGlobalResourcesGranted(SatStatsHelper::OUTPUT_SCALAR_FILE);
837 m_statContainer->AddGlobalResourcesGranted(SatStatsHelper::OUTPUT_CDF_FILE);
838 m_statContainer->AddPerBeamResourcesGranted(SatStatsHelper::OUTPUT_CDF_FILE);
839 m_statContainer->AddPerBeamResourcesGranted(SatStatsHelper::OUTPUT_CDF_PLOT);
840 m_statContainer->AddPerUtResourcesGranted(SatStatsHelper::OUTPUT_SCATTER_FILE);
841
842 // Frame load
843 m_statContainer->AddGlobalFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
844 m_statContainer->AddPerBeamFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
845
846 m_statContainer->AddGlobalRtnFeederLinkSinr(SatStatsHelper::OUTPUT_CDF_FILE);
847 m_statContainer->AddGlobalRtnUserLinkSinr(SatStatsHelper::OUTPUT_CDF_FILE);
848
849 // SINR
850 m_statContainer->AddGlobalRtnCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
851 m_statContainer->AddGlobalRtnCompositeSinr(SatStatsHelper::OUTPUT_SCATTER_FILE);
852 m_statContainer->AddPerBeamRtnCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
853 m_statContainer->AddPerBeamRtnCompositeSinr(SatStatsHelper::OUTPUT_CDF_PLOT);
854
855 // Delay
858
863
864 m_statContainer->AddPerBeamRtnAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
865 m_statContainer->AddPerBeamRtnDevDelay(SatStatsHelper::OUTPUT_CDF_FILE);
866 m_statContainer->AddPerBeamRtnPhyDelay(SatStatsHelper::OUTPUT_CDF_FILE);
867 m_statContainer->AddPerBeamRtnMacDelay(SatStatsHelper::OUTPUT_CDF_FILE);
868
869 // Packet error
870 m_statContainer->AddGlobalRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
871 m_statContainer->AddPerBeamRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
872 m_statContainer->AddPerBeamFeederCrdsaPacketCollision(SatStatsHelper::OUTPUT_SCALAR_FILE);
873 m_statContainer->AddPerBeamFeederCrdsaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
874 m_statContainer->AddPerBeamFeederSlottedAlohaPacketCollision(
876 m_statContainer->AddPerBeamFeederSlottedAlohaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
877
878 // Waveform
879 m_statContainer->AddPerBeamWaveformUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
880 m_statContainer->AddPerBeamFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
881
882 // Capacity request
884 m_statContainer->AddPerBeamCapacityRequest(SatStatsHelper::OUTPUT_SCATTER_FILE);
885}
886
887void
889{
890 NS_LOG_FUNCTION(this << em << errorRate);
891
892 Config::SetDefault("ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
893 Config::SetDefault("ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
894
896 {
897 Config::SetDefault("ns3::SatGwHelper::RtnLinkConstantErrorRate", DoubleValue(errorRate));
898 Config::SetDefault("ns3::SatUtHelper::FwdLinkConstantErrorRate", DoubleValue(errorRate));
899 }
900}
901
902void
904 double constantIf)
905{
906 NS_LOG_FUNCTION(this << ifModel << constantIf);
907
908 Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel", EnumValue(ifModel));
909 Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel", EnumValue(ifModel));
910
912 {
913 Config::SetDefault("ns3::SatConstantInterference::ConstantInterferencePower",
914 DoubleValue(constantIf));
915 }
916}
917
918void
920 double bw,
921 double carrierBw,
922 double rollOff,
923 double carrierSpacing,
924 bool isRandomAccess)
925{
926 NS_LOG_FUNCTION(this << bw << carrierBw << rollOff << carrierSpacing << isRandomAccess);
927
928 std::stringstream sfId, fId;
929 sfId << superFrameId;
931 std::string attributeDefault("ns3::SatSuperframeConf" + sfId.str() + "::Frame" + fId.str());
932
933 Config::SetDefault(attributeDefault + "_AllocatedBandwidthHz", DoubleValue(bw));
934 Config::SetDefault(attributeDefault + "_CarrierAllocatedBandwidthHz", DoubleValue(carrierBw));
935 Config::SetDefault(attributeDefault + "_CarrierRollOff", DoubleValue(rollOff));
936 Config::SetDefault(attributeDefault + "_CarrierSpacing", DoubleValue(carrierSpacing));
937 Config::SetDefault(attributeDefault + "_RandomAccessFrame", BooleanValue(isRandomAccess));
938
940
941 Config::SetDefault("ns3::SatSuperframeConf" + sfId.str() + "::FrameCount",
942 UintegerValue(m_numberOfConfiguredFrames));
943}
944
945void
947{
948 NS_LOG_FUNCTION(this);
949
950 Config::SetDefault("ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(2e+09));
951 Config::SetDefault("ns3::SatConf::FwdFeederLinkBaseFrequency", DoubleValue(2.75e+10));
952 Config::SetDefault("ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(5e+08));
953 Config::SetDefault("ns3::SatConf::FwdUserLinkBaseFrequency", DoubleValue(1.97e+10));
954
955 Config::SetDefault("ns3::SatConf::RtnFeederLinkBandwidth", DoubleValue(2e+09));
956 Config::SetDefault("ns3::SatConf::RtnFeederLinkBaseFrequency", DoubleValue(1.77e+10));
957 Config::SetDefault("ns3::SatConf::RtnUserLinkBandwidth", DoubleValue(5e+08));
958 Config::SetDefault("ns3::SatConf::RtnUserLinkBaseFrequency", DoubleValue(2.95e+10));
959
960 Config::SetDefault("ns3::SatConf::FwdUserLinkChannels", UintegerValue(4));
961 Config::SetDefault("ns3::SatConf::FwdFeederLinkChannels", UintegerValue(16));
962 Config::SetDefault("ns3::SatConf::RtnUserLinkChannels", UintegerValue(4));
963 Config::SetDefault("ns3::SatConf::RtnFeederLinkChannels", UintegerValue(16));
964
965 Config::SetDefault("ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1.25e+08));
966 Config::SetDefault("ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.2));
967 Config::SetDefault("ns3::SatConf::FwdCarrierSpacing", DoubleValue(0.0));
968}
969
970void
972{
973 NS_LOG_FUNCTION(this);
974
975 // Enable flag
976 Config::SetDefault("ns3::SatBeamHelper::EnableFwdLinkBeamHopping", BooleanValue(true));
977
978 Config::SetDefault("ns3::SatBstpController::BeamHoppingMode",
980 Config::SetDefault("ns3::SatBstpController::StaticBeamHoppingConfigFileName",
981 StringValue(m_scenarioPath + "/beamhopping/SatBstpConf_GW1.txt"));
982 Config::SetDefault("ns3::SatBstpController::SuperframeDuration", TimeValue(MilliSeconds(1)));
983
984 // Frequency configuration for 500 MHz user link bandwidth
985 Config::SetDefault("ns3::SatConf::FwdFeederLinkBandwidth", DoubleValue(2e+09));
986 Config::SetDefault("ns3::SatConf::FwdFeederLinkBaseFrequency", DoubleValue(2.75e+10));
987 Config::SetDefault("ns3::SatConf::FwdUserLinkBandwidth", DoubleValue(5e+08));
988 Config::SetDefault("ns3::SatConf::FwdUserLinkBaseFrequency", DoubleValue(1.97e+10));
989
990 Config::SetDefault("ns3::SatConf::FwdUserLinkChannels", UintegerValue(1));
991 Config::SetDefault("ns3::SatConf::FwdFeederLinkChannels", UintegerValue(4));
992
993 Config::SetDefault("ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(5e+08));
994 Config::SetDefault("ns3::SatConf::FwdCarrierRollOff", DoubleValue(0.2));
995 Config::SetDefault("ns3::SatConf::FwdCarrierSpacing", DoubleValue(0.0));
996}
997
998void
1000{
1001 NS_LOG_FUNCTION(this);
1002
1003 Config::SetDefault("ns3::SatPhyRxCarrier::EnableCompositeSinrOutputTrace", BooleanValue(true));
1004 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
1005 Config::SetDefault("ns3::SatChannel::EnableRxPowerOutputTrace", BooleanValue(true));
1006 Config::SetDefault("ns3::SatChannel::EnableFadingOutputTrace", BooleanValue(true));
1007}
1008
1009void
1011{
1012 NS_LOG_FUNCTION(this);
1013
1014 Config::SetDefault("ns3::SatOrbiterFeederPhy::RxTemperatureDbk", DoubleValue(28.4));
1015 Config::SetDefault("ns3::SatOrbiterFeederPhy::RxMaxAntennaGainDb", DoubleValue(54));
1016 Config::SetDefault("ns3::SatOrbiterFeederPhy::TxMaxAntennaGainDb", DoubleValue(54));
1017 Config::SetDefault("ns3::SatOrbiterFeederPhy::TxMaxPowerDbw", DoubleValue(-4.38));
1018 Config::SetDefault("ns3::SatOrbiterFeederPhy::TxOutputLossDb", DoubleValue(1.75));
1019 Config::SetDefault("ns3::SatOrbiterFeederPhy::TxPointingLossDb", DoubleValue(0));
1020 Config::SetDefault("ns3::SatOrbiterFeederPhy::TxOboLossDb", DoubleValue(4));
1021 Config::SetDefault("ns3::SatOrbiterFeederPhy::TxAntennaLossDb", DoubleValue(1));
1022 Config::SetDefault("ns3::SatOrbiterFeederPhy::RxAntennaLossDb", DoubleValue(1));
1023 Config::SetDefault("ns3::SatOrbiterFeederPhy::DefaultFadingValue", DoubleValue(1));
1024 Config::SetDefault("ns3::SatOrbiterFeederPhy::ExtNoisePowerDensityDbwhz", DoubleValue(-207));
1025 Config::SetDefault("ns3::SatOrbiterFeederPhy::ImIfCOverIDb", DoubleValue(27));
1026 Config::SetDefault("ns3::SatOrbiterFeederPhy::FixedAmplificationGainDb", DoubleValue(82));
1027 Config::SetDefault("ns3::SatOrbiterUserPhy::RxTemperatureDbk", DoubleValue(28.4));
1028 Config::SetDefault("ns3::SatOrbiterUserPhy::RxMaxAntennaGainDb", DoubleValue(54));
1029 Config::SetDefault("ns3::SatOrbiterUserPhy::TxMaxAntennaGainDb", DoubleValue(54));
1030 Config::SetDefault("ns3::SatOrbiterUserPhy::TxMaxPowerDbw", DoubleValue(15));
1031 Config::SetDefault("ns3::SatOrbiterUserPhy::TxOutputLossDb", DoubleValue(2.85));
1032 Config::SetDefault("ns3::SatOrbiterUserPhy::TxPointingLossDb", DoubleValue(0));
1033 Config::SetDefault("ns3::SatOrbiterUserPhy::TxOboLossDb", DoubleValue(0));
1034 Config::SetDefault("ns3::SatOrbiterUserPhy::TxAntennaLossDb", DoubleValue(1));
1035 Config::SetDefault("ns3::SatOrbiterUserPhy::RxAntennaLossDb", DoubleValue(1));
1036 Config::SetDefault("ns3::SatOrbiterUserPhy::DefaultFadingValue", DoubleValue(1));
1037 Config::SetDefault("ns3::SatOrbiterUserPhy::OtherSysIfCOverIDb", DoubleValue(27.5));
1038 Config::SetDefault("ns3::SatOrbiterUserPhy::AciIfCOverIDb", DoubleValue(17));
1039 Config::SetDefault("ns3::SatGwPhy::RxTemperatureDbk", DoubleValue(24.62));
1040 Config::SetDefault("ns3::SatGwPhy::RxMaxAntennaGainDb", DoubleValue(61.5));
1041 Config::SetDefault("ns3::SatGwPhy::TxMaxAntennaGainDb", DoubleValue(65.2));
1042 Config::SetDefault("ns3::SatGwPhy::TxMaxPowerDbw", DoubleValue(8.97));
1043 Config::SetDefault("ns3::SatGwPhy::TxOutputLossDb", DoubleValue(2));
1044 Config::SetDefault("ns3::SatGwPhy::TxPointingLossDb", DoubleValue(1.1));
1045 Config::SetDefault("ns3::SatGwPhy::TxOboLossDb", DoubleValue(6));
1046 Config::SetDefault("ns3::SatGwPhy::TxAntennaLossDb", DoubleValue(0));
1047 Config::SetDefault("ns3::SatGwPhy::RxAntennaLossDb", DoubleValue(0));
1048 Config::SetDefault("ns3::SatGwPhy::DefaultFadingValue", DoubleValue(1));
1049 Config::SetDefault("ns3::SatGwPhy::ImIfCOverIDb", DoubleValue(22));
1050 Config::SetDefault("ns3::SatGwPhy::AciIfWrtNoisePercent", DoubleValue(10));
1051 Config::SetDefault("ns3::SatUtPhy::RxTemperatureDbk", DoubleValue(24.6));
1052 Config::SetDefault("ns3::SatUtPhy::RxMaxAntennaGainDb", DoubleValue(44.6));
1053 Config::SetDefault("ns3::SatUtPhy::TxMaxAntennaGainDb", DoubleValue(45.2));
1054 Config::SetDefault("ns3::SatUtPhy::TxMaxPowerDbw", DoubleValue(4));
1055 Config::SetDefault("ns3::SatUtPhy::TxOutputLossDb", DoubleValue(0.5));
1056 Config::SetDefault("ns3::SatUtPhy::TxPointingLossDb", DoubleValue(1));
1057 Config::SetDefault("ns3::SatUtPhy::TxOboLossDb", DoubleValue(0.5));
1058 Config::SetDefault("ns3::SatUtPhy::TxAntennaLossDb", DoubleValue(1));
1059 Config::SetDefault("ns3::SatUtPhy::RxAntennaLossDb", DoubleValue(0));
1060 Config::SetDefault("ns3::SatUtPhy::DefaultFadingValue", DoubleValue(1));
1061 Config::SetDefault("ns3::SatUtPhy::OtherSysIfCOverIDb", DoubleValue(24.7));
1062}
1063
1064void
1066{
1067 NS_LOG_FUNCTION(this);
1068
1069 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_OFF));
1070
1071 // Set index files defining external tracing input files for UTs
1072 // Given index files must locate in /satellite/data/ext-fadingtraces/input folder
1073 Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
1074 StringValue("BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
1075 Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
1076 StringValue("BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
1077
1078 // Set external fading input trace container mode as list mode
1079 // Now external fading input file used for UT1 is input file defined in row one in set index
1080 // file, for UT2 second input file defined in row two in set index file etc. Position info in
1081 // index file is ignored by list mode
1082 Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtInputMode",
1083 StringValue("ListMode"));
1084
1085 // enable/disable external fading input on SatChannel as user requests
1086 Config::SetDefault("ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(true));
1087}
1088
1089void
1090SimulationHelper::SetCommonUtPositionAllocator(Ptr<SatListPositionAllocator> posAllocator)
1091{
1092 NS_LOG_FUNCTION(this);
1093 m_commonUtPositions = posAllocator;
1094}
1095
1096void
1098 Ptr<SatListPositionAllocator> posAllocator)
1099{
1100 NS_LOG_FUNCTION(this << beamId);
1101 m_utPositionsByBeam[beamId] = posAllocator;
1102}
1103
1104void
1105SimulationHelper::EnableUtListPositionsFromInputFile(std::string inputFile, bool checkBeams)
1106{
1107 NS_LOG_FUNCTION(this << inputFile);
1108
1109 m_inputFileUtListPositions = inputFile;
1111}
1112
1113Ptr<SatStatsHelperContainer>
1115{
1116 NS_LOG_FUNCTION(this);
1117
1118 if (!m_statContainer)
1119 {
1120 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite",
1121 BooleanValue(true));
1122 m_statContainer = CreateObject<SatStatsHelperContainer>(m_satHelper);
1123 }
1124
1125 return m_statContainer;
1126}
1127
1128Ptr<SatTrafficHelper>
1130{
1131 NS_LOG_FUNCTION(this);
1132
1133 if (!m_trafficHelper)
1134 {
1136 CreateObject<SatTrafficHelper>(GetSatelliteHelper(), GetStatisticsContainer());
1137 }
1138
1139 return m_trafficHelper;
1140}
1141
1142Ptr<SatGroupHelper>
1144{
1145 NS_LOG_FUNCTION(this);
1146
1147 if (!m_groupHelper)
1148 {
1149 m_groupHelper = CreateObject<SatGroupHelper>();
1150 }
1151
1152 return m_groupHelper;
1153}
1154
1155Ptr<SatCnoHelper>
1157{
1158 NS_LOG_FUNCTION(this);
1159
1160 if (!m_cnoHelper)
1161 {
1162 m_cnoHelper = CreateObject<SatCnoHelper>(m_satHelper);
1163 }
1164
1165 return m_cnoHelper;
1166}
1167
1168void
1170{
1171 NS_LOG_FUNCTION(this);
1172 if (m_outputPath == "")
1173 {
1174 m_outputPath = SatEnvVariables::GetInstance()->LocateDataDirectory() + "/sims/" +
1175 m_simulationName + "/";
1176 // Create the simulation campaign output directory in data/sims/
1177 if (!SatEnvVariables::GetInstance()->IsValidDirectory(m_outputPath))
1178 {
1179 SatEnvVariables::GetInstance()->CreateDirectory(m_outputPath);
1180 }
1181 if (m_simulationTag != "")
1182 {
1184 Config::SetDefault("ns3::SatEnvVariables::SimulationTag", StringValue(m_simulationTag));
1185
1186 // Create the simulation output directory by tag name in
1187 // data/sims/simulation-campaign-directory/
1188 if (!SatEnvVariables::GetInstance()->IsValidDirectory(m_outputPath))
1189 {
1190 SatEnvVariables::GetInstance()->CreateDirectory(m_outputPath);
1191 }
1192 }
1193 }
1195}
1196
1197Ptr<SatHelper>
1199 const std::string& mobileUtsFolder)
1200{
1201 NS_LOG_FUNCTION(this);
1202
1203 std::stringstream ss;
1204 ss << "Created scenario: " << std::endl;
1205
1206 // Set final output path
1208
1209 if (m_scenarioPath == "")
1210 {
1211 NS_FATAL_ERROR("Must specify a scenario folder name from data submodule");
1212 }
1213
1214 if (SatEnvVariables::GetInstance()->IsValidDirectory(m_scenarioPath + "/beamhopping"))
1215 {
1217 }
1218
1219 m_satHelper = CreateObject<SatHelper>(m_scenarioPath);
1220
1222
1223 m_satHelper->SetGroupHelper(
1224 GetGroupHelper()); // If not done in user scenario, group helper is created here
1225 Ptr<SatAntennaGainPatternContainer> antennaGainPatterns = m_satHelper->GetAntennaGainPatterns();
1226 m_satHelper->GetBeamHelper()->SetAntennaGainPatterns(antennaGainPatterns);
1227
1228 // Set UT position allocators, if any
1229 if (m_inputFileUtListPositions == "" && !m_satHelper->IsSatConstellationEnabled())
1230 {
1232 {
1233 m_satHelper->SetCustomUtPositionAllocator(m_commonUtPositions);
1234 }
1235 for (auto it : m_utPositionsByBeam)
1236 {
1237 m_satHelper->SetUtPositionAllocatorForBeam(it.first, it.second);
1238 }
1239 }
1240
1241 // Determine scenario
1242 if (m_satHelper->IsSatConstellationEnabled())
1243 {
1245 switch (scenario)
1246 {
1247 case SatHelper::NONE: {
1248 for (uint32_t satId = 0; satId < Singleton<SatTopology>::Get()->GetNOrbiterNodes();
1249 satId++)
1250 {
1251 // Set beamInfo to indicate enabled beams
1252 for (uint32_t i = 1; i <= m_satHelper->GetBeamCount(); i++)
1253 {
1254 if (IsBeamEnabled(i))
1255 {
1256 SatBeamUserInfo info;
1257 beamInfo.insert(std::make_pair(std::make_pair(satId, i), info));
1258 }
1259 }
1260 }
1261 break;
1262 }
1263 case SatHelper::FULL: {
1264 for (uint32_t satId = 0; satId < Singleton<SatTopology>::Get()->GetNOrbiterNodes();
1265 satId++)
1266 {
1267 // Set beamInfo to indicate enabled beams
1268 for (uint32_t i = 1; i <= m_satHelper->GetBeamCount(); i++)
1269 {
1270 SatBeamUserInfo info;
1271 beamInfo.insert(std::make_pair(std::make_pair(satId, i), info));
1272 }
1273 }
1274 break;
1275 }
1276 case SatHelper::SIMPLE:
1277 case SatHelper::LARGER:
1278 default: {
1279 NS_FATAL_ERROR("Incorrect scenario chosen with a constellation");
1280 }
1281 }
1282
1283 m_satHelper->LoadConstellationScenario(
1284 beamInfo,
1285 MakeCallback(&SimulationHelper::GetNextUtUserCount, this));
1286
1287 std::vector<std::pair<GeoCoordinate, uint32_t>> additionalNodesVector =
1288 m_groupHelper->GetAdditionalNodesPerBeam();
1289 std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>> additionalNodes;
1290 for (std::vector<std::pair<GeoCoordinate, uint32_t>>::iterator it =
1291 additionalNodesVector.begin();
1292 it != additionalNodesVector.end();
1293 it++)
1294 {
1295 uint32_t bestBeamId = antennaGainPatterns->GetBestBeamId(0, it->first, false);
1296 additionalNodes[bestBeamId].push_back(*it);
1297 }
1298
1299 for (std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>>::iterator it =
1300 additionalNodes.begin();
1301 it != additionalNodes.end();
1302 it++)
1303 {
1304 if (!IsBeamEnabled(it->first))
1305 {
1306 NS_LOG_WARN("Beam ID " << it->first << " is not enabled, cannot add "
1307 << it->second.size() << " UTs from SatGroupHelper");
1308 std::cout << "Beam ID " << it->first << " is not enabled, cannot add "
1309 << it->second.size() << " UTs from SatGroupHelper" << std::endl;
1310 continue;
1311 }
1312 beamInfo[std::make_pair(0, it->first)].SetPositions(it->second);
1313 for (uint32_t i = 0; i < it->second.size(); i++)
1314 {
1315 beamInfo[std::make_pair(0, it->first)].AppendUt(GetNextUtUserCount());
1316 }
1317 }
1318
1319 if (mobileUtsFolder != "")
1320 {
1321 m_satHelper->LoadMobileUTsFromFolder(mobileUtsFolder, m_utMobileUserCount);
1322 }
1323
1324 // Now, create either a scenario based on list positions in input file
1325 // or create a generic scenario with UT positions configured by other ways..
1327 {
1328 m_satHelper->CreateUserDefinedScenarioFromListPositions(
1329 0,
1330 beamInfo,
1333 }
1334 else
1335 {
1336 m_satHelper->CreateUserDefinedScenario(beamInfo);
1337 }
1338 }
1339 else if (scenario == SatHelper::NONE)
1340 {
1341 // Create beam scenario
1343
1344 for (uint32_t i = 1; i <= m_satHelper->GetBeamCount(); i++)
1345 {
1346 if (IsBeamEnabled(i))
1347 {
1348 SatBeamUserInfo info;
1349
1350 uint32_t utCount;
1351 std::map<uint32_t, Ptr<RandomVariableStream>>::iterator iti = m_utCount.find(i);
1352 std::map<uint32_t, Ptr<RandomVariableStream>>::iterator it0 = m_utCount.find(0);
1353 if (iti == m_utCount.end() && it0 == m_utCount.end())
1354 {
1355 NS_LOG_WARN("No UT count per beam set. Must be set for GEO scenarios");
1356 utCount = 0;
1357 }
1358 else
1359 {
1360 utCount = GetNextUtCount(i);
1361 }
1362
1363 ss << " Beam " << i << ": UT count= " << utCount;
1364
1365 for (uint32_t j = 1; j < utCount + 1; j++)
1366 {
1367 uint32_t utUserCount = GetNextUtUserCount();
1368 info.AppendUt(utUserCount);
1369 ss << ", " << j << ". UT user count= " << utUserCount;
1370 }
1371
1372 beamInfo.insert(std::make_pair(std::make_pair(0, i), info));
1373
1374 ss << std::endl;
1375 }
1376 }
1377
1378 std::vector<std::pair<GeoCoordinate, uint32_t>> additionalNodesVector =
1379 m_groupHelper->GetAdditionalNodesPerBeam();
1380 std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>> additionalNodes;
1381 for (std::vector<std::pair<GeoCoordinate, uint32_t>>::iterator it =
1382 additionalNodesVector.begin();
1383 it != additionalNodesVector.end();
1384 it++)
1385 {
1386 uint32_t bestBeamId = antennaGainPatterns->GetBestBeamId(0, it->first, false);
1387 additionalNodes[bestBeamId].push_back(*it);
1388 }
1389
1390 for (std::map<uint32_t, std::vector<std::pair<GeoCoordinate, uint32_t>>>::iterator it =
1391 additionalNodes.begin();
1392 it != additionalNodes.end();
1393 it++)
1394 {
1395 if (!IsBeamEnabled(it->first))
1396 {
1397 NS_LOG_WARN("Beam ID " << it->first << " is not enabled, cannot add "
1398 << it->second.size() << " UTs from SatGroupHelper");
1399 std::cout << "Beam ID " << it->first << " is not enabled, cannot add "
1400 << it->second.size() << " UTs from SatGroupHelper" << std::endl;
1401 continue;
1402 }
1403 beamInfo[std::make_pair(0, it->first)].SetPositions(it->second);
1404 for (uint32_t i = 0; i < it->second.size(); i++)
1405 {
1406 beamInfo[std::make_pair(0, it->first)].AppendUt(GetNextUtUserCount());
1407 }
1408 }
1409
1410 if (mobileUtsFolder != "")
1411 {
1412 m_satHelper->LoadMobileUTsFromFolder(mobileUtsFolder, m_utMobileUserCount);
1413 }
1414
1415 // Now, create either a scenario based on list positions in input file
1416 // or create a generic scenario with UT positions configured by other ways..
1418 {
1419 m_satHelper->CreateUserDefinedScenarioFromListPositions(
1420 0,
1421 beamInfo,
1424 }
1425 else
1426 {
1427 m_satHelper->CreateUserDefinedScenario(beamInfo);
1428 }
1429 }
1430 else
1431 {
1432 m_satHelper->CreatePredefinedScenario(scenario);
1433 }
1434
1435 NS_LOG_INFO(ss.str());
1436
1437 m_groupHelper->Init();
1438
1439 return m_satHelper;
1440}
1441
1442bool
1443SimulationHelper::HasSinkInstalled(Ptr<Node> node, uint16_t port)
1444{
1445 NS_LOG_FUNCTION(this << node->GetId() << port);
1446
1447 for (uint32_t i = 0; i < node->GetNApplications(); i++)
1448 {
1449 auto sink = DynamicCast<PacketSink>(node->GetApplication(i));
1450 if (sink != nullptr)
1451 {
1452 AddressValue av;
1453 sink->GetAttribute("Local", av);
1454 if (InetSocketAddress::ConvertFrom(av.Get()).GetPort() == port)
1455 {
1456 return true;
1457 }
1458 }
1459 }
1460 return false;
1461}
1462
1463void
1465{
1466 switch (crTxConf)
1467 {
1468 case CR_PERIODIC_CONTROL: {
1469 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
1470 EnumValue(SatEnums::RA_MODEL_OFF));
1471 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(true));
1472 break;
1473 }
1474 case CR_SLOTTED_ALOHA: {
1475 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
1477 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
1478 break;
1479 }
1480 case CR_CRDSA_LOOSE_RC_0: {
1481 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
1482 EnumValue(SatEnums::RA_MODEL_CRDSA));
1483 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
1484 Config::SetDefault("ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(false));
1485 break;
1486 }
1487 default: {
1488 NS_FATAL_ERROR("Unsupported crTxConf: " << crTxConf);
1489 break;
1490 }
1491 }
1492}
1493
1494void
1495SimulationHelper::SetBeams(const std::string& enabledBeams)
1496{
1497 NS_LOG_FUNCTION(this << enabledBeams);
1498
1499 m_enabledBeamsStr = enabledBeams;
1500 m_enabledBeams.clear();
1501 std::stringstream bss(enabledBeams);
1502
1503 while (!bss.eof())
1504 {
1505 uint32_t beamId;
1506 bss >> beamId;
1507 if (bss.fail())
1508 {
1509 bss.clear();
1510 std::string garbage;
1511 bss >> garbage;
1512 }
1513 else
1514 {
1515 m_enabledBeams.insert(beamId);
1516 }
1517 }
1518}
1519
1520void
1521SimulationHelper::SetBeamSet(std::set<uint32_t> beamSet)
1522{
1523 NS_LOG_FUNCTION(this);
1524
1525 m_enabledBeams = beamSet;
1526 std::stringstream bss;
1527 for (auto beamId : beamSet)
1528 {
1529 bss << beamId << " ";
1530 }
1531 m_enabledBeamsStr = bss.str();
1532}
1533
1534const std::set<uint32_t>&
1536{
1537 NS_LOG_FUNCTION(this);
1538
1539 return m_enabledBeams;
1540}
1541
1542bool
1544{
1545 NS_LOG_FUNCTION(this << beamId);
1546
1547 bool beamEnabled = false;
1548
1549 if (m_enabledBeams.find(beamId) != m_enabledBeams.end())
1550 {
1551 beamEnabled = true;
1552 }
1553
1554 return beamEnabled;
1555}
1556
1557uint32_t
1559{
1560 NS_LOG_FUNCTION(this << beamId);
1561
1562 auto iter = m_utCount.find(beamId);
1563 if (iter != m_utCount.end())
1564 {
1565 return m_utCount.at(beamId)->GetInteger();
1566 }
1567
1568 return m_utCount.at(0)->GetInteger();
1569}
1570
1571void
1573{
1574 NS_LOG_FUNCTION(this);
1575
1576 NS_LOG_INFO("--- " << m_simulationName << "---");
1577 NS_LOG_INFO(" Simulation length: " << m_simTime.GetSeconds());
1578 NS_LOG_INFO(" Enabled beams: " << m_enabledBeamsStr);
1579 NS_LOG_INFO(" Number of UTs: " << Singleton<SatTopology>::Get()->GetNGwUserNodes());
1580 NS_LOG_INFO(" Number of end users: " << Singleton<SatTopology>::Get()->GetNUtUserNodes());
1581
1582 Simulator::Stop(m_simTime);
1583 Simulator::Run();
1584
1585 Simulator::Destroy();
1586}
1587
1588void
1590{
1591 NS_LOG_FUNCTION(this);
1592
1594 {
1595 if (GetSimTime().GetSeconds() > 20)
1596 {
1597 m_progressUpdateInterval = Seconds(GetSimTime().GetSeconds() / 100);
1598 }
1599 else
1600 {
1601 m_progressUpdateInterval = Seconds(0.2);
1602 }
1604 Simulator::Schedule(m_progressUpdateInterval, &SimulationHelper::ProgressCb, this);
1606 }
1607}
1608
1609void
1611{
1612 NS_LOG_FUNCTION(this);
1613
1615 m_progressReportEvent.Cancel();
1616}
1617
1618void
1620{
1621 NS_LOG_FUNCTION(this << name);
1622
1623 std::string path = SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/" + name;
1624
1625 if (!SatEnvVariables::GetInstance()->IsValidFile(path))
1626 {
1627 NS_FATAL_ERROR("Scenario in " << path << " does not exist");
1628 }
1629
1630 m_scenarioPath = path;
1631}
1632
1633void
1635{
1636 NS_LOG_FUNCTION(this);
1637}
1638
1639void
1641 bool overrideManualConfiguration)
1642{
1644 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
1645
1646 if (overrideManualConfiguration)
1647 {
1648 SetBeams(simulationConf->m_enabledBeams);
1649 SetUtCountPerBeam(simulationConf->m_utCount);
1650 SetUserCountPerUt(simulationConf->m_utUserCount);
1651 SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
1652 SetSimulationTime(simulationConf->m_simTime);
1653 }
1654
1655 CreateSatScenario(SatHelper::NONE, simulationConf->m_mobileUtsFolder);
1656 if (simulationConf->m_activateProgressLogging)
1657 {
1659 }
1660
1661 Ptr<SatTrafficHelperConf> satTrafficHelperConf =
1662 CreateObject<SatTrafficHelperConf>(GetTrafficHelper(), m_simTime);
1663 satTrafficHelperConf->InstallTrafficModels();
1664
1665 if (simulationConf->m_activateStatistics)
1666 {
1668 }
1669}
1670
1671void
1673{
1674 NS_LOG_FUNCTION(this << filePath);
1675
1676 // To read attributes from file
1677 Config::SetDefault("ns3::ConfigStore::Filename", StringValue(filePath));
1678 Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Load"));
1679 Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
1680 ConfigStore inputConfig;
1681 inputConfig.ConfigureDefaults();
1682}
1683
1684std::string
1685SimulationHelper::StoreAttributesToFile(std::string fileName, bool outputAttributes)
1686{
1687 NS_LOG_FUNCTION(this);
1688
1689 std::string outputPath;
1690 outputPath = SatEnvVariables::GetInstance()->GetOutputPath();
1691
1692 // Store set attribute values to XML output file
1693 Config::SetDefault("ns3::ConfigStore::Filename", StringValue(outputPath + "/" + fileName));
1694 Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
1695 Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
1696 ConfigStore outputConfig;
1697 outputConfig.ConfigureDefaults();
1698
1699 if (outputAttributes)
1700 {
1701 outputConfig.ConfigureAttributes();
1702 }
1703
1704 return outputPath;
1705}
1706
1707} // 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.
static Ptr< SatEnvVariables > GetInstance()
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
@ LARGER
LARGER Larger scenario used as base.
@ NONE
NONE Not used.
@ FULL
FULL Full scenario used as base.
@ SIMPLE
SIMPLE Simple scenario used as base.
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.
InterferenceModel
Interference model enum.
Ptr< RandomVariableStream > m_utCount
Ptr< RandomVariableStream > m_utUserCount
Ptr< RandomVariableStream > m_utMobileUserCount
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.
Time & GetSimTime()
Get simulation time.
void EnableCrdsa()
Enable CRDSA random access.
Ptr< SatCnoHelper > m_cnoHelper
void ProgressCb()
Callback that prints simulation progress to stdout.
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.
Ptr< SatHelper > GetSatelliteHelper()
If lower layer API access is required, use this to access SatHelper.
void DoDispose(void)
Disposing.
void ParseScenarioFolder()
parse scenario folder to load all variables that can be
SimulationHelper()
Default constructor, which is not used.
void ConfigureFrequencyBands()
Configure the default setting for the forward and return link frequencies.
std::string m_inputFileUtListPositions
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.
Ptr< SatTrafficHelper > GetTrafficHelper()
Get the traffic helper to create more complex traffics.
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 LoadScenario(std::string name)
Load a scenario from data submodule.
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.