A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::SpectrumChannel Class Referenceabstract

Defines the interface for spectrum-aware channel implementations. More...

#include "spectrum-channel.h"

+ Inheritance diagram for ns3::SpectrumChannel:
+ Collaboration diagram for ns3::SpectrumChannel:

Public Types

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

Public Member Functions

 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.
 
virtual void AddRx (Ptr< SpectrumPhy > phy)=0
 Add a SpectrumPhy to a channel, so it can receive packets.
 
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.
 
void DoDispose () override
 Destructor implementation.
 
Ptr< PhasedArraySpectrumPropagationLossModelGetPhasedArraySpectrumPropagationLossModel ()
 Get the frequency-dependent propagation loss model that is compatible with the phased antenna arrays at TX and RX.
 
Ptr< PropagationLossModelGetPropagationLossModel ()
 Get the propagation loss model.
 
Ptr< SpectrumPropagationLossModelGetSpectrumPropagationLossModel ()
 Get the frequency-dependent propagation loss model.
 
Ptr< const SpectrumTransmitFilterGetSpectrumTransmitFilter () const
 Get the transmit filter, or first in a chain of transmit filters if more than one is present.
 
virtual void RemoveRx (Ptr< SpectrumPhy > phy)=0
 Remove a SpectrumPhy from a channel.
 
void SetPropagationDelayModel (Ptr< PropagationDelayModel > delay)
 Set the propagation delay model to be used.
 
virtual void StartTx (Ptr< SpectrumSignalParameters > params)=0
 Used by attached PHY instances to transmit signals on the channel.
 
- Public Member Functions inherited from ns3::Channel
 Channel ()
 
 ~Channel () override
 
virtual Ptr< NetDeviceGetDevice (std::size_t i) const =0
 
uint32_t GetId () const
 
virtual std::size_t GetNDevices () const =0
 
- 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.
 
- 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) 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.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
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::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 Attributes

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.
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
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.
 

Detailed Description

Defines the interface for spectrum-aware channel implementations.

Config Paths

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

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

Attributes

  • 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
  • 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.

TraceSources

  • 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
    Callback signature: ns3::SpectrumChannel::GainTracedCallback
  • 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.
    Callback signature: ns3::SpectrumChannel::LossTracedCallback
  • 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.
    Callback signature: ns3::SpectrumChannel::SignalParametersTracedCallback

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

Definition at line 48 of file spectrum-channel.h.

Member Typedef Documentation

◆ GainTracedCallback

typedef void(* ns3::SpectrumChannel::GainTracedCallback) (Ptr< const MobilityModel > txMobility, Ptr< const MobilityModel > rxMobility, double txAntennaGain, double rxAntennaGain, double propagationGain, double pathloss)

TracedCallback signature for path loss calculation events.

Parameters
[in]txMobilityThe mobility model of the transmitter.
[in]rxMobilityThe mobility model of the receiver.
[in]txAntennaGainThe transmitter antenna gain, in dB.
[in]rxAntennaGainThe receiver antenna gain, in dB.
[in]propagationGainThe propagation gain, in dB.
[in]pathlossThe path loss value, in dB.

Definition at line 194 of file spectrum-channel.h.

◆ LossTracedCallback

typedef void(* ns3::SpectrumChannel::LossTracedCallback) (Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)

TracedCallback signature for path loss calculation events.

Parameters
[in]txPhyThe TX SpectrumPhy instance.
[in]rxPhyThe RX SpectrumPhy instance.
[in]lossDbThe loss value, in dB.

Definition at line 181 of file spectrum-channel.h.

◆ SignalParametersTracedCallback

typedef void(* ns3::SpectrumChannel::SignalParametersTracedCallback) (Ptr< SpectrumSignalParameters > params)

TracedCallback signature for Ptr<const SpectrumSignalParameters>.

Parameters
[in]paramsSpectrumSignalParameters instance.

Definition at line 205 of file spectrum-channel.h.

Constructor & Destructor Documentation

◆ SpectrumChannel()

ns3::SpectrumChannel::SpectrumChannel ( )

constructor

Definition at line 33 of file spectrum-channel.cc.

References NS_LOG_FUNCTION.

◆ ~SpectrumChannel()

ns3::SpectrumChannel::~SpectrumChannel ( )
override

destructor

Definition at line 38 of file spectrum-channel.cc.

Member Function Documentation

◆ AddPhasedArraySpectrumPropagationLossModel()

