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
42
namespace
ns3 {
43
44
struct
TbId_t
45
{
46
uint16_t
m_rnti
;
47
uint8_t
m_layer
;
48
49
public
:
50
TbId_t
();
51
TbId_t
(
const
uint16_t a,
const
uint8_t b);
52
53
friend
bool
operator ==
(
const
TbId_t
&a,
const
TbId_t
&b);
54
friend
bool
operator <
(
const
TbId_t
&a,
const
TbId_t
&b);
55
};
56
57
58
struct
tbInfo_t
59
{
60
uint16_t
size
;
61
uint8_t
mcs
;
62
std::vector<int>
rbBitmap
;
63
bool
corrupt
;
64
};
65
66
typedef
std::map<TbId_t, tbInfo_t>
expectedTbs_t
;
67
68
class
LteNetDevice
;
69
class
AntennaModel
;
70
79
class
LteSpectrumPhy
:
public
SpectrumPhy
80
{
81
82
public
:
83
LteSpectrumPhy
();
84
virtual
~LteSpectrumPhy
();
85
89
enum
State
90
{
91
IDLE
,
TX
,
RX
92
};
93
94
// inherited from Object
95
static
TypeId
GetTypeId
(
void
);
96
virtual
void
DoDispose
();
97
98
// inherited from SpectrumPhy
99
void
SetChannel
(
Ptr<SpectrumChannel>
c);
100
void
SetMobility
(
Ptr<MobilityModel>
m);
101
void
SetDevice
(
Ptr<NetDevice>
d);
102
Ptr<MobilityModel>
GetMobility
();
103
Ptr<NetDevice>
GetDevice
();
104
Ptr<const SpectrumModel>
GetRxSpectrumModel
()
const
;
105
Ptr<AntennaModel>
GetRxAntenna
();
106
void
StartRx
(
Ptr<SpectrumSignalParameters>
params);
107
113
void
SetTxPowerSpectralDensity
(
Ptr<SpectrumValue>
txPsd);
114
120
void
SetNoisePowerSpectralDensity
(
Ptr<const SpectrumValue>
noisePsd);
121
127
void
SetAntenna
(
Ptr<AntennaModel>
a);
128
138
bool
StartTx
(
Ptr<PacketBurst>
pb);
139
140
147
void
SetGenericPhyTxEndCallback
(
GenericPhyTxEndCallback
c);
148
155
void
SetGenericPhyRxEndErrorCallback
(
GenericPhyRxEndErrorCallback
c);
156
163
void
SetGenericPhyRxEndOkCallback
(
GenericPhyRxEndOkCallback
c);
164
169
void
SetState
(
State
newState);
170
176
void
SetCellId
(uint16_t cellId);
177
178
184
void
AddSinrChunkProcessor
(
Ptr<LteSinrChunkProcessor>
p);
185
195
void
AddExpectedTb
(uint16_t rnti, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer);
196
202
void
UpdateSinrPerceived
(
const
SpectrumValue
& sinr);
203
209
void
SetTransmissionMode
(uint8_t txMode);
210
211
friend
class
LteUePhy
;
212
221
int64_t
AssignStreams
(int64_t stream);
222
223
private
:
224
void
ChangeState
(
State
newState);
225
void
EndTx
();
226
void
EndRx
();
227
228
void
SetTxModeGain
(uint8_t txMode,
double
gain);
229
230
231
Ptr<MobilityModel>
m_mobility
;
232
Ptr<AntennaModel>
m_antenna
;
233
Ptr<NetDevice>
m_device
;
234
235
Ptr<SpectrumChannel>
m_channel
;
236
237
Ptr<const SpectrumModel>
m_rxSpectrumModel
;
238
Ptr<SpectrumValue>
m_txPsd
;
239
Ptr<PacketBurst>
m_txPacketBurst
;
240
std::list<Ptr<PacketBurst> >
m_rxPacketBurstList
;
241
242
State
m_state
;
243
Time
m_firstRxStart
;
244
Time
m_firstRxDuration
;
245
246
TracedCallback<Ptr<const PacketBurst>
>
m_phyTxStartTrace
;
247
TracedCallback<Ptr<const PacketBurst>
>
m_phyTxEndTrace
;
248
TracedCallback<Ptr<const PacketBurst>
>
m_phyRxStartTrace
;
249
TracedCallback<Ptr<const Packet>
>
m_phyRxEndOkTrace
;
250
TracedCallback<Ptr<const Packet>
>
m_phyRxEndErrorTrace
;
251
252
GenericPhyTxEndCallback
m_genericPhyTxEndCallback
;
253
GenericPhyRxEndErrorCallback
m_genericPhyRxEndErrorCallback
;
254
GenericPhyRxEndOkCallback
m_genericPhyRxEndOkCallback
;
255
256
Ptr<LteInterference>
m_interference
;
257
258
uint16_t
m_cellId
;
259
260
expectedTbs_t
m_expectedTbs
;
261
SpectrumValue
m_sinrPerceived
;
262
264
Ptr<UniformRandomVariable>
m_random
;
265
bool
m_pemEnabled
;
// when true (default) the phy error model is enabled
266
267
uint8_t
m_transmissionMode
;
// for UEs: store the transmission mode
268
std::vector <double>
m_txModeGain
;
// duplicate value of LteUePhy
269
270
};
271
272
273
274
275
276
277
}
278
279
#endif
/* LTE_SPECTRUM_PHY_H */
src
lte
model
lte-spectrum-phy.h
Generated on Tue Nov 13 2012 10:32:17 for ns-3 by
1.8.1.2