sat-fwd-link-beam-hopping-example.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 Magister Solutions
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: Jani Puttonen <jani.puttonen@magister.fi>
19  *
20  */
21 
22 #include "ns3/applications-module.h"
23 #include "ns3/core-module.h"
24 #include "ns3/internet-module.h"
25 #include "ns3/network-module.h"
26 #include "ns3/satellite-module.h"
27 #include "ns3/traffic-module.h"
28 
29 using namespace ns3;
30 
43 NS_LOG_COMPONENT_DEFINE("sat-fwd-link-beam-hopping-example");
44 
45 int
46 main(int argc, char* argv[])
47 {
48  uint32_t endUsersPerUt(1);
49  Time simLength(Seconds(3.0));
50  bool scaleDown(true);
51 
52  std::string simulationName("sat-fwd-link-beam-hopping-example");
53  Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>(simulationName);
54 
55  // read command line parameters given by user
56  CommandLine cmd;
57  cmd.AddValue("simTime", "Length of simulation", simLength);
58  cmd.AddValue("scaleDown",
59  "Scale down the bandwidth to see differences with less traffic",
60  scaleDown);
61  simulationHelper->AddDefaultUiArguments(cmd);
62  cmd.Parse(argc, argv);
63 
64  simulationHelper->SetDefaultValues();
65  simulationHelper->SetUserCountPerUt(endUsersPerUt);
66  simulationHelper->ConfigureFwdLinkBeamHopping();
67  if (scaleDown)
68  {
69  Config::SetDefault("ns3::SatConf::FwdCarrierAllocatedBandwidth", DoubleValue(1e+08));
70  }
71  simulationHelper->SetSimulationTime(simLength.GetSeconds());
72 
73  // All spot-beams of GW-1 (14 in total)
74  simulationHelper->SetBeams("1 2 3 4 11 12 13 14 25 26 27 28 40 41");
75  std::map<uint32_t, uint32_t> utsInBeam = {{1, 30},
76  {2, 9},
77  {3, 15},
78  {4, 30},
79  {11, 15},
80  {12, 30},
81  {13, 9},
82  {14, 18},
83  {25, 9},
84  {26, 15},
85  {27, 18},
86  {28, 30},
87  {40, 9},
88  {41, 15}};
89 
90  // Set users unevenly in different beams
91  for (const auto& it : utsInBeam)
92  {
93  simulationHelper->SetUtCountPerBeam(it.first, it.second);
94  }
95 
96  simulationHelper->LoadScenario("geo-33E-beam-hopping");
97 
98  // Create the scenario
99  simulationHelper->CreateSatScenario();
100 
101  // Install traffic model
102  simulationHelper->GetTrafficHelper()->AddCbrTraffic(
105  MilliSeconds(1),
106  512,
107  NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
108  Singleton<SatTopology>::Get()->GetUtUserNodes(),
109  MilliSeconds(1),
110  simLength,
111  MilliSeconds(1));
112 
113  auto stats = simulationHelper->GetStatisticsContainer();
114  stats->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
115  stats->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
116  stats->AddPerBeamBeamServiceTime(SatStatsHelper::OUTPUT_SCALAR_FILE);
117  stats->AddGlobalFwdAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
118  stats->AddGlobalFwdCompositeSinr(SatStatsHelper::OUTPUT_CDF_FILE);
119 
120  simulationHelper->EnableProgressLogs();
121  simulationHelper->RunSimulation();
122 
123  return 0;
124 }
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.