30 #include "ns3/cbr-application.h"
31 #include "ns3/cbr-helper.h"
32 #include "ns3/config.h"
35 #include "ns3/packet-sink-helper.h"
36 #include "ns3/packet-sink.h"
37 #include "ns3/satellite-env-variables.h"
38 #include "ns3/satellite-helper.h"
39 #include "ns3/satellite-topology.h"
40 #include "ns3/simulator.h"
41 #include "ns3/singleton.h"
42 #include "ns3/string.h"
68 virtual void DoRun(
void);
73 : TestCase(
"'CRDSA, test 1' case tests successful transmission of UDP packets from UT "
74 "connected user to GW connected user in simple scenario using only CRDSA.")
91 Singleton<SatEnvVariables>::Get()->DoInitialize();
92 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-random-access",
"crdsa",
true);
98 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
99 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
102 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
103 EnumValue(SatEnums::RA_MODEL_RCS2_SPECIFICATION));
106 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
107 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
110 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
111 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
114 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
117 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
118 BooleanValue(
false));
120 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
124 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
126 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
128 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
130 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
132 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
134 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
136 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
139 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
141 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DefaultControlRandomizationInterval",
142 TimeValue(MilliSeconds(100)));
143 Config::SetDefault(
"ns3::SatRandomAccessConf::CrdsaSignalingOverheadInBytes", UintegerValue(5));
144 Config::SetDefault(
"ns3::SatRandomAccessConf::SlottedAlohaSignalingOverheadInBytes",
148 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
149 BooleanValue(
false));
150 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
151 BooleanValue(
false));
152 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
153 BooleanValue(
false));
154 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
155 BooleanValue(
false));
156 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
157 BooleanValue(
false));
158 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
159 BooleanValue(
false));
160 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
161 BooleanValue(
false));
162 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
163 BooleanValue(
false));
164 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
165 BooleanValue(
false));
166 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
167 BooleanValue(
false));
168 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
169 BooleanValue(
false));
170 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
171 BooleanValue(
false));
174 Ptr<SatHelper> helper = CreateObject<SatHelper>(
175 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
176 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
180 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
185 CbrHelper cbr(
"ns3::UdpSocketFactory",
186 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
187 cbr.SetAttribute(
"Interval", StringValue(
"1s"));
188 cbr.SetAttribute(
"PacketSize", UintegerValue(64));
190 ApplicationContainer utApps = cbr.Install(Singleton<SatTopology>::Get()->GetUtUserNodes());
191 utApps.Start(Seconds(1.0));
192 utApps.Stop(Seconds(2.1));
195 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
196 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
198 ApplicationContainer gwApps = sink.Install(gwUsers);
199 gwApps.Start(Seconds(1.0));
200 gwApps.Stop(Seconds(10.0));
202 Simulator::Stop(Seconds(11));
205 Simulator::Destroy();
207 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(gwApps.Get(0));
208 Ptr<CbrApplication> sender = DynamicCast<CbrApplication>(utApps.Get(0));
213 NS_TEST_ASSERT_MSG_NE(sender->GetSent(), (uint32_t)0,
"Nothing sent !");
214 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), sender->GetSent(),
"Packets were lost !");
216 Singleton<SatEnvVariables>::Get()->DoDispose();
245 virtual void DoRun(
void);
250 : TestCase(
"'Slotted ALOHA, test 1' case tests successful transmission of UDP packets from UT "
251 "connected user to GW connected user in simple scenario using Slotted ALOHA for "
252 "control messages and VBDC for data.")
269 Singleton<SatEnvVariables>::Get()->DoInitialize();
270 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-random-access",
278 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
279 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
282 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
283 EnumValue(SatEnums::RA_MODEL_RCS2_SPECIFICATION));
286 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
287 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
290 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
291 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
294 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
297 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
298 BooleanValue(
false));
300 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
304 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
306 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
308 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
310 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
312 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
314 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
316 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
319 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
321 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DefaultControlRandomizationInterval",
322 TimeValue(MilliSeconds(100)));
323 Config::SetDefault(
"ns3::SatRandomAccessConf::CrdsaSignalingOverheadInBytes", UintegerValue(5));
324 Config::SetDefault(
"ns3::SatRandomAccessConf::SlottedAlohaSignalingOverheadInBytes",
328 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
329 BooleanValue(
false));
330 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
331 BooleanValue(
false));
332 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
333 BooleanValue(
false));
334 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
335 BooleanValue(
false));
336 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
337 BooleanValue(
false));
338 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
339 BooleanValue(
false));
340 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
341 BooleanValue(
false));
342 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
343 BooleanValue(
false));
344 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
345 BooleanValue(
false));
346 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
347 BooleanValue(
false));
348 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
349 BooleanValue(
false));
350 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
354 Ptr<SatHelper> helper = CreateObject<SatHelper>(
355 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
356 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
360 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
365 CbrHelper cbr(
"ns3::UdpSocketFactory",
366 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
367 cbr.SetAttribute(
"Interval", StringValue(
"1s"));
368 cbr.SetAttribute(
"PacketSize", UintegerValue(64));
370 ApplicationContainer utApps = cbr.Install(Singleton<SatTopology>::Get()->GetUtUserNodes());
371 utApps.Start(Seconds(1.0));
372 utApps.Stop(Seconds(2.1));
375 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
376 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
378 ApplicationContainer gwApps = sink.Install(gwUsers);
379 gwApps.Start(Seconds(1.0));
380 gwApps.Stop(Seconds(10.0));
382 Simulator::Stop(Seconds(11));
385 Simulator::Destroy();
387 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(gwApps.Get(0));
388 Ptr<CbrApplication> sender = DynamicCast<CbrApplication>(utApps.Get(0));
393 NS_TEST_ASSERT_MSG_NE(sender->GetSent(), (uint32_t)0,
"Nothing sent !");
394 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), sender->GetSent(),
"Packets were lost !");
396 Singleton<SatEnvVariables>::Get()->DoDispose();
411 : TestSuite(
"sat-random-access-test", Type::SYSTEM)
'CRDSA, test 1' test case implementation.
SatRandomAccessTestSuite()
'Slotted ALOHA, test 1' test case implementation.
virtual ~SatSlottedAlohaTest1()
ErrorModel
Error model enum.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static SatRandomAccessTestSuite satRandomAccessTestSuite