A Discrete-Event Network Simulator
API
lte-enb-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  * Author: Marco Miozzo <marco.miozzo@cttc.es>
19  */
20 
21 #ifndef ENB_LTE_PHY_H
22 #define ENB_LTE_PHY_H
23 
24 #include "lte-control-messages.h"
25 #include "lte-enb-cphy-sap.h"
26 #include "lte-enb-phy-sap.h"
27 #include "lte-harq-phy.h"
28 #include "lte-phy.h"
29 
30 #include <map>
31 #include <set>
32 
33 namespace ns3
34 {
35 
36 class PacketBurst;
37 class LteNetDevice;
38 class LteUePhy;
39 
44 class LteEnbPhy : public LtePhy
45 {
50 
51  public:
55  LteEnbPhy();
56 
63 
64  ~LteEnbPhy() override;
65 
70  static TypeId GetTypeId();
71  // inherited from Object
72  void DoInitialize() override;
73  void DoDispose() override;
74 
80 
86 
92 
98 
102  void SetTxPower(double pow);
103 
107  double GetTxPower() const;
108 
112  int8_t DoGetReferenceSignalPower() const;
113 
117  void SetNoiseFigure(double pow);
118 
122  double GetNoiseFigure() const;
123 
127  void SetMacChDelay(uint8_t delay);
128 
132  uint8_t GetMacChDelay() const;
133 
138 
143 
153  void SetDownlinkSubChannels(std::vector<int> mask);
154 
164  void SetDownlinkSubChannelsWithPowerAllocation(std::vector<int> mask);
172  std::vector<int> GetDownlinkSubChannels();
173 
181  void GeneratePowerAllocationMap(uint16_t rnti, int rbId);
182 
188 
194 
200  void CalcChannelQualityForUe(std::vector<double> sinr, Ptr<LteSpectrumPhy> ue);
201 
207 
215  const SpectrumValue& sinr);
216 
224  const SpectrumValue& sinr);
225 
231 
237 
242 
246  std::list<UlDciLteControlMessage> DequeueUlDci();
247 
251  void StartFrame();
255  void StartSubFrame();
259  void EndSubFrame();
263  void EndFrame();
264 
269  void PhyPduReceived(Ptr<Packet> p);
270 
276 
277  // inherited from LtePhy
278  void GenerateCtrlCqiReport(const SpectrumValue& sinr) override;
279  void GenerateDataCqiReport(const SpectrumValue& sinr) override;
280  void ReportInterference(const SpectrumValue& interf) override;
281  void ReportRsReceivedPower(const SpectrumValue& power) override;
282 
288  virtual void ReportUlHarqFeedback(UlInfoListElement_s mes);
289 
296 
304  typedef void (*ReportUeSinrTracedCallback)(uint16_t cellId,
305  uint16_t rnti,
306  double sinrLinear,
307  uint8_t componentCarrierId);
308 
317  typedef void (*ReportInterferenceTracedCallback)(uint16_t cellId,
318  Ptr<SpectrumValue> spectrumValue);
319 
320  private:
321  // LteEnbCphySapProvider forwarded methods
328  void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth);
335  void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn);
341  void DoAddUe(uint16_t rnti);
347  void DoRemoveUe(uint16_t rnti);
354  void DoSetPa(uint16_t rnti, double pa);
361  void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode);
368  void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi);
381 
382  // LteEnbPhySapProvider forwarded methods
383  void DoSendMacPdu(Ptr<Packet> p) override;
395  uint8_t DoGetMacChTtiDelay();
396 
402  bool AddUePhy(uint16_t rnti);
408  bool DeleteUePhy(uint16_t rnti);
409 
416  void CreateSrsReport(uint16_t rnti, double srs);
417 
422  std::set<uint16_t> m_ueAttached;
423 
425  std::map<uint16_t, double> m_paMap;
426 
428  std::map<int, double> m_dlPowerAllocationMap;
429 
436  std::vector<int> m_listOfDownlinkSubchannel;
437 
438  std::vector<int> m_dlDataRbMap;
439 
441  std::vector<std::list<UlDciLteControlMessage>> m_ulDciQueue;
442 
445 
448 
453  uint32_t m_nrFrames;
459  uint32_t m_nrSubFrames;
460 
461  uint16_t m_srsPeriodicity;
463  std::map<uint16_t, uint16_t> m_srsCounter;
464  std::vector<uint16_t> m_srsUeOffset;
466 
478 
480 
491  std::map<uint16_t, uint16_t> m_srsSampleCounterMap;
492 
508 
515 
516 }; // end of `class LteEnbPhy`
517 
518 } // namespace ns3
519 
520 #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:45
uint16_t m_srsPeriodicity
SRS periodicity.
Definition: lte-enb-phy.h:461
double GetTxPower() const
Definition: lte-enb-phy.cc:311
Time m_srsStartTime
SRS start time.
Definition: lte-enb-phy.h:462
int8_t DoGetReferenceSignalPower() const
Definition: lte-enb-phy.cc:318
void StartSubFrame()
Start a LTE sub frame.
Definition: lte-enb-phy.cc:593
void CreateSrsReport(uint16_t rnti, double srs)
Create SRS report function.
uint16_t m_interferenceSamplePeriod
The InterferenceSamplePeriod attribute.
Definition: lte-enb-phy.h:506
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.
Definition: lte-enb-phy.h:490
void SetLteEnbCphySapUser(LteEnbCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-enb-phy.cc:290
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreatePuschCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the PUSCH signal rec...
Definition: lte-enb-phy.cc:861
uint32_t m_nrSubFrames
The subframe number currently served.
Definition: lte-enb-phy.h:459
std::set< uint16_t > m_ueAttached
List of RNTI of attached UEs.
Definition: lte-enb-phy.h:422
LteEnbPhySapProvider * GetLteEnbPhySapProvider()
Get the PHY SAP provider.
Definition: lte-enb-phy.cc:284
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:278
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.
Definition: lte-enb-phy.cc:395
std::vector< std::list< UlDciLteControlMessage > > m_ulDciQueue
For storing info on future receptions.
Definition: lte-enb-phy.h:441
double GetNoiseFigure() const
Definition: lte-enb-phy.cc:332
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:304
std::vector< int > m_dlDataRbMap
DL data RB map.
Definition: lte-enb-phy.h:438
TracedCallback< uint16_t, uint16_t, double, uint8_t > m_reportUeSinr
The ReportUeSinr trace source.
Definition: lte-enb-phy.h:485
~LteEnbPhy() override
Definition: lte-enb-phy.cc:239
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage >> msgList)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:523
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:366
void DoDispose() override
Destructor implementation.
Definition: lte-enb-phy.cc:244
void GenerateCtrlCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:822
void GenerateDataCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs)
Definition: lte-enb-phy.cc:834
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:789
std::map< uint16_t, uint16_t > m_srsSampleCounterMap
SRS sample counter map.
Definition: lte-enb-phy.h:491
void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
Set source configuration index.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:425
void(* ReportUeSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
TracedCallback signature for the linear average of SRS SINRs.
Definition: lte-enb-phy.h:304
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.
Definition: lte-enb-phy.h:444
void EndFrame()
End a LTE frame.
Definition: lte-enb-phy.cc:815
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:501
void DoSetPa(uint16_t rnti, double pa)
Set PA.
Definition: lte-enb-phy.cc:989
uint8_t GetMacChDelay() const
Definition: lte-enb-phy.cc:360
uint16_t m_currentSrsOffset
current SRS offset
Definition: lte-enb-phy.h:465
void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn)
Set EARFCN.
Definition: lte-enb-phy.cc:901
Ptr< SpectrumValue > CreateTxPowerSpectralDensity() override
Create the PSD for TX.
Definition: lte-enb-phy.cc:472
void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
Set transmission mode.
LteEnbPhySapProvider * m_enbPhySapProvider
ENB Phy SAP provider.
Definition: lte-enb-phy.h:443
void SendControlChannels(std::list< Ptr< LteControlMessage >> ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
Definition: lte-enb-phy.cc:769
uint8_t DoGetMacChTtiDelay()
Get MAC ch TTI delay function.
Definition: lte-enb-phy.cc:419
std::map< int, double > m_dlPowerAllocationMap
DL power allocation map.
Definition: lte-enb-phy.h:428
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...
Definition: lte-enb-phy.h:436
void GeneratePowerAllocationMap(uint16_t rnti, int rbId)
Generate power allocation map (i.e.
Definition: lte-enb-phy.cc:457
void QueueUlDci(UlDciLteControlMessage m)
void SetNoiseFigure(double pow)
Definition: lte-enb-phy.cc:325
std::map< uint16_t, uint16_t > m_srsCounter
SRS counter.
Definition: lte-enb-phy.h:463
void SetMacChDelay(uint8_t delay)
Definition: lte-enb-phy.cc:339
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ Phy module.
void DoRemoveUe(uint16_t rnti)
Remove UE.
Definition: lte-enb-phy.cc:921
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:441
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 ...
Definition: lte-enb-phy.cc:855
LteRrcSap::MasterInformationBlock m_mib
The Master Information Block message to be broadcasted every frame.
Definition: lte-enb-phy.h:471
void DoSendMacPdu(Ptr< Packet > p) override
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-enb-phy.cc:412
void ReportInterference(const SpectrumValue &interf) override
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-enb-phy.cc:842
TracedCallback< uint16_t, Ptr< SpectrumValue > > m_reportInterferenceTrace
The ReportInterference trace source.
Definition: lte-enb-phy.h:500
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-enb-phy.cc:372
void DoAddUe(uint16_t rnti)
Add UE.
Definition: lte-enb-phy.cc:909
void DoSetSystemInformationBlockType1(LteRrcSap::SystemInformationBlockType1 sib1)
Set system information block.
void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE Control Message function.
Definition: lte-enb-phy.cc:507
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
Definition: lte-enb-phy.cc:486
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:378
void DoInitialize() override
Initialize() implementation.
Definition: lte-enb-phy.cc:255
LteRrcSap::SystemInformationBlockType1 m_sib1
The System Information Block Type 1 message to be broadcasted.
Definition: lte-enb-phy.h:477
std::map< uint16_t, double > m_paMap
P_A per UE RNTI.
Definition: lte-enb-phy.h:425
void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Set bandwidth function.
Definition: lte-enb-phy.cc:878
void EndSubFrame()
End a LTE sub frame.
Definition: lte-enb-phy.cc:801
LteEnbCphySapUser * m_enbCphySapUser
ENB CPhy SAP user.
Definition: lte-enb-phy.h:447
uint16_t m_interferenceSampleCounter
interference sample counter
Definition: lte-enb-phy.h:507
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:432
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:515
void StartFrame()
Start a LTE frame.
Definition: lte-enb-phy.cc:575
uint32_t m_nrFrames
The frame number currently served.
Definition: lte-enb-phy.h:453
LteEnbCphySapProvider * m_enbCphySapProvider
ENB CPhy SAP provider.
Definition: lte-enb-phy.h:446
std::vector< uint16_t > m_srsUeOffset
SRS UE offset.
Definition: lte-enb-phy.h:464
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-enb-phy.cc:297
TracedCallback< PhyTransmissionStatParameters > m_dlPhyTransmission
The DlPhyTransmission trace source.
Definition: lte-enb-phy.h:514
std::vector< int > GetDownlinkSubChannels()
Definition: lte-enb-phy.cc:450
Ptr< LteHarqPhy > m_harqPhyModule
HARQ Phy module.
Definition: lte-enb-phy.h:479
void(* ReportInterferenceTracedCallback)(uint16_t cellId, Ptr< SpectrumValue > spectrumValue)
TracedCallback signature for the linear average of SRS SINRs.
Definition: lte-enb-phy.h:317
static TypeId GetTypeId()
Get the type ID.
Definition: lte-enb-phy.cc:166
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:51
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.
Definition: ptr.h:77
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
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.
#define list
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
MasterInformationBlock structure.
Definition: lte-rrc-sap.h:622
SystemInformationBlockType1 structure.
Definition: lte-rrc-sap.h:629
See section 4.3.12 ulInfoListElement.