A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::UanTransducerHd Class Reference

Half duplex implementation of transducer object. More...

#include "uan-transducer-hd.h"

+ Inheritance diagram for ns3::UanTransducerHd:
+ Collaboration diagram for ns3::UanTransducerHd:

Public Member Functions

 UanTransducerHd ()
 Constructor.
 
 ~UanTransducerHd () override
 Dummy destructor, see DoDispose.
 
void AddPhy (Ptr< UanPhy >) override
 Attach a physical network layer above this transducer.
 
double ApplyRxGainDb (double rxPowerDb, UanTxMode mode) override
 Apply receiver gain in dB to the received power.
 
void Clear () override
 Clears all pointer references.
 
const ArrivalListGetArrivalList () const override
 Get the list of overlapped (in time) packets at this transducer.
 
Ptr< UanChannelGetChannel () const override
 Get the attached channel.
 
const UanPhyListGetPhyList () const override
 Get the list of physical layer above this transducer.
 
double GetRxGainDb () override
 Get the receiver gain added to signal at receiver in dB.
 
State GetState () const override
 Get the transducer state.
 
bool IsRx () const override
 Is the state receiving (or available for reception)?
 
bool IsTx () const override
 Is the state transmitting?
 
void Receive (Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) override
 Notify this object that a new packet has arrived at this nodes location.
 
void SetChannel (Ptr< UanChannel > chan) override
 Attach this transducer to a channel.
 
void SetRxGainDb (double gainDb) override
 Set the receiver gain.
 
void Transmit (Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode) override
 Transmit a packet from this transducer.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::UanTransducer
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Protected Member Functions

void DoDispose () override
 Destructor implementation.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Private Member Functions

void EndTx ()
 Handle end of transmission event.
 
void RemoveArrival (UanPacketArrival arrival)
 Remove an entry from the arrival list.
 

Private Attributes

ArrivalList m_arrivalList
 List of arriving packets which overlap in time.
 
Ptr< UanChannelm_channel
 The attached channel.
 
bool m_cleared
 Flab when we've been cleared.
 
EventId m_endTxEvent
 Event scheduled for end of transmission.
 
Time m_endTxTime
 Time at which transmission will be completed.
 
UanPhyList m_phyList
 List of physical layers attached above this tranducer.
 
double m_rxGainDb
 Receive gain in dB.
 
State m_state
 Transducer state.
 

Additional Inherited Members

- Public Types inherited from ns3::UanTransducer
typedef std::list< UanPacketArrivalArrivalList
 List of arriving packets overlapping in time.
 
enum  State { TX , RX }
 Transducer state. More...
 
typedef std::list< Ptr< UanPhy > > UanPhyList
 List of UanPhy objects.
 

Detailed Description

Half duplex implementation of transducer object.

This class will only allow attached Phy's to receive packets if not in TX mode.

Definition at line 27 of file uan-transducer-hd.h.

Constructor & Destructor Documentation

◆ UanTransducerHd()

ns3::UanTransducerHd::UanTransducerHd ( )

Constructor.

Definition at line 27 of file uan-transducer-hd.cc.

◆ ~UanTransducerHd()

ns3::UanTransducerHd::~UanTransducerHd ( )
override

Dummy destructor, see DoDispose.

Definition at line 36 of file uan-transducer-hd.cc.

Member Function Documentation

◆ AddPhy()

void ns3::UanTransducerHd::AddPhy ( Ptr< UanPhy > phy)
overridevirtual

Attach a physical network layer above this transducer.

More than one physical layer may be attached.

Parameters
phyThe physical layer.

Implements ns3::UanTransducer.

Definition at line 222 of file uan-transducer-hd.cc.

References m_phyList.

◆ ApplyRxGainDb()

double ns3::UanTransducerHd::ApplyRxGainDb ( double rxPowerDb,
UanTxMode mode )
overridevirtual

Apply receiver gain in dB to the received power.

Parameters
rxPowerDbSignal power in dB of arriving packet.
modeMode arriving packet is using.
Returns
Updated receive power (in dB) with gain applied.

Implements ns3::UanTransducer.

Definition at line 132 of file uan-transducer-hd.cc.

