A Discrete-Event Network Simulator
API
ns3::SingleModelSpectrumChannel Class Reference

SpectrumChannel implementation which handles a single spectrum model. More...

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

+ Inheritance diagram for ns3::SingleModelSpectrumChannel:
+ Collaboration diagram for ns3::SingleModelSpectrumChannel:

Public Types

typedef std::vector< Ptr< SpectrumPhy > > PhyList
 Container: SpectrumPhy objects. More...
 
- Public Types inherited from ns3::SpectrumChannel
typedef void(* LossTracedCallback) (Ptr< SpectrumPhy > txPhy, Ptr< SpectrumPhy > rxPhy, double lossDb)
 TracedCallback signature for path loss calculation events. More...
 

Public Member Functions

 SingleModelSpectrumChannel ()
 
virtual void AddPropagationLossModel (Ptr< PropagationLossModel > loss)
 Set the single-frequency propagation loss model to be used. More...
 
virtual void AddRx (Ptr< SpectrumPhy > phy)
 Add a SpectrumPhy to a channel, so it can receive packets. More...
 
virtual void AddSpectrumPropagationLossModel (Ptr< SpectrumPropagationLossModel > loss)
 Set the frequency-dependent propagation loss model to be used. More...
 
virtual Ptr< NetDeviceGetDevice (uint32_t i) const
 
virtual uint32_t GetNDevices (void) const
 
virtual Ptr< SpectrumPropagationLossModelGetSpectrumPropagationLossModel (void)
 Get the frequency-dependent propagation loss model. More...
 
virtual void SetPropagationDelayModel (Ptr< PropagationDelayModel > delay)
 Set the propagation delay model to be used. More...
 
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
virtual ~SpectrumChannel ()
 
- 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
 Implement the GetInstanceTypeId method defined in ObjectBase. 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 ()
 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. 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::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Member Functions

virtual void DoDispose ()
 Destructor implementation. More...
 
void StartRx (Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver)
 Used internally to reschedule transmission after the propagation delay. More...
 

Private Attributes

double m_maxLossDb
 Maximum loss [dB]. More...
 
TracedCallback< Ptr< SpectrumPhy >, Ptr< SpectrumPhy >, double > m_pathLossTrace
 
PhyList m_phyList
 List of SpectrumPhy instances attached to the channel. 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< const SpectrumModelm_spectrumModel
 SpectrumModel that this channel instance is supporting. More...
 
Ptr< SpectrumPropagationLossModelm_spectrumPropagationLoss
 Frequency-dependent propagation loss model to be used with this channel. More...
 

Additional Inherited Members

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

Detailed Description

SpectrumChannel implementation which handles a single spectrum model.

All SpectrumPhy layers attached to this SpectrumChannel

Config Paths

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

  • "/NodeList/[i]/DeviceList/[i]/$ns3::LrWpanNetDevice/Channel/$ns3::SingleModelSpectrumChannel"
  • "/ChannelList/[i]/$ns3::SpectrumChannel/$ns3::SingleModelSpectrumChannel"
  • "/ChannelList/[i]/$ns3::SingleModelSpectrumChannel"

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: construct write read

Attributes defined in parent class ns3::Channel

  • Id: The id (unique integer) of this Channel.

TraceSources

  • 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

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

Definition at line 40 of file single-model-spectrum-channel.h.

Member Typedef Documentation

Container: SpectrumPhy objects.

Definition at line 65 of file single-model-spectrum-channel.h.

Constructor & Destructor Documentation

ns3::SingleModelSpectrumChannel::SingleModelSpectrumChannel ( )

Definition at line 47 of file single-model-spectrum-channel.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

void ns3::SingleModelSpectrumChannel::AddPropagationLossModel ( Ptr< PropagationLossModel loss)
virtual

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

Implements ns3::SpectrumChannel.

Definition at line 239 of file single-model-spectrum-channel.cc.

References m_propagationLoss, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by LrWpanCollisionTestCase::DoRun(), LrWpanEdTestCase::DoRun(), LrWpanAckTestCase::DoRun(), LrWpanErrorDistanceTestCase::DoRun(), and LrWpanCcaTestCase::DoRun().

+ Here is the caller graph for this function:

void ns3::SingleModelSpectrumChannel::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 receiveing 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 106 of file single-model-spectrum-channel.cc.

References m_phyList, and NS_LOG_FUNCTION.

void ns3::SingleModelSpectrumChannel::AddSpectrumPropagationLossModel ( Ptr< SpectrumPropagationLossModel loss)
virtual

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

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

Implements ns3::SpectrumChannel.

Definition at line 248 of file single-model-spectrum-channel.cc.

