28 #include "ns3/boolean.h"
29 #include "ns3/config.h"
31 #include "ns3/mobility-helper.h"
32 #include "ns3/satellite-env-variables.h"
33 #include "ns3/satellite-mobility-model.h"
34 #include "ns3/satellite-position-allocator.h"
35 #include "ns3/simulator.h"
36 #include "ns3/singleton.h"
37 #include "ns3/string.h"
39 #include <ns3/cbr-application.h>
40 #include <ns3/cbr-helper.h>
42 #include <ns3/lora-periodic-sender.h>
43 #include <ns3/lorawan-mac-header.h>
44 #include <ns3/packet-sink-helper.h>
45 #include <ns3/packet-sink.h>
46 #include <ns3/satellite-enums.h>
47 #include <ns3/satellite-helper.h>
48 #include <ns3/satellite-lora-conf.h>
49 #include <ns3/satellite-lorawan-net-device.h>
50 #include <ns3/satellite-topology.h>
51 #include <ns3/uinteger.h>
74 virtual void DoRun(
void);
75 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
85 : TestCase(
"Test satellite lorawan with acks sent in first window."),
86 m_gwReceiveDate(Seconds(0)),
87 m_edReceiveDate(Seconds(0))
97 Ptr<const Packet> packet,
98 const Address& address)
115 Singleton<SatEnvVariables>::Get()->DoInitialize();
116 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-lora",
"first-window",
true);
119 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
120 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
121 EnumValue(LorawanMacHeader::CONFIRMED_DATA_UP));
122 Config::SetDefault(
"ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
124 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
125 TimeValue(MilliSeconds(1500)));
126 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
127 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
128 TimeValue(MilliSeconds(400)));
129 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
130 TimeValue(MilliSeconds(400)));
131 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay", TimeValue(Seconds(1)));
132 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
135 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
136 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_4));
137 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
138 EnumValue(SatSuperframeConf::CONFIG_TYPE_4));
139 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
140 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
144 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
145 BooleanValue(
false));
146 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
147 BooleanValue(
false));
150 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
151 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
152 EnumValue(SatPhyRxCarrierConf::SIC_RESIDUAL));
153 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
154 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
155 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
158 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
159 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
160 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
161 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
163 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
164 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
167 Ptr<SatHelper> helper = CreateObject<SatHelper>(
168 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E-lora");
169 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
172 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
173 Ptr<LoraPeriodicSender> app = Create<LoraPeriodicSender>();
175 app->SetInterval(Seconds(10));
177 app->SetStartTime(Seconds(1.0));
178 app->SetStopTime(Seconds(10.0));
179 app->SetPacketSize(24);
181 app->SetNode(utNode);
182 utNode->AddApplication(app);
184 m_gwAddress = Singleton<SatTopology>::Get()->GetGwNode(0)->GetDevice(1)->GetAddress();
185 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
187 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
190 Simulator::Stop(Seconds(10));
193 Simulator::Destroy();
195 Singleton<SatEnvVariables>::Get()->DoDispose();
197 NS_TEST_ASSERT_MSG_NE(
m_gwReceiveDate, Seconds(0),
"Packet should be received by Gateway.");
198 NS_TEST_ASSERT_MSG_NE(
m_edReceiveDate, Seconds(0),
"Ack should be received by End Device.");
202 Time delay = MilliSeconds(130);
204 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1) + delay,
"Ack arrived too early.");
205 NS_TEST_ASSERT_MSG_LT(difference + delay,
206 MilliSeconds(1900) + delay,
207 "Ack arrived too late. First window should be closed.");
226 virtual void DoRun(
void);
227 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
237 : TestCase(
"Test satellite lorawan with acks sent in second window."),
238 m_gwReceiveDate(Seconds(0)),
239 m_edReceiveDate(Seconds(0))
249 Ptr<const Packet> packet,
250 const Address& address)
267 Singleton<SatEnvVariables>::Get()->DoInitialize();
268 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-lora",
"second-window",
true);
271 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
272 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
273 EnumValue(LorawanMacHeader::CONFIRMED_DATA_UP));
274 Config::SetDefault(
"ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
276 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
277 TimeValue(MilliSeconds(1500)));
278 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
279 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
280 TimeValue(MilliSeconds(400)));
281 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
282 TimeValue(MilliSeconds(400)));
285 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
286 TimeValue(Seconds(1) + MilliSeconds(500)));
287 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
290 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
291 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_4));
292 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
293 EnumValue(SatSuperframeConf::CONFIG_TYPE_4));
294 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
295 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
299 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
300 BooleanValue(
false));
301 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
302 BooleanValue(
false));
305 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
306 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
307 EnumValue(SatPhyRxCarrierConf::SIC_RESIDUAL));
308 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
309 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
310 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
313 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
314 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
315 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
316 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
318 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
319 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
322 Ptr<SatHelper> helper = CreateObject<SatHelper>(
323 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E-lora");
324 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
327 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
328 Ptr<LoraPeriodicSender> app = Create<LoraPeriodicSender>();
330 app->SetInterval(Seconds(10));
332 app->SetStartTime(Seconds(1.0));
333 app->SetStopTime(Seconds(10.0));
334 app->SetPacketSize(24);
336 app->SetNode(utNode);
337 utNode->AddApplication(app);
339 m_gwAddress = Singleton<SatTopology>::Get()->GetGwNode(0)->GetDevice(1)->GetAddress();
340 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
342 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
345 Simulator::Stop(Seconds(10));
348 Simulator::Destroy();
350 Singleton<SatEnvVariables>::Get()->DoDispose();
351 NS_TEST_ASSERT_MSG_NE(
m_gwReceiveDate, Seconds(0),
"Packet should be received by Gateway.");
352 NS_TEST_ASSERT_MSG_NE(
m_edReceiveDate, Seconds(0),
"Ack should be received by End Device.");
356 Time delay = MilliSeconds(130);
358 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1.5) + delay,
"Ack arrived too early.");
359 NS_TEST_ASSERT_MSG_LT(difference + delay,
360 MilliSeconds(2400) + delay,
361 "Ack arrived too late. Second window should be closed.");
379 virtual void DoRun(
void);
380 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
381 void PhyTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
394 : TestCase(
"Test satellite lorawan with acks sent out of reception windows."),
395 m_edReceiveDate(Seconds(0)),
396 m_phyGwReceive(false),
397 m_phyEdReceive(false)
407 Ptr<const Packet> packet,
408 const Address& address)
423 Ptr<const Packet> packet,
424 const Address& address)
441 Singleton<SatEnvVariables>::Get()->DoInitialize();
442 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-lora",
"out-of-window",
true);
445 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
446 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
447 EnumValue(LorawanMacHeader::CONFIRMED_DATA_UP));
448 Config::SetDefault(
"ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
450 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
451 TimeValue(MilliSeconds(1500)));
452 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
453 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
454 TimeValue(MilliSeconds(400)));
455 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
456 TimeValue(MilliSeconds(400)));
458 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
459 TimeValue(Seconds(0.1)));
460 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
463 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
464 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_4));
465 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
466 EnumValue(SatSuperframeConf::CONFIG_TYPE_4));
467 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
468 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
472 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
473 BooleanValue(
false));
474 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
475 BooleanValue(
false));
478 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
479 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
480 EnumValue(SatPhyRxCarrierConf::SIC_RESIDUAL));
481 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
482 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
483 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
486 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
487 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
488 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
489 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
491 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
492 Config::SetDefault(
"ns3::SatPhy::EnableStatisticsTags", BooleanValue(
true));
493 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
496 Ptr<SatHelper> helper = CreateObject<SatHelper>(
497 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E-lora");
498 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
501 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
502 Ptr<LoraPeriodicSender> app = Create<LoraPeriodicSender>();
504 app->SetInterval(Seconds(10));
506 app->SetStartTime(Seconds(1.0));
507 app->SetStopTime(Seconds(10.0));
508 app->SetPacketSize(24);
510 app->SetNode(utNode);
511 utNode->AddApplication(app);
513 m_gwAddress = Singleton<SatTopology>::Get()->GetGwNode(0)->GetDevice(1)->GetAddress();
516 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
518 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/Rx",
521 Simulator::Stop(Seconds(10));
524 Simulator::Destroy();
526 Singleton<SatEnvVariables>::Get()->DoDispose();
530 "GW should receive a packet and the first retransmission.");
531 NS_TEST_ASSERT_MSG_EQ(
m_edReceiveDate, Seconds(0),
"No ack should be received by End Device.");
535 "Phy layer should trace traffic from End Device to Gateway.");
538 "Phy layer should not trace traffic from Gateway to End Device, as phy "
539 "layer is in SLEEP state.");
558 virtual void DoRun(
void);
559 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
560 void PhyTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
570 : TestCase(
"Test satellite lorawan with acks sent out of reception windows and no "
571 "retransmission needed."),
572 m_edReceiveDate(Seconds(0))
583 Ptr<const Packet> packet,
584 const Address& address)
601 Singleton<SatEnvVariables>::Get()->DoInitialize();
602 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-lora",
"out-of-window",
true);
605 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
606 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
607 EnumValue(LorawanMacHeader::UNCONFIRMED_DATA_UP));
608 Config::SetDefault(
"ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
610 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
611 TimeValue(MilliSeconds(1500)));
612 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
613 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
614 TimeValue(MilliSeconds(400)));
615 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
616 TimeValue(MilliSeconds(400)));
618 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay",
619 TimeValue(Seconds(0.1)));
620 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
623 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
624 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_4));
625 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
626 EnumValue(SatSuperframeConf::CONFIG_TYPE_4));
627 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
628 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
632 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
633 BooleanValue(
false));
634 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
635 BooleanValue(
false));
638 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
639 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
640 EnumValue(SatPhyRxCarrierConf::SIC_RESIDUAL));
641 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
642 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
643 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
646 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
647 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
648 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
649 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
651 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
652 Config::SetDefault(
"ns3::SatPhy::EnableStatisticsTags", BooleanValue(
true));
653 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
656 Ptr<SatHelper> helper = CreateObject<SatHelper>(
657 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E-lora");
658 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
661 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
662 Ptr<LoraPeriodicSender> app = Create<LoraPeriodicSender>();
664 app->SetInterval(Seconds(10));
666 app->SetStartTime(Seconds(1.0));
667 app->SetStopTime(Seconds(10.0));
668 app->SetPacketSize(24);
670 app->SetNode(utNode);
671 utNode->AddApplication(app);
673 m_gwAddress = Singleton<SatTopology>::Get()->GetGwNode(0)->GetDevice(1)->GetAddress();
677 "/NodeList/*/DeviceList/*/SatMac/Rx",
680 Simulator::Stop(Seconds(10));
683 Simulator::Destroy();
685 Singleton<SatEnvVariables>::Get()->DoDispose();
689 "GW should receive a packet but no retransmission.");
690 NS_TEST_ASSERT_MSG_EQ(
m_edReceiveDate, Seconds(0),
"No ack should be received by End Device.");
708 virtual void DoRun(
void);
709 void MacTraceCb(std::string context, Ptr<const Packet> packet,
const Address& address);
719 : TestCase(
"Test satellite lorawan with acks sent in second window."),
720 m_edReceiveDate(Seconds(0))
730 Ptr<const Packet> packet,
731 const Address& address)
748 Singleton<SatEnvVariables>::Get()->DoInitialize();
749 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-lora",
"cbr",
true);
752 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
753 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
754 EnumValue(LorawanMacHeader::CONFIRMED_DATA_UP));
755 Config::SetDefault(
"ns3::SatLoraConf::Standard", EnumValue(SatLoraConf::SATELLITE));
757 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDelay",
758 TimeValue(MilliSeconds(1500)));
759 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDelay", TimeValue(Seconds(2)));
760 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::FirstWindowDuration",
761 TimeValue(MilliSeconds(400)));
762 Config::SetDefault(
"ns3::LorawanMacEndDeviceClassA::SecondWindowDuration",
763 TimeValue(MilliSeconds(400)));
764 Config::SetDefault(
"ns3::LoraNetworkScheduler::FirstWindowAnswerDelay", TimeValue(Seconds(1)));
765 Config::SetDefault(
"ns3::LoraNetworkScheduler::SecondWindowAnswerDelay", TimeValue(Seconds(2)));
768 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
769 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_4));
770 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
771 EnumValue(SatSuperframeConf::CONFIG_TYPE_4));
772 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_AllocatedBandwidthHz", DoubleValue(15000));
773 Config::SetDefault(
"ns3::SatSuperframeConf4::Frame0_CarrierAllocatedBandwidthHz",
777 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
778 BooleanValue(
false));
779 Config::SetDefault(
"ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
780 BooleanValue(
false));
783 Config::SetDefault(
"ns3::SatBeamHelper::RandomAccessModel", EnumValue(SatEnums::RA_MODEL_ESSA));
784 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
785 EnumValue(SatPhyRxCarrierConf::SIC_RESIDUAL));
786 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
787 EnumValue(SatPhyRxCarrierConf::RA_COLLISION_CHECK_AGAINST_SINR));
788 Config::SetDefault(
"ns3::SatBeamHelper::ReturnLinkLinkResults", EnumValue(SatEnums::LR_LORA));
791 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowDuration", StringValue(
"600ms"));
792 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowStep", StringValue(
"200ms"));
793 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::WindowSICIterations", UintegerValue(5));
794 Config::SetDefault(
"ns3::SatPhyRxCarrierPerWindow::EnableSIC", BooleanValue(
false));
796 Config::SetDefault(
"ns3::CbrApplication::Interval", StringValue(
"10s"));
797 Config::SetDefault(
"ns3::CbrApplication::PacketSize", UintegerValue(24));
799 Config::SetDefault(
"ns3::SatMac::EnableStatisticsTags", BooleanValue(
true));
800 Config::SetDefault(
"ns3::SatHelper::PacketTraceEnabled", BooleanValue(
true));
803 Ptr<SatHelper> helper = CreateObject<SatHelper>(
804 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E-lora");
805 helper->CreatePredefinedScenario(SatHelper::SIMPLE);
807 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
808 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
809 InetSocketAddress gwUserAddr = InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), 9);
811 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory", Address());
812 CbrHelper cbrHelper(
"ns3::UdpSocketFactory", Address());
813 ApplicationContainer sinkContainer;
814 ApplicationContainer cbrContainer;
816 sinkHelper.SetAttribute(
"Local", AddressValue(Address(gwUserAddr)));
817 sinkContainer.Add(sinkHelper.Install(gwUsers.Get(0)));
819 cbrHelper.SetAttribute(
"Remote", AddressValue(Address(gwUserAddr)));
821 auto app = cbrHelper.Install(utUsers.Get(0)).Get(0);
822 app->SetStartTime(Seconds(1));
823 cbrContainer.Add(app);
825 sinkContainer.Start(Seconds(1));
826 sinkContainer.Stop(Seconds(20));
828 m_gwAddress = Singleton<SatTopology>::Get()->GetGwNode(0)->GetDevice(1)->GetAddress();
829 m_edAddress = Singleton<SatTopology>::Get()->GetUtNode(0)->GetDevice(2)->GetAddress();
831 Ptr<PacketSink> receiver = DynamicCast<PacketSink>(sinkContainer.Get(0));
833 Config::Connect(
"/NodeList/*/DeviceList/*/SatMac/Rx",
836 Simulator::Stop(Seconds(20));
839 Simulator::Destroy();
841 Singleton<SatEnvVariables>::Get()->DoDispose();
843 NS_TEST_ASSERT_MSG_NE(
m_gwReceiveDate, Seconds(0),
"Packet should be received by Gateway.");
844 NS_TEST_ASSERT_MSG_NE(
m_edReceiveDate, Seconds(0),
"Ack should be received by End Device.");
848 Time delay = MilliSeconds(130);
850 NS_TEST_ASSERT_MSG_GT(difference, Seconds(1) + delay,
"Ack arrived too early.");
851 NS_TEST_ASSERT_MSG_LT(difference + delay,
852 MilliSeconds(1900) + delay,
853 "Ack arrived too late. First window should be closed.");
855 NS_TEST_ASSERT_MSG_EQ(receiver->GetTotalRx(), 24,
"Sink should receive one packet of 24 bytes");
869 : TestSuite(
"sat-lora-test", Type::SYSTEM)
Test case to check if packet is received on App layer.
virtual ~SatLoraCbrTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test case to check if Lora ack arrives in first reception window.
virtual ~SatLoraFirstWindowTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
SatLoraFirstWindowTestCase()
Test case to check that packet is not retransmitted if ack outside of both windows but no retransmiss...
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
void PhyTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
std::vector< Time > m_gwReceiveDates
SatLoraOutOfWindowWindowNoRetransmissionTestCase()
virtual ~SatLoraOutOfWindowWindowNoRetransmissionTestCase()
Test case to check if packet retransmitted if ack outside of both windows.
std::vector< Time > m_gwReceiveDates
SatLoraOutOfWindowWindowTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
virtual ~SatLoraOutOfWindowWindowTestCase()
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 ~SatLoraSecondWindowTestCase()
SatLoraSecondWindowTestCase()
void MacTraceCb(std::string context, Ptr< const Packet > packet, const Address &address)
Test suite for Satellite mobility unit test cases.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static SatLoraTestSuite satLoraTestSuite