A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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:
+ Collaboration diagram for ns3::MultiModelSpectrumChannel:

Public Member Functions

 MultiModelSpectrumChannel ()
 
void AddRx (Ptr< SpectrumPhy > phy) override
 Add a SpectrumPhy to a channel, so it can receive packets.
 
Ptr< NetDeviceGetDevice (std::size_t i) const override
 
std::size_t GetNDevices () const override
 
void RemoveRx (Ptr< SpectrumPhy > phy) override
 Remove a SpectrumPhy from a channel.
 
void StartTx (Ptr< SpectrumSignalParameters > params) override
 Used by attached PHY instances to transmit signals on the channel.
 
- Public Member Functions inherited from ns3::SpectrumChannel
 SpectrumChannel ()
 constructor
 
 ~SpectrumChannel () override
 destructor
 
void AddPhasedArraySpectrumPropagationLossModel (Ptr< PhasedArraySpectrumPropagationLossModel > loss)
 Add the frequency-dependent propagation loss model that is compapatible with the phased antenna arrays at the TX and RX.
 
void AddPropagationLossModel (Ptr< PropagationLossModel > loss)
 Add the single-frequency propagation loss model to be used.
 
void AddSpectrumPropagationLossModel (Ptr< SpectrumPropagationLossModel > loss)
 Add the frequency-dependent propagation loss model to be used.
 
void AddSpectrumTransmitFilter (Ptr< SpectrumTransmitFilter > filter)
 Add the transmit filter to be used to filter possible signal receptions at the StartTx() time.
 
int64_t AssignStreams (int64_t stream)
 This method calls AssignStreams() on any/all of the PropagationLossModel, PropagationDelayModel, SpectrumPropagationLossModel, PhasedArraySpectrumPropagationLossModel, and SpectrumTransmitFilter objects that have been added to this channel.
 
void DoDispose () override
 Destructor implementation.
 
Ptr< PhasedArraySpectrumPropagationLossModelGetPhasedArraySpectrumPropagationLossModel () const
 Get the frequency-dependent propagation loss model that is compatible with the phased antenna arrays at TX and RX.
 
Ptr< PropagationDelayModelGetPropagationDelayModel () const
 Get the propagation delay model that has been set on the channel.
 
Ptr< PropagationLossModelGetPropagationLossModel () const
 Get the propagation loss model.
 
Ptr< SpectrumPropagationLossModelGetSpectrumPropagationLossModel () const
 Get the frequency-dependent propagation loss model.
 
Ptr< SpectrumTransmitFilterGetSpectrumTransmitFilter () const
 Get the transmit filter, or first in a chain of transmit filters if more than one is present.
 
void SetPropagationDelayModel (Ptr< PropagationDelayModel > delay)
 Set the propagation delay model to be used.
 
- Public Member Functions inherited from ns3::Channel
 Channel ()
 
 ~Channel () override
 
uint32_t GetId () const
 
- 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 ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::SpectrumChannel
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Channel
static TypeId GetTypeId ()
 Get the type ID.
 
- 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::SpectrumChannel
virtual int64_t DoAssignStreams (int64_t stream)
 This provides a base class implementation that may be subclassed if needed by subclasses that might need additional stream assignments.
 
- 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

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

Private Attributes

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

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.
 
