A Discrete-Event Network Simulator
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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
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: Manuel Requena <manuel.requena@cttc.es>
19  */
22 #include "ns3/core-module.h"
23 #include "ns3/network-module.h"
24 #include "ns3/mobility-module.h"
25 #include "ns3/lte-module.h"
26 #include "ns3/config-store-module.h"
29 using namespace ns3;
31 int main (int argc, char *argv[])
32 {
33  // Command line arguments
35  cmd.Parse (argc, argv);
37  ConfigStore inputConfig;
38  inputConfig.ConfigureDefaults ();
40  // parse again so you can override default values from the command line
41  cmd.Parse (argc, argv);
43  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
45  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
46  // Enable LTE log components
47  //lteHelper->EnableLogComponents ();
49  // Create Nodes: eNodeB and UE
50  NodeContainer enbNodes;
51  NodeContainer ueNodes;
52  enbNodes.Create (1);
53  ueNodes.Create (3);
55  // Install Mobility Model
57  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
58  mobility.Install (enbNodes);
59  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
60  mobility.Install (ueNodes);
62  // Create Devices and install them in the Nodes (eNB and UE)
63  NetDeviceContainer enbDevs;
64  NetDeviceContainer ueDevs;
65  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
66  ueDevs = lteHelper->InstallUeDevice (ueNodes);
68  // Attach a UE to a eNB
69  lteHelper->Attach (ueDevs, enbDevs.Get (0));
71  // Activate an EPS bearer
73  EpsBearer bearer (q);
74  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
76  Simulator::Stop (Seconds (0.5));
78  lteHelper->EnablePhyTraces ();
79  lteHelper->EnableMacTraces ();
80  lteHelper->EnableRlcTraces ();
83  double distance_temp [] = { 1000,1000,1000};
84  std::vector<double> userDistance;
85  userDistance.assign (distance_temp, distance_temp + 3);
86  for (int i = 0; i < 3; i++)
87  {
89  mm->SetPosition (Vector (userDistance[i], 0.0, 0.0));
90  }
92  Simulator::Run ();
94  // Uncomment to show available paths
95  // GtkConfigStore config;
96  // config.ConfigureAttributes ();
100  return 0;
101 }
Introspection did not find any typical Config paths.
Definition: config-store.h:59
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:484
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
Hold variables of type string.
Definition: string.h:41
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Mobility model for which the current position does not change once it has been set and until it is se...
static void Run(void)
Run the simulation.
Definition: simulator.cc:226
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:943
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1350
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1294
tuple cmd
Definition: second.py:35
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
holds a vector of ns3::NetDevice pointers
void EnablePhyTraces(void)
Enable trace sinks for PHY layer.
Definition: lte-helper.cc:1404
Parse command-line arguments.
Definition: command-line.h:205
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:190
void ConfigureDefaults(void)
Configure the default values.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void SetPosition(const Vector &position)
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:499
Helper class used to assign positions and mobility models to nodes.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:234
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:993
void Parse(int argc, char *argv[])
Parse the program arguments.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void EnableMacTraces(void)
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1444
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
QoS Class Indicator.
Definition: eps-bearer.h:77