A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
203 
207  void PhyPduReceived (Ptr<Packet> p);
208 
209 
216  void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
217 
218 
222  void SendSrs ();
223 
228 
232  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
233 
237  State GetState () const;
238 
239 
240 
241 private:
242 
243  void SetTxMode1Gain (double gain);
244  void SetTxMode2Gain (double gain);
245  void SetTxMode3Gain (double gain);
246  void SetTxMode4Gain (double gain);
247  void SetTxMode5Gain (double gain);
248  void SetTxMode6Gain (double gain);
249  void SetTxMode7Gain (double gain);
250  void SetTxModeGain (uint8_t txMode, double gain);
251 
252  void QueueSubChannelsForTransmission (std::vector <int> rbMap);
253 
261  void ReportUeMeasurements ();
262 
263  void SwitchToState (State s);
264 
265  // UE CPHY SAP methods
266  void DoReset ();
267  void DoStartCellSearch (uint16_t dlEarfcn);
268  void DoSynchronizeWithEnb (uint16_t cellId);
269  void DoSynchronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
270  void DoSetDlBandwidth (uint8_t ulBandwidth);
271  void DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
272  void DoConfigureReferenceSignalPower (int8_t referenceSignalPower);
273  void DoSetRnti (uint16_t rnti);
274  void DoSetTransmissionMode (uint8_t txMode);
275  void DoSetSrsConfigurationIndex (uint16_t srcCi);
276 
277  // UE PHY SAP methods
278  virtual void DoSendMacPdu (Ptr<Packet> p);
280  virtual void DoSendRachPreamble (uint32_t prachId, uint32_t raRnti);
281 
282  std::vector <int> m_subChannelsForTransmission;
283  std::vector <int> m_subChannelsForReception;
284 
285  std::vector< std::vector <int> > m_subChannelsForTransmissionQueue;
286 
287 
289 
292 
295 
297  // NOTE defines a periodicity for academic studies
300 
303 
306 
307  uint16_t m_rnti;
308 
310  std::vector <double> m_txModeGain;
311 
314  uint16_t m_srsConfigured;
316 
319 
321  // cellid rnti
323 
324  uint8_t m_subframeNo;
325 
328 
331 
334 
336  struct PssElement
337  {
338  uint16_t cellId;
339  double pssPsdSum;
340  uint16_t nRB;
341  };
342  std::list <PssElement> m_pssList;
343 
344  double m_pssReceptionThreshold; // on RSRQ [W]
345 
347  {
348  double rsrpSum;
349  uint8_t rsrpNum;
350  double rsrqSum;
351  uint8_t rsrqNum;
352  };
353 
354  std::map <uint16_t, UeMeasurementsElement> m_ueMeasurementsMap;
357 
359 
360  uint32_t m_raPreambleId;
361  uint32_t m_raRnti;
362 
370 
376 
378 
384 
385 };
386 
387 
388 }
389 
390 #endif /* LTE_UE_PHY_H */
double GetNoiseFigure() const
Definition: lte-ue-phy.cc:330
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-ue-phy.cc:371
uint16_t m_srsConfigured
Definition: lte-ue-phy.h:314
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Definition: lte-ue-phy.cc:569
LteUePhySapUser * m_uePhySapUser
Definition: lte-ue-phy.h:302
void SetTxMode5Gain(double gain)
Definition: lte-ue-phy.cc:1396
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:563
std::list< PssElement > m_pssList
Definition: lte-ue-phy.h:342
void SetTxMode2Gain(double gain)
Definition: lte-ue-phy.cc:1378
bool m_ulConfigured
Definition: lte-ue-phy.h:318
uint8_t GetMacChDelay(void) const
Definition: lte-ue-phy.cc:359
void DoConfigureUplink(uint16_t ulEarfcn, uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1324
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:412
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:438
TracedCallback< uint16_t, uint16_t, double, double > m_reportCurrentCellRsrpSinrTrace
Trace information regarding RSRP and average SINR (see TS 36.214) uint16_t cellId, uint16_t rnti, double rsrp, double sinr.
Definition: lte-ue-phy.h:367
Time m_a30CqiLast
Definition: lte-ue-phy.h:299
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:392
LteUePhySapProvider * m_uePhySapProvider
Definition: lte-ue-phy.h:301
void SetTxMode6Gain(double gain)
Definition: lte-ue-phy.cc:1402
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:310
SpectrumValue m_dataInterferencePower
Definition: lte-ue-phy.h:333
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
Definition: lte-ue-phy.cc:1097
Service Access Point (SAP) offered by the PHY to the MAC.
void SetTxModeGain(uint8_t txMode, double gain)
Definition: lte-ue-phy.cc:1415
Ptr< LteUePowerControl > m_powerControl
Definition: lte-ue-phy.h:291
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:377
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:420
uint8_t m_transmissionMode
Definition: lte-ue-phy.h:309
EventId m_sendSrsEvent
Definition: lte-ue-phy.h:377
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1455
bool m_pssReceived
Definition: lte-ue-phy.h:335
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Definition: lte-ue-phy.cc:1357
State
The states of the UE PHY entity.
Definition: lte-ue-phy.h:61
void DoSetTransmissionMode(uint8_t txMode)
Definition: lte-ue-phy.cc:1349
Template for the implementation of the LteUeCphySapProvider as a member of an owner class of type C t...
double m_pssReceptionThreshold
Definition: lte-ue-phy.h:344
TracedCallback< uint16_t, uint16_t, double, double, bool > m_reportUeMeasurements
Trace information regarding RSRP and RSRQ (see TS 36.214) uint16_t rnti, uint16_t cellId...
Definition: lte-ue-phy.h:375
void DoSynchronizeWithEnb(uint16_t cellId)
Definition: lte-ue-phy.cc:1270
Time m_ueMeasurementsFilterLast
Definition: lte-ue-phy.h:356
LteUeCphySapUser * m_ueCphySapUser
Definition: lte-ue-phy.h:305
void DoSetDlBandwidth(uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1293
uint16_t m_rsrpSinrSamplePeriod
Definition: lte-ue-phy.h:368
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:294
void DoConfigureReferenceSignalPower(int8_t referenceSignalPower)
Definition: lte-ue-phy.cc:1332
void SetTxMode3Gain(double gain)
Definition: lte-ue-phy.cc:1384
Ptr< SampleEmitter > s
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:728
void SetTxMode4Gain(double gain)
Definition: lte-ue-phy.cc:1390
void SwitchToState(State s)
Definition: lte-ue-phy.cc:1470
TracedCallback< uint16_t, uint16_t, State, State > m_stateTransitionTrace
Definition: lte-ue-phy.h:322
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:1195
bool m_rsInterferencePowerUpdated
Definition: lte-ue-phy.h:329
void SetTxMode7Gain(double gain)
Definition: lte-ue-phy.cc:1408
Ptr< LteUePowerControl > GetUplinkPowerControl() const
Definition: lte-ue-phy.cc:352
#define list
See section 4.3.23 dlInfoListElement.
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Definition: lte-ue-phy.cc:877
virtual void ReportDataInterference(const SpectrumValue &interf)
Definition: lte-ue-phy.cc:694
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1445
bool m_enableUplinkPowerControl
Definition: lte-ue-phy.h:290
Ptr< LteHarqPhy > m_harqPhyModule
Definition: lte-ue-phy.h:358
void DoStartCellSearch(uint16_t dlEarfcn)
Definition: lte-ue-phy.cc:1253
uint16_t m_rsrpSinrSampleCounter
Definition: lte-ue-phy.h:369
SpectrumValue m_rsReceivedPower
Definition: lte-ue-phy.h:327
double GetTxPower() const
Definition: lte-ue-phy.cc:345
uint16_t m_srsSubframeOffset
Definition: lte-ue-phy.h:313
Time m_srsStartTime
Definition: lte-ue-phy.h:315
uint8_t m_subframeNo
Definition: lte-ue-phy.h:324
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:1104
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: lte-ue-phy.cc:287
void SetTxMode1Gain(double gain)
Definition: lte-ue-phy.cc:1372
std::vector< int > m_subChannelsForTransmission
Definition: lte-ue-phy.h:282
Time m_p10CqiPeriocity
Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
Definition: lte-ue-phy.h:293
uint32_t m_raRnti
Definition: lte-ue-phy.h:361
bool m_dlConfigured
Definition: lte-ue-phy.h:317
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
Definition: lte-ue-phy.h:285
Time m_a30CqiPeriocity
Definition: lte-ue-phy.h:298
LteUeCphySapProvider * m_ueCphySapProvider
Definition: lte-ue-phy.h:304
std::map< uint16_t, UeMeasurementsElement > m_ueMeasurementsMap
Definition: lte-ue-phy.h:354
an identifier for simulation events.
Definition: event-id.h:46
std::vector< int > m_subChannelsForReception
Definition: lte-ue-phy.h:283
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:891
void SetTxPower(double pow)
Definition: lte-ue-phy.cc:337
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:1043
uint16_t m_srsPeriodicity
Definition: lte-ue-phy.h:312
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:301
State GetState() const
Definition: lte-ue-phy.cc:1462
uint32_t m_raPreambleId
Definition: lte-ue-phy.h:360
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:309
SpectrumValue m_rsInterferencePower
Definition: lte-ue-phy.h:330
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:386
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-ue-phy.cc:869
bool m_rsReceivedPowerUpdated
Definition: lte-ue-phy.h:326
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:163
The LteSpectrumPhy models the physical layer of LTE.
Definition: lte-ue-phy.h:51
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-ue-phy.cc:365
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:703
Time m_p10CqiLast
SubBand Aperiodic CQI: activated by DCI format 0 or Random Access Response Grant. ...
Definition: lte-ue-phy.h:294
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:316
Set of values corresponding to a given SpectrumModel.
a unique identifier for an interface.
Definition: type-id.h:49
uint16_t m_rnti
Definition: lte-ue-phy.h:307
bool m_dataInterferencePowerUpdated
Definition: lte-ue-phy.h:332
void SetNoiseFigure(double nf)
Definition: lte-ue-phy.cc:323
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
Trace information regarding PHY stats from DL Tx perspective PhyTrasmissionStatParameters see lte-com...
Definition: lte-ue-phy.h:383
static TypeId GetTypeId(void)
Definition: lte-ue-phy.cc:180
Ptr< LteAmc > m_amc
Definition: lte-ue-phy.h:288
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:828
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:686
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:428
void DoSetRnti(uint16_t rnti)
Definition: lte-ue-phy.cc:1339
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:404
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-ue-phy.cc:169
Time m_ueMeasurementsFilterPeriod
Definition: lte-ue-phy.h:355