21 #include "ns3/simulator.h" 22 #include "ns3/packet.h" 27 #include "ns3/packet-burst.h" 28 #include "ns3/trace-source-accessor.h" 29 #include "ns3/pointer.h" 30 #include "ns3/uinteger.h" 31 #include "ns3/double.h" 43 .SetGroupName(
"Wimax")
47 .AddAttribute (
"Channel",
51 MakePointerChecker<WimaxChannel> ())
53 .AddAttribute (
"FrameDuration",
54 "The frame duration in seconds.",
59 .AddAttribute (
"Frequency",
60 "The central frequency in KHz.",
63 MakeUintegerChecker<uint32_t> (1000000, 11000000))
65 .AddAttribute (
"Bandwidth",
66 "The channel bandwidth in Hz.",
69 MakeUintegerChecker<uint32_t> (5000000, 30000000))
76 : m_state (PHY_STATE_IDLE),
78 m_frameDuration (
Seconds (0.01)),
79 m_frequency (5000000),
80 m_channelBandwidth (10000000),
134 "Error while scanning: The PHY state should be PHY_STATE_SCANNING or PHY_STATE_IDLE");
uint64_t m_rxFrequency
receive frequency
virtual uint16_t DoGetTtg(void) const =0
Get TTG.
uint64_t m_txFrequency
transmit frequency
uint8_t GetFrameDurationCode(void) const
Get the frame duration code.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
Callback< void, Ptr< const PacketBurst > > GetReceiveCallback(void) const
virtual double DoGetSamplingFactor(void) const =0
Get sampling factor.
void SetFrequency(uint32_t frequency)
set the frequency on which the device should lock
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void SetFrameDuration(Time frameDuration)
Set the frame duration.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
uint32_t GetSymbolsPerFrame(void) const
Get the number of symbols per frame.
virtual void DoAttach(Ptr< WimaxChannel > channel)=0
Attach channel.
virtual void DoDispose(void)
Destructor implementation.
virtual uint8_t DoGetFrameDurationCode(void) const =0
Get frame duration code.
EventId GetChnlSrchTimeoutEvent(void) const
Get channel search timeout event.
Ptr< Object > m_mobility
modility model
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time m_frameDuration
in seconds
Ptr< WimaxChannel > m_channel
channel
void SetSimplex(uint64_t frequency)
configure the physical layer in simplex mode
virtual Time DoGetTransmissionTime(uint32_t size, ModulationType modulationType) const =0
Get transmission time.
void SetScanningCallback(void) const
calls the scanning call back function
void SetSymbolsPerFrame(uint32_t symbolsPerFrame)
set the number of symbols per frame
void SetPsDuration(Time psDuration)
set the physical slot duration
uint32_t m_frequency
in KHz
double GetSamplingFactor(void) const
Get the sampling factor.
uint16_t GetRtg(void) const
Get the receive/transmit transition gap.
void SetReceiveCallback(Callback< void, Ptr< const PacketBurst > > callback)
set the callback function to call when a burst is received
uint64_t GetTxFrequency(void) const
Get the transmission frequency.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
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...
void EndScanning(void)
End scanning.
virtual uint16_t DoGetRtg(void) const =0
Get RTG.
virtual uint32_t DoGetDataRate(ModulationType modulationType) const =0
Get data rate.
uint32_t GetFrequency(void) const
Get the frequency on which the device is locked.
Time GetPsDuration(void) const
Get the physical slot duration.
uint16_t m_psPerFrame
ps per framce
uint16_t GetNfft(void) const
Get the size of the FFT.
uint16_t m_psPerSymbol
ps per sumbol
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
uint32_t m_channelBandwidth
in Hz
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
AttributeValue implementation for Time.
Ptr< NetDevice > GetDevice(void) const
Hold an unsigned integer type.
void SetPsPerSymbol(uint16_t psPerSymbol)
set the number of physical slots per symbol
uint16_t GetTtg(void) const
Get the transmit/receive transition gap.
bool IsDuplex(void) const
Check if configured in duplex mode.
Ptr< WimaxChannel > GetChannel(void) const
static TypeId GetTypeId(void)
Get the type ID.
Time GetTransmissionTime(uint32_t size, ModulationType modulationType) const
Get transmission time needed to send bytes at a given modulation.
virtual uint16_t DoGetNfft(void) const =0
Get NFFT.
virtual uint64_t DoGetNrBytes(uint32_t symbols, ModulationType modulationType) const =0
Get number of bytes.
Callback< void, bool, uint64_t > m_scanningCallback
scanning callback function
uint16_t GetPsPerFrame(void) const
Get the number of physical slots per frame.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
uint8_t m_nrCarriers
number of carriers
uint64_t GetScanningFrequency(void) const
Get the scanning frequency.
void SetChannelBandwidth(uint32_t channelBandwidth)
Set the channel bandwidth.
uint32_t m_symbolsPerFrame
symbols per frame
Time GetFrameDuration(void) const
Get the frame duration.
Time GetSymbolDuration(void) const
Get the OFDM symbol duration.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Time m_symbolDuration
in seconds
virtual uint64_t DoGetNrSymbols(uint32_t size, ModulationType modulationType) const =0
Get number of symbols.
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 ...
uint64_t GetNrSymbols(uint32_t size, ModulationType modulationType) const
Get the number of symbols needed to transmit size bytes using the modulation modulationType.
Callback< void, Ptr< const PacketBurst > > m_rxCallback
receive callback function
ModulationType
ModulationType enumeration.
Time m_psDuration
in seconds
void Attach(Ptr< WimaxChannel > channel)
Attach the physical layer to a channel.
uint32_t GetChannelBandwidth(void) const
Get the channel bandwidth.
void SetSymbolDuration(Time symbolDuration)
set the OFDM symbol duration
uint16_t GetPsPerSymbol(void) const
Get the number of physical slots per symbol.
An identifier for simulation events.
virtual Ptr< Object > GetMobility(void)
Get the mobility model of the device.
double GetGValue(void) const
Get the guard interval factor (the ratio TG/Td)
void SetDuplex(uint64_t rxFrequency, uint64_t txFrequency)
configure the physical layer in duplex mode
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDevice(Ptr< WimaxNetDevice > device)
Set the device in which this physical layer is installed.
void SetState(PhyState state)
set the state of the device
void SetDataRates(void)
calculates the data rate of each modulation and save them for future use
Time GetFrameDurationSec(void) const
Get the frame duration This method is redundant with GetFrameDuration ()
uint64_t GetRxFrequency(void) const
Get the reception frequency.
void SetNrCarriers(uint8_t nrCarriers)
Set the number of carriers in the physical frame.
Ptr< WimaxNetDevice > m_device
the device
A base class which provides memory management and object aggregation.
virtual void DoSetDataRates(void)=0
Set data rates.
void SetPsPerFrame(uint16_t psPerFrame)
set the number of physical slots per frame
PhyState GetState(void) const
Get the state of the device.
double GetSamplingFrequency(void) const
Get the sampling frequency.
virtual double DoGetGValue(void) const =0
Get G value.
void SetPhyParameters(void)
computes the Physical parameters and store them
virtual double DoGetSamplingFrequency(void) const =0
Get sampling frequency.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
PhyState
PhyState enumeration.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
EventId m_dlChnlSrchTimeoutEvent
DL channel search timeout event.
uint8_t GetNrCarriers(void) const
Get the number of carriers in the physical frame.
virtual void SetMobility(Ptr< Object > mobility)
set the mobility model of the device
virtual void DoSetPhyParameters(void)=0
Set phy parameters.
virtual Time DoGetFrameDuration(uint8_t frameDurationCode) const =0
Get frame duration.
uint32_t GetDataRate(ModulationType modulationType) const
Get the data rate corresponding to a modulation type.
uint64_t m_scanningFrequency
scanning frequency