References m_spectrumPropagationLoss, NS_ASSERT, and NS_LOG_FUNCTION.

void ns3::SingleModelSpectrumChannel::DoDispose ( void  )
privatevirtual

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 overriden 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 53 of file single-model-spectrum-channel.cc.

References ns3::Object::DoDispose(), m_phyList, m_propagationDelay, m_propagationLoss, m_spectrumModel, m_spectrumPropagationLoss, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Ptr< NetDevice > ns3::SingleModelSpectrumChannel::GetDevice ( uint32_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 231 of file single-model-spectrum-channel.cc.

References m_phyList, and NS_LOG_FUNCTION.

uint32_t ns3::SingleModelSpectrumChannel::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 223 of file single-model-spectrum-channel.cc.

References m_phyList, and NS_LOG_FUNCTION.

Ptr< SpectrumPropagationLossModel > ns3::SingleModelSpectrumChannel::GetSpectrumPropagationLossModel ( void  )
virtual

Get the frequency-dependent propagation loss model.

Returns
a pointer to the propagation loss model.

Definition at line 265 of file single-model-spectrum-channel.cc.

References m_spectrumPropagationLoss, and NS_LOG_FUNCTION.

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

Get the type ID.

Returns
the object TypeId

Definition at line 65 of file single-model-spectrum-channel.cc.

References m_maxLossDb, m_pathLossTrace, ns3::MakeDoubleAccessor(), ns3::MakeTraceSourceAccessor(), NS_LOG_FUNCTION_NOARGS, and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

void ns3::SingleModelSpectrumChannel::SetPropagationDelayModel ( Ptr< PropagationDelayModel delay)
virtual

Set the propagation delay model to be used.

Parameters
delayPtr to the propagation delay model to be used.

Implements ns3::SpectrumChannel.

Definition at line 256 of file single-model-spectrum-channel.cc.

References m_propagationDelay, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by LrWpanCollisionTestCase::DoRun(), LrWpanEdTestCase::DoRun(), LrWpanAckTestCase::DoRun(), and LrWpanCcaTestCase::DoRun().

+ Here is the caller graph for this function:

void ns3::SingleModelSpectrumChannel::StartRx ( Ptr< SpectrumSignalParameters params,
Ptr< SpectrumPhy receiver 
)
private

Used internally to reschedule transmission after the propagation delay.

Parameters
params
receiver

Definition at line 214 of file single-model-spectrum-channel.cc.

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

Referenced by StartTx().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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 114 of file single-model-spectrum-channel.cc.

References ns3::PropagationLossModel::CalcRxPower(), ns3::MobilityModel::GetPosition(), m_maxLossDb, m_pathLossTrace, m_phyList, m_propagationDelay, m_propagationLoss, m_spectrumModel, m_spectrumPropagationLoss, ns3::MicroSeconds(), NS_ASSERT, NS_ASSERT_MSG, 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

double ns3::SingleModelSpectrumChannel::m_maxLossDb
private

Maximum loss [dB].

Any device above this loss is considered out of range.

Definition at line 117 of file single-model-spectrum-channel.h.

Referenced by GetTypeId(), and StartTx().

TracedCallback<Ptr<SpectrumPhy>, Ptr<SpectrumPhy>, double > ns3::SingleModelSpectrumChannel::m_pathLossTrace
private
Deprecated:
The non-const Ptr<SpectrumPhy> argument is deprecated and will be changed to Ptr<const SpectrumPhy> in a future release.

Definition at line 124 of file single-model-spectrum-channel.h.

Referenced by GetTypeId(), and StartTx().

PhyList ns3::SingleModelSpectrumChannel::m_phyList
private

List of SpectrumPhy instances attached to the channel.

Definition at line 87 of file single-model-spectrum-channel.h.

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

Ptr<PropagationDelayModel> ns3::SingleModelSpectrumChannel::m_propagationDelay
private

Propagation delay model to be used with this channel.

Definition at line 98 of file single-model-spectrum-channel.h.

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

Ptr<PropagationLossModel> ns3::SingleModelSpectrumChannel::m_propagationLoss
private

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

Definition at line 104 of file single-model-spectrum-channel.h.

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

Ptr<const SpectrumModel> ns3::SingleModelSpectrumChannel::m_spectrumModel
private

SpectrumModel that this channel instance is supporting.

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

Referenced by DoDispose(), and StartTx().

Ptr<SpectrumPropagationLossModel> ns3::SingleModelSpectrumChannel::m_spectrumPropagationLoss
private

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

Definition at line 109 of file single-model-spectrum-channel.h.

Referenced by AddSpectrumPropagationLossModel(), DoDispose(), GetSpectrumPropagationLossModel(), and StartTx().


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