22 #include "ns3/applications-module.h"
23 #include "ns3/config-store-module.h"
24 #include "ns3/core-module.h"
25 #include "ns3/internet-module.h"
26 #include "ns3/network-module.h"
27 #include "ns3/satellite-module.h"
28 #include "ns3/traffic-module.h"
37 NS_LOG_COMPONENT_DEFINE(
"sat-ncr-example");
40 main(
int argc,
char* argv[])
43 uint32_t endUsersPerUt = 1;
44 uint32_t utsPerBeam = 10;
46 uint32_t packetSize = 512;
47 std::string interval =
"100ms";
49 double simLength = 60.0;
51 uint32_t guardTime = 4;
52 int32_t clockDrift = 50;
55 Config::SetDefault(
"ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(
true));
58 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
59 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(
"example-ncr");
63 cmd.AddValue(
"simLength",
"Simulation duration in seconds", simLength);
64 cmd.AddValue(
"beamId",
"ID of beam used", beamId);
65 cmd.AddValue(
"utsPerBeam",
"Number of UTs per spot-beam", utsPerBeam);
66 cmd.AddValue(
"endUsersPerUt",
"Number end users per UT", endUsersPerUt);
67 cmd.AddValue(
"packetSize",
"Constant packet size in bytes", packetSize);
68 cmd.AddValue(
"interval",
"Interval between two UDP packets per UT", interval);
69 cmd.AddValue(
"guardTime",
"Guard time in time slots in symbols", guardTime);
70 cmd.AddValue(
"clockDrift",
"Drift value of UT clocks in ticks per second", clockDrift);
71 simulationHelper->AddDefaultUiArguments(cmd);
72 cmd.Parse(argc, argv);
75 simulationHelper->SetSimulationTime(simLength);
76 simulationHelper->SetUserCountPerUt(endUsersPerUt);
77 simulationHelper->SetUtCountPerBeam(utsPerBeam);
78 simulationHelper->SetBeamSet({beamId});
79 simulationHelper->SetSimulationTime(Seconds(simLength));
80 simulationHelper->EnableProgressLogs();
83 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
85 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
87 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
89 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
91 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_RandomAccessFrame", BooleanValue(
true));
92 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame1_RandomAccessFrame", BooleanValue(
true));
93 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame1_LogonFrame", BooleanValue(
true));
95 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_GuardTimeSymbols",
96 UintegerValue(guardTime));
97 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame1_GuardTimeSymbols",
98 UintegerValue(guardTime));
99 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame2_GuardTimeSymbols",
100 UintegerValue(guardTime));
101 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame3_GuardTimeSymbols",
102 UintegerValue(guardTime));
103 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame4_GuardTimeSymbols",
104 UintegerValue(guardTime));
105 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame5_GuardTimeSymbols",
106 UintegerValue(guardTime));
107 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame6_GuardTimeSymbols",
108 UintegerValue(guardTime));
109 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame7_GuardTimeSymbols",
110 UintegerValue(guardTime));
111 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame8_GuardTimeSymbols",
112 UintegerValue(guardTime));
113 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame9_GuardTimeSymbols",
114 UintegerValue(guardTime));
116 Config::SetDefault(
"ns3::SatUtMac::WindowInitLogon", TimeValue(Seconds(20)));
117 Config::SetDefault(
"ns3::SatUtMac::MaxWaitingTimeLogonResponse", TimeValue(Seconds(1)));
119 Config::SetDefault(
"ns3::SatMac::NcrVersion2", BooleanValue(
false));
120 Config::SetDefault(
"ns3::SatGwMac::NcrBroadcastPeriod", TimeValue(MilliSeconds(100)));
121 Config::SetDefault(
"ns3::SatGwMac::UseCmt", BooleanValue(
true));
122 Config::SetDefault(
"ns3::SatUtMacState::NcrSyncTimeout", TimeValue(Seconds(1)));
123 Config::SetDefault(
"ns3::SatUtMacState::NcrRecoveryTimeout", TimeValue(Seconds(10)));
124 Config::SetDefault(
"ns3::SatNcc::UtTimeout", TimeValue(Seconds(10)));
126 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
true));
127 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotInterval", TimeValue(MilliSeconds(500)));
129 Config::SetDefault(
"ns3::SatUtMac::ClockDrift", IntegerValue(clockDrift));
130 Config::SetDefault(
"ns3::SatGwMac::CmtPeriodMin", TimeValue(MilliSeconds(550)));
132 simulationHelper->LoadScenario(
"geo-33E");
134 simulationHelper->CreateSatScenario();
136 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
141 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
142 Singleton<SatTopology>::Get()->GetUtUserNodes(),
147 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
152 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
153 Singleton<SatTopology>::Get()->GetUtUserNodes(),
159 Config::SetDefault(
"ns3::ConfigStore::Filename", StringValue(
"output-attributes.xml"));
160 Config::SetDefault(
"ns3::ConfigStore::FileFormat", StringValue(
"Xml"));
161 Config::SetDefault(
"ns3::ConfigStore::Mode", StringValue(
"Save"));
162 ConfigStore outputConfig;
163 outputConfig.ConfigureDefaults();
164 simulationHelper->StoreAttributesToFile(
"output-attributes.xml");
166 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
191 simulationHelper->RunSimulation();
@ RA_COLLISION_CHECK_AGAINST_SINR
@ SUPER_FRAME_CONFIG_0
SUPER_FRAME_CONFIG_0.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.