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 
299  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
300 
308  typedef void (* ReportUeSinrTracedCallback)
309  (uint16_t cellId, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId);
310 
319  typedef void (* ReportInterferenceTracedCallback)
320  (uint16_t cellId, Ptr<SpectrumValue> spectrumValue);
321 
322 private:
323 
324  // LteEnbCphySapProvider forwarded methods
331  void DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
338  void DoSetEarfcn (uint32_t dlEarfcn, uint32_t ulEarfcn);
344  void DoAddUe (uint16_t rnti);
350  void DoRemoveUe (uint16_t rnti);
357  void DoSetPa (uint16_t rnti, double pa);
364  void DoSetTransmissionMode (uint16_t rnti, uint8_t txMode);
371  void DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi);
384 
385  // LteEnbPhySapProvider forwarded methods
386  void DoSendMacPdu (Ptr<Packet> p);
398  uint8_t DoGetMacChTtiDelay ();
399 
405  bool AddUePhy (uint16_t rnti);
411  bool DeleteUePhy (uint16_t rnti);
412 
419  void CreateSrsReport (uint16_t rnti, double srs);
420 
425  std::set <uint16_t> m_ueAttached;
426 
427 
429  std::map <uint16_t,double> m_paMap;
430 
432  std::map <int, double> m_dlPowerAllocationMap;
433 
440  std::vector <int> m_listOfDownlinkSubchannel;
441 
442  std::vector <int> m_dlDataRbMap;
443 
445  std::vector< std::list<UlDciLteControlMessage> > m_ulDciQueue;
446 
449 
452 
457  uint32_t m_nrFrames;
463  uint32_t m_nrSubFrames;
464 
465  uint16_t m_srsPeriodicity;
467  std::map <uint16_t,uint16_t> m_srsCounter;
468  std::vector <uint16_t> m_srsUeOffset;
470 
482 
484 
495  std::map <uint16_t,uint16_t> m_srsSampleCounterMap;
496 
512 
519 
520 }; // end of `class LteEnbPhy`
521 
522 
523 }
524 
525 #endif /* LTE_ENB_PHY_H */
virtual ~LteEnbPhy()
Definition: lte-enb-phy.cc:249
void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn)
Set EARFCN.
Definition: lte-enb-phy.cc:920
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:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
uint16_t m_interferenceSampleCounter
interference sample counter
Definition: lte-enb-phy.h:511
uint32_t m_nrSubFrames
The subframe number currently served.
Definition: lte-enb-phy.h:463
uint16_t m_srsSamplePeriod
The UeSinrSamplePeriod trace source.
Definition: lte-enb-phy.h:494
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:309
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:445
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:506
The Uplink Data Control Indicator messages defines the RB allocation for the users in the uplink...
double GetNoiseFigure() const
Definition: lte-enb-phy.cc:340
bool DeleteUePhy(uint16_t rnti)
Remove the given RNTI from the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:404
std::list< UlDciLteControlMessage > DequeueUlDci(void)
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:531
void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE Control Message function.
Definition: lte-enb-phy.cc:513
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:867
void DoSetSystemInformationBlockType1(LteRrcSap::SystemInformationBlockType1 sib1)
Set system information block.
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for TX.
Definition: lte-enb-phy.cc:485
std::vector< std::list< UlDciLteControlMessage > > m_ulDciQueue
For storing info on future receptions.
Definition: lte-enb-phy.h:445
std::map< int, double > m_dlPowerAllocationMap
DL power allocation map.
Definition: lte-enb-phy.h:432
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
Definition: lte-enb-phy.cc:495
std::map< uint16_t, double > m_paMap
P_A per UE RNTI.
Definition: lte-enb-phy.h:429
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
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:320
See section 4.3.12 ulInfoListElement.
std::vector< int > m_dlDataRbMap
DL data RB map.
Definition: lte-enb-phy.h:442
uint32_t m_nrFrames
The frame number currently served.
Definition: lte-enb-phy.h:457
std::map< uint16_t, uint16_t > m_srsCounter
SRS counter.
Definition: lte-enb-phy.h:467
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:448
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:440
void CreateSrsReport(uint16_t rnti, double srs)
Create SRS report function.
void SetMacChDelay(uint8_t delay)
Definition: lte-enb-phy.cc:347
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-enb-phy.cc:174
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:834
LteEnbCphySapProvider * m_enbCphySapProvider
ENB CPhy SAP provider.
Definition: lte-enb-phy.h:450
void DoSetMasterInformationBlock(LteRrcSap::MasterInformationBlock mib)
Set master information block.
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-enb-phy.cc:265
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:846
Ptr< LteHarqPhy > m_harqPhyModule
HARQ Phy module.
Definition: lte-enb-phy.h:483
std::map< uint16_t, uint16_t > m_srsSampleCounterMap
SRS sample counter map.
Definition: lte-enb-phy.h:495
virtual void ReceiveLteUlHarqFeedback(UlInfoListElement_s mes)
PhySpectrum generated a new UL HARQ feedback.
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
PhySpectrum generated a new UL HARQ feedback.
TracedCallback< uint16_t, uint16_t, double, uint8_t > m_reportUeSinr
The ReportUeSinr trace source.
Definition: lte-enb-phy.h:489
uint16_t m_interferenceSamplePeriod
The InterferenceSamplePeriod attribute.
Definition: lte-enb-phy.h:510
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:523
void StartSubFrame(void)
Start a LTE sub frame.
Definition: lte-enb-phy.cc:607
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:386
#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:854
void DoSetBandwidth(uint8_t ulBandwidth, uint8_t dlBandwidth)
Set bandwidth function.
Definition: lte-enb-phy.cc:897
SystemInformationBlockType1 structure.
Definition: lte-rrc-sap.h:594
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:374
void SendControlChannels(std::list< Ptr< LteControlMessage > > ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
Definition: lte-enb-phy.cc:777
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:292
LteRrcSap::MasterInformationBlock m_mib
The Master Information Block message to be broadcasted every frame.
Definition: lte-enb-phy.h:475
void DoRemoveUe(uint16_t rnti)
Remove UE.
Definition: lte-enb-phy.cc:941
LteEnbPhySapProvider * m_enbPhySapProvider
ENB Phy SAP provider.
Definition: lte-enb-phy.h:447
uint16_t m_currentSrsOffset
current SRS offset
Definition: lte-enb-phy.h:469
MasterInformationBlock structure.
Definition: lte-rrc-sap.h:587
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:312
void DoAddUe(uint16_t rnti)
Add UE.
Definition: lte-enb-phy.cc:929
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:454
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-enb-phy.cc:305
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:875
LteEnbCphySapUser * m_enbCphySapUser
ENB CPhy SAP user.
Definition: lte-enb-phy.h:451
int8_t DoGetReferenceSignalPower() const
Definition: lte-enb-phy.cc:326
uint8_t DoGetMacChTtiDelay()
Get MAC ch TTI delay function.
Definition: lte-enb-phy.cc:431
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:333
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:286
Time m_srsStartTime
SRS start time.
Definition: lte-enb-phy.h:466
void StartFrame(void)
Start a LTE frame.
Definition: lte-enb-phy.cc:588
double GetTxPower() const
Definition: lte-enb-phy.cc:319
std::vector< int > GetDownlinkSubChannels(void)
Definition: lte-enb-phy.cc:463
std::vector< uint16_t > m_srsUeOffset
SRS UE offset.
Definition: lte-enb-phy.h:468
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:470
LteRrcSap::SystemInformationBlockType1 m_sib1
The System Information Block Type 1 message to be broadcasted.
Definition: lte-enb-phy.h:481
LteEnbPhy models the physical layer for the eNodeB.
Definition: lte-enb-phy.h:47
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-enb-phy.cc:380
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:504
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:798
Set of values corresponding to a given SpectrumModel.
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-phy.cc:254
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:438
std::set< uint16_t > m_ueAttached
List of RNTI of attached UEs.
Definition: lte-enb-phy.h:425
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:298
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:518
uint16_t m_srsPeriodicity
SRS periodicity.
Definition: lte-enb-phy.h:465
void EndFrame(void)
End a LTE frame.
Definition: lte-enb-phy.cc:826
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:424
void EndSubFrame(void)
End a LTE sub frame.
Definition: lte-enb-phy.cc:811
uint8_t GetMacChDelay(void) const
Definition: lte-enb-phy.cc:368