A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
lena-rem.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Manuel Requena <manuel.requena@cttc.es>
7
* Nicola Baldo <nbaldo@cttc.es>
8
*/
9
10
#include "ns3/config-store.h"
11
#include "ns3/core-module.h"
12
#include "ns3/lte-module.h"
13
#include "ns3/mobility-module.h"
14
#include "ns3/network-module.h"
15
#include "ns3/spectrum-module.h"
16
#include <ns3/buildings-helper.h>
17
// #include "ns3/gtk-config-store.h"
18
19
using namespace
ns3
;
20
21
int
22
main(
int
argc,
char
* argv[])
23
{
24
CommandLine
cmd
(__FILE__);
25
cmd
.Parse(argc, argv);
26
27
// to save a template default attribute file run it like this:
28
// ./ns3 run src/lte/examples/lena-first-sim --command-template="%s
29
// --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Save
30
// --ns3::ConfigStore::FileFormat=RawText"
31
//
32
// to load a previously created default attribute file
33
// ./ns3 run src/lte/examples/lena-first-sim --command-template="%s
34
// --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Load
35
// --ns3::ConfigStore::FileFormat=RawText"
36
37
ConfigStore
inputConfig;
38
inputConfig.
ConfigureDefaults
();
39
40
// Parse again so you can override default values from the command line
41
cmd
.Parse(argc, argv);
42
43
Ptr<LteHelper>
lteHelper =
CreateObject<LteHelper>
();
44
45
// Uncomment to enable logging
46
// lteHelper->EnableLogComponents ();
47
48
// Create Nodes: eNodeB and UE
49
NodeContainer
enbNodes;
50
NodeContainer
ueNodes;
51
enbNodes.
Create
(1);
52
ueNodes.
Create
(1);
53
54
// Install Mobility Model
55
MobilityHelper
mobility
;
56
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
57
mobility
.Install(enbNodes);
58
BuildingsHelper::Install
(enbNodes);
59
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
60
mobility
.Install(ueNodes);
61
BuildingsHelper::Install
(ueNodes);
62
63
// Create Devices and install them in the Nodes (eNB and UE)
64
NetDeviceContainer
enbDevs;
65
NetDeviceContainer
ueDevs;
66
// Default scheduler is PF, uncomment to use RR
67
// lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler");
68
69
enbDevs = lteHelper->InstallEnbDevice(enbNodes);
70
ueDevs = lteHelper->InstallUeDevice(ueNodes);
71
72
// Attach a UE to a eNB
73
lteHelper->Attach(ueDevs, enbDevs.
Get
(0));
74
75
// Activate an EPS bearer
76
EpsBearer::Qci
q =
EpsBearer::GBR_CONV_VOICE
;
77
EpsBearer
bearer(q);
78
lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
79
80
// Configure Radio Environment Map (REM) output
81
// for LTE-only simulations always use /ChannelList/0 which is the downlink channel
82
Ptr<RadioEnvironmentMapHelper>
remHelper =
CreateObject<RadioEnvironmentMapHelper>
();
83
remHelper->SetAttribute(
"ChannelPath"
,
StringValue
(
"/ChannelList/0"
));
84
remHelper->SetAttribute(
"OutputFile"
,
StringValue
(
"rem.out"
));
85
remHelper->SetAttribute(
"XMin"
,
DoubleValue
(-400.0));
86
remHelper->SetAttribute(
"XMax"
,
DoubleValue
(400.0));
87
remHelper->SetAttribute(
"YMin"
,
DoubleValue
(-300.0));
88
remHelper->SetAttribute(
"YMax"
,
DoubleValue
(300.0));
89
remHelper->SetAttribute(
"Z"
,
DoubleValue
(0.0));
90
remHelper->Install();
91
92
// here's a minimal gnuplot script that will plot the above:
93
//
94
// set view map;
95
// set term x11;
96
// set xlabel "X"
97
// set ylabel "Y"
98
// set cblabel "SINR (dB)"
99
// plot "rem.out" using ($1):($2):(10*log10($4)) with image
100
101
Simulator::Run
();
102
103
// GtkConfigStore config;
104
// config.ConfigureAttributes ();
105
106
Simulator::Destroy
();
107
return
0;
108
}
ns3::BuildingsHelper::Install
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Definition
buildings-helper.cc:34
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
ns3::ConfigStore
Definition
config-store.h:50
ns3::ConfigStore::ConfigureDefaults
void ConfigureDefaults()
Configure the default values.
Definition
config-store.cc:183
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::EpsBearer
This class contains the specification of EPS Bearers.
Definition
eps-bearer.h:80
ns3::EpsBearer::Qci
Qci
QoS Class Indicator.
Definition
eps-bearer.h:95
ns3::EpsBearer::GBR_CONV_VOICE
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition
eps-bearer.h:96
ns3::MobilityHelper
Helper class used to assign positions and mobility models to nodes.
Definition
mobility-helper.h:33
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
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:56
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
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:73
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Simulator::Destroy
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition
simulator.cc:131
ns3::Simulator::Run
static void Run()
Run the simulation.
Definition
simulator.cc:167
ns3::StringValue
Hold variables of type string.
Definition
string.h:45
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.cmd
cmd
Definition
second.py:29
third.mobility
mobility
Definition
third.py:92
src
lte
examples
lena-rem.cc
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0