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::SatGeoHelper::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>();
315 beamMap[std::make_pair(0, 1)] = beamInfo;
316 beamMap[std::make_pair(0, 5)] = beamInfo;
318 helper->CreateUserDefinedScenario(beamMap);
322 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
325 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
328 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
331 NodeContainer utUsers = helper->GetUtUsers();
332 NodeContainer gwUsers = helper->GetGwUsers();
336 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
337 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
340 ApplicationContainer utSinks = sinkHelper.Install(utUsers.Get(0));
343 sinkHelper.SetAttribute(
345 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(1)), port))));
346 utSinks.Add(sinkHelper.Install(utUsers.Get(1)));
347 utSinks.Start(Seconds(0.1));
348 utSinks.Stop(Seconds(0.5));
350 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
351 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
357 ApplicationContainer gw1Cbr = cbrHelper.Install(gwUsers.Get(0));
358 gw1Cbr.Start(Seconds(0.2));
359 gw1Cbr.Stop(Seconds(0.5));
362 cbrHelper.SetAttribute(
364 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(1)), port))));
368 ApplicationContainer gw2Cbr = cbrHelper.Install(gwUsers.Get(1));
369 gw2Cbr.Start(Seconds(0.2));
370 gw2Cbr.Stop(Seconds(1.0));
372 Simulator::Stop(Seconds(1.0));
376 Simulator::Destroy();
378 Singleton<SatEnvVariables>::Get()->DoDispose();
409 "Test satellite per packet interference in Forward Link with fullscenario. ";
422 UintegerValue pSize1,
424 UintegerValue pSize2);
428 virtual void DoRun(
void);
436 StringValue(
"0.00015s"),
448 "IfTestFwdFull_" + name,
451 StringValue(
"0.00015s"),
462 UintegerValue pSize1,
464 UintegerValue pSize2)
466 "IfTestFwdFull_" + name,
483 Singleton<SatEnvVariables>::Get()->DoInitialize();
488 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
492 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
493 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
496 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
497 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
498 Config::SetDefault(
"ns3::SatGeoHelper::DaFwdLinkInterferenceModel",
499 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
500 Config::SetDefault(
"ns3::SatUtHelper::DaFwdLinkInterferenceModel",
501 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
502 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
505 Ptr<SatHelper> helper = CreateObject<SatHelper>();
507 helper->CreatePredefinedScenario(SatHelper::FULL);
511 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
514 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
517 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
520 NodeContainer utUsers = helper->GetUtUsers();
521 NodeContainer gwUsers = helper->GetGwUsers();
525 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
526 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
529 ApplicationContainer utSinks = sinkHelper.Install(utUsers.Get(0));
532 sinkHelper.SetAttribute(
534 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(4)), port))));
535 utSinks.Add(sinkHelper.Install(utUsers.Get(4)));
536 utSinks.Start(Seconds(0.1));
537 utSinks.Stop(Seconds(1.0));
539 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
540 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
546 ApplicationContainer gw1Cbr = cbrHelper.Install(gwUsers.Get(0));
547 gw1Cbr.Start(Seconds(0.2));
548 gw1Cbr.Stop(Seconds(0.4));
551 cbrHelper.SetAttribute(
553 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(4)), port))));
557 ApplicationContainer gw2Cbr = cbrHelper.Install(gwUsers.Get(4));
558 gw2Cbr.Start(Seconds(0.2));
559 gw2Cbr.Stop(Seconds(0.4));
561 Simulator::Stop(Seconds(1.0));
565 Simulator::Destroy();
567 Singleton<SatEnvVariables>::Get()->DoDispose();
597 "Test satellite per packet interference in Return Link with user defined scenario. ";
607 UintegerValue pSize1,
609 UintegerValue pSize2);
614 virtual void DoRun(
void);
622 StringValue(
"0.01s"),
624 StringValue(
"0.01s"),
632 "IfTestRtnUsr_" + name,
635 StringValue(
"0.01s"),
637 StringValue(
"0.01s"),
645 UintegerValue pSize1,
647 UintegerValue pSize2)
649 "IfTestRtnUsr_" + name,
666 Singleton<SatEnvVariables>::Get()->DoInitialize();
671 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
675 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
676 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
679 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
680 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
681 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
682 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_0));
683 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
684 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType",
685 EnumValue(SatSuperframeConf::CONFIG_TYPE_0));
686 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(1.25e6));
687 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
688 DoubleValue(1.25e6));
689 Config::SetDefault(
"ns3::SatWaveformConf::DefaultWfId", UintegerValue(13));
690 Config::SetDefault(
"ns3::SatGwHelper::DaRtnLinkInterferenceModel",
691 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
692 Config::SetDefault(
"ns3::SatGeoHelper::DaRtnLinkInterferenceModel",
693 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
694 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
697 Ptr<SatHelper> helper = CreateObject<SatHelper>();
702 beamMap[std::make_pair(0, 1)] = beamInfo;
703 beamMap[std::make_pair(0, 5)] = beamInfo;
705 helper->CreateUserDefinedScenario(beamMap);
709 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
712 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
715 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
718 NodeContainer utUsers = helper->GetUtUsers();
719 NodeContainer gwUsers = helper->GetGwUsers();
723 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
724 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
727 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
728 gwSink.Start(Seconds(0.1));
729 gwSink.Stop(Seconds(0.5));
731 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
732 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
738 ApplicationContainer ut1Cbr = cbrHelper.Install(utUsers.Get(0));
739 ut1Cbr.Start(Seconds(0.1));
740 ut1Cbr.Stop(Seconds(0.4));
746 ApplicationContainer ut5Cbr = cbrHelper.Install(utUsers.Get(1));
747 ut5Cbr.Start(Seconds(0.1));
748 ut5Cbr.Stop(Seconds(0.4));
750 Simulator::Stop(Seconds(1.0));
754 Simulator::Destroy();
756 Singleton<SatEnvVariables>::Get()->DoDispose();
762 "Test satellite per packet interference in Return Link with full defined scenario. ";
773 UintegerValue pSize1,
775 UintegerValue pSize2);
779 virtual void DoRun(
void);
787 StringValue(
"0.01s"),
789 StringValue(
"0.01s"),
797 "IfTestRtnFull_" + name,
800 StringValue(
"0.01s"),
802 StringValue(
"0.01s"),
810 UintegerValue pSize1,
812 UintegerValue pSize2)
814 "IfTestRtnFull_" + name,
831 Singleton<SatEnvVariables>::Get()->DoInitialize();
836 Singleton<SatEnvVariables>::Get()->SetOutputVariables(
"test-sat-per-packet-if",
840 Config::SetDefault(
"ns3::SatBeamHelper::FadingModel", EnumValue(
m_fading));
841 Config::SetDefault(
"ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
844 Config::SetDefault(
"ns3::SatHelper::UtCount", UintegerValue(1));
845 Config::SetDefault(
"ns3::SatHelper::UtUsers", UintegerValue(1));
846 Config::SetDefault(
"ns3::SatConf::SuperFrameConfForSeq0",
847 EnumValue(SatSuperframeConf::SUPER_FRAME_CONFIG_0));
848 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
849 Config::SetDefault(
"ns3::SatSuperframeConf0::FrameConfigType",
850 EnumValue(SatSuperframeConf::CONFIG_TYPE_0));
851 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(1.25e6));
852 Config::SetDefault(
"ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
853 DoubleValue(1.25e6));
854 Config::SetDefault(
"ns3::SatWaveformConf::DefaultWfId", UintegerValue(13));
855 Config::SetDefault(
"ns3::SatGwHelper::DaRtnLinkInterferenceModel",
856 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
857 Config::SetDefault(
"ns3::SatGeoHelper::DaRtnLinkInterferenceModel",
858 EnumValue(SatPhyRxCarrierConf::IF_PER_PACKET));
859 Config::SetDefault(
"ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(
true));
862 Ptr<SatHelper> helper = CreateObject<SatHelper>();
863 helper->CreatePredefinedScenario(SatHelper::FULL);
867 Config::Connect(
"/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
870 Config::Connect(
"/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
873 Config::Connect(
"/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
876 NodeContainer utUsers = helper->GetUtUsers();
877 NodeContainer gwUsers = helper->GetGwUsers();
881 PacketSinkHelper sinkHelper(
"ns3::UdpSocketFactory",
882 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
885 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
886 gwSink.Start(Seconds(0.1));
887 gwSink.Stop(Seconds(0.5));
889 CbrHelper cbrHelper(
"ns3::UdpSocketFactory",
890 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
896 ApplicationContainer ut1Cbr = cbrHelper.Install(utUsers.Get(0));
897 ut1Cbr.Start(Seconds(0.1));
898 ut1Cbr.Stop(Seconds(0.4));
904 ApplicationContainer ut5Cbr = cbrHelper.Install(utUsers.Get(4));
905 ut5Cbr.Start(Seconds(0.1));
906 ut5Cbr.Stop(Seconds(0.4));
908 Simulator::Stop(Seconds(1.0));
912 Simulator::Destroy();
914 Singleton<SatEnvVariables>::Get()->DoDispose();
928 : TestSuite(
"sat-per-packet-if-test", SYSTEM)
937 SatEnums::FADING_MARKOV,
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