A Discrete-Event Network Simulator
API
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;
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;
365 virtual Ptr<Object> GetMobility();
370 virtual void SetMobility(Ptr<Object> mobility);
371
380 virtual int64_t AssignStreams(int64_t stream) = 0;
381
382 private:
390 uint8_t& bitsPerSymbol,
391 double& fecCode) const;
393 void EndScanning();
400 virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const = 0;
407 virtual void DoSetDataRates() = 0;
413 virtual uint32_t DoGetDataRate(ModulationType modulationType) const = 0;
420 virtual uint64_t DoGetNrSymbols(uint32_t size, ModulationType modulationType) const = 0;
427 virtual uint64_t DoGetNrBytes(uint32_t symbols, ModulationType modulationType) const = 0;
432 virtual uint16_t DoGetTtg() const = 0;
437 virtual uint16_t DoGetRtg() const = 0;
438
443 virtual uint8_t DoGetFrameDurationCode() const = 0;
449 virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const = 0;
453 virtual void DoSetPhyParameters() = 0;
458 virtual double DoGetSamplingFactor() const = 0;
463 virtual uint16_t DoGetNfft() const = 0;
468 virtual double DoGetSamplingFrequency() const = 0;
473 virtual double DoGetGValue() const = 0;
474
477
478 uint64_t m_txFrequency;
479 uint64_t m_rxFrequency;
482 bool m_duplex;
484
487
488 uint8_t m_nrCarriers;
494 uint16_t m_psPerSymbol;
495 uint16_t m_psPerFrame;
498};
499
500} // namespace ns3
501
502#endif /* WIMAX_PHY_H */
Callback template class.
Definition: callback.h:443
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:60
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:241
Time GetFrameDuration() const
Get the frame duration.
Definition: wimax-phy.cc:309
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:482
void SetSymbolDuration(Time symbolDuration)
set the OFDM symbol duration
Definition: wimax-phy.cc:375
virtual void SetMobility(Ptr< Object > mobility)
set the mobility model of the device
Definition: wimax-phy.cc:435
Ptr< WimaxChannel > GetChannel() const
Definition: wimax-phy.cc:118
uint32_t GetSymbolsPerFrame() const
Get the number of symbols per frame.
Definition: wimax-phy.cc:423
void SetChannelBandwidth(uint32_t channelBandwidth)
Set the channel bandwidth.
Definition: wimax-phy.cc:333
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:253
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:478
~WimaxPhy() override
Definition: wimax-phy.cc:99
void SetDuplex(uint64_t rxFrequency, uint64_t txFrequency)
configure the physical layer in duplex mode
Definition: wimax-phy.cc:167
EventId m_dlChnlSrchTimeoutEvent
DL channel search timeout event.
Definition: wimax-phy.h:481
uint64_t GetRxFrequency() const
Get the reception frequency.
Definition: wimax-phy.cc:181
Time GetFrameDurationSec() const
Get the frame duration This method is redundant with GetFrameDuration ()
Definition: wimax-phy.cc:315
void SetDataRates()
calculates the data rate of each modulation and save them for future use
Definition: wimax-phy.cc:229
uint16_t GetPsPerFrame() const
Get the number of physical slots per frame.
Definition: wimax-phy.cc:411
Ptr< Object > m_mobility
modility model
Definition: wimax-phy.h:497
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:381
uint8_t GetNrCarriers() const
Get the number of carriers in the physical frame.
Definition: wimax-phy.cc:297
uint32_t m_channelBandwidth
in Hz
Definition: wimax-phy.h:491
Time m_psDuration
in seconds
Definition: wimax-phy.h:492
PhyState GetState() const
Get the state of the device.
Definition: wimax-phy.cc:205
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:111
uint16_t m_psPerFrame
ps per framce
Definition: wimax-phy.h:495
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:321
uint32_t m_symbolsPerFrame
symbols per frame
Definition: wimax-phy.h:496
uint8_t GetFrameDurationCode() const
Get the frame duration code.
Definition: wimax-phy.cc:271
void SetDevice(Ptr< WimaxNetDevice > device)
Set the device in which this physical layer is installed.
Definition: wimax-phy.cc:124
virtual Ptr< Object > GetMobility()
Get the mobility model of the device.
Definition: wimax-phy.cc:429
uint64_t m_rxFrequency
receive frequency
Definition: wimax-phy.h:479
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:136
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:155
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:417
Ptr< WimaxNetDevice > m_device
the device
Definition: wimax-phy.h:475
void SetScanningCallback() const
calls the scanning call back function
Definition: wimax-phy.cc:223
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:357
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:291
Ptr< WimaxChannel > m_channel
channel
Definition: wimax-phy.h:476
Time GetPsDuration() const
Get the physical slot duration.
Definition: wimax-phy.cc:369
static TypeId GetTypeId()
Get the type ID.
Definition: wimax-phy.cc:42
uint64_t m_scanningFrequency
scanning frequency
Definition: wimax-phy.h:480
void DoDispose() override
Destructor implementation.
Definition: wimax-phy.cc:104
uint32_t GetFrequency() const
Get the frequency on which the device is locked.
Definition: wimax-phy.cc:327
double GetGValue() const
Get the guard interval factor (the ratio TG/Td)
Definition: wimax-phy.cc:387
Ptr< NetDevice > GetDevice() const
Definition: wimax-phy.cc:130
void SetPsPerFrame(uint16_t psPerFrame)
set the number of physical slots per frame
Definition: wimax-phy.cc:405
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:235
virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const =0
Get transmission time.
uint32_t m_frequency
in KHz
Definition: wimax-phy.h:490
virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const =0
Get frame duration.
uint8_t m_nrCarriers
number of carriers
Definition: wimax-phy.h:488
void SetSimplex(uint64_t frequency)
configure the physical layer in simplex mode
Definition: wimax-phy.cc:174
Callback< void, Ptr< const PacketBurst > > m_rxCallback
receive callback function
Definition: wimax-phy.h:485
void SetFrameDuration(Time frameDuration)
Set the frame duration.
Definition: wimax-phy.cc:303
uint64_t GetScanningFrequency() const
Get the scanning frequency.
Definition: wimax-phy.cc:193
Time m_symbolDuration
in seconds
Definition: wimax-phy.h:493
void SetPsDuration(Time psDuration)
set the physical slot duration
Definition: wimax-phy.cc:363
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:247
void EndScanning()
End scanning.
Definition: wimax-phy.cc:149
uint16_t GetPsPerSymbol() const
Get the number of physical slots per symbol.
Definition: wimax-phy.cc:399
void SetState(PhyState state)
set the state of the device
Definition: wimax-phy.cc:199
Callback< void, bool, uint64_t > m_scanningCallback
scanning callback function
Definition: wimax-phy.h:486
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:339
uint16_t m_psPerSymbol
ps per sumbol
Definition: wimax-phy.h:494
EventId GetChnlSrchTimeoutEvent() const
Get channel search timeout event.
Definition: wimax-phy.cc:217
double GetSamplingFactor() const
Get the sampling factor.
Definition: wimax-phy.cc:351
void SetPhyParameters()
computes the Physical parameters and store them
Definition: wimax-phy.cc:285
Time m_frameDuration
in seconds
Definition: wimax-phy.h:489
bool IsDuplex() const
Check if configured in duplex mode.
Definition: wimax-phy.cc:211
Callback< void, Ptr< const PacketBurst > > GetReceiveCallback() const
Definition: wimax-phy.cc:161
void SetPsPerSymbol(uint16_t psPerSymbol)
set the number of physical slots per symbol
Definition: wimax-phy.cc:393
PhyState m_state
state
Definition: wimax-phy.h:483
uint64_t GetTxFrequency() const
Get the transmission frequency.
Definition: wimax-phy.cc:187
uint16_t GetRtg() const
Get the receive/transmit transition gap.
Definition: wimax-phy.cc:265
uint16_t GetTtg() const
Get the transmit/receive transition gap.
Definition: wimax-phy.cc:259
uint16_t GetNfft() const
Get the size of the FFT.
Definition: wimax-phy.cc:345
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:81
mobility
Definition: third.py:96
ns3::Time timeout