ns-3
|
#include <half-duplex-ideal-phy.h>
Public Types | |
enum | State { IDLE, TX, RX } |
Public Member Functions | |
void | SetChannel (Ptr< SpectrumChannel > c) |
void | SetMobility (Ptr< MobilityModel > m) |
void | SetDevice (Ptr< NetDevice > d) |
Ptr< MobilityModel > | GetMobility () |
Ptr< NetDevice > | GetDevice () |
Ptr< const SpectrumModel > | GetRxSpectrumModel () const |
void | StartRx (Ptr< SpectrumSignalParameters > params) |
void | SetTxPowerSpectralDensity (Ptr< SpectrumValue > txPsd) |
void | SetNoisePowerSpectralDensity (Ptr< const SpectrumValue > noisePsd) |
bool | StartTx (Ptr< Packet > p) |
void | SetRate (DataRate rate) |
DataRate | GetRate () const |
void | SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c) |
void | SetGenericPhyRxStartCallback (GenericPhyRxStartCallback c) |
void | SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c) |
void | SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::HalfDuplexIdealPhy. |
This PHY layer implementation realizes an ideal OFDM PHY which transmits half-duplex (i.e., it can either receive or transmit at a given time). The device is ideal in the sense that: 1) it uses an error model based on the Shannon capacity, which assumes ideal channel coding; 2) it uses ideal signal acquisition, i.e., preamble detection and synchronization are always successful 3) it has no PHY layer overhead
Being half duplex, if a RX is ongoing but a TX is requested, the RX is aborted and the TX is started. Of course, no RX can be performed while there is an ongoing TX.
The use of OFDM is modeled by means of the Spectrum framework. By calling the method SetTxPowerSpectralDensity(), the user can specify how much of the spectrum is used, how many subcarriers are used, and what power is allocated to each subcarrier.
The user can also specify the PHY rate at which communications take place by using SetRate(). This is equivalent to choosing a particular modulation and coding scheme.
The use of the ShannonSpectrumErrorModel allows us to account for the following aspects in determining whether a transmission is successful or not:
PHY states
Ptr< NetDevice > ns3::HalfDuplexIdealPhy::GetDevice | ( | ) | [virtual] |
Ptr< MobilityModel > ns3::HalfDuplexIdealPhy::GetMobility | ( | ) | [virtual] |
DataRate ns3::HalfDuplexIdealPhy::GetRate | ( | void | ) | const |
Ptr< const SpectrumModel > ns3::HalfDuplexIdealPhy::GetRxSpectrumModel | ( | ) | const [virtual] |
Implements ns3::SpectrumPhy.
References ns3::SpectrumValue::GetSpectrumModel().
TypeId ns3::HalfDuplexIdealPhy::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::HalfDuplexIdealPhy.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
TraceSources defined for this type:
Reimplemented from ns3::SpectrumPhy.
References GetRate(), ns3::MakeTraceSourceAccessor(), ns3::TypeId::SetParent(), and SetRate().
void ns3::HalfDuplexIdealPhy::SetChannel | ( | Ptr< SpectrumChannel > | c | ) | [virtual] |
Set the channel attached to this device.
c | the channel |
Implements ns3::SpectrumPhy.
References NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetDevice | ( | Ptr< NetDevice > | d | ) | [virtual] |
set the associated NetDevice instance
d | the NetDevice instance |
Implements ns3::SpectrumPhy.
References NS_LOG_FUNCTION.
set the callback for the end of a RX in error, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
References NS_LOG_FUNCTION.
set the callback for the successful end of a RX, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
References NS_LOG_FUNCTION.
set the callback for the start of RX, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
References NS_LOG_FUNCTION.
set the callback for the end of a TX, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
References NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetMobility | ( | Ptr< MobilityModel > | m | ) | [virtual] |
Set the mobility model associated with this device.
m | the mobility model |
Implements ns3::SpectrumPhy.
References NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetNoisePowerSpectralDensity | ( | Ptr< const SpectrumValue > | noisePsd | ) |
noisePsd | the Noise Power Spectral Density in power units (Watt, Pascal...) per Hz. |
References NS_ASSERT, NS_LOG_FUNCTION, and ns3::SpectrumInterference::SetNoisePowerSpectralDensity().
void ns3::HalfDuplexIdealPhy::SetRate | ( | DataRate | rate | ) |
set the PHY rate to be used by this PHY.
rate |
References NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::HalfDuplexIdealPhy::SetTxPowerSpectralDensity | ( | Ptr< SpectrumValue > | txPsd | ) |
set the Power Spectral Density of outgoing signals in power units (Watt, Pascal...) per Hz.
txPsd |
References NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_INFO.
void ns3::HalfDuplexIdealPhy::StartRx | ( | Ptr< SpectrumSignalParameters > | params | ) | [virtual] |
Notify the SpectrumPhy instance of an incoming signal
params | the parameters of the signals being received |
Implements ns3::SpectrumPhy.
References ns3::SpectrumInterference::AddSignal(), ns3::Integral(), NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and ns3::SpectrumInterference::StartRx().
bool ns3::HalfDuplexIdealPhy::StartTx | ( | Ptr< Packet > | p | ) |
Start a transmission
p | the packet to be transmitted |
References ns3::DataRate::CalculateTxTime(), ns3::Packet::GetSize(), ns3::Integral(), NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::SpectrumChannel::StartTx().
Referenced by ns3::AdhocAlohaNoackIdealPhyHelper::Install().