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
43
namespace
ns3 {
44
45
struct
TbId_t
46
{
47
uint16_t
m_rnti
;
48
uint8_t
m_layer
;
49
50
public
:
51
TbId_t
();
52
TbId_t
(
const
uint16_t a,
const
uint8_t b);
53
54
friend
bool
operator ==
(
const
TbId_t
&a,
const
TbId_t
&b);
55
friend
bool
operator <
(
const
TbId_t
&a,
const
TbId_t
&b);
56
};
57
58
59
struct
tbInfo_t
60
{
61
uint16_t
size
;
62
uint8_t
mcs
;
63
std::vector<int>
rbBitmap
;
64
bool
corrupt
;
65
};
66
67
typedef
std::map<TbId_t, tbInfo_t>
expectedTbs_t
;
68
69
70
class
LteNetDevice
;
71
class
AntennaModel
;
72
class
LteControlMessage
;
73
struct
LteSpectrumSignalParametersDataFrame
;
74
struct
LteSpectrumSignalParametersDlCtrlFrame
;
75
struct
LteSpectrumSignalParametersUlSrsFrame
;
76
77
84
typedef
Callback< void, Ptr<const Packet>
>
LtePhyTxEndCallback
;
85
90
typedef
Callback< void >
LtePhyRxDataEndErrorCallback
;
97
typedef
Callback< void, Ptr<Packet>
>
LtePhyRxDataEndOkCallback
;
98
99
107
typedef
Callback< void, std::list<Ptr<LteControlMessage>
> >
LtePhyRxCtrlEndOkCallback
;
108
114
typedef
Callback< void >
LtePhyRxCtrlEndErrorCallback
;
115
116
117
126
class
LteSpectrumPhy
:
public
SpectrumPhy
127
{
128
129
public
:
130
LteSpectrumPhy
();
131
virtual
~LteSpectrumPhy
();
132
136
enum
State
137
{
138
IDLE
,
TX
,
RX_DATA
,
RX_CTRL
139
};
140
141
// inherited from Object
142
static
TypeId
GetTypeId
(
void
);
143
virtual
void
DoDispose
();
144
145
// inherited from SpectrumPhy
146
void
SetChannel
(
Ptr<SpectrumChannel>
c);
147
void
SetMobility
(
Ptr<MobilityModel>
m);
148
void
SetDevice
(
Ptr<NetDevice>
d);
149
Ptr<MobilityModel>
GetMobility
();
150
Ptr<NetDevice>
GetDevice
();
151
Ptr<const SpectrumModel>
GetRxSpectrumModel
()
const
;
152
Ptr<AntennaModel>
GetRxAntenna
();
153
void
StartRx
(
Ptr<SpectrumSignalParameters>
params);
154
void
StartRxData
(
Ptr<LteSpectrumSignalParametersDataFrame>
params);
155
void
StartRxCtrl
(
Ptr<SpectrumSignalParameters>
params);
156
162
void
SetTxPowerSpectralDensity
(
Ptr<SpectrumValue>
txPsd);
163
169
void
SetNoisePowerSpectralDensity
(
Ptr<const SpectrumValue>
noisePsd);
170
176
void
SetAntenna
(
Ptr<AntennaModel>
a);
177
189
bool
StartTxDataFrame
(
Ptr<PacketBurst>
pb,
std::list
<
Ptr<LteControlMessage>
> ctrlMsgList,
Time
duration);
190
201
bool
StartTxDlCtrlFrame
(
std::list
<
Ptr<LteControlMessage>
> ctrlMsgList);
202
203
213
bool
StartTxUlSrsFrame
();
214
215
222
void
SetLtePhyTxEndCallback
(
LtePhyTxEndCallback
c);
223
230
void
SetLtePhyRxDataEndErrorCallback
(
LtePhyRxDataEndErrorCallback
c);
231
238
void
SetLtePhyRxDataEndOkCallback
(
LtePhyRxDataEndOkCallback
c);
239
246
void
SetLtePhyRxCtrlEndOkCallback
(
LtePhyRxCtrlEndOkCallback
c);
247
254
void
SetLtePhyRxCtrlEndErrorCallback
(
LtePhyRxCtrlEndErrorCallback
c);
255
260
void
SetState
(
State
newState);
261
267
void
SetCellId
(uint16_t cellId);
268
269
275
void
AddDataSinrChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
276
277
283
void
AddCtrlSinrChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
284
294
void
AddExpectedTb
(uint16_t rnti, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer);
295
301
void
UpdateSinrPerceived
(
const
SpectrumValue
& sinr);
302
308
void
SetTransmissionMode
(uint8_t txMode);
309
310
friend
class
LteUePhy
;
311
320
int64_t
AssignStreams
(int64_t stream);
321
322
private
:
323
void
ChangeState
(
State
newState);
324
void
EndTx
();
325
void
EndRxData
();
326
void
EndRxDlCtrl
();
327
void
EndRxUlSrs
();
328
329
void
SetTxModeGain
(uint8_t txMode,
double
gain);
330
331
332
Ptr<MobilityModel>
m_mobility
;
333
Ptr<AntennaModel>
m_antenna
;
334
Ptr<NetDevice>
m_device
;
335
336
Ptr<SpectrumChannel>
m_channel
;
337
338
Ptr<const SpectrumModel>
m_rxSpectrumModel
;
339
Ptr<SpectrumValue>
m_txPsd
;
340
Ptr<PacketBurst>
m_txPacketBurst
;
341
std::list<Ptr<PacketBurst> >
m_rxPacketBurstList
;
342
343
std::list<Ptr<LteControlMessage> >
m_txControlMessageList
;
344
std::list<Ptr<LteControlMessage> >
m_rxControlMessageList
;
345
346
347
State
m_state
;
348
Time
m_firstRxStart
;
349
Time
m_firstRxDuration
;
350
351
TracedCallback<Ptr<const PacketBurst>
>
m_phyTxStartTrace
;
352
TracedCallback<Ptr<const PacketBurst>
>
m_phyTxEndTrace
;
353
TracedCallback<Ptr<const PacketBurst>
>
m_phyRxStartTrace
;
354
TracedCallback<Ptr<const Packet>
>
m_phyRxEndOkTrace
;
355
TracedCallback<Ptr<const Packet>
>
m_phyRxEndErrorTrace
;
356
357
LtePhyTxEndCallback
m_ltePhyTxEndCallback
;
358
LtePhyRxDataEndErrorCallback
m_ltePhyRxDataEndErrorCallback
;
359
LtePhyRxDataEndOkCallback
m_ltePhyRxDataEndOkCallback
;
360
361
LtePhyRxCtrlEndOkCallback
m_ltePhyRxCtrlEndOkCallback
;
362
LtePhyRxCtrlEndErrorCallback
m_ltePhyRxCtrlEndErrorCallback
;
363
364
Ptr<LteInterference>
m_interferenceData
;
365
Ptr<LteInterference>
m_interferenceCtrl
;
366
367
uint16_t
m_cellId
;
368
369
expectedTbs_t
m_expectedTbs
;
370
SpectrumValue
m_sinrPerceived
;
371
373
Ptr<UniformRandomVariable>
m_random
;
374
bool
m_dataErrorModelEnabled
;
// when true (default) the phy error model is enabled
375
bool
m_ctrlErrorModelEnabled
;
// when true (default) the phy error model is enabled for DL ctrl frame
376
377
uint8_t
m_transmissionMode
;
// for UEs: store the transmission mode
378
std::vector <double>
m_txModeGain
;
// duplicate value of LteUePhy
379
380
};
381
382
383
384
385
386
387
}
388
389
#endif
/* LTE_SPECTRUM_PHY_H */
src
lte
model
lte-spectrum-phy.h
Generated on Fri Dec 21 2012 19:00:40 for ns-3 by
1.8.1.2