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-spectrum-phy.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 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: Nicola Baldo <nbaldo@cttc.es>
19
* Giuseppe Piro <g.piro@poliba.it>
20
* Modified by: Marco Miozzo <mmiozzo@cttc.es> (introduce physical error model)
21
*/
22
23
#ifndef LTE_SPECTRUM_PHY_H
24
#define LTE_SPECTRUM_PHY_H
25
26
#include <ns3/event-id.h>
27
#include <ns3/spectrum-value.h>
28
#include <ns3/mobility-model.h>
29
#include <ns3/packet.h>
30
#include <ns3/nstime.h>
31
#include <ns3/net-device.h>
32
#include <ns3/spectrum-phy.h>
33
#include <ns3/spectrum-channel.h>
34
#include <ns3/spectrum-interference.h>
35
#include <ns3/data-rate.h>
36
#include <ns3/generic-phy.h>
37
#include <ns3/packet-burst.h>
38
#include <ns3/lte-interference.h>
39
#include "ns3/random-variable-stream.h"
40
#include <map>
41
#include <ns3/ff-mac-common.h>
42
#include <ns3/lte-harq-phy.h>
43
#include <ns3/lte-common.h>
44
45
namespace
ns3 {
46
47
struct
TbId_t
48
{
49
uint16_t
m_rnti
;
50
uint8_t
m_layer
;
51
52
public
:
53
TbId_t
();
54
TbId_t
(
const
uint16_t a,
const
uint8_t b);
55
56
friend
bool
operator ==
(
const
TbId_t
&a,
const
TbId_t
&b);
57
friend
bool
operator <
(
const
TbId_t
&a,
const
TbId_t
&b);
58
};
59
60
61
struct
tbInfo_t
62
{
63
uint8_t
ndi
;
64
uint16_t
size
;
65
uint8_t
mcs
;
66
std::vector<int>
rbBitmap
;
67
uint8_t
harqProcessId
;
68
uint8_t
rv
;
69
double
mi
;
70
bool
downlink
;
71
bool
corrupt
;
72
bool
harqFeedbackSent
;
73
};
74
75
typedef
std::map<TbId_t, tbInfo_t>
expectedTbs_t
;
76
77
78
class
LteNetDevice
;
79
class
AntennaModel
;
80
class
LteControlMessage
;
81
struct
LteSpectrumSignalParametersDataFrame
;
82
struct
LteSpectrumSignalParametersDlCtrlFrame
;
83
struct
LteSpectrumSignalParametersUlSrsFrame
;
84
85
92
typedef
Callback< void, Ptr<const Packet>
>
LtePhyTxEndCallback
;
93
98
typedef
Callback< void >
LtePhyRxDataEndErrorCallback
;
105
typedef
Callback< void, Ptr<Packet>
>
LtePhyRxDataEndOkCallback
;
106
107
115
typedef
Callback< void, std::list<Ptr<LteControlMessage>
> >
LtePhyRxCtrlEndOkCallback
;
116
122
typedef
Callback< void >
LtePhyRxCtrlEndErrorCallback
;
123
128
typedef
Callback< void, uint16_t, Ptr<SpectrumValue>
>
LtePhyRxPssCallback
;
129
130
135
typedef
Callback< void, DlInfoListElement_s >
LtePhyDlHarqFeedbackCallback
;
136
141
typedef
Callback< void, UlInfoListElement_s >
LtePhyUlHarqFeedbackCallback
;
142
143
144
153
class
LteSpectrumPhy
:
public
SpectrumPhy
154
{
155
156
public
:
157
LteSpectrumPhy
();
158
virtual
~LteSpectrumPhy
();
159
163
enum
State
164
{
165
IDLE
,
TX
,
RX_DATA
,
RX_CTRL
166
};
167
168
// inherited from Object
169
static
TypeId
GetTypeId
(
void
);
170
virtual
void
DoDispose
();
171
172
// inherited from SpectrumPhy
173
void
SetChannel
(
Ptr<SpectrumChannel>
c);
174
void
SetMobility
(
Ptr<MobilityModel>
m);
175
void
SetDevice
(
Ptr<NetDevice>
d);
176
Ptr<MobilityModel>
GetMobility
();
177
Ptr<NetDevice>
GetDevice
();
178
Ptr<const SpectrumModel>
GetRxSpectrumModel
()
const
;
179
Ptr<AntennaModel>
GetRxAntenna
();
180
void
StartRx
(
Ptr<SpectrumSignalParameters>
params);
181
void
StartRxData
(
Ptr<LteSpectrumSignalParametersDataFrame>
params);
182
void
StartRxCtrl
(
Ptr<SpectrumSignalParameters>
params);
183
184
void
SetHarqPhyModule
(
Ptr<LteHarqPhy>
harq);
185
191
void
SetTxPowerSpectralDensity
(
Ptr<SpectrumValue>
txPsd);
192
198
void
SetNoisePowerSpectralDensity
(
Ptr<const SpectrumValue>
noisePsd);
199
204
void
Reset
();
205
211
void
SetAntenna
(
Ptr<AntennaModel>
a);
212
224
bool
StartTxDataFrame
(
Ptr<PacketBurst>
pb,
std::list
<
Ptr<LteControlMessage>
> ctrlMsgList,
Time
duration);
225
236
bool
StartTxDlCtrlFrame
(
std::list
<
Ptr<LteControlMessage>
> ctrlMsgList,
bool
pss);
237
238
248
bool
StartTxUlSrsFrame
();
249
250
257
void
SetLtePhyTxEndCallback
(
LtePhyTxEndCallback
c);
258
265
void
SetLtePhyRxDataEndErrorCallback
(
LtePhyRxDataEndErrorCallback
c);
266
273
void
SetLtePhyRxDataEndOkCallback
(
LtePhyRxDataEndOkCallback
c);
274
281
void
SetLtePhyRxCtrlEndOkCallback
(
LtePhyRxCtrlEndOkCallback
c);
282
289
void
SetLtePhyRxCtrlEndErrorCallback
(
LtePhyRxCtrlEndErrorCallback
c);
290
297
void
SetLtePhyRxPssCallback
(
LtePhyRxPssCallback
c);
298
305
void
SetLtePhyDlHarqFeedbackCallback
(
LtePhyDlHarqFeedbackCallback
c);
306
313
void
SetLtePhyUlHarqFeedbackCallback
(
LtePhyUlHarqFeedbackCallback
c);
314
319
void
SetState
(
State
newState);
320
326
void
SetCellId
(uint16_t cellId);
327
328
335
void
AddRsPowerChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
336
342
void
AddDataSinrChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
343
350
void
AddInterferenceCtrlChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
351
358
void
AddInterferenceDataChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
359
360
366
void
AddCtrlSinrChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
367
380
void
AddExpectedTb
(uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer, uint8_t harqId, uint8_t rv,
bool
downlink);
381
382
388
void
UpdateSinrPerceived
(
const
SpectrumValue
& sinr);
389
395
void
SetTransmissionMode
(uint8_t txMode);
396
397
402
Ptr<SpectrumChannel>
GetChannel
();
403
404
friend
class
LteUePhy
;
405
414
int64_t
AssignStreams
(int64_t stream);
415
416
private
:
417
void
ChangeState
(
State
newState);
418
void
EndTx
();
419
void
EndRxData
();
420
void
EndRxDlCtrl
();
421
void
EndRxUlSrs
();
422
423
void
SetTxModeGain
(uint8_t txMode,
double
gain);
424
425
426
Ptr<MobilityModel>
m_mobility
;
427
Ptr<AntennaModel>
m_antenna
;
428
Ptr<NetDevice>
m_device
;
429
430
Ptr<SpectrumChannel>
m_channel
;
431
432
Ptr<const SpectrumModel>
m_rxSpectrumModel
;
433
Ptr<SpectrumValue>
m_txPsd
;
434
Ptr<PacketBurst>
m_txPacketBurst
;
435
std::list<Ptr<PacketBurst> >
m_rxPacketBurstList
;
436
437
std::list<Ptr<LteControlMessage> >
m_txControlMessageList
;
438
std::list<Ptr<LteControlMessage> >
m_rxControlMessageList
;
439
440
441
State
m_state
;
442
Time
m_firstRxStart
;
443
Time
m_firstRxDuration
;
444
445
TracedCallback<Ptr<const PacketBurst>
>
m_phyTxStartTrace
;
446
TracedCallback<Ptr<const PacketBurst>
>
m_phyTxEndTrace
;
447
TracedCallback<Ptr<const PacketBurst>
>
m_phyRxStartTrace
;
448
TracedCallback<Ptr<const Packet>
>
m_phyRxEndOkTrace
;
449
TracedCallback<Ptr<const Packet>
>
m_phyRxEndErrorTrace
;
450
451
LtePhyTxEndCallback
m_ltePhyTxEndCallback
;
452
LtePhyRxDataEndErrorCallback
m_ltePhyRxDataEndErrorCallback
;
453
LtePhyRxDataEndOkCallback
m_ltePhyRxDataEndOkCallback
;
454
455
LtePhyRxCtrlEndOkCallback
m_ltePhyRxCtrlEndOkCallback
;
456
LtePhyRxCtrlEndErrorCallback
m_ltePhyRxCtrlEndErrorCallback
;
457
LtePhyRxPssCallback
m_ltePhyRxPssCallback
;
458
459
Ptr<LteInterference>
m_interferenceData
;
460
Ptr<LteInterference>
m_interferenceCtrl
;
461
462
uint16_t
m_cellId
;
463
464
expectedTbs_t
m_expectedTbs
;
465
SpectrumValue
m_sinrPerceived
;
466
468
Ptr<UniformRandomVariable>
m_random
;
469
bool
m_dataErrorModelEnabled
;
// when true (default) the phy error model is enabled
470
bool
m_ctrlErrorModelEnabled
;
// when true (default) the phy error model is enabled for DL ctrl frame
471
472
uint8_t
m_transmissionMode
;
// for UEs: store the transmission mode
473
uint8_t
m_layersNum
;
474
std::vector <double>
m_txModeGain
;
// duplicate value of LteUePhy
475
476
Ptr<LteHarqPhy>
m_harqPhyModule
;
477
LtePhyDlHarqFeedbackCallback
m_ltePhyDlHarqFeedbackCallback
;
478
LtePhyUlHarqFeedbackCallback
m_ltePhyUlHarqFeedbackCallback
;
479
480
485
TracedCallback<PhyReceptionStatParameters>
m_dlPhyReception
;
486
487
492
TracedCallback<PhyReceptionStatParameters>
m_ulPhyReception
;
493
494
EventId
m_endTxEvent
;
495
EventId
m_endRxDataEvent
;
496
EventId
m_endRxDlCtrlEvent
;
497
EventId
m_endRxUlSrsEvent
;
498
499
500
};
501
502
503
504
505
506
507
}
508
509
#endif
/* LTE_SPECTRUM_PHY_H */
src
lte
model
lte-spectrum-phy.h
Generated on Fri Aug 30 2013 01:42:55 for ns-3 by
1.8.1.2