A Discrete-Event Network Simulator
API
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ns3::SpectrumAnalyzer Class Reference

Simple SpectrumPhy implementation that averages the spectrum power density of incoming transmissions to produce a spectrogram. More...

#include "spectrum-analyzer.h"

+ Inheritance diagram for ns3::SpectrumAnalyzer:

Public Member Functions

 SpectrumAnalyzer ()
 
virtual ~SpectrumAnalyzer ()
 
Ptr< NetDeviceGetDevice () const
 Get the associated NetDevice instance. More...
 
Ptr< MobilityModelGetMobility ()
 Get the associated MobilityModel instance. More...
 
Ptr< AntennaModelGetRxAntenna ()
 Get the AntennaModel used by the NetDevice for reception. More...
 
Ptr< const SpectrumModelGetRxSpectrumModel () const
 
void SetAntenna (Ptr< AntennaModel > a)
 Set the AntennaModel to be used. More...
 
void SetChannel (Ptr< SpectrumChannel > c)
 Set the channel attached to this device. More...
 
void SetDevice (Ptr< NetDevice > d)
 Set the associated NetDevice instance. More...
 
void SetMobility (Ptr< MobilityModel > m)
 Set the mobility model associated with this device. More...
 
void SetRxSpectrumModel (Ptr< SpectrumModel > m)
 Set the spectrum model used by the SpectrumAnalyzer to represent incoming signals. More...
 
virtual void Start ()
 Start the spectrum analyzer. More...
 
void StartRx (Ptr< SpectrumSignalParameters > params)
 Notify the SpectrumPhy instance of an incoming signal. More...
 
virtual void Stop ()
 Stop the spectrum analyzer. More...
 
- Public Member Functions inherited from ns3::SpectrumPhy
 SpectrumPhy ()
 
virtual ~SpectrumPhy ()
 
- 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
 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...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default 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 operator. 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::SpectrumPhy
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::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

void DoDispose ()
 Destructor implementation. More...
 
- 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...
 

Private Member Functions

void AddSignal (Ptr< const SpectrumValue > psd)
 Adds a signal to the data collected. More...
 
virtual void GenerateReport ()
 Generates a report of the data collected so far. More...
 
void SubtractSignal (Ptr< const SpectrumValue > psd)
 Removes a signal to the data collected. More...
 
void UpdateEnergyReceivedSoFar ()
 Updates the data about the received Energy. More...
 

Private Attributes

bool m_active
 True if the analyzer is active. More...
 
Ptr< AntennaModelm_antenna
 Pointer to the Antenna model. More...
 
TracedCallback< Ptr< const SpectrumValue > > m_averagePowerSpectralDensityReportTrace
 TracedCallback - average power spectral density report. More...
 
Ptr< SpectrumChannelm_channel
 Pointer to the channel to be analyzed. More...
 
Ptr< SpectrumValuem_energySpectralDensity
 Energy spectral density. More...
 
Time m_lastChangeTime
 When the last update happened. More...
 
Ptr< MobilityModelm_mobility
 Pointer to the mobility model. More...
 
Ptr< NetDevicem_netDevice
 Pointer to the NetDevice using this object. More...
 
double m_noisePowerSpectralDensity
 Noise power spectral density. More...
 
Time m_resolution
 Time resolution. More...
 
Ptr< SpectrumModelm_spectrumModel
 Spectrum model. More...
 
Ptr< SpectrumValuem_sumPowerSpectralDensity
 Sum of the received PSD. More...
 

Additional Inherited Members

Detailed Description

Simple SpectrumPhy implementation that averages the spectrum power density of incoming transmissions to produce a spectrogram.


Introspection did not find any typical Config paths.

This PHY model supports a single antenna model instance which is used for reception (this PHY model never transmits).


Attributes

TraceSources

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

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

Constructor & Destructor Documentation

◆ SpectrumAnalyzer()

ns3::SpectrumAnalyzer::SpectrumAnalyzer ( )

Definition at line 37 of file spectrum-analyzer.cc.

References NS_LOG_FUNCTION.

◆ ~SpectrumAnalyzer()

ns3::SpectrumAnalyzer::~SpectrumAnalyzer ( )
virtual

Definition at line 51 of file spectrum-analyzer.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddSignal()

void ns3::SpectrumAnalyzer::AddSignal ( Ptr< const SpectrumValue psd)
private

Adds a signal to the data collected.

Definition at line 170 of file spectrum-analyzer.cc.

