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-test-phy-error-model.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: Marco Miozzo <marco.miozzo@cttc.es>
19
*/
20
21
#include <ns3/object.h>
22
#include <ns3/spectrum-interference.h>
23
#include <ns3/spectrum-error-model.h>
24
#include <ns3/log.h>
25
#include <ns3/test.h>
26
#include <ns3/simulator.h>
27
#include <ns3/packet.h>
28
#include <ns3/ptr.h>
29
#include <iostream>
30
#include <ns3/radio-bearer-stats-calculator.h>
31
#include <ns3/buildings-mobility-model.h>
32
#include <ns3/hybrid-buildings-propagation-loss-model.h>
33
#include <ns3/eps-bearer.h>
34
#include <ns3/node-container.h>
35
#include <ns3/mobility-helper.h>
36
#include <ns3/net-device-container.h>
37
#include <ns3/lte-ue-net-device.h>
38
#include <ns3/lte-enb-net-device.h>
39
#include <ns3/lte-ue-rrc.h>
40
#include <ns3/lte-helper.h>
41
#include <ns3/string.h>
42
#include <ns3/double.h>
43
#include <ns3/lte-enb-phy.h>
44
#include <ns3/lte-ue-phy.h>
45
#include <ns3/config.h>
46
#include <ns3/boolean.h>
47
#include <ns3/enum.h>
48
#include <ns3/unused.h>
49
#include <ns3/ff-mac-scheduler.h>
50
51
#include "
lte-test-phy-error-model.h
"
52
53
NS_LOG_COMPONENT_DEFINE
(
"LenaTestPhyErrorModel"
);
54
55
namespace
ns3 {
56
57
58
LenaTestPhyErrorModelrSuite::LenaTestPhyErrorModelrSuite
()
59
:
TestSuite
(
"lte-phy-error-model"
, SYSTEM)
60
{
61
NS_LOG_INFO
(
"creating LenaTestPhyErrorModelTestCase"
);
62
63
64
// Tests on DL Control Channels (PCFICH+PDDCH)
65
// 1 interfering eNB SINR -2.0 BER 0.007 TB size 217
66
AddTestCase
(
new
LenaDlCtrlPhyErrorModelTestCase
(2, 1078, 217, 0.007),
TestCase::QUICK
);
67
// 2 interfering eNBs SINR -4.0 BER 0.037 TB size 217
68
AddTestCase
(
new
LenaDlCtrlPhyErrorModelTestCase
(3, 1040, 217, 0.045),
TestCase::EXTENSIVE
);
69
// 3 interfering eNBs SINR -6.0 BER 0.21 TB size 133
70
AddTestCase
(
new
LenaDlCtrlPhyErrorModelTestCase
(4, 1250, 133, 0.206),
TestCase::EXTENSIVE
);
71
// 4 interfering eNBs SINR -7.0 BER 0.34 TB size 133
72
AddTestCase
(
new
LenaDlCtrlPhyErrorModelTestCase
(5, 1260, 81, 0.343),
TestCase::EXTENSIVE
);
73
74
// Tests on DL/UL Data channels (PDSCH, PUSCH)
75
// MCS 2 TB size of 256 bits BER 0.33 SINR -5.51
76
AddTestCase
(
new
LenaDataPhyErrorModelTestCase
(4, 1800, 32, 0.33, 50),
TestCase::QUICK
);
77
// MCS 2 TB size of 528 bits BER 0.11 SINR -5.51
78
AddTestCase
(
new
LenaDataPhyErrorModelTestCase
(2, 1800, 66, 0.11, 34),
TestCase::EXTENSIVE
);
79
// MCS 2 TB size of 1088 bits BER 0.02 SINR -5.51
80
AddTestCase
(
new
LenaDataPhyErrorModelTestCase
(1, 1800, 136, 0.02, 16),
TestCase::EXTENSIVE
);
81
// MCS 12 TB size of 4800 bits BER 0.3 SINR 4.43
82
AddTestCase
(
new
LenaDataPhyErrorModelTestCase
(1, 600, 600, 0.3, 48),
TestCase::EXTENSIVE
);
83
// MCS 12 TB size of 1632 bits BER 0.55 SINR 4.43
84
AddTestCase
(
new
LenaDataPhyErrorModelTestCase
(3, 600, 204, 0.55, 52),
TestCase::EXTENSIVE
);
85
// MCS 16 TB size of 7272 bits (3648 x 3584) BER 0.14 SINR 8.48
86
// BER 0.14 = 1 - ((1-0.075)*(1-0.075))
87
AddTestCase
(
new
LenaDataPhyErrorModelTestCase
(1, 470, 781, 0.14, 29),
TestCase::EXTENSIVE
);
88
89
90
91
}
92
93
static
LenaTestPhyErrorModelrSuite
lenaTestPhyErrorModelrSuite
;
94
95
std::string
96
LenaDataPhyErrorModelTestCase::BuildNameString
(uint16_t nUser, uint16_t dist)
97
{
98
std::ostringstream oss;
99
oss << nUser <<
" UEs, distance "
<< dist <<
" m"
;
100
return
oss.str ();
101
}
102
103
LenaDataPhyErrorModelTestCase::LenaDataPhyErrorModelTestCase
(uint16_t nUser, uint16_t dist, uint16_t tbSize,
double
berRef, uint16_t bernQuantile)
104
:
TestCase
(BuildNameString (nUser, dist)),
105
m_nUser (nUser),
106
m_dist (dist),
107
m_tbSize (tbSize),
108
m_berRef (berRef),
109
m_bernQuantile (bernQuantile)
110
{
111
}
112
113
LenaDataPhyErrorModelTestCase::~LenaDataPhyErrorModelTestCase
()
114
{
115
}
116
117
void
118
LenaDataPhyErrorModelTestCase::DoRun
(
void
)
119
{
120
121
double
ber = 0.03;
122
Config::SetDefault
(
"ns3::LteAmc::Ber"
,
DoubleValue
(ber));
123
Config::SetDefault
(
"ns3::LteAmc::AmcModel"
,
EnumValue
(
LteAmc::PiroEW2010
));
124
Config::SetDefault
(
"ns3::LteSpectrumPhy::CtrlErrorModelEnabled"
,
BooleanValue
(
false
));
125
Config::SetDefault
(
"ns3::LteSpectrumPhy::DataErrorModelEnabled"
,
BooleanValue
(
true
));
126
Config::SetDefault
(
"ns3::RrFfMacScheduler::HarqEnabled"
,
BooleanValue
(
false
));
127
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
128
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
129
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
130
// LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
131
// LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
132
//
133
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
134
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
135
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
136
137
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
138
// LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
139
// LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
140
//
141
// LogComponentEnable ("LtePropagationLossModel", LOG_LEVEL_ALL);
142
// LogComponentEnable ("LossModel", LOG_LEVEL_ALL);
143
// LogComponentEnable ("ShadowingLossModel", LOG_LEVEL_ALL);
144
// LogComponentEnable ("PenetrationLossModel", LOG_LEVEL_ALL);
145
// LogComponentEnable ("MultipathLossModel", LOG_LEVEL_ALL);
146
// LogComponentEnable ("PathLossModel", LOG_LEVEL_ALL);
147
//
148
// LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
149
// LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
150
// LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
151
152
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
153
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
154
// LogComponentEnable ("RlcStatsCalculator", LOG_LEVEL_ALL);
155
156
157
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
158
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
159
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
160
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
161
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
162
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
163
// LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
164
// LogComponentEnable ("LteMiErrorModel", LOG_LEVEL_ALL);
165
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
166
//
167
// LogComponentDisableAll (LOG_LEVEL_ALL);
168
169
LogComponentEnable
(
"LenaTestPhyErrorModel"
,
LOG_LEVEL_ALL
);
170
171
176
Ptr<LteHelper>
lena = CreateObject<LteHelper> ();
177
178
// Create Nodes: eNodeB and UE
179
NodeContainer
enbNodes;
180
NodeContainer
ueNodes;
181
enbNodes.
Create
(1);
182
ueNodes.
Create
(
m_nUser
);
183
184
// Install Mobility Model
185
MobilityHelper
mobility;
186
mobility.
SetMobilityModel
(
"ns3::BuildingsMobilityModel"
);
187
mobility.
Install
(enbNodes);
188
mobility.
SetMobilityModel
(
"ns3::BuildingsMobilityModel"
);
189
mobility.
Install
(ueNodes);
190
191
// remove random shadowing component
192
lena->
SetAttribute
(
"PathlossModel"
,
StringValue
(
"ns3::HybridBuildingsPropagationLossModel"
));
193
lena->
SetPathlossModelAttribute
(
"ShadowSigmaOutdoor"
,
DoubleValue
(0.0));
194
lena->
SetPathlossModelAttribute
(
"ShadowSigmaIndoor"
,
DoubleValue
(0.0));
195
lena->
SetPathlossModelAttribute
(
"ShadowSigmaExtWalls"
,
DoubleValue
(0.0));
196
197
// Create Devices and install them in the Nodes (eNB and UE)
198
NetDeviceContainer
enbDevs;
199
NetDeviceContainer
ueDevs;
200
lena->
SetSchedulerType
(
"ns3::RrFfMacScheduler"
);
201
lena->
SetSchedulerAttribute
(
"UlCqiFilter"
,
EnumValue
(
FfMacScheduler::PUSCH_UL_CQI
));
202
203
enbDevs = lena->
InstallEnbDevice
(enbNodes);
204
ueDevs = lena->
InstallUeDevice
(ueNodes);
205
206
// Attach a UE to a eNB
207
lena->
Attach
(ueDevs, enbDevs.
Get
(0));
208
209
// Activate an EPS bearer
210
enum
EpsBearer::Qci
q =
EpsBearer::GBR_CONV_VOICE
;
211
EpsBearer
bearer (q);
212
lena->
ActivateDataRadioBearer
(ueDevs, bearer);
213
214
215
Ptr<LteEnbNetDevice>
lteEnbDev = enbDevs.
Get
(0)->
GetObject
<
LteEnbNetDevice
> ();
216
Ptr<LteEnbPhy>
enbPhy = lteEnbDev->
GetPhy
();
217
enbPhy->
SetAttribute
(
"TxPower"
,
DoubleValue
(43.0));
218
enbPhy->SetAttribute (
"NoiseFigure"
,
DoubleValue
(5.0));
219
// place the HeNB over the default rooftop level (20 mt.)
220
Ptr<BuildingsMobilityModel>
mm = enbNodes.Get (0)->
GetObject
<
BuildingsMobilityModel
> ();
221
mm->
SetPosition
(
Vector
(0.0, 0.0, 30.0));
222
223
// Set UEs' position and power
224
for
(
int
i = 0; i <
m_nUser
; i++)
225
{
226
Ptr<BuildingsMobilityModel>
mm = ueNodes.
Get
(i)->
GetObject
<
BuildingsMobilityModel
> ();
227
mm->
SetPosition
(
Vector
(
m_dist
, 0.0, 1.0));
228
Ptr<LteUeNetDevice>
lteUeDev = ueDevs.
Get
(i)->
GetObject
<
LteUeNetDevice
> ();
229
Ptr<LteUePhy>
uePhy = lteUeDev->GetPhy ();
230
uePhy->SetAttribute (
"TxPower"
,
DoubleValue
(23.0));
231
uePhy->SetAttribute (
"NoiseFigure"
,
DoubleValue
(9.0));
232
}
233
234
lena->
EnableRlcTraces
();
235
double
simulationTime = 1.000;
236
237
Simulator::Stop
(
Seconds
(simulationTime));
238
239
Ptr<RadioBearerStatsCalculator>
rlcStats = lena->
GetRlcStats
();
240
rlcStats->
SetAttribute
(
"EpochDuration"
,
TimeValue
(
Seconds
(simulationTime)));
241
242
243
Simulator::Run
();
244
248
NS_LOG_INFO
(
"\tTest downlink/uplink data shared channels (PDSCH and PUSCH)"
);
249
NS_LOG_INFO
(
"Test with "
<< m_nUser <<
" user(s) at distance "
<<
m_dist
<<
" expected BER "
<<
m_berRef
);
250
std::vector <uint64_t> dlDataRxed;
251
for
(
int
i = 0; i <
m_nUser
; i++)
252
{
253
// get the imsi
254
uint64_t imsi = ueDevs.
Get
(i)->
GetObject
<
LteUeNetDevice
> ()->GetImsi ();
255
// get the lcId
256
uint8_t lcId = 1;
257
dlDataRxed.push_back (rlcStats->
GetDlRxData
(imsi, lcId));
258
double
txed = rlcStats->
GetDlTxData
(imsi, lcId);
259
int
n = txed /
m_tbSize
;
260
int
lambda = (double)dlDataRxed.at (i) /
m_tbSize
;
261
double
ber = 1.0 - ((double)dlDataRxed.at (i)/txed);
262
double
np = n-n*
m_berRef
;
263
NS_LOG_INFO
(
"\tUser "
<< i <<
" imsi "
<< imsi <<
" bytes rxed "
<< (
double
)dlDataRxed.at (i) <<
" txed "
<< txed
264
<<
" BER "
<< ber <<
" Err "
<< std::fabs (m_berRef - ber) <<
" lambda "
<< lambda
265
<<
" np "
<< np <<
" difference "
<< std::abs (lambda - np) <<
" quantile "
<<
m_bernQuantile
);
266
NS_UNUSED
(ber);
267
// the quantiles are evaluated offline according to a Bernoulli
268
// ditribution with n equal to the number of packet sent and p equal
269
// to the BER (see /reference/bernuolliDistribution.m for details)
270
NS_TEST_ASSERT_MSG_EQ_TOL
(lambda, np,
m_bernQuantile
,
" Unexpected BER distribution!"
);
271
}
272
273
274
Simulator::Destroy
();
275
}
276
277
278
279
280
std::string
281
LenaDlCtrlPhyErrorModelTestCase::BuildNameString
(uint16_t nEnb, uint16_t dist)
282
{
283
std::ostringstream oss;
284
oss << nEnb <<
" eNBs, distance "
<< dist <<
" m"
;
285
return
oss.str ();
286
}
287
288
289
LenaDlCtrlPhyErrorModelTestCase::LenaDlCtrlPhyErrorModelTestCase
(uint16_t nEnb, uint16_t dist, uint16_t tbSize,
double
berRef)
290
:
TestCase
(BuildNameString (nEnb, dist)),
291
m_nEnb (nEnb),
292
m_dist (dist),
293
m_tbSize (tbSize),
294
m_berRef (berRef)
295
{
296
}
297
298
LenaDlCtrlPhyErrorModelTestCase::~LenaDlCtrlPhyErrorModelTestCase
()
299
{
300
}
301
302
void
303
LenaDlCtrlPhyErrorModelTestCase::DoRun
(
void
)
304
{
305
306
double
ber = 0.03;
307
Config::SetDefault
(
"ns3::LteAmc::Ber"
,
DoubleValue
(ber));
308
Config::SetDefault
(
"ns3::LteAmc::AmcModel"
,
EnumValue
(
LteAmc::PiroEW2010
));
309
Config::SetDefault
(
"ns3::LteSpectrumPhy::CtrlErrorModelEnabled"
,
BooleanValue
(
true
));
310
Config::SetDefault
(
"ns3::LteSpectrumPhy::DataErrorModelEnabled"
,
BooleanValue
(
false
));
311
Config::SetDefault
(
"ns3::RrFfMacScheduler::HarqEnabled"
,
BooleanValue
(
false
));
312
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
313
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
314
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
315
// LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
316
// LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
317
//
318
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
319
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
320
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
321
322
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
323
// LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
324
// LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
325
//
326
// LogComponentEnable ("LtePropagationLossModel", LOG_LEVEL_ALL);
327
// LogComponentEnable ("LossModel", LOG_LEVEL_ALL);
328
// LogComponentEnable ("ShadowingLossModel", LOG_LEVEL_ALL);
329
// LogComponentEnable ("PenetrationLossModel", LOG_LEVEL_ALL);
330
// LogComponentEnable ("MultipathLossModel", LOG_LEVEL_ALL);
331
// LogComponentEnable ("PathLossModel", LOG_LEVEL_ALL);
332
//
333
// LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
334
// LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
335
// LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
336
337
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
338
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
339
// LogComponentEnable ("RlcStatsCalculator", LOG_LEVEL_ALL);
340
341
342
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
343
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
344
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
345
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
346
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
347
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
348
// LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
349
// LogComponentEnable ("LteMiErrorModel", LOG_LEVEL_ALL);
350
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
351
//
352
// LogComponentDisableAll (LOG_LEVEL_ALL);
353
354
LogComponentEnable
(
"LenaTestPhyErrorModel"
,
LOG_LEVEL_ALL
);
355
356
361
Ptr<LteHelper>
lena = CreateObject<LteHelper> ();
362
363
// Create Nodes: eNodeB and UE
364
NodeContainer
enbNodes;
365
NodeContainer
ueNodes;
366
enbNodes.
Create
(
m_nEnb
);
367
ueNodes.
Create
(1);
368
369
// Install Mobility Model
370
MobilityHelper
mobility;
371
mobility.
SetMobilityModel
(
"ns3::BuildingsMobilityModel"
);
372
mobility.
Install
(enbNodes);
373
mobility.
SetMobilityModel
(
"ns3::BuildingsMobilityModel"
);
374
mobility.
Install
(ueNodes);
375
376
// remove random shadowing component
377
lena->
SetAttribute
(
"PathlossModel"
,
StringValue
(
"ns3::HybridBuildingsPropagationLossModel"
));
378
lena->
SetPathlossModelAttribute
(
"ShadowSigmaOutdoor"
,
DoubleValue
(0.0));
379
lena->
SetPathlossModelAttribute
(
"ShadowSigmaIndoor"
,
DoubleValue
(0.0));
380
lena->
SetPathlossModelAttribute
(
"ShadowSigmaExtWalls"
,
DoubleValue
(0.0));
381
382
// Create Devices and install them in the Nodes (eNB and UE)
383
NetDeviceContainer
enbDevs;
384
NetDeviceContainer
ueDevs;
385
lena->
SetSchedulerType
(
"ns3::RrFfMacScheduler"
);
386
lena->
SetSchedulerAttribute
(
"UlCqiFilter"
,
EnumValue
(
FfMacScheduler::PUSCH_UL_CQI
));
387
388
enbDevs = lena->
InstallEnbDevice
(enbNodes);
389
ueDevs = lena->
InstallUeDevice
(ueNodes);
390
391
// Attach a UE to one eNB (the others are interfering ones)
392
lena->
Attach
(ueDevs, enbDevs.
Get
(0));
393
394
// Activate an EPS bearer
395
enum
EpsBearer::Qci
q =
EpsBearer::GBR_CONV_VOICE
;
396
EpsBearer
bearer (q);
397
lena->
ActivateDataRadioBearer
(ueDevs, bearer);
398
399
// Set UEs' position and power
400
for
(
int
i = 0; i <
m_nEnb
; i++)
401
{
402
// place the HeNB over the default rooftop level (20 mt.)
403
Ptr<BuildingsMobilityModel>
mm = enbNodes.Get (i)->
GetObject
<
BuildingsMobilityModel
> ();
404
mm->
SetPosition
(
Vector
(0.0, 0.0, 30.0));
405
Ptr<LteEnbNetDevice>
lteEnbDev = enbDevs.
Get
(i)->
GetObject
<
LteEnbNetDevice
> ();
406
Ptr<LteEnbPhy>
enbPhy = lteEnbDev->
GetPhy
();
407
enbPhy->
SetAttribute
(
"TxPower"
,
DoubleValue
(43.0));
408
enbPhy->SetAttribute (
"NoiseFigure"
,
DoubleValue
(5.0));
409
}
410
411
// Set UEs' position and power
412
Ptr<BuildingsMobilityModel>
mm = ueNodes.
Get
(0)->
GetObject
<
BuildingsMobilityModel
> ();
413
mm->
SetPosition
(
Vector
(
m_dist
, 0.0, 1.0));
414
Ptr<LteUeNetDevice>
lteUeDev = ueDevs.
Get
(0)->
GetObject
<
LteUeNetDevice
> ();
415
Ptr<LteUePhy>
uePhy = lteUeDev->GetPhy ();
416
uePhy->SetAttribute (
"TxPower"
,
DoubleValue
(23.0));
417
uePhy->SetAttribute (
"NoiseFigure"
,
DoubleValue
(9.0));
418
419
420
lena->
EnableRlcTraces
();
421
double
simulationTime = 1.000;
422
423
Simulator::Stop
(
Seconds
(simulationTime));
424
425
Ptr<RadioBearerStatsCalculator>
rlcStats = lena->
GetRlcStats
();
426
rlcStats->
SetAttribute
(
"EpochDuration"
,
TimeValue
(
Seconds
(simulationTime)));
427
428
429
Simulator::Run
();
430
434
NS_LOG_INFO
(
"\tTest downlink control channels (PCFICH+PDCCH)"
);
435
NS_LOG_INFO
(
"Test with "
<< m_nEnb <<
" eNB(s) at distance "
<<
m_dist
<<
" expected BER "
<<
m_berRef
);
436
std::vector <uint64_t> dlDataRxed;
437
int
nUser = 1;
438
for
(
int
i = 0; i < nUser; i++)
439
{
440
// get the imsi
441
uint64_t imsi = ueDevs.
Get
(i)->
GetObject
<
LteUeNetDevice
> ()->GetImsi ();
442
// get the lcId
443
uint8_t lcId = 1;
444
dlDataRxed.push_back (rlcStats->
GetDlRxData
(imsi, lcId));
445
double
txed = rlcStats->
GetDlTxData
(imsi, lcId);
446
double
ber = 1.0 - ((double)dlDataRxed.at (i)/txed);
447
NS_LOG_INFO
(
"\tUser "
<< i <<
" imsi "
<< imsi <<
" bytes rxed "
<< (
double
)dlDataRxed.at (i) <<
" txed "
<< txed
448
<<
" BER "
<< ber <<
" Err "
<< fabs (
m_berRef
- ber));
449
NS_UNUSED
(ber);
450
NS_TEST_ASSERT_MSG_EQ_TOL
(ber,
m_berRef
, 0.1,
" Unexpected BER distribution!"
);
451
}
452
453
454
Simulator::Destroy
();
455
}
456
457
458
}
// namespace
src
lte
test
lte-test-phy-error-model.cc
Generated on Tue May 14 2013 11:08:27 for ns-3 by
1.8.1.2