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 
36 
37 namespace ns3 {
38 
39 class PacketBurst;
40 class LteEnbPhy;
41 class LteHarqPhy;
42 
43 
49 class LteUePhy : public LtePhy
50 {
51 
54 
55 public:
59  LteUePhy ();
60 
67 
68  virtual ~LteUePhy ();
69 
70  // inherited from Object
71  static TypeId GetTypeId (void);
72  virtual void DoInitialize (void);
73  virtual void DoDispose (void);
74 
80 
86 
92 
98 
99 
103  void SetTxPower (double pow);
104 
108  double GetTxPower () const;
112  void SetNoiseFigure (double pow);
113 
117  double GetNoiseFigure () const;
118 
122  uint8_t GetMacChDelay (void) const;
123 
128 
133 
134 
140 
145  void SetSubChannelsForTransmission (std::vector <int> mask);
150  std::vector <int> GetSubChannelsForTransmission (void);
151 
156  void SetSubChannelsForReception (std::vector <int> mask);
161  std::vector <int> GetSubChannelsForReception (void);
162 
163 
170 
171 
172 
173  // inherited from LtePhy
174  virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
175  virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
176  virtual void ReportInterference (const SpectrumValue& interf);
177  virtual void ReportRsReceivedPower (const SpectrumValue& power);
178 
179  // callbacks for LteSpectrumPhy
181  virtual void ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p);
182 
183 
184 
185 
186 
190  void PhyPduReceived (Ptr<Packet> p);
191 
192 
199  void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
200 
201 
205  void SendSrs ();
206 
211 
215  void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
216 
217 
218 
219 
220 private:
221 
222  void SetTxMode1Gain (double gain);
223  void SetTxMode2Gain (double gain);
224  void SetTxMode3Gain (double gain);
225  void SetTxMode4Gain (double gain);
226  void SetTxMode5Gain (double gain);
227  void SetTxMode6Gain (double gain);
228  void SetTxMode7Gain (double gain);
229  void SetTxModeGain (uint8_t txMode, double gain);
230 
231  void QueueSubChannelsForTransmission (std::vector <int> rbMap);
232 
233  void ReportUeMeasurements ();
234 
235  // UE CPHY SAP methods
236  void DoReset ();
237  void DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
238  void DoSetDlBandwidth (uint8_t ulBandwidth);
239  void DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
240  void DoSetRnti (uint16_t rnti);
241  void DoSetTransmissionMode (uint8_t txMode);
242  void DoSetSrsConfigurationIndex (uint16_t srcCi);
243 
244  // UE PHY SAP methods
245  virtual void DoSendMacPdu (Ptr<Packet> p);
247  virtual void DoSendRachPreamble (uint32_t prachId, uint32_t raRnti);
248 
249  std::vector <int> m_subChannelsForTransmission;
250  std::vector <int> m_subChannelsForReception;
251 
252  std::vector< std::vector <int> > m_subChannelsForTransmissionQueue;
253 
254 
256 
259 
261  // NOTE defines a periodicity for academic studies
264 
267 
270 
271  uint16_t m_rnti;
272 
274  std::vector <double> m_txModeGain;
275 
278  uint16_t m_srsConfigured;
280 
283 
284  uint8_t m_subframeNo;
285 
288 
291 
293  struct PssElement
294  {
295  uint16_t cellId;
296  double pssPsdSum;
297  uint16_t nRB;
298  };
299  std::list <PssElement> m_pssList;
300 
301  double m_pssReceptionThreshold; // on RSRQ [W]
302 
304  {
305  double rsrpSum;
306  uint8_t rsrpNum;
307  double rsrqSum;
308  uint8_t rsrqNum;
309  };
310 
311  std::map <uint16_t, UeMeasurementsElement> m_UeMeasurementsMap;
314 
316 
317  uint32_t m_raPreambleId;
318  uint32_t m_raRnti;
319 
327 
333 
335 
341 
342 };
343 
344 
345 }
346 
347 #endif /* LTE_UE_PHY_H */
double GetNoiseFigure() const
Definition: lte-ue-phy.cc:306
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-ue-phy.cc:340
SpectrumValue m_rsIntereferencePower
Definition: lte-ue-phy.h:290
uint16_t m_srsConfigured
Definition: lte-ue-phy.h:278
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
LteUePhySapUser * m_uePhySapUser
Definition: lte-ue-phy.h:266
void SetNoiseFigure(double pow)
Definition: lte-ue-phy.cc:299
void SetTxMode5Gain(double gain)
Definition: lte-ue-phy.cc:1124
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)
Definition: lte-ue-phy.cc:535
std::list< PssElement > m_pssList
Definition: lte-ue-phy.h:299
void SetTxMode2Gain(double gain)
Definition: lte-ue-phy.cc:1106
bool m_ulConfigured
Definition: lte-ue-phy.h:282
uint8_t GetMacChDelay(void) const
Definition: lte-ue-phy.cc:328
void DoConfigureUplink(uint16_t ulEarfcn, uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1061
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:381
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
Definition: lte-ue-phy.cc:407
TracedCallback< uint16_t, uint16_t, double, double > m_reportCurrentCellRsrpSinrTrace
Definition: lte-ue-phy.h:324
Time m_a30CqiLast
Definition: lte-ue-phy.h:263
void DoSyncronizeWithEnb(uint16_t cellId, uint16_t dlEarfcn)
Definition: lte-ue-phy.cc:1011
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:361
LteUePhySapProvider * m_uePhySapProvider
Definition: lte-ue-phy.h:265
void SetTxMode6Gain(double gain)
Definition: lte-ue-phy.cc:1130
std::vector< double > m_txModeGain
Definition: lte-ue-phy.h:274
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
Definition: lte-ue-phy.cc:875
void SetTxModeGain(uint8_t txMode, double gain)
Definition: lte-ue-phy.cc:1143
std::map< uint16_t, UeMeasurementsElement > m_UeMeasurementsMap
Definition: lte-ue-phy.h:311
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:346
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:389
uint8_t m_transmissionMode
Definition: lte-ue-phy.h:273
EventId m_sendSrsEvent
Definition: lte-ue-phy.h:334
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1183
bool m_pssReceived
Definition: lte-ue-phy.h:292
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Definition: lte-ue-phy.cc:1085
void DoSetTransmissionMode(uint8_t txMode)
Definition: lte-ue-phy.cc:1077
double m_pssReceptionThreshold
Definition: lte-ue-phy.h:301
TracedCallback< uint16_t, uint16_t, double, double, bool > m_reportUeMeasurements
Definition: lte-ue-phy.h:332
Time m_ueMeasurementsFilterLast
Definition: lte-ue-phy.h:313
LteUeCphySapUser * m_ueCphySapUser
Definition: lte-ue-phy.h:269
void DoSetDlBandwidth(uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1030
uint16_t m_rsrpSinrSamplePeriod
Definition: lte-ue-phy.h:325
void SetLteUePhySapUser(LteUePhySapUser *s)
Set the PHY SAP User.
Definition: lte-ue-phy.cc:270
void SetTxMode3Gain(double gain)
Definition: lte-ue-phy.cc:1112
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:559
void SetTxMode4Gain(double gain)
Definition: lte-ue-phy.cc:1118
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:960
bool m_rsInterferencePowerUpdated
Definition: lte-ue-phy.h:289
void SetTxMode7Gain(double gain)
Definition: lte-ue-phy.cc:1136
#define list
See section 4.3.23 dlInfoListElement.
void DoReset()
Definition: lte-ue-phy.cc:976
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Definition: lte-ue-phy.cc:694
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1173
Ptr< LteHarqPhy > m_harqPhyModule
Definition: lte-ue-phy.h:315
uint16_t m_rsrpSinrSampleCounter
Definition: lte-ue-phy.h:326
SpectrumValue m_rsReceivedPower
Definition: lte-ue-phy.h:287
double GetTxPower() const
Definition: lte-ue-phy.cc:320
uint16_t m_srsSubframeOffset
Definition: lte-ue-phy.h:277
Time m_srsStartTime
Definition: lte-ue-phy.h:279
uint8_t m_subframeNo
Definition: lte-ue-phy.h:284
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:882
virtual void DoInitialize(void)
Definition: lte-ue-phy.cc:263
void SetTxMode1Gain(double gain)
Definition: lte-ue-phy.cc:1100
std::vector< int > m_subChannelsForTransmission
Definition: lte-ue-phy.h:249
Time m_p10CqiPeriocity
Definition: lte-ue-phy.h:257
uint32_t m_raRnti
Definition: lte-ue-phy.h:318
bool m_dlConfigured
Definition: lte-ue-phy.h:281
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
Definition: lte-ue-phy.h:252
Time m_a30CqiPeriocity
Definition: lte-ue-phy.h:262
LteUeCphySapProvider * m_ueCphySapProvider
Definition: lte-ue-phy.h:268
an identifier for simulation events.
Definition: event-id.h:46
std::vector< int > m_subChannelsForReception
Definition: lte-ue-phy.h:250
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
Definition: lte-ue-phy.cc:708
void SetTxPower(double pow)
Definition: lte-ue-phy.cc:313
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:847
uint16_t m_srsPeriodicity
Definition: lte-ue-phy.h:276
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:277
uint32_t m_raPreambleId
Definition: lte-ue-phy.h:317
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:285
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:355
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-ue-phy.cc:686
bool m_rsReceivedPowerUpdated
Definition: lte-ue-phy.h:286
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:147
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-ue-phy.cc:334
virtual void ReportRsReceivedPower(const SpectrumValue &power)
Definition: lte-ue-phy.cc:549
Time m_p10CqiLast
Definition: lte-ue-phy.h:258
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:292
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:271
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
Definition: lte-ue-phy.h:340
static TypeId GetTypeId(void)
Definition: lte-ue-phy.cc:164
Ptr< LteAmc > m_amc
Definition: lte-ue-phy.h:255
void ReportUeMeasurements()
Definition: lte-ue-phy.cc:659
virtual void ReportInterference(const SpectrumValue &interf)
Definition: lte-ue-phy.cc:541
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:397
void DoSetRnti(uint16_t rnti)
Definition: lte-ue-phy.cc:1070
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:373
virtual void DoDispose(void)
Definition: lte-ue-phy.cc:153
Time m_ueMeasurementsFilterPeriod
Definition: lte-ue-phy.h:312