typedef void(* LossTracedCallback) (Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
 TracedCallback signature for path loss calculation events.
 
typedef void(* SignalParametersTracedCallback) (Ptr< SpectrumSignalParameters > params)
 TracedCallback signature for Ptr<const SpectrumSignalParameters>.
 
- Protected Attributes inherited from ns3::SpectrumChannel
Ptr< SpectrumTransmitFilterm_filter {nullptr}
 Transmit filter to be used with this channel.
 
TracedCallback< Ptr< const MobilityModel >, Ptr< const MobilityModel >, double, double, double, doublem_gainTrace
 The Gain trace source.
 
double m_maxLossDb
 Maximum loss [dB].
 
TracedCallback< Ptr< const SpectrumPhy >, Ptr< const SpectrumPhy >, doublem_pathLossTrace
 The PathLoss trace source.
 
Ptr< PhasedArraySpectrumPropagationLossModelm_phasedArraySpectrumPropagationLoss
 Frequency-dependent propagation loss model to be used with this channel.
 
Ptr< PropagationDelayModelm_propagationDelay
 Propagation delay model to be used with this channel.
 
Ptr< PropagationLossModelm_propagationLoss
 Single-frequency propagation loss model to be used with this channel.
 
Ptr< SpectrumPropagationLossModelm_spectrumPropagationLoss
 Frequency-dependent propagation loss model to be used with this channel.
 
TracedCallback< Ptr< SpectrumSignalParameters > > m_txSigParamsTrace
 Traced callback for SpectrumSignalParameters in StartTx requests.
 

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:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Channel/$ns3::MultiModelSpectrumChannel"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Channel/$ns3::SpectrumChannel/$ns3::MultiModelSpectrumChannel"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Phy/Channel/$ns3::MultiModelSpectrumChannel"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Phy/Channel/$ns3::SpectrumChannel/$ns3::MultiModelSpectrumChannel"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Phys/[i]/Channel/$ns3::MultiModelSpectrumChannel"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Phys/[i]/Channel/$ns3::SpectrumChannel/$ns3::MultiModelSpectrumChannel"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::lrwpan::LrWpanNetDevice/Channel/$ns3::MultiModelSpectrumChannel"
  • "/ChannelList/[i]/$ns3::MultiModelSpectrumChannel"
  • "/ChannelList/[i]/$ns3::SpectrumChannel/$ns3::MultiModelSpectrumChannel"

No Attributes are defined for this type.

Attributes defined in parent class ns3::SpectrumChannel

  • MaxLossDb: If a single-frequency PropagationLossModel is used, this value represents the maximum loss in dB for which transmissions will be passed to the receiving PHY. Signals for which the PropagationLossModel returns a loss bigger than this value will not be propagated to the receiver. This parameter is to be used to reduce the computational load by not propagating signals that are far beyond the interference range. Note that the default value corresponds to considering all signals for reception. Tune this value with care.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1e+09
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • PropagationLossModel: A pointer to the propagation loss model attached to this channel.

Attributes defined in parent class ns3::Channel

  • Id: The id (unique integer) of this Channel.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Flags: read
    • Support level: SUPPORTED

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::SpectrumChannel

  • Gain: This trace is fired whenever a new path loss value is calculated. The parameters to this trace are : Pointer to the mobility model of the transmitter, Pointer to the mobility model of the receiver, Tx antenna gain, Rx antenna gain, Propagation gain, Pathloss
  • PathLoss: This trace is fired whenever a new path loss value is calculated. The first and second parameters to the trace are pointers respectively to the TX and RX SpectrumPhy instances, whereas the third parameters is the loss value in dB. Note that the loss value reported by this trace is the single-frequency loss value obtained by evaluating only the TX and RX AntennaModels and the PropagationLossModel. In particular, note that SpectrumPropagationLossModel (even if present) is never used to evaluate the loss value reported in this trace.
  • TxSigParams: This trace is fired whenever a signal is transmitted. The sole parameter is a pointer to a copy of the SpectrumSignalParameters provided by the transmitter.

Group: Spectrum

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

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

Constructor & Destructor Documentation

◆ MultiModelSpectrumChannel()

ns3::MultiModelSpectrumChannel::MultiModelSpectrumChannel ( )

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

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddRx()

void ns3::MultiModelSpectrumChannel::AddRx ( Ptr< SpectrumPhy > phy)
overridevirtual

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 125 of file multi-model-spectrum-channel.cc.

References m_numDevices, m_rxSpectrumModelInfoMap, m_txSpectrumModelInfoMap, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and RemoveRx().

+ Here is the call graph for this function:

◆ DoDispose()

void ns3::MultiModelSpectrumChannel::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 79 of file multi-model-spectrum-channel.cc.

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

+ Here is the call graph for this 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_txSpectrumModelInfoMap, 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 173 of file multi-model-spectrum-channel.cc.

References m_rxSpectrumModelInfoMap, m_txSpectrumModelInfoMap, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by StartRx(), and StartTx().

+ Here is the caller graph for this function:

◆ GetDevice()

Ptr< NetDevice > ns3::MultiModelSpectrumChannel::GetDevice ( std::size_t i) const
overridevirtual
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 495 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 ( ) const
overridevirtual
Returns
the number of NetDevices connected to this Channel.

This method must be implemented by subclasses.

Implements ns3::Channel.

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

References m_numDevices.

◆ GetTypeId()

TypeId ns3::MultiModelSpectrumChannel::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

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

References ns3::TypeId::SetParent().

Referenced by ns3::LteHelper::LteHelper().

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

◆ RemoveRx()

void ns3::MultiModelSpectrumChannel::RemoveRx ( Ptr< SpectrumPhy > phy)
overridevirtual

Remove a SpectrumPhy from a channel.

This method is used to detach a SpectrumPhy instance from a SpectrumChannel instance, so that the SpectrumPhy does not receive packets sent on that channel.

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

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

Implements ns3::SpectrumChannel.

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

References m_numDevices, m_rxSpectrumModelInfoMap, and NS_LOG_FUNCTION.

Referenced by AddRx().

+ Here is the caller graph for this function:

◆ StartRx()

void ns3::MultiModelSpectrumChannel::StartRx ( Ptr< SpectrumValue > txPsd,
double txAntennaGain,
Ptr< SpectrumSignalParameters > params,
Ptr< SpectrumPhy > receiver,
const std::map< SpectrumModelUid_t, Ptr< SpectrumValue > > & availableConvertedPsds )
privatevirtual

Used internally to reschedule transmission after the propagation delay.

Parameters
txPsdThe transmitted PSD.
txAntennaGainThe antenna gain at the transmitter.
paramsThe signal parameters.
receiverA pointer to the receiver SpectrumPhy.
availableConvertedPsdsavailable converted PSDs from the TX PSD.

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

References ns3::DynamicCast(), FindAndEventuallyAddTxSpectrumModel(), ns3::SpectrumChannel::m_gainTrace, ns3::SpectrumChannel::m_maxLossDb, ns3::SpectrumChannel::m_pathLossTrace, ns3::SpectrumChannel::m_phasedArraySpectrumPropagationLoss, ns3::SpectrumChannel::m_propagationLoss, ns3::SpectrumChannel::m_spectrumPropagationLoss, m_txSpectrumModelInfoMap, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by StartTx().

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

◆ StartTx()

void ns3::MultiModelSpectrumChannel::StartTx ( Ptr< SpectrumSignalParameters > params)
overridevirtual

Used by attached PHY instances to transmit signals on the channel.

Parameters
paramsthe parameters of the signals being transmitted

Implements ns3::SpectrumChannel.

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

References ns3::Copy(), FindAndEventuallyAddTxSpectrumModel(), ns3::SpectrumChannel::m_filter, ns3::SpectrumChannel::m_propagationDelay, m_rxSpectrumModelInfoMap, ns3::SpectrumChannel::m_txSigParamsTrace, m_txSpectrumModelInfoMap, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), ns3::Simulator::ScheduleWithContext(), and StartRx().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_numDevices

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

Number of devices connected to the channel.

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

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

◆ 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 157 of file multi-model-spectrum-channel.h.

Referenced by AddRx(), DoDispose(), FindAndEventuallyAddTxSpectrumModel(), GetDevice(), RemoveRx(), 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 151 of file multi-model-spectrum-channel.h.

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


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