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 
42 namespace ns3 {
43 
44 struct TbId_t
45 {
46  uint16_t m_rnti;
47  uint8_t m_layer;
48 
49  public:
50  TbId_t ();
51  TbId_t (const uint16_t a, const uint8_t b);
52 
53  friend bool operator == (const TbId_t &a, const TbId_t &b);
54  friend bool operator < (const TbId_t &a, const TbId_t &b);
55 };
56 
57 
58 struct tbInfo_t
59 {
60  uint16_t size;
61  uint8_t mcs;
62  std::vector<int> rbBitmap;
63  bool corrupt;
64 };
65 
66 typedef std::map<TbId_t, tbInfo_t> expectedTbs_t;
67 
68 class LteNetDevice;
69 class AntennaModel;
70 
80 {
81 
82 public:
83  LteSpectrumPhy ();
84  virtual ~LteSpectrumPhy ();
85 
89  enum State
90  {
92  };
93 
94  // inherited from Object
95  static TypeId GetTypeId (void);
96  virtual void DoDispose ();
97 
98  // inherited from SpectrumPhy
101  void SetDevice (Ptr<NetDevice> d);
107 
114 
121 
127  void SetAntenna (Ptr<AntennaModel> a);
128 
138  bool StartTx (Ptr<PacketBurst> pb);
139 
140 
148 
156 
164 
169  void SetState (State newState);
170 
176  void SetCellId (uint16_t cellId);
177 
178 
185 
195  void AddExpectedTb (uint16_t rnti, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer);
196 
202  void UpdateSinrPerceived (const SpectrumValue& sinr);
203 
209  void SetTransmissionMode (uint8_t txMode);
210 
211  friend class LteUePhy;
212 
221  int64_t AssignStreams (int64_t stream);
222 
223 private:
224  void ChangeState (State newState);
225  void EndTx ();
226  void EndRx ();
227 
228  void SetTxModeGain (uint8_t txMode, double gain);
229 
230 
234 
236 
240  std::list<Ptr<PacketBurst> > m_rxPacketBurstList;
241 
245 
251 
255 
257 
258  uint16_t m_cellId;
259 
262 
265  bool m_pemEnabled; // when true (default) the phy error model is enabled
266 
267  uint8_t m_transmissionMode; // for UEs: store the transmission mode
268  std::vector <double> m_txModeGain; // duplicate value of LteUePhy
269 
270 };
271 
272 
273 
274 
275 
276 
277 }
278 
279 #endif /* LTE_SPECTRUM_PHY_H */