A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::HalfDuplexIdealPhy Class Reference

#include <half-duplex-ideal-phy.h>

+ Inheritance diagram for ns3::HalfDuplexIdealPhy:
+ Collaboration diagram for ns3::HalfDuplexIdealPhy:

Public Types

enum  State { IDLE, TX, RX }

Public Member Functions

 HalfDuplexIdealPhy ()
virtual ~HalfDuplexIdealPhy ()
Ptr< NetDeviceGetDevice ()
Ptr< MobilityModelGetMobility ()
DataRate GetRate () const
Ptr< AntennaModelGetRxAntenna ()
Ptr< const SpectrumModelGetRxSpectrumModel () const
void SetAntenna (Ptr< AntennaModel > a)
void SetChannel (Ptr< SpectrumChannel > c)
void SetDevice (Ptr< NetDevice > d)
void SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c)
void SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c)
void SetGenericPhyRxStartCallback (GenericPhyRxStartCallback c)
void SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c)
void SetMobility (Ptr< MobilityModel > m)
void SetNoisePowerSpectralDensity (Ptr< const SpectrumValue > noisePsd)
void SetRate (DataRate rate)
void SetTxPowerSpectralDensity (Ptr< SpectrumValue > txPsd)
void StartRx (Ptr< SpectrumSignalParameters > params)
bool StartTx (Ptr< Packet > p)
- 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)
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 Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
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)
 This method returns the TypeId associated to ns3::HalfDuplexIdealPhy.

Private Member Functions

void AbortRx ()
void ChangeState (State newState)
virtual void DoDispose (void)
void EndRx ()
void EndTx ()

Private Attributes

Ptr< AntennaModelm_antenna
Ptr< SpectrumChannelm_channel
EventId m_endRxEventId
SpectrumInterference m_interference
Ptr< MobilityModelm_mobility
Ptr< NetDevicem_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< Packetm_rxPacket
Ptr< const SpectrumValuem_rxPsd
State m_state
Ptr< Packetm_txPacket
Ptr< SpectrumValuem_txPsd

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
virtual void DoDispose (void)
virtual void DoStart (void)
virtual void NotifyNewAggregate (void)

Detailed Description

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:

  • the PHY rate (trades off communication speed with reliability)
  • the power spectral density (trade-off among total power consumed, total bandwidth used (i.e., how much of the spectrum is occupied), and communication reliability)
  • the signal propagation

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.

Member Enumeration Documentation

PHY states

Enumerator:
IDLE 
TX 
RX 

Definition at line 89 of file half-duplex-ideal-phy.h.

Constructor & Destructor Documentation

ns3::HalfDuplexIdealPhy::HalfDuplexIdealPhy ( )

Definition at line 41 of file half-duplex-ideal-phy.cc.

References m_interference, and ns3::SpectrumInterference::SetErrorModel().

+ Here is the call graph for this function:

ns3::HalfDuplexIdealPhy::~HalfDuplexIdealPhy ( )
virtual

Definition at line 52 of file half-duplex-ideal-phy.cc.

Member Function Documentation

void ns3::HalfDuplexIdealPhy::AbortRx ( )
private

Definition at line 393 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::HalfDuplexIdealPhy::ChangeState ( State  newState)
private

Definition at line 260 of file half-duplex-ideal-phy.cc.

References m_state, and NS_LOG_LOGIC.

Referenced by AbortRx(), EndRx(), EndTx(), StartRx(), and StartTx().

+ Here is the caller graph for this function:

void ns3::HalfDuplexIdealPhy::DoDispose ( void  )
privatevirtual
void ns3::HalfDuplexIdealPhy::EndRx ( )
private
void ns3::HalfDuplexIdealPhy::EndTx ( )
private

Definition at line 308 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< NetDevice > ns3::HalfDuplexIdealPhy::GetDevice ( )
virtual

get the associated NetDevice instance

Returns
a Ptr to the associated NetDevice instance

Implements ns3::SpectrumPhy.

Definition at line 132 of file half-duplex-ideal-phy.cc.

References m_netDevice, and NS_LOG_FUNCTION.

Ptr< MobilityModel > ns3::HalfDuplexIdealPhy::GetMobility ( )
virtual

get the associated MobilityModel instance

Returns
a Ptr to the associated MobilityModel instance

Implements ns3::SpectrumPhy.

Definition at line 140 of file half-duplex-ideal-phy.cc.

References m_mobility, and NS_LOG_FUNCTION.

DataRate ns3::HalfDuplexIdealPhy::GetRate ( void  ) const
Returns
the PHY rate used by this PHY.

Definition at line 208 of file half-duplex-ideal-phy.cc.

