sat-logon-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: Bastien Tauran <bastien.tauran@viveris.fr>
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 
30 using namespace ns3;
31 
37 NS_LOG_COMPONENT_DEFINE("sat-logon-example");
38 
39 int
40 main(int argc, char* argv[])
41 {
42  uint32_t beamId = 1;
43  uint32_t endUsersPerUt = 1;
44  uint32_t utsPerBeam = 10;
45 
46  uint32_t packetSize = 512;
47  std::string interval = "10ms";
48 
49  double simLength = 30.0;
50 
52  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
53 
55  Config::SetDefault("ns3::SatHelper::PacketTraceEnabled", BooleanValue(true));
56  Ptr<SimulationHelper> simulationHelper = CreateObject<SimulationHelper>("example-logon");
57  simulationHelper->SetSimulationTime(Seconds(simLength));
58  simulationHelper->EnableProgressLogs();
59 
60  // Set beam ID
61  simulationHelper->SetSimulationTime(simLength);
62  simulationHelper->SetUserCountPerUt(endUsersPerUt);
63  simulationHelper->SetUtCountPerBeam(utsPerBeam);
64  simulationHelper->SetBeamSet({beamId});
65 
66  // Set 2 RA frames including one for logon
67  Config::SetDefault("ns3::SatConf::SuperFrameConfForSeq0",
69  Config::SetDefault("ns3::SatBeamHelper::RandomAccessModel",
71  Config::SetDefault("ns3::SatBeamHelper::RaInterferenceModel",
73  Config::SetDefault("ns3::SatBeamHelper::RaCollisionModel",
75  Config::SetDefault("ns3::SatSuperframeConf0::Frame0_RandomAccessFrame", BooleanValue(true));
76  Config::SetDefault("ns3::SatSuperframeConf0::Frame1_RandomAccessFrame", BooleanValue(true));
77  Config::SetDefault("ns3::SatSuperframeConf0::Frame1_LogonFrame", BooleanValue(true));
78 
79  Config::SetDefault("ns3::SatUtMac::WindowInitLogon", TimeValue(Seconds(20)));
80  Config::SetDefault("ns3::SatUtMac::MaxWaitingTimeLogonResponse", TimeValue(Seconds(1)));
81 
82  // Disable DA
83  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_ConstantAssignmentProvided",
84  BooleanValue(false));
85  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_ConstantAssignmentProvided",
86  BooleanValue(false));
87  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_ConstantAssignmentProvided",
88  BooleanValue(false));
89  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_ConstantAssignmentProvided",
90  BooleanValue(false));
91  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_RbdcAllowed",
92  BooleanValue(false));
93  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_RbdcAllowed",
94  BooleanValue(false));
95  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_RbdcAllowed",
96  BooleanValue(false));
97  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_RbdcAllowed",
98  BooleanValue(false));
99  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService0_VolumeAllowed",
100  BooleanValue(false));
101  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService1_VolumeAllowed",
102  BooleanValue(false));
103  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService2_VolumeAllowed",
104  BooleanValue(false));
105  Config::SetDefault("ns3::SatLowerLayerServiceConf::DaService3_VolumeAllowed",
106  BooleanValue(false));
107 
108  simulationHelper->CreateSatScenario();
109 
110  Config::SetDefault("ns3::CbrApplication::Interval", StringValue(interval));
111  Config::SetDefault("ns3::CbrApplication::PacketSize", UintegerValue(packetSize));
112 
113  simulationHelper->InstallTrafficModel(SimulationHelper::CBR,
116  Seconds(0.1),
117  Seconds(simLength));
118  simulationHelper->InstallTrafficModel(SimulationHelper::CBR,
121  Seconds(0.1),
122  Seconds(simLength));
123 
124  // To store attributes to file
125  Config::SetDefault("ns3::ConfigStore::Filename", StringValue("output-attributes.xml"));
126  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
127  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
128  ConfigStore outputConfig;
129  outputConfig.ConfigureDefaults();
130  simulationHelper->StoreAttributesToFile("output-attributes.xml");
131 
132  Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
133 
134  s->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
135  s->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
136  s->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
137  s->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
138 
139  s->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
140  s->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
141  s->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
142  s->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
143 
144  s->AddGlobalFwdMacDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
145  s->AddGlobalFwdMacDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
146  s->AddGlobalRtnMacDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
147  s->AddGlobalRtnMacDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
148 
149  s->AddGlobalFwdAppDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
150  s->AddGlobalFwdAppDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
151  s->AddGlobalRtnAppDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
152  s->AddGlobalRtnAppDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
153 
154  simulationHelper->RunSimulation();
155 
156  return 0;
157 }
@ SUPER_FRAME_CONFIG_0
SUPER_FRAME_CONFIG_0.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.