A Discrete-Event Network Simulator
API
lte-enb-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
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: Giuseppe Piro <g.piro@poliba.it>
19  * Author: Marco Miozzo <marco.miozzo@cttc.es>
20  */
21 
22 #ifndef ENB_LTE_PHY_H
23 #define ENB_LTE_PHY_H
24 
25 
26 #include <ns3/lte-control-messages.h>
27 #include <ns3/lte-enb-phy-sap.h>
28 #include <ns3/lte-enb-cphy-sap.h>
29 #include <ns3/lte-phy.h>
30 #include <ns3/lte-harq-phy.h>
31 
32 #include <map>
33 #include <set>
34 
35 
36 
37 namespace ns3 {
38 
39 class PacketBurst;
40 class LteNetDevice;
41 class LteUePhy;
42 
47 class LteEnbPhy : public LtePhy
48 {
53 
54 public:
58  LteEnbPhy ();
59 
66 
67  virtual ~LteEnbPhy ();
68 
73  static TypeId GetTypeId (void);
74  // inherited from Object
75  virtual void DoInitialize (void);
76  virtual void DoDispose (void);
77 
78 
84 
90 
96 
102 
106  void SetTxPower (double pow);
107 
111  double GetTxPower () const;
112 
116  int8_t DoGetReferenceSignalPower () const;
117 
121  void SetNoiseFigure (double pow);
122 
126  double GetNoiseFigure () const;
127 
131  void SetMacChDelay (uint8_t delay);
132 
136  uint8_t GetMacChDelay (void) const;
137 
142 
147 
148 
157  void SetDownlinkSubChannels (std::vector<int> mask );
158 
168  void SetDownlinkSubChannelsWithPowerAllocation (std::vector<int> mask);
176  std::vector<int> GetDownlinkSubChannels (void);
177 
178 
186  void GeneratePowerAllocationMap (uint16_t rnti, int rbId);
187 
193 
199 
205  void CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue);
206 
212 
220 
228 
234 
240 
245 
249  std::list<UlDciLteControlMessage> DequeueUlDci (void);
250 
251 
255  void StartFrame (void);
259  void StartSubFrame (void);
263  void EndSubFrame (void);
267  void EndFrame (void);
268 
273  void PhyPduReceived (Ptr<Packet> p);
274 
279 
280  // inherited from LtePhy
281  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
282  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
283  virtual void ReportInterference (const SpectrumValue& interf);
284  virtual void ReportRsReceivedPower (const SpectrumValue& power);
285 
286 
287 
293  virtual void ReportUlHarqFeedback (UlInfoListElement_s mes);
294 
300  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
301 
309  typedef void (* ReportUeSinrTracedCallback)
310  (uint16_t cellId, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId);
311 
320  typedef void (* ReportInterferenceTracedCallback)
321  (uint16_t cellId, Ptr<SpectrumValue> spectrumValue);
322 
323 private:
324 
325  // LteEnbCphySapProvider forwarded methods
332  void DoSetBandwidth (uint16_t ulBandwidth, uint16_t dlBandwidth);
339  void DoSetEarfcn (uint32_t dlEarfcn, uint32_t ulEarfcn);
345  void DoAddUe (uint16_t rnti);
351  void DoRemoveUe (uint16_t rnti);
358  void DoSetPa (uint16_t rnti, double pa);
365  void DoSetTransmissionMode (uint16_t rnti, uint8_t txMode);
372  void DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi);
385 
386  // LteEnbPhySapProvider forwarded methods
387  void DoSendMacPdu (Ptr<Packet> p);
399  uint8_t DoGetMacChTtiDelay ();
400 
406  bool AddUePhy (uint16_t rnti);
412  bool DeleteUePhy (uint16_t rnti);
413 
420  void CreateSrsReport (uint16_t rnti, double srs);
421 
426  std::set <uint16_t> m_ueAttached;
427 
428 
430  std::map <uint16_t,double> m_paMap;
431 
433  std::map <int, double> m_dlPowerAllocationMap;
434 
441  std::vector <int> m_listOfDownlinkSubchannel;
442 
443  std::vector <int> m_dlDataRbMap;
444 
446  std::vector< std::list<UlDciLteControlMessage> > m_ulDciQueue;
447 
450 
453 
458  uint32_t m_nrFrames;
464  uint32_t m_nrSubFrames;
465 
466  uint16_t m_srsPeriodicity;
468  std::map <uint16_t,uint16_t> m_srsCounter;
469  std::vector <uint16_t> m_srsUeOffset;
471 
483 
485 
496  std::map <uint16_t,uint16_t> m_srsSampleCounterMap;
497 
513 
520 
521 }; // end of `class LteEnbPhy`
522 
523 
524 }
525 
526 #endif /* LTE_ENB_PHY_H */
virtual ~LteEnbPhy()
Definition: lte-enb-phy.cc:246
void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn)
Set EARFCN.
Definition: lte-enb-phy.cc:916
Template for the implementation of the LteEnbCphySapProvider as a member of an owner class of type C ...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
uint16_t m_interferenceSampleCounter
interference sample counter
Definition: lte-enb-phy.h:512
uint32_t m_nrSubFrames
The subframe number currently served.
Definition: lte-enb-phy.h:464
uint16_t m_srsSamplePeriod
The UeSinrSamplePeriod trace source.
Definition: lte-enb-phy.h:495
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:310
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:441
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:502
The Uplink Data Control Indicator messages defines the RB allocation for the users in the uplink...
double GetNoiseFigure() const
Definition: lte-enb-phy.cc:336
bool DeleteUePhy(uint16_t rnti)
Remove the given RNTI from the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:400
std::list< UlDciLteControlMessage > DequeueUlDci(void)
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:527
void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE Control Message function.
Definition: lte-enb-phy.cc:509
virtual void ReportRsReceivedPower(const SpectrumValue &power)
generate a report based on the linear RS power perceived during CTRL frame NOTE: used only by UE for ...
Definition: lte-enb-phy.cc:863
void DoSetSystemInformationBlockType1(LteRrcSap::SystemInformationBlockType1 sib1)
Set system information block.
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for TX.
Definition: lte-enb-phy.cc:481
std::vector< std::list< UlDciLteControlMessage > > m_ulDciQueue
For storing info on future receptions.
Definition: lte-enb-phy.h:446
std::map< int, double > m_dlPowerAllocationMap
DL power allocation map.
Definition: lte-enb-phy.h:433
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
Definition: lte-enb-phy.cc:491
std::map< uint16_t, double > m_paMap
P_A per UE RNTI.
Definition: lte-enb-phy.h:430
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
virtual void ReportUlHarqFeedback(UlInfoListElement_s mes)
Report the uplink HARQ feedback generated by LteSpectrumPhy to MAC.
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
void(* ReportInterferenceTracedCallback)(uint16_t cellId, Ptr< SpectrumValue > spectrumValue)
TracedCallback signature for the linear average of SRS SINRs.
Definition: lte-enb-phy.h:321
See section 4.3.12 ulInfoListElement.
std::vector< int > m_dlDataRbMap
DL data RB map.
Definition: lte-enb-phy.h:443
uint32_t m_nrFrames
The frame number currently served.
Definition: lte-enb-phy.h:458
std::map< uint16_t, uint16_t > m_srsCounter
SRS counter.
Definition: lte-enb-phy.h:468
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
LteEnbPhySapUser * m_enbPhySapUser
ENB Phy SAP user.
Definition: lte-enb-phy.h:449
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:441
void CreateSrsReport(uint16_t rnti, double srs)
Create SRS report function.
void SetMacChDelay(uint8_t delay)
Definition: lte-enb-phy.cc:343
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-enb-phy.cc:171
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:830
LteEnbCphySapProvider * m_enbCphySapProvider
ENB CPhy SAP provider.
Definition: lte-enb-phy.h:451
void DoSetMasterInformationBlock(LteRrcSap::MasterInformationBlock mib)
Set master information block.
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-enb-phy.cc:261
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs) ...
Definition: lte-enb-phy.cc:842
Ptr< LteHarqPhy > m_harqPhyModule
HARQ Phy module.
Definition: lte-enb-phy.h:484
std::map< uint16_t, uint16_t > m_srsSampleCounterMap
SRS sample counter map.
Definition: lte-enb-phy.h:496
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ Phy module.
void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Set bandwidth function.
Definition: lte-enb-phy.cc:893
TracedCallback< uint16_t, uint16_t, double, uint8_t > m_reportUeSinr
The ReportUeSinr trace source.
Definition: lte-enb-phy.h:490
uint16_t m_interferenceSamplePeriod
The InterferenceSamplePeriod attribute.
Definition: lte-enb-phy.h:511
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:519
void StartSubFrame(void)
Start a LTE sub frame.
Definition: lte-enb-phy.cc:603
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:382
#define list
virtual void ReportInterference(const SpectrumValue &interf)
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-enb-phy.cc:850
SystemInformationBlockType1 structure.
Definition: lte-rrc-sap.h:594
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:370
void SendControlChannels(std::list< Ptr< LteControlMessage > > ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
Definition: lte-enb-phy.cc:773
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LteEnbPhySapProvider * GetLteEnbPhySapProvider()
Get the PHY SAP provider.
Definition: lte-enb-phy.cc:288
LteRrcSap::MasterInformationBlock m_mib
The Master Information Block message to be broadcasted every frame.
Definition: lte-enb-phy.h:476
void DoRemoveUe(uint16_t rnti)
Remove UE.
Definition: lte-enb-phy.cc:937
LteEnbPhySapProvider * m_enbPhySapProvider
ENB Phy SAP provider.
Definition: lte-enb-phy.h:448
uint16_t m_currentSrsOffset
current SRS offset
Definition: lte-enb-phy.h:470
MasterInformationBlock structure.
Definition: lte-rrc-sap.h:587
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:308
void DoAddUe(uint16_t rnti)
Add UE.
Definition: lte-enb-phy.cc:925
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:450
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-enb-phy.cc:301
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:871
LteEnbCphySapUser * m_enbCphySapUser
ENB CPhy SAP user.
Definition: lte-enb-phy.h:452
int8_t DoGetReferenceSignalPower() const
Definition: lte-enb-phy.cc:322
uint8_t DoGetMacChTtiDelay()
Get MAC ch TTI delay function.
Definition: lte-enb-phy.cc:427
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
Set source configuration index.
void SetNoiseFigure(double pow)
Definition: lte-enb-phy.cc:329
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:282
Time m_srsStartTime
SRS start time.
Definition: lte-enb-phy.h:467
void StartFrame(void)
Start a LTE frame.
Definition: lte-enb-phy.cc:584
double GetTxPower() const
Definition: lte-enb-phy.cc:315
std::vector< int > GetDownlinkSubChannels(void)
Definition: lte-enb-phy.cc:459
std::vector< uint16_t > m_srsUeOffset
SRS UE offset.
Definition: lte-enb-phy.h:469
void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
Set transmission mode.
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreateSrsCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the SRS signal recei...
void QueueUlDci(UlDciLteControlMessage m)
void GeneratePowerAllocationMap(uint16_t rnti, int rbId)
Generate power allocation map (i.e.
Definition: lte-enb-phy.cc:466
LteRrcSap::SystemInformationBlockType1 m_sib1
The System Information Block Type 1 message to be broadcasted.
Definition: lte-enb-phy.h:482
LteEnbPhy models the physical layer for the eNodeB.
Definition: lte-enb-phy.h:47
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-enb-phy.cc:376
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
TracedCallback< uint16_t, Ptr< SpectrumValue > > m_reportInterferenceTrace
The ReportInterference trace source.
Definition: lte-enb-phy.h:505
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:794
Set of values corresponding to a given SpectrumModel.
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-phy.cc:250
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:434
std::set< uint16_t > m_ueAttached
List of RNTI of attached UEs.
Definition: lte-enb-phy.h:426
a unique identifier for an interface.
Definition: type-id.h:58
void SetLteEnbCphySapUser(LteEnbCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-enb-phy.cc:294
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:52
TracedCallback< PhyTransmissionStatParameters > m_dlPhyTransmission
The DlPhyTransmission trace source.
Definition: lte-enb-phy.h:519
uint16_t m_srsPeriodicity
SRS periodicity.
Definition: lte-enb-phy.h:466
void EndFrame(void)
End a LTE frame.
Definition: lte-enb-phy.cc:822
void DoSetPa(uint16_t rnti, double pa)
Set PA.
void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-enb-phy.cc:420
void EndSubFrame(void)
End a LTE sub frame.
Definition: lte-enb-phy.cc:807
uint8_t GetMacChDelay(void) const
Definition: lte-enb-phy.cc:364