References NS_LOG_FUNCTION, and UpdateEnergyReceivedSoFar().

Referenced by StartRx().

◆ DoDispose()

void ns3::SpectrumAnalyzer::DoDispose ( void  )
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 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 57 of file spectrum-analyzer.cc.

References ns3::Object::DoDispose(), m_channel, m_energySpectralDensity, m_mobility, m_netDevice, m_spectrumModel, m_sumPowerSpectralDensity, and NS_LOG_FUNCTION.

◆ GenerateReport()

void ns3::SpectrumAnalyzer::GenerateReport ( )
privatevirtual

◆ GetDevice()

Ptr< NetDevice > ns3::SpectrumAnalyzer::GetDevice ( ) const
virtual

Get the associated NetDevice instance.

Returns
a Ptr to the associated NetDevice instance

Implements ns3::SpectrumPhy.

Definition at line 102 of file spectrum-analyzer.cc.

References m_netDevice.

◆ GetMobility()

Ptr< MobilityModel > ns3::SpectrumAnalyzer::GetMobility ( )
virtual

Get the associated MobilityModel instance.

Returns
a Ptr to the associated MobilityModel instance

Implements ns3::SpectrumPhy.

Definition at line 109 of file spectrum-analyzer.cc.

References m_mobility.

◆ GetRxAntenna()

Ptr< AntennaModel > ns3::SpectrumAnalyzer::GetRxAntenna ( )
virtual

Get the AntennaModel used by the NetDevice for reception.

Returns
a Ptr to the AntennaModel used by the NetDevice for reception

Implements ns3::SpectrumPhy.

Definition at line 146 of file spectrum-analyzer.cc.

References m_antenna.

◆ GetRxSpectrumModel()

Ptr< const SpectrumModel > ns3::SpectrumAnalyzer::GetRxSpectrumModel ( ) const
virtual
Returns
returns the SpectrumModel that this SpectrumPhy expects to be used for all SpectrumValues that are passed to StartRx. If 0 is returned, it means that any model will be accepted.

Implements ns3::SpectrumPhy.

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

References m_spectrumModel.

◆ GetTypeId()

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

◆ SetAntenna()

void ns3::SpectrumAnalyzer::SetAntenna ( Ptr< AntennaModel a)

Set the AntennaModel to be used.

Parameters
athe Antenna Model

Definition at line 152 of file spectrum-analyzer.cc.

References m_antenna, and NS_LOG_FUNCTION.

◆ SetChannel()

void ns3::SpectrumAnalyzer::SetChannel ( Ptr< SpectrumChannel c)
virtual

Set the channel attached to this device.

Parameters
cthe channel

Implements ns3::SpectrumPhy.

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

References m_channel, and NS_LOG_FUNCTION.

◆ SetDevice()

void ns3::SpectrumAnalyzer::SetDevice ( Ptr< NetDevice d)
virtual

Set the associated NetDevice instance.

Parameters
dthe NetDevice instance

Implements ns3::SpectrumPhy.

Definition at line 122 of file spectrum-analyzer.cc.

References m_netDevice, and NS_LOG_FUNCTION.

◆ SetMobility()

void ns3::SpectrumAnalyzer::SetMobility ( Ptr< MobilityModel m)
virtual

Set the mobility model associated with this device.

Parameters
mthe mobility model

Implements ns3::SpectrumPhy.

Definition at line 130 of file spectrum-analyzer.cc.

References m_mobility, and NS_LOG_FUNCTION.

◆ SetRxSpectrumModel()

void ns3::SpectrumAnalyzer::SetRxSpectrumModel ( Ptr< SpectrumModel m)

Set the spectrum model used by the SpectrumAnalyzer to represent incoming signals.

Parameters
mthe Rx Spectrum model

Definition at line 225 of file spectrum-analyzer.cc.

References f(), m_energySpectralDensity, m_spectrumModel, m_sumPowerSpectralDensity, NS_ASSERT, and NS_LOG_FUNCTION.

◆ Start()

void ns3::SpectrumAnalyzer::Start ( void  )
virtual

Start the spectrum analyzer.

Definition at line 239 of file spectrum-analyzer.cc.

References GenerateReport(), m_active, m_resolution, NS_LOG_FUNCTION, NS_LOG_LOGIC(), and ns3::Simulator::Schedule().

◆ StartRx()

void ns3::SpectrumAnalyzer::StartRx ( Ptr< SpectrumSignalParameters params)
virtual

Notify the SpectrumPhy instance of an incoming signal.

