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-rlc-traces.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
*/
8
9
#include "ns3/config-store-module.h"
10
#include "ns3/core-module.h"
11
#include "ns3/lte-module.h"
12
#include "ns3/mobility-module.h"
13
#include "ns3/network-module.h"
14
15
using namespace
ns3
;
16
17
int
18
main(
int
argc
,
char
*
argv
[])
19
{
20
// Command line arguments
21
CommandLine
cmd
(
__FILE__
);
22
cmd
.Parse(
argc
,
argv
);
23
24
ConfigStore
inputConfig
;
25
inputConfig
.
ConfigureDefaults
();
26
27
// parse again so you can override default values from the command line
28
cmd
.Parse(
argc
,
argv
);
29
30
Ptr<LteHelper>
lteHelper
=
CreateObject<LteHelper>
();
31
32
lteHelper
->SetAttribute(
"PathlossModel"
,
StringValue
(
"ns3::FriisSpectrumPropagationLossModel"
));
33
// Enable LTE log components
34
// lteHelper->EnableLogComponents ();
35
36
// Create Nodes: eNodeB and UE
37
NodeContainer
enbNodes
;
38
NodeContainer
ueNodes
;
39
enbNodes
.
Create
(1);
40
ueNodes
.Create(3);
41
42
// Install Mobility Model
43
MobilityHelper
mobility
;
44
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
45
mobility
.Install(
enbNodes
);
46
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
47
mobility
.Install(
ueNodes
);
48
49
// Create Devices and install them in the Nodes (eNB and UE)
50
NetDeviceContainer
enbDevs
;
51
NetDeviceContainer
ueDevs
;
52
enbDevs
=
lteHelper
->InstallEnbDevice(
enbNodes
);
53
ueDevs
=
lteHelper
->InstallUeDevice(
ueNodes
);
54
55
// Attach a UE to a eNB
56
lteHelper
->Attach(
ueDevs
,
enbDevs
.Get(0));
57
58
// Activate an EPS bearer
59
EpsBearer::Qci
q =
EpsBearer::GBR_CONV_VOICE
;
60
EpsBearer
bearer(q);
61
lteHelper
->ActivateDataRadioBearer(
ueDevs
, bearer);
62
63
Simulator::Stop
(
Seconds
(0.5));
64
65
lteHelper
->EnablePhyTraces();
66
lteHelper
->EnableMacTraces();
67
lteHelper
->EnableRlcTraces();
68
69
double
distance_temp
[] = {1000, 1000, 1000};
70
std::vector<double>
userDistance
;
71
userDistance
.assign(
distance_temp
,
distance_temp
+ 3);
72
for
(
int
i
= 0;
i
< 3;
i
++)
73
{
74
Ptr<ConstantPositionMobilityModel>
mm
=
75
ueNodes
.Get(
i
)->GetObject<
ConstantPositionMobilityModel
>();
76
mm
->
SetPosition
(Vector(
userDistance
[
i
], 0.0, 0.0));
77
}
78
79
Simulator::Run
();
80
81
// Uncomment to show available paths
82
// GtkConfigStore config;
83
// config.ConfigureAttributes ();
84
85
Simulator::Destroy
();
86
87
return
0;
88
}
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
ns3::ConfigStore
Introspection did not find any typical Config paths.
Definition
config-store.h:50
ns3::ConfigStore::ConfigureDefaults
void ConfigureDefaults()
Configure the default values.
Definition
config-store.cc:181
ns3::ConstantPositionMobilityModel
Mobility model for which the current position does not change once it has been set and until it is se...
Definition
constant-position-mobility-model.h:23
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::MobilityModel::SetPosition
void SetPosition(const Vector &position)
Definition
mobility-model.cc:81
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
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
ptr.h:66
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::Simulator::Stop
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition
simulator.cc:175
ns3::StringValue
Hold variables of type string.
Definition
string.h:45
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1344
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-rlc-traces.cc
Generated on Mon Dec 15 2025 15:21:56 for ns-3 by
1.9.8