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