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"
Public Types | |
typedef void(* | SignalParametersTracedCallback) (Ptr< SpectrumSignalParameters > params) |
TracedCallback signature for Ptr<const SpectrumSignalParameters>. More... | |
![]() | |
typedef void(* | LossTracedCallback) (Ptr< SpectrumPhy > txPhy, Ptr< SpectrumPhy > rxPhy, double lossDb) |
TracedCallback signature for path loss calculation events. More... | |
Public Member Functions | |
MultiModelSpectrumChannel () | |
virtual void | AddPropagationLossModel (Ptr< PropagationLossModel > loss) |
Add 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) |
Add the frequency-dependent propagation loss model to be used. More... | |
virtual Ptr< NetDevice > | GetDevice (uint32_t i) const |
virtual uint32_t | GetNDevices (void) const |
virtual Ptr< SpectrumPropagationLossModel > | GetSpectrumPropagationLossModel (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... | |
![]() | |
virtual | ~SpectrumChannel () |
![]() | |
Channel () | |
virtual | ~Channel () |
uint32_t | GetId (void) const |
![]() | |
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... | |
![]() | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
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 TypeId | GetTypeId (void) |
Get the type ID. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
void | DoDispose () |
Destructor implementation. More... | |
![]() | |
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... | |
![]() | |
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 | |
double | m_maxLossDb |
Maximum loss [dB]. More... | |
uint32_t | m_numDevices |
Number of devices connected to the channel. More... | |
TracedCallback< Ptr< SpectrumPhy >, Ptr< SpectrumPhy >, double > | m_pathLossTrace |
Ptr< PropagationDelayModel > | m_propagationDelay |
Propagation delay model to be used with this channel. More... | |
Ptr< PropagationLossModel > | m_propagationLoss |
Single-frequency propagation loss model to be used with this channel. More... | |
RxSpectrumModelInfoMap_t | m_rxSpectrumModelInfoMap |
Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances. More... | |
Ptr< SpectrumPropagationLossModel > | m_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... | |
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 | |
![]() | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
This SpectrumChannel implementation can handle the presence of SpectrumPhy instances which can use different spectrum models, i.e., different SpectrumModel.
ns3::MultiModelSpectrumChannel is accessible through the following paths with Config::Set and Config::Connect:
Size of this type is 200 bytes (on a 64-bit architecture).
Definition at line 106 of file multi-model-spectrum-channel.h.
typedef void(* ns3::MultiModelSpectrumChannel::SignalParametersTracedCallback) (Ptr< SpectrumSignalParameters > params) |
TracedCallback signature for Ptr<const SpectrumSignalParameters>.
[in] | params | SpectrumSignalParameters instance. |
Definition at line 141 of file multi-model-spectrum-channel.h.
ns3::MultiModelSpectrumChannel::MultiModelSpectrumChannel | ( | ) |
Definition at line 84 of file multi-model-spectrum-channel.cc.
References NS_LOG_FUNCTION.
|
virtual |
Add the single-frequency propagation loss model to be used.
loss | a pointer to the propagation loss model to be used. |
Implements ns3::SpectrumChannel.
Definition at line 445 of file multi-model-spectrum-channel.cc.
References m_propagationLoss, NS_LOG_FUNCTION, and ns3::PropagationLossModel::SetNext().
Referenced by Bug2483TestCase::DoRun().
|
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.
phy | the SpectrumPhy instance to be added to the channel as a receiver. |
Implements ns3::SpectrumChannel.
Definition at line 150 of file multi-model-spectrum-channel.cc.
References ns3::SpectrumPhy::GetRxSpectrumModel(), ns3::SpectrumModel::GetUid(), ns3::SpectrumModel::IsOrthogonal(), m_numDevices, m_rxSpectrumModelInfoMap, m_txSpectrumModelInfoMap, NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().
|
virtual |
Add the frequency-dependent propagation loss model to be used.
loss | a pointer to the propagation loss model to be used. |
Implements ns3::SpectrumChannel.
Definition at line 456 of file multi-model-spectrum-channel.cc.
References m_spectrumPropagationLoss, and NS_LOG_FUNCTION.
|
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 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 90 of file multi-model-spectrum-channel.cc.
References ns3::Object::DoDispose(), m_propagationDelay, m_propagationLoss, m_rxSpectrumModelInfoMap, m_spectrumPropagationLoss, m_txSpectrumModelInfoMap, and NS_LOG_FUNCTION.
|
private |
This method checks if m_rxSpectrumModelInfoMap contains an entry for the given TX SpectrumModel.
If such entry exists, it returns an interator pointing to it. If not, it creates a new entry in m_txSpectrumMpodelInfoMap, and returns an iterator to it.
txSpectrumModel | The TX SpectrumModel being considered |
Definition at line 220 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().
i | index of NetDevice to retrieve |
This method must be implemented by subclasses.
Implements ns3::Channel.
Definition at line 411 of file multi-model-spectrum-channel.cc.
References m_numDevices, m_rxSpectrumModelInfoMap, NS_ASSERT, and NS_FATAL_ERROR.
|
virtual |
This method must be implemented by subclasses.
Implements ns3::Channel.
Definition at line 403 of file multi-model-spectrum-channel.cc.
References m_numDevices.
|
virtual |
Get the frequency-dependent propagation loss model.
Definition at line 474 of file multi-model-spectrum-channel.cc.
References m_spectrumPropagationLoss, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 102 of file multi-model-spectrum-channel.cc.
References m_maxLossDb, m_pathLossTrace, m_txSigParamsTrace, ns3::MakeDoubleAccessor(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
|
virtual |
Set the propagation delay model to be used.
delay | Ptr to the propagation delay model to be used. |
Implements ns3::SpectrumChannel.
Definition at line 467 of file multi-model-spectrum-channel.cc.
References m_propagationDelay, and NS_ASSERT.
Referenced by Bug2483TestCase::DoRun().
|
privatevirtual |
Used internally to reschedule transmission after the propagation delay.
params | The signal paramters. |
receiver | A pointer to the receiver SpectrumPhy. |
Definition at line 394 of file multi-model-spectrum-channel.cc.
References NS_LOG_FUNCTION, and ns3::SpectrumPhy::StartRx().
Referenced by StartTx().
|
virtual |
Used by attached PHY instances to transmit signals on the channel.
params | the parameters of the signals being transmitted |
Implements ns3::SpectrumChannel.
Definition at line 264 of file multi-model-spectrum-channel.cc.
References ns3::PropagationLossModel::CalcRxPower(), FindAndEventuallyAddTxSpectrumModel(), ns3::MobilityModel::GetPosition(), m_maxLossDb, m_pathLossTrace, m_propagationDelay, m_propagationLoss, m_rxSpectrumModelInfoMap, m_spectrumPropagationLoss, m_txSigParamsTrace, m_txSpectrumModelInfoMap, ns3::MicroSeconds(), NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, NS_LOG_LOGIC(), ns3::Simulator::Schedule(), ns3::Simulator::ScheduleWithContext(), and StartRx().
|
private |
Maximum loss [dB].
Any device above this loss is considered out of range.
Definition at line 208 of file multi-model-spectrum-channel.h.
Referenced by GetTypeId(), and StartTx().
|
private |
Number of devices connected to the channel.
Definition at line 201 of file multi-model-spectrum-channel.h.
Referenced by AddRx(), GetDevice(), and GetNDevices().
|
private |
Ptr<SpectrumPhy>
argument is deprecated and will be changed to Ptr<const SpectrumPhy>
in a future release. Definition at line 215 of file multi-model-spectrum-channel.h.
Referenced by GetTypeId(), and StartTx().
|
private |
Propagation delay model to be used with this channel.
Definition at line 170 of file multi-model-spectrum-channel.h.
Referenced by DoDispose(), SetPropagationDelayModel(), and StartTx().
|
private |
Single-frequency propagation loss model to be used with this channel.
Definition at line 175 of file multi-model-spectrum-channel.h.
Referenced by AddPropagationLossModel(), DoDispose(), and StartTx().
|
private |
Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances.
Definition at line 196 of file multi-model-spectrum-channel.h.
Referenced by AddRx(), DoDispose(), FindAndEventuallyAddTxSpectrumModel(), GetDevice(), and StartTx().
|
private |
Frequency-dependent propagation loss model to be used with this channel.
Definition at line 180 of file multi-model-spectrum-channel.h.
Referenced by AddSpectrumPropagationLossModel(), DoDispose(), GetSpectrumPropagationLossModel(), and StartTx().
|
private |
Traced callback for SpectrumSignalParameters in StartTx requests.
Definition at line 219 of file multi-model-spectrum-channel.h.
Referenced by GetTypeId(), and StartTx().
|
private |
Data structure holding, for each TX SpectrumModel, all the converters to any RX SpectrumModel, and all the corresponding SpectrumPhy instances.
Definition at line 189 of file multi-model-spectrum-channel.h.
Referenced by AddRx(), DoDispose(), FindAndEventuallyAddTxSpectrumModel(), and StartTx().