A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wimax-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 */
19
20#ifndef WIMAX_PHY_H
21#define WIMAX_PHY_H
22
23#include "bvec.h"
24#include "send-params.h"
25
26#include "ns3/callback.h"
27#include "ns3/event-id.h"
28#include "ns3/log.h"
29#include "ns3/nstime.h"
30#include "ns3/object.h"
31#include "ns3/traced-callback.h"
32
33#include <list>
34#include <stdint.h>
35
36namespace ns3
37{
38
39class WimaxChannel;
40class WimaxNetDevice;
41class NetDevice;
42class Packet;
43
49class WimaxPhy : public Object
50{
51 public:
53 enum ModulationType // Table 356 and 362
54 {
62 };
63
66 {
71 };
72
75 {
78 };
79
84 static TypeId GetTypeId();
85 WimaxPhy();
86 ~WimaxPhy() override;
91 void Attach(Ptr<WimaxChannel> channel);
100 void SetDevice(Ptr<WimaxNetDevice> device);
118 virtual void Send(SendParams* params) = 0;
123 virtual PhyType GetPhyType() const = 0;
129 void SetDuplex(uint64_t rxFrequency, uint64_t txFrequency);
134 void SetSimplex(uint64_t frequency);
139 uint64_t GetRxFrequency() const;
144 uint64_t GetTxFrequency() const;
149 uint64_t GetScanningFrequency() const;
155 void SetNrCarriers(uint8_t nrCarriers);
160 uint8_t GetNrCarriers() const;
165 void SetFrameDuration(Time frameDuration);
176 Time GetFrameDuration() const;
181 void SetFrequency(uint32_t frequency);
186 uint32_t GetFrequency() const;
191 void SetChannelBandwidth(uint32_t channelBandwidth);
201 uint16_t GetNfft() const;
206 double GetSamplingFactor() const;
211 double GetSamplingFrequency() const;
216 void SetPsDuration(Time psDuration);
221 Time GetPsDuration() const;
226 void SetSymbolDuration(Time symbolDuration);
231 Time GetSymbolDuration() const;
236 double GetGValue() const;
241 void SetPsPerSymbol(uint16_t psPerSymbol);
246 uint16_t GetPsPerSymbol() const;
247
252 void SetPsPerFrame(uint16_t psPerFrame);
257 uint16_t GetPsPerFrame() const;
262 void SetSymbolsPerFrame(uint32_t symbolsPerFrame);
272 bool IsDuplex() const;
278 void SetState(PhyState state);
284 PhyState GetState() const;
292 void StartScanning(uint64_t frequency, Time timeout, Callback<void, bool, uint64_t> callback);
293
297 void SetScanningCallback() const;
306 void SetDataRates();
312 uint32_t GetDataRate(ModulationType modulationType) const;
319 Time GetTransmissionTime(uint32_t size, ModulationType modulationType) const;
326 uint64_t GetNrSymbols(uint32_t size, ModulationType modulationType) const;
334 uint64_t GetNrBytes(uint32_t symbols, ModulationType modulationType) const;
339 uint16_t GetTtg() const;
344 uint16_t GetRtg() const;
349 uint8_t GetFrameDurationCode() const;
355 Time GetFrameDuration(uint8_t frameDurationCode) const;
359 void SetPhyParameters();
360 void DoDispose() override;
361
370 virtual int64_t AssignStreams(int64_t stream) = 0;
371
372 private:
380 uint8_t& bitsPerSymbol,
381 double& fecCode) const;
383 void EndScanning();
390 virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const = 0;
395 virtual void DoAttach(Ptr<WimaxChannel> channel) = 0;
397 virtual void DoSetDataRates() = 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() const = 0;
427 virtual uint16_t DoGetRtg() const = 0;
428
433 virtual uint8_t DoGetFrameDurationCode() const = 0;
439 virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const = 0;
443 virtual void DoSetPhyParameters() = 0;
448 virtual double DoGetSamplingFactor() const = 0;
453 virtual uint16_t DoGetNfft() const = 0;
458 virtual double DoGetSamplingFrequency() const = 0;
463 virtual double DoGetGValue() 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;
484 uint16_t m_psPerSymbol;
485 uint16_t m_psPerFrame;
487};
488
489} // namespace ns3
490
491#endif /* WIMAX_PHY_H */
Callback template class.
Definition: callback.h:438
An identifier for simulation events.
Definition: event-id.h:55
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
The SendParams class defines the parameters with which Send() function of a particular PHY is called.
Definition: send-params.h:42
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
WiMAX PHY entity.
Definition: wimax-phy.h:50
Time GetTransmissionTime(uint32_t size, ModulationType modulationType) const
Get transmission time needed to send bytes at a given modulation.
Definition: wimax-phy.cc:240
Time GetFrameDuration() const
Get the frame duration.
Definition: wimax-phy.cc:308
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:54
@ MODULATION_TYPE_QPSK_12
Definition: wimax-phy.h:56
@ MODULATION_TYPE_QAM16_12
Definition: wimax-phy.h:58
@ MODULATION_TYPE_QAM64_34
Definition: wimax-phy.h:61
@ MODULATION_TYPE_QAM16_34
Definition: wimax-phy.h:59
@ MODULATION_TYPE_QAM64_23
Definition: wimax-phy.h:60
@ MODULATION_TYPE_QPSK_34
Definition: wimax-phy.h:57
@ MODULATION_TYPE_BPSK_12
Definition: wimax-phy.h:55
virtual double DoGetGValue() const =0
Get G value.
bool m_duplex
duplex
Definition: wimax-phy.h:472
void SetSymbolDuration(Time symbolDuration)
set the OFDM symbol duration
Definition: wimax-phy.cc:374
Ptr< WimaxChannel > GetChannel() const
Definition: wimax-phy.cc:117
uint32_t GetSymbolsPerFrame() const
Get the number of symbols per frame.
Definition: wimax-phy.cc:422
void SetChannelBandwidth(uint32_t channelBandwidth)
Set the channel bandwidth.
Definition: wimax-phy.cc:332
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:252
virtual uint8_t DoGetFrameDurationCode() const =0
Get frame duration code.
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
uint64_t m_txFrequency
transmit frequency
Definition: wimax-phy.h:468
~WimaxPhy() override
Definition: wimax-phy.cc:98
void SetDuplex(uint64_t rxFrequency, uint64_t txFrequency)
configure the physical layer in duplex mode
Definition: wimax-phy.cc:166
EventId m_dlChnlSrchTimeoutEvent
DL channel search timeout event.
Definition: wimax-phy.h:471
uint64_t GetRxFrequency() const
Get the reception frequency.
Definition: wimax-phy.cc:180
Time GetFrameDurationSec() const
Get the frame duration This method is redundant with GetFrameDuration ()
Definition: wimax-phy.cc:314
void SetDataRates()
calculates the data rate of each modulation and save them for future use
Definition: wimax-phy.cc:228
uint16_t GetPsPerFrame() const
Get the number of physical slots per frame.
Definition: wimax-phy.cc:410
PhyType
PhyType enumeration.
Definition: wimax-phy.h:75
@ simpleOfdmWimaxPhy
Definition: wimax-phy.h:77
Time GetSymbolDuration() const
Get the OFDM symbol duration.
Definition: wimax-phy.cc:380
uint8_t GetNrCarriers() const
Get the number of carriers in the physical frame.
Definition: wimax-phy.cc:296
uint32_t m_channelBandwidth
in Hz
Definition: wimax-phy.h:481
Time m_psDuration
in seconds
Definition: wimax-phy.h:482
PhyState GetState() const
Get the state of the device.
Definition: wimax-phy.cc:204
virtual void DoSetPhyParameters()=0
Set phy parameters.
virtual uint16_t DoGetTtg() const =0
Get TTG.
void Attach(Ptr< WimaxChannel > channel)
Attach the physical layer to a channel.
Definition: wimax-phy.cc:110
uint16_t m_psPerFrame
ps per framce
Definition: wimax-phy.h:485
virtual uint16_t DoGetNfft() const =0
Get NFFT.
void SetFrequency(uint32_t frequency)
set the frequency on which the device should lock
Definition: wimax-phy.cc:320
uint32_t m_symbolsPerFrame
symbols per frame
Definition: wimax-phy.h:486
uint8_t GetFrameDurationCode() const
Get the frame duration code.
Definition: wimax-phy.cc:270
void SetDevice(Ptr< WimaxNetDevice > device)
Set the device in which this physical layer is installed.
Definition: wimax-phy.cc:123
uint64_t m_rxFrequency
receive frequency
Definition: wimax-phy.h:469
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:135
virtual void DoSetDataRates()=0
Set data rates.
void SetReceiveCallback(Callback< void, Ptr< const PacketBurst > > callback)
set the callback function to call when a burst is received
Definition: wimax-phy.cc:154
virtual void DoAttach(Ptr< WimaxChannel > channel)=0
Attach channel.
virtual void Send(SendParams *params)=0
send a packet on the channel
void SetSymbolsPerFrame(uint32_t symbolsPerFrame)
set the number of symbols per frame
Definition: wimax-phy.cc:416
Ptr< WimaxNetDevice > m_device
the device
Definition: wimax-phy.h:465
void SetScanningCallback() const
calls the scanning call back function
Definition: wimax-phy.cc:222
virtual uint64_t DoGetNrSymbols(uint32_t size, ModulationType modulationType) const =0
Get number of symbols.
double GetSamplingFrequency() const
Get the sampling frequency.
Definition: wimax-phy.cc:356
virtual double DoGetSamplingFactor() const =0
Get sampling factor.
virtual uint64_t DoGetNrBytes(uint32_t symbols, ModulationType modulationType) const =0
Get number of bytes.
void SetNrCarriers(uint8_t nrCarriers)
Set the number of carriers in the physical frame.
Definition: wimax-phy.cc:290
Ptr< WimaxChannel > m_channel
channel
Definition: wimax-phy.h:466
Time GetPsDuration() const
Get the physical slot duration.
Definition: wimax-phy.cc:368
static TypeId GetTypeId()
Get the type ID.
Definition: wimax-phy.cc:42
uint64_t m_scanningFrequency
scanning frequency
Definition: wimax-phy.h:470
void DoDispose() override
Destructor implementation.
Definition: wimax-phy.cc:103
uint32_t GetFrequency() const
Get the frequency on which the device is locked.
Definition: wimax-phy.cc:326
double GetGValue() const
Get the guard interval factor (the ratio TG/Td)
Definition: wimax-phy.cc:386
Ptr< NetDevice > GetDevice() const
Definition: wimax-phy.cc:129
void SetPsPerFrame(uint16_t psPerFrame)
set the number of physical slots per frame
Definition: wimax-phy.cc:404
PhyState
PhyState enumeration.
Definition: wimax-phy.h:66
@ PHY_STATE_SCANNING
Definition: wimax-phy.h:68
uint32_t GetDataRate(ModulationType modulationType) const
Get the data rate corresponding to a modulation type.
Definition: wimax-phy.cc:234
virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const =0
Get transmission time.
uint32_t m_frequency
in KHz
Definition: wimax-phy.h:480
virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const =0
Get frame duration.
uint8_t m_nrCarriers
number of carriers
Definition: wimax-phy.h:478
void SetSimplex(uint64_t frequency)
configure the physical layer in simplex mode
Definition: wimax-phy.cc:173
Callback< void, Ptr< const PacketBurst > > m_rxCallback
receive callback function
Definition: wimax-phy.h:475
void SetFrameDuration(Time frameDuration)
Set the frame duration.
Definition: wimax-phy.cc:302
uint64_t GetScanningFrequency() const
Get the scanning frequency.
Definition: wimax-phy.cc:192
Time m_symbolDuration
in seconds
Definition: wimax-phy.h:483
void SetPsDuration(Time psDuration)
set the physical slot duration
Definition: wimax-phy.cc:362
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:246
void EndScanning()
End scanning.
Definition: wimax-phy.cc:148
uint16_t GetPsPerSymbol() const
Get the number of physical slots per symbol.
Definition: wimax-phy.cc:398
void SetState(PhyState state)
set the state of the device
Definition: wimax-phy.cc:198
Callback< void, bool, uint64_t > m_scanningCallback
scanning callback function
Definition: wimax-phy.h:476
virtual uint16_t DoGetRtg() const =0
Get RTG.
virtual double DoGetSamplingFrequency() const =0
Get sampling frequency.
virtual PhyType GetPhyType() const =0
Get the type of the physical layer.
virtual uint32_t DoGetDataRate(ModulationType modulationType) const =0
Get data rate.
void GetModulationFecParams(ModulationType modulationType, uint8_t &bitsPerSymbol, double &fecCode) const
Get modulation FEC parameters.
uint32_t GetChannelBandwidth() const
Get the channel bandwidth.
Definition: wimax-phy.cc:338
uint16_t m_psPerSymbol
ps per sumbol
Definition: wimax-phy.h:484
EventId GetChnlSrchTimeoutEvent() const
Get channel search timeout event.
Definition: wimax-phy.cc:216
double GetSamplingFactor() const
Get the sampling factor.
Definition: wimax-phy.cc:350
void SetPhyParameters()
computes the Physical parameters and store them
Definition: wimax-phy.cc:284
Time m_frameDuration
in seconds
Definition: wimax-phy.h:479
bool IsDuplex() const
Check if configured in duplex mode.
Definition: wimax-phy.cc:210
Callback< void, Ptr< const PacketBurst > > GetReceiveCallback() const
Definition: wimax-phy.cc:160
void SetPsPerSymbol(uint16_t psPerSymbol)
set the number of physical slots per symbol
Definition: wimax-phy.cc:392
PhyState m_state
state
Definition: wimax-phy.h:473
uint64_t GetTxFrequency() const
Get the transmission frequency.
Definition: wimax-phy.cc:186
uint16_t GetRtg() const
Get the receive/transmit transition gap.
Definition: wimax-phy.cc:264
uint16_t GetTtg() const
Get the transmit/receive transition gap.
Definition: wimax-phy.cc:258
uint16_t GetNfft() const
Get the size of the FFT.
Definition: wimax-phy.cc:344
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout