Loading...
Searching...
No Matches
satellite-lora-regenerative-test.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Bastien Tauran <bastien.tauran@viveris.fr>
19 */
20
26
27// Include a header file from your module to test.
28#include "ns3/boolean.h"
29#include "ns3/cbr-application.h"
30#include "ns3/cbr-helper.h"
31#include "ns3/config.h"
32#include "ns3/enum.h"
33#include "ns3/log.h"
34#include "ns3/lora-periodic-sender.h"
35#include "ns3/lorawan-mac-header.h"
36#include "ns3/mobility-helper.h"
37#include "ns3/packet-sink-helper.h"
38#include "ns3/packet-sink.h"
39#include "ns3/satellite-enums.h"
40#include "ns3/satellite-env-variables.h"
41#include "ns3/satellite-helper.h"
42#include "ns3/satellite-lora-conf.h"
43#include "ns3/satellite-lorawan-net-device.h"
44#include "ns3/satellite-mobility-model.h"
45#include "ns3/satellite-position-allocator.h"
46#include "ns3/satellite-topology.h"
47#include "ns3/simulation-helper.h"
48#include "ns3/simulator.h"
49#include "ns3/singleton.h"
50#include "ns3/string.h"
51#include "ns3/test.h"
52#include "ns3/uinteger.h"
53
54#include <iostream>
55#include <stdint.h>
56
57using namespace ns3;
58
69{
70 public:
73
74 private:
75 virtual void DoRun(void);
76 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
77
80
81 Address m_edAddress;
83};
84
86 : TestCase("Test regenerative satellite lorawan with acks sent in first window."),
87 m_gwReceiveDate(Seconds(0)),
88 m_edReceiveDate(Seconds(0))
89{
90}
91
95
96void
98 Ptr<const Packet> packet,
99 const Address& address)
100{
101 if (address == m_edAddress)
102 {
103 m_gwReceiveDate = Simulator::Now();
104 }
105
106 if (address == m_orbiterUserAddress)
107 {
108 m_edReceiveDate = Simulator::Now();
109 }
110}
111
112void
114{
115 // Set simulation output details
116 SatEnvVariables::GetInstance()->DoInitialize();
117 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-lora-regenerative",
118 "first-window",
119 true);
120
121 // Enable Lora
122 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
123 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
125 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
126
128 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
130 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
132
133 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
134 TimeValue(MilliSeconds(1500)));
135 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay",
136 TimeValue(MilliSeconds(2500)));
137 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
138 TimeValue(MilliSeconds(600)));
139 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
140 TimeValue(MilliSeconds(500)));
141 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay", TimeValue(Seconds(1)));
142 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
143
144 // Superframe configuration
145 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
147 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
149 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
150 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
151 DoubleValue(15000));
152
153 // CRDSA only
154 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
155 BooleanValue(false));
156 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
157 BooleanValue(false));
158
159 // Configure RA
160 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
161 EnumValue(SatPhyRxCarrierConf::EM_AVI));
162 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
163 EnumValue(SatPhyRxCarrierConf::EM_AVI));
164 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
165 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
167 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
169 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
170
171 // Configure E-SSA
172 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
173 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
174 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
175 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
176
177 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
178
179 // Creating the reference system.
180 Ptr<SatHelper> helper = CreateObject<SatHelper>(
181 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E-lora");
182 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
183
184 // >>> Start of actual test using Simple scenario >>>
185 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
186 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
187
188 app->SetInterval(Seconds(10));
189
190 app->SetStartTime(Seconds(1.0));
191 app->SetStopTime(Seconds(10.0));
192 app->SetPacketSize(24);
193
194 app->SetNode(utNode);
195 utNode->AddApplication(app);
196
197 Ptr<SatOrbiterNetDevice> orbiterNetDevice = DynamicCast<SatOrbiterNetDevice>(
198 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
199 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
200 m_orbiterUserAddress = orbiterNetDevice->GetSatelliteUserAddress(8);
201
202 Config::Connect("/NodeList/*/DeviceList/*/SatMac/Rx",
204 Config::Connect("/NodeList/*/DeviceList/*/FeederMac/*/Rx",
206
207 Simulator::Stop(Seconds(10));
208 Simulator::Run();
209
210 Simulator::Destroy();
211
212 SatEnvVariables::GetInstance()->DoDispose();
213
214 NS_TEST_ASSERT_MSG_NE(m_gwReceiveDate, Seconds(0), "Packet should be received by Gateway.");
215 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate, Seconds(0), "Ack should be received by End Device.");
216 NS_TEST_ASSERT_MSG_GT(m_edReceiveDate, m_gwReceiveDate, "Ack should be received after packet.");
217
218 Time difference = m_edReceiveDate - m_gwReceiveDate;
219 Time delay = MilliSeconds(130);
220
221 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1) + delay, "Ack arrived too early.");
222 NS_TEST_ASSERT_MSG_LT(difference + delay,
223 MilliSeconds(1900) + delay,
224 "Ack arrived too late. First window should be closed.");
225}
226
237{
238 public:
241
242 private:
243 virtual void DoRun(void);
244 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
245
248
249 Address m_edAddress;
251};
252
254 : TestCase("Test regenerative satellite lorawan with acks sent in second window."),
255 m_gwReceiveDate(Seconds(0)),
256 m_edReceiveDate(Seconds(0))
257{
258}
259
263
264void
266 Ptr<const Packet> packet,
267 const Address& address)
268{
269 if (address == m_edAddress)
270 {
271 m_gwReceiveDate = Simulator::Now();
272 }
273
274 if (address == m_orbiterUserAddress)
275 {
276 m_edReceiveDate = Simulator::Now();
277 }
278}
279
280void
282{
283 // Set simulation output details
284 SatEnvVariables::GetInstance()->DoInitialize();
285 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-lora-regenerative",
286 "second-window",
287 true);
288
289 // Enable Lora
290 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
291 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
293 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
294
296 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
298 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
300
301 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
302 TimeValue(MilliSeconds(1500)));
303 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
304 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
305 TimeValue(MilliSeconds(400)));
306 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
307 TimeValue(MilliSeconds(500)));
308 // Increase answer delay by 500ms compared to SatLoraRegenerativeSecondWindowTestCase to be in
309 // second window on End Device
310 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
311 TimeValue(Seconds(1) + MilliSeconds(500)));
312 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
313
314 // Superframe configuration
315 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
317 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
319 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
320 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
321 DoubleValue(15000));
322
323 // CRDSA only
324 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
325 BooleanValue(false));
326 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
327 BooleanValue(false));
328
329 // Configure RA
330 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
331 EnumValue(SatPhyRxCarrierConf::EM_AVI));
332 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
333 EnumValue(SatPhyRxCarrierConf::EM_AVI));
334 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
335 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
337 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
339 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
340
341 // Configure E-SSA
342 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
343 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
344 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
345 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
346
347 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
348
349 // Creating the reference system.
350 Ptr<SatHelper> helper = CreateObject<SatHelper>(
351 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E-lora");
352 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
353
354 // >>> Start of actual test using Simple scenario >>>
355 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
356 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
357
358 app->SetInterval(Seconds(10));
359
360 app->SetStartTime(Seconds(1.0));
361 app->SetStopTime(Seconds(10.0));
362 app->SetPacketSize(24);
363
364 app->SetNode(utNode);
365 utNode->AddApplication(app);
366
367 Ptr<SatOrbiterNetDevice> orbiterNetDevice = DynamicCast<SatOrbiterNetDevice>(
368 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
369 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
370 m_orbiterUserAddress = orbiterNetDevice->GetSatelliteUserAddress(8);
371
372 Config::Connect("/NodeList/*/DeviceList/*/SatMac/Rx",
374 Config::Connect("/NodeList/*/DeviceList/*/FeederMac/*/Rx",
376
377 Simulator::Stop(Seconds(10));
378 Simulator::Run();
379
380 Simulator::Destroy();
381
382 SatEnvVariables::GetInstance()->DoDispose();
383 NS_TEST_ASSERT_MSG_NE(m_gwReceiveDate, Seconds(0), "Packet should be received by Gateway.");
384 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate, Seconds(0), "Ack should be received by End Device.");
385 NS_TEST_ASSERT_MSG_GT(m_edReceiveDate, m_gwReceiveDate, "Ack should be received after packet.");
386
387 Time difference = m_edReceiveDate - m_gwReceiveDate;
388 Time delay = MilliSeconds(130);
389
390 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1.5) + delay, "Ack arrived too early.");
391 NS_TEST_ASSERT_MSG_LT(difference + delay,
392 MilliSeconds(2400) + delay,
393 "Ack arrived too late. Second window should be closed.");
394}
395
405{
406 public:
409
410 private:
411 virtual void DoRun(void);
412 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
413 void PhyTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
414
415 std::vector<Time> m_gwReceiveDates;
417
418 Address m_edAddress;
420
423};
424
426 : TestCase("Test regenerative satellite lorawan with acks sent out of reception windows."),
427 m_edReceiveDate(Seconds(0)),
428 m_phyGwReceive(false),
429 m_phyEdReceive(false)
430{
431}
432
436
437void
439 Ptr<const Packet> packet,
440 const Address& address)
441{
442 if (address == m_edAddress)
443 {
444 m_gwReceiveDates.push_back(Simulator::Now());
445 }
446
447 if (address == m_orbiterUserAddress)
448 {
449 m_edReceiveDate = Simulator::Now();
450 }
451}
452
453void
455 Ptr<const Packet> packet,
456 const Address& address)
457{
458 if (address == m_edAddress)
459 {
460 m_phyGwReceive = true;
461 }
462
463 if (address == m_orbiterUserAddress)
464 {
465 m_phyEdReceive = true;
466 }
467}
468
469void
471{
472 // Set simulation output details
473 SatEnvVariables::GetInstance()->DoInitialize();
474 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-lora-regenerative",
475 "out-of-window",
476 true);
477
478 // Enable Lora
479 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
480 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
482 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
483
485 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
487 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
489
490 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
491 TimeValue(MilliSeconds(1500)));
492 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
493 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
494 TimeValue(MilliSeconds(400)));
495 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
496 TimeValue(MilliSeconds(500)));
497 // Send answer too early
498 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
499 TimeValue(Seconds(0.1)));
500 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
501
502 // Superframe configuration
503 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
505 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
507 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
508 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
509 DoubleValue(15000));
510
511 // CRDSA only
512 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
513 BooleanValue(false));
514 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
515 BooleanValue(false));
516
517 // Configure RA
518 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
519 EnumValue(SatPhyRxCarrierConf::EM_AVI));
520 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
521 EnumValue(SatPhyRxCarrierConf::EM_AVI));
522 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
523 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
525 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
527 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
528
529 // Configure E-SSA
530 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
531 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
532 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
533 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
534
535 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
536 Config::SetDefault("ns3::SatPhy::EnableStatisticsTags", BooleanValue(true));
537
538 // Creating the reference system.
539 Ptr<SatHelper> helper = CreateObject<SatHelper>(
540 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E-lora");
541 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
542
543 // >>> Start of actual test using Simple scenario >>>
544 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
545 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
546
547 app->SetInterval(Seconds(10));
548
549 app->SetStartTime(Seconds(1.0));
550 app->SetStopTime(Seconds(10.0));
551 app->SetPacketSize(24);
552
553 app->SetNode(utNode);
554 utNode->AddApplication(app);
555
556 Ptr<SatOrbiterNetDevice> orbiterNetDevice = DynamicCast<SatOrbiterNetDevice>(
557 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
558 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
559 m_orbiterUserAddress = orbiterNetDevice->GetSatelliteUserAddress(8);
560
561 Config::Connect("/NodeList/*/DeviceList/*/SatMac/Rx",
563 Config::Connect("/NodeList/*/DeviceList/*/FeederMac/*/Rx",
565 Config::Connect("/NodeList/*/DeviceList/*/SatPhy/Rx",
567 Config::Connect("/NodeList/*/DeviceList/*/FeederPhy/*/Rx",
569 Config::Connect("/NodeList/*/DeviceList/*/UserPhy/*/Rx",
571
572 Simulator::Stop(Seconds(10));
573 Simulator::Run();
574
575 Simulator::Destroy();
576
577 SatEnvVariables::GetInstance()->DoDispose();
578
579 NS_TEST_ASSERT_MSG_EQ(m_gwReceiveDates.size(),
580 2,
581 "GW should receive a packet and the first retransmission.");
582 NS_TEST_ASSERT_MSG_EQ(m_edReceiveDate, Seconds(0), "No ack should be received by End Device.");
583
584 NS_TEST_ASSERT_MSG_EQ(m_phyGwReceive,
585 true,
586 "Phy layer should trace traffic from End Device to Gateway.");
587 NS_TEST_ASSERT_MSG_EQ(m_phyEdReceive,
588 false,
589 "Phy layer should not trace traffic from Gateway to End Device, as phy "
590 "layer is in SLEEP state.");
591}
592
603{
604 public:
607
608 private:
609 virtual void DoRun(void);
610 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
611 void PhyTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
612
613 std::vector<Time> m_gwReceiveDates;
615
616 Address m_edAddress;
618};
619
622 : TestCase("Test regenerative satellite lorawan with acks sent out of reception windows and no "
623 "retransmission needed."),
624 m_edReceiveDate(Seconds(0))
625{
626}
627
632
633void
635 Ptr<const Packet> packet,
636 const Address& address)
637{
638 if (address == m_edAddress)
639 {
640 m_gwReceiveDates.push_back(Simulator::Now());
641 }
642
643 if (address == m_orbiterUserAddress)
644 {
645 m_edReceiveDate = Simulator::Now();
646 }
647}
648
649void
651{
652 // Set simulation output details
653 SatEnvVariables::GetInstance()->DoInitialize();
654 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-lora-regenerative",
655 "out-of-window",
656 true);
657
658 // Enable Lora
659 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
660 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
662 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
663
665 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
667 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
669
670 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
671 TimeValue(MilliSeconds(1500)));
672 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
673 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
674 TimeValue(MilliSeconds(400)));
675 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
676 TimeValue(MilliSeconds(500)));
677 // Send answer too early
678 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
679 TimeValue(Seconds(0.1)));
680 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
681
682 // Superframe configuration
683 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
685 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
687 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
688 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
689 DoubleValue(15000));
690
691 // CRDSA only
692 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
693 BooleanValue(false));
694 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
695 BooleanValue(false));
696
697 // Configure RA
698 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
699 EnumValue(SatPhyRxCarrierConf::EM_AVI));
700 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
701 EnumValue(SatPhyRxCarrierConf::EM_AVI));
702 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
703 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
705 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
707 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
708
709 // Configure E-SSA
710 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
711 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
712 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
713 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
714
715 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
716 Config::SetDefault("ns3::SatPhy::EnableStatisticsTags", BooleanValue(true));
717
718 // Creating the reference system.
719 Ptr<SatHelper> helper = CreateObject<SatHelper>(
720 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E-lora");
721 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
722
723 // >>> Start of actual test using Simple scenario >>>
724 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
725 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
726
727 app->SetInterval(Seconds(10));
728
729 app->SetStartTime(Seconds(1.0));
730 app->SetStopTime(Seconds(10.0));
731 app->SetPacketSize(24);
732
733 app->SetNode(utNode);
734 utNode->AddApplication(app);
735
736 Ptr<SatOrbiterNetDevice> orbiterNetDevice = DynamicCast<SatOrbiterNetDevice>(
737 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
738 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
739 m_orbiterUserAddress = orbiterNetDevice->GetSatelliteUserAddress(8);
740
741 Config::Connect(
742 "/NodeList/*/DeviceList/*/SatMac/Rx",
744 this));
745 Config::Connect(
746 "/NodeList/*/DeviceList/*/FeederMac/*/Rx",
748 this));
749
750 Simulator::Stop(Seconds(10));
751 Simulator::Run();
752
753 Simulator::Destroy();
754
755 SatEnvVariables::GetInstance()->DoDispose();
756
757 NS_TEST_ASSERT_MSG_EQ(m_gwReceiveDates.size(),
758 1,
759 "GW should receive a packet but no retransmission.");
760 NS_TEST_ASSERT_MSG_EQ(m_edReceiveDate, Seconds(0), "No ack should be received by End Device.");
761}
762
771class SatLoraRegenerativeCbrTestCase : public TestCase
772{
773 public:
776
777 private:
778 virtual void DoRun(void);
779 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
780
783
784 Address m_edAddress;
786};
787
789 : TestCase("Test regenerativesatellite lorawan with CBR traffic."),
790 m_edReceiveDate(Seconds(0))
791{
792}
793
797
798void
800 Ptr<const Packet> packet,
801 const Address& address)
802{
803 if (address == m_edAddress)
804 {
805 m_gwReceiveDate = Simulator::Now();
806 }
807
808 if (address == m_orbiterUserAddress)
809 {
810 m_edReceiveDate = Simulator::Now();
811 }
812}
813
814void
816{
817 // Set simulation output details
818 SatEnvVariables::GetInstance()->DoInitialize();
819 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-lora-regenerative", "cbr", true);
820
821 // Enable Lora
822 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
823 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
825 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
826
828 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
830 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
832
833 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
834 TimeValue(MilliSeconds(1500)));
835 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
836 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
837 TimeValue(MilliSeconds(450)));
838 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
839 TimeValue(MilliSeconds(500)));
840 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay", TimeValue(Seconds(1)));
841 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
842
843 // Superframe configuration
844 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
846 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
848 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
849 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
850 DoubleValue(15000));
851
852 // CRDSA only
853 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
854 BooleanValue(false));
855 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
856 BooleanValue(false));
857
858 // Configure RA
859 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
860 EnumValue(SatPhyRxCarrierConf::EM_AVI));
861 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
862 EnumValue(SatPhyRxCarrierConf::EM_AVI));
863 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
864 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
866 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
868 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
869
870 // Configure E-SSA
871 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
872 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
873 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
874 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
875
876 Config::SetDefault("ns3::CbrApplication::Interval", StringValue("10s"));
877 Config::SetDefault("ns3::CbrApplication::PacketSize", UintegerValue(24));
878
879 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
880
881 // Creating the reference system.
882 Ptr<SatHelper> helper = CreateObject<SatHelper>(
883 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E-lora");
884 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
885
886 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
887 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
888 InetSocketAddress gwUserAddr = InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), 9);
889
890 PacketSinkHelper sinkHelper("ns3::UdpSocketFactory", Address());
891 CbrHelper cbrHelper("ns3::UdpSocketFactory", Address());
892 ApplicationContainer sinkContainer;
893 ApplicationContainer cbrContainer;
894
895 sinkHelper.SetAttribute("Local", AddressValue(Address(gwUserAddr)));
896 sinkContainer.Add(sinkHelper.Install(gwUsers.Get(0)));
897
898 cbrHelper.SetAttribute("Remote", AddressValue(Address(gwUserAddr)));
899
900 auto app = cbrHelper.Install(utUsers.Get(0)).Get(0);
901 app->SetStartTime(Seconds(1));
902 cbrContainer.Add(app);
903
904 sinkContainer.Start(Seconds(1));
905 sinkContainer.Stop(Seconds(20));
906
907 Ptr<SatOrbiterNetDevice> orbiterNetDevice = DynamicCast<SatOrbiterNetDevice>(
908 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
909 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
910 m_orbiterUserAddress = orbiterNetDevice->GetSatelliteUserAddress(8);
911
912 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(sinkContainer.Get(0));
913
914 Config::Connect("/NodeList/*/DeviceList/*/SatMac/Rx",
915 MakeCallback(&SatLoraRegenerativeCbrTestCase::MacTraceCb, this));
916 Config::Connect("/NodeList/*/DeviceList/*/FeederMac/*/Rx",
917 MakeCallback(&SatLoraRegenerativeCbrTestCase::MacTraceCb, this));
918
919 Simulator::Stop(Seconds(20));
920 Simulator::Run();
921
922 Simulator::Destroy();
923
924 SatEnvVariables::GetInstance()->DoDispose();
925
926 NS_TEST_ASSERT_MSG_NE(m_gwReceiveDate, Seconds(0), "Packet should be received by Gateway.");
927 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate, Seconds(0), "Ack should be received by End Device.");
928 NS_TEST_ASSERT_MSG_GT(m_edReceiveDate, m_gwReceiveDate, "Ack should be received after packet.");
929
930 Time difference = m_edReceiveDate - m_gwReceiveDate;
931 Time delay = MilliSeconds(130);
932
933 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1) + delay, "Ack arrived too early.");
934 NS_TEST_ASSERT_MSG_LT(difference + delay,
935 MilliSeconds(1900) + delay,
936 "Ack arrived too late. First window should be closed.");
937
938 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), 24, "Sink should receive one packet of 24 bytes");
939}
940
952{
953 public:
956
957 private:
958 virtual void DoRun(void);
959 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
960
963
964 Address m_edAddress;
966};
967
969 : TestCase("Test constellation satellite lorawan with acks sent in first window."),
970 m_gwReceiveDate(Seconds(0)),
971 m_edReceiveDate(Seconds(0))
972{
973}
974
978
979void
981 Ptr<const Packet> packet,
982 const Address& address)
983{
984 if (address == m_edAddress)
985 {
986 m_gwReceiveDate = Simulator::Now();
987 }
988
989 if (address == m_orbiterUserAddress)
990 {
991 m_edReceiveDate = Simulator::Now();
992 }
993}
994
995void
997{
998 // Set simulation output details
999 SatEnvVariables::GetInstance()->DoInitialize();
1000
1001 Ptr<SimulationHelper> simulationHelper =
1002 CreateObject<SimulationHelper>("test-sat-lora-regenerative/constellation-first-window");
1003
1004 // Enable Lora
1005 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
1006 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
1008 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
1009
1011 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
1013 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
1015
1016 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
1017 TimeValue(MilliSeconds(1500)));
1018 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
1019 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
1020 TimeValue(MilliSeconds(400)));
1021 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
1022 TimeValue(MilliSeconds(500)));
1023 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay", TimeValue(Seconds(1)));
1024 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
1025
1026 // Superframe configuration
1027 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
1029 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
1031 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
1032 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
1033 DoubleValue(15000));
1034
1035 // CRDSA only
1036 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
1037 BooleanValue(false));
1038 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
1039 BooleanValue(false));
1040
1041 // Configure RA
1042 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
1043 EnumValue(SatPhyRxCarrierConf::EM_AVI));
1044 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
1045 EnumValue(SatPhyRxCarrierConf::EM_AVI));
1046 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
1047 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
1049 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
1051 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
1052
1053 // Configure E-SSA
1054 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
1055 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
1056 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
1057 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
1058
1059 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
1060
1061 // Traffics
1062 simulationHelper->SetSimulationTime(Seconds(15.0));
1063
1064 simulationHelper->SetGwUserCount(1);
1065 simulationHelper->SetUtCountPerBeam(1);
1066 simulationHelper->SetUserCountPerUt(1);
1067 simulationHelper->SetBeams("30 43");
1068
1069 simulationHelper->LoadScenario("constellation-eutelsat-geo-2-sats-isls-lora");
1070
1071 simulationHelper->CreateSatScenario();
1072
1073 // >>> Start of actual test using Simple scenario >>>
1074 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
1075 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
1076
1077 app->SetInterval(Seconds(10));
1078
1079 app->SetStartTime(Seconds(1.0));
1080 app->SetStopTime(Seconds(10.0));
1081 app->SetPacketSize(24);
1082
1083 app->SetNode(utNode);
1084 utNode->AddApplication(app);
1085
1086 Ptr<SatOrbiterNetDevice> orbiterNetDevice0 = DynamicCast<SatOrbiterNetDevice>(
1087 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
1088 Ptr<SatOrbiterNetDevice> orbiterNetDevice1 = DynamicCast<SatOrbiterNetDevice>(
1089 Singleton<SatTopology>::Get()->GetOrbiterNode(1)->GetDevice(0));
1090 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
1091 m_orbiterUserAddress = orbiterNetDevice0->GetSatelliteUserAddress(43);
1092
1093 Config::Connect("/NodeList/*/DeviceList/*/SatMac/Rx",
1095 Config::Connect("/NodeList/*/DeviceList/*/FeederMac/*/Rx",
1097
1098 simulationHelper->RunSimulation();
1099
1100 Simulator::Destroy();
1101
1102 SatEnvVariables::GetInstance()->DoDispose();
1103
1104 NS_TEST_ASSERT_MSG_NE(m_gwReceiveDate, Seconds(0), "Packet should be received by Gateway.");
1105 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate, Seconds(0), "Ack should be received by End Device.");
1106 NS_TEST_ASSERT_MSG_GT(m_edReceiveDate, m_gwReceiveDate, "Ack should be received after packet.");
1107
1108 Time difference = m_edReceiveDate - m_gwReceiveDate;
1109 Time delay = MilliSeconds(130);
1110
1111 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1) + delay, "Ack arrived too early.");
1112 NS_TEST_ASSERT_MSG_LT(difference + delay,
1113 MilliSeconds(1900) + delay,
1114 "Ack arrived too late. First window should be closed.");
1115}
1116
1127{
1128 public:
1131
1132 private:
1133 virtual void DoRun(void);
1134 void MacTraceCb(std::string context, Ptr<const Packet> packet, const Address& address);
1135
1140
1145};
1146
1148 : TestCase("Test constellation satellite lorawan with handovers."),
1149 m_gwReceiveDate(Seconds(0)),
1150 m_edReceiveDate31(Seconds(0)),
1151 m_edReceiveDate40(Seconds(0)),
1152 m_edReceiveDate41(Seconds(0))
1153{
1154}
1155
1159
1160void
1162 Ptr<const Packet> packet,
1163 const Address& address)
1164{
1165 if (address == m_edAddress)
1166 {
1167 m_gwReceiveDate = Simulator::Now();
1168 }
1169
1170 if (address == m_orbiterUserAddress31)
1171 {
1172 m_edReceiveDate31 = Simulator::Now();
1173 }
1174
1175 if (address == m_orbiterUserAddress40)
1176 {
1177 m_edReceiveDate40 = Simulator::Now();
1178 }
1179
1180 if (address == m_orbiterUserAddress41)
1181 {
1182 m_edReceiveDate41 = Simulator::Now();
1183 }
1184}
1185
1186void
1188{
1189 // Set simulation output details
1190 SatEnvVariables::GetInstance()->DoInitialize();
1191
1192 Ptr<SimulationHelper> simulationHelper =
1193 CreateObject<SimulationHelper>("test-sat-lora-regenerative/constellation-handover");
1194
1195 // Enable Lora
1196 Config::SetDefault("ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
1197 Config::SetDefault("ns3::LorawanMacEndDevice::MType",
1199 Config::SetDefault("ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
1200
1202 Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
1204 Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
1206
1207 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
1208 TimeValue(MilliSeconds(1000)));
1209 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
1210 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
1211 TimeValue(MilliSeconds(900)));
1212 Config::SetDefault("ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
1213 TimeValue(MilliSeconds(500)));
1214 Config::SetDefault("ns3::LoraNetworkScheduler::FirstWindowAnswerDelay", TimeValue(Seconds(1)));
1215 Config::SetDefault("ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
1216
1217 // Superframe configuration
1218 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
1220 Config::SetDefault("ns3::SatSuperframeConf4::FrameConfigType",
1222 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
1223 Config::SetDefault("ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
1224 DoubleValue(15000));
1225
1226 // CRDSA only
1227 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
1228 BooleanValue(false));
1229 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
1230 BooleanValue(false));
1231
1232 // Configure RA
1233 Config::SetDefault("ns3::SatOrbiterHelper::FwdLinkErrorModel",
1234 EnumValue(SatPhyRxCarrierConf::EM_AVI));
1235 Config::SetDefault("ns3::SatOrbiterHelper::RtnLinkErrorModel",
1236 EnumValue(SatPhyRxCarrierConf::EM_AVI));
1237 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
1238 Config::SetDefault("ns3::SatBeamHelper::RaInterferenceEliminationModel",
1240 Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
1242 Config::SetDefault("ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
1243
1244 // Configure E-SSA
1245 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue("600ms"));
1246 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue("200ms"));
1247 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
1248 Config::SetDefault("ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(false));
1249
1250 Config::SetDefault("ns3::SatMac::EnableStatisticsTags", BooleanValue(true));
1251
1252 Config::SetDefault("ns3::SatHelper::HandoversEnabled", BooleanValue(true));
1253 Config::SetDefault("ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
1254
1255 // Traffics
1256 Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
1257 simulationHelper->SetSimulationTime(Seconds(100));
1258 simulationHelper->SetGwUserCount(1);
1259 simulationHelper->SetUserCountPerUt(1);
1260 simulationHelper->SetBeamSet({31, 40, 41, 43});
1261 simulationHelper->LoadScenario("constellation-leo-2-satellites-lora");
1262 simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
1263 simulationHelper->CreateSatScenario(SatHelper::NONE);
1264
1265 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
1266 simulationHelper->GetTrafficHelper()->AddLoraPeriodicTraffic(Seconds(10),
1267 24,
1268 NodeContainer(utNode),
1269 Seconds(0.001),
1270 Seconds(100),
1271 Seconds(3));
1272
1273 Ptr<SatOrbiterNetDevice> orbiterNetDevice0 = DynamicCast<SatOrbiterNetDevice>(
1274 Singleton<SatTopology>::Get()->GetOrbiterNode(0)->GetDevice(0));
1275 Ptr<SatOrbiterNetDevice> orbiterNetDevice1 = DynamicCast<SatOrbiterNetDevice>(
1276 Singleton<SatTopology>::Get()->GetOrbiterNode(1)->GetDevice(0));
1277
1278 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
1279
1280 m_orbiterUserAddress31 = orbiterNetDevice0->GetSatelliteUserAddress(31);
1281 m_orbiterUserAddress40 = orbiterNetDevice1->GetSatelliteUserAddress(40);
1282 m_orbiterUserAddress41 = orbiterNetDevice1->GetSatelliteUserAddress(41);
1283
1284 Config::Connect("/NodeList/*/DeviceList/*/SatMac/Rx",
1286 Config::Connect("/NodeList/*/DeviceList/*/FeederMac/*/Rx",
1288 Config::Connect("/NodeList/*/DeviceList/*/UserMac/*/Rx",
1290
1291 simulationHelper->RunSimulation();
1292
1293 Simulator::Destroy();
1294
1295 SatEnvVariables::GetInstance()->DoDispose();
1296
1297 NS_TEST_ASSERT_MSG_NE(m_gwReceiveDate, Seconds(0), "Packet should be received by Gateway.");
1298 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate31,
1299 Seconds(0),
1300 "Ack should be received by End Device from satellite 0 and beam 31.");
1301 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate40,
1302 Seconds(0),
1303 "Ack should be received by End Device from satellite 1 and beam 40.");
1304 NS_TEST_ASSERT_MSG_NE(m_edReceiveDate41,
1305 Seconds(0),
1306 "Ack should be received by End Device from satellite 1 and beam 41.");
1307}
1308
1313class SatLoraRegenerativeTestSuite : public TestSuite
1314{
1315 public:
1317};
1318
1320 : TestSuite("sat-lora-regenerative-test", Type::SYSTEM)
1321{
1322 AddTestCase(new SatLoraRegenerativeFirstWindowTestCase, TestCase::Duration::QUICK);
1323 AddTestCase(new SatLoraRegenerativeSecondWindowTestCase, TestCase::Duration::QUICK);
1324 AddTestCase(new SatLoraRegenerativeOutOfWindowWindowTestCase, TestCase::Duration::QUICK);
1326 TestCase::Duration::QUICK);
1327 AddTestCase(new SatLoraRegenerativeCbrTestCase, TestCase::Duration::QUICK);
1328 AddTestCase(new SatLoraConstellationFirstWindowTestCase, TestCase::Duration::QUICK);
1329 AddTestCase(new SatLoraConstellationHandoverTestCase, TestCase::Duration::QUICK);
1330}
1331
1332// Do allocate an instance of this TestSuite
Test case to check if Lora ack arrives in first reception window when using a constellation.
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if Lora still works after hadovers.
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if packet is received on App layer.
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if Lora ack arrives in first reception window.
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check that packet is not retransmitted if ack outside of both windows but no retransmiss...
void PhyTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if packet retransmitted if ack outside of both windows.
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
void PhyTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if Lora ack arrives in second reception window.
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test suite for Satellite mobility unit test cases.
static Ptr< SatEnvVariables > GetInstance()
@ NONE
NONE Not used.
@ SIMPLE
SIMPLE Simple scenario used as base.
@ SATELLITE
For Satellite.
@ SUPER_FRAME_CONFIG_4
SUPER_FRAME_CONFIG_4.
@ CONFIG_TYPE_4
Configuration type 4 (ESSA).
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static SatLoraRegenerativeTestSuite satLoraRegenerativeTestSuite