A Discrete-Event Network Simulator
API
simple-ofdm-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, 2009 INRIA, UDcast
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: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19  * <amine.ismail@udcast.com>
20  */
21 
22 #ifndef SIMPLE_OFDM_WIMAX_PHY_H
23 #define SIMPLE_OFDM_WIMAX_PHY_H
24 
25 #include <stdint.h>
26 #include <list>
27 #include "ns3/callback.h"
28 #include "ns3/nstime.h"
29 #include "ns3/event-id.h"
30 #include "ns3/random-variable-stream.h"
31 #include "wimax-phy.h"
32 #include "bvec.h"
33 #include "ns3/snr-to-block-error-rate-manager.h"
34 #include "wimax-connection.h"
35 namespace ns3 {
36 
37 class WimaxChannel;
38 class WimaxNetDevice;
39 class NetDevice;
40 class Packet;
41 class SimpleOfdmWimaxChannel;
42 
48 {
49 public:
52  {
60  };
61 
66  static TypeId GetTypeId (void);
67  SimpleOfdmWimaxPhy (void);
73  SimpleOfdmWimaxPhy (char * tracesPath);
74  ~SimpleOfdmWimaxPhy (void);
79  void ActivateLoss (bool loss);
85  void SetSNRToBlockErrorRateTracesPath (char * tracesPath);
102  void Send (Ptr<PacketBurst> burst, WimaxPhy::ModulationType modulationType, uint8_t direction);
108  void Send (SendParams *params);
113  WimaxPhy::PhyType GetPhyType (void) const;
125  void StartReceive (uint32_t burstSize,
126  bool isFirstBlock,
127  uint64_t frequency,
128  WimaxPhy::ModulationType modulationType,
129  uint8_t direction,
130  double rxPower,
131  Ptr<PacketBurst> burst);
132 
136  uint32_t GetBandwidth (void) const;
141  void SetBandwidth (uint32_t BW);
145  double GetTxPower (void) const;
150  void SetTxPower (double txPower);
154  double GetNoiseFigure (void) const;
159  void SetNoiseFigure (double nf);
160 
166  void NotifyTxBegin (Ptr<PacketBurst> burst);
167 
173  void NotifyTxEnd (Ptr<PacketBurst> burst);
174 
180  void NotifyTxDrop (Ptr<PacketBurst> burst);
181 
187  void NotifyRxBegin (Ptr<PacketBurst> burst);
188 
194  void NotifyRxEnd (Ptr<PacketBurst> burst);
195 
201  void NotifyRxDrop (Ptr<PacketBurst> burst);
202 
211  int64_t AssignStreams (int64_t stream);
212 
213 private:
220  Time DoGetTransmissionTime (uint32_t size, WimaxPhy::ModulationType modulationType) const;
227  uint64_t DoGetNrSymbols (uint32_t size, WimaxPhy::ModulationType modulationType) const;
234  uint64_t DoGetNrBytes (uint32_t symbols, WimaxPhy::ModulationType modulationType) const;
252  void CreateFecBlocks (const bvec &buffer, WimaxPhy::ModulationType modulationType);
257  bvec RecreateBuffer ();
263  uint32_t GetFecBlockSize (WimaxPhy::ModulationType type) const;
269  uint32_t GetCodedFecBlockSize (WimaxPhy::ModulationType modulationType) const;
275  void SetBlockParameters (uint32_t burstSize, WimaxPhy::ModulationType modulationType);
282  uint16_t GetNrBlocks (uint32_t burstSize, WimaxPhy::ModulationType modulationType) const;
283  void DoDispose (void);
285  void EndSend (void);
291  void EndSendFecBlock (WimaxPhy::ModulationType modulationType, uint8_t direction);
296  void EndReceive (Ptr<const PacketBurst> burst);
305  void EndReceiveFecBlock (uint32_t burstSize,
306  WimaxPhy::ModulationType modulationType,
307  uint8_t direction,
308  uint8_t drop,
309  Ptr<PacketBurst> burst);
316  void StartSendDummyFecBlock (bool isFirstBlock,
317  WimaxPhy::ModulationType modulationType,
318  uint8_t direction);
326  void DoSetDataRates (void);
328  void InitSimpleOfdmWimaxPhy (void);
329 
336  void GetModulationFecParams (WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const;
342  uint32_t CalculateDataRate (WimaxPhy::ModulationType modulationType) const;
348  uint32_t DoGetDataRate (WimaxPhy::ModulationType modulationType) const;
353  uint16_t DoGetTtg (void) const;
358  uint16_t DoGetRtg (void) const;
363  uint8_t DoGetFrameDurationCode (void) const;
369  Time DoGetFrameDuration (uint8_t frameDurationCode) const;
371  void DoSetPhyParameters (void);
376  uint16_t DoGetNfft (void) const;
381  void DoSetNfft (uint16_t nfft);
386  double DoGetSamplingFactor (void) const;
391  double DoGetSamplingFrequency (void) const;
396  double DoGetGValue (void) const;
401  void DoSetGValue (double g);
402 
407  double GetRxGain (void) const;
412  void SetRxGain (double rxgain);
413 
418  double GetTxGain (void) const;
423  void SetTxGain (double txgain);
424 
429  std::string GetTraceFilePath (void) const;
434  void SetTraceFilePath (std::string path);
435 
436  uint16_t m_fecBlockSize;
438 
439  std::list<bvec> *m_receivedFecBlocks;
440  uint32_t m_nrFecBlocksSent;
441  std::list<bvec> *m_fecBlocks;
443 
446 
447  // data rates for this Phy
448  uint32_t m_dataRateBpsk12;
449  uint32_t m_dataRateQpsk12;
450  uint32_t m_dataRateQpsk34;
455 
456  // parameters to store for a per burst life-time
457  uint16_t m_nrBlocks;
460  uint16_t m_blockSize;
461  uint32_t m_paddingBits;
464  uint16_t m_nfft;
465  double m_g;
466  double m_bandWidth;
467  double m_txPower;
468  double m_noiseFigure;
469  double m_txGain;
470  double m_rxGain;
480 
490 
500 
510 
520 
529 
531 
534 
535 };
536 
537 } // namespace ns3
538 
539 #endif /* OFDM_WIMAX_PHY_H */
Callback template class.
Definition: callback.h:1279
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
This class handles the SNR to BlcER traces.
The SendParams class defines the parameters with which Send() function of a particular PHY is called.
Definition: send-params.h:44
SimpleOfdmWimaxPhy class.
void GetModulationFecParams(WimaxPhy::ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const
Get moduleation FEC parameters.
void NotifyRxBegin(Ptr< PacketBurst > burst)
Public method used to fire a PhyRxBegin trace.
TracedCallback< Ptr< PacketBurst > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
double GetNoiseFigure(void) const
void NotifyRxEnd(Ptr< PacketBurst > burst)
Public method used to fire a PhyRxEnd trace.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_dataRateQpsk12
data rate
TracedCallback< Ptr< PacketBurst > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
double m_txPower
transmit power
double DoGetSamplingFactor(void) const
Get sampling factor.
uint32_t DoGetDataRate(WimaxPhy::ModulationType modulationType) const
Get data rate.
TracedCallback< Ptr< PacketBurst > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
void EndReceive(Ptr< const PacketBurst > burst)
End receive.
void DoSetGValue(double g)
Set G value.
uint32_t CalculateDataRate(WimaxPhy::ModulationType modulationType) const
Calculate data rate.
TracedCallback< Ptr< PacketBurst > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
void StartSendDummyFecBlock(bool isFirstBlock, WimaxPhy::ModulationType modulationType, uint8_t direction)
Start end dummy FEC block.
TracedCallback< Ptr< PacketBurst > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
double m_txGain
transmit gain
uint16_t DoGetTtg(void) const
Get TTG.
void ActivateLoss(bool loss)
if called with true it will enable the loss model
uint32_t m_dataRateQam16_34
data rate
uint16_t m_nbErroneousBlock
erroneous blocks
uint16_t m_nrBlocks
number of blocks
WimaxPhy::PhyType GetPhyType(void) const
returns the type this physical layer
uint16_t m_blockSize
block size
Time DoGetFrameDuration(uint8_t frameDurationCode) const
Get frame duration.
void SetTraceFilePath(std::string path)
Set trace file path.
void DoSetPhyParameters(void)
Set Phy parameters.
void SetNoiseFigure(double nf)
set the noise figure of the device
void SetRxGain(double rxgain)
Set receive gsain.
void EndSendFecBlock(WimaxPhy::ModulationType modulationType, uint8_t direction)
End send FEC block.
uint32_t m_dataRateQpsk34
data rate
Ptr< PacketBurst > m_currentBurst
current burst
Ptr< UniformRandomVariable > m_URNG
Provides uniform random variables.
double DoGetGValue(void) const
Get G value.
void DoSetNfft(uint16_t nfft)
Set NFFT.
void NotifyRxDrop(Ptr< PacketBurst > burst)
Public method used to fire a PhyRxDrop trace.
uint16_t GetNrBlocks(uint32_t burstSize, WimaxPhy::ModulationType modulationType) const
Get number of blocks.
void EndReceiveFecBlock(uint32_t burstSize, WimaxPhy::ModulationType modulationType, uint8_t direction, uint8_t drop, Ptr< PacketBurst > burst)
End receive FEC block.
uint16_t m_nrRecivedFecBlocks
number received FEC blocks
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void NotifyTxEnd(Ptr< PacketBurst > burst)
Public method used to fire a PhyTxEnd trace.
double m_noiseFigure
noise figure
void SetBlockParameters(uint32_t burstSize, WimaxPhy::ModulationType modulationType)
Set block parameters.
uint16_t DoGetNfft(void) const
Get NFFT.
uint32_t m_dataRateQam64_34
data rate
uint32_t m_dataRateBpsk12
data rate
bvec ConvertBurstToBits(Ptr< const PacketBurst > burst)
Convert burst to bits.
void SetTxPower(double txPower)
set the transmission power
uint64_t DoGetNrBytes(uint32_t symbols, WimaxPhy::ModulationType modulationType) const
Get number of bytes.
uint64_t DoGetNrSymbols(uint32_t size, WimaxPhy::ModulationType modulationType) const
Get number of symbols.
FrameDurationCode
Frame duration code enumeration.
SNRToBlockErrorRateManager * m_snrToBlockErrorRateManager
SNR to block error rate manager.
TracedCallback< Ptr< const PacketBurst > > m_traceTx
trace transmit callback
std::string GetTraceFilePath(void) const
Get trace file path.
std::list< bvec > * m_fecBlocks
the FEC blocks
double DoGetSamplingFrequency(void) const
Get sampling frequency.
double GetTxGain(void) const
Get transmit gain.
uint32_t m_dataRateQam16_12
data rate
uint8_t DoGetFrameDurationCode(void) const
Get frame duration code.
void DoAttach(Ptr< WimaxChannel > channel)
Attach the physical layer to a channel.
uint32_t GetBandwidth(void) const
uint32_t GetCodedFecBlockSize(WimaxPhy::ModulationType modulationType) const
Get coded FEC block size.
std::list< bvec > * m_receivedFecBlocks
a list of received FEC blocks until they are combined to recreate the full burst buffer
uint32_t GetFecBlockSize(WimaxPhy::ModulationType type) const
Get FEC block size.
void SetTxGain(double txgain)
Set transmit gain.
uint16_t m_nrRemainingBlocksToSend
number of remaining blocks to send
void SetBandwidth(uint32_t BW)
Set the bandwidth.
void InitSimpleOfdmWimaxPhy(void)
Initialize simple OFDM WIMAX Phy.
Time GetBlockTransmissionTime(WimaxPhy::ModulationType modulationType) const
Get block transmission time.
void Send(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType, uint8_t direction)
Sends a burst on the channel.
uint16_t DoGetRtg(void) const
Get RTG.
Ptr< PacketBurst > ConvertBitsToBurst(bvec buffer)
Convert bits to burst.
void DoDispose(void)
Destructor implementation.
void SetSNRToBlockErrorRateTracesPath(char *tracesPath)
Set the path of the repository containing the traces.
uint32_t m_currentBurstSize
current burst size
void NotifyTxDrop(Ptr< PacketBurst > burst)
Public method used to fire a PhyTxDrop trace.
bvec RecreateBuffer()
Recreate buffer.
void SetReceiveCallback(Callback< void, Ptr< PacketBurst >, Ptr< WimaxConnection > > callback)
set the callback function to call when a burst is received
void NotifyTxBegin(Ptr< PacketBurst > burst)
Public method used to fire a PhyTxBegin trace.
void DoSetDataRates(void)
Set data rates.
uint32_t m_paddingBits
padding bits
Time DoGetTransmissionTime(uint32_t size, WimaxPhy::ModulationType modulationType) const
Get transmission time.
void CreateFecBlocks(const bvec &buffer, WimaxPhy::ModulationType modulationType)
Create FEC blocks.
TracedCallback< Ptr< PacketBurst > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet as it tries to transmit it.
uint16_t m_fecBlockSize
in bits, size of FEC block transmitted after PHY operations
double GetRxGain(void) const
Get receive gain.
TracedCallback< Ptr< const PacketBurst > > m_traceRx
trace receive callback
uint32_t m_dataRateQam64_23
data rate
void StartReceive(uint32_t burstSize, bool isFirstBlock, uint64_t frequency, WimaxPhy::ModulationType modulationType, uint8_t direction, double rxPower, Ptr< PacketBurst > burst)
start the reception of a fec block
uint32_t m_nrFecBlocksSent
counting the number of FEC blocks sent (within a burst)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
WiMAX PHY entity.
Definition: wimax-phy.h:48
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:52
PhyType
PhyType enumeration.
Definition: wimax-phy.h:73
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< bool > bvec
boolean vector typedef
Definition: bvec.h:29
channel
Definition: third.py:92