A Discrete-Event Network Simulator
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 * 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
30using namespace ns3;
31
32int
33main(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
67 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
68 mobility.Install(enbNodes);
70 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
71 mobility.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
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
113
114 // GtkConfigStore config;
115 // config.ConfigureAttributes ();
116
118 return 0;
119}
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Parse command-line arguments.
Definition: command-line.h:232
Introspection did not find any typical Config paths.
Definition: config-store.h:61
void ConfigureDefaults()
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
Qci
QoS Class Indicator.
Definition: eps-bearer.h:106
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition: eps-bearer.h:107
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static void Run()
Run the simulation.
Definition: simulator.cc:178
Hold variables of type string.
Definition: string.h:56
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns cmd
Definition: second.py:40
ns mobility
Definition: third.py:105