Loading...
Searching...
No Matches
sat-cbr-full-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: Jani Puttonen <jani.puttonen@magister.fi>
19 *
20 */
21
22#include "ns3/applications-module.h"
23#include "ns3/config-store-module.h"
24#include "ns3/core-module.h"
25#include "ns3/internet-module.h"
26#include "ns3/network-module.h"
27#include "ns3/satellite-module.h"
28#include "ns3/traffic-module.h"
29
30using namespace ns3;
31
40
41NS_LOG_COMPONENT_DEFINE("sat-cbr-full-example");
42
43int
44main(int argc, char* argv[])
45{
46 // LogComponentEnable ("CbrApplication", LOG_LEVEL_ALL);
47 // LogComponentEnable ("PacketSink", LOG_LEVEL_ALL);
48 // LogComponentEnable ("sat-arq-rtn-example", LOG_LEVEL_INFO);
49
50 uint32_t endUsersPerUt(3);
51 uint32_t utsPerBeam(3);
52 uint32_t packetSize(128);
53 std::string interval("1s");
54 double simLength(10.0);
55
56 Time appStartTime = Seconds(0.001);
57
59 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
60
62 Config::SetDefault("ns3::SatHelper::PacketTraceEnabled", BooleanValue(true));
63 Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>("example-cbr-full");
64
65 // read command line parameters given by user
66 CommandLine cmd;
67 cmd.AddValue("endUsersPerUt", "Number of end users per UT", endUsersPerUt);
68 cmd.AddValue("utsPerBeam", "Number of UTs per spot-beam", utsPerBeam);
69 cmd.AddValue("packetSize", "Size of constant packet (bytes)", packetSize);
70 cmd.AddValue("interval", "Interval to sent packets in seconds, (e.g. (1s)", interval);
71 cmd.AddValue("simLength", "Simulation length in seconds", simLength);
72 simulationHelper->AddDefaultUiArguments(cmd);
73 cmd.Parse(argc, argv);
74
75 simulationHelper->SetSimulationTime(simLength);
76
77 // We set the UT count and UT user count using attributes when configuring a pre-defined
78 // scenario
79 Config::SetDefault("ns3::SatHelper::UtCount", UintegerValue(utsPerBeam));
80 Config::SetDefault("ns3::SatHelper::UtUsers", UintegerValue(endUsersPerUt));
81
82 // Configure a static error probability
84 double errorRate(0.2);
85 Config::SetDefault("ns3::SatUtHelper::FwdLinkConstantErrorRate", DoubleValue(errorRate));
86 Config::SetDefault("ns3::SatUtHelper::FwdLinkErrorModel", EnumValue(em));
87 Config::SetDefault("ns3::SatGwHelper::RtnLinkConstantErrorRate", DoubleValue(errorRate));
88 Config::SetDefault("ns3::SatGwHelper::RtnLinkErrorModel", EnumValue(em));
89
90 simulationHelper->LoadScenario("geo-33E");
91
92 // Create full scenario
93 simulationHelper->CreateSatScenario(SatHelper::FULL);
94
95 // >>> Start of actual test using Full scenario >>>
96 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
99 Time(interval),
100 packetSize,
101 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
102 Singleton<SatTopology>::Get()->GetUtUserNodes(),
103 appStartTime,
104 Seconds(simLength),
105 Seconds(0.001));
106
107 NS_LOG_INFO("--- sat-cbr-full-example ---");
108 NS_LOG_INFO(" Packet size in bytes: " << packetSize);
109 NS_LOG_INFO(" Packet sending interval: " << interval);
110 NS_LOG_INFO(" Simulation length: " << simLength);
111 NS_LOG_INFO(" Number of UTs: " << utsPerBeam);
112 NS_LOG_INFO(" Number of end users per UT: " << endUsersPerUt);
113 NS_LOG_INFO(" ");
114
115 simulationHelper->RunSimulation();
116
117 return 0;
118
119} // end of `int main (int argc, char *argv[])`
@ FULL
FULL Full scenario used as base.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.