A Discrete-Event Network Simulator
API
wimax-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008 INRIA
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: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  */
20 
21 #ifndef WIMAX_PHY_H
22 #define WIMAX_PHY_H
23 
24 #include <stdint.h>
25 #include <list>
26 #include "ns3/callback.h"
27 #include "ns3/nstime.h"
28 #include "ns3/event-id.h"
29 #include "bvec.h"
30 #include "send-params.h"
31 #include "ns3/log.h"
32 #include "ns3/object.h"
33 #include "ns3/traced-callback.h"
34 
35 namespace ns3 {
36 
37 class WimaxChannel;
38 class WimaxNetDevice;
39 class NetDevice;
40 class Packet;
41 
45 class WimaxPhy : public Object
46 {
47 public:
49  enum ModulationType // Table 356 and 362
50  {
58  };
59 
61  enum PhyState
62  {
67  };
68 
70  enum PhyType
71  {
74  };
75 
80  static TypeId GetTypeId (void);
81  WimaxPhy (void);
82  virtual ~WimaxPhy (void);
91  Ptr<WimaxChannel> GetChannel (void) const;
96  void SetDevice (Ptr<WimaxNetDevice> device);
100  Ptr<NetDevice> GetDevice (void) const;
105  void SetReceiveCallback (Callback<void, Ptr<const PacketBurst> > callback);
114  virtual void Send (SendParams *params) = 0;
119  virtual PhyType GetPhyType (void) const = 0;
125  void SetDuplex (uint64_t rxFrequency, uint64_t txFrequency);
130  void SetSimplex (uint64_t frequency);
135  uint64_t GetRxFrequency (void) const;
140  uint64_t GetTxFrequency (void) const;
145  uint64_t GetScanningFrequency (void) const;
151  void SetNrCarriers (uint8_t nrCarriers);
156  uint8_t GetNrCarriers (void) const;
161  void SetFrameDuration (Time frameDuration);
167  Time GetFrameDurationSec (void) const;
172  Time GetFrameDuration (void) const;
177  void SetFrequency (uint32_t frequency);
182  uint32_t GetFrequency (void) const;
187  void SetChannelBandwidth (uint32_t channelBandwidth);
192  uint32_t GetChannelBandwidth (void) const;
197  uint16_t GetNfft (void) const;
202  double GetSamplingFactor (void) const;
207  double GetSamplingFrequency (void) const;
212  void SetPsDuration (Time psDuration);
217  Time GetPsDuration (void) const;
222  void SetSymbolDuration (Time symbolDuration);
227  Time GetSymbolDuration (void) const;
232  double GetGValue (void) const;
237  void SetPsPerSymbol (uint16_t psPerSymbol);
242  uint16_t GetPsPerSymbol (void) const;
243 
248  void SetPsPerFrame (uint16_t psPerFrame);
253  uint16_t GetPsPerFrame (void) const;
258  void SetSymbolsPerFrame (uint32_t symbolsPerFrame);
263  uint32_t GetSymbolsPerFrame (void) const;
268  bool IsDuplex (void) const;
273  void SetState (PhyState state);
278  PhyState GetState (void) const;
285  void StartScanning (uint64_t frequency, Time timeout, Callback<void, bool, uint64_t> callback);
286 
290  void SetScanningCallback (void) const;
295  EventId GetChnlSrchTimeoutEvent (void) const;
299  void SetDataRates (void);
305  uint32_t GetDataRate (ModulationType modulationType) const;
312  Time GetTransmissionTime (uint32_t size, ModulationType modulationType) const;
319  uint64_t GetNrSymbols (uint32_t size, ModulationType modulationType) const;
326  uint64_t GetNrBytes (uint32_t symbols, ModulationType modulationType) const;
331  uint16_t GetTtg (void) const;
336  uint16_t GetRtg (void) const;
341  uint8_t GetFrameDurationCode (void) const;
347  Time GetFrameDuration (uint8_t frameDurationCode) const;
351  void SetPhyParameters (void);
352  virtual void DoDispose (void);
357  virtual Ptr<Object> GetMobility (void);
362  virtual void SetMobility (Ptr<Object> mobility);
363 
372  virtual int64_t AssignStreams (int64_t stream) = 0;
373 
374 private:
381  void GetModulationFecParams (ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const;
383  void EndScanning (void);
390  virtual Time DoGetTransmissionTime (uint32_t size, ModulationType modulationType) const = 0;
395  virtual void DoAttach (Ptr<WimaxChannel> channel) = 0;
397  virtual void DoSetDataRates (void) = 0;
403  virtual uint32_t DoGetDataRate (ModulationType modulationType) const = 0;
410  virtual uint64_t DoGetNrSymbols (uint32_t size, ModulationType modulationType) const = 0;
417  virtual uint64_t DoGetNrBytes (uint32_t symbols, ModulationType modulationType) const = 0;
422  virtual uint16_t DoGetTtg (void) const = 0;
427  virtual uint16_t DoGetRtg (void) const = 0;
428 
433  virtual uint8_t DoGetFrameDurationCode (void) const = 0;
439  virtual Time DoGetFrameDuration (uint8_t frameDurationCode) const = 0;
443  virtual void DoSetPhyParameters (void) = 0;
448  virtual double DoGetSamplingFactor (void) const = 0;
453  virtual uint16_t DoGetNfft (void) const = 0;
458  virtual double DoGetSamplingFrequency (void) const = 0;
463  virtual double DoGetGValue (void) const = 0;
464 
467 
468  uint64_t m_txFrequency;
469  uint64_t m_rxFrequency;
472  bool m_duplex;
474 
477 
478  uint8_t m_nrCarriers;
480  uint32_t m_frequency;
484  uint16_t m_psPerSymbol;
485  uint16_t m_psPerFrame;
486  uint32_t m_symbolsPerFrame;
488 };
489 
490 } // namespace ns3
491 
492 #endif /* WIMAX_PHY_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::WimaxPhy::SetDataRates
void SetDataRates(void)
calculates the data rate of each modulation and save them for future use
Definition: wimax-phy.cc:222
ns3::WimaxPhy::DoGetRtg
virtual uint16_t DoGetRtg(void) const =0
Get RTG.
ns3::WimaxPhy::SetScanningCallback
void SetScanningCallback(void) const
calls the scanning call back function
Definition: wimax-phy.cc:216
ns3::WimaxPhy::SetFrequency
void SetFrequency(uint32_t frequency)
set the frequency on which the device should lock
Definition: wimax-phy.cc:314
ns3::WimaxPhy::GetFrameDurationCode
uint8_t GetFrameDurationCode(void) const
Get the frame duration code.
Definition: wimax-phy.cc:264
ns3::WimaxPhy::DoAttach
virtual void DoAttach(Ptr< WimaxChannel > channel)=0
Attach channel.
ns3::WimaxPhy::SetChannelBandwidth
void SetChannelBandwidth(uint32_t channelBandwidth)
Set the channel bandwidth.
Definition: wimax-phy.cc:326
ns3::WimaxPhy::DoGetFrameDurationCode
virtual uint8_t DoGetFrameDurationCode(void) const =0
Get frame duration code.
ns3::WimaxPhy::GetSamplingFactor
double GetSamplingFactor(void) const
Get the sampling factor.
Definition: wimax-phy.cc:344
ns3::WimaxPhy::SetDuplex
void SetDuplex(uint64_t rxFrequency, uint64_t txFrequency)
configure the physical layer in duplex mode
Definition: wimax-phy.cc:161
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::WimaxPhy::m_duplex
bool m_duplex
duplex
Definition: wimax-phy.h:472
ns3::WimaxPhy::AssignStreams
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
ns3::Callback
Callback template class.
Definition: callback.h:1279
ns3::WimaxPhy::DoGetTtg
virtual uint16_t DoGetTtg(void) const =0
Get TTG.
ns3::WimaxPhy::PHY_STATE_RX
@ PHY_STATE_RX
Definition: wimax-phy.h:66
ns3::WimaxPhy::GetSymbolDuration
Time GetSymbolDuration(void) const
Get the OFDM symbol duration.
Definition: wimax-phy.cc:374
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WimaxPhy::GetPsPerSymbol
uint16_t GetPsPerSymbol(void) const
Get the number of physical slots per symbol.
Definition: wimax-phy.cc:392
ns3::WimaxPhy::WimaxPhy
WimaxPhy(void)
Definition: wimax-phy.cc:75
ns3::WimaxPhy::GetGValue
double GetGValue(void) const
Get the guard interval factor (the ratio TG/Td)
Definition: wimax-phy.cc:380
ns3::WimaxPhy::simpleOfdmWimaxPhy
@ simpleOfdmWimaxPhy
Definition: wimax-phy.h:73
ns3::WimaxPhy::m_dlChnlSrchTimeoutEvent
EventId m_dlChnlSrchTimeoutEvent
DL channel search timeout event.
Definition: wimax-phy.h:471
ns3::WimaxPhy::DoGetSamplingFactor
virtual double DoGetSamplingFactor(void) const =0
Get sampling factor.
ns3::WimaxPhy::MODULATION_TYPE_QPSK_12
@ MODULATION_TYPE_QPSK_12
Definition: wimax-phy.h:52
ns3::WimaxPhy::m_symbolDuration
Time m_symbolDuration
in seconds
Definition: wimax-phy.h:483
ns3::WimaxPhy::m_psPerSymbol
uint16_t m_psPerSymbol
ps per sumbol
Definition: wimax-phy.h:484
ns3::WimaxPhy::GetSymbolsPerFrame
uint32_t GetSymbolsPerFrame(void) const
Get the number of symbols per frame.
Definition: wimax-phy.cc:416
ns3::WimaxPhy::GetDataRate
uint32_t GetDataRate(ModulationType modulationType) const
Get the data rate corresponding to a modulation type.
Definition: wimax-phy.cc:228
third.channel
channel
Definition: third.py:92
ns3::WimaxPhy::GetState
PhyState GetState(void) const
Get the state of the device.
Definition: wimax-phy.cc:198
ns3::WimaxPhy::DoGetNfft
virtual uint16_t DoGetNfft(void) const =0
Get NFFT.
ns3::WimaxPhy::DoGetGValue
virtual double DoGetGValue(void) const =0
Get G value.
ns3::WimaxPhy::SetPsDuration
void SetPsDuration(Time psDuration)
set the physical slot duration
Definition: wimax-phy.cc:356
ns3::WimaxPhy::SetPhyParameters
void SetPhyParameters(void)
computes the Physical parameters and store them
Definition: wimax-phy.cc:278
ns3::WimaxPhy::GetFrequency
uint32_t GetFrequency(void) const
Get the frequency on which the device is locked.
Definition: wimax-phy.cc:320
ns3::WimaxPhy::SetPsPerSymbol
void SetPsPerSymbol(uint16_t psPerSymbol)
set the number of physical slots per symbol
Definition: wimax-phy.cc:386
ns3::WimaxPhy::GetPsPerFrame
uint16_t GetPsPerFrame(void) const
Get the number of physical slots per frame.
Definition: wimax-phy.cc:404
ns3::WimaxPhy::GetReceiveCallback
Callback< void, Ptr< const PacketBurst > > GetReceiveCallback(void) const
Definition: wimax-phy.cc:155
ns3::WimaxPhy::MODULATION_TYPE_BPSK_12
@ MODULATION_TYPE_BPSK_12
Definition: wimax-phy.h:51
ns3::WimaxPhy::GetNfft
uint16_t GetNfft(void) const
Get the size of the FFT.
Definition: wimax-phy.cc:338
ns3::WimaxPhy::GetChannel
Ptr< WimaxChannel > GetChannel(void) const
Definition: wimax-phy.cc:113
ns3::WimaxPhy::m_mobility
Ptr< Object > m_mobility
modility model
Definition: wimax-phy.h:487
ns3::WimaxPhy::SetState
void SetState(PhyState state)
set the state of the device
Definition: wimax-phy.cc:193
ns3::WimaxPhy::PHY_STATE_TX
@ PHY_STATE_TX
Definition: wimax-phy.h:65
ns3::WimaxPhy::GetRtg
uint16_t GetRtg(void) const
Get the receive/transmit transition gap.
Definition: wimax-phy.cc:258
ns3::WimaxPhy::MODULATION_TYPE_QAM64_23
@ MODULATION_TYPE_QAM64_23
Definition: wimax-phy.h:56
ns3::WimaxPhy::SetNrCarriers
void SetNrCarriers(uint8_t nrCarriers)
Set the number of carriers in the physical frame.
Definition: wimax-phy.cc:284
ns3::WimaxPhy::DoGetDataRate
virtual uint32_t DoGetDataRate(ModulationType modulationType) const =0
Get data rate.
ns3::WimaxPhy::IsDuplex
bool IsDuplex(void) const
Check if configured in duplex mode.
Definition: wimax-phy.cc:204
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::WimaxPhy::MODULATION_TYPE_QAM16_34
@ MODULATION_TYPE_QAM16_34
Definition: wimax-phy.h:55
ns3::WimaxPhy::m_channelBandwidth
uint32_t m_channelBandwidth
in Hz
Definition: wimax-phy.h:481
ns3::WimaxPhy::ModulationType
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:50
ns3::WimaxPhy::m_txFrequency
uint64_t m_txFrequency
transmit frequency
Definition: wimax-phy.h:468
ns3::WimaxPhy::MODULATION_TYPE_QPSK_34
@ MODULATION_TYPE_QPSK_34
Definition: wimax-phy.h:53
ns3::WimaxPhy::GetSamplingFrequency
double GetSamplingFrequency(void) const
Get the sampling frequency.
Definition: wimax-phy.cc:350
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::WimaxPhy::GetChnlSrchTimeoutEvent
EventId GetChnlSrchTimeoutEvent(void) const
Get channel search timeout event.
Definition: wimax-phy.cc:210
ns3::WimaxPhy::GetPhyType
virtual PhyType GetPhyType(void) const =0
Get the type of the physical layer.
ns3::WimaxPhy::DoSetPhyParameters
virtual void DoSetPhyParameters(void)=0
Set phy parameters.
ns3::WimaxPhy::SetSymbolsPerFrame
void SetSymbolsPerFrame(uint32_t symbolsPerFrame)
set the number of symbols per frame
Definition: wimax-phy.cc:410
ns3::WimaxPhy::m_frequency
uint32_t m_frequency
in KHz
Definition: wimax-phy.h:480
ns3::WimaxPhy::StartScanning
void StartScanning(uint64_t frequency, Time timeout, Callback< void, bool, uint64_t > callback)
scan a frequency for maximum timeout seconds and call the callback if the frequency can be used
Definition: wimax-phy.cc:131
ns3::WimaxPhy::GetDevice
Ptr< NetDevice > GetDevice(void) const
Definition: wimax-phy.cc:125
ns3::WimaxPhy::GetNrSymbols
uint64_t GetNrSymbols(uint32_t size, ModulationType modulationType) const
Get the number of symbols needed to transmit size bytes using the modulation modulationType.
Definition: wimax-phy.cc:240
ns3::WimaxPhy::m_rxCallback
Callback< void, Ptr< const PacketBurst > > m_rxCallback
receive callback function
Definition: wimax-phy.h:475
ns3::WimaxPhy::MODULATION_TYPE_QAM16_12
@ MODULATION_TYPE_QAM16_12
Definition: wimax-phy.h:54
ns3::WimaxPhy::GetNrBytes
uint64_t GetNrBytes(uint32_t symbols, ModulationType modulationType) const
Get the maximum number of bytes that could be carried by symbols symbols using the modulation modulat...
Definition: wimax-phy.cc:246
ns3::WimaxPhy::m_scanningCallback
Callback< void, bool, uint64_t > m_scanningCallback
scanning callback function
Definition: wimax-phy.h:476
ns3::WimaxPhy::Send
virtual void Send(SendParams *params)=0
send a packet on the channel
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
bvec.h
ns3::WimaxPhy::PhyType
PhyType
PhyType enumeration.
Definition: wimax-phy.h:71
ns3::WimaxPhy::PhyState
PhyState
PhyState enumeration.
Definition: wimax-phy.h:62
ns3::WimaxPhy::GetPsDuration
Time GetPsDuration(void) const
Get the physical slot duration.
Definition: wimax-phy.cc:362
ns3::WimaxPhy::DoSetDataRates
virtual void DoSetDataRates(void)=0
Set data rates.
ns3::WimaxPhy::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: wimax-phy.cc:99
send-params.h
ns3::WimaxPhy::DoGetTransmissionTime
virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const =0
Get transmission time.
ns3::WimaxPhy::DoGetNrBytes
virtual uint64_t DoGetNrBytes(uint32_t symbols, ModulationType modulationType) const =0
Get number of bytes.
ns3::WimaxPhy::MODULATION_TYPE_QAM64_34
@ MODULATION_TYPE_QAM64_34
Definition: wimax-phy.h:57
ns3::WimaxPhy::GetChannelBandwidth
uint32_t GetChannelBandwidth(void) const
Get the channel bandwidth.
Definition: wimax-phy.cc:332
ns3::WimaxPhy::GetModulationFecParams
void GetModulationFecParams(ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const
Get modulation FEC parameters.
ns3::WimaxPhy::m_symbolsPerFrame
uint32_t m_symbolsPerFrame
symbols per frame
Definition: wimax-phy.h:486
ns3::WimaxPhy::m_nrCarriers
uint8_t m_nrCarriers
number of carriers
Definition: wimax-phy.h:478
ns3::WimaxPhy::SimpleWimaxPhy
@ SimpleWimaxPhy
Definition: wimax-phy.h:72
ns3::WimaxPhy::m_state
PhyState m_state
state
Definition: wimax-phy.h:473
timeout
ns3::Time timeout
Definition: openflow-switch.cc:52
ns3::WimaxPhy::m_frameDuration
Time m_frameDuration
in seconds
Definition: wimax-phy.h:479
ns3::WimaxPhy::~WimaxPhy
virtual ~WimaxPhy(void)
Definition: wimax-phy.cc:94
ns3::WimaxPhy::DoGetNrSymbols
virtual uint64_t DoGetNrSymbols(uint32_t size, ModulationType modulationType) const =0
Get number of symbols.
ns3::WimaxPhy::SetSymbolDuration
void SetSymbolDuration(Time symbolDuration)
set the OFDM symbol duration
Definition: wimax-phy.cc:368
ns3::WimaxPhy::DoGetSamplingFrequency
virtual double DoGetSamplingFrequency(void) const =0
Get sampling frequency.
ns3::WimaxPhy::PHY_STATE_SCANNING
@ PHY_STATE_SCANNING
Definition: wimax-phy.h:64
ns3::WimaxPhy::m_psPerFrame
uint16_t m_psPerFrame
ps per framce
Definition: wimax-phy.h:485
ns3::WimaxPhy::GetFrameDurationSec
Time GetFrameDurationSec(void) const
Get the frame duration This method is redundant with GetFrameDuration ()
Definition: wimax-phy.cc:308
ns3::WimaxPhy::SetMobility
virtual void SetMobility(Ptr< Object > mobility)
set the mobility model of the device
Definition: wimax-phy.cc:427
ns3::WimaxPhy::GetRxFrequency
uint64_t GetRxFrequency(void) const
Get the reception frequency.
Definition: wimax-phy.cc:175
ns3::WimaxPhy::SetDevice
void SetDevice(Ptr< WimaxNetDevice > device)
Set the device in which this physical layer is installed.
Definition: wimax-phy.cc:119
ns3::WimaxPhy::GetMobility
virtual Ptr< Object > GetMobility(void)
Get the mobility model of the device.
Definition: wimax-phy.cc:421
ns3::WimaxPhy::m_scanningFrequency
uint64_t m_scanningFrequency
scanning frequency
Definition: wimax-phy.h:470
ns3::WimaxPhy::DoGetFrameDuration
virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const =0
Get frame duration.
ns3::WimaxPhy::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: wimax-phy.cc:39
ns3::WimaxPhy::GetFrameDuration
Time GetFrameDuration(void) const
Get the frame duration.
Definition: wimax-phy.cc:302
ns3::WimaxPhy::Attach
void Attach(Ptr< WimaxChannel > channel)
Attach the physical layer to a channel.
Definition: wimax-phy.cc:106
ns3::WimaxPhy::m_rxFrequency
uint64_t m_rxFrequency
receive frequency
Definition: wimax-phy.h:469
ns3::WimaxPhy::m_channel
Ptr< WimaxChannel > m_channel
channel
Definition: wimax-phy.h:466
ns3::WimaxPhy::SetPsPerFrame
void SetPsPerFrame(uint16_t psPerFrame)
set the number of physical slots per frame
Definition: wimax-phy.cc:398
ns3::SendParams
The SendParams class defines the parameters with which Send() function of a particular PHY is called.
Definition: send-params.h:44
ns3::WimaxPhy::m_device
Ptr< WimaxNetDevice > m_device
the device
Definition: wimax-phy.h:465
ns3::WimaxPhy::GetScanningFrequency
uint64_t GetScanningFrequency(void) const
Get the scanning frequency.
Definition: wimax-phy.cc:187
ns3::WimaxPhy::GetNrCarriers
uint8_t GetNrCarriers(void) const
Get the number of carriers in the physical frame.
Definition: wimax-phy.cc:290
ns3::WimaxPhy::SetReceiveCallback
void SetReceiveCallback(Callback< void, Ptr< const PacketBurst > > callback)
set the callback function to call when a burst is received
Definition: wimax-phy.cc:149
ns3::WimaxPhy::PHY_STATE_IDLE
@ PHY_STATE_IDLE
Definition: wimax-phy.h:63
ns3::WimaxPhy::m_psDuration
Time m_psDuration
in seconds
Definition: wimax-phy.h:482
ns3::WimaxPhy::GetTtg
uint16_t GetTtg(void) const
Get the transmit/receive transition gap.
Definition: wimax-phy.cc:252
ns3::WimaxPhy
Definition: wimax-phy.h:46
ns3::WimaxPhy::EndScanning
void EndScanning(void)
End scanning.
Definition: wimax-phy.cc:143
third.mobility
mobility
Definition: third.py:108
ns3::WimaxPhy::SetFrameDuration
void SetFrameDuration(Time frameDuration)
Set the frame duration.
Definition: wimax-phy.cc:296
ns3::WimaxPhy::GetTransmissionTime
Time GetTransmissionTime(uint32_t size, ModulationType modulationType) const
Get transmission time needed to send bytes at a given modulation.
Definition: wimax-phy.cc:234
ns3::WimaxPhy::SetSimplex
void SetSimplex(uint64_t frequency)
configure the physical layer in simplex mode
Definition: wimax-phy.cc:168
ns3::WimaxPhy::GetTxFrequency
uint64_t GetTxFrequency(void) const
Get the transmission frequency.
Definition: wimax-phy.cc:181