28#include "ns3/boolean.h"
29#include "ns3/cbr-application.h"
30#include "ns3/cbr-helper.h"
31#include "ns3/config.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"
52#include "ns3/uinteger.h"
75 virtual void DoRun(
void);
76 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
86 : TestCase(
"Test regenerative satellite lorawan with acks sent in first window."),
98 Ptr<const Packet> packet,
99 const Address& address)
122 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
123 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
128 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
130 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
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",
154 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
155 BooleanValue(
false));
156 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
157 BooleanValue(
false));
160 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
162 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
165 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
167 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
169 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
177 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
180 Ptr<SatHelper> helper = CreateObject<SatHelper>(
185 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
186 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
188 app->SetInterval(Seconds(10));
190 app->SetStartTime(Seconds(1.0));
191 app->SetStopTime(Seconds(10.0));
192 app->SetPacketSize(24);
194 app->SetNode(utNode);
195 utNode->AddApplication(app);
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();
202 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
204 Config::Connect(
"/NodeList/*/DeviceList/*/FeederMac/*/Rx",
207 Simulator::Stop(Seconds(10));
210 Simulator::Destroy();
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.");
219 Time delay = MilliSeconds(130);
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.");
243 virtual void DoRun(
void);
244 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
254 : TestCase(
"Test regenerative satellite lorawan with acks sent in second window."),
266 Ptr<const Packet> packet,
267 const Address& address)
290 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
291 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
296 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
298 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
310 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
311 TimeValue(Seconds(1) + MilliSeconds(500)));
312 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
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",
324 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
325 BooleanValue(
false));
326 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
327 BooleanValue(
false));
330 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
332 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
335 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
337 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
339 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
347 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
350 Ptr<SatHelper> helper = CreateObject<SatHelper>(
355 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
356 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
358 app->SetInterval(Seconds(10));
360 app->SetStartTime(Seconds(1.0));
361 app->SetStopTime(Seconds(10.0));
362 app->SetPacketSize(24);
364 app->SetNode(utNode);
365 utNode->AddApplication(app);
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();
372 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
374 Config::Connect(
"/NodeList/*/DeviceList/*/FeederMac/*/Rx",
377 Simulator::Stop(Seconds(10));
380 Simulator::Destroy();
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.");
388 Time delay = MilliSeconds(130);
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.");
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);
426 : TestCase(
"Test regenerative satellite lorawan with acks sent out of reception windows."),
439 Ptr<const Packet> packet,
440 const Address& address)
455 Ptr<const Packet> packet,
456 const Address& address)
479 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
480 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
485 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
487 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
498 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
499 TimeValue(Seconds(0.1)));
500 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
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",
512 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
513 BooleanValue(
false));
514 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
515 BooleanValue(
false));
518 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
520 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
523 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
525 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
527 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
535 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
536 Config::SetDefault(
"ns3::SatPhy::EnableStatisticsTags", BooleanValue(
true));
539 Ptr<SatHelper> helper = CreateObject<SatHelper>(
544 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
545 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
547 app->SetInterval(Seconds(10));
549 app->SetStartTime(Seconds(1.0));
550 app->SetStopTime(Seconds(10.0));
551 app->SetPacketSize(24);
553 app->SetNode(utNode);
554 utNode->AddApplication(app);
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();
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",
572 Simulator::Stop(Seconds(10));
575 Simulator::Destroy();
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.");
586 "Phy layer should trace traffic from End Device to Gateway.");
589 "Phy layer should not trace traffic from Gateway to End Device, as phy "
590 "layer is in SLEEP state.");
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);
622 : TestCase(
"Test regenerative satellite lorawan with acks sent out of reception windows and no "
623 "retransmission needed."),
635 Ptr<const Packet> packet,
636 const Address& address)
659 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
660 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
665 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
667 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
678 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
679 TimeValue(Seconds(0.1)));
680 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
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",
692 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
693 BooleanValue(
false));
694 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
695 BooleanValue(
false));
698 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
700 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
703 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
705 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
707 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
715 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
716 Config::SetDefault(
"ns3::SatPhy::EnableStatisticsTags", BooleanValue(
true));
719 Ptr<SatHelper> helper = CreateObject<SatHelper>(
724 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
725 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
727 app->SetInterval(Seconds(10));
729 app->SetStartTime(Seconds(1.0));
730 app->SetStopTime(Seconds(10.0));
731 app->SetPacketSize(24);
733 app->SetNode(utNode);
734 utNode->AddApplication(app);
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();
742 "/NodeList/*/DeviceList/*/SatMac/Rx",
746 "/NodeList/*/DeviceList/*/FeederMac/*/Rx",
750 Simulator::Stop(Seconds(10));
753 Simulator::Destroy();
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.");
778 virtual void DoRun(
void);
779 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
789 : TestCase(
"Test regenerativesatellite lorawan with CBR traffic."),
800 Ptr<const Packet> packet,
801 const Address& address)
822 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
823 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
828 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
830 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
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",
853 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
854 BooleanValue(
false));
855 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
856 BooleanValue(
false));
859 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
861 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
864 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
866 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
868 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
876 Config::SetDefault(
"ns3::CbrApplication::Interval", StringValue(
"10s"));
877 Config::SetDefault(
"ns3::CbrApplication::PacketSize", UintegerValue(24));
879 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
882 Ptr<SatHelper> helper = CreateObject<SatHelper>(
886 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
887 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
888 InetSocketAddress gwUserAddr = InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), 9);
890 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory", Address());
891 CbrHelper cbrHelper(
"ns3::UdpSocketFactory", Address());
892 ApplicationContainer sinkContainer;
893 ApplicationContainer cbrContainer;
895 sinkHelper.SetAttribute(
"Local", AddressValue(Address(gwUserAddr)));
896 sinkContainer.Add(sinkHelper.Install(gwUsers.Get(0)));
898 cbrHelper.SetAttribute(
"Remote", AddressValue(Address(gwUserAddr)));
900 auto app = cbrHelper.Install(utUsers.Get(0)).Get(0);
901 app->SetStartTime(Seconds(1));
902 cbrContainer.Add(app);
904 sinkContainer.Start(Seconds(1));
905 sinkContainer.Stop(Seconds(20));
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();
912 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(sinkContainer.Get(0));
914 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
916 Config::Connect(
"/NodeList/*/DeviceList/*/FeederMac/*/Rx",
919 Simulator::Stop(Seconds(20));
922 Simulator::Destroy();
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.");
931 Time delay = MilliSeconds(130);
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.");
938 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), 24,
"Sink should receive one packet of 24 bytes");
958 virtual void DoRun(
void);
959 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
969 : TestCase(
"Test constellation satellite lorawan with acks sent in first window."),
981 Ptr<const Packet> packet,
982 const Address& address)
1001 Ptr<SimulationHelper> simulationHelper =
1002 CreateObject<SimulationHelper>(
"test-sat-lora-regenerative/constellation-first-window");
1005 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
1006 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
1011 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
1013 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
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));
1036 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
1037 BooleanValue(
false));
1038 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
1039 BooleanValue(
false));
1042 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
1044 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
1047 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
1049 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
1051 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
1059 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
1062 simulationHelper->SetSimulationTime(Seconds(15.0));
1064 simulationHelper->SetGwUserCount(1);
1065 simulationHelper->SetUtCountPerBeam(1);
1066 simulationHelper->SetUserCountPerUt(1);
1067 simulationHelper->SetBeams(
"30 43");
1069 simulationHelper->LoadScenario(
"constellation-eutelsat-geo-2-sats-isls-lora");
1071 simulationHelper->CreateSatScenario();
1074 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
1075 Ptr<LoraPeriodicSender> app = CreateObject<LoraPeriodicSender>();
1077 app->SetInterval(Seconds(10));
1079 app->SetStartTime(Seconds(1.0));
1080 app->SetStopTime(Seconds(10.0));
1081 app->SetPacketSize(24);
1083 app->SetNode(utNode);
1084 utNode->AddApplication(app);
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();
1093 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
1095 Config::Connect(
"/NodeList/*/DeviceList/*/FeederMac/*/Rx",
1098 simulationHelper->RunSimulation();
1100 Simulator::Destroy();
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.");
1109 Time delay = MilliSeconds(130);
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.");
1133 virtual void DoRun(
void);
1134 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
1148 : TestCase(
"Test constellation satellite lorawan with handovers."),
1162 Ptr<const Packet> packet,
1163 const Address& address)
1192 Ptr<SimulationHelper> simulationHelper =
1193 CreateObject<SimulationHelper>(
"test-sat-lora-regenerative/constellation-handover");
1196 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
1197 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
1202 Config::SetDefault(
"ns3::SatConf::ForwardLinkRegenerationMode",
1204 Config::SetDefault(
"ns3::SatConf::ReturnLinkRegenerationMode",
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)));
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));
1227 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
1228 BooleanValue(
false));
1229 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
1230 BooleanValue(
false));
1233 Config::SetDefault(
"ns3::SatOrbiterHelper::FwdLinkErrorModel",
1235 Config::SetDefault(
"ns3::SatOrbiterHelper::RtnLinkErrorModel",
1238 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
1240 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
1242 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(
SatEnums::LR_LORA));
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));
1250 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
1252 Config::SetDefault(
"ns3::SatHelper::HandoversEnabled", BooleanValue(
true));
1253 Config::SetDefault(
"ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
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);
1265 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
1266 simulationHelper->GetTrafficHelper()->AddLoraPeriodicTraffic(Seconds(10),
1268 NodeContainer(utNode),
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));
1278 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
1284 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
1286 Config::Connect(
"/NodeList/*/DeviceList/*/FeederMac/*/Rx",
1288 Config::Connect(
"/NodeList/*/DeviceList/*/UserMac/*/Rx",
1291 simulationHelper->RunSimulation();
1293 Simulator::Destroy();
1297 NS_TEST_ASSERT_MSG_NE(
m_gwReceiveDate, Seconds(0),
"Packet should be received by Gateway.");
1300 "Ack should be received by End Device from satellite 0 and beam 31.");
1303 "Ack should be received by End Device from satellite 1 and beam 40.");
1306 "Ack should be received by End Device from satellite 1 and beam 41.");
1320 : TestSuite(
"sat-lora-regenerative-test", Type::SYSTEM)
1326 TestCase::Duration::QUICK);
Test case to check if Lora ack arrives in first reception window when using a constellation.
Address m_orbiterUserAddress
SatLoraConstellationFirstWindowTestCase()
virtual ~SatLoraConstellationFirstWindowTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if Lora still works after hadovers.
Address m_orbiterUserAddress41
Address m_orbiterUserAddress40
SatLoraConstellationHandoverTestCase()
Address m_orbiterUserAddress31
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
virtual ~SatLoraConstellationHandoverTestCase()
Test case to check if packet is received on App layer.
virtual ~SatLoraRegenerativeCbrTestCase()
SatLoraRegenerativeCbrTestCase()
Address m_orbiterUserAddress
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)
virtual ~SatLoraRegenerativeFirstWindowTestCase()
Address m_orbiterUserAddress
SatLoraRegenerativeFirstWindowTestCase()
Test case to check that packet is not retransmitted if ack outside of both windows but no retransmiss...
SatLoraRegenerativeOutOfWindowWindowNoRetransmissionTestCase()
void PhyTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
virtual ~SatLoraRegenerativeOutOfWindowWindowNoRetransmissionTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
std::vector< Time > m_gwReceiveDates
Address m_orbiterUserAddress
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)
SatLoraRegenerativeOutOfWindowWindowTestCase()
Address m_orbiterUserAddress
std::vector< Time > m_gwReceiveDates
virtual ~SatLoraRegenerativeOutOfWindowWindowTestCase()
void PhyTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if Lora ack arrives in second reception window.
virtual ~SatLoraRegenerativeSecondWindowTestCase()
Address m_orbiterUserAddress
SatLoraRegenerativeSecondWindowTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test suite for Satellite mobility unit test cases.
SatLoraRegenerativeTestSuite()
static Ptr< SatEnvVariables > GetInstance()
@ SIMPLE
SIMPLE Simple scenario used as base.
@ SATELLITE
For Satellite.
@ RA_COLLISION_CHECK_AGAINST_SINR
@ 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