A Discrete-Event Network Simulator
API
lena-rlc-traces.cc
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
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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  */
20 
21 
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"
27 
28 
29 using namespace ns3;
30 
31 int main (int argc, char *argv[])
32 {
33  // Command line arguments
34  CommandLine cmd (__FILE__);
35  cmd.Parse (argc, argv);
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  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
46  // Enable LTE log components
47  //lteHelper->EnableLogComponents ();
48 
49  // Create Nodes: eNodeB and UE
50  NodeContainer enbNodes;
51  NodeContainer ueNodes;
52  enbNodes.Create (1);
53  ueNodes.Create (3);
54 
55  // Install Mobility Model
57  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
58  mobility.Install (enbNodes);
59  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
60  mobility.Install (ueNodes);
61 
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);
67 
68  // Attach a UE to a eNB
69  lteHelper->Attach (ueDevs, enbDevs.Get (0));
70 
71  // Activate an EPS bearer
73  EpsBearer bearer (q);
74  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
75 
76  Simulator::Stop (Seconds (0.5));
77 
78  lteHelper->EnablePhyTraces ();
79  lteHelper->EnableMacTraces ();
80  lteHelper->EnableRlcTraces ();
81 
82 
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  }
91 
92  Simulator::Run ();
93 
94  // Uncomment to show available paths
95  // GtkConfigStore config;
96  // config.ConfigureAttributes ();
97 
99 
100  return 0;
101 }
Parse command-line arguments.
Definition: command-line.h:229
Introspection did not find any typical Config paths.
Definition: config-store.h:60
void ConfigureDefaults(void)
Configure the default values.
Mobility model for which the current position does not change once it has been set and until it is se...
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
Qci
QoS Class Indicator.
Definition: eps-bearer.h:107
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition: eps-bearer.h:108
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
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:959
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1435
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1313
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
void EnablePhyTraces(void)
Enable trace sinks for PHY layer.
Definition: lte-helper.cc:1489
void EnableMacTraces(void)
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1529
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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
Hold variables of type string.
Definition: string.h:41
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Every class exported by the ns3 library is enclosed in the ns3 namespace.
cmd
Definition: second.py:35
mobility
Definition: third.py:108