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). More...
#include <half-duplex-ideal-phy.h>
Public Types | |
enum | State { IDLE, TX, RX } |
PHY states. More... | |
Public Member Functions | |
HalfDuplexIdealPhy () | |
virtual | ~HalfDuplexIdealPhy () |
Ptr< NetDevice > | GetDevice () |
get the associated NetDevice instance More... | |
Ptr< MobilityModel > | GetMobility () |
get the associated MobilityModel instance More... | |
DataRate | GetRate () const |
Ptr< AntennaModel > | GetRxAntenna () |
get the AntennaModel used by the NetDevice for reception More... | |
Ptr< const SpectrumModel > | GetRxSpectrumModel () const |
void | SetAntenna (Ptr< AntennaModel > a) |
set the AntennaModel to be used More... | |
void | SetChannel (Ptr< SpectrumChannel > c) |
Set the channel attached to this device. More... | |
void | SetDevice (Ptr< NetDevice > d) |
set the associated NetDevice instance More... | |
void | SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c) |
set the callback for the end of a RX in error, as part of the interconnections betweenthe PHY and the MAC More... | |
void | SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c) |
set the callback for the successful end of a RX, as part of the interconnections betweenthe PHY and the MAC More... | |
void | SetGenericPhyRxStartCallback (GenericPhyRxStartCallback c) |
set the callback for the start of RX, as part of the interconnections betweenthe PHY and the MAC More... | |
void | SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c) |
set the callback for the end of a TX, as part of the interconnections betweenthe PHY and the MAC More... | |
void | SetMobility (Ptr< MobilityModel > m) |
Set the mobility model associated with this device. More... | |
void | SetNoisePowerSpectralDensity (Ptr< const SpectrumValue > noisePsd) |
void | SetRate (DataRate rate) |
set the PHY rate to be used by this PHY. More... | |
void | SetTxPowerSpectralDensity (Ptr< SpectrumValue > txPsd) |
set the Power Spectral Density of outgoing signals in power units (Watt, Pascal...) per Hz. More... | |
void | StartRx (Ptr< SpectrumSignalParameters > params) |
Notify the SpectrumPhy instance of an incoming signal. More... | |
bool | StartTx (Ptr< Packet > p) |
Start a transmission. More... | |
Public Member Functions inherited from ns3::SpectrumPhy | |
SpectrumPhy () | |
virtual | ~SpectrumPhy () |
Public Member Functions inherited from ns3::Object | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SpectrumPhy | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
void | AbortRx () |
void | ChangeState (State newState) |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
void | EndRx () |
void | EndTx () |
Private Attributes | |
Ptr< AntennaModel > | m_antenna |
Ptr< SpectrumChannel > | m_channel |
EventId | m_endRxEventId |
SpectrumInterference | m_interference |
Ptr< MobilityModel > | m_mobility |
Ptr< NetDevice > | m_netDevice |
GenericPhyRxEndErrorCallback | m_phyMacRxEndErrorCallback |
GenericPhyRxEndOkCallback | m_phyMacRxEndOkCallback |
GenericPhyRxStartCallback | m_phyMacRxStartCallback |
GenericPhyTxEndCallback | m_phyMacTxEndCallback |
TracedCallback< Ptr< const Packet > > | m_phyRxAbortTrace |
TracedCallback< Ptr< const Packet > > | m_phyRxEndErrorTrace |
TracedCallback< Ptr< const Packet > > | m_phyRxEndOkTrace |
TracedCallback< Ptr< const Packet > > | m_phyRxStartTrace |
TracedCallback< Ptr< const Packet > > | m_phyTxEndTrace |
TracedCallback< Ptr< const Packet > > | m_phyTxStartTrace |
DataRate | m_rate |
Ptr< Packet > | m_rxPacket |
Ptr< const SpectrumValue > | m_rxPsd |
State | m_state |
Ptr< Packet > | m_txPacket |
Ptr< SpectrumValue > | m_txPsd |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
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).
Doxygen introspection did not find any typical Config paths.
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:
This PHY model supports a single antenna model instance which is used for both transmission and reception.
Definition at line 78 of file half-duplex-ideal-phy.h.
ns3::HalfDuplexIdealPhy::HalfDuplexIdealPhy | ( | ) |
Definition at line 42 of file half-duplex-ideal-phy.cc.
References m_interference, and ns3::SpectrumInterference::SetErrorModel().
|
virtual |
Definition at line 53 of file half-duplex-ideal-phy.cc.
|
private |
Definition at line 394 of file half-duplex-ideal-phy.cc.
References ns3::SpectrumInterference::AbortRx(), ns3::EventId::Cancel(), ChangeState(), IDLE, m_endRxEventId, m_interference, m_phyRxAbortTrace, m_rxPacket, m_state, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RX.
Referenced by StartTx().
|
private |
Definition at line 261 of file half-duplex-ideal-phy.cc.
References m_state, and NS_LOG_LOGIC.
Referenced by AbortRx(), EndRx(), EndTx(), StartRx(), and StartTx().
|
privatevirtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
Definition at line 58 of file half-duplex-ideal-phy.cc.
References ns3::Object::DoDispose(), m_channel, m_mobility, m_netDevice, m_phyMacRxEndErrorCallback, m_phyMacRxEndOkCallback, m_phyMacRxStartCallback, m_phyMacTxEndCallback, m_rxPacket, m_rxPsd, m_txPacket, m_txPsd, and NS_LOG_FUNCTION.
|
private |
Definition at line 409 of file half-duplex-ideal-phy.cc.
References ChangeState(), ns3::SpectrumInterference::EndRx(), IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_interference, m_phyMacRxEndErrorCallback, m_phyMacRxEndOkCallback, m_phyRxEndErrorTrace, m_phyRxEndOkTrace, m_rxPacket, m_rxPsd, m_state, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RX.
Referenced by StartRx().
|
private |
Definition at line 309 of file half-duplex-ideal-phy.cc.
References ChangeState(), IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_phyMacTxEndCallback, m_phyTxEndTrace, m_state, m_txPacket, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and TX.
Referenced by StartTx().
get the associated NetDevice instance
Implements ns3::SpectrumPhy.
Definition at line 133 of file half-duplex-ideal-phy.cc.
References m_netDevice, and NS_LOG_FUNCTION.
|
virtual |
get the associated MobilityModel instance
Implements ns3::SpectrumPhy.
Definition at line 141 of file half-duplex-ideal-phy.cc.
References m_mobility, and NS_LOG_FUNCTION.
DataRate ns3::HalfDuplexIdealPhy::GetRate | ( | void | ) | const |
Definition at line 209 of file half-duplex-ideal-phy.cc.
References m_rate, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
get the AntennaModel used by the NetDevice for reception
Implements ns3::SpectrumPhy.
Definition at line 247 of file half-duplex-ideal-phy.cc.
References m_antenna, and NS_LOG_FUNCTION.
|
virtual |
Implements ns3::SpectrumPhy.
Definition at line 172 of file half-duplex-ideal-phy.cc.
References m_txPsd.
|
static |
Definition at line 97 of file half-duplex-ideal-phy.cc.
References GetRate(), m_phyRxAbortTrace, m_phyRxEndErrorTrace, m_phyRxEndOkTrace, m_phyRxStartTrace, m_phyTxEndTrace, m_phyTxStartTrace, ns3::MakeTraceSourceAccessor(), ns3::TypeId::SetParent(), and SetRate().
void ns3::HalfDuplexIdealPhy::SetAntenna | ( | Ptr< AntennaModel > | a | ) |
set the AntennaModel to be used
a | the Antenna Model |
Definition at line 254 of file half-duplex-ideal-phy.cc.
References m_antenna, and NS_LOG_FUNCTION.
|
virtual |
Set the channel attached to this device.
c | the channel |
Implements ns3::SpectrumPhy.
Definition at line 165 of file half-duplex-ideal-phy.cc.
References m_channel, and NS_LOG_FUNCTION.
set the associated NetDevice instance
d | the NetDevice instance |
Implements ns3::SpectrumPhy.
Definition at line 149 of file half-duplex-ideal-phy.cc.
References m_netDevice, and NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetGenericPhyRxEndErrorCallback | ( | GenericPhyRxEndErrorCallback | c | ) |
set the callback for the end of a RX in error, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
Definition at line 232 of file half-duplex-ideal-phy.cc.
References m_phyMacRxEndErrorCallback, and NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetGenericPhyRxEndOkCallback | ( | GenericPhyRxEndOkCallback | c | ) |
set the callback for the successful end of a RX, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
Definition at line 240 of file half-duplex-ideal-phy.cc.
References m_phyMacRxEndOkCallback, and NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetGenericPhyRxStartCallback | ( | GenericPhyRxStartCallback | c | ) |
set the callback for the start of RX, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
Definition at line 224 of file half-duplex-ideal-phy.cc.
References m_phyMacRxStartCallback, and NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetGenericPhyTxEndCallback | ( | GenericPhyTxEndCallback | c | ) |
set the callback for the end of a TX, as part of the interconnections betweenthe PHY and the MAC
c | the callback |
Definition at line 217 of file half-duplex-ideal-phy.cc.
References m_phyMacTxEndCallback, and NS_LOG_FUNCTION.
|
virtual |
Set the mobility model associated with this device.
m | the mobility model |
Implements ns3::SpectrumPhy.
Definition at line 157 of file half-duplex-ideal-phy.cc.
References m_mobility, and NS_LOG_FUNCTION.
void ns3::HalfDuplexIdealPhy::SetNoisePowerSpectralDensity | ( | Ptr< const SpectrumValue > | noisePsd | ) |
noisePsd | the Noise Power Spectral Density in power units (Watt, Pascal...) per Hz. |
Definition at line 194 of file half-duplex-ideal-phy.cc.
References m_interference, 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 |
Definition at line 202 of file half-duplex-ideal-phy.cc.
References m_rate, and 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 |
Definition at line 185 of file half-duplex-ideal-phy.cc.
References m_txPsd, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_INFO.
|
virtual |
Notify the SpectrumPhy instance of an incoming signal.
params | the parameters of the signals being received |
Implements ns3::SpectrumPhy.
Definition at line 329 of file half-duplex-ideal-phy.cc.
References ns3::SpectrumInterference::AddSignal(), ChangeState(), EndRx(), IDLE, ns3::Integral(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_endRxEventId, m_interference, m_phyMacRxStartCallback, m_phyRxStartTrace, m_rxPacket, m_rxPsd, m_state, NS_LOG_FUNCTION, NS_LOG_LOGIC, RX, ns3::Simulator::Schedule(), ns3::SpectrumInterference::StartRx(), and TX.
Start a transmission.
p | the packet to be transmitted |
Definition at line 268 of file half-duplex-ideal-phy.cc.
References AbortRx(), ns3::DataRate::CalculateTxTime(), ChangeState(), EndTx(), ns3::Packet::GetSize(), IDLE, ns3::Integral(), m_antenna, m_channel, m_phyTxStartTrace, m_rate, m_state, m_txPacket, m_txPsd, NS_LOG_FUNCTION, NS_LOG_LOGIC, RX, ns3::Simulator::Schedule(), and TX.
Referenced by ns3::AdhocAlohaNoackIdealPhyHelper::Install().
|
private |
Definition at line 197 of file half-duplex-ideal-phy.h.
Referenced by GetRxAntenna(), SetAntenna(), and StartTx().
|
private |
Definition at line 199 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), SetChannel(), and StartTx().
|
private |
Definition at line 194 of file half-duplex-ideal-phy.h.
|
private |
Definition at line 222 of file half-duplex-ideal-phy.h.
Referenced by AbortRx(), EndRx(), HalfDuplexIdealPhy(), SetNoisePowerSpectralDensity(), and StartRx().
|
private |
Definition at line 196 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), GetMobility(), and SetMobility().
Definition at line 198 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), GetDevice(), and SetDevice().
|
private |
Definition at line 219 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), EndRx(), and SetGenericPhyRxEndErrorCallback().
|
private |
Definition at line 220 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), EndRx(), and SetGenericPhyRxEndOkCallback().
|
private |
Definition at line 218 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), SetGenericPhyRxStartCallback(), and StartRx().
|
private |
Definition at line 217 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), EndTx(), and SetGenericPhyTxEndCallback().
|
private |
Definition at line 213 of file half-duplex-ideal-phy.h.
Referenced by AbortRx(), and GetTypeId().
|
private |
Definition at line 215 of file half-duplex-ideal-phy.h.
Referenced by EndRx(), and GetTypeId().
|
private |
Definition at line 214 of file half-duplex-ideal-phy.h.
Referenced by EndRx(), and GetTypeId().
|
private |
Definition at line 212 of file half-duplex-ideal-phy.h.
Referenced by GetTypeId(), and StartRx().
|
private |
Definition at line 211 of file half-duplex-ideal-phy.h.
Referenced by EndTx(), and GetTypeId().
|
private |
Definition at line 210 of file half-duplex-ideal-phy.h.
Referenced by GetTypeId(), and StartTx().
|
private |
Definition at line 206 of file half-duplex-ideal-phy.h.
Definition at line 204 of file half-duplex-ideal-phy.h.
Referenced by AbortRx(), DoDispose(), EndRx(), and StartRx().
|
private |
Definition at line 202 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), EndRx(), and StartRx().
|
private |
Definition at line 208 of file half-duplex-ideal-phy.h.
Referenced by AbortRx(), ChangeState(), EndRx(), EndTx(), StartRx(), and StartTx().
Definition at line 203 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), EndTx(), and StartTx().
|
private |
Definition at line 201 of file half-duplex-ideal-phy.h.
Referenced by DoDispose(), GetRxSpectrumModel(), SetTxPowerSpectralDensity(), and StartTx().