Loading...
Searching...
No Matches
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
30using namespace ns3;
31
36
37NS_LOG_COMPONENT_DEFINE("sat-logon-example");
38
39int
40main(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->LoadScenario("geo-33E");
109
110 simulationHelper->CreateSatScenario();
111
112 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
115 Time(interval),
116 packetSize,
117 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
118 Singleton<SatTopology>::Get()->GetUtUserNodes(),
119 Seconds(0.1),
120 Seconds(simLength),
121 Seconds(0));
122
123 simulationHelper->GetTrafficHelper()->AddCbrTraffic(
126 Time(interval),
127 packetSize,
128 NodeContainer(Singleton<SatTopology>::Get()->GetGwUserNode(0)),
129 Singleton<SatTopology>::Get()->GetUtUserNodes(),
130 Seconds(0.1),
131 Seconds(simLength),
132 Seconds(0));
133
134 // To store attributes to file
135 Config::SetDefault("ns3::ConfigStore::Filename", StringValue("output-attributes.xml"));
136 Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("Xml"));
137 Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
138 ConfigStore outputConfig;
139 outputConfig.ConfigureDefaults();
140 simulationHelper->StoreAttributesToFile("output-attributes.xml");
141
142 Ptr<SatStatsHelperContainer> s = simulationHelper->GetStatisticsContainer();
143
144 s->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
145 s->AddGlobalFwdUserMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
146 s->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
147 s->AddGlobalRtnFeederMacThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
148
149 s->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
150 s->AddGlobalFwdAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
151 s->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCALAR_FILE);
152 s->AddGlobalRtnAppThroughput(SatStatsHelper::OUTPUT_SCATTER_FILE);
153
154 s->AddGlobalFwdMacDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
155 s->AddGlobalFwdMacDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
156 s->AddGlobalRtnMacDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
157 s->AddGlobalRtnMacDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
158
159 s->AddGlobalFwdAppDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
160 s->AddGlobalFwdAppDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
161 s->AddGlobalRtnAppDelay(SatStatsHelper::OUTPUT_SCALAR_FILE);
162 s->AddGlobalRtnAppDelay(SatStatsHelper::OUTPUT_SCATTER_FILE);
163
164 simulationHelper->RunSimulation();
165
166 return 0;
167}
@ SUPER_FRAME_CONFIG_0
SUPER_FRAME_CONFIG_0.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.