A Discrete-Event Network Simulator
API
lte-ue-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 <mmiozzo@cttc.es>
20  */
21 
22 #ifndef LTE_UE_PHY_H
23 #define LTE_UE_PHY_H
24 
25 
26 #include <ns3/lte-phy.h>
27 #include <ns3/ff-mac-common.h>
28 
29 #include <ns3/lte-control-messages.h>
30 #include <ns3/lte-amc.h>
31 #include <ns3/lte-ue-phy-sap.h>
32 #include <ns3/lte-ue-cphy-sap.h>
33 #include <ns3/ptr.h>
34 #include <ns3/lte-amc.h>
35 #include <set>
36 #include <ns3/lte-ue-power-control.h>
37 
38 
39 namespace ns3 {
40 
41 class PacketBurst;
42 class LteEnbPhy;
43 class LteHarqPhy;
44 
45 
51 class LteUePhy : public LtePhy
52 {
53 
56 
57 public:
61  enum State
62  {
66  };
67 
71  LteUePhy ();
72 
79 
80  virtual ~LteUePhy ();
81 
82  // inherited from Object
83  static TypeId GetTypeId (void);
84  virtual void DoInitialize (void);
85  virtual void DoDispose (void);
86 
92 
98 
104 
110 
111 
115  void SetTxPower (double pow);
116 
120  double GetTxPower () const;
121 
126 
130  void SetNoiseFigure (double nf);
131 
135  double GetNoiseFigure () const;
136 
140  uint8_t GetMacChDelay (void) const;
141 
146 
151 
157 
162  void SetSubChannelsForTransmission (std::vector <int> mask);
167  std::vector <int> GetSubChannelsForTransmission (void);
168 
173  void SetSubChannelsForReception (std::vector <int> mask);
178  std::vector <int> GetSubChannelsForReception (void);
179 
187 
188 
189 
190  // inherited from LtePhy
191  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
192  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
193  virtual void GenerateMixedCqiReport (const SpectrumValue& sinr);
194  virtual void ReportInterference (const SpectrumValue& interf);
195  virtual void ReportDataInterference (const SpectrumValue& interf);
196  virtual void ReportRsReceivedPower (const SpectrumValue& power);
197 
198  // callbacks for LteSpectrumPhy
200  virtual void ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p);
201 
202 
206  void PhyPduReceived (Ptr<Packet> p);
207 
208 
215  void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
216 
217 
221  void SendSrs ();
222 
227 
231  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
232 
236  State GetState () const;
237 
246  typedef void (* StateTracedCallback)
247  (const uint16_t cellId, const uint16_t rnti,
248  const State oldState, const State newState);
249 
258  typedef void (* RsrpSinrTracedCallback)
259  (const uint16_t cellId, const uint16_t rnti,
260  const double rsrp, const double sinr);
261 
271  typedef void (* RsrpRsrqTracedCallback)
272  (const uint16_t rnti, const uint16_t cellId,
273  const double rsrp, const double rsrq, const bool isServingCell);
274 
275 private:
276 
277  void SetTxMode1Gain (double gain);
278  void SetTxMode2Gain (double gain);
279  void SetTxMode3Gain (double gain);
280  void SetTxMode4Gain (double gain);
281  void SetTxMode5Gain (double gain);
282  void SetTxMode6Gain (double gain);
283  void SetTxMode7Gain (double gain);
284  void SetTxModeGain (uint8_t txMode, double gain);
285 
286  void QueueSubChannelsForTransmission (std::vector <int> rbMap);
287 
288 
295  void GenerateCqiRsrpRsrq (const SpectrumValue& sinr);
296 
297 
305  void ReportUeMeasurements ();
306 
311  void SwitchToState (State s);
312 
313  // UE CPHY SAP methods
314  void DoReset ();
315  void DoStartCellSearch (uint16_t dlEarfcn);
316  void DoSynchronizeWithEnb (uint16_t cellId);
317  void DoSynchronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
318  void DoSetDlBandwidth (uint8_t ulBandwidth);
319  void DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
320  void DoConfigureReferenceSignalPower (int8_t referenceSignalPower);
321  void DoSetRnti (uint16_t rnti);
322  void DoSetTransmissionMode (uint8_t txMode);
323  void DoSetSrsConfigurationIndex (uint16_t srcCi);
324  void DoSetPa (double pa);
325 
326  // UE PHY SAP methods
327  virtual void DoSendMacPdu (Ptr<Packet> p);
329  virtual void DoSendRachPreamble (uint32_t prachId, uint32_t raRnti);
330 
332  std::vector <int> m_subChannelsForTransmission;
334  std::vector <int> m_subChannelsForReception;
335 
336  std::vector< std::vector <int> > m_subChannelsForTransmissionQueue;
337 
338 
340 
348 
352 
360 
363 
366 
367  uint16_t m_rnti;
368 
370  std::vector <double> m_txModeGain;
371 
374  uint16_t m_srsConfigured;
376 
377  double m_paLinear;
378 
381 
389 
391  uint8_t m_subframeNo;
392 
395 
398 
401 
403  struct PssElement
404  {
405  uint16_t cellId;
406  double pssPsdSum;
407  uint16_t nRB;
408  };
409  std::list <PssElement> m_pssList;
410 
416 
419  {
420  double rsrpSum;
421  uint8_t rsrpNum;
422  double rsrqSum;
423  uint8_t rsrqNum;
424  };
425 
430  std::map <uint16_t, UeMeasurementsElement> m_ueMeasurementsMap;
438 
440 
441  uint32_t m_raPreambleId;
442  uint32_t m_raRnti;
443 
456 
464 
466 
473 
474 
476 
478 }; // end of `class LteUePhy`
479 
480 
481 }
482 
483 #endif /* LTE_UE_PHY_H */
double GetNoiseFigure() const
Definition: lte-ue-phy.cc:364
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-ue-phy.cc:405
uint16_t m_srsConfigured
Definition: lte-ue-phy.h:374
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Definition: lte-ue-phy.cc:609
LteUePhySapUser * m_uePhySapUser
Definition: lte-ue-phy.h:362
void SetTxMode5Gain(double gain)
Definition: lte-ue-phy.cc:1374
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs) ...
Definition: lte-ue-phy.cc:603
std::list< PssElement > m_pssList
Definition: lte-ue-phy.h:409
void SetTxMode2Gain(double gain)
Definition: lte-ue-phy.cc:1356
bool m_ulConfigured
Definition: lte-ue-phy.h:380
uint8_t GetMacChDelay(void) const
Definition: lte-ue-phy.cc:393
void DoConfigureUplink(uint16_t ulEarfcn, uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1296
void(* RsrpRsrqTracedCallback)(const uint16_t rnti, const uint16_t cellId, const double rsrp, const double rsrq, const bool isServingCell)
TracedCallback signature for cell RSRP and RSRQ.
Definition: lte-ue-phy.h:272
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:446
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:472
TracedCallback< uint16_t, uint16_t, double, double > m_reportCurrentCellRsrpSinrTrace
The ReportCurrentCellRsrpSinr trace source.
Definition: lte-ue-phy.h:449
Time m_a30CqiLast
Definition: lte-ue-phy.h:359
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:426
double m_paLinear
Definition: lte-ue-phy.h:377
LteUePhySapProvider * m_uePhySapProvider
Definition: lte-ue-phy.h:361
uint8_t rsrqNum
Number of RSRQ samples.
Definition: lte-ue-phy.h:423
void SetTxMode6Gain(double gain)
Definition: lte-ue-phy.cc:1380
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
std::vector< double > m_txModeGain
Definition: lte-ue-phy.h:370
Summary results of measuring a specific cell. Used for layer-1 filtering.
Definition: lte-ue-phy.h:418
SpectrumValue m_dataInterferencePower
Definition: lte-ue-phy.h:400
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
Definition: lte-ue-phy.cc:1068
void(* RsrpSinrTracedCallback)(const uint16_t cellId, const uint16_t rnti, const double rsrp, const double sinr)
TracedCallback signature for cell RSRP and SINR report.
Definition: lte-ue-phy.h:259
Service Access Point (SAP) offered by the PHY to the MAC.
void SetTxModeGain(uint8_t txMode, double gain)
Definition: lte-ue-phy.cc:1393
State
The states of the UE PHY entity.
Definition: lte-ue-phy.h:61
Ptr< LteUePowerControl > m_powerControl
Pointer to UE Uplink Power Control entity.
Definition: lte-ue-phy.h:347
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:411
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:454
uint8_t m_transmissionMode
Definition: lte-ue-phy.h:369
EventId m_sendSrsEvent
Definition: lte-ue-phy.h:465
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1433
bool m_pssReceived
Definition: lte-ue-phy.h:402
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Definition: lte-ue-phy.cc:1329
void DoSetTransmissionMode(uint8_t txMode)
Definition: lte-ue-phy.cc:1321
Template for the implementation of the LteUeCphySapProvider as a member of an owner class of type C t...
double m_pssReceptionThreshold
The RsrqUeMeasThreshold attribute.
Definition: lte-ue-phy.h:415
TracedCallback< uint16_t, uint16_t, double, double, bool > m_reportUeMeasurements
The ReportUeMeasurements trace source.
Definition: lte-ue-phy.h:463
void DoSynchronizeWithEnb(uint16_t cellId)
Definition: lte-ue-phy.cc:1242
Time m_ueMeasurementsFilterLast
Definition: lte-ue-phy.h:437
uint8_t rsrpNum
Number of RSRP samples.
Definition: lte-ue-phy.h:421
LteUeCphySapUser * m_ueCphySapUser
Definition: lte-ue-phy.h:365
void DoSetDlBandwidth(uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1265
uint16_t m_rsrpSinrSamplePeriod
The RsrpSinrSamplePeriod attribute.
Definition: lte-ue-phy.h:454
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
void SetLteUePhySapUser(LteUePhySapUser *s)
Set the PHY SAP User.
Definition: lte-ue-phy.cc:328
void DoConfigureReferenceSignalPower(int8_t referenceSignalPower)
Definition: lte-ue-phy.cc:1304
void SetTxMode3Gain(double gain)
Definition: lte-ue-phy.cc:1362
Ptr< DlCqiLteControlMessage > CreateDlCqiFeedbackMessage(const SpectrumValue &sinr)
Create the DL CQI feedback from SINR values perceived at the physical layer with the signal received ...
Definition: lte-ue-phy.cc:699
void SetTxMode4Gain(double gain)
Definition: lte-ue-phy.cc:1368
void SwitchToState(State s)
Switch the UE PHY to the given state.
Definition: lte-ue-phy.cc:1448
TracedCallback< uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
Definition: lte-ue-phy.h:388
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:1166
bool m_rsInterferencePowerUpdated
Definition: lte-ue-phy.h:396
void SetTxMode7Gain(double gain)
Definition: lte-ue-phy.cc:1386
Ptr< LteUePowerControl > GetUplinkPowerControl() const
Definition: lte-ue-phy.cc:386
void DoSetPa(double pa)
Definition: lte-ue-phy.cc:1343
#define list
See section 4.3.23 dlInfoListElement.
double rsrpSum
Sum of RSRP sample values in linear unit.
Definition: lte-ue-phy.h:420
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Definition: lte-ue-phy.cc:848
virtual void ReportDataInterference(const SpectrumValue &interf)
Definition: lte-ue-phy.cc:665
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1423
bool m_enableUplinkPowerControl
The EnableUplinkPowerControl attribute.
Definition: lte-ue-phy.h:345
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< LteHarqPhy > m_harqPhyModule
Definition: lte-ue-phy.h:439
void DoStartCellSearch(uint16_t dlEarfcn)
Definition: lte-ue-phy.cc:1225
uint16_t m_rsrpSinrSampleCounter
Definition: lte-ue-phy.h:455
void(* StateTracedCallback)(const uint16_t cellId, const uint16_t rnti, const State oldState, const State newState)
TracedCallback signature for state transition events.
Definition: lte-ue-phy.h:247
SpectrumValue m_rsReceivedPower
Definition: lte-ue-phy.h:394
double GetTxPower() const
Definition: lte-ue-phy.cc:379
double rsrqSum
Sum of RSRQ sample values in linear unit.
Definition: lte-ue-phy.h:422
uint16_t m_srsSubframeOffset
Definition: lte-ue-phy.h:373
Time m_srsStartTime
Definition: lte-ue-phy.h:375
uint8_t m_subframeNo
Definition: lte-ue-phy.h:391
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:1075
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-ue-phy.cc:302
void SetTxMode1Gain(double gain)
Definition: lte-ue-phy.cc:1350
std::vector< int > m_subChannelsForTransmission
A list of sub channels to use in TX.
Definition: lte-ue-phy.h:332
Time m_p10CqiPeriocity
Wideband Periodic CQI. 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
Definition: lte-ue-phy.h:350
uint32_t m_raRnti
Definition: lte-ue-phy.h:442
bool m_dlConfigured
Definition: lte-ue-phy.h:379
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
Definition: lte-ue-phy.h:336
Time m_a30CqiPeriocity
SubBand Aperiodic CQI.
Definition: lte-ue-phy.h:358
LteUeCphySapProvider * m_ueCphySapProvider
Definition: lte-ue-phy.h:364
std::map< uint16_t, UeMeasurementsElement > m_ueMeasurementsMap
Store measurement results during the last layer-1 filtering period.
Definition: lte-ue-phy.h:430
An identifier for simulation events.
Definition: event-id.h:53
std::vector< int > m_subChannelsForReception
A list of sub channels to use in RX.
Definition: lte-ue-phy.h:334
Service Access Point (SAP) offered by the UE-PHY to the UE-MAC.
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
Definition: lte-ue-phy.cc:862
void SetTxPower(double pow)
Definition: lte-ue-phy.cc:371
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:1014
uint16_t m_srsPeriodicity
Definition: lte-ue-phy.h:372
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:335
State GetState() const
Definition: lte-ue-phy.cc:1440
uint32_t m_raPreambleId
Definition: lte-ue-phy.h:441
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:343
SpectrumValue m_rsInterferencePower
Definition: lte-ue-phy.h:397
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:420
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-ue-phy.cc:840
bool m_rsReceivedPowerUpdated
Definition: lte-ue-phy.h:393
void GenerateCqiRsrpRsrq(const SpectrumValue &sinr)
internal method that takes care of generating CQI reports, calculating the RSRP and RSRQ metrics...
Definition: lte-ue-phy.cc:480
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:172
The LteSpectrumPhy models the physical layer of LTE.
Definition: lte-ue-phy.h:51
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-ue-phy.cc:399
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-ue-phy.cc:674
Time m_p10CqiLast
Definition: lte-ue-phy.h:351
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:350
State m_state
The current UE PHY state.
Definition: lte-ue-phy.h:383
Set of values corresponding to a given SpectrumModel.
a unique identifier for an interface.
Definition: type-id.h:57
uint16_t m_rnti
Definition: lte-ue-phy.h:367
bool m_dataInterferencePowerUpdated
Definition: lte-ue-phy.h:399
void SetNoiseFigure(double nf)
Definition: lte-ue-phy.cc:357
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
The UlPhyTransmission trace source.
Definition: lte-ue-phy.h:472
static TypeId GetTypeId(void)
Definition: lte-ue-phy.cc:189
Ptr< LteAmc > m_amc
Definition: lte-ue-phy.h:339
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:52
void ReportUeMeasurements()
Layer-1 filtering of RSRP and RSRQ measurements and reporting to the RRC entity.
Definition: lte-ue-phy.cc:799
virtual void ReportInterference(const SpectrumValue &interf)
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-ue-phy.cc:657
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:462
Ptr< SpectrumValue > m_noisePsd
Noise power spectral density for the configured bandwidth.
Definition: lte-ue-phy.h:475
void DoSetRnti(uint16_t rnti)
Definition: lte-ue-phy.cc:1311
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:438
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-ue-phy.cc:178
Time m_ueMeasurementsFilterPeriod
The UeMeasurementsFilterPeriod attribute.
Definition: lte-ue-phy.h:435