A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::SpectrumAnalyzer Class Reference

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

#include <spectrum-analyzer.h>

+ Inheritance diagram for ns3::SpectrumAnalyzer:
+ Collaboration diagram for ns3::SpectrumAnalyzer:

Public Member Functions

 SpectrumAnalyzer ()
 
virtual ~SpectrumAnalyzer ()
 
Ptr< NetDeviceGetDevice ()
 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 ()
 
virtual ~Object ()
 
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 Run the DoDispose methods of this object and all the objects aggregated to it. More...
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 This method calls the virtual DoInitialize method on all the objects aggregated to this object. 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
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::SpectrumPhy
static TypeId GetTypeId (void)
 
- 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...
 

Protected Member Functions

void DoDispose ()
 This method is called by Object::Dispose or by the object's destructor, whichever comes first. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoInitialize (void)
 This method is called only once by Object::Initialize. More...
 
virtual void NotifyNewAggregate (void)
 This method is invoked whenever two sets of objects are aggregated together. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

Private Member Functions

void AddSignal (Ptr< const SpectrumValue > psd)
 
virtual void GenerateReport ()
 
void SubtractSignal (Ptr< const SpectrumValue > psd)
 
void UpdateEnergyReceivedSoFar ()
 

Private Attributes

bool m_active
 
Ptr< AntennaModelm_antenna
 
TracedCallback< Ptr< const
SpectrumValue > > 
m_averagePowerSpectralDensityReportTrace
 
Ptr< SpectrumChannelm_channel
 
Ptr< SpectrumValuem_energySpectralDensity
 
Time m_lastChangeTime
 
Ptr< MobilityModelm_mobility
 
Ptr< NetDevicem_netDevice
 
double m_noisePowerSpectralDensity
 
Time m_resolution
 
Ptr< SpectrumModelm_spectrumModel
 
Ptr< SpectrumValuem_sumPowerSpectralDensity
 

Detailed Description

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

Doxygen 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

  • Resolution: the lengh of the time interval over which the power spectral density of incoming signals is averaged
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +1000000.0ns
    • Flags: construct write read
  • NoisePowerSpectralDensity: the power spectral density of the measuring instrument noise, in Watt/Hz. Mostly useful to make spectrograms look more similar to those obtained by real devices. Defaults to the value for thermal noise at 300K.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 4.14e-21
    • Flags: construct write read

TraceSources

  • AveragePowerSpectralDensityReport: Trace fired whenever a new value for the average Power Spectral Density is calculated

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

Constructor & Destructor Documentation

ns3::SpectrumAnalyzer::SpectrumAnalyzer ( )

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

References NS_LOG_FUNCTION.

ns3::SpectrumAnalyzer::~SpectrumAnalyzer ( )
virtual

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

References NS_LOG_FUNCTION.

Member Function Documentation

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

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

References NS_LOG_FUNCTION, and UpdateEnergyReceivedSoFar().

Referenced by StartRx().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::SpectrumAnalyzer::DoDispose ( void  )
protectedvirtual

This method is called by Object::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 58 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.

+ Here is the call graph for this function:

void ns3::SpectrumAnalyzer::GenerateReport ( )
privatevirtual

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

References ns3::Time::GetSeconds(), m_active, m_averagePowerSpectralDensityReportTrace, m_noisePowerSpectralDensity, m_resolution, m_sumPowerSpectralDensity, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Simulator::Schedule(), and UpdateEnergyReceivedSoFar().

Referenced by Start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

get the associated NetDevice instance

Returns
a Ptr to the associated NetDevice instance

Implements ns3::SpectrumPhy.

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

References m_netDevice.

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 104 of file spectrum-analyzer.cc.

References m_mobility.

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 141 of file spectrum-analyzer.cc.

References m_antenna.

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 111 of file spectrum-analyzer.cc.

References m_spectrumModel.

TypeId ns3::SpectrumAnalyzer::GetTypeId ( void  )
static
void ns3::SpectrumAnalyzer::SetAntenna ( Ptr< AntennaModel a)

set the AntennaModel to be used

Parameters
athe Antenna Model

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

References m_antenna, and NS_LOG_FUNCTION.

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

Set the channel attached to this device.

Parameters
cthe channel

Implements ns3::SpectrumPhy.

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

References m_channel, and NS_LOG_FUNCTION.

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

set the associated NetDevice instance

Parameters
dthe NetDevice instance

Implements ns3::SpectrumPhy.

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

References m_netDevice, and NS_LOG_FUNCTION.

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 125 of file spectrum-analyzer.cc.

References m_mobility, and NS_LOG_FUNCTION.

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

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

Parameters
m

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

References m_energySpectralDensity, m_spectrumModel, m_sumPowerSpectralDensity, NS_ASSERT, and NS_LOG_FUNCTION.

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

Start the spectrum analyzer.

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

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

+ Here is the call graph for this function:

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 156 of file spectrum-analyzer.cc.

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

+ Here is the call graph for this function:

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

Stop the spectrum analyzer.

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

References m_active.

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

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

References NS_LOG_FUNCTION, and UpdateEnergyReceivedSoFar().

Referenced by StartRx().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::SpectrumAnalyzer::UpdateEnergyReceivedSoFar ( )
private

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

bool ns3::SpectrumAnalyzer::m_active
private

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

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

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

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

Referenced by GetRxAntenna(), and SetAntenna().

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

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

Referenced by GenerateReport(), and GetTypeId().

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

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

Referenced by DoDispose(), and SetChannel().

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

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

Referenced by DoDispose(), and SetRxSpectrumModel().

Time ns3::SpectrumAnalyzer::m_lastChangeTime
private

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

Referenced by UpdateEnergyReceivedSoFar().

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

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

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

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

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

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

double ns3::SpectrumAnalyzer::m_noisePowerSpectralDensity
private

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

Referenced by GenerateReport(), and GetTypeId().

Time ns3::SpectrumAnalyzer::m_resolution
private

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

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

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

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

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

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

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

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


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