Loading...
Searching...
No Matches
satellite-per-packet-if-test.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Sami Rantanen <sami.rantanen@magister.fi>
19 */
20
26
27// Include a header file from your module to test.
28#include "ns3/applications-module.h"
29#include "ns3/boolean.h"
30#include "ns3/config.h"
31#include "ns3/log.h"
32#include "ns3/satellite-module.h"
33#include "ns3/simulator.h"
34#include "ns3/singleton.h"
35#include "ns3/string.h"
36#include "ns3/test.h"
37#include "ns3/timer.h"
38#include "ns3/traffic-module.h"
39
40#include <iomanip>
41
42using namespace ns3;
43
44static void
45LinkBudgetTraceCb(std::string context,
46 Ptr<SatSignalParameters> params,
47 Mac48Address ownAdd,
48 Mac48Address destAdd,
49 double ifPower,
50 double cSinr)
51{
52 // print only unicast message to prevent printing control messages like TBTP messages
53 if (!destAdd.IsBroadcast())
54 {
55 std::cout.precision(2);
56 std::cout.setf(std::cout.fixed | std::cout.showpoint);
57
58 std::cout << "Time= " << Simulator::Now() << ", ChType= " << std::setw(17)
59 << SatEnums::GetChannelTypeName(params->m_channelType) << ", OwnAddr= " << ownAdd
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;
66 }
67}
68
69class SatPerPacketBaseTestCase : public TestCase
70{
71 public:
73 SatPerPacketBaseTestCase(std::string name,
74 std::string extName,
76 bool dummyFrames,
77 StringValue ival1,
78 UintegerValue pSize1,
79 StringValue ival2,
80 UintegerValue pSize2);
82
83 protected:
84 virtual void DoRun(void) = 0;
85 void InitOutput(bool figureOutput);
86 void PrintTraceInfo();
87
88 StringValue m_Interval1;
89 StringValue m_Interval2;
90
91 UintegerValue m_PackageSize1;
92 UintegerValue m_PackageSize2;
93
94 std::string m_extName;
95
98};
99
101 : TestCase(""),
102 m_Interval1(),
103 m_Interval2(),
106 m_extName(),
107 m_fading(),
108 m_dummyFrames(false)
109{
110}
111
113 std::string extName,
115 bool dummyFrames,
116 StringValue ival1,
117 UintegerValue pSize1,
118 StringValue ival2,
119 UintegerValue pSize2)
120 : TestCase(name),
121 m_Interval1(ival1),
122 m_Interval2(ival2),
123 m_PackageSize1(pSize1),
124 m_PackageSize2(pSize2),
125 m_extName(extName),
126 m_fading(fading),
127 m_dummyFrames(dummyFrames)
128{
129}
130
134
135void
137{
138 Ptr<SatIdMapper> ptrMapper = Singleton<SatIdMapper>::Get();
139 ptrMapper->Reset();
140
141 Ptr<SatInterferenceOutputTraceContainer> ptrCont =
142 Singleton<SatInterferenceOutputTraceContainer>::Get();
143 ptrCont->Reset();
144
145 std::size_t pos = m_extName.find(' ');
146
147 while (pos != std::string::npos)
148 {
149 m_extName.replace(pos, 1, "_");
150 pos = m_extName.find(' ');
151 }
152
153 pos = m_extName.find(',');
154
155 while (pos != std::string::npos)
156 {
157 m_extName.replace(pos, 1, "\0");
158 pos = m_extName.find(',');
159 }
160
161 pos = m_extName.find('.');
162
163 while (pos != std::string::npos)
164 {
165 m_extName.replace(pos, 1, "\0");
166 pos = m_extName.find('.');
167 }
168
169 ptrCont->EnableFigureOutput(figureOutput);
170}
171
172void
174{
175 Ptr<SatIdMapper> ptrMapper = Singleton<SatIdMapper>::Get();
176
177 std::cout << m_extName << std::endl;
178 ptrMapper->PrintTraceMap();
179}
180
205
206// Default name to show for SatPerPacketFwdLinkUserTestCase test. When the second constructor is
207// used, the text to append this name can be given.
208static const char* defFwdUserName =
209 "Test satellite per packet interference in Forward Link with user defined scenario. ";
210
212{
213 public:
215 SatPerPacketFwdLinkUserTestCase(std::string name,
217 bool dummyFrames);
218 SatPerPacketFwdLinkUserTestCase(std::string name,
220 bool dummyFrames,
221 StringValue ival1,
222 UintegerValue pSize1,
223 StringValue ival2,
224 UintegerValue pSize2);
225
227
228 private:
229 virtual void DoRun(void);
230};
231
234 "IfTestFwdUsr",
235 SatEnums::FADING_OFF,
236 false,
237 StringValue("0.00015s"),
238 UintegerValue(512),
239 StringValue("0.1s"),
240 UintegerValue(512))
241{
242}
243
246 bool dummyFrames)
248 "IfTestFwdUsr_" + name,
249 fading,
250 dummyFrames,
251 StringValue("0.00015s"),
252 UintegerValue(512),
253 StringValue("0.1s"),
254 UintegerValue(512))
255{
256}
257
260 bool dummyFrames,
261 StringValue ival1,
262 UintegerValue pSize1,
263 StringValue ival2,
264 UintegerValue pSize2)
266 "IfTestFwdUsr_" + name,
267 fading,
268 dummyFrames,
269 ival1,
270 pSize1,
271 ival2,
272 pSize2)
273{
274}
275
279
280void
282{
283 SatEnvVariables::GetInstance()->DoInitialize();
284
285 InitOutput(true);
286
287 // Set simulation output details
288 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-per-packet-if", m_extName, true);
289
290 // Configure a static error probability
292 Config::SetDefault("ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
293 Config::SetDefault("ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
294
295 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(m_fading));
296 Config::SetDefault("ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
297 BooleanValue(m_dummyFrames));
298
299 Config::SetDefault("ns3::SatHelper::UtCount", UintegerValue(1));
300 Config::SetDefault("ns3::SatHelper::UtUsers", UintegerValue(1));
301 Config::SetDefault("ns3::SatOrbiterHelper::DaFwdLinkInterferenceModel",
303 Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel",
305 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
306
307 // Creating the reference system.
308 Ptr<SatHelper> helper = CreateObject<SatHelper>(
309 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E");
310
311 // create user defined scenario with beams 1 and 5
312 SatBeamUserInfo beamInfo = SatBeamUserInfo(1, 1);
313 std::map<std::pair<uint32_t, uint32_t>, SatBeamUserInfo> beamMap;
314 beamMap[std::make_pair(0, 1)] = beamInfo;
315 beamMap[std::make_pair(0, 5)] = beamInfo;
316
317 helper->CreateUserDefinedScenario(beamMap);
318
319 // set callback traces where we want results out
320
321 Config::Connect("/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
322 MakeCallback(&LinkBudgetTraceCb));
323
324 Config::Connect("/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
325 MakeCallback(&LinkBudgetTraceCb));
326
327 Config::Connect("/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
328 MakeCallback(&LinkBudgetTraceCb));
329
330 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
331 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
332 uint16_t port = 9;
333
334 // create Sink helper
335 PacketSinkHelper sinkHelper("ns3::UdpSocketFactory",
336 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
337
338 // install Sink application on UT user 1 to receive packet
339 ApplicationContainer utSinks = sinkHelper.Install(utUsers.Get(0));
340
341 // install Sink application on UT user 5 to receive packet
342 sinkHelper.SetAttribute(
343 "Local",
344 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(1)), port))));
345 utSinks.Add(sinkHelper.Install(utUsers.Get(1)));
346 utSinks.Start(Seconds(0.1));
347 utSinks.Stop(Seconds(0.5));
348
349 CbrHelper cbrHelper("ns3::UdpSocketFactory",
350 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
351
352 // create application on GW to sent beam 1 (UT user 1)
353 cbrHelper.SetAttribute("Interval", m_Interval1);
354 cbrHelper.SetAttribute("PacketSize", m_PackageSize1);
355
356 ApplicationContainer gw1Cbr = cbrHelper.Install(gwUsers.Get(0));
357 gw1Cbr.Start(Seconds(0.2));
358 gw1Cbr.Stop(Seconds(0.5));
359
360 // create application on GW to sent beam 5 (UT user 5)
361 cbrHelper.SetAttribute(
362 "Remote",
363 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(1)), port))));
364 cbrHelper.SetAttribute("Interval", m_Interval2);
365 cbrHelper.SetAttribute("PacketSize", m_PackageSize2);
366
367 ApplicationContainer gw2Cbr = cbrHelper.Install(gwUsers.Get(1));
368 gw2Cbr.Start(Seconds(0.2));
369 gw2Cbr.Stop(Seconds(1.0));
370
371 Simulator::Stop(Seconds(1.0));
372 Simulator::Run();
374
375 Simulator::Destroy();
376
377 SatEnvVariables::GetInstance()->DoDispose();
378}
379
404
405// Default name to show for SatPerPacketFwdLinkFullTestCase test. When the second constructor is
406// used, the text to append this name can be given.
407static const char* defFwdFullName =
408 "Test satellite per packet interference in Forward Link with fullscenario. ";
409
411{
412 public:
414 SatPerPacketFwdLinkFullTestCase(std::string name,
416 bool dummyFrames);
417 SatPerPacketFwdLinkFullTestCase(std::string name,
419 bool dummyFrames,
420 StringValue ival1,
421 UintegerValue pSize1,
422 StringValue ival2,
423 UintegerValue pSize2);
425
426 private:
427 virtual void DoRun(void);
428};
429
432 "IfTestFwdFull",
433 SatEnums::FADING_OFF,
434 false,
435 StringValue("0.00015s"),
436 UintegerValue(512),
437 StringValue("0.1s"),
438 UintegerValue(512))
439
440{
441}
442
445 bool dummyFrames)
447 "IfTestFwdFull_" + name,
448 fading,
449 dummyFrames,
450 StringValue("0.00015s"),
451 UintegerValue(512),
452 StringValue("0.1s"),
453 UintegerValue(512))
454{
455}
456
459 bool dummyFrames,
460 StringValue ival1,
461 UintegerValue pSize1,
462 StringValue ival2,
463 UintegerValue pSize2)
465 "IfTestFwdFull_" + name,
466 fading,
467 dummyFrames,
468 ival1,
469 pSize1,
470 ival2,
471 pSize2)
472{
473}
474
478
479void
481{
482 SatEnvVariables::GetInstance()->DoInitialize();
483
484 InitOutput(false);
485
486 // Set simulation output details
487 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-per-packet-if", m_extName, true);
488
489 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(m_fading));
490 Config::SetDefault("ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
491 BooleanValue(m_dummyFrames));
492
493 Config::SetDefault("ns3::SatHelper::UtCount", UintegerValue(1));
494 Config::SetDefault("ns3::SatHelper::UtUsers", UintegerValue(1));
495 Config::SetDefault("ns3::SatOrbiterHelper::DaFwdLinkInterferenceModel",
497 Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel",
499 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
500
501 // Creating the reference system.
502 Ptr<SatHelper> helper = CreateObject<SatHelper>(
503 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E");
504
505 helper->CreatePredefinedScenario(SatHelper::FULL);
506
507 // set callback traces where we want results out
508
509 Config::Connect("/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
510 MakeCallback(&LinkBudgetTraceCb));
511
512 Config::Connect("/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
513 MakeCallback(&LinkBudgetTraceCb));
514
515 Config::Connect("/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
516 MakeCallback(&LinkBudgetTraceCb));
517
518 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
519 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
520 uint16_t port = 9;
521
522 // create Sink helper
523 PacketSinkHelper sinkHelper("ns3::UdpSocketFactory",
524 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
525
526 // install Sink application on UT user 1 to receive packet
527 ApplicationContainer utSinks = sinkHelper.Install(utUsers.Get(0));
528
529 // install Sink application on UT user 5 to receive packet
530 sinkHelper.SetAttribute(
531 "Local",
532 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(4)), port))));
533 utSinks.Add(sinkHelper.Install(utUsers.Get(4)));
534 utSinks.Start(Seconds(0.1));
535 utSinks.Stop(Seconds(1.0));
536
537 CbrHelper cbrHelper("ns3::UdpSocketFactory",
538 InetSocketAddress(helper->GetUserAddress(utUsers.Get(0)), port));
539
540 // create application on GW to sent beam 1 (UT user 1)
541 cbrHelper.SetAttribute("Interval", m_Interval1);
542 cbrHelper.SetAttribute("PacketSize", m_PackageSize1);
543
544 ApplicationContainer gw1Cbr = cbrHelper.Install(gwUsers.Get(0));
545 gw1Cbr.Start(Seconds(0.2));
546 gw1Cbr.Stop(Seconds(0.4));
547
548 // create application on GW to sent beam 5 (UT user 5)
549 cbrHelper.SetAttribute(
550 "Remote",
551 AddressValue(Address(InetSocketAddress(helper->GetUserAddress(utUsers.Get(4)), port))));
552 cbrHelper.SetAttribute("Interval", m_Interval2);
553 cbrHelper.SetAttribute("PacketSize", m_PackageSize2);
554
555 ApplicationContainer gw2Cbr = cbrHelper.Install(gwUsers.Get(4));
556 gw2Cbr.Start(Seconds(0.2));
557 gw2Cbr.Stop(Seconds(0.4));
558
559 Simulator::Stop(Seconds(1.0));
560 Simulator::Run();
562
563 Simulator::Destroy();
564
565 SatEnvVariables::GetInstance()->DoDispose();
566}
567
591
592// Default name to show for SatPerPacketRtnLinkUserTestCase test. When the second constructor is
593// used, the text to append this name can be given.
594static const char* defRtnUserName =
595 "Test satellite per packet interference in Return Link with user defined scenario. ";
596
598{
599 public:
602 SatPerPacketRtnLinkUserTestCase(std::string name,
604 StringValue ival1,
605 UintegerValue pSize1,
606 StringValue ival2,
607 UintegerValue pSize2);
608
610
611 private:
612 virtual void DoRun(void);
613};
614
617 "IfTestRtnUsr",
618 SatEnums::FADING_OFF,
619 false,
620 StringValue("0.01s"),
621 UintegerValue(512),
622 StringValue("0.01s"),
623 UintegerValue(32))
624{
625}
626
630 "IfTestRtnUsr_" + name,
631 fading,
632 false,
633 StringValue("0.01s"),
634 UintegerValue(512),
635 StringValue("0.01s"),
636 UintegerValue(32))
637{
638}
639
642 StringValue ival1,
643 UintegerValue pSize1,
644 StringValue ival2,
645 UintegerValue pSize2)
647 "IfTestRtnUsr_" + name,
648 fading,
649 false,
650 ival1,
651 pSize1,
652 ival2,
653 pSize2)
654{
655}
656
660
661void
663{
664 SatEnvVariables::GetInstance()->DoInitialize();
665
666 InitOutput(false);
667
668 // Set simulation output details
669 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-per-packet-if", m_extName, true);
670
671 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(m_fading));
672 Config::SetDefault("ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
673 BooleanValue(m_dummyFrames));
674
675 Config::SetDefault("ns3::SatHelper::UtCount", UintegerValue(1));
676 Config::SetDefault("ns3::SatHelper::UtUsers", UintegerValue(1));
677 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
679 Config::SetDefault("ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
680 Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType",
682 Config::SetDefault("ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(1.25e6));
683 Config::SetDefault("ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
684 DoubleValue(1.25e6));
685 // Config::SetDefault("ns3::SatWaveformConf::DefaultWfId", UintegerValue(13));
686 Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel",
688 Config::SetDefault("ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
690 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
691
692 // Creating the reference system.
693 Ptr<SatHelper> helper = CreateObject<SatHelper>(
694 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E");
695
696 // create user defined scenario with beams 1 and 5
697 SatBeamUserInfo beamInfo = SatBeamUserInfo(1, 1);
698 std::map<std::pair<uint32_t, uint32_t>, SatBeamUserInfo> beamMap;
699 beamMap[std::make_pair(0, 1)] = beamInfo;
700 beamMap[std::make_pair(0, 5)] = beamInfo;
701
702 helper->CreateUserDefinedScenario(beamMap);
703
704 // set callback traces where we want results out
705
706 Config::Connect("/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
707 MakeCallback(&LinkBudgetTraceCb));
708
709 Config::Connect("/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
710 MakeCallback(&LinkBudgetTraceCb));
711
712 Config::Connect("/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
713 MakeCallback(&LinkBudgetTraceCb));
714
715 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
716 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
717 uint16_t port = 9;
718
719 // create Sink helper
720 PacketSinkHelper sinkHelper("ns3::UdpSocketFactory",
721 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
722
723 // install Sink application on GW user to receive packet
724 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
725 gwSink.Start(Seconds(0.1));
726 gwSink.Stop(Seconds(0.5));
727
728 CbrHelper cbrHelper("ns3::UdpSocketFactory",
729 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
730
731 // create applications on UT in beam 1
732 cbrHelper.SetAttribute("Interval", m_Interval1);
733 cbrHelper.SetAttribute("PacketSize", m_PackageSize1);
734
735 ApplicationContainer ut1Cbr = cbrHelper.Install(utUsers.Get(0));
736 ut1Cbr.Start(Seconds(0.1));
737 ut1Cbr.Stop(Seconds(0.4));
738
739 // create applications on UT in beam 5
740 cbrHelper.SetAttribute("Interval", m_Interval2);
741 cbrHelper.SetAttribute("PacketSize", m_PackageSize2);
742
743 ApplicationContainer ut5Cbr = cbrHelper.Install(utUsers.Get(1));
744 ut5Cbr.Start(Seconds(0.1));
745 ut5Cbr.Stop(Seconds(0.4));
746
747 Simulator::Stop(Seconds(1.0));
748 Simulator::Run();
750
751 Simulator::Destroy();
752
753 SatEnvVariables::GetInstance()->DoDispose();
754}
755
756// Default name to show for test. When the second constructor is used, the text to append this name
757// can be given.
758static const char* defRtnFullName =
759 "Test satellite per packet interference in Return Link with full defined scenario. ";
760
762{
763 public:
765
767 SatPerPacketRtnLinkFullTestCase(std::string name,
769 StringValue ival1,
770 UintegerValue pSize1,
771 StringValue ival2,
772 UintegerValue pSize2);
774
775 private:
776 virtual void DoRun(void);
777};
778
781 "IfTestRtnFull",
782 SatEnums::FADING_OFF,
783 false,
784 StringValue("0.01s"),
785 UintegerValue(512),
786 StringValue("0.01s"),
787 UintegerValue(32))
788{
789}
790
794 "IfTestRtnFull_" + name,
795 fading,
796 false,
797 StringValue("0.01s"),
798 UintegerValue(512),
799 StringValue("0.01s"),
800 UintegerValue(32))
801{
802}
803
806 StringValue ival1,
807 UintegerValue pSize1,
808 StringValue ival2,
809 UintegerValue pSize2)
811 "IfTestRtnFull_" + name,
812 fading,
813 false,
814 ival1,
815 pSize1,
816 ival2,
817 pSize2)
818{
819}
820
824
825void
827{
828 SatEnvVariables::GetInstance()->DoInitialize();
829
830 InitOutput(false);
831
832 // Set simulation output details
833 SatEnvVariables::GetInstance()->SetOutputVariables("test-sat-per-packet-if", m_extName, true);
834
835 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(m_fading));
836 Config::SetDefault("ns3::SatFwdLinkScheduler::DummyFrameSendingEnabled",
837 BooleanValue(m_dummyFrames));
838
839 Config::SetDefault("ns3::SatHelper::UtCount", UintegerValue(1));
840 Config::SetDefault("ns3::SatHelper::UtUsers", UintegerValue(1));
841 Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
843 Config::SetDefault("ns3::SatSuperframeConf0::FrameCount", UintegerValue(1));
844 Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType",
846 Config::SetDefault("ns3::SatSuperframeConf0::Frame0_AllocatedBandwidthHz", DoubleValue(1.25e6));
847 Config::SetDefault("ns3::SatSuperframeConf0::Frame0_CarrierAllocatedBandwidthHz",
848 DoubleValue(1.25e6));
849 // Config::SetDefault("ns3::SatWaveformConf::DefaultWfId", UintegerValue(13));
850 Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel",
852 Config::SetDefault("ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
854 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
855
856 // Creating the reference system.
857 Ptr<SatHelper> helper = CreateObject<SatHelper>(
858 SatEnvVariables::GetInstance()->LocateDataDirectory() + "/scenarios/geo-33E");
859 helper->CreatePredefinedScenario(SatHelper::FULL);
860
861 // set callback traces where we want results out
862
863 Config::Connect("/NodeList/*/DeviceList/*/SatPhy/PhyRx/RxCarrierList/*/LinkBudgetTrace",
864 MakeCallback(&LinkBudgetTraceCb));
865
866 Config::Connect("/NodeList/*/DeviceList/*/UserPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
867 MakeCallback(&LinkBudgetTraceCb));
868
869 Config::Connect("/NodeList/*/DeviceList/*/FeederPhy/*/PhyRx/RxCarrierList/*/LinkBudgetTrace",
870 MakeCallback(&LinkBudgetTraceCb));
871
872 NodeContainer utUsers = Singleton<SatTopology>::Get()->GetUtUserNodes();
873 NodeContainer gwUsers = Singleton<SatTopology>::Get()->GetGwUserNodes();
874 uint16_t port = 9;
875
876 // create Sink helper
877 PacketSinkHelper sinkHelper("ns3::UdpSocketFactory",
878 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
879
880 // install Sink application on GW user to receive packet
881 ApplicationContainer gwSink = sinkHelper.Install(gwUsers.Get(0));
882 gwSink.Start(Seconds(0.1));
883 gwSink.Stop(Seconds(0.5));
884
885 CbrHelper cbrHelper("ns3::UdpSocketFactory",
886 InetSocketAddress(helper->GetUserAddress(gwUsers.Get(0)), port));
887
888 // create applications on UT in beam 1
889 cbrHelper.SetAttribute("Interval", m_Interval1);
890 cbrHelper.SetAttribute("PacketSize", m_PackageSize1);
891
892 ApplicationContainer ut1Cbr = cbrHelper.Install(utUsers.Get(0));
893 ut1Cbr.Start(Seconds(0.1));
894 ut1Cbr.Stop(Seconds(0.4));
895
896 // create applications on UT in beam 5
897 cbrHelper.SetAttribute("Interval", m_Interval2);
898 cbrHelper.SetAttribute("PacketSize", m_PackageSize2);
899
900 ApplicationContainer ut5Cbr = cbrHelper.Install(utUsers.Get(4));
901 ut5Cbr.Start(Seconds(0.1));
902 ut5Cbr.Stop(Seconds(0.4));
903
904 Simulator::Stop(Seconds(1.0));
905 Simulator::Run();
907
908 Simulator::Destroy();
909
910 SatEnvVariables::GetInstance()->DoDispose();
911}
912
917class SatPerPacketIfTestSuite : public TestSuite
918{
919 public:
921};
922
924 : TestSuite("sat-per-packet-if-test", Type::SYSTEM)
925{
926 AddTestCase(new SatPerPacketFwdLinkUserTestCase, TestCase::Duration::QUICK);
927 AddTestCase(new SatPerPacketFwdLinkUserTestCase("DummyFrames.", SatEnums::FADING_OFF, true),
928 TestCase::Duration::QUICK);
929 AddTestCase(
930 new SatPerPacketFwdLinkUserTestCase("Markov_Fading.", SatEnums::FADING_MARKOV, false),
931 TestCase::Duration::QUICK);
932 AddTestCase(new SatPerPacketFwdLinkUserTestCase("Markov_Fading, DummyFrames.",
934 true),
935 TestCase::Duration::QUICK);
936 AddTestCase(new SatPerPacketFwdLinkFullTestCase, TestCase::Duration::QUICK);
937
938 AddTestCase(
939 new SatPerPacketFwdLinkFullTestCase("Markov_Fading.", SatEnums::FADING_MARKOV, false),
940 TestCase::Duration::QUICK);
941 AddTestCase(new SatPerPacketRtnLinkUserTestCase, TestCase::Duration::QUICK);
942 AddTestCase(new SatPerPacketRtnLinkUserTestCase("Markov_Fading.", SatEnums::FADING_MARKOV),
943 TestCase::Duration::QUICK);
944
945 AddTestCase(new SatPerPacketRtnLinkFullTestCase, TestCase::Duration::QUICK);
946 AddTestCase(new SatPerPacketRtnLinkFullTestCase("Markov_Fading.", SatEnums::FADING_MARKOV),
947 TestCase::Duration::QUICK);
948}
949
950// Do allocate an instance of this TestSuite
virtual void DoRun(void)=0
Test suite for Satellite interference unit test cases.
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.
static Ptr< SatEnvVariables > GetInstance()
@ FULL
FULL Full scenario used as base.
@ SUPER_FRAME_CONFIG_0
SUPER_FRAME_CONFIG_0.
@ CONFIG_TYPE_0
Configuration type 0.
static T WToDbW(T w)
Converts Watts to Decibel Watts.
static T LinearToDb(T linear)
Converts linear to decibels.
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