30 #include "../helper/satellite-helper.h"
31 #include "../utils/satellite-env-variables.h"
33 #include "ns3/cbr-application.h"
34 #include "ns3/cbr-helper.h"
35 #include "ns3/config.h"
38 #include "ns3/packet-sink-helper.h"
39 #include "ns3/packet-sink.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 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
179 NodeContainer gwUsers = helper->GetGwUsers();
184 CbrHelper cbr(
"ns3::UdpSocketFactory",
185 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
186 cbr.SetAttribute(
"Interval", StringValue(
"1s"));
187 cbr.SetAttribute(
"PacketSize", UintegerValue(64));
189 ApplicationContainer utApps = cbr.Install(helper->GetUtUsers());
190 utApps.Start(Seconds(1.0));
191 utApps.Stop(Seconds(2.1));
194 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
195 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
197 ApplicationContainer gwApps = sink.Install(gwUsers);
198 gwApps.Start(Seconds(1.0));
199 gwApps.Stop(Seconds(10.0));
201 Simulator::Stop(Seconds(11));
204 Simulator::Destroy();
206 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(gwApps.Get(0));
207 Ptr<CbrApplication> sender = DynamicCast<CbrApplication>(utApps.Get(0));
212 NS_TEST_ASSERT_MSG_NE(sender->GetSent(), (uint32_t)0,
"Nothing sent !");
213 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), sender->GetSent(),
"Packets were lost !");
215 Singleton<SatEnvVariables>::Get()->DoDispose();
244 virtual void DoRun(
void);
249 : TestCase(
"'Slotted ALOHA, test 1' case tests successful transmission of UDP packets from UT "
250 "connected user to GW connected user in simple scenario using Slotted ALOHA for "
251 "control messages and VBDC for data.")
268 Singleton<SatEnvVariables>::Get()->DoInitialize();
269 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-random-access",
277 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
278 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
281 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel",
282 EnumValue(SatEnums::RA_MODEL_RCS2_SPECIFICATION));
285 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceModel",
286 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
289 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
290 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
293 Config::SetDefault(
"ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(
false));
296 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableRandomAccessDynamicLoadControl",
297 BooleanValue(
false));
299 "ns3::SatPhyRxCarrierConf::RandomAccessAverageNormalizedOfferedLoadMeasurementWindowSize",
303 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumUniquePayloadPerBlock",
305 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MaximumConsecutiveBlockAccessed",
307 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_MinimumIdleBlock",
309 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffTimeInMilliSeconds",
311 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_BackOffProbability",
313 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_HighLoadBackOffProbability",
315 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::RaService0_NumberOfInstances",
318 "ns3::SatLowerLayerServiceConf::RaService0_AverageNormalizedOfferedLoadThreshold",
320 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DefaultControlRandomizationInterval",
321 TimeValue(MilliSeconds(100)));
322 Config::SetDefault(
"ns3::SatRandomAccessConf::CrdsaSignalingOverheadInBytes", UintegerValue(5));
323 Config::SetDefault(
"ns3::SatRandomAccessConf::SlottedAlohaSignalingOverheadInBytes",
327 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
328 BooleanValue(
false));
329 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
330 BooleanValue(
false));
331 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
332 BooleanValue(
false));
333 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
334 BooleanValue(
false));
335 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
336 BooleanValue(
false));
337 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
338 BooleanValue(
false));
339 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
340 BooleanValue(
false));
341 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
342 BooleanValue(
false));
343 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
344 BooleanValue(
false));
345 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
346 BooleanValue(
false));
347 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
348 BooleanValue(
false));
349 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
353 Ptr<SatHelper> helper = CreateObject<SatHelper>();
354 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
358 NodeContainer gwUsers = helper->GetGwUsers();
363 CbrHelper cbr(
"ns3::UdpSocketFactory",
364 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
365 cbr.SetAttribute(
"Interval", StringValue(
"1s"));
366 cbr.SetAttribute(
"PacketSize", UintegerValue(64));
368 ApplicationContainer utApps = cbr.Install(helper->GetUtUsers());
369 utApps.Start(Seconds(1.0));
370 utApps.Stop(Seconds(2.1));
373 PacketSinkHelper sink(
"ns3::UdpSocketFactory",
374 Address(InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port)));
376 ApplicationContainer gwApps = sink.Install(gwUsers);
377 gwApps.Start(Seconds(1.0));
378 gwApps.Stop(Seconds(10.0));
380 Simulator::Stop(Seconds(11));
383 Simulator::Destroy();
385 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(gwApps.Get(0));
386 Ptr<CbrApplication> sender = DynamicCast<CbrApplication>(utApps.Get(0));
391 NS_TEST_ASSERT_MSG_NE(sender->GetSent(), (uint32_t)0,
"Nothing sent !");
392 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), sender->GetSent(),
"Packets were lost !");
394 Singleton<SatEnvVariables>::Get()->DoDispose();
409 : TestSuite(
"sat-random-access-test", 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