119 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
120 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
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",
137 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
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));
151 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
153 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
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>(
172 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
173 Ptr<LoraPeriodicSender> app = CreateObject<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();
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.");
271 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
272 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
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",
292 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
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));
306 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
308 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
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>(
327 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
328 Ptr<LoraPeriodicSender> app = CreateObject<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();
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.");
445 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
446 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
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",
465 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
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));
479 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
481 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
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>(
501 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
502 Ptr<LoraPeriodicSender> app = CreateObject<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();
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.");
605 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
606 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
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",
625 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
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));
639 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
641 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
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>(
661 Ptr<Node> utNode = Singleton<SatTopology>::Get()->GetUtNode(0);
662 Ptr<LoraPeriodicSender> app = CreateObject<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();
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.");
752 Config::SetDefault(
"ns3::LorawanMacEndDevice::DataRate", UintegerValue(5));
753 Config::SetDefault(
"ns3::LorawanMacEndDevice::MType",
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",
770 Config::SetDefault(
"ns3::SatSuperframeConf4::FrameConfigType",
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));
784 Config::SetDefault(
"ns3::SatBeamHelper::RaInterferenceEliminationModel",
786 Config::SetDefault(
"ns3::SatBeamHelper::RaCollisionModel",
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>(
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();
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");