sat-gw-handover-example.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 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: Bastien TAURAN <bastien.tauran@viveris.fr>
19  *
20  */
21 
22 #include "ns3/applications-module.h"
23 #include "ns3/config-store-module.h"
24 #include "ns3/core-module.h"
25 #include "ns3/internet-module.h"
26 #include "ns3/network-module.h"
27 #include "ns3/satellite-module.h"
28 #include "ns3/traffic-module.h"
29 
30 using namespace ns3;
31 
40 NS_LOG_COMPONENT_DEFINE("sat-gw-handover-example");
41 
42 int
43 main(int argc, char* argv[])
44 {
46  Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
48  Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
50 
51  Config::SetDefault("ns3::SatOrbiterFeederPhy::QueueSize", UintegerValue(100000));
52 
53  Config::SetDefault("ns3::SatHelper::HandoversEnabled", BooleanValue(true));
54  Config::SetDefault("ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
55 
56  Config::SetDefault("ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(true));
57  Config::SetDefault("ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
58  BooleanValue(true));
59 
61  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
62 
64  Config::SetDefault("ns3::SatHelper::PacketTraceEnabled", BooleanValue(true));
65  Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>("example-gw-handover");
66  Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
67  simulationHelper->SetSimulationTime(Seconds(100));
68  simulationHelper->SetGwUserCount(1);
69  simulationHelper->SetUserCountPerUt(1);
70  std::set<uint32_t> beamSetAll = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
71  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
72  31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
73  46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
74  61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72};
75  simulationHelper->SetBeamSet(beamSetAll);
76  simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
77 
78  simulationHelper->LoadScenario("constellation-leo-2-satellites");
79 
80  simulationHelper->CreateSatScenario(SatHelper::NONE);
81 
82  Singleton<SatTopology>::Get()->PrintTopology(std::cout);
83 
84  simulationHelper->GetTrafficHelper()->AddCbrTraffic(
87  MilliSeconds(100),
88  512,
89  NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
90  Singleton<SatTopology>::Get()->GetUtUserNodes(),
91  Seconds(1.0),
92  Seconds(100.0),
93  Seconds(0));
94 
95  simulationHelper->GetTrafficHelper()->AddCbrTraffic(
98  MilliSeconds(100),
99  512,
100  NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
101  Singleton<SatTopology>::Get()->GetUtUserNodes(),
102  Seconds(1.0),
103  Seconds(100.0),
104  Seconds(0));
105 
106  // To store attributes to file
107  Config::SetDefault("ns3::ConfigStore::Filename", StringValue("output-attributes.xml"));
108  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
109  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
110  ConfigStore outputConfig;
111  outputConfig.ConfigureDefaults();
112 
113  Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
114 
115  s->AddPerSatFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
116  s->AddPerSatFwdUserDevThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
117  s->AddPerSatRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
118  s->AddPerSatRtnUserDevThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
119 
120  s->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
121  s->AddPerBeamFwdUserDevThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
122  s->AddPerBeamBeamServiceTime(SatStatsHelper::OUTPUT_SCALAR_FILE);
123 
124  simulationHelper->EnableProgressLogs();
125  simulationHelper->RunSimulation();
126 
127  return 0;
128 }
@ NONE
NONE Not used.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.