Loading...
Searching...
No Matches
sat-trace-output-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
54
55NS_LOG_COMPONENT_DEFINE("sat-trace-output-example");
56
57int
58main(int argc, char* argv[])
59{
60 uint32_t packetSize = 512;
61 std::string interval = "1s";
62 std::string scenario = "simple";
64
65 Config::SetDefault("ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(true));
66 std::string simulationName = "example-trace-output";
67 auto simulationHelper = CreateObject<SimulationHelper>(simulationName);
68
70 CommandLine cmd;
71 cmd.AddValue("packetSize", "Size of constant packet (bytes)", packetSize);
72 cmd.AddValue("interval", "Interval to sent packets in seconds, (e.g. (1s)", interval);
73 cmd.AddValue("scenario", "Test scenario to use. (simple, larger or full", scenario);
74 simulationHelper->AddDefaultUiArguments(cmd);
75 cmd.Parse(argc, argv);
76
78 Config::SetDefault("ns3::SatChannel::RxPowerCalculationMode",
80 Config::SetDefault("ns3::SatChannel::EnableRxPowerOutputTrace", BooleanValue(true));
81
83 Config::SetDefault("ns3::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_MARKOV));
84 Config::SetDefault("ns3::SatChannel::EnableFadingOutputTrace", BooleanValue(true));
85
87 Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel",
89 Config::SetDefault("ns3::SatOrbiterHelper::DaRtnLinkInterferenceModel",
91 Config::SetDefault("ns3::SatOrbiterHelper::DaFwdLinkInterferenceModel",
93 Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel",
95 Config::SetDefault("ns3::SatPhyRxCarrierConf::EnableIntfOutputTrace", BooleanValue(true));
96
98 Config::SetDefault("ns3::SatPhyRxCarrier::EnableCompositeSinrOutputTrace", BooleanValue(true));
99
101 simulationHelper->SetOutputTag(scenario);
102
104 // Singleton<SatFadingOutputTraceContainer>::Get ()->EnableFigureOutput (false);
105 // Singleton<SatInterferenceOutputTraceContainer>::Get ()->EnableFigureOutput (false);
106 // Singleton<SatRxPowerOutputTraceContainer>::Get ()->EnableFigureOutput (false);
107 // Singleton<SatCompositeSinrOutputTraceContainer>::Get ()->EnableFigureOutput (false);
108
110 Singleton<SatIdMapper>::Get()->EnableMapPrint(true);
111
112 if (scenario == "larger")
113 {
114 satScenario = SatHelper::LARGER;
115 }
116 else if (scenario == "full")
117 {
118 satScenario = SatHelper::FULL;
119 }
120
122 LogComponentEnable("CbrApplication", LOG_LEVEL_INFO);
123 LogComponentEnable("PacketSink", LOG_LEVEL_INFO);
124 LogComponentEnable("sat-trace-output-example", LOG_LEVEL_INFO);
125
126 // Set simulation time
127 simulationHelper->SetSimulationTime(Seconds(11));
128
130 // GlobalValue::Bind ("SimulatorImplementationType", StringValue
131 // ("ns3::RealtimeSimulatorImpl"));
132
133 simulationHelper->LoadScenario("geo-33E");
134
135 // Creating the reference system.
136 simulationHelper->CreateSatScenario(satScenario);
137
138 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
141 Time(interval),
142 packetSize,
143 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
144 Singleton<SatTopology>::Get()->GetUtUserNodes(),
145 Seconds(3.0),
146 Seconds(5.1),
147 Seconds(0));
148
149 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
152 Time(interval),
153 packetSize,
154 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
155 Singleton<SatTopology>::Get()->GetUtUserNodes(),
156 Seconds(7.0),
157 Seconds(9.1),
158 Seconds(0));
159
160 NS_LOG_INFO("--- Trace-output-example ---");
161 NS_LOG_INFO(" Scenario used: " << scenario);
162 NS_LOG_INFO(" PacketSize: " << packetSize);
163 NS_LOG_INFO(" Interval: " << interval);
164 NS_LOG_INFO(" ");
165
166 simulationHelper->RunSimulation();
167
168 return 0;
169}
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.