14#include "ns3/double.h"
16#include "ns3/packet-burst.h"
17#include "ns3/packet.h"
18#include "ns3/pointer.h"
19#include "ns3/simulator.h"
20#include "ns3/trace-source-accessor.h"
21#include "ns3/uinteger.h"
36 .SetGroupName(
"Wimax")
40 .AddAttribute(
"Channel",
48 "The frame duration in seconds.",
53 .AddAttribute(
"Frequency",
54 "The central frequency in KHz.",
59 .AddAttribute(
"Bandwidth",
60 "The channel bandwidth in Hz.",
71 : m_state(PHY_STATE_IDLE),
75 m_channelBandwidth(10000000),
128 "Error while scanning: The PHY state should be PHY_STATE_SCANNING or PHY_STATE_IDLE");
An identifier for simulation events.
A base class which provides memory management and object aggregation.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
Time GetTransmissionTime(uint32_t size, ModulationType modulationType) const
Get transmission time needed to send bytes at a given modulation.
Time GetFrameDuration() const
Get the frame duration.
ModulationType
ModulationType enumeration.
virtual double DoGetGValue() const =0
Get G value.
void SetSymbolDuration(Time symbolDuration)
set the OFDM symbol duration
Ptr< WimaxChannel > GetChannel() const
uint32_t GetSymbolsPerFrame() const
Get the number of symbols per frame.
void SetChannelBandwidth(uint32_t channelBandwidth)
Set the channel bandwidth.
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...
virtual uint8_t DoGetFrameDurationCode() const =0
Get frame duration code.
uint64_t m_txFrequency
transmit frequency
void SetDuplex(uint64_t rxFrequency, uint64_t txFrequency)
configure the physical layer in duplex mode
EventId m_dlChnlSrchTimeoutEvent
DL channel search timeout event.
uint64_t GetRxFrequency() const
Get the reception frequency.
Time GetFrameDurationSec() const
Get the frame duration This method is redundant with GetFrameDuration ()
void SetDataRates()
calculates the data rate of each modulation and save them for future use
uint16_t GetPsPerFrame() const
Get the number of physical slots per frame.
Time GetSymbolDuration() const
Get the OFDM symbol duration.
uint8_t GetNrCarriers() const
Get the number of carriers in the physical frame.
uint32_t m_channelBandwidth
in Hz
Time m_psDuration
in seconds
PhyState GetState() const
Get the state of the device.
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.
uint16_t m_psPerFrame
ps per framce
virtual uint16_t DoGetNfft() const =0
Get NFFT.
void SetFrequency(uint32_t frequency)
set the frequency on which the device should lock
uint32_t m_symbolsPerFrame
symbols per frame
uint8_t GetFrameDurationCode() const
Get the frame duration code.
void SetDevice(Ptr< WimaxNetDevice > device)
Set the device in which this physical layer is installed.
uint64_t m_rxFrequency
receive frequency
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
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
virtual void DoAttach(Ptr< WimaxChannel > channel)=0
Attach channel.
void SetSymbolsPerFrame(uint32_t symbolsPerFrame)
set the number of symbols per frame
Ptr< WimaxNetDevice > m_device
the device
void SetScanningCallback() const
calls the scanning call back function
virtual uint64_t DoGetNrSymbols(uint32_t size, ModulationType modulationType) const =0
Get number of symbols.
double GetSamplingFrequency() const
Get the sampling frequency.
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.
Ptr< WimaxChannel > m_channel
channel
Time GetPsDuration() const
Get the physical slot duration.
static TypeId GetTypeId()
Get the type ID.
uint64_t m_scanningFrequency
scanning frequency
void DoDispose() override
Destructor implementation.
uint32_t GetFrequency() const
Get the frequency on which the device is locked.
double GetGValue() const
Get the guard interval factor (the ratio TG/Td)
Ptr< NetDevice > GetDevice() const
void SetPsPerFrame(uint16_t psPerFrame)
set the number of physical slots per frame
PhyState
PhyState enumeration.
uint32_t GetDataRate(ModulationType modulationType) const
Get the data rate corresponding to a modulation type.
virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const =0
Get transmission time.
uint32_t m_frequency
in KHz
virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const =0
Get frame duration.
uint8_t m_nrCarriers
number of carriers
void SetSimplex(uint64_t frequency)
configure the physical layer in simplex mode
Callback< void, Ptr< const PacketBurst > > m_rxCallback
receive callback function
void SetFrameDuration(Time frameDuration)
Set the frame duration.
uint64_t GetScanningFrequency() const
Get the scanning frequency.
Time m_symbolDuration
in seconds
void SetPsDuration(Time psDuration)
set the physical slot duration
uint64_t GetNrSymbols(uint32_t size, ModulationType modulationType) const
Get the number of symbols needed to transmit size bytes using the modulation modulationType.
void EndScanning()
End scanning.
uint16_t GetPsPerSymbol() const
Get the number of physical slots per symbol.
void SetState(PhyState state)
set the state of the device
Callback< void, bool, uint64_t > m_scanningCallback
scanning callback function
virtual uint16_t DoGetRtg() const =0
Get RTG.
virtual double DoGetSamplingFrequency() const =0
Get sampling frequency.
virtual uint32_t DoGetDataRate(ModulationType modulationType) const =0
Get data rate.
uint32_t GetChannelBandwidth() const
Get the channel bandwidth.
uint16_t m_psPerSymbol
ps per sumbol
EventId GetChnlSrchTimeoutEvent() const
Get channel search timeout event.
double GetSamplingFactor() const
Get the sampling factor.
void SetPhyParameters()
computes the Physical parameters and store them
Time m_frameDuration
in seconds
bool IsDuplex() const
Check if configured in duplex mode.
Callback< void, Ptr< const PacketBurst > > GetReceiveCallback() const
void SetPsPerSymbol(uint16_t psPerSymbol)
set the number of physical slots per symbol
uint64_t GetTxFrequency() const
Get the transmission frequency.
uint16_t GetRtg() const
Get the receive/transmit transition gap.
uint16_t GetTtg() const
Get the transmit/receive transition gap.
uint16_t GetNfft() const
Get the size of the FFT.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.