sat-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 #include <stdint.h>
31 
32 using namespace ns3;
33 
42 NS_LOG_COMPONENT_DEFINE("sat-handover-example");
43 
44 int
45 main(int argc, char* argv[])
46 {
48  Config::SetDefault("ns3::SatConf::ForwardLinkRegenerationMode",
50  Config::SetDefault("ns3::SatConf::ReturnLinkRegenerationMode",
52 
53  Config::SetDefault("ns3::SatOrbiterFeederPhy::QueueSize", UintegerValue(100000));
54 
55  Config::SetDefault("ns3::SatHelper::HandoversEnabled", BooleanValue(true));
56  Config::SetDefault("ns3::SatHandoverModule::NumberClosestSats", UintegerValue(2));
57 
58  Config::SetDefault("ns3::SatGwMac::DisableSchedulingIfNoDeviceConnected", BooleanValue(true));
59  Config::SetDefault("ns3::SatOrbiterMac::DisableSchedulingIfNoDeviceConnected",
60  BooleanValue(true));
61 
63  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
64 
66  Config::SetDefault("ns3::SatHelper::PacketTraceEnabled", BooleanValue(true));
67  Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>("example-handover");
68  Ptr<SimulationHelperConf> simulationConf = CreateObject<SimulationHelperConf>();
69  simulationHelper->SetSimulationTime(Seconds(100));
70  simulationHelper->SetGwUserCount(1);
71  simulationHelper->SetUserCountPerUt(1);
72  simulationHelper->SetBeamSet({0, 20, 21, 22, 32, 33, 34, 35, 36, 37, 44, 45, 46,
73  47, 53, 54, 55, 56, 59, 60, 61, 66, 67, 68, 71, 72});
74  simulationHelper->SetUserCountPerMobileUt(simulationConf->m_utMobileUserCount);
75 
76  simulationHelper->LoadScenario("constellation-eutelsat-geo-2-sats-handovers");
77 
78  std::string mobileUtFolder = Singleton<SatEnvVariables>::Get()->LocateDataDirectory() +
79  "/additional-input/utpositions/mobiles/scenario6";
80  simulationHelper->CreateSatScenario(SatHelper::NONE, mobileUtFolder);
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->AddPerUtFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
117  s->AddPerGwFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
118 
119  s->AddPerSatRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
120  s->AddPerUtRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
121  s->AddPerGwRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
122 
123  s->AddPerSatFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
124  s->AddPerUtFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
125  s->AddPerGwFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
126 
127  s->AddPerSatRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
128  s->AddPerUtRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
129  s->AddPerGwRtnUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
130 
131  s->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
132  s->AddPerBeamFwdUserDevThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
133  s->AddPerBeamBeamServiceTime(SatStatsHelper::OUTPUT_SCALAR_FILE);
134 
135  s->AddPerSatFwdFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
136 
137  simulationHelper->EnableProgressLogs();
138  simulationHelper->RunSimulation();
139 
140  return 0;
141 }
@ NONE
NONE Not used.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.