A Discrete-Event Network Simulator
API
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ns3::MultiModelSpectrumChannel Class Reference

This SpectrumChannel implementation can handle the presence of SpectrumPhy instances which can use different spectrum models, i.e., different SpectrumModel. More...

#include "multi-model-spectrum-channel.h"

+ Inheritance diagram for ns3::MultiModelSpectrumChannel:

Public Member Functions

 MultiModelSpectrumChannel ()
 
virtual void AddRx (Ptr< SpectrumPhy > phy)
 Add a SpectrumPhy to a channel, so it can receive packets. More...
 
virtual Ptr< NetDeviceGetDevice (std::size_t i) const
 
virtual std::size_t GetNDevices (void) const
 
virtual void StartTx (Ptr< SpectrumSignalParameters > params)
 Used by attached PHY instances to transmit signals on the channel. More...
 
- Public Member Functions inherited from ns3::SpectrumChannel
 SpectrumChannel ()
 constructor More...
 
virtual ~SpectrumChannel ()
 destructor More...
 
void AddPropagationLossModel (Ptr< PropagationLossModel > loss)
 Add the single-frequency propagation loss model to be used. More...
 
void AddSpectrumPropagationLossModel (Ptr< SpectrumPropagationLossModel > loss)
 Add the frequency-dependent propagation loss model to be used. More...
 
Ptr< SpectrumPropagationLossModelGetSpectrumPropagationLossModel (void)
 Get the frequency-dependent propagation loss model. More...
 
void SetPropagationDelayModel (Ptr< PropagationDelayModel > delay)
 Set the propagation delay model to be used. More...
 
- Public Member Functions inherited from ns3::Channel
 Channel ()
 
virtual ~Channel ()
 
uint32_t GetId (void) const
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. 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
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

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

Protected Member Functions

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

Private Member Functions

TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel (Ptr< const SpectrumModel > txSpectrumModel)
 This method checks if m_rxSpectrumModelInfoMap contains an entry for the given TX SpectrumModel. More...
 
virtual void StartRx (Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver)
 Used internally to reschedule transmission after the propagation delay. More...
 

Private Attributes

std::size_t m_numDevices
 Number of devices connected to the channel. More...
 
RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap
 Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances. More...
 
TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap
 Data structure holding, for each TX SpectrumModel, all the converters to any RX SpectrumModel, and all the corresponding SpectrumPhy instances. More...
 

Additional Inherited Members

- Public Types inherited from ns3::SpectrumChannel
typedef void(* GainTracedCallback) (Ptr< const MobilityModel > txMobility, Ptr< const MobilityModel > rxMobility, double txAntennaGain, double rxAntennaGain, double propagationGain, double pathloss)
 TracedCallback signature for path loss calculation events. More...
 