References GetRxGainDb(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by Receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Clear()

void ns3::UanTransducerHd::Clear ( )
overridevirtual

Clears all pointer references.

Implements ns3::UanTransducer.

Definition at line 41 of file uan-transducer-hd.cc.

References ns3::EventId::Cancel(), m_arrivalList, m_channel, m_cleared, m_endTxEvent, and m_phyList.

Referenced by DoDispose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::UanTransducerHd::DoDispose ( )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden 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 74 of file uan-transducer-hd.cc.

References Clear(), and ns3::Object::DoDispose().

+ Here is the call graph for this function:

◆ EndTx()

void ns3::UanTransducerHd::EndTx ( )
private

Handle end of transmission event.

Definition at line 201 of file uan-transducer-hd.cc.

References m_endTxTime, m_state, NS_ASSERT, ns3::UanTransducer::RX, ns3::Seconds(), and ns3::UanTransducer::TX.

Referenced by Transmit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetArrivalList()

const UanTransducer::ArrivalList & ns3::UanTransducerHd::GetArrivalList ( ) const
overridevirtual

Get the list of overlapped (in time) packets at this transducer.

Returns
List of all packets currently crossing this node in the water.

Implements ns3::UanTransducer.

Definition at line 114 of file uan-transducer-hd.cc.

References m_arrivalList.

◆ GetChannel()

Ptr< UanChannel > ns3::UanTransducerHd::GetChannel ( ) const
overridevirtual

Get the attached channel.

Returns
The channel.

Implements ns3::UanTransducer.

Definition at line 216 of file uan-transducer-hd.cc.

References m_channel.

◆ GetPhyList()

const UanTransducer::UanPhyList & ns3::UanTransducerHd::GetPhyList ( ) const
overridevirtual

Get the list of physical layer above this transducer.

Returns
List of attached physical layers.

Implements ns3::UanTransducer.

Definition at line 228 of file uan-transducer-hd.cc.

References m_phyList.

◆ GetRxGainDb()

double ns3::UanTransducerHd::GetRxGainDb ( )
overridevirtual

Get the receiver gain added to signal at receiver in dB.

Returns
The gain (in dB).

Implements ns3::UanTransducer.

Definition at line 126 of file uan-transducer-hd.cc.

References m_rxGainDb.

Referenced by ApplyRxGainDb().

+ Here is the caller graph for this function:

◆ GetState()

UanTransducer::State ns3::UanTransducerHd::GetState ( ) const
overridevirtual

Get the transducer state.

Returns
State (TX or RX) of this transducer.

Implements ns3::UanTransducer.

Definition at line 96 of file uan-transducer-hd.cc.

References m_state.

◆ GetTypeId()

TypeId ns3::UanTransducerHd::GetTypeId ( )
static

Register this type.

Returns
The object TypeId.

Definition at line 81 of file uan-transducer-hd.cc.

References m_rxGainDb, ns3::MakeDoubleAccessor(), ns3::MakeDoubleChecker(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ IsRx()

bool ns3::UanTransducerHd::IsRx ( ) const
overridevirtual

Is the state receiving (or available for reception)?

Returns
True if this transducer is available for receiving an incoming packet.

Implements ns3::UanTransducer.

Definition at line 102 of file uan-transducer-hd.cc.

References m_state, and ns3::UanTransducer::RX.

◆ IsTx()

bool ns3::UanTransducerHd::IsTx ( ) const
overridevirtual

Is the state transmitting?

Returns
True if there is a packet being transmitted from this transducer.

Implements ns3::UanTransducer.

Definition at line 108 of file uan-transducer-hd.cc.

References m_state, and ns3::UanTransducer::TX.

◆ Receive()

void ns3::UanTransducerHd::Receive ( Ptr< Packet > packet,
double rxPowerDb,
UanTxMode txMode,
UanPdp pdp )
overridevirtual

Notify this object that a new packet has arrived at this nodes location.

Parameters
packetPacket arriving.
rxPowerDbSignal power in dB of arriving packet.
txModeMode arriving packet is using.
pdpPDP of arriving signal.

Implements ns3::UanTransducer.

Definition at line 141 of file uan-transducer-hd.cc.

References ApplyRxGainDb(), ns3::UanTxMode::GetDataRateBps(), m_arrivalList, m_phyList, m_state, ns3::Now(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, RemoveArrival(), ns3::UanTransducer::RX, ns3::Time::S, ns3::Simulator::Schedule(), and ns3::Seconds().

+ Here is the call graph for this function:

◆ RemoveArrival()

void ns3::UanTransducerHd::RemoveArrival ( UanPacketArrival arrival)
private

Remove an entry from the arrival list.

Parameters
arrivalThe packet arrival to remove.

Definition at line 234 of file uan-transducer-hd.cc.

References ns3::UanPacketArrival::GetPacket(), m_arrivalList, and m_phyList.

Referenced by Receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChannel()

void ns3::UanTransducerHd::SetChannel ( Ptr< UanChannel > chan)
overridevirtual

Attach this transducer to a channel.

Parameters
chanThe channel

Implements ns3::UanTransducer.

Definition at line 209 of file uan-transducer-hd.cc.

References m_channel, and NS_LOG_DEBUG.

◆ SetRxGainDb()

void ns3::UanTransducerHd::SetRxGainDb ( double gainDb)
overridevirtual

Set the receiver gain.

Parameters
gainDbGain added at receiver, in dB.

Implements ns3::UanTransducer.

Definition at line 120 of file uan-transducer-hd.cc.

References m_rxGainDb.

◆ Transmit()

void ns3::UanTransducerHd::Transmit ( Ptr< UanPhy > src,
Ptr< Packet > packet,
double txPowerDb,
UanTxMode txMode )
overridevirtual

Transmit a packet from this transducer.

Parameters
srcSource PHY.
packetPacket to transmit.
txPowerDbOutgoing Tx power of packet.
txModeMode to transmit packet with.

Implements ns3::UanTransducer.

Definition at line 166 of file uan-transducer-hd.cc.

References ns3::EventId::Cancel(), EndTx(), ns3::UanTxMode::GetDataRateBps(), m_channel, m_endTxEvent, m_endTxTime, m_phyList, m_state, ns3::UanPhy::NotifyTxEnd(), ns3::Simulator::Now(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::UanTransducer::TX.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_arrivalList

ArrivalList ns3::UanTransducerHd::m_arrivalList
private

List of arriving packets which overlap in time.

Definition at line 59 of file uan-transducer-hd.h.

Referenced by Clear(), GetArrivalList(), Receive(), and RemoveArrival().

◆ m_channel

Ptr<UanChannel> ns3::UanTransducerHd::m_channel
private

The attached channel.

Definition at line 61 of file uan-transducer-hd.h.

Referenced by Clear(), GetChannel(), SetChannel(), and Transmit().

◆ m_cleared

bool ns3::UanTransducerHd::m_cleared
private

Flab when we've been cleared.

Definition at line 64 of file uan-transducer-hd.h.

Referenced by Clear().

◆ m_endTxEvent

EventId ns3::UanTransducerHd::m_endTxEvent
private

Event scheduled for end of transmission.

Definition at line 62 of file uan-transducer-hd.h.

Referenced by Clear(), and Transmit().

◆ m_endTxTime

Time ns3::UanTransducerHd::m_endTxTime
private

Time at which transmission will be completed.

Definition at line 63 of file uan-transducer-hd.h.

Referenced by EndTx(), and Transmit().

◆ m_phyList

UanPhyList ns3::UanTransducerHd::m_phyList
private

List of physical layers attached above this tranducer.

Definition at line 60 of file uan-transducer-hd.h.

Referenced by AddPhy(), Clear(), GetPhyList(), Receive(), RemoveArrival(), and Transmit().

◆ m_rxGainDb

double ns3::UanTransducerHd::m_rxGainDb
private

Receive gain in dB.

Definition at line 65 of file uan-transducer-hd.h.

Referenced by GetRxGainDb(), GetTypeId(), and SetRxGainDb().

◆ m_state

State ns3::UanTransducerHd::m_state
private

Transducer state.

Definition at line 58 of file uan-transducer-hd.h.

Referenced by EndTx(), GetState(), IsRx(), IsTx(), Receive(), and Transmit().


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