sat-trace-input-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) 2013 Magister Solutions Ltd
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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #include "ns3/applications-module.h"
22 #include "ns3/core-module.h"
23 #include "ns3/internet-module.h"
24 #include "ns3/network-module.h"
25 #include "ns3/satellite-module.h"
26 #include "ns3/traffic-module.h"
27 
28 using namespace ns3;
29 
55 NS_LOG_COMPONENT_DEFINE("sat-trace-input-fading-example");
56 
57 int
58 main(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-input-fading";
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::SatBeamHelper::FadingModel", EnumValue(SatEnums::FADING_TRACE));
79 
81  simulationHelper->SetOutputTag(scenario);
82 
83  Singleton<SatIdMapper>::Get()->EnableMapPrint(true);
84 
85  if (scenario == "larger")
86  {
87  satScenario = SatHelper::LARGER;
88  }
89  else if (scenario == "full")
90  {
91  satScenario = SatHelper::FULL;
92  }
93 
95  LogComponentEnable("CbrApplication", LOG_LEVEL_INFO);
96  LogComponentEnable("PacketSink", LOG_LEVEL_INFO);
97  LogComponentEnable("sat-trace-input-fading-example", LOG_LEVEL_INFO);
98  LogComponentEnable("SatInputFileStreamTimeDoubleContainer", LOG_LEVEL_INFO);
99 
100  // Set simulation time
101  simulationHelper->SetSimulationTime(Seconds(11));
102 
104  // GlobalValue::Bind ("SimulatorImplementationType", StringValue
105  // ("ns3::RealtimeSimulatorImpl"));
106 
108 
109  // Creating the reference system. Note, currently the satellite module supports
110  // only one reference system, which is named as "Scenario72". The string is utilized
111  // in mapping the scenario to the needed reference system configuration files. Arbitrary
112  // scenario name results in fatal error.
113  simulationHelper->CreateSatScenario(satScenario);
114 
115  Config::SetDefault("ns3::CbrApplication::Interval", TimeValue(Time(interval)));
116  Config::SetDefault("ns3::CbrApplication::PacketSize", UintegerValue(packetSize));
117 
119  simulationHelper->InstallTrafficModel(SimulationHelper::CBR,
122  Seconds(3.0),
123  Seconds(5.1));
124 
126  simulationHelper->InstallTrafficModel(SimulationHelper::CBR,
129  Seconds(7.0),
130  Seconds(9.1));
131 
132  NS_LOG_INFO("--- Trace-input-fading-example ---");
133  NS_LOG_INFO(" Scenario used: " << scenario);
134  NS_LOG_INFO(" PacketSize: " << packetSize);
135  NS_LOG_INFO(" Interval: " << interval);
136  NS_LOG_INFO(" ");
137 
138  simulationHelper->RunSimulation();
139 
140  return 0;
141 }
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.