22 #include <ns3/object-factory.h>
24 #include <ns3/double.h>
25 #include <ns3/simulator.h>
26 #include <ns3/trace-source-accessor.h>
27 #include <ns3/antenna-model.h>
42 m_sumPowerSpectralDensity (0),
43 m_resolution (MilliSeconds (50)),
74 .AddConstructor<SpectrumAnalyzer> ()
75 .AddAttribute (
"Resolution",
76 "the lengh of the time interval over which the power spectral "
77 "density of incoming signals is averaged",
81 .AddAttribute (
"NoisePowerSpectralDensity",
82 "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.",
85 MakeDoubleChecker<double> ())
86 .AddTraceSource (
"AveragePowerSpectralDensityReport",
87 "Trace fired whenever a new value for the average Power Spectral Density is calculated",
168 (*m_sumPowerSpectralDensity) += (*psd);
176 (*m_sumPowerSpectralDensity) -= (*psd);
185 (*m_energySpectralDensity) += (*m_sumPowerSpectralDensity) * ((
Now () -
m_lastChangeTime).GetSeconds ());
203 (*m_energySpectralDensity) = 0;
208 *avgPowerSpectralDensity = 0;
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
Ptr< NetDevice > m_netDevice
void StartRx(Ptr< SpectrumSignalParameters > params)
double m_noisePowerSpectralDensity
Ptr< NetDevice > GetDevice()
Ptr< AntennaModel > m_antenna
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void DoDispose(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
void SetChannel(Ptr< SpectrumChannel > c)
double GetSeconds(void) const
Ptr< SpectrumChannel > m_channel
hold objects of type ns3::Time
virtual ~SpectrumAnalyzer()
static TypeId GetTypeId(void)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
#define NS_LOG_LOGIC(msg)
void SetDevice(Ptr< NetDevice > d)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
void AddSignal(Ptr< const SpectrumValue > psd)
TracedCallback< Ptr< const SpectrumValue > > m_averagePowerSpectralDensityReportTrace
Ptr< SpectrumValue > m_sumPowerSpectralDensity
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Ptr< SpectrumModel > m_spectrumModel
Ptr< MobilityModel > GetMobility()
virtual void GenerateReport()
void SetMobility(Ptr< MobilityModel > m)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. Both limits are inclusive.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< AntennaModel > GetRxAntenna()
Hold an floating point type.
void SubtractSignal(Ptr< const SpectrumValue > psd)
a unique identifier for an interface.
Ptr< MobilityModel > m_mobility
TypeId SetParent(TypeId tid)
Ptr< SpectrumValue > m_energySpectralDensity
void SetAntenna(Ptr< AntennaModel > a)
void UpdateEnergyReceivedSoFar()