author | Mitch Watrous <watrous@u.washington.edu> |
Wed, 18 May 2011 17:24:04 -0700 | |
changeset 7241 | 0a7a16b599e8 |
parent 7142 | 89a701fec3a1 |
permissions | -rw-r--r-- |
6349 | 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 |
||
38 |
/** |
|
7241
0a7a16b599e8
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
7142
diff
changeset
|
39 |
* \ingroup spectrum |
0a7a16b599e8
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
7142
diff
changeset
|
40 |
* |
6349 | 41 |
* Simple SpectrumPhy implemetation that averages the spectrum power |
42 |
* density of incoming transmissions to produce a spectrogram. |
|
43 |
* |
|
44 |
*/ |
|
45 |
class SpectrumAnalyzer : public SpectrumPhy |
|
46 |
{ |
|
47 |
||
48 |
public: |
|
49 |
SpectrumAnalyzer (); |
|
50 |
virtual ~SpectrumAnalyzer (); |
|
51 |
||
52 |
static TypeId GetTypeId (void); |
|
53 |
||
54 |
// inherited from SpectrumPhy |
|
55 |
void SetChannel (Ptr<SpectrumChannel> c); |
|
56 |
void SetMobility (Ptr<Object> m); |
|
57 |
void SetDevice (Ptr<Object> d); |
|
58 |
Ptr<Object> GetMobility (); |
|
59 |
Ptr<Object> GetDevice (); |
|
60 |
Ptr<const SpectrumModel> GetRxSpectrumModel () const; |
|
61 |
void StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPowerSpectralDensity, SpectrumType st, Time duration); |
|
62 |
||
63 |
||
64 |
/** |
|
65 |
* Set the spectrum model used by the SpectrumAnalyzer to represent incoming signals |
|
66 |
* |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6801
diff
changeset
|
67 |
* @param m |
6349 | 68 |
*/ |
69 |
void SetRxSpectrumModel (Ptr<SpectrumModel> m); |
|
70 |
||
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6801
diff
changeset
|
71 |
|
6349 | 72 |
/** |
73 |
* Start the spectrum analyzer |
|
74 |
* |
|
75 |
*/ |
|
76 |
virtual void Start (); |
|
77 |
||
78 |
/** |
|
79 |
* Stop the spectrum analyzer |
|
80 |
* |
|
81 |
*/ |
|
82 |
virtual void Stop (); |
|
83 |
||
84 |
||
85 |
protected: |
|
86 |
void DoDispose (); |
|
87 |
||
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6801
diff
changeset
|
88 |
private: |
6349 | 89 |
Ptr<Object> m_mobility; |
90 |
Ptr<Object> m_netDevice; |
|
91 |
Ptr<SpectrumChannel> m_channel; |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6801
diff
changeset
|
92 |
|
6349 | 93 |
virtual void GenerateReport (); |
94 |
||
95 |
void AddSignal (Ptr<const SpectrumValue> psd); |
|
96 |
void SubtractSignal (Ptr<const SpectrumValue> psd); |
|
97 |
void UpdateEnergyReceivedSoFar (); |
|
98 |
||
99 |
Ptr<SpectrumModel> m_spectrumModel; |
|
100 |
Ptr<SpectrumValue> m_sumPowerSpectralDensity; |
|
101 |
Ptr<SpectrumValue> m_energySpectralDensity; |
|
102 |
double m_noisePowerSpectralDensity; |
|
103 |
Time m_resolution; |
|
104 |
Time m_lastChangeTime; |
|
105 |
bool m_active; |
|
106 |
||
107 |
TracedCallback<Ptr<const SpectrumValue> > m_averagePowerSpectralDensityReportTrace; |
|
108 |
||
109 |
}; |
|
110 |
||
111 |
||
112 |
||
113 |
||
114 |
||
115 |
||
116 |
} |
|
117 |
||
118 |
||
119 |
||
120 |
||
121 |
||
122 |
#endif /* SPECTRUM_ANALYZER_H */ |