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 
58 
59 public:
63  enum State
64  {
68  };
69 
73  LteUePhy ();
74 
81 
82  virtual ~LteUePhy ();
83 
88  static TypeId GetTypeId (void);
89  // inherited from Object
90  virtual void DoInitialize (void);
91  virtual void DoDispose (void);
92 
98 
104 
110 
116 
117 
121  void SetTxPower (double pow);
122 
126  double GetTxPower () const;
127 
132 
136  void SetNoiseFigure (double nf);
137 
141  double GetNoiseFigure () const;
142 
146  uint8_t GetMacChDelay (void) const;
147 
152 
157 
163 
168  void SetSubChannelsForTransmission (std::vector <int> mask);
173  std::vector <int> GetSubChannelsForTransmission (void);
174 
179  void SetSubChannelsForReception (std::vector <int> mask);
184  std::vector <int> GetSubChannelsForReception (void);
185 
193 
194 
195 
196  // inherited from LtePhy
197  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
198  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
204  virtual void GenerateMixedCqiReport (const SpectrumValue& sinr);
205  virtual void ReportInterference (const SpectrumValue& interf);
211  virtual void ReportDataInterference (const SpectrumValue& interf);
212  virtual void ReportRsReceivedPower (const SpectrumValue& power);
213 
214  // callbacks for LteSpectrumPhy
227  virtual void ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p);
228 
229 
234  void PhyPduReceived (Ptr<Packet> p);
235 
236 
243  void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
244 
245 
249  void SendSrs ();
250 
256 
261  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
262 
266  State GetState () const;
267 
276  typedef void (* StateTracedCallback)
277  (uint16_t cellId, uint16_t rnti, State oldState, State newState);
278 
288  typedef void (* RsrpSinrTracedCallback)
289  (uint16_t cellId, uint16_t rnti,
290  double rsrp, double sinr, uint8_t componentCarrierId);
291 
302  typedef void (* RsrpRsrqTracedCallback)
303  (uint16_t rnti, uint16_t cellId, double rsrp, double rsrq,
304  bool isServingCell, uint8_t componentCarrierId);
305 
306 private:
307 
313  void SetTxMode1Gain (double gain);
319  void SetTxMode2Gain (double gain);
325  void SetTxMode3Gain (double gain);
331  void SetTxMode4Gain (double gain);
337  void SetTxMode5Gain (double gain);
343  void SetTxMode6Gain (double gain);
349  void SetTxMode7Gain (double gain);
356  void SetTxModeGain (uint8_t txMode, double gain);
357 
363  void QueueSubChannelsForTransmission (std::vector <int> rbMap);
364 
365 
372  void GenerateCqiRsrpRsrq (const SpectrumValue& sinr);
373 
374 
382  void ReportUeMeasurements ();
383 
388  void SwitchToState (State s);
389 
390  // UE CPHY SAP methods
392  void DoReset ();
397  void DoStartCellSearch (uint32_t dlEarfcn);
402  void DoSynchronizeWithEnb (uint16_t cellId);
408  void DoSynchronizeWithEnb (uint16_t cellId, uint32_t dlEarfcn);
413  void DoSetDlBandwidth (uint8_t dlBandwidth);
419  void DoConfigureUplink (uint32_t ulEarfcn, uint8_t ulBandwidth);
424  void DoConfigureReferenceSignalPower (int8_t referenceSignalPower);
429  void DoSetRnti (uint16_t rnti);
434  void DoSetTransmissionMode (uint8_t txMode);
439  void DoSetSrsConfigurationIndex (uint16_t srcCi);
444  void DoSetPa (double pa);
445 
446  // UE PHY SAP methods
447  virtual void DoSendMacPdu (Ptr<Packet> p);
458  virtual void DoSendRachPreamble (uint32_t prachId, uint32_t raRnti);
459 
461  std::vector <int> m_subChannelsForTransmission;
463  std::vector <int> m_subChannelsForReception;
464 
465  std::vector< std::vector <int> > m_subChannelsForTransmissionQueue;
466 
467 
469 
477 
481 
489 
492 
495 
496  uint16_t m_rnti;
497 
499  std::vector <double> m_txModeGain;
500 
501  uint16_t m_srsPeriodicity;
503  uint16_t m_srsConfigured;
505 
506  double m_paLinear;
507 
510 
518 
520  uint8_t m_subframeNo;
521 
524 
527 
530 
532  struct PssElement
534  {
535  uint16_t cellId;
536  double pssPsdSum;
537  uint16_t nRB;
538  };
539  std::list <PssElement> m_pssList;
540 
546 
549  {
550  double rsrpSum;
551  uint8_t rsrpNum;
552  double rsrqSum;
553  uint8_t rsrqNum;
554  };
555 
560  std::map <uint16_t, UeMeasurementsElement> m_ueMeasurementsMap;
568 
570 
571  uint32_t m_raPreambleId;
572  uint32_t m_raRnti;
573 
590 
598 
600 
607 
608 
610 
612 }; // end of `class LteUePhy`
613 
614 
615 }
616 
617 #endif /* LTE_UE_PHY_H */
uint16_t m_srsConfigured
SRS configured.
Definition: lte-ue-phy.h:503
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
UeMemberLteUePhySapProvider class.
Definition: lte-ue-phy.cc:74
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-ue-phy.cc:410
double pssPsdSum
PSS PSD sum.
Definition: lte-ue-phy.h:536
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:614
LteUePhySapUser * m_uePhySapUser
UE Phy SAP user.
Definition: lte-ue-phy.h:491
void SetTxMode5Gain(double gain)
Set transmit mode 5 gain function.
Definition: lte-ue-phy.cc:1383
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:608
std::list< PssElement > m_pssList
PSS list.
Definition: lte-ue-phy.h:539
void SetTxMode2Gain(double gain)
Set transmit mode 2 gain function.
Definition: lte-ue-phy.cc:1365
uint16_t cellId
cell ID
Definition: lte-ue-phy.h:535
bool m_ulConfigured
UL configured?
Definition: lte-ue-phy.h:509
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:451
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:477
TracedCallback< uint16_t, uint16_t, double, double, bool, uint8_t > m_reportUeMeasurements
The ReportUeMeasurements trace source.
Definition: lte-ue-phy.h:597
Time m_a30CqiLast
last aperiodic CQI
Definition: lte-ue-phy.h:488
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:431
double m_paLinear
PA linear.
Definition: lte-ue-phy.h:506
LteUePhySapProvider * m_uePhySapProvider
UE Phy SAP provider.
Definition: lte-ue-phy.h:490
uint8_t rsrqNum
Number of RSRQ samples.
Definition: lte-ue-phy.h:553
void SetTxMode6Gain(double gain)
Set transmit mode 6 gain function.
Definition: lte-ue-phy.cc:1389
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
std::vector< double > m_txModeGain
the transmit mode gain
Definition: lte-ue-phy.h:499
Summary results of measuring a specific cell. Used for layer-1 filtering.
Definition: lte-ue-phy.h:548
SpectrumValue m_dataInterferencePower
data interference power
Definition: lte-ue-phy.h:529
uint8_t GetMacChDelay(void) const
Definition: lte-ue-phy.cc:398
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
queue subchannels for transmission function
Definition: lte-ue-phy.cc:1077
Service Access Point (SAP) offered by the PHY to the MAC.
void SetTxModeGain(uint8_t txMode, double gain)
Set transmit mode gain function.
Definition: lte-ue-phy.cc:1402
Ptr< LteUePowerControl > m_powerControl
Pointer to UE Uplink Power Control entity.
Definition: lte-ue-phy.h:476
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:416
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:459
uint8_t m_transmissionMode
the transmission mode
Definition: lte-ue-phy.h:498
EventId m_sendSrsEvent
send SRS event
Definition: lte-ue-phy.h:599
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1442
bool m_pssReceived
PSS received?
Definition: lte-ue-phy.h:531
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Set SRS configuration index function.
Definition: lte-ue-phy.cc:1338
State
The states of the UE PHY entity.
Definition: lte-ue-phy.h:63
void DoSetTransmissionMode(uint8_t txMode)
Set transmission mode function.
Definition: lte-ue-phy.cc:1330
void DoConfigureUplink(uint32_t ulEarfcn, uint8_t ulBandwidth)
Configure UL uplink function.
Definition: lte-ue-phy.cc:1305
Template for the implementation of the LteUeCphySapProvider as a member of an owner class of type C t...
void(* StateTracedCallback)(uint16_t cellId, uint16_t rnti, State oldState, State newState)
TracedCallback signature for state transition events.
Definition: lte-ue-phy.h:277
double m_pssReceptionThreshold
The RsrqUeMeasThreshold attribute.
Definition: lte-ue-phy.h:545
void DoSynchronizeWithEnb(uint16_t cellId)
Synchronize with ENB function.
Definition: lte-ue-phy.cc:1251
Time m_ueMeasurementsFilterLast
Definition: lte-ue-phy.h:567
uint8_t rsrpNum
Number of RSRP samples.
Definition: lte-ue-phy.h:551
LteUeCphySapUser * m_ueCphySapUser
UE CPhy SAP user.
Definition: lte-ue-phy.h:494
uint16_t m_rsrpSinrSamplePeriod
The RsrpSinrSamplePeriod attribute.
Definition: lte-ue-phy.h:584
double GetNoiseFigure() const
Definition: lte-ue-phy.cc:369
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:333
void DoConfigureReferenceSignalPower(int8_t referenceSignalPower)
Configure reference signal power function.
Definition: lte-ue-phy.cc:1313
void SetTxMode3Gain(double gain)
Set transmit mode 3 gain function.
Definition: lte-ue-phy.cc:1371
PssElement structure.
Definition: lte-ue-phy.h:533
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:704
void SetTxMode4Gain(double gain)
Set transmit mode 4 gain function.
Definition: lte-ue-phy.cc:1377
void SwitchToState(State s)
Switch the UE PHY to the given state.
Definition: lte-ue-phy.cc:1457
TracedCallback< uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
Definition: lte-ue-phy.h:517
TracedCallback< uint16_t, uint16_t, double, double, uint8_t > m_reportCurrentCellRsrpSinrTrace
The ReportCurrentCellRsrpSinr trace source.
Definition: lte-ue-phy.h:579
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:1175
bool m_rsInterferencePowerUpdated
RS interference power updated?
Definition: lte-ue-phy.h:525
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-ue-phy.cc:404
void SetTxMode7Gain(double gain)
Set transmit mode 7 gain function.
Definition: lte-ue-phy.cc:1395
void DoSetPa(double pa)
Set PA function.
Definition: lte-ue-phy.cc:1352
#define list
See section 4.3.23 dlInfoListElement.
void DoReset()
Reset function.
Definition: lte-ue-phy.cc:1197
double rsrpSum
Sum of RSRP sample values in linear unit.
Definition: lte-ue-phy.h:550
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Send RACH preamble function.
Definition: lte-ue-phy.cc:855
virtual void ReportDataInterference(const SpectrumValue &interf)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:670
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1432
bool m_enableUplinkPowerControl
The EnableUplinkPowerControl attribute.
Definition: lte-ue-phy.h:474
double GetTxPower() const
Definition: lte-ue-phy.cc:384
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< LteHarqPhy > m_harqPhyModule
HARQ phy module.
Definition: lte-ue-phy.h:569
uint16_t m_rsrpSinrSampleCounter
The RsrpSinrSampleCounter attribute.
Definition: lte-ue-phy.h:589
SpectrumValue m_rsReceivedPower
RS receive power.
Definition: lte-ue-phy.h:523
double rsrqSum
Sum of RSRQ sample values in linear unit.
Definition: lte-ue-phy.h:552
uint16_t m_srsSubframeOffset
SRS subframe offset.
Definition: lte-ue-phy.h:502
Time m_srsStartTime
SRS start time.
Definition: lte-ue-phy.h:504
uint8_t m_subframeNo
Definition: lte-ue-phy.h:520
void(* RsrpRsrqTracedCallback)(uint16_t rnti, uint16_t cellId, double rsrp, double rsrq, bool isServingCell, uint8_t componentCarrierId)
TracedCallback signature for cell RSRP and RSRQ.
Definition: lte-ue-phy.h:303
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:1084
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-ue-phy.cc:307
void DoSetDlBandwidth(uint8_t dlBandwidth)
Set DL bandwidth function.
Definition: lte-ue-phy.cc:1274
Time m_a30CqiPeriodicity
SubBand Aperiodic CQI.
Definition: lte-ue-phy.h:487
void SetTxMode1Gain(double gain)
Set transmit mode 1 gain function.
Definition: lte-ue-phy.cc:1359
std::vector< int > m_subChannelsForTransmission
A list of sub channels to use in TX.
Definition: lte-ue-phy.h:461
void DoStartCellSearch(uint32_t dlEarfcn)
Start the cell search function.
Definition: lte-ue-phy.cc:1234
uint32_t m_raRnti
RA rnti.
Definition: lte-ue-phy.h:572
bool m_dlConfigured
DL configured?
Definition: lte-ue-phy.h:508
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
Receive LTE control message list function.
Definition: lte-ue-phy.cc:869
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
subchannels for transmission queue
Definition: lte-ue-phy.h:465
LteUeCphySapProvider * m_ueCphySapProvider
UE CPhy SAP provider.
Definition: lte-ue-phy.h:493
uint16_t nRB
number of RB
Definition: lte-ue-phy.h:537
std::map< uint16_t, UeMeasurementsElement > m_ueMeasurementsMap
Store measurement results during the last layer-1 filtering period.
Definition: lte-ue-phy.h:560
An identifier for simulation events.
Definition: event-id.h:53
State GetState() const
Definition: lte-ue-phy.cc:1449
std::vector< int > m_subChannelsForReception
A list of sub channels to use in RX.
Definition: lte-ue-phy.h:463
Service Access Point (SAP) offered by the UE-PHY to the UE-MAC.
void SetTxPower(double pow)
Definition: lte-ue-phy.cc:376
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Receive PSS function.
Definition: lte-ue-phy.cc:1023
uint16_t m_srsPeriodicity
SRS periodicity.
Definition: lte-ue-phy.h:501
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:340
uint32_t m_raPreambleId
RA preamble ID.
Definition: lte-ue-phy.h:571
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:348
SpectrumValue m_rsInterferencePower
RS interference power.
Definition: lte-ue-phy.h:526
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:425
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE control message function.
Definition: lte-ue-phy.cc:847
bool m_rsReceivedPowerUpdated
RS receive power updated?
Definition: lte-ue-phy.h:522
Ptr< LteUePowerControl > GetUplinkPowerControl() const
Definition: lte-ue-phy.cc:391
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:485
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:177
The LteSpectrumPhy models the physical layer of LTE.
Definition: lte-ue-phy.h:51
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:679
Time m_p10CqiLast
last periodic CQI
Definition: lte-ue-phy.h:480
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:355
State m_state
The current UE PHY state.
Definition: lte-ue-phy.h:512
Set of values corresponding to a given SpectrumModel.
a unique identifier for an interface.
Definition: type-id.h:58
uint16_t m_rnti
the RNTI
Definition: lte-ue-phy.h:496
bool m_dataInterferencePowerUpdated
data interference power updated?
Definition: lte-ue-phy.h:528
void SetNoiseFigure(double nf)
Definition: lte-ue-phy.cc:362
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
The UlPhyTransmission trace source.
Definition: lte-ue-phy.h:606
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-ue-phy.cc:194
Time m_p10CqiPeriodicity
Wideband Periodic CQI. 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
Definition: lte-ue-phy.h:479
Ptr< LteAmc > m_amc
AMC.
Definition: lte-ue-phy.h:468
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:804
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:662
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:467
Ptr< SpectrumValue > m_noisePsd
Noise power spectral density for the configured bandwidth.
Definition: lte-ue-phy.h:609
void DoSetRnti(uint16_t rnti)
Set RNTI function.
Definition: lte-ue-phy.cc:1320
void(* RsrpSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
TracedCallback signature for cell RSRP and SINR report.
Definition: lte-ue-phy.h:289
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:443
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-ue-phy.cc:183
Time m_ueMeasurementsFilterPeriod
The UeMeasurementsFilterPeriod attribute.
Definition: lte-ue-phy.h:565