void ns3::SpectrumChannel::AddPhasedArraySpectrumPropagationLossModel ( Ptr< PhasedArraySpectrumPropagationLossModel loss)

Add the frequency-dependent propagation loss model that is compapatible with the phased antenna arrays at the TX and RX.

Parameters
lossa pointer to the propagation loss model to be used.

Definition at line 138 of file spectrum-channel.cc.

References m_phasedArraySpectrumPropagationLoss, and NS_LOG_FUNCTION.

◆ AddPropagationLossModel()

void ns3::SpectrumChannel::AddPropagationLossModel ( Ptr< PropagationLossModel loss)

Add the single-frequency propagation loss model to be used.

Warning
only models that do not depend on the TX power should be used.
Parameters
lossa pointer to the propagation loss model to be used.

Definition at line 116 of file spectrum-channel.cc.

References m_propagationLoss, and NS_LOG_FUNCTION.

◆ AddRx()

virtual void ns3::SpectrumChannel::AddRx ( Ptr< SpectrumPhy phy)
pure 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.

Implemented in ns3::MultiModelSpectrumChannel, and ns3::SingleModelSpectrumChannel.

◆ AddSpectrumPropagationLossModel()

void ns3::SpectrumChannel::AddSpectrumPropagationLossModel ( Ptr< SpectrumPropagationLossModel loss)

Add the frequency-dependent propagation loss model to be used.

Parameters
lossa pointer to the propagation loss model to be used.

Definition at line 127 of file spectrum-channel.cc.

References m_spectrumPropagationLoss, and NS_LOG_FUNCTION.

◆ AddSpectrumTransmitFilter()

void ns3::SpectrumChannel::AddSpectrumTransmitFilter ( Ptr< SpectrumTransmitFilter filter)

Add the transmit filter to be used to filter possible signal receptions at the StartTx() time.

This method may be called multiple times to chain multiple filters together; the last filter added will be the first one used in the chain.

Parameters
filteran instance of a SpectrumTransmitFilter

Definition at line 150 of file spectrum-channel.cc.

References m_filter, and NS_LOG_FUNCTION.

◆ DoDispose()

void ns3::SpectrumChannel::DoDispose ( )
overridevirtual

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 43 of file spectrum-channel.cc.

References m_propagationDelay, m_propagationLoss, m_spectrumPropagationLoss, and NS_LOG_FUNCTION.

Referenced by ns3::MultiModelSpectrumChannel::DoDispose(), and ns3::SingleModelSpectrumChannel::DoDispose().

+ Here is the caller graph for this function:

◆ GetPhasedArraySpectrumPropagationLossModel()

Ptr< PhasedArraySpectrumPropagationLossModel > ns3::SpectrumChannel::GetPhasedArraySpectrumPropagationLossModel ( )

Get the frequency-dependent propagation loss model that is compatible with the phased antenna arrays at TX and RX.

Returns
a pointer to the propagation loss model.

Definition at line 182 of file spectrum-channel.cc.

References m_phasedArraySpectrumPropagationLoss, and NS_LOG_FUNCTION.

◆ GetPropagationLossModel()

Ptr< PropagationLossModel > ns3::SpectrumChannel::GetPropagationLossModel ( )

Get the propagation loss model.

Returns
a pointer to the propagation loss model.

Definition at line 189 of file spectrum-channel.cc.

References m_propagationLoss.

◆ GetSpectrumPropagationLossModel()

Ptr< SpectrumPropagationLossModel > ns3::SpectrumChannel::GetSpectrumPropagationLossModel ( )

Get the frequency-dependent propagation loss model.

Returns
a pointer to the propagation loss model.

Definition at line 175 of file spectrum-channel.cc.

References m_spectrumPropagationLoss, and NS_LOG_FUNCTION.

◆ GetSpectrumTransmitFilter()

Ptr< const SpectrumTransmitFilter > ns3::SpectrumChannel::GetSpectrumTransmitFilter ( ) const

Get the transmit filter, or first in a chain of transmit filters if more than one is present.

Returns
a pointer to the transmit filter.

Definition at line 162 of file spectrum-channel.cc.

References m_filter.

◆ GetTypeId()

TypeId ns3::SpectrumChannel::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 52 of file spectrum-channel.cc.

