A Discrete-Event Network Simulator
API
spectrum-analyzer.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef SPECTRUM_ANALYZER_H
22 #define SPECTRUM_ANALYZER_H
23 
24 
25 #include <ns3/spectrum-value.h>
26 #include <ns3/mobility-model.h>
27 #include <ns3/packet.h>
28 #include <ns3/nstime.h>
29 #include <ns3/net-device.h>
30 #include <ns3/spectrum-phy.h>
31 #include <ns3/spectrum-channel.h>
32 #include <string>
33 #include <fstream>
34 
35 namespace ns3 {
36 
37 
49 {
50 
51 public:
53  virtual ~SpectrumAnalyzer ();
54 
59  static TypeId GetTypeId (void);
60 
61  // inherited from SpectrumPhy
64  void SetDevice (Ptr<NetDevice> d);
66  Ptr<NetDevice> GetDevice () const;
68  Ptr<Object> GetAntenna () const;
70 
71 
78 
85 
90  virtual void Start ();
91 
96  virtual void Stop ();
97 
98 
99 protected:
100  void DoDispose ();
101 
102 private:
107 
113  virtual void GenerateReport ();
114 
129 
136  bool m_active;
137 
140 
141 };
142 
143 
144 
145 
146 
147 
148 }
149 
150 
151 
152 
153 
154 #endif /* SPECTRUM_ANALYZER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Simple SpectrumPhy implementation that averages the spectrum power density of incoming transmissions ...
TracedCallback< Ptr< const SpectrumValue > > m_averagePowerSpectralDensityReportTrace
TracedCallback - average power spectral density report.
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
Set the spectrum model used by the SpectrumAnalyzer to represent incoming signals.
virtual void Start()
Start the spectrum analyzer.
void DoDispose()
Destructor implementation.
double m_noisePowerSpectralDensity
Noise power spectral density.
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
void SetAntenna(Ptr< AntennaModel > a)
Set the AntennaModel to be used.
virtual void Stop()
Stop the spectrum analyzer.
Ptr< MobilityModel > GetMobility() const
Get the associated MobilityModel instance.
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
bool m_active
True if the analyzer is active.
Ptr< SpectrumChannel > m_channel
Pointer to the channel to be analyzed.
Time m_resolution
Time resolution.
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
Ptr< AntennaModel > m_antenna
Pointer to the Antenna model.
virtual void GenerateReport()
Generates a report of the data collected so far.
Ptr< SpectrumModel > m_spectrumModel
Spectrum model.
static TypeId GetTypeId(void)
Get the type ID.
Time m_lastChangeTime
When the last update happened.
void AddSignal(Ptr< const SpectrumValue > psd)
Adds a signal to the data collected.
Ptr< SpectrumValue > m_sumPowerSpectralDensity
Sum of the received PSD.
Ptr< Object > GetAntenna() const
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
Ptr< SpectrumValue > m_energySpectralDensity
Energy spectral density.
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
void UpdateEnergyReceivedSoFar()
Updates the data about the received Energy.
Ptr< const SpectrumModel > GetRxSpectrumModel() const
void SubtractSignal(Ptr< const SpectrumValue > psd)
Removes a signal to the data collected.
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Ptr< NetDevice > m_netDevice
Pointer to the NetDevice using this object.
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:47
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.