A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lte-spectrum-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
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: Nicola Baldo <nbaldo@cttc.es>
19  * Giuseppe Piro <g.piro@poliba.it>
20  * Modified by: Marco Miozzo <mmiozzo@cttc.es> (introduce physical error model)
21  */
22 
23 #ifndef LTE_SPECTRUM_PHY_H
24 #define LTE_SPECTRUM_PHY_H
25 
26 #include <ns3/event-id.h>
27 #include <ns3/spectrum-value.h>
28 #include <ns3/mobility-model.h>
29 #include <ns3/packet.h>
30 #include <ns3/nstime.h>
31 #include <ns3/net-device.h>
32 #include <ns3/spectrum-phy.h>
33 #include <ns3/spectrum-channel.h>
34 #include <ns3/spectrum-interference.h>
35 #include <ns3/data-rate.h>
36 #include <ns3/generic-phy.h>
37 #include <ns3/packet-burst.h>
38 #include <ns3/lte-interference.h>
39 #include "ns3/random-variable-stream.h"
40 #include <map>
41 #include <ns3/ff-mac-common.h>
42 
43 namespace ns3 {
44 
45 struct TbId_t
46 {
47  uint16_t m_rnti;
48  uint8_t m_layer;
49 
50  public:
51  TbId_t ();
52  TbId_t (const uint16_t a, const uint8_t b);
53 
54  friend bool operator == (const TbId_t &a, const TbId_t &b);
55  friend bool operator < (const TbId_t &a, const TbId_t &b);
56 };
57 
58 
59 struct tbInfo_t
60 {
61  uint16_t size;
62  uint8_t mcs;
63  std::vector<int> rbBitmap;
64  bool corrupt;
65 };
66 
67 typedef std::map<TbId_t, tbInfo_t> expectedTbs_t;
68 
69 
70 class LteNetDevice;
71 class AntennaModel;
72 class LteControlMessage;
76 
77 
85 
98 
99 
108 
115 
116 
117 
127 {
128 
129 public:
130  LteSpectrumPhy ();
131  virtual ~LteSpectrumPhy ();
132 
136  enum State
137  {
139  };
140 
141  // inherited from Object
142  static TypeId GetTypeId (void);
143  virtual void DoDispose ();
144 
145  // inherited from SpectrumPhy
148  void SetDevice (Ptr<NetDevice> d);
156 
163 
170 
176  void SetAntenna (Ptr<AntennaModel> a);
177 
189  bool StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, Time duration);
190 
202 
203 
213  bool StartTxUlSrsFrame ();
214 
215 
223 
231 
239 
247 
255 
260  void SetState (State newState);
261 
267  void SetCellId (uint16_t cellId);
268 
269 
276 
277 
284 
294  void AddExpectedTb (uint16_t rnti, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer);
295 
301  void UpdateSinrPerceived (const SpectrumValue& sinr);
302 
308  void SetTransmissionMode (uint8_t txMode);
309 
310  friend class LteUePhy;
311 
320  int64_t AssignStreams (int64_t stream);
321 
322 private:
323  void ChangeState (State newState);
324  void EndTx ();
325  void EndRxData ();
326  void EndRxDlCtrl ();
327  void EndRxUlSrs ();
328 
329  void SetTxModeGain (uint8_t txMode, double gain);
330 
331 
335 
337 
341  std::list<Ptr<PacketBurst> > m_rxPacketBurstList;
342 
343  std::list<Ptr<LteControlMessage> > m_txControlMessageList;
344  std::list<Ptr<LteControlMessage> > m_rxControlMessageList;
345 
346 
350 
356 
360 
363 
366 
367  uint16_t m_cellId;
368 
371 
374  bool m_dataErrorModelEnabled; // when true (default) the phy error model is enabled
375  bool m_ctrlErrorModelEnabled; // when true (default) the phy error model is enabled for DL ctrl frame
376 
377  uint8_t m_transmissionMode; // for UEs: store the transmission mode
378  std::vector <double> m_txModeGain; // duplicate value of LteUePhy
379 
380 };
381 
382 
383 
384 
385 
386 
387 }
388 
389 #endif /* LTE_SPECTRUM_PHY_H */