References m_gainTrace, m_maxLossDb, m_pathLossTrace, m_propagationLoss, m_txSigParamsTrace, ns3::MakeDoubleAccessor(), ns3::MakePointerAccessor(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ RemoveRx()

virtual void ns3::SpectrumChannel::RemoveRx ( Ptr< SpectrumPhy phy)
pure virtual

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.

Implemented in ns3::MultiModelSpectrumChannel, and ns3::SingleModelSpectrumChannel.

◆ SetPropagationDelayModel()

void ns3::SpectrumChannel::SetPropagationDelayModel ( Ptr< PropagationDelayModel delay)

Set the propagation delay model to be used.

Parameters
delayPtr to the propagation delay model to be used.

Definition at line 168 of file spectrum-channel.cc.

References m_propagationDelay, and NS_ASSERT.

◆ StartTx()

virtual void ns3::SpectrumChannel::StartTx ( Ptr< SpectrumSignalParameters params)
pure virtual

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

Parameters
paramsthe parameters of the signals being transmitted

Implemented in ns3::MultiModelSpectrumChannel, and ns3::SingleModelSpectrumChannel.

Member Data Documentation

◆ m_filter

Ptr<SpectrumTransmitFilter> ns3::SpectrumChannel::m_filter {nullptr}
protected

◆ m_gainTrace

TracedCallback<Ptr<const MobilityModel>, Ptr<const MobilityModel>, double, double, double, double> ns3::SpectrumChannel::m_gainTrace
protected

The Gain trace source.

Fired whenever a new path loss value is calculated. Exporting pointer to the mobility model of the transmitter and the receiver, Tx antenna gain, Rx antenna gain, propagation gain and pathloss

Definition at line 225 of file spectrum-channel.h.

Referenced by GetTypeId(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::SingleModelSpectrumChannel::StartTx().

◆ m_maxLossDb

double ns3::SpectrumChannel::m_maxLossDb
protected

Maximum loss [dB].

Any device above this loss is considered out of range.

Definition at line 237 of file spectrum-channel.h.

Referenced by GetTypeId(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::SingleModelSpectrumChannel::StartTx().

◆ m_pathLossTrace

TracedCallback<Ptr<const SpectrumPhy>, Ptr<const SpectrumPhy>, double> ns3::SpectrumChannel::m_pathLossTrace
protected

The PathLoss trace source.

Exporting the pointers to the Tx and Rx SpectrumPhy and a pathloss value, in dB.

Definition at line 212 of file spectrum-channel.h.

Referenced by GetTypeId(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::SingleModelSpectrumChannel::StartTx().

◆ m_phasedArraySpectrumPropagationLoss

Ptr<PhasedArraySpectrumPropagationLossModel> ns3::SpectrumChannel::m_phasedArraySpectrumPropagationLoss
protected

Frequency-dependent propagation loss model to be used with this channel.

Definition at line 257 of file spectrum-channel.h.

Referenced by AddPhasedArraySpectrumPropagationLossModel(), GetPhasedArraySpectrumPropagationLossModel(), and ns3::MultiModelSpectrumChannel::StartRx().

◆ m_propagationDelay

Ptr<PropagationDelayModel> ns3::SpectrumChannel::m_propagationDelay
protected

Propagation delay model to be used with this channel.

Definition at line 247 of file spectrum-channel.h.

Referenced by DoDispose(), SetPropagationDelayModel(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::SingleModelSpectrumChannel::StartTx().

◆ m_propagationLoss

Ptr<PropagationLossModel> ns3::SpectrumChannel::m_propagationLoss
protected

Single-frequency propagation loss model to be used with this channel.

Definition at line 242 of file spectrum-channel.h.

Referenced by AddPropagationLossModel(), DoDispose(), GetPropagationLossModel(), GetTypeId(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::SingleModelSpectrumChannel::StartTx().

◆ m_spectrumPropagationLoss

Ptr<SpectrumPropagationLossModel> ns3::SpectrumChannel::m_spectrumPropagationLoss
protected

Frequency-dependent propagation loss model to be used with this channel.

Definition at line 252 of file spectrum-channel.h.

Referenced by AddSpectrumPropagationLossModel(), DoDispose(), GetSpectrumPropagationLossModel(), ns3::MultiModelSpectrumChannel::StartRx(), and ns3::SingleModelSpectrumChannel::StartRx().

◆ m_txSigParamsTrace

TracedCallback<Ptr<SpectrumSignalParameters> > ns3::SpectrumChannel::m_txSigParamsTrace
protected

Traced callback for SpectrumSignalParameters in StartTx requests.

Definition at line 230 of file spectrum-channel.h.

Referenced by GetTypeId(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::SingleModelSpectrumChannel::StartTx().


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