28 #include "ns3/applications-module.h"
29 #include "ns3/boolean.h"
30 #include "ns3/config.h"
32 #include "ns3/satellite-module.h"
33 #include "ns3/simulator.h"
34 #include "ns3/singleton.h"
35 #include "ns3/string.h"
37 #include "ns3/timer.h"
38 #include "ns3/traffic-module.h"
46 Ptr<SatSignalParameters> params,
53 if (!destAdd.IsBroadcast())
55 std::cout.precision(2);
56 std::cout.setf(std::cout.fixed | std::cout.showpoint);
58 std::cout <<
"Time= " << Simulator::Now() <<
", ChType= " << std::setw(17)
60 <<
", DestAddr= " << destAdd <<
", Beam= " << std::setw(2) << params->m_beamId
61 <<
", Freq= " << params->m_carrierFreq_hz <<
", IFPwr= " << std::setw(8)
62 << SatUtils::WToDbW<double>(ifPower) <<
", RXPwr= " << std::setw(8)
63 << SatUtils::WToDbW<double>(params->m_rxPower_W) <<
", SINR= " << std::setw(7)
64 << SatUtils::LinearToDb<double>(params->GetSinr()) <<
", CSINR= " << std::setw(7)
65 << SatUtils::LinearToDb<double>(cSinr) << std::endl;
80 UintegerValue pSize2);
85 void InitOutput(
bool figureOutput);
86 void PrintTraceInfo();
117 UintegerValue pSize1,
119 UintegerValue pSize2)
123 m_PackageSize1(pSize1),
124 m_PackageSize2(pSize2),
127 m_dummyFrames(dummyFrames)
138 Ptr<SatIdMapper> ptrMapper = Singleton<SatIdMapper>::Get();
141 Ptr<SatInterferenceOutputTraceContainer> ptrCont =
142 Singleton<SatInterferenceOutputTraceContainer>::Get();
147 while (pos != std::string::npos)
155 while (pos != std::string::npos)
163 while (pos != std::string::npos)
169 ptrCont->EnableFigureOutput(figureOutput);
175 Ptr<SatIdMapper> ptrMapper = Singleton<SatIdMapper>::Get();
178 ptrMapper->PrintTraceMap();
209 "Test satellite per packet interference in Forward Link with user defined scenario. ";
222 UintegerValue pSize1,
224 UintegerValue pSize2);
229 virtual void DoRun(
void);
237 StringValue(
"0.00015s"),
248 "IfTestFwdUsr_" + name,
251 StringValue(
"0.00015s"),
262 UintegerValue pSize1,
264 UintegerValue pSize2)
266 "IfTestFwdUsr_" + name,
283 Singleton<SatEnvVariables>::Get()->DoInitialize();
288 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
294 Config::SetDefault(
"ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
295 Config::SetDefault(
"ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
297 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
298 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
301 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
302 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
303 Config::SetDefault(
"ns3::SatOrbiterHelper::DaFwdLinkInterferenceModel",
304 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
305 Config::SetDefault(
"ns3::SatUtHelper::DaFwdLinkInterferenceModel",
306 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
307 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
310 Ptr<SatHelper> helper = CreateObject<SatHelper>(
311 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
316 beamMap[std::make_pair(0, 1)] = beamInfo;
317 beamMap[std::make_pair(0, 5)] = beamInfo;
319 helper->CreateUserDefinedScenario(beamMap);
323 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
326 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
329 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
332 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
333 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
337 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
338 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
341 ApplicationContainer utSinks = sinkHelper.Install(utUsers.Get(0));
344 sinkHelper.SetAttribute(
346 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(1)), port))));
347 utSinks.Add(sinkHelper.Install(utUsers.Get(1)));
348 utSinks.Start(Seconds(0.1));
349 utSinks.Stop(Seconds(0.5));
351 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
352 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
358 ApplicationContainer gw1Cbr = cbrHelper.Install(gwUsers.Get(0));
359 gw1Cbr.Start(Seconds(0.2));
360 gw1Cbr.Stop(Seconds(0.5));
363 cbrHelper.SetAttribute(
365 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(1)), port))));
369 ApplicationContainer gw2Cbr = cbrHelper.Install(gwUsers.Get(1));
370 gw2Cbr.Start(Seconds(0.2));
371 gw2Cbr.Stop(Seconds(1.0));
373 Simulator::Stop(Seconds(1.0));
377 Simulator::Destroy();
379 Singleton<SatEnvVariables>::Get()->DoDispose();
410 "Test satellite per packet interference in Forward Link with fullscenario. ";
423 UintegerValue pSize1,
425 UintegerValue pSize2);
429 virtual void DoRun(
void);
437 StringValue(
"0.00015s"),
449 "IfTestFwdFull_" + name,
452 StringValue(
"0.00015s"),
463 UintegerValue pSize1,
465 UintegerValue pSize2)
467 "IfTestFwdFull_" + name,
484 Singleton<SatEnvVariables>::Get()->DoInitialize();
489 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
493 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
494 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
497 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
498 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
499 Config::SetDefault(
"ns3::SatOrbiterHelper::DaFwdLinkInterferenceModel",
500 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
501 Config::SetDefault(
"ns3::SatUtHelper::DaFwdLinkInterferenceModel",
502 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
503 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
506 Ptr<SatHelper> helper = CreateObject<SatHelper>(
507 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
509 helper->CreatePredefinedScenario(SatHelper::FULL);
513 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
516 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
519 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
522 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
523 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
527 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
528 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
531 ApplicationContainer utSinks = sinkHelper.Install(utUsers.Get(0));
534 sinkHelper.SetAttribute(
536 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(4)), port))));
537 utSinks.Add(sinkHelper.Install(utUsers.Get(4)));
538 utSinks.Start(Seconds(0.1));
539 utSinks.Stop(Seconds(1.0));
541 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
542 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
548 ApplicationContainer gw1Cbr = cbrHelper.Install(gwUsers.Get(0));
549 gw1Cbr.Start(Seconds(0.2));
550 gw1Cbr.Stop(Seconds(0.4));
553 cbrHelper.SetAttribute(
555 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(4)), port))));
559 ApplicationContainer gw2Cbr = cbrHelper.Install(gwUsers.Get(4));
560 gw2Cbr.Start(Seconds(0.2));
561 gw2Cbr.Stop(Seconds(0.4));
563 Simulator::Stop(Seconds(1.0));
567 Simulator::Destroy();
569 Singleton<SatEnvVariables>::Get()->DoDispose();
599 "Test satellite per packet interference in Return Link with user defined scenario. ";
609 UintegerValue pSize1,
611 UintegerValue pSize2);
616 virtual void DoRun(
void);
624 StringValue(
"0.01s"),
626 StringValue(
"0.01s"),
634 "IfTestRtnUsr_" + name,
637 StringValue(
"0.01s"),
639 StringValue(
"0.01s"),
647 UintegerValue pSize1,
649 UintegerValue pSize2)
651 "IfTestRtnUsr_" + name,
668 Singleton<SatEnvVariables>::Get()->DoInitialize();
673 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
677 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
678 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
681 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
682 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
683 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
684 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_0));
685 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
686 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType",
687 EnumValue(SatSuperframeConf::CONFIG_TYPE_0));
688 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(1.25e6));
689 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
690 DoubleValue(1.25e6));
692 Config::SetDefault(
"ns3::SatGwHelper::DaRtnLinkInterferenceModel",
693 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
694 Config::SetDefault(
"ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
695 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
696 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
699 Ptr<SatHelper> helper = CreateObject<SatHelper>(
700 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
705 beamMap[std::make_pair(0, 1)] = beamInfo;
706 beamMap[std::make_pair(0, 5)] = beamInfo;
708 helper->CreateUserDefinedScenario(beamMap);
712 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
715 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
718 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
721 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
722 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
726 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
727 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
730 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
731 gwSink.Start(Seconds(0.1));
732 gwSink.Stop(Seconds(0.5));
734 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
735 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
741 ApplicationContainer ut1Cbr = cbrHelper.Install(utUsers.Get(0));
742 ut1Cbr.Start(Seconds(0.1));
743 ut1Cbr.Stop(Seconds(0.4));
749 ApplicationContainer ut5Cbr = cbrHelper.Install(utUsers.Get(1));
750 ut5Cbr.Start(Seconds(0.1));
751 ut5Cbr.Stop(Seconds(0.4));
753 Simulator::Stop(Seconds(1.0));
757 Simulator::Destroy();
759 Singleton<SatEnvVariables>::Get()->DoDispose();
765 "Test satellite per packet interference in Return Link with full defined scenario. ";
776 UintegerValue pSize1,
778 UintegerValue pSize2);
782 virtual void DoRun(
void);
790 StringValue(
"0.01s"),
792 StringValue(
"0.01s"),
800 "IfTestRtnFull_" + name,
803 StringValue(
"0.01s"),
805 StringValue(
"0.01s"),
813 UintegerValue pSize1,
815 UintegerValue pSize2)
817 "IfTestRtnFull_" + name,
834 Singleton<SatEnvVariables>::Get()->DoInitialize();
839 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
843 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
844 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
847 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
848 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
849 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
850 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_0));
851 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
852 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType",
853 EnumValue(SatSuperframeConf::CONFIG_TYPE_0));
854 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(1.25e6));
855 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
856 DoubleValue(1.25e6));
858 Config::SetDefault(
"ns3::SatGwHelper::DaRtnLinkInterferenceModel",
859 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
860 Config::SetDefault(
"ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
861 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
862 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
865 Ptr<SatHelper> helper = CreateObject<SatHelper>(
866 Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
"/scenarios/geo-33E");
867 helper->CreatePredefinedScenario(SatHelper::FULL);
871 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
874 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
877 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
880 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
881 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
885 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
886 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
889 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
890 gwSink.Start(Seconds(0.1));
891 gwSink.Stop(Seconds(0.5));
893 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
894 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
900 ApplicationContainer ut1Cbr = cbrHelper.Install(utUsers.Get(0));
901 ut1Cbr.Start(Seconds(0.1));
902 ut1Cbr.Stop(Seconds(0.4));
908 ApplicationContainer ut5Cbr = cbrHelper.Install(utUsers.Get(4));
909 ut5Cbr.Start(Seconds(0.1));
910 ut5Cbr.Stop(Seconds(0.4));
912 Simulator::Stop(Seconds(1.0));
916 Simulator::Destroy();
918 Singleton<SatEnvVariables>::Get()->DoDispose();
932 : TestSuite(
"sat-per-packet-if-test", Type::SYSTEM)
936 TestCase::Duration::QUICK);
939 TestCase::Duration::QUICK);
941 SatEnums::FADING_MARKOV,
943 TestCase::Duration::QUICK);
948 TestCase::Duration::QUICK);
951 TestCase::Duration::QUICK);
955 TestCase::Duration::QUICK);
virtual void DoRun(void)=0
SatEnums::FadingModel_t m_fading
void InitOutput(bool figureOutput)
UintegerValue m_PackageSize1
virtual ~SatPerPacketBaseTestCase()
SatPerPacketBaseTestCase()
UintegerValue m_PackageSize2
SatPerPacketFwdLinkFullTestCase()
virtual ~SatPerPacketFwdLinkFullTestCase()
SatPerPacketFwdLinkUserTestCase()
virtual ~SatPerPacketFwdLinkUserTestCase()
Test suite for Satellite interference unit test cases.
SatPerPacketIfTestSuite()
SatPerPacketRtnLinkFullTestCase()
virtual ~SatPerPacketRtnLinkFullTestCase()
SatPerPacketRtnLinkUserTestCase()
virtual ~SatPerPacketRtnLinkUserTestCase()
Class that holds information for each beam regarding UTs and their users camped in each beam.
SatEnums class is for simplifying the use of enumerators in the satellite module.
static std::string GetChannelTypeName(ChannelType_t channelType)
FadingModel_t
Fading models.
ErrorModel
Error model enum.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static SatPerPacketIfTestSuite satSatPerPacketIfTestSuite
static const char * defRtnUserName
Per-packet interference, Return Link System test case.
static const char * defFwdUserName
Per-packet interference, Forward Link System test case.
static const char * defFwdFullName
Per-packet interference, Forward Link System test case.
static void LinkBudgetTraceCb(std::string context, Ptr< SatSignalParameters > params, Mac48Address ownAdd, Mac48Address destAdd, double ifPower, double cSinr)
static const char * defRtnFullName