Loading...
Searching...
No Matches
sat-dama-http-sim-tn9.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: Budiarto Herman <budiarto.herman@magister.fi>
19 *
20 */
21
22#include "ns3/config-store-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
29using namespace ns3;
30
41
42NS_LOG_COMPONENT_DEFINE("sat-dama-http-sim-tn9");
43
44int
45main(int argc, char* argv[])
46{
47 // Spot-beam over Finland
48 uint32_t beamId = 18;
49 uint32_t endUsersPerUt(1);
50 uint32_t utsPerBeam(1);
51 uint32_t crTxConf(0);
52
53 double simLength(300.0); // in seconds
54
56 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
57
59 Ptr<SimulationHelper> simulationHelper =
60 CreateObject<SimulationHelper>("example-dama-http-sim-tn9");
61
62 // To read attributes from file
63 std::string inputFileNameWithPath =
64 SatEnvVariables::GetInstance()->LocateDirectory("contrib/satellite/examples") +
65 "/tn9-dama-input-attributes.xml";
66
102
103 // read command line parameters given by user
104 CommandLine cmd;
105 cmd.AddValue("simLength", "Simulation duration in seconds", simLength);
106 cmd.AddValue("utsPerBeam", "Number of UTs per spot-beam", utsPerBeam);
107 cmd.AddValue("crTxConf", "CR transmission configuration", crTxConf);
108 simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath);
109 cmd.Parse(argc, argv);
110
111 Config::SetDefault("ns3::ConfigStore::Filename", StringValue(inputFileNameWithPath));
112 Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Load"));
113 Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
114 ConfigStore inputConfig;
115 inputConfig.ConfigureDefaults();
116
117 simulationHelper->SetSimulationTime(simLength);
118 simulationHelper->SetUserCountPerUt(endUsersPerUt);
119 simulationHelper->SetUtCountPerBeam(utsPerBeam);
120
121 // Set beam ID
122 std::stringstream beamsEnabled;
123 beamsEnabled << beamId;
124 simulationHelper->SetBeams(beamsEnabled.str());
125
126 // NCC configuration
127 Config::SetDefault("ns3::SatSuperframeConf0::FrameConfigType", StringValue("ConfigType_2"));
128 Config::SetDefault("ns3::SatWaveformConf::AcmEnabled", BooleanValue(true));
129
130 // RBDC
131 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
132 BooleanValue(false));
133 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed", BooleanValue(true));
134 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_MinimumServiceRate",
135 UintegerValue(16));
136 Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
137 BooleanValue(false));
138
139 switch (crTxConf)
140 {
141 // Periodical control slots
142 case 0: {
143 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
144 EnumValue(SatEnums::RA_MODEL_OFF));
145 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(true));
146 break;
147 }
148 // Slotted ALOHA
149 case 1: {
150 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
152 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
153 break;
154 }
155 // CRDSA (loose RC 0)
156 case 2: {
157 Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
158 EnumValue(SatEnums::RA_MODEL_CRDSA));
159 Config::SetDefault("ns3::SatBeamScheduler::ControlSlotsEnabled", BooleanValue(false));
160 Config::SetDefault("ns3::SatUtHelper::UseCrdsaOnlyForControlPackets", BooleanValue(false));
161 break;
162 }
163 default: {
164 NS_FATAL_ERROR("Unsupported crTxConf: " << crTxConf);
165 break;
166 }
167 }
168
169 simulationHelper->LoadScenario("geo-33E");
170
171 // Creating the reference system.
172 simulationHelper->CreateSatScenario();
173
177 simulationHelper->GetTrafficHelper()->AddHttpTraffic(
179 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
180 Singleton<SatTopology>::Get()->GetUtUserNodes(),
181 MilliSeconds(3),
182 Seconds(simLength),
183 Seconds(0));
184
188 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
189
190 s->AddPerBeamRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_PLOT);
191 s->AddPerBeamRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
192 s->AddPerBeamRtnFeederDevThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
193 s->AddPerBeamRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
194 s->AddPerBeamRtnFeederPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
195
196 s->AddPerBeamRtnAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
197 s->AddPerBeamRtnAppDelay(SatStatsHelper::OUTPUT_CDF_PLOT);
198 s->AddPerBeamRtnDevDelay(SatStatsHelper::OUTPUT_CDF_FILE);
199 s->AddPerBeamRtnDevDelay(SatStatsHelper::OUTPUT_CDF_PLOT);
200 s->AddPerBeamRtnPhyDelay(SatStatsHelper::OUTPUT_CDF_FILE);
201 s->AddPerBeamRtnPhyDelay(SatStatsHelper::OUTPUT_CDF_PLOT);
202
203 s->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_PLOT);
204 s->AddPerBeamFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
205 s->AddPerBeamFwdUserDevThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
206 s->AddPerBeamFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
207 s->AddPerBeamFwdUserPhyThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
208
209 s->AddPerBeamFwdAppDelay(SatStatsHelper::OUTPUT_CDF_FILE);
210 s->AddPerBeamFwdAppDelay(SatStatsHelper::OUTPUT_CDF_PLOT);
211 s->AddPerBeamFwdDevDelay(SatStatsHelper::OUTPUT_CDF_FILE);
212 s->AddPerBeamFwdDevDelay(SatStatsHelper::OUTPUT_CDF_PLOT);
213 s->AddPerBeamFwdPhyDelay(SatStatsHelper::OUTPUT_CDF_FILE);
214 s->AddPerBeamFwdPhyDelay(SatStatsHelper::OUTPUT_CDF_PLOT);
215
216 s->AddPerBeamRtnFeederDaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
217 s->AddPerBeamFrameSymbolLoad(SatStatsHelper::OUTPUT_SCALAR_FILE);
218 s->AddPerBeamWaveformUsage(SatStatsHelper::OUTPUT_SCALAR_FILE);
219 s->AddPerBeamCapacityRequest(SatStatsHelper::OUTPUT_SCATTER_FILE);
220 s->AddPerBeamResourcesGranted(SatStatsHelper::OUTPUT_SCATTER_PLOT);
221
222 s->AddPerBeamFeederCrdsaPacketCollision(SatStatsHelper::OUTPUT_SCALAR_FILE);
223 s->AddPerBeamFeederCrdsaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
224 s->AddPerBeamFeederSlottedAlohaPacketCollision(SatStatsHelper::OUTPUT_SCALAR_FILE);
225 s->AddPerBeamFeederSlottedAlohaPacketError(SatStatsHelper::OUTPUT_SCALAR_FILE);
226
227 NS_LOG_INFO("--- sat-dama-http-sim-tn9 ---");
228 NS_LOG_INFO(" Simulation length: " << simLength);
229 NS_LOG_INFO(" Number of UTs: " << utsPerBeam);
230 NS_LOG_INFO(" Number of end users per UT: " << endUsersPerUt);
231 NS_LOG_INFO(" ");
232
236 // std::stringstream filename;
237 // filename << "tn9-dama-onoff-output-attributes-ut" << utsPerBeam
238 // << "-conf" << crTxConf << ".xml";
239 //
240 // Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (filename.str ()));
241 // Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("Xml"));
242 // Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
243 // ConfigStore outputConfig;
244 // outputConfig.ConfigureDefaults ();
245
249 simulationHelper->RunSimulation();
250
251 return 0;
252}
static Ptr< SatEnvVariables > GetInstance()
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.