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 
37 
38 namespace ns3 {
39 
40 class PacketBurst;
41 class LteEnbPhy;
42 class LteHarqPhy;
43 
44 
50 class LteUePhy : public LtePhy
51 {
52 
55 
56 public:
60  enum State
61  {
65  };
66 
70  LteUePhy ();
71 
78 
79  virtual ~LteUePhy ();
80 
81  // inherited from Object
82  static TypeId GetTypeId (void);
83  virtual void DoInitialize (void);
84  virtual void DoDispose (void);
85 
91 
97 
103 
109 
110 
114  void SetTxPower (double pow);
115 
119  double GetTxPower () const;
123  void SetNoiseFigure (double nf);
124 
128  double GetNoiseFigure () const;
129 
133  uint8_t GetMacChDelay (void) const;
134 
139 
144 
150 
155  void SetSubChannelsForTransmission (std::vector <int> mask);
160  std::vector <int> GetSubChannelsForTransmission (void);
161 
166  void SetSubChannelsForReception (std::vector <int> mask);
171  std::vector <int> GetSubChannelsForReception (void);
172 
180 
181 
182 
183  // inherited from LtePhy
184  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
185  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
186  virtual void ReportInterference (const SpectrumValue& interf);
187  virtual void ReportRsReceivedPower (const SpectrumValue& power);
188 
189  // callbacks for LteSpectrumPhy
191  virtual void ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p);
192 
193 
194 
198  void PhyPduReceived (Ptr<Packet> p);
199 
200 
207  void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
208 
209 
213  void SendSrs ();
214 
219 
223  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
224 
228  State GetState () const;
229 
230 
231 
232 private:
233 
234  void SetTxMode1Gain (double gain);
235  void SetTxMode2Gain (double gain);
236  void SetTxMode3Gain (double gain);
237  void SetTxMode4Gain (double gain);
238  void SetTxMode5Gain (double gain);
239  void SetTxMode6Gain (double gain);
240  void SetTxMode7Gain (double gain);
241  void SetTxModeGain (uint8_t txMode, double gain);
242 
243  void QueueSubChannelsForTransmission (std::vector <int> rbMap);
244 
252  void ReportUeMeasurements ();
253 
254  void SwitchToState (State s);
255 
256  // UE CPHY SAP methods
257  void DoReset ();
258  void DoStartCellSearch (uint16_t dlEarfcn);
259  void DoSynchronizeWithEnb (uint16_t cellId);
260  void DoSynchronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
261  void DoSetDlBandwidth (uint8_t ulBandwidth);
262  void DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
263  void DoSetRnti (uint16_t rnti);
264  void DoSetTransmissionMode (uint8_t txMode);
265  void DoSetSrsConfigurationIndex (uint16_t srcCi);
266 
267  // UE PHY SAP methods
268  virtual void DoSendMacPdu (Ptr<Packet> p);
270  virtual void DoSendRachPreamble (uint32_t prachId, uint32_t raRnti);
271 
272  std::vector <int> m_subChannelsForTransmission;
273  std::vector <int> m_subChannelsForReception;
274 
275  std::vector< std::vector <int> > m_subChannelsForTransmissionQueue;
276 
277 
279 
282 
284  // NOTE defines a periodicity for academic studies
287 
290 
293 
294  uint16_t m_rnti;
295 
297  std::vector <double> m_txModeGain;
298 
301  uint16_t m_srsConfigured;
303 
306 
308  // cellid rnti
310 
311  uint8_t m_subframeNo;
312 
315 
318 
320  struct PssElement
321  {
322  uint16_t cellId;
323  double pssPsdSum;
324  uint16_t nRB;
325  };
326  std::list <PssElement> m_pssList;
327 
328  double m_pssReceptionThreshold; // on RSRQ [W]
329 
331  {
332  double rsrpSum;
333  uint8_t rsrpNum;
334  double rsrqSum;
335  uint8_t rsrqNum;
336  };
337 
338  std::map <uint16_t, UeMeasurementsElement> m_ueMeasurementsMap;
341 
343 
344  uint32_t m_raPreambleId;
345  uint32_t m_raRnti;
346 
354 
360 
362 
368 
369 };
370 
371 
372 }
373 
374 #endif /* LTE_UE_PHY_H */
double GetNoiseFigure() const
Definition: lte-ue-phy.cc:321
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-ue-phy.cc:355
uint16_t m_srsConfigured
Definition: lte-ue-phy.h:301
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
LteUePhySapUser * m_uePhySapUser
Definition: lte-ue-phy.h:289
void SetTxMode5Gain(double gain)
Definition: lte-ue-phy.cc:1199
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:539
std::list< PssElement > m_pssList
Definition: lte-ue-phy.h:326
void SetTxMode2Gain(double gain)
Definition: lte-ue-phy.cc:1181
bool m_ulConfigured
Definition: lte-ue-phy.h:305
uint8_t GetMacChDelay(void) const
Definition: lte-ue-phy.cc:343
void DoConfigureUplink(uint16_t ulEarfcn, uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1136
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:396
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:422
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:351
Time m_a30CqiLast
Definition: lte-ue-phy.h:286
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:376
LteUePhySapProvider * m_uePhySapProvider
Definition: lte-ue-phy.h:288
void SetTxMode6Gain(double gain)
Definition: lte-ue-phy.cc:1205
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:297
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
Definition: lte-ue-phy.cc:927
Service Access Point (SAP) offered by the PHY to the MAC.
void SetTxModeGain(uint8_t txMode, double gain)
Definition: lte-ue-phy.cc:1218
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:361
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:404
uint8_t m_transmissionMode
Definition: lte-ue-phy.h:296
EventId m_sendSrsEvent
Definition: lte-ue-phy.h:361
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1258
bool m_pssReceived
Definition: lte-ue-phy.h:319
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Definition: lte-ue-phy.cc:1160
State
The states of the UE PHY entity.
Definition: lte-ue-phy.h:60
void DoSetTransmissionMode(uint8_t txMode)
Definition: lte-ue-phy.cc:1152
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:328
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:359
void DoSynchronizeWithEnb(uint16_t cellId)
Definition: lte-ue-phy.cc:1082
Time m_ueMeasurementsFilterLast
Definition: lte-ue-phy.h:340
LteUeCphySapUser * m_ueCphySapUser
Definition: lte-ue-phy.h:292
void DoSetDlBandwidth(uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1105
uint16_t m_rsrpSinrSamplePeriod
Definition: lte-ue-phy.h:352
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:285
void SetTxMode3Gain(double gain)
Definition: lte-ue-phy.cc:1187
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:563
void SetTxMode4Gain(double gain)
Definition: lte-ue-phy.cc:1193
void SwitchToState(State s)
Definition: lte-ue-phy.cc:1273
TracedCallback< uint16_t, uint16_t, State, State > m_stateTransitionTrace
Definition: lte-ue-phy.h:309
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:1013
bool m_rsInterferencePowerUpdated
Definition: lte-ue-phy.h:316
void SetTxMode7Gain(double gain)
Definition: lte-ue-phy.cc:1211
#define list
See section 4.3.23 dlInfoListElement.
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Definition: lte-ue-phy.cc:712
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1248
Ptr< LteHarqPhy > m_harqPhyModule
Definition: lte-ue-phy.h:342
void DoStartCellSearch(uint16_t dlEarfcn)
Definition: lte-ue-phy.cc:1065
uint16_t m_rsrpSinrSampleCounter
Definition: lte-ue-phy.h:353
SpectrumValue m_rsReceivedPower
Definition: lte-ue-phy.h:314
double GetTxPower() const
Definition: lte-ue-phy.cc:335
uint16_t m_srsSubframeOffset
Definition: lte-ue-phy.h:300
Time m_srsStartTime
Definition: lte-ue-phy.h:302
uint8_t m_subframeNo
Definition: lte-ue-phy.h:311
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:934
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: lte-ue-phy.cc:278
void SetTxMode1Gain(double gain)
Definition: lte-ue-phy.cc:1175
std::vector< int > m_subChannelsForTransmission
Definition: lte-ue-phy.h:272
Time m_p10CqiPeriocity
Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
Definition: lte-ue-phy.h:280
uint32_t m_raRnti
Definition: lte-ue-phy.h:345
bool m_dlConfigured
Definition: lte-ue-phy.h:304
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
Definition: lte-ue-phy.h:275
Time m_a30CqiPeriocity
Definition: lte-ue-phy.h:285
LteUeCphySapProvider * m_ueCphySapProvider
Definition: lte-ue-phy.h:291
std::map< uint16_t, UeMeasurementsElement > m_ueMeasurementsMap
Definition: lte-ue-phy.h:338
an identifier for simulation events.
Definition: event-id.h:46
std::vector< int > m_subChannelsForReception
Definition: lte-ue-phy.h:273
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:726
void SetTxPower(double pow)
Definition: lte-ue-phy.cc:328
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:873
uint16_t m_srsPeriodicity
Definition: lte-ue-phy.h:299
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:292
State GetState() const
Definition: lte-ue-phy.cc:1265
uint32_t m_raPreambleId
Definition: lte-ue-phy.h:344
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:300
SpectrumValue m_rsInterferencePower
Definition: lte-ue-phy.h:317
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:370
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-ue-phy.cc:704
bool m_rsReceivedPowerUpdated
Definition: lte-ue-phy.h:313
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:159
The LteSpectrumPhy models the physical layer of LTE.
Definition: lte-ue-phy.h:50
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-ue-phy.cc:349
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:553
Time m_p10CqiLast
SubBand Aperiodic CQI: activated by DCI format 0 or Random Access Response Grant. ...
Definition: lte-ue-phy.h:281
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:307
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:294
void SetNoiseFigure(double nf)
Definition: lte-ue-phy.cc:314
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
Trace information regarding PHY stats from DL Tx perspective PhyTrasmissionStatParameters see lte-com...
Definition: lte-ue-phy.h:367
static TypeId GetTypeId(void)
Definition: lte-ue-phy.cc:176
Ptr< LteAmc > m_amc
Definition: lte-ue-phy.h:278
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:663
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:545
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:412
void DoSetRnti(uint16_t rnti)
Definition: lte-ue-phy.cc:1145
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:388
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:165
Time m_ueMeasurementsFilterPeriod
Definition: lte-ue-phy.h:339