A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-enb-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 * Author: Marco Miozzo <marco.miozzo@cttc.es>
8 */
9
10#ifndef ENB_LTE_PHY_H
11#define ENB_LTE_PHY_H
12
14#include "lte-enb-cphy-sap.h"
15#include "lte-enb-phy-sap.h"
16#include "lte-harq-phy.h"
17#include "lte-phy.h"
18
19#include <map>
20#include <set>
21
22namespace ns3
23{
24
25class PacketBurst;
26class LteNetDevice;
27class LteUePhy;
28
29/**
30 * \ingroup lte
31 * LteEnbPhy models the physical layer for the eNodeB
32 */
33class LteEnbPhy : public LtePhy
34{
35 /// allow EnbMemberLteEnbPhySapProvider class friend access
37 /// allow MemberLteEnbCphySapProvider<LteEnbPhy> class friend access
39
40 public:
41 /**
42 * @warning the default constructor should not be used
43 */
44 LteEnbPhy();
45
46 /**
47 *
48 * \param dlPhy the downlink LteSpectrumPhy instance
49 * \param ulPhy the uplink LteSpectrumPhy instance
50 */
52
53 ~LteEnbPhy() override;
54
55 /**
56 * \brief Get the type ID.
57 * \return the object TypeId
58 */
59 static TypeId GetTypeId();
60 // inherited from Object
61 void DoInitialize() override;
62 void DoDispose() override;
63
64 /**
65 * \brief Get the PHY SAP provider
66 * \return a pointer to the SAP Provider of the PHY
67 */
69
70 /**
71 * \brief Set the PHY SAP User
72 * \param s a pointer to the PHY SAP user
73 */
75
76 /**
77 * \brief Get the CPHY SAP provider
78 * \return a pointer to the SAP Provider
79 */
81
82 /**
83 * \brief Set the CPHY SAP User
84 * \param s a pointer to the SAP user
85 */
87
88 /**
89 * \param pow the transmission power in dBm
90 */
91 void SetTxPower(double pow);
92
93 /**
94 * \return the transmission power in dBm
95 */
96 double GetTxPower() const;
97
98 /**
99 * \return the transmission power in dBm
100 */
102
103 /**
104 * \param pow the noise figure in dB
105 */
106 void SetNoiseFigure(double pow);
107
108 /**
109 * \return the noise figure in dB
110 */
111 double GetNoiseFigure() const;
112
113 /**
114 * \param delay the TTI delay between MAC and channel
115 */
116 void SetMacChDelay(uint8_t delay);
117
118 /**
119 * \returns the TTI delay between MAC and channel
120 */
121 uint8_t GetMacChDelay() const;
122
123 /**
124 * \return a pointer to the LteSpectrumPhy instance relative to the downlink
125 */
127
128 /**
129 * \return a pointer to the LteSpectrumPhy instance relative to the uplink
130 */
132
133 /**
134 * \brief set the resource blocks (a.k.a. sub channels) to be used in the downlink for
135 * transmission
136 *
137 * \param mask a vector of integers, if the i-th value is j it means
138 * that the j-th resource block is used for transmission in the
139 * downlink. If there is no i such that the value of the i-th
140 * element is j, it means that RB j is not used.
141 */
142 void SetDownlinkSubChannels(std::vector<int> mask);
143
144 /**
145 * \brief set the resource blocks (a.k.a. sub channels) and its power
146 * to be used in the downlink for transmission
147 *
148 * \param mask a vector of integers, if the i-th value is j it means
149 * that the j-th resource block is used for transmission in the
150 * downlink. If there is no i such that the value of the i-th
151 * element is j, it means that RB j is not used.
152 */
153 void SetDownlinkSubChannelsWithPowerAllocation(std::vector<int> mask);
154 /**
155 *
156 * \return a vector of integers, if the i-th value is j it means
157 * that the j-th resource block is used for transmission in the
158 * downlink. If there is no i such that the value of the i-th
159 * element is j, it means that RB j is not used.
160 */
161 std::vector<int> GetDownlinkSubChannels();
162
163 /**
164 * \brief Generate power allocation map (i.e. tx power level for each RB)
165 *
166 * \param rnti indicates which UE will occupy this RB
167 * \param rbId indicates which RB UE is using,
168 * power level for this RB is power level of UE
169 */
170 void GeneratePowerAllocationMap(uint16_t rnti, int rbId);
171
172 /**
173 * \brief Create the PSD for TX
174 * \returns the PSD
175 */
177
178 /**
179 * \brief Create the PSD for TX with power allocation for each RB
180 * \return the PSD
181 */
183
184 /**
185 * \brief Calculate the channel quality for a given UE
186 * \param sinr a list of computed SINR
187 * \param ue the UE
188 */
189 void CalcChannelQualityForUe(std::vector<double> sinr, Ptr<LteSpectrumPhy> ue);
190
191 /**
192 * \brief Receive the control message
193 * \param msg the received message
194 */
196
197 /**
198 * \brief Create the UL CQI feedback from SINR values perceived at
199 * the physical layer with the PUSCH signal received from eNB
200 * \param sinr SINR values vector
201 * \return UL CQI feedback in the format usable by an FF MAC scheduler
202 */
204 const SpectrumValue& sinr);
205
206 /**
207 * \brief Create the UL CQI feedback from SINR values perceived at
208 * the physical layer with the SRS signal received from eNB
209 * \param sinr SINR values vector
210 * \return UL CQI feedback in the format usable by an FF MAC scheduler
211 */
213 const SpectrumValue& sinr);
214
215 /**
216 * \brief Send the PDCCH and PCFICH in the first 3 symbols
217 * \param ctrlMsgList the list of control messages of PDCCH
218 */
219 void SendControlChannels(std::list<Ptr<LteControlMessage>> ctrlMsgList);
220
221 /**
222 * \brief Send the PDSCH
223 * \param pb the PacketBurst to be sent
224 */
226
227 /**
228 * \param m the UL-CQI to be queued
229 */
231
232 /**
233 * \returns the list of UL-CQI to be processed
234 */
235 std::list<UlDciLteControlMessage> DequeueUlDci();
236
237 /**
238 * \brief Start a LTE frame
239 */
240 void StartFrame();
241 /**
242 * \brief Start a LTE sub frame
243 */
244 void StartSubFrame();
245 /**
246 * \brief End a LTE sub frame
247 */
248 void EndSubFrame();
249 /**
250 * \brief End a LTE frame
251 */
252 void EndFrame();
253
254 /**
255 * \brief PhySpectrum received a new PHY-PDU
256 * \param p the packet received
257 */
259
260 /**
261 * \brief PhySpectrum received a new list of LteControlMessage
262 * \param msgList List of control messages
263 */
264 virtual void ReceiveLteControlMessageList(std::list<Ptr<LteControlMessage>> msgList);
265
266 // inherited from LtePhy
267 void GenerateCtrlCqiReport(const SpectrumValue& sinr) override;
268 void GenerateDataCqiReport(const SpectrumValue& sinr) override;
269 void ReportInterference(const SpectrumValue& interf) override;
270 void ReportRsReceivedPower(const SpectrumValue& power) override;
271
272 /**
273 * \brief Report the uplink HARQ feedback generated by LteSpectrumPhy to MAC
274 *
275 * \param mes UlInfoListElement_s
276 */
278
279 /**
280 * \brief Set the HARQ Phy module
281 *
282 * \param harq the HARQ Phy
283 */
285
286 /**
287 * TracedCallback signature for the linear average of SRS SINRs.
288 *
289 * \param [in] cellId
290 * \param [in] rnti
291 * \param [in] sinrLinear
292 */
293 typedef void (*ReportUeSinrTracedCallback)(uint16_t cellId,
294 uint16_t rnti,
295 double sinrLinear,
296 uint8_t componentCarrierId);
297
298 /**
299 * TracedCallback signature for the linear average of SRS SINRs.
300 *
301 * \param [in] cellId
302 * \param [in] spectrumValue
303 * \deprecated The non-const \c Ptr<SpectrumValue> argument is deprecated
304 * and will be changed to \c Ptr<const SpectrumValue> in a future release.
305 */
306 // NS_DEPRECATED() - tag for future removal
307 typedef void (*ReportInterferenceTracedCallback)(uint16_t cellId,
308 Ptr<SpectrumValue> spectrumValue);
309
310 private:
311 // LteEnbCphySapProvider forwarded methods
312 /**
313 * Set bandwidth function
314 *
315 * \param ulBandwidth UL bandwidth
316 * \param dlBandwidth DL bandwidth
317 */
318 void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth);
319 /**
320 * Set EARFCN
321 *
322 * \param dlEarfcn DL EARFCN
323 * \param ulEarfcn UL EARFCN
324 */
325 void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn);
326 /**
327 * Add UE
328 *
329 * \param rnti RNTI
330 */
331 void DoAddUe(uint16_t rnti);
332 /**
333 * Remove UE
334 *
335 * \param rnti RNTI
336 */
337 void DoRemoveUe(uint16_t rnti);
338 /**
339 * Set PA
340 *
341 * \param rnti RNTI
342 * \param pa PA
343 */
344 void DoSetPa(uint16_t rnti, double pa);
345 /**
346 * Set transmission mode
347 *
348 * \param rnti RNTI
349 * \param txMode transmit mode
350 */
351 void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode);
352 /**
353 * Set source configuration index
354 *
355 * \param rnti RNTI
356 * \param srcCi source configuration index
357 */
358 void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi);
359 /**
360 * Set master information block
361 *
362 * \param mib LteRrcSap::MasterInformationBlock
363 */
365 /**
366 * Set system information block
367 *
368 * \param sib1 LteRrcSap::SystemInformationBlockType1
369 */
371
372 // LteEnbPhySapProvider forwarded methods
373 void DoSendMacPdu(Ptr<Packet> p) override;
374 /**
375 * Send LTE Control Message function
376 *
377 * \param msg LTE control message
378 */
380 /**
381 * Get MAC ch TTI delay function
382 *
383 * \returns delay value
384 */
385 uint8_t DoGetMacChTtiDelay();
386
387 /**
388 * Add the given RNTI to the list of attached UE #m_ueAttached.
389 * \param rnti RNTI of a UE
390 * \return true if the RNTI has _not_ existed before, or false otherwise.
391 */
392 bool AddUePhy(uint16_t rnti);
393 /**
394 * Remove the given RNTI from the list of attached UE #m_ueAttached.
395 * \param rnti RNTI of a UE
396 * \return true if the RNTI has existed before, or false otherwise.
397 */
398 bool DeleteUePhy(uint16_t rnti);
399
400 /**
401 * Create SRS report function
402 *
403 * \param rnti the RNTI
404 * \param srs the SRS
405 */
406 void CreateSrsReport(uint16_t rnti, double srs);
407
408 /**
409 * List of RNTI of attached UEs. Used for quickly determining whether a UE is
410 * attached to this eNodeB or not.
411 */
412 std::set<uint16_t> m_ueAttached;
413
414 /// P_A per UE RNTI.
415 std::map<uint16_t, double> m_paMap;
416
417 /// DL power allocation map.
418 std::map<int, double> m_dlPowerAllocationMap;
419
420 /**
421 * A vector of integers, if the i-th value is j it means that the j-th
422 * resource block is used for transmission in the downlink. If there is
423 * no i such that the value of the i-th element is j, it means that RB j
424 * is not used.
425 */
427
428 std::vector<int> m_dlDataRbMap; ///< DL data RB map
429
430 /// For storing info on future receptions.
431 std::vector<std::list<UlDciLteControlMessage>> m_ulDciQueue;
432
433 LteEnbPhySapProvider* m_enbPhySapProvider; ///< ENB Phy SAP provider
434 LteEnbPhySapUser* m_enbPhySapUser; ///< ENB Phy SAP user
435
436 LteEnbCphySapProvider* m_enbCphySapProvider; ///< ENB CPhy SAP provider
437 LteEnbCphySapUser* m_enbCphySapUser; ///< ENB CPhy SAP user
438
439 /**
440 * The frame number currently served. In ns-3, frame number starts from 1.
441 * In contrast, the 3GPP standard's frame number starts from 0.
442 */
444 /**
445 * The subframe number currently served. In ns-3, subframe number starts
446 * from 1. In contrast, the 3GPP standard's subframe number starts from 0.
447 * The number resets to the beginning again after 10 subframes.
448 */
450
451 uint16_t m_srsPeriodicity; ///< SRS periodicity
452 Time m_srsStartTime; ///< SRS start time
453 std::map<uint16_t, uint16_t> m_srsCounter; ///< SRS counter
454 std::vector<uint16_t> m_srsUeOffset; ///< SRS UE offset
455 uint16_t m_currentSrsOffset; ///< current SRS offset
456
457 /**
458 * The Master Information Block message to be broadcasted every frame.
459 * The message content is specified by the upper layer through the RRC SAP.
460 */
462 /**
463 * The System Information Block Type 1 message to be broadcasted. SIB1 is
464 * broadcasted every 6th subframe of every odd-numbered radio frame.
465 * The message content is specified by the upper layer through the RRC SAP.
466 */
468
469 Ptr<LteHarqPhy> m_harqPhyModule; ///< HARQ Phy module
470
471 /**
472 * The `ReportUeSinr` trace source. Reporting the linear average of SRS SINR.
473 * Exporting cell ID, RNTI, SINR in linear unit and ComponentCarrierId
474 */
476 /**
477 * The `UeSinrSamplePeriod` trace source. The sampling period for reporting
478 * UEs' SINR stats.
479 */
481 std::map<uint16_t, uint16_t> m_srsSampleCounterMap; ///< SRS sample counter map
482
483 /**
484 * The `ReportInterference` trace source. Reporting the interference per PHY
485 * RB (TS 36.214 section 5.2.2, measured on DATA). Exporting cell ID and
486 * interference linear power per RB basis.
487 * \deprecated The non-const \c Ptr<SpectrumValue> argument is deprecated
488 * and will be changed to \c Ptr<const SpectrumValue> in a future release.
489 */
490 // NS_DEPRECATED() - tag for future removal
492 /**
493 * The `InterferenceSamplePeriod` attribute. The sampling period for
494 * reporting interference stats.
495 * \todo In what unit is this?
496 */
498 uint16_t m_interferenceSampleCounter; ///< interference sample counter
499
500 /**
501 * The `DlPhyTransmission` trace source. Contains trace information regarding
502 * PHY stats from DL Tx perspective. Exporting a structure with type
503 * PhyTransmissionStatParameters.
504 */
506
507}; // end of `class LteEnbPhy`
508
509} // namespace ns3
510
511#endif /* LTE_ENB_PHY_H */
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
LteEnbPhy models the physical layer for the eNodeB.
Definition lte-enb-phy.h:34
uint16_t m_srsPeriodicity
SRS periodicity.
double GetTxPower() const
Time m_srsStartTime
SRS start time.
int8_t DoGetReferenceSignalPower() const
void StartSubFrame()
Start a LTE sub frame.
void CreateSrsReport(uint16_t rnti, double srs)
Create SRS report function.
uint16_t m_interferenceSamplePeriod
The InterferenceSamplePeriod attribute.
virtual void ReportUlHarqFeedback(UlInfoListElement_s mes)
Report the uplink HARQ feedback generated by LteSpectrumPhy to MAC.
std::list< UlDciLteControlMessage > DequeueUlDci()
uint16_t m_srsSamplePeriod
The UeSinrSamplePeriod trace source.
void SetLteEnbCphySapUser(LteEnbCphySapUser *s)
Set the CPHY SAP User.
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreatePuschCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the PUSCH signal rec...
uint32_t m_nrSubFrames
The subframe number currently served.
std::set< uint16_t > m_ueAttached
List of RNTI of attached UEs.
LteEnbPhySapProvider * GetLteEnbPhySapProvider()
Get the PHY SAP provider.
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
void DoSetMasterInformationBlock(LteRrcSap::MasterInformationBlock mib)
Set master information block.
bool DeleteUePhy(uint16_t rnti)
Remove the given RNTI from the list of attached UE m_ueAttached.
std::vector< std::list< UlDciLteControlMessage > > m_ulDciQueue
For storing info on future receptions.
double GetNoiseFigure() const
void SetTxPower(double pow)
std::vector< int > m_dlDataRbMap
DL data RB map.
TracedCallback< uint16_t, uint16_t, double, uint8_t > m_reportUeSinr
The ReportUeSinr trace source.
~LteEnbPhy() override
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
void DoDispose() override
Destructor implementation.
void GenerateCtrlCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Ctrl frame
void GenerateDataCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs)
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
std::map< uint16_t, uint16_t > m_srsSampleCounterMap
SRS sample counter map.
void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
Set source configuration index.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
void(* ReportUeSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
TracedCallback signature for the linear average of SRS SINRs.
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreateSrsCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the SRS signal recei...
LteEnbPhySapUser * m_enbPhySapUser
ENB Phy SAP user.
void EndFrame()
End a LTE frame.
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
void DoSetPa(uint16_t rnti, double pa)
Set PA.
uint8_t GetMacChDelay() const
uint16_t m_currentSrsOffset
current SRS offset
void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn)
Set EARFCN.
Ptr< SpectrumValue > CreateTxPowerSpectralDensity() override
Create the PSD for TX.
void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
Set transmission mode.
LteEnbPhySapProvider * m_enbPhySapProvider
ENB Phy SAP provider.
uint8_t DoGetMacChTtiDelay()
Get MAC ch TTI delay function.
std::map< int, double > m_dlPowerAllocationMap
DL power allocation map.
std::vector< int > m_listOfDownlinkSubchannel
A vector of integers, if the i-th value is j it means that the j-th resource block is used for transm...
void GeneratePowerAllocationMap(uint16_t rnti, int rbId)
Generate power allocation map (i.e.
void QueueUlDci(UlDciLteControlMessage m)
void SetNoiseFigure(double pow)
std::map< uint16_t, uint16_t > m_srsCounter
SRS counter.
void SetMacChDelay(uint8_t delay)
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ Phy module.
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
PhySpectrum received a new list of LteControlMessage.
void SendControlChannels(std::list< Ptr< LteControlMessage > > ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
void DoRemoveUe(uint16_t rnti)
Remove UE.
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
void ReportRsReceivedPower(const SpectrumValue &power) override
generate a report based on the linear RS power perceived during CTRL frame NOTE: used only by UE for ...
LteRrcSap::MasterInformationBlock m_mib
The Master Information Block message to be broadcasted every frame.
void DoSendMacPdu(Ptr< Packet > p) override
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
void ReportInterference(const SpectrumValue &interf) override
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
TracedCallback< uint16_t, Ptr< SpectrumValue > > m_reportInterferenceTrace
The ReportInterference trace source.
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
void DoAddUe(uint16_t rnti)
Add UE.
void DoSetSystemInformationBlockType1(LteRrcSap::SystemInformationBlockType1 sib1)
Set system information block.
void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE Control Message function.
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
void DoInitialize() override
Initialize() implementation.
LteRrcSap::SystemInformationBlockType1 m_sib1
The System Information Block Type 1 message to be broadcasted.
std::map< uint16_t, double > m_paMap
P_A per UE RNTI.
void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Set bandwidth function.
void EndSubFrame()
End a LTE sub frame.
LteEnbCphySapUser * m_enbCphySapUser
ENB CPhy SAP user.
uint16_t m_interferenceSampleCounter
interference sample counter
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a.
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
void StartFrame()
Start a LTE frame.
uint32_t m_nrFrames
The frame number currently served.
LteEnbCphySapProvider * m_enbCphySapProvider
ENB CPhy SAP provider.
std::vector< uint16_t > m_srsUeOffset
SRS UE offset.
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
TracedCallback< PhyTransmissionStatParameters > m_dlPhyTransmission
The DlPhyTransmission trace source.
std::vector< int > GetDownlinkSubChannels()
Ptr< LteHarqPhy > m_harqPhyModule
HARQ Phy module.
void(* ReportInterferenceTracedCallback)(uint16_t cellId, Ptr< SpectrumValue > spectrumValue)
TracedCallback signature for the linear average of SRS SINRs.
static TypeId GetTypeId()
Get the type ID.
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
The LtePhy models the physical layer of LTE.
Definition lte-phy.h:40
Template for the implementation of the LteEnbCphySapProvider as a member of an owner class of type C ...
Smart pointer class similar to boost::intrusive_ptr.
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:48
The Uplink Data Control Indicator messages defines the RB allocation for the users in the uplink.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
MasterInformationBlock structure.
SystemInformationBlockType1 structure.
See section 4.3.12 ulInfoListElement.