A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
spectrum-analyzer.h
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 
55  static TypeId GetTypeId (void);
56 
57 // inherited from SpectrumPhy
60  void SetDevice (Ptr<NetDevice> d);
66 
67 
74 
81 
86  virtual void Start ();
87 
92  virtual void Stop ();
93 
94 
95 protected:
96  void DoDispose ();
97 
98 private:
99  Ptr<MobilityModel> m_mobility;
100  Ptr<AntennaModel> m_antenna;
101  Ptr<NetDevice> m_netDevice;
102  Ptr<SpectrumChannel> m_channel;
103 
104  virtual void GenerateReport ();
105 
106  void AddSignal (Ptr<const SpectrumValue> psd);
107  void SubtractSignal (Ptr<const SpectrumValue> psd);
108  void UpdateEnergyReceivedSoFar ();
109 
110  Ptr<SpectrumModel> m_spectrumModel;
111  Ptr<SpectrumValue> m_sumPowerSpectralDensity;
112  Ptr<SpectrumValue> m_energySpectralDensity;
113  double m_noisePowerSpectralDensity;
114  Time m_resolution;
115  Time m_lastChangeTime;
116  bool m_active;
117 
118  TracedCallback<Ptr<const SpectrumValue> > m_averagePowerSpectralDensityReportTrace;
119 
120 };
121 
122 
123 
124 
125 
126 
127 }
128 
129 
130 
131 
132 
133 #endif /* SPECTRUM_ANALYZER_H */
keep track of time unit.
Definition: nstime.h:149
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
void StartRx(Ptr< SpectrumSignalParameters > params)
Ptr< NetDevice > GetDevice()
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
void SetChannel(Ptr< SpectrumChannel > c)
void SetRxSpectrumModel(Ptr< SpectrumModel > m)
void SetDevice(Ptr< NetDevice > d)
Ptr< MobilityModel > GetMobility()
void SetMobility(Ptr< MobilityModel > m)
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< AntennaModel > GetRxAntenna()
a unique identifier for an interface.
Definition: type-id.h:44
void SetAntenna(Ptr< AntennaModel > a)