References m_rate, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Ptr< AntennaModel > ns3::HalfDuplexIdealPhy::GetRxAntenna ( )
virtual

get the AntennaModel used by the NetDevice for reception

Returns
a Ptr to the AntennaModel used by the NetDevice for reception

Implements ns3::SpectrumPhy.

Definition at line 246 of file half-duplex-ideal-phy.cc.

References m_antenna, and NS_LOG_FUNCTION.

Ptr< const SpectrumModel > ns3::HalfDuplexIdealPhy::GetRxSpectrumModel ( ) const
virtual
Returns
returns the SpectrumModel that this SpectrumPhy expects to be used for all SpectrumValues that are passed to StartRx. If 0 is returned, it means that any model will be accepted.

Implements ns3::SpectrumPhy.

Definition at line 171 of file half-duplex-ideal-phy.cc.

References ns3::SpectrumValue::GetSpectrumModel(), and m_txPsd.

+ Here is the call graph for this function:

TypeId ns3::HalfDuplexIdealPhy::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::HalfDuplexIdealPhy.

Attributes defined for this type:

  • Rate: The PHY rate used by this device
    • Set with class: DataRateValue
    • Underlying type: DataRate
    • Initial value: 1000000bps
    • Flags: construct write read

TraceSources defined for this type:

  • TxStart: Trace fired when a new transmission is started
  • TxEnd: Trace fired when a previosuly started transmission is finished
  • RxStart: Trace fired when the start of a signal is detected
  • RxAbort: Trace fired when a previously started RX is aborted before time
  • RxEndOk: Trace fired when a previosuly started RX terminates successfully
  • RxEndError: Trace fired when a previosuly started RX terminates with an error (packet is corrupted)

Reimplemented from ns3::SpectrumPhy.

Definition at line 96 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().

+ Here is the call graph for this function:

void ns3::HalfDuplexIdealPhy::SetAntenna ( Ptr< AntennaModel a)

set the AntennaModel to be used

Parameters
athe Antenna Model

Definition at line 253 of file half-duplex-ideal-phy.cc.

References m_antenna, and NS_LOG_FUNCTION.

void ns3::HalfDuplexIdealPhy::SetChannel ( Ptr< SpectrumChannel c)
virtual

Set the channel attached to this device.

Parameters
cthe channel

Implements ns3::SpectrumPhy.

Definition at line 164 of file half-duplex-ideal-phy.cc.

References m_channel, and NS_LOG_FUNCTION.

void ns3::HalfDuplexIdealPhy::SetDevice ( Ptr< NetDevice d)
virtual

set the associated NetDevice instance

Parameters
dthe NetDevice instance

Implements ns3::SpectrumPhy.

Definition at line 148 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

Parameters
cthe callback

Definition at line 231 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

Parameters
cthe callback

Definition at line 239 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

Parameters
cthe callback

Definition at line 223 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

Parameters
cthe callback

Definition at line 216 of file half-duplex-ideal-phy.cc.

References m_phyMacTxEndCallback, and NS_LOG_FUNCTION.

void ns3::HalfDuplexIdealPhy::SetMobility ( Ptr< MobilityModel m)
virtual

Set the mobility model associated with this device.

Parameters
mthe mobility model

Implements ns3::SpectrumPhy.

Definition at line 156 of file half-duplex-ideal-phy.cc.

References m_mobility, and NS_LOG_FUNCTION.

void ns3::HalfDuplexIdealPhy::SetNoisePowerSpectralDensity ( Ptr< const SpectrumValue noisePsd)
Parameters
noisePsdthe Noise Power Spectral Density in power units (Watt, Pascal...) per Hz.

Definition at line 193 of file half-duplex-ideal-phy.cc.

References m_interference, NS_ASSERT, NS_LOG_FUNCTION, and ns3::SpectrumInterference::SetNoisePowerSpectralDensity().

+ Here is the call graph for this function:

void ns3::HalfDuplexIdealPhy::SetRate ( DataRate  rate)

set the PHY rate to be used by this PHY.

Parameters
rate

Definition at line 201 of file half-duplex-ideal-phy.cc.

References m_rate, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::HalfDuplexIdealPhy::SetTxPowerSpectralDensity ( Ptr< SpectrumValue txPsd)

set the Power Spectral Density of outgoing signals in power units (Watt, Pascal...) per Hz.

Parameters
txPsd

Definition at line 184 of file half-duplex-ideal-phy.cc.

References m_txPsd, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_INFO.

void ns3::HalfDuplexIdealPhy::StartRx ( Ptr< SpectrumSignalParameters params)
virtual
bool ns3::HalfDuplexIdealPhy::StartTx ( Ptr< Packet p)

