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 */