A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Giuseppe Piro <g.piro@poliba.it>
18 * Marco Miozzo <mmiozzo@cttc.es>
19 * Nicola Baldo <nbaldo@cttc.es>
20 */
21
22#ifndef LTE_PHY_H
23#define LTE_PHY_H
24
25#include "lte-spectrum-phy.h"
26
27#include <ns3/generic-phy.h>
28#include <ns3/mobility-model.h>
29#include <ns3/nstime.h>
30#include <ns3/packet.h>
31#include <ns3/spectrum-channel.h>
32#include <ns3/spectrum-interference.h>
33#include <ns3/spectrum-phy.h>
34#include <ns3/spectrum-signal-parameters.h>
35#include <ns3/spectrum-value.h>
36
37namespace ns3
38{
39
40class PacketBurst;
41class LteNetDevice;
42class LteControlMessage;
43
44/**
45 * \ingroup lte
46 *
47 * The LtePhy models the physical layer of LTE. It is composed by two
48 * LteSpectrumPhy, one for the downlink and one for the uplink.
49 */
50class LtePhy : public Object
51{
52 public:
53 /**
54 * @warning the default constructor should not be used
55 */
56 LtePhy();
57
58 /**
59 *
60 * \param dlPhy the downlink LteSpectrumPhy instance
61 * \param ulPhy the uplink LteSpectrumPhy instance
62 */
64
65 ~LtePhy() override;
66
67 /**
68 * \brief Get the type ID.
69 * \return the object TypeId
70 */
71 static TypeId GetTypeId();
72
73 /**
74 * \brief Set the device where the phy layer is attached
75 * \param d the device
76 */
78 /**
79 * \brief Get the device where the phy layer is attached
80 * \return the pointer to the device
81 */
83
84 /**
85 *
86 * \return a pointer to the LteSpectrumPhy instance that manages the downlink
87 */
89
90 /**
91 *
92 * \return a pointer to the LteSpectrumPhy instance that manages the uplink
93 */
95
96 /**
97 * \brief Queue the MAC PDU to be sent (according to m_macChTtiDelay)
98 * \param p the MAC PDU to sent
99 */
100 virtual void DoSendMacPdu(Ptr<Packet> p) = 0;
101
102 /**
103 * Set the downlink channel
104 * \param c the downlink channel
105 */
107
108 /**
109 * Set the uplink channel
110 * \param c the uplink channel
111 */
113
114 /**
115 * \brief Compute the TX Power Spectral Density
116 * \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral
117 * Density in W/Hz for each Resource Block
118 */
120
121 void DoDispose() override;
122
123 /**
124 * \param tti transmission time interval
125 */
126 void SetTti(double tti);
127 /**
128 * \returns transmission time interval
129 */
130 double GetTti() const;
131
132 /**
133 *
134 * \param cellId the Cell Identifier
135 */
136 void DoSetCellId(uint16_t cellId);
137
138 /**
139 * \returns the RB group size according to the bandwidth
140 */
141 uint8_t GetRbgSize() const;
142
143 /**
144 * \returns the SRS periodicity (see Table 8.2-1 of 36.213)
145 * \param srcCi the SRS Configuration Index
146 */
147 uint16_t GetSrsPeriodicity(uint16_t srcCi) const;
148
149 /**
150 * \returns the SRS Subframe offset (see Table 8.2-1 of 36.213)
151 * \param srcCi the SRS Configuration Index
152 */
153 uint16_t GetSrsSubframeOffset(uint16_t srcCi) const;
154
155 /**
156 * \param p queue MAC PDU to be sent
157 */
158 void SetMacPdu(Ptr<Packet> p);
159
160 /**
161 * \returns the packet burst to be sent
162 */
164
165 /**
166 * \param m the control message to be sent
167 */
169
170 /**
171 * \returns the list of control messages to be sent
172 */
173 std::list<Ptr<LteControlMessage>> GetControlMessages();
174
175 /**
176 * generate a CQI report based on the given SINR of Ctrl frame
177 *
178 * \param sinr the SINR vs frequency measured by the device
179 */
180 virtual void GenerateCtrlCqiReport(const SpectrumValue& sinr) = 0;
181
182 /**
183 * generate a CQI report based on the given SINR of Data frame
184 * (used for PUSCH CQIs)
185 *
186 * \param sinr the SINR vs frequency measured by the device
187 */
188 virtual void GenerateDataCqiReport(const SpectrumValue& sinr) = 0;
189
190 /**
191 * generate a report based on the linear interference and noise power
192 * perceived during DATA frame
193 * NOTE: used only by eNB
194 *
195 * \param interf the interference + noise power measured by the device
196 */
197 virtual void ReportInterference(const SpectrumValue& interf) = 0;
198
199 /**
200 * generate a report based on the linear RS power perceived during CTRL
201 * frame
202 * NOTE: used only by UE for evaluating RSRP
203 *
204 * \param power the RS power measured by the device
205 */
206 virtual void ReportRsReceivedPower(const SpectrumValue& power) = 0;
207
208 /**
209 * Set the component carrier ID
210 *
211 * \param index the component carrier ID index
212 */
213 void SetComponentCarrierId(uint8_t index);
214
215 /**
216 * Get the component carrier ID
217 *
218 * \returns the component carrier ID index
219 */
220 uint8_t GetComponentCarrierId() const;
221
222 protected:
223 /// Pointer to the NetDevice where this PHY layer is attached.
225
226 /**
227 * The downlink LteSpectrumPhy associated to this LtePhy. Also available as
228 * attribute `DlSpectrumPhy` in the child classes LteEnbPhy and LteUePhy.
229 */
231 /**
232 * The uplink LteSpectrumPhy associated to this LtePhy. Also available as
233 * attribute `UlSpectrumPhy` in the child classes LteEnbPhy and LteUePhy.
234 */
236
237 /**
238 * Transmission power in dBm. Also available as attribute `TxPower` in the
239 * child classes LteEnbPhy and LteUePhy.
240 */
241 double m_txPower;
242 /**
243 * Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the
244 * receiver. Also available as attribute `NoiseFigure` in the child classes
245 * LteEnbPhy and LteUePhy.
246 *
247 * According to [Wikipedia](http://en.wikipedia.org/wiki/Noise_figure), this
248 * is "the difference in decibels (dB) between the noise output of the actual
249 * receiver to the noise output of an ideal receiver with the same overall
250 * gain and bandwidth when the receivers are connected to sources at the
251 * standard noise temperature T0." In this model, we consider T0 = 290K.
252 */
254
255 /// Transmission time interval.
256 double m_tti;
257 /**
258 * The UL bandwidth in number of PRBs.
259 * Specified by the upper layer through CPHY SAP.
260 */
262 /**
263 * The DL bandwidth in number of PRBs.
264 * Specified by the upper layer through CPHY SAP.
265 */
267 /// The RB group size according to the bandwidth.
268 uint8_t m_rbgSize;
269 /**
270 * The downlink carrier frequency.
271 * Specified by the upper layer through CPHY SAP.
272 */
274 /**
275 * The uplink carrier frequency.
276 * Specified by the upper layer through CPHY SAP.
277 */
279
280 /// A queue of packet bursts to be sent.
281 std::vector<Ptr<PacketBurst>> m_packetBurstQueue;
282 /// A queue of control messages to be sent.
283 std::vector<std::list<Ptr<LteControlMessage>>> m_controlMessagesQueue;
284 /**
285 * Delay between MAC and channel layer in terms of TTIs. It is the delay that
286 * occurs between a scheduling decision in the MAC and the actual start of
287 * the transmission by the PHY. This is intended to be used to model the
288 * latency of real PHY and MAC implementations.
289 *
290 * In LteEnbPhy, it is 2 TTIs by default and can be configured through the
291 * `MacToChannelDelay` attribute. In LteUePhy, it is 4 TTIs.
292 */
294
295 /**
296 * Cell identifier. In LteEnbPhy, this corresponds to the ID of the cell
297 * which hosts this PHY layer. In LteUePhy, this corresponds to the ID of the
298 * eNodeB which this PHY layer is synchronized with.
299 */
300 uint16_t m_cellId;
301
302 /// component carrier Id used to address sap
304
305}; // end of `class LtePhy`
306
307} // namespace ns3
308
309#endif /* LTE_PHY_H */
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:51
virtual void ReportInterference(const SpectrumValue &interf)=0
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
void DoSetCellId(uint16_t cellId)
Definition: lte-phy.cc:240
double m_txPower
Transmission power in dBm.
Definition: lte-phy.h:241
static TypeId GetTypeId()
Get the type ID.
Definition: lte-phy.cc:64
uint8_t GetRbgSize() const
Definition: lte-phy.cc:180
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()=0
Compute the TX Power Spectral Density.
uint8_t GetComponentCarrierId() const
Get the component carrier ID.
Definition: lte-phy.cc:256
void DoDispose() override
Destructor implementation.
Definition: lte-phy.cc:76
uint16_t GetSrsPeriodicity(uint16_t srcCi) const
Definition: lte-phy.cc:144
std::vector< Ptr< PacketBurst > > m_packetBurstQueue
A queue of packet bursts to be sent.
Definition: lte-phy.h:281
uint16_t m_ulBandwidth
The UL bandwidth in number of PRBs.
Definition: lte-phy.h:261
Ptr< PacketBurst > GetPacketBurst()
Definition: lte-phy.cc:192
Ptr< LteNetDevice > GetDevice() const
Get the device where the phy layer is attached.
Definition: lte-phy.cc:97
void SetDownlinkChannel(Ptr< SpectrumChannel > c)
Set the downlink channel.
Definition: lte-phy.cc:116
void SetUplinkChannel(Ptr< SpectrumChannel > c)
Set the uplink channel.
Definition: lte-phy.cc:123
virtual void ReportRsReceivedPower(const SpectrumValue &power)=0
generate a report based on the linear RS power perceived during CTRL frame NOTE: used only by UE for ...
uint8_t m_componentCarrierId
component carrier Id used to address sap
Definition: lte-phy.h:303
double m_noiseFigure
Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
Definition: lte-phy.h:253
void SetComponentCarrierId(uint8_t index)
Set the component carrier ID.
Definition: lte-phy.cc:248
Ptr< LteSpectrumPhy > GetDownlinkSpectrumPhy()
Definition: lte-phy.cc:104
uint32_t m_ulEarfcn
The uplink carrier frequency.
Definition: lte-phy.h:278
uint16_t m_dlBandwidth
The DL bandwidth in number of PRBs.
Definition: lte-phy.h:266
Ptr< LteSpectrumPhy > m_downlinkSpectrumPhy
The downlink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:230
Ptr< LteSpectrumPhy > GetUplinkSpectrumPhy()
Definition: lte-phy.cc:110
void SetMacPdu(Ptr< Packet > p)
Definition: lte-phy.cc:186
std::list< Ptr< LteControlMessage > > GetControlMessages()
Definition: lte-phy.cc:218
uint16_t GetSrsSubframeOffset(uint16_t srcCi) const
Definition: lte-phy.cc:162
void SetDevice(Ptr< LteNetDevice > d)
Set the device where the phy layer is attached.
Definition: lte-phy.cc:90
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)=0
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs)
Ptr< LteNetDevice > m_netDevice
Pointer to the NetDevice where this PHY layer is attached.
Definition: lte-phy.h:224
uint16_t m_cellId
Cell identifier.
Definition: lte-phy.h:300
void SetControlMessages(Ptr< LteControlMessage > m)
Definition: lte-phy.cc:210
double m_tti
Transmission time interval.
Definition: lte-phy.h:256
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)=0
generate a CQI report based on the given SINR of Ctrl frame
uint32_t m_dlEarfcn
The downlink carrier frequency.
Definition: lte-phy.h:273
virtual void DoSendMacPdu(Ptr< Packet > p)=0
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Ptr< LteSpectrumPhy > m_uplinkSpectrumPhy
The uplink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:235
double GetTti() const
Definition: lte-phy.cc:137
std::vector< std::list< Ptr< LteControlMessage > > > m_controlMessagesQueue
A queue of control messages to be sent.
Definition: lte-phy.h:283
uint8_t m_rbgSize
The RB group size according to the bandwidth.
Definition: lte-phy.h:268
~LtePhy() override
Definition: lte-phy.cc:70
void SetTti(double tti)
Definition: lte-phy.cc:130
uint8_t m_macChTtiDelay
Delay between MAC and channel layer in terms of TTIs.
Definition: lte-phy.h:293
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Set of values corresponding to a given SpectrumModel.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.