Start a transmission

Parameters
pthe packet to be transmitted
Returns
true if an error occurred and the transmission was not started, false otherwise.

Definition at line 267 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(), ns3::Seconds(), ns3::SpectrumChannel::StartTx(), and TX.

Referenced by ns3::AdhocAlohaNoackIdealPhyHelper::Install().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

Ptr<AntennaModel> ns3::HalfDuplexIdealPhy::m_antenna
private

Definition at line 197 of file half-duplex-ideal-phy.h.

Referenced by GetRxAntenna(), SetAntenna(), and StartTx().

Ptr<SpectrumChannel> ns3::HalfDuplexIdealPhy::m_channel
private

Definition at line 199 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), SetChannel(), and StartTx().

EventId ns3::HalfDuplexIdealPhy::m_endRxEventId
private

Definition at line 194 of file half-duplex-ideal-phy.h.

Referenced by AbortRx(), and StartRx().

SpectrumInterference ns3::HalfDuplexIdealPhy::m_interference
private
Ptr<MobilityModel> ns3::HalfDuplexIdealPhy::m_mobility
private

Definition at line 196 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), GetMobility(), and SetMobility().

Ptr<NetDevice> ns3::HalfDuplexIdealPhy::m_netDevice
private

Definition at line 198 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), GetDevice(), and SetDevice().

GenericPhyRxEndErrorCallback ns3::HalfDuplexIdealPhy::m_phyMacRxEndErrorCallback
private

Definition at line 219 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), EndRx(), and SetGenericPhyRxEndErrorCallback().

GenericPhyRxEndOkCallback ns3::HalfDuplexIdealPhy::m_phyMacRxEndOkCallback
private

Definition at line 220 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), EndRx(), and SetGenericPhyRxEndOkCallback().

GenericPhyRxStartCallback ns3::HalfDuplexIdealPhy::m_phyMacRxStartCallback
private

Definition at line 218 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), SetGenericPhyRxStartCallback(), and StartRx().

GenericPhyTxEndCallback ns3::HalfDuplexIdealPhy::m_phyMacTxEndCallback
private

Definition at line 217 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), EndTx(), and SetGenericPhyTxEndCallback().

TracedCallback<Ptr<const Packet> > ns3::HalfDuplexIdealPhy::m_phyRxAbortTrace
private

Definition at line 213 of file half-duplex-ideal-phy.h.

Referenced by AbortRx(), and GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::HalfDuplexIdealPhy::m_phyRxEndErrorTrace
private

Definition at line 215 of file half-duplex-ideal-phy.h.

Referenced by EndRx(), and GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::HalfDuplexIdealPhy::m_phyRxEndOkTrace
private

Definition at line 214 of file half-duplex-ideal-phy.h.

Referenced by EndRx(), and GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::HalfDuplexIdealPhy::m_phyRxStartTrace
private

Definition at line 212 of file half-duplex-ideal-phy.h.

Referenced by GetTypeId(), and StartRx().

TracedCallback<Ptr<const Packet> > ns3::HalfDuplexIdealPhy::m_phyTxEndTrace
private

Definition at line 211 of file half-duplex-ideal-phy.h.

Referenced by EndTx(), and GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::HalfDuplexIdealPhy::m_phyTxStartTrace
private

Definition at line 210 of file half-duplex-ideal-phy.h.

Referenced by GetTypeId(), and StartTx().

DataRate ns3::HalfDuplexIdealPhy::m_rate
private

Definition at line 206 of file half-duplex-ideal-phy.h.

Referenced by GetRate(), SetRate(), and StartTx().

Ptr<Packet> ns3::HalfDuplexIdealPhy::m_rxPacket
private

Definition at line 204 of file half-duplex-ideal-phy.h.

Referenced by AbortRx(), DoDispose(), EndRx(), and StartRx().

Ptr<const SpectrumValue> ns3::HalfDuplexIdealPhy::m_rxPsd
private

Definition at line 202 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), EndRx(), and StartRx().

State ns3::HalfDuplexIdealPhy::m_state
private

Definition at line 208 of file half-duplex-ideal-phy.h.

Referenced by AbortRx(), ChangeState(), EndRx(), EndTx(), StartRx(), and StartTx().

Ptr<Packet> ns3::HalfDuplexIdealPhy::m_txPacket
private

Definition at line 203 of file half-duplex-ideal-phy.h.

Referenced by DoDispose(), EndTx(), and StartTx().

Ptr<SpectrumValue> ns3::HalfDuplexIdealPhy::m_txPsd
private

The documentation for this class was generated from the following files: