SpectrumChannel implementation which handles a single spectrum model. More...
#include "single-model-spectrum-channel.h"
Public Types | |
typedef std::vector< Ptr< SpectrumPhy > > | PhyList |
Container: SpectrumPhy objects. | |
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>. | |
Public Member Functions | |
SingleModelSpectrumChannel () | |
void | AddRx (Ptr< SpectrumPhy > phy) override |
Add a SpectrumPhy to a channel, so it can receive packets. | |
Ptr< NetDevice > | GetDevice (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< PhasedArraySpectrumPropagationLossModel > | GetPhasedArraySpectrumPropagationLossModel () const |
Get the frequency-dependent propagation loss model that is compatible with the phased antenna arrays at TX and RX. | |
Ptr< PropagationDelayModel > | GetPropagationDelayModel () const |
Get the propagation delay model that has been set on the channel. | |
Ptr< PropagationLossModel > | GetPropagationLossModel () const |
Get the propagation loss model. | |
Ptr< SpectrumPropagationLossModel > | GetSpectrumPropagationLossModel () const |
Get the frequency-dependent propagation loss model. | |
Ptr< SpectrumTransmitFilter > | GetSpectrumTransmitFilter () 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< Object > | GetObject () 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< Object > | GetObject (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. | |
SimpleRefCount & | operator= (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. | |
Private Member Functions | |
void | DoDispose () override |
Destructor implementation. | |
void | StartRx (Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver) |
Used internally to reschedule transmission after the propagation delay. | |
Private Attributes | |
PhyList | m_phyList |
List of SpectrumPhy instances attached to the channel. | |
Ptr< const SpectrumModel > | m_spectrumModel |
SpectrumModel that this channel instance is supporting. | |
Additional Inherited Members | |
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. | |
Protected Attributes inherited from ns3::SpectrumChannel | |
Ptr< SpectrumTransmitFilter > | m_filter {nullptr} |
Transmit filter to be used with this channel. | |
TracedCallback< Ptr< const MobilityModel >, Ptr< const MobilityModel >, double, double, double, double > | m_gainTrace |
The Gain trace source. | |
double | m_maxLossDb |
Maximum loss [dB]. | |
TracedCallback< Ptr< const SpectrumPhy >, Ptr< const SpectrumPhy >, double > | m_pathLossTrace |
The PathLoss trace source. | |
Ptr< PhasedArraySpectrumPropagationLossModel > | m_phasedArraySpectrumPropagationLoss |
Frequency-dependent propagation loss model to be used with this channel. | |
Ptr< PropagationDelayModel > | m_propagationDelay |
Propagation delay model to be used with this channel. | |
Ptr< PropagationLossModel > | m_propagationLoss |
Single-frequency propagation loss model to be used with this channel. | |
Ptr< SpectrumPropagationLossModel > | m_spectrumPropagationLoss |
Frequency-dependent propagation loss model to be used with this channel. | |
TracedCallback< Ptr< SpectrumSignalParameters > > | m_txSigParamsTrace |
Traced callback for SpectrumSignalParameters in StartTx requests. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
SpectrumChannel implementation which handles a single spectrum model.
All SpectrumPhy layers attached to this SpectrumChannel
Definition at line 27 of file single-model-spectrum-channel.h.
typedef std::vector<Ptr<SpectrumPhy> > ns3::SingleModelSpectrumChannel::PhyList |
Container: SpectrumPhy objects.
Definition at line 48 of file single-model-spectrum-channel.h.
ns3::SingleModelSpectrumChannel::SingleModelSpectrumChannel | ( | ) |
Definition at line 38 of file single-model-spectrum-channel.cc.
References NS_LOG_FUNCTION.
|
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.
phy | the SpectrumPhy instance to be added to the channel as a receiver. |
Implements ns3::SpectrumChannel.
Definition at line 75 of file single-model-spectrum-channel.cc.
References m_phyList, m_spectrumModel, and NS_LOG_FUNCTION.
|
overrideprivatevirtual |
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 44 of file single-model-spectrum-channel.cc.
References ns3::SpectrumChannel::DoDispose(), m_phyList, m_spectrumModel, and NS_LOG_FUNCTION.
i | index of NetDevice to retrieve |
This method must be implemented by subclasses.
Implements ns3::Channel.
Definition at line 245 of file single-model-spectrum-channel.cc.
References m_phyList, and NS_LOG_FUNCTION.
|
overridevirtual |
This method must be implemented by subclasses.
Implements ns3::Channel.
Definition at line 238 of file single-model-spectrum-channel.cc.
References m_phyList, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 53 of file single-model-spectrum-channel.cc.
References NS_LOG_FUNCTION_NOARGS, and ns3::TypeId::SetParent().
|
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.
phy | the SpectrumPhy instance to be removed from the channel as a receiver. |
Implements ns3::SpectrumChannel.
Definition at line 64 of file single-model-spectrum-channel.cc.
References m_phyList, and NS_LOG_FUNCTION.
|
private |
Used internally to reschedule transmission after the propagation delay.
params | |
receiver |
Definition at line 224 of file single-model-spectrum-channel.cc.
References ns3::SpectrumChannel::m_spectrumPropagationLoss, and NS_LOG_FUNCTION.
Referenced by StartTx().
|
overridevirtual |
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 90 of file single-model-spectrum-channel.cc.
References ns3::DynamicCast(), ns3::SpectrumChannel::m_filter, ns3::SpectrumChannel::m_gainTrace, ns3::SpectrumChannel::m_maxLossDb, ns3::SpectrumChannel::m_pathLossTrace, m_phyList, ns3::SpectrumChannel::m_propagationDelay, ns3::SpectrumChannel::m_propagationLoss, m_spectrumModel, ns3::SpectrumChannel::m_txSigParamsTrace, ns3::MicroSeconds(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), ns3::Simulator::ScheduleWithContext(), and StartRx().
|
private |
List of SpectrumPhy instances attached to the channel.
Definition at line 64 of file single-model-spectrum-channel.h.
Referenced by AddRx(), DoDispose(), GetDevice(), GetNDevices(), RemoveRx(), and StartTx().
|
private |
SpectrumModel that this channel instance is supporting.
Definition at line 69 of file single-model-spectrum-channel.h.
Referenced by AddRx(), DoDispose(), and StartTx().