A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lte-enb-phy.h
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 {
49  friend class EnbMemberLteEnbPhySapProvider;
50  friend class MemberLteEnbCphySapProvider<LteEnbPhy>;
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 
107 
111  void SetNoiseFigure (double pow);
112 
116  double GetNoiseFigure () const;
117 
121  void SetMacChDelay (uint8_t delay);
122 
126  uint8_t GetMacChDelay (void) const;
127 
132 
137 
138 
147  void SetDownlinkSubChannels (std::vector<int> mask );
148 
149 
157  std::vector<int> GetDownlinkSubChannels (void);
158 
163 
169  void CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue);
170 
176 
183 
190 
195  void SendControlChannels (std::list<Ptr<LteControlMessage> > ctrlMsgList);
196 
202 
207 
211  std::list<UlDciLteControlMessage> DequeueUlDci (void);
212 
213 
217  void StartFrame (void);
221  void StartSubFrame (void);
225  void EndSubFrame (void);
229  void EndFrame (void);
230 
234  void PhyPduReceived (Ptr<Packet> p);
235 
239  virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
240 
241  // inherited from LtePhy
242  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
243  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
244  virtual void ReportInterference (const SpectrumValue& interf);
245  virtual void ReportRsReceivedPower (const SpectrumValue& interf);
246 
247 
248 
253 
254  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
255 
256 
257 private:
258 
259  // LteEnbCphySapProvider forwarded methods
260  void DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
261  void DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn);
262  void DoAddUe (uint16_t rnti);
263  void DoRemoveUe (uint16_t rnti);
264  void DoSetTransmissionMode (uint16_t rnti, uint8_t txMode);
265  void DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi);
266  void DoSetMasterInformationBlock (LteRrcSap::MasterInformationBlock mib);
267 
268  // LteEnbPhySapProvider forwarded methods
269  void DoSendMacPdu (Ptr<Packet> p);
270  void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
271  uint8_t DoGetMacChTtiDelay ();
272 
273  bool AddUePhy (uint16_t rnti);
274 
275  bool DeleteUePhy (uint16_t rnti);
276 
277  void CreateSrsReport(uint16_t rnti, double srs);
278 
279 
280  std::set <uint16_t> m_ueAttached;
281 
282  std::vector <int> m_listOfDownlinkSubchannel;
283 
284  std::vector <int> m_dlDataRbMap;
285 
286  std::vector< std::list<UlDciLteControlMessage> > m_ulDciQueue; // for storing info on future receptions
287 
288  LteEnbPhySapProvider* m_enbPhySapProvider;
289  LteEnbPhySapUser* m_enbPhySapUser;
290 
291  LteEnbCphySapProvider* m_enbCphySapProvider;
292  LteEnbCphySapUser* m_enbCphySapUser;
293 
294  uint32_t m_nrFrames;
295  uint32_t m_nrSubFrames;
296 
297  uint16_t m_srsPeriodicity;
298  Time m_srsStartTime;
299  std::map <uint16_t,uint16_t> m_srsCounter;
300  std::vector <uint16_t> m_srsUeOffset;
301  uint16_t m_currentSrsOffset;
302 
304 
305  Ptr<LteHarqPhy> m_harqPhyModule;
306 
312  uint16_t m_srsSamplePeriod;
313  std::map <uint16_t,uint16_t> m_srsSampleCounterMap;
314 
321  uint16_t m_interferenceSamplePeriod;
322  uint16_t m_interferenceSampleCounter;
323 
329 
330 };
331 
332 
333 }
334 
335 #endif /* LTE_ENB_PHY_H */
keep track of time unit.
Definition: nstime.h:149
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a. sub channels) to be used in the downlink for transmission ...
Definition: lte-enb-phy.cc:394
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:421
std::list< UlDciLteControlMessage > DequeueUlDci(void)
Definition: lte-enb-phy.cc:875
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:446
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for TX.
Definition: lte-enb-phy.cc:410
TracedCallback< uint16_t, uint16_t, double > m_reportUeSinr
Definition: lte-enb-phy.h:311
See section 4.3.12 ulInfoListElement.
double GetNoiseFigure() const
Definition: lte-enb-phy.cc:289
void SetMacChDelay(uint8_t delay)
Definition: lte-enb-phy.cc:296
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
Definition: lte-enb-phy.cc:694
virtual void DoInitialize(void)
Definition: lte-enb-phy.cc:232
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)
Definition: lte-enb-phy.cc:706
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:323
virtual void ReceiveLteUlHarqFeedback(UlInfoListElement_s mes)
PhySpectrum generated a new UL HARQ feedback.
Definition: lte-enb-phy.cc:945
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:438
void StartSubFrame(void)
Start a LTE sub frame.
Definition: lte-enb-phy.cc:490
virtual void ReportInterference(const SpectrumValue &interf)
Definition: lte-enb-phy.cc:714
void SendControlChannels(std::list< Ptr< LteControlMessage > > ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
Definition: lte-enb-phy.cc:642
double GetTxPower() const
Definition: lte-enb-phy.cc:275
LteEnbPhySapProvider * GetLteEnbPhySapProvider()
Get the PHY SAP provider.
Definition: lte-enb-phy.cc:248
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:268
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-enb-phy.cc:261
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:735
void SetNoiseFigure(double pow)
Definition: lte-enb-phy.cc:282
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:242
void StartFrame(void)
Start a LTE frame.
Definition: lte-enb-phy.cc:471
std::vector< int > GetDownlinkSubChannels(void)
Definition: lte-enb-phy.cc:403
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:808
void QueueUlDci(UlDciLteControlMessage m)
Definition: lte-enb-phy.cc:868
TracedCallback< uint16_t, Ptr< SpectrumValue > > m_reportInterferenceTrace
Definition: lte-enb-phy.h:320
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:658
virtual void ReportRsReceivedPower(const SpectrumValue &interf)
Definition: lte-enb-phy.cc:727
Set of values corresponding to a given SpectrumModel.
virtual void DoDispose(void)
Definition: lte-enb-phy.cc:221
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:387
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-enb-phy.cc:329
a unique identifier for an interface.
Definition: type-id.h:44
uint8_t GetMacChDelay(void) const
Definition: lte-enb-phy.cc:317
void SetLteEnbCphySapUser(LteEnbCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-enb-phy.cc:254
TracedCallback< PhyTransmissionStatParameters > m_dlPhyTransmission
Definition: lte-enb-phy.h:328
void EndFrame(void)
End a LTE frame.
Definition: lte-enb-phy.cc:686
void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-enb-phy.cc:373
void EndSubFrame(void)
End a LTE sub frame.
Definition: lte-enb-phy.cc:671