Loading...
Searching...
No Matches
sat-trace-input-external-fading-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: Frans Laakso <frans.laakso@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
29using namespace ns3;
30
70
71NS_LOG_COMPONENT_DEFINE("sat-trace-input-external-fading-example");
72
73int
74main(int argc, char* argv[])
75{
76 uint32_t packetSize = 512;
77 std::string interval = "1s";
78 std::string scenario = "simple";
80
81 Config::SetDefault("ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(true));
82 std::string simulationName = "example-trace-input-external-fading";
83 auto simulationHelper = CreateObject<SimulationHelper>(simulationName);
84
86 CommandLine cmd;
87 cmd.AddValue("packetSize", "Size of constant packet (bytes)", packetSize);
88 cmd.AddValue("interval", "Interval to sent packets in seconds, (e.g. (1s)", interval);
89 cmd.AddValue("scenario", "Test scenario to use. (simple, larger or full", scenario);
90 simulationHelper->AddDefaultUiArguments(cmd);
91 cmd.Parse(argc, argv);
92
94 Config::SetDefault("ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(true));
95
97 Config::SetDefault("ns3::SatChannel::RxPowerCalculationMode",
99 Config::SetDefault("ns3::SatChannel::EnableRxPowerOutputTrace", BooleanValue(true));
100
102 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_MARKOV));
103 Config::SetDefault("ns3::SatChannel::EnableFadingOutputTrace", BooleanValue(true));
104
105 // Rain fading
106 // Note, that the positions of the fading files do not necessarily match with the
107 // beam location, since this example is not using list position allocator!
108 Config::SetDefault("ns3::SatChannel::EnableExternalFadingInputTrace", BooleanValue(true));
109 Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtFwdDownIndexFileName",
110 StringValue("BeamId-1_256_UT_fading_fwddwn_trace_index.txt"));
111 Config::SetDefault("ns3::SatFadingExternalInputTraceContainer::UtRtnUpIndexFileName",
112 StringValue("BeamId-1_256_UT_fading_rtnup_trace_index.txt"));
113
115 Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel",
117 Config::SetDefault("ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
119 Config::SetDefault("ns3::SatOrbiterHelper::DaFwdLinkInterferenceModel",
121 Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel",
123 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
124
126 Config::SetDefault("ns3::SatPhyRxCarrier::EnableCompositeSinrOutputTrace", BooleanValue(true));
127
129 simulationHelper->SetOutputTag(scenario);
130
132 // Singleton<SatFadingOutputTraceContainer>::Get ()->EnableFigureOutput (false);
133 // Singleton<SatInterferenceOutputTraceContainer>::Get ()->EnableFigureOutput (false);
134 // Singleton<SatRxPowerOutputTraceContainer>::Get ()->EnableFigureOutput (false);
135 // Singleton<SatCompositeSinrOutputTraceContainer>::Get ()->EnableFigureOutput (false);
136
138 // Singleton<SatFadingOutputTraceContainer>::Get ()->InsertTag ("fadingExampleTag_");
139 // Singleton<SatInterferenceOutputTraceContainer>::Get ()->InsertTag
140 // ("interferenceExampleTag_"); Singleton<SatRxPowerOutputTraceContainer>::Get ()->InsertTag
141 // ("rxPowerExampleTag_"); Singleton<SatCompositeSinrOutputTraceContainer>::Get ()->InsertTag
142 // ("compositeSinrExampleTag_");
143
145 Singleton<SatIdMapper>::Get()->EnableMapPrint(true);
146
147 if (scenario == "larger")
148 {
149 satScenario = SatHelper::LARGER;
150 }
151 else if (scenario == "full")
152 {
153 satScenario = SatHelper::FULL;
154 }
155
157 LogComponentEnable("CbrApplication", LOG_LEVEL_INFO);
158 LogComponentEnable("PacketSink", LOG_LEVEL_INFO);
159 LogComponentEnable("sat-trace-input-external-fading-example", LOG_LEVEL_INFO);
160
161 // Set simulation time
162 simulationHelper->SetSimulationTime(Seconds(11));
163
165 // GlobalValue::Bind ("SimulatorImplementationType", StringValue
166 // ("ns3::RealtimeSimulatorImpl"));
167
168 simulationHelper->LoadScenario("geo-33E");
169
170 // Creating the reference system.
171 simulationHelper->CreateSatScenario(satScenario);
172
173 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
176 Time(interval),
177 packetSize,
178 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
179 Singleton<SatTopology>::Get()->GetUtUserNodes(),
180 Seconds(3.0),
181 Seconds(5.1),
182 Seconds(0));
183
184 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
187 Time(interval),
188 packetSize,
189 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
190 Singleton<SatTopology>::Get()->GetUtUserNodes(),
191 Seconds(7.0),
192 Seconds(9.1),
193 Seconds(0));
194
195 NS_LOG_INFO("--- input-external-fading-example ---");
196 NS_LOG_INFO(" Scenario used: " << scenario);
197 NS_LOG_INFO(" PacketSize: " << packetSize);
198 NS_LOG_INFO(" Interval: " << interval);
199 NS_LOG_INFO(" ");
200
201 simulationHelper->RunSimulation();
202
203 return 0;
204}
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
@ LARGER
LARGER Larger scenario used as base.
@ FULL
FULL Full scenario used as base.
@ SIMPLE
SIMPLE Simple scenario used as base.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.