sat-trace-input-interference-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 
29 using namespace ns3;
30 
56 NS_LOG_COMPONENT_DEFINE("sat-trace-input-interference-example");
57 
58 int
59 main(int argc, char* argv[])
60 {
61  uint32_t packetSize = 512;
62  std::string interval = "1s";
63  std::string scenario = "simple";
65 
66  Config::SetDefault("ns3::SatHelper::ScenarioCreationTraceEnabled", BooleanValue(true));
67  std::string simulationName = "example-trace-input-interference";
68  auto simulationHelper = CreateObject<SimulationHelper>(simulationName);
69 
71  CommandLine cmd;
72  cmd.AddValue("packetSize", "Size of constant packet (bytes)", packetSize);
73  cmd.AddValue("interval", "Interval to sent packets in seconds, (e.g. (1s)", interval);
74  cmd.AddValue("scenario", "Test scenario to use. (simple, larger or full", scenario);
75  simulationHelper->AddDefaultUiArguments(cmd);
76  cmd.Parse(argc, argv);
77 
79  Config::SetDefault("ns3::SatGwHelper::DaRtnLinkInterferenceModel",
81  Config::SetDefault("ns3::SatGeoHelper::DaRtnLinkInterferenceModel",
83  Config::SetDefault("ns3::SatGeoHelper::DaFwdLinkInterferenceModel",
85  Config::SetDefault("ns3::SatUtHelper::DaFwdLinkInterferenceModel",
87 
89  simulationHelper->SetOutputTag(scenario);
90 
91  Singleton<SatIdMapper>::Get()->EnableMapPrint(true);
92 
93  if (scenario == "larger")
94  {
95  satScenario = SatHelper::LARGER;
96  }
97  else if (scenario == "full")
98  {
99  satScenario = SatHelper::FULL;
100  }
101 
103  LogComponentEnable("CbrApplication", LOG_LEVEL_INFO);
104  LogComponentEnable("PacketSink", LOG_LEVEL_INFO);
105  LogComponentEnable("sat-trace-input-interference-example", LOG_LEVEL_INFO);
106  LogComponentEnable("SatInputFileStreamTimeDoubleContainer", LOG_LEVEL_INFO);
107 
108  // Set simulation time
109  simulationHelper->SetSimulationTime(Seconds(11));
110 
112  // GlobalValue::Bind ("SimulatorImplementationType", StringValue
113  // ("ns3::RealtimeSimulatorImpl"));
114 
116 
117  // Creating the reference system. Note, currently the satellite module supports
118  // only one reference system, which is named as "Scenario72". The string is utilized
119  // in mapping the scenario to the needed reference system configuration files. Arbitrary
120  // scenario name results in fatal error.
121  simulationHelper->CreateSatScenario(satScenario);
122 
123  Config::SetDefault("ns3::CbrApplication::Interval", TimeValue(Time(interval)));
124  Config::SetDefault("ns3::CbrApplication::PacketSize", UintegerValue(packetSize));
125 
127  simulationHelper->InstallTrafficModel(SimulationHelper::CBR,
130  Seconds(3.0),
131  Seconds(5.1));
132 
134  simulationHelper->InstallTrafficModel(SimulationHelper::CBR,
137  Seconds(7.0),
138  Seconds(9.1));
139 
140  NS_LOG_INFO("--- Trace-input-interference-example ---");
141  NS_LOG_INFO(" Scenario used: " << scenario);
142  NS_LOG_INFO(" PacketSize: " << packetSize);
143  NS_LOG_INFO(" Interval: " << interval);
144  NS_LOG_INFO(" ");
145 
146  simulationHelper->RunSimulation();
147 
148  return 0;
149 }
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.