A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
lena-rem.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Manuel Requena <manuel.requena@cttc.es>
18
* Nicola Baldo <nbaldo@cttc.es>
19
*/
20
21
#include "ns3/config-store.h"
22
#include "ns3/core-module.h"
23
#include "ns3/lte-module.h"
24
#include "ns3/mobility-module.h"
25
#include "ns3/network-module.h"
26
#include "ns3/spectrum-module.h"
27
#include <ns3/buildings-helper.h>
28
// #include "ns3/gtk-config-store.h"
29
30
using namespace
ns3
;
31
32
int
33
main(
int
argc,
char
* argv[])
34
{
35
CommandLine
cmd
(__FILE__);
36
cmd
.Parse(argc, argv);
37
38
// to save a template default attribute file run it like this:
39
// ./ns3 run src/lte/examples/lena-first-sim --command-template="%s
40
// --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Save
41
// --ns3::ConfigStore::FileFormat=RawText"
42
//
43
// to load a previously created default attribute file
44
// ./ns3 run src/lte/examples/lena-first-sim --command-template="%s
45
// --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Load
46
// --ns3::ConfigStore::FileFormat=RawText"
47
48
ConfigStore
inputConfig;
49
inputConfig.
ConfigureDefaults
();
50
51
// Parse again so you can override default values from the command line
52
cmd
.Parse(argc, argv);
53
54
Ptr<LteHelper>
lteHelper = CreateObject<LteHelper>();
55
56
// Uncomment to enable logging
57
// lteHelper->EnableLogComponents ();
58
59
// Create Nodes: eNodeB and UE
60
NodeContainer
enbNodes;
61
NodeContainer
ueNodes;
62
enbNodes.
Create
(1);
63
ueNodes.
Create
(1);
64
65
// Install Mobility Model
66
MobilityHelper
mobility
;
67
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
68
mobility
.Install(enbNodes);
69
BuildingsHelper::Install
(enbNodes);
70
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
71
mobility
.Install(ueNodes);
72
BuildingsHelper::Install
(ueNodes);
73
74
// Create Devices and install them in the Nodes (eNB and UE)
75
NetDeviceContainer
enbDevs;
76
NetDeviceContainer
ueDevs;
77
// Default scheduler is PF, uncomment to use RR
78
// lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler");
79
80
enbDevs = lteHelper->
InstallEnbDevice
(enbNodes);
81
ueDevs = lteHelper->
InstallUeDevice
(ueNodes);
82
83
// Attach a UE to a eNB
84
lteHelper->
Attach
(ueDevs, enbDevs.
Get
(0));
85
86
// Activate an EPS bearer
87
EpsBearer::Qci
q =
EpsBearer::GBR_CONV_VOICE
;
88
EpsBearer
bearer(q);
89
lteHelper->
ActivateDataRadioBearer
(ueDevs, bearer);
90
91
// Configure Radio Environment Map (REM) output
92
// for LTE-only simulations always use /ChannelList/0 which is the downlink channel
93
Ptr<RadioEnvironmentMapHelper>
remHelper = CreateObject<RadioEnvironmentMapHelper>();
94
remHelper->SetAttribute(
"ChannelPath"
,
StringValue
(
"/ChannelList/0"
));
95
remHelper->SetAttribute(
"OutputFile"
,
StringValue
(
"rem.out"
));
96
remHelper->SetAttribute(
"XMin"
,
DoubleValue
(-400.0));
97
remHelper->SetAttribute(
"XMax"
,
DoubleValue
(400.0));
98
remHelper->SetAttribute(
"YMin"
,
DoubleValue
(-300.0));
99
remHelper->SetAttribute(
"YMax"
,
DoubleValue
(300.0));
100
remHelper->SetAttribute(
"Z"
,
DoubleValue
(0.0));
101
remHelper->Install();
102
103
// here's a minimal gnuplot script that will plot the above:
104
//
105
// set view map;
106
// set term x11;
107
// set xlabel "X"
108
// set ylabel "Y"
109
// set cblabel "SINR (dB)"
110
// plot "rem.out" using ($1):($2):(10*log10($4)) with image
111
112
Simulator::Run
();
113
114
// GtkConfigStore config;
115
// config.ConfigureAttributes ();
116
117
Simulator::Destroy
();
118
return
0;
119
}
ns3::BuildingsHelper::Install
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Definition:
buildings-helper.cc:45
ns3::CommandLine
Parse command-line arguments.
Definition:
command-line.h:232
ns3::ConfigStore
Definition:
config-store.h:61
ns3::ConfigStore::ConfigureDefaults
void ConfigureDefaults()
Configure the default values.
Definition:
config-store.cc:192
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition:
double.h:42
ns3::EpsBearer
This class contains the specification of EPS Bearers.
Definition:
eps-bearer.h:91
ns3::EpsBearer::Qci
Qci
QoS Class Indicator.
Definition:
eps-bearer.h:106
ns3::EpsBearer::GBR_CONV_VOICE
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition:
eps-bearer.h:107
ns3::LteHelper::InstallEnbDevice
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition:
lte-helper.cc:485
ns3::LteHelper::Attach
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
Definition:
lte-helper.cc:1039
ns3::LteHelper::ActivateDataRadioBearer
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition:
lte-helper.cc:1436
ns3::LteHelper::InstallUeDevice
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition:
lte-helper.cc:500
ns3::MobilityHelper
Helper class used to assign positions and mobility models to nodes.
Definition:
mobility-helper.h:44
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition:
net-device-container.h:43
ns3::NetDeviceContainer::Get
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Definition:
net-device-container.cc:67
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition:
node-container.cc:84
ns3::Ptr< LteHelper >
ns3::Simulator::Destroy
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition:
simulator.cc:142
ns3::Simulator::Run
static void Run()
Run the simulation.
Definition:
simulator.cc:178
ns3::StringValue
Hold variables of type string.
Definition:
string.h:56
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.cmd
cmd
Definition:
second.py:40
third.mobility
mobility
Definition:
third.py:105
src
lte
examples
lena-rem.cc
Generated on Sun Mar 3 2024 17:11:01 for ns-3 by
1.9.1