A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
lte-enb-net-device.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
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: Giuseppe Piro <g.piro@poliba.it>
19
* Author: Marco Miozzo <mmiozzo@cttc.es> : Update to FF API Architecture
20
* Author: Nicola Baldo <nbaldo@cttc.es> : Integrated with new RRC and MAC architecture
21
*/
22
23
#include <ns3/llc-snap-header.h>
24
#include <ns3/simulator.h>
25
#include <ns3/callback.h>
26
#include <ns3/node.h>
27
#include <ns3/packet.h>
28
#include <ns3/lte-net-device.h>
29
#include <ns3/packet-burst.h>
30
#include <ns3/uinteger.h>
31
#include <ns3/trace-source-accessor.h>
32
#include <ns3/pointer.h>
33
#include <ns3/enum.h>
34
#include <ns3/lte-amc.h>
35
#include <ns3/lte-enb-mac.h>
36
#include <ns3/lte-enb-net-device.h>
37
#include <ns3/lte-enb-rrc.h>
38
#include <ns3/lte-ue-net-device.h>
39
#include <ns3/lte-enb-phy.h>
40
#include <ns3/ff-mac-scheduler.h>
41
#include <ns3/ipv4-l3-protocol.h>
42
#include <ns3/abort.h>
43
#include <ns3/log.h>
44
45
NS_LOG_COMPONENT_DEFINE
(
"LteEnbNetDevice"
);
46
47
namespace
ns3 {
48
49
NS_OBJECT_ENSURE_REGISTERED
( LteEnbNetDevice);
50
51
TypeId
LteEnbNetDevice::GetTypeId
(
void
)
52
{
53
static
TypeId
54
tid =
55
TypeId
(
"ns3::LteEnbNetDevice"
)
56
.
SetParent
<
LteNetDevice
> ()
57
.AddConstructor<LteEnbNetDevice> ()
58
.AddAttribute (
"LteEnbRrc"
,
59
"The RRC associated to this EnbNetDevice"
,
60
PointerValue
(),
61
MakePointerAccessor (&
LteEnbNetDevice::m_rrc
),
62
MakePointerChecker <LteEnbRrc> ())
63
.AddAttribute (
"LteEnbMac"
,
64
"The MAC associated to this EnbNetDevice"
,
65
PointerValue
(),
66
MakePointerAccessor (&
LteEnbNetDevice::m_mac
),
67
MakePointerChecker <LteEnbMac> ())
68
.AddAttribute (
"FfMacScheduler"
,
69
"The scheduler associated to this EnbNetDevice"
,
70
PointerValue
(),
71
MakePointerAccessor (&
LteEnbNetDevice::m_scheduler
),
72
MakePointerChecker <FfMacScheduler> ())
73
.AddAttribute (
"LteEnbPhy"
,
74
"The PHY associated to this EnbNetDevice"
,
75
PointerValue
(),
76
MakePointerAccessor (&
LteEnbNetDevice::m_phy
),
77
MakePointerChecker <LteEnbPhy> ())
78
.AddAttribute (
"UlBandwidth"
,
79
"Uplink Transmission Bandwidth Configuration in number of Resource Blocks"
,
80
UintegerValue
(25),
81
MakeUintegerAccessor (&
LteEnbNetDevice::SetUlBandwidth
,
82
&
LteEnbNetDevice::GetUlBandwidth
),
83
MakeUintegerChecker<uint8_t> ())
84
.AddAttribute (
"DlBandwidth"
,
85
"Downlink Transmission Bandwidth Configuration in number of Resource Blocks"
,
86
UintegerValue
(25),
87
MakeUintegerAccessor (&
LteEnbNetDevice::SetDlBandwidth
,
88
&
LteEnbNetDevice::GetDlBandwidth
),
89
MakeUintegerChecker<uint8_t> ())
90
.AddAttribute (
"CellId"
,
91
"Cell Identifier"
,
92
UintegerValue
(0),
93
MakeUintegerAccessor (&
LteEnbNetDevice::m_cellId
),
94
MakeUintegerChecker<uint16_t> ())
95
.AddAttribute (
"DlEarfcn"
,
96
"Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
97
"as per 3GPP 36.101 Section 5.7.3. "
,
98
UintegerValue
(100),
99
MakeUintegerAccessor (&
LteEnbNetDevice::m_dlEarfcn
),
100
MakeUintegerChecker<uint16_t> (0, 6149))
101
.AddAttribute (
"UlEarfcn"
,
102
"Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
103
"as per 3GPP 36.101 Section 5.7.3. "
,
104
UintegerValue
(18100),
105
MakeUintegerAccessor (&
LteEnbNetDevice::m_ulEarfcn
),
106
MakeUintegerChecker<uint16_t> (18000, 24149))
107
;
108
return
tid;
109
}
110
111
LteEnbNetDevice::LteEnbNetDevice
()
112
{
113
NS_LOG_FUNCTION
(
this
);
114
}
115
116
LteEnbNetDevice::~LteEnbNetDevice
(
void
)
117
{
118
NS_LOG_FUNCTION
(
this
);
119
}
120
121
void
122
LteEnbNetDevice::DoDispose
()
123
{
124
NS_LOG_FUNCTION
(
this
);
125
126
m_mac
->
Dispose
();
127
m_mac
= 0;
128
129
m_scheduler
->
Dispose
();
130
m_scheduler
= 0;
131
132
m_rrc
->
Dispose
();
133
m_rrc
= 0;
134
135
m_phy
->
Dispose
();
136
m_phy
= 0;
137
138
LteNetDevice::DoDispose
();
139
}
140
141
142
143
Ptr<LteEnbMac>
144
LteEnbNetDevice::GetMac
(
void
)
const
145
{
146
NS_LOG_FUNCTION
(
this
);
147
return
m_mac
;
148
}
149
150
151
Ptr<LteEnbPhy>
152
LteEnbNetDevice::GetPhy
(
void
)
const
153
{
154
NS_LOG_FUNCTION
(
this
);
155
return
m_phy
;
156
}
157
158
159
Ptr<LteEnbRrc>
160
LteEnbNetDevice::GetRrc
()
const
161
{
162
return
m_rrc
;
163
}
164
165
uint16_t
166
LteEnbNetDevice::GetCellId
()
const
167
{
168
return
m_cellId
;
169
}
170
171
uint8_t
172
LteEnbNetDevice::GetUlBandwidth
()
const
173
{
174
return
m_ulBandwidth
;
175
}
176
177
void
178
LteEnbNetDevice::SetUlBandwidth
(uint8_t bw)
179
{
180
switch
(bw)
181
{
182
case
6:
183
case
15:
184
case
25:
185
case
50:
186
case
75:
187
case
100:
188
m_ulBandwidth
= bw;
189
break
;
190
191
default
:
192
NS_FATAL_ERROR
(
"invalid bandwidth value "
<< (uint16_t) bw);
193
break
;
194
}
195
}
196
197
uint8_t
198
LteEnbNetDevice::GetDlBandwidth
()
const
199
{
200
return
m_dlBandwidth
;
201
}
202
203
void
204
LteEnbNetDevice::SetDlBandwidth
(uint8_t bw)
205
{
206
switch
(bw)
207
{
208
case
6:
209
case
15:
210
case
25:
211
case
50:
212
case
75:
213
case
100:
214
m_dlBandwidth
= bw;
215
break
;
216
217
default
:
218
NS_FATAL_ERROR
(
"invalid bandwidth value "
<< (uint16_t) bw);
219
break
;
220
}
221
}
222
223
uint16_t
224
LteEnbNetDevice::GetDlEarfcn
()
const
225
{
226
return
m_dlEarfcn
;
227
}
228
229
void
230
LteEnbNetDevice::SetDlEarfcn
(uint16_t earfcn)
231
{
232
m_dlEarfcn
= earfcn;
233
}
234
235
uint16_t
236
LteEnbNetDevice::GetUlEarfcn
()
const
237
{
238
return
m_ulEarfcn
;
239
}
240
241
void
242
LteEnbNetDevice::SetUlEarfcn
(uint16_t earfcn)
243
{
244
m_ulEarfcn
= earfcn;
245
}
246
247
248
void
249
LteEnbNetDevice::DoInitialize
(
void
)
250
{
251
252
UpdateConfig
();
253
m_phy
->
Initialize
();
254
m_mac
->
Initialize
();
255
m_rrc
->
Initialize
();
256
}
257
258
259
260
bool
261
LteEnbNetDevice::Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber)
262
{
263
NS_LOG_FUNCTION
(
this
<< packet << dest << protocolNumber);
264
NS_ASSERT_MSG
(protocolNumber ==
Ipv4L3Protocol::PROT_NUMBER
,
"unsupported protocol "
<< protocolNumber <<
", only IPv4 is supported"
);
265
return
m_rrc
->
SendData
(packet);
266
}
267
268
269
270
271
void
272
LteEnbNetDevice::UpdateConfig
(
void
)
273
{
274
NS_LOG_FUNCTION
(
this
);
275
276
m_rrc
->
ConfigureCell
(
m_ulBandwidth
,
m_dlBandwidth
,
m_ulEarfcn
,
m_dlEarfcn
,
m_cellId
);
277
m_rrc
->
SetCellId
(
m_cellId
);
278
279
}
280
281
282
}
// namespace ns3
src
lte
model
lte-enb-net-device.cc
Generated on Tue May 14 2013 11:08:25 for ns-3 by
1.8.1.2