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 * 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
19using namespace ns3;
20
21int
22main(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
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
56 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
57 mobility.Install(enbNodes);
59 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
60 mobility.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
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
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
102
103 // GtkConfigStore config;
104 // config.ConfigureAttributes ();
105
107 return 0;
108}
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Parse command-line arguments.
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:31
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
Qci
QoS Class Indicator.
Definition eps-bearer.h:95
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition eps-bearer.h:96
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.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void Run()
Run the simulation.
Definition simulator.cc:167
Hold variables of type string.
Definition string.h:45
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mobility
Definition third.py:92