typedef void(* LossTracedCallback) (Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
 TracedCallback signature for path loss calculation events. More...
 
typedef void(* SignalParametersTracedCallback) (Ptr< SpectrumSignalParameters > params)
 TracedCallback signature for Ptr<const SpectrumSignalParameters>. More...
 
- Protected Attributes inherited from ns3::SpectrumChannel
TracedCallback< Ptr< const MobilityModel >, Ptr< const MobilityModel >, double, double, double, double > m_gainTrace
 The Gain trace source. More...
 
double m_maxLossDb
 Maximum loss [dB]. More...
 
TracedCallback< Ptr< const SpectrumPhy >, Ptr< const SpectrumPhy >, double > m_pathLossTrace
 The PathLoss trace source. More...
 
Ptr< PropagationDelayModelm_propagationDelay
 Propagation delay model to be used with this channel. More...
 
Ptr< PropagationLossModelm_propagationLoss
 Single-frequency propagation loss model to be used with this channel. More...
 
Ptr< SpectrumPropagationLossModelm_spectrumPropagationLoss
 Frequency-dependent propagation loss model to be used with this channel. More...
 
TracedCallback< Ptr< SpectrumSignalParameters > > m_txSigParamsTrace
 Traced callback for SpectrumSignalParameters in StartTx requests. More...
 

Detailed Description

This SpectrumChannel implementation can handle the presence of SpectrumPhy instances which can use different spectrum models, i.e., different SpectrumModel.


Note
It is allowed for a receiving SpectrumPhy to switch to a different SpectrumModel during the simulation. The requirement for this to work is that, after the SpectrumPhy switched its SpectrumModel, MultiModelSpectrumChannel::AddRx () is called again passing the pointer to that SpectrumPhy.

Config Paths

ns3::MultiModelSpectrumChannel is accessible through the following paths with Config::Set and Config::Connect:

No Attributes are defined for this type.

Attributes defined in parent class ns3::SpectrumChannel

Attributes defined in parent class ns3::Channel

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::SpectrumChannel

Size of this type is 192 bytes (on a 64-bit architecture).

Definition at line 106 of file multi-model-spectrum-channel.h.

Constructor & Destructor Documentation

◆ MultiModelSpectrumChannel()

ns3::MultiModelSpectrumChannel::MultiModelSpectrumChannel ( )

Definition at line 84 of file multi-model-spectrum-channel.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddRx()

void ns3::MultiModelSpectrumChannel::AddRx ( Ptr< SpectrumPhy phy)
virtual

Add a SpectrumPhy to a channel, so it can receive packets.

This method is used to attach a SpectrumPhy instance to a SpectrumChannel instance, so that the SpectrumPhy can receive packets sent on that channel. Note that a SpectrumPhy that only transmits (without receiving ever) does not need to be added to the channel.

This method is to be implemented by all classes inheriting from SpectrumChannel.

Parameters
phythe SpectrumPhy instance to be added to the channel as a receiver.

Implements ns3::SpectrumChannel.

Definition at line 113 of file multi-model-spectrum-channel.cc.

References ns3::SpectrumModel::GetUid(), ns3::SpectrumModel::IsOrthogonal(), m_numDevices, m_rxSpectrumModelInfoMap, m_txSpectrumModelInfoMap, NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, NS_LOG_LOGIC(), and third::phy.

◆ DoDispose()

void ns3::MultiModelSpectrumChannel::DoDispose ( void  )
protectedvirtual

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::SpectrumChannel.

Definition at line 90 of file multi-model-spectrum-channel.cc.

References ns3::SpectrumChannel::DoDispose(), m_rxSpectrumModelInfoMap, m_txSpectrumModelInfoMap, and NS_LOG_FUNCTION.

◆ FindAndEventuallyAddTxSpectrumModel()

TxSpectrumModelInfoMap_t::const_iterator ns3::MultiModelSpectrumChannel::FindAndEventuallyAddTxSpectrumModel ( Ptr< const SpectrumModel txSpectrumModel)
private

This method checks if m_rxSpectrumModelInfoMap contains an entry for the given TX SpectrumModel.

If such entry exists, it returns an iterator pointing to it. If not, it creates a new entry in m_txSpectrumMpodelInfoMap, and returns an iterator to it.

Parameters
txSpectrumModelThe TX SpectrumModel being considered
Returns
An iterator pointing to the corresponding entry in m_txSpectrumModelInfoMap

Definition at line 183 of file multi-model-spectrum-channel.cc.

References ns3::SpectrumModel::GetUid(), ns3::SpectrumModel::IsOrthogonal(), m_rxSpectrumModelInfoMap, m_txSpectrumModelInfoMap, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by StartTx().

◆ GetDevice()

Ptr< NetDevice > ns3::MultiModelSpectrumChannel::GetDevice ( std::size_t  i) const
virtual
Parameters
iindex of NetDevice to retrieve
Returns
one of the NetDevices connected to this channel.

This method must be implemented by subclasses.

Implements ns3::Channel.

Definition at line 370 of file multi-model-spectrum-channel.cc.

References m_numDevices, m_rxSpectrumModelInfoMap, NS_ASSERT, and NS_FATAL_ERROR.

◆ GetNDevices()

std::size_t ns3::MultiModelSpectrumChannel::GetNDevices ( void  ) const
virtual
Returns
the number of NetDevices connected to this Channel.

This method must be implemented by subclasses.

Implements ns3::Channel.

Definition at line 364 of file multi-model-spectrum-channel.cc.

References m_numDevices.

◆ GetTypeId()

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

Get the type ID.

Returns
the object TypeId

Definition at line 99 of file multi-model-spectrum-channel.cc.

References ns3::TypeId::SetParent().

◆ StartRx()

void ns3::MultiModelSpectrumChannel::StartRx ( Ptr< SpectrumSignalParameters params,
Ptr< SpectrumPhy receiver 
)
privatevirtual

Used internally to reschedule transmission after the propagation delay.

Parameters
paramsThe signal parameters.
receiverA pointer to the receiver SpectrumPhy.

Definition at line 357 of file multi-model-spectrum-channel.cc.

References NS_LOG_FUNCTION, and ns3::SpectrumPhy::StartRx().

Referenced by StartTx().

◆ StartTx()

void ns3::MultiModelSpectrumChannel::StartTx ( Ptr< SpectrumSignalParameters params)
virtual

Member Data Documentation

◆ m_numDevices

std::size_t ns3::MultiModelSpectrumChannel::m_numDevices
private

Number of devices connected to the channel.

Definition at line 170 of file multi-model-spectrum-channel.h.

Referenced by AddRx(), GetDevice(), and GetNDevices().

◆ m_rxSpectrumModelInfoMap

RxSpectrumModelInfoMap_t ns3::MultiModelSpectrumChannel::m_rxSpectrumModelInfoMap
private

Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances.

Definition at line 165 of file multi-model-spectrum-channel.h.

Referenced by AddRx(), DoDispose(), FindAndEventuallyAddTxSpectrumModel(), GetDevice(), and StartTx().

◆ m_txSpectrumModelInfoMap

TxSpectrumModelInfoMap_t ns3::MultiModelSpectrumChannel::m_txSpectrumModelInfoMap
private

Data structure holding, for each TX SpectrumModel, all the converters to any RX SpectrumModel, and all the corresponding SpectrumPhy instances.

Definition at line 158 of file multi-model-spectrum-channel.h.

Referenced by AddRx(), DoDispose(), FindAndEventuallyAddTxSpectrumModel(), and StartTx().


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