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 {
51 
52 public:
56  LteEnbPhy ();
57 
64 
65  virtual ~LteEnbPhy ();
66 
67  // inherited from Object
68  static TypeId GetTypeId (void);
69  virtual void DoInitialize (void);
70  virtual void DoDispose (void);
71 
72 
78 
84 
90 
96 
100  void SetTxPower (double pow);
101 
105  double GetTxPower () const;
106 
110  int8_t DoGetReferenceSignalPower () const;
111 
115  void SetNoiseFigure (double pow);
116 
120  double GetNoiseFigure () const;
121 
125  void SetMacChDelay (uint8_t delay);
126 
130  uint8_t GetMacChDelay (void) const;
131 
136 
141 
142 
151  void SetDownlinkSubChannels (std::vector<int> mask );
152 
162  void SetDownlinkSubChannelsWithPowerAllocation (std::vector<int> mask);
170  std::vector<int> GetDownlinkSubChannels (void);
171 
172 
180  void GeneratePowerAllocationMap (uint16_t rnti, int rbId);
181 
186 
191 
197  void CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue);
198 
204 
212 
220 
226 
232 
237 
241  std::list<UlDciLteControlMessage> DequeueUlDci (void);
242 
243 
247  void StartFrame (void);
251  void StartSubFrame (void);
255  void EndSubFrame (void);
259  void EndFrame (void);
260 
264  void PhyPduReceived (Ptr<Packet> p);
265 
270 
271  // inherited from LtePhy
272  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
273  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
274  virtual void ReportInterference (const SpectrumValue& interf);
275  virtual void ReportRsReceivedPower (const SpectrumValue& power);
276 
277 
278 
283 
284  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
285 
293  typedef void (* ReportUeSinrTracedCallback)
294  (uint16_t cellId, uint16_t rnti, double sinrLinear);
295 
304  typedef void (* ReportInterferenceTracedCallback)
305  (uint16_t cellId, Ptr<SpectrumValue> spectrumValue);
306 
307 private:
308 
309  // LteEnbCphySapProvider forwarded methods
310  void DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
311  void DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn);
312  void DoAddUe (uint16_t rnti);
313  void DoRemoveUe (uint16_t rnti);
314  void DoSetPa (uint16_t rnti, double pa);
315  void DoSetTransmissionMode (uint16_t rnti, uint8_t txMode);
316  void DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi);
319 
320  // LteEnbPhySapProvider forwarded methods
321  void DoSendMacPdu (Ptr<Packet> p);
323  uint8_t DoGetMacChTtiDelay ();
324 
330  bool AddUePhy (uint16_t rnti);
336  bool DeleteUePhy (uint16_t rnti);
337 
338  void CreateSrsReport (uint16_t rnti, double srs);
339 
344  std::set <uint16_t> m_ueAttached;
345 
346 
348  std::map <uint16_t,double> m_paMap;
349 
351  std::map <int, double> m_dlPowerAllocationMap;
352 
359  std::vector <int> m_listOfDownlinkSubchannel;
360 
361  std::vector <int> m_dlDataRbMap;
362 
364  std::vector< std::list<UlDciLteControlMessage> > m_ulDciQueue;
365 
368 
371 
376  uint32_t m_nrFrames;
382  uint32_t m_nrSubFrames;
383 
386  std::map <uint16_t,uint16_t> m_srsCounter;
387  std::vector <uint16_t> m_srsUeOffset;
389 
401 
403 
414  std::map <uint16_t,uint16_t> m_srsSampleCounterMap;
415 
431 
438 
439 }; // end of `class LteEnbPhy`
440 
441 
442 }
443 
444 #endif /* LTE_ENB_PHY_H */
virtual ~LteEnbPhy()
Definition: lte-enb-phy.cc:233
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
Definition: lte-enb-phy.h:430
uint32_t m_nrSubFrames
The subframe number currently served.
Definition: lte-enb-phy.h:382
uint16_t m_srsSamplePeriod
The UeSinrSamplePeriod trace source.
Definition: lte-enb-phy.h:413
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:437
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:498
The Uplink Data Control Indicator messages defines the RB allocation for the users in the uplink...
bool DeleteUePhy(uint16_t rnti)
Remove the given RNTI from the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:396
std::list< UlDciLteControlMessage > DequeueUlDci(void)
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:523
void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-enb-phy.cc:505
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:858
void DoSetSystemInformationBlockType1(LteRrcSap::SystemInformationBlockType1 sib1)
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for TX.
Definition: lte-enb-phy.cc:477
std::vector< std::list< UlDciLteControlMessage > > m_ulDciQueue
For storing info on future receptions.
Definition: lte-enb-phy.h:364
std::map< int, double > m_dlPowerAllocationMap
DL power allocation map.
Definition: lte-enb-phy.h:351
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
Definition: lte-enb-phy.cc:487
std::map< uint16_t, double > m_paMap
P_A per UE RNTI.
Definition: lte-enb-phy.h:348
TracedCallback< uint16_t, uint16_t, double > m_reportUeSinr
The ReportUeSinr trace source.
Definition: lte-enb-phy.h:408
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
void(* ReportUeSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double sinrLinear)
TracedCallback signature for the linear average of SRS SINRs.
Definition: lte-enb-phy.h:294
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:305
See section 4.3.12 ulInfoListElement.
std::vector< int > m_dlDataRbMap
Definition: lte-enb-phy.h:361
uint32_t m_nrFrames
The frame number currently served.
Definition: lte-enb-phy.h:376
std::map< uint16_t, uint16_t > m_srsCounter
Definition: lte-enb-phy.h:386
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
void DoSetEarfcn(uint16_t dlEarfcn, uint16_t ulEarfcn)
Definition: lte-enb-phy.cc:911
LteEnbPhySapUser * m_enbPhySapUser
Definition: lte-enb-phy.h:367
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:359
double GetNoiseFigure() const
Definition: lte-enb-phy.cc:332
void CreateSrsReport(uint16_t rnti, double srs)
void SetMacChDelay(uint8_t delay)
Definition: lte-enb-phy.cc:339
static TypeId GetTypeId(void)
Definition: lte-enb-phy.cc:158
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:825
LteEnbCphySapProvider * m_enbCphySapProvider
Definition: lte-enb-phy.h:369
void DoSetMasterInformationBlock(LteRrcSap::MasterInformationBlock mib)
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-enb-phy.cc:249
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:837
Ptr< LteHarqPhy > m_harqPhyModule
Definition: lte-enb-phy.h:402
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:366
std::map< uint16_t, uint16_t > m_srsSampleCounterMap
Definition: lte-enb-phy.h:414
virtual void ReceiveLteUlHarqFeedback(UlInfoListElement_s mes)
PhySpectrum generated a new UL HARQ feedback.
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
uint16_t m_interferenceSamplePeriod
The InterferenceSamplePeriod attribute.
Definition: lte-enb-phy.h:429
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:515
void StartSubFrame(void)
Start a LTE sub frame.
Definition: lte-enb-phy.cc:599
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:378
#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:845
void DoSetBandwidth(uint8_t ulBandwidth, uint8_t dlBandwidth)
Definition: lte-enb-phy.cc:888
void SendControlChannels(std::list< Ptr< LteControlMessage > > ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
Definition: lte-enb-phy.cc:768
double GetTxPower() const
Definition: lte-enb-phy.cc:311
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:284
LteRrcSap::MasterInformationBlock m_mib
The Master Information Block message to be broadcasted every frame.
Definition: lte-enb-phy.h:394
void DoRemoveUe(uint16_t rnti)
Definition: lte-enb-phy.cc:932
LteEnbPhySapProvider * m_enbPhySapProvider
Definition: lte-enb-phy.h:366
uint16_t m_currentSrsOffset
Definition: lte-enb-phy.h:388
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:304
void DoAddUe(uint16_t rnti)
Definition: lte-enb-phy.cc:920
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:446
int8_t DoGetReferenceSignalPower() const
Definition: lte-enb-phy.cc:318
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-enb-phy.cc:297
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:866
LteEnbCphySapUser * m_enbCphySapUser
Definition: lte-enb-phy.h:370
uint8_t DoGetMacChTtiDelay()
Definition: lte-enb-phy.cc:423
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
void SetNoiseFigure(double pow)
Definition: lte-enb-phy.cc:325
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:278
void StartFrame(void)
Start a LTE frame.
Definition: lte-enb-phy.cc:580
std::vector< int > GetDownlinkSubChannels(void)
Definition: lte-enb-phy.cc:455
std::vector< uint16_t > m_srsUeOffset
Definition: lte-enb-phy.h:387
void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreateSrsCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the SRS signal recei...
Definition: lte-enb-phy.cc:967
void QueueUlDci(UlDciLteControlMessage m)
void GeneratePowerAllocationMap(uint16_t rnti, int rbId)
Generate power allocation map (i.e.
Definition: lte-enb-phy.cc:462
LteRrcSap::SystemInformationBlockType1 m_sib1
The System Information Block Type 1 message to be broadcasted.
Definition: lte-enb-phy.h:400
LteEnbPhy models the physical layer for the eNodeB.
Definition: lte-enb-phy.h:47
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:423
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:789
Set of values corresponding to a given SpectrumModel.
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-enb-phy.cc:238
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:430
std::set< uint16_t > m_ueAttached
List of RNTI of attached UEs.
Definition: lte-enb-phy.h:344
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-enb-phy.cc:372
a unique identifier for an interface.
Definition: type-id.h:58
uint8_t GetMacChDelay(void) const
Definition: lte-enb-phy.cc:360
void SetLteEnbCphySapUser(LteEnbCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-enb-phy.cc:290
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:437
uint16_t m_srsPeriodicity
Definition: lte-enb-phy.h:384
void EndFrame(void)
End a LTE frame.
Definition: lte-enb-phy.cc:817
void DoSetPa(uint16_t rnti, double pa)
Definition: lte-enb-phy.cc:949
void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-enb-phy.cc:416
void EndSubFrame(void)
End a LTE sub frame.
Definition: lte-enb-phy.cc:802