Parameters
paramsthe parameters of the signals being received

Implements ns3::SpectrumPhy.

Definition at line 161 of file spectrum-analyzer.cc.

References AddSignal(), NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SubtractSignal().

◆ Stop()

void ns3::SpectrumAnalyzer::Stop ( void  )
virtual

Stop the spectrum analyzer.

Definition at line 252 of file spectrum-analyzer.cc.

References m_active.

◆ SubtractSignal()

void ns3::SpectrumAnalyzer::SubtractSignal ( Ptr< const SpectrumValue psd)
private

Removes a signal to the data collected.

Definition at line 178 of file spectrum-analyzer.cc.

References NS_LOG_FUNCTION, and UpdateEnergyReceivedSoFar().

Referenced by StartRx().

◆ UpdateEnergyReceivedSoFar()

void ns3::SpectrumAnalyzer::UpdateEnergyReceivedSoFar ( )
private

Updates the data about the received Energy.

Definition at line 186 of file spectrum-analyzer.cc.

References m_lastChangeTime, ns3::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by AddSignal(), GenerateReport(), and SubtractSignal().

Member Data Documentation

◆ m_active

bool ns3::SpectrumAnalyzer::m_active
private

True if the analyzer is active.

Definition at line 134 of file spectrum-analyzer.h.

Referenced by GenerateReport(), Start(), and Stop().

◆ m_antenna

Ptr<AntennaModel> ns3::SpectrumAnalyzer::m_antenna
private

Pointer to the Antenna model.

Definition at line 104 of file spectrum-analyzer.h.

Referenced by GetRxAntenna(), and SetAntenna().

◆ m_averagePowerSpectralDensityReportTrace

TracedCallback<Ptr<const SpectrumValue> > ns3::SpectrumAnalyzer::m_averagePowerSpectralDensityReportTrace
private

TracedCallback - average power spectral density report.

Definition at line 137 of file spectrum-analyzer.h.

Referenced by GenerateReport(), and GetTypeId().

◆ m_channel

Ptr<SpectrumChannel> ns3::SpectrumAnalyzer::m_channel
private

Pointer to the channel to be analyzed.

Definition at line 106 of file spectrum-analyzer.h.

Referenced by DoDispose(), and SetChannel().

◆ m_energySpectralDensity

Ptr<SpectrumValue> ns3::SpectrumAnalyzer::m_energySpectralDensity
private

Energy spectral density.

Definition at line 130 of file spectrum-analyzer.h.

Referenced by DoDispose(), and SetRxSpectrumModel().

◆ m_lastChangeTime

Time ns3::SpectrumAnalyzer::m_lastChangeTime
private

When the last update happened.

Definition at line 133 of file spectrum-analyzer.h.

Referenced by UpdateEnergyReceivedSoFar().

◆ m_mobility

Ptr<MobilityModel> ns3::SpectrumAnalyzer::m_mobility
private

Pointer to the mobility model.

Definition at line 103 of file spectrum-analyzer.h.

Referenced by DoDispose(), GetMobility(), and SetMobility().

◆ m_netDevice

Ptr<NetDevice> ns3::SpectrumAnalyzer::m_netDevice
private

Pointer to the NetDevice using this object.

Definition at line 105 of file spectrum-analyzer.h.

Referenced by DoDispose(), GetDevice(), and SetDevice().

◆ m_noisePowerSpectralDensity

double ns3::SpectrumAnalyzer::m_noisePowerSpectralDensity
private

Noise power spectral density.

Definition at line 131 of file spectrum-analyzer.h.

Referenced by GenerateReport(), and GetTypeId().

◆ m_resolution

Time ns3::SpectrumAnalyzer::m_resolution
private

Time resolution.

Definition at line 132 of file spectrum-analyzer.h.

Referenced by GenerateReport(), GetTypeId(), and Start().

◆ m_spectrumModel

Ptr<SpectrumModel> ns3::SpectrumAnalyzer::m_spectrumModel
private

Spectrum model.

Definition at line 128 of file spectrum-analyzer.h.

Referenced by DoDispose(), GetRxSpectrumModel(), and SetRxSpectrumModel().

◆ m_sumPowerSpectralDensity

Ptr<SpectrumValue> ns3::SpectrumAnalyzer::m_sumPowerSpectralDensity
private

Sum of the received PSD.

Definition at line 129 of file spectrum-analyzer.h.

Referenced by DoDispose(), GenerateReport(), and SetRxSpectrumModel().


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