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 |
||
22 |
#ifndef SPECTRUM_INTERFERENCE_H |
|
23 |
#define SPECTRUM_INTERFERENCE_H |
|
24 |
||
25 |
#include <ns3/object.h> |
|
26 |
#include <ns3/packet.h> |
|
27 |
#include <ns3/nstime.h> |
|
28 |
#include <ns3/spectrum-value.h> |
|
29 |
||
30 |
namespace ns3 { |
|
31 |
||
32 |
||
33 |
||
34 |
||
35 |
class SpectrumErrorModel; |
|
36 |
||
37 |
||
38 |
||
39 |
/** |
|
7241
0a7a16b599e8
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
7142
diff
changeset
|
40 |
* \ingroup spectrum |
0a7a16b599e8
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
7142
diff
changeset
|
41 |
* |
6349 | 42 |
* This class implements a gaussian interference model, i.e., all |
43 |
* incoming signals are added to the total interference. |
|
44 |
* |
|
45 |
*/ |
|
46 |
class SpectrumInterference : public Object |
|
47 |
{ |
|
48 |
public: |
|
49 |
SpectrumInterference (); |
|
50 |
virtual ~SpectrumInterference (); |
|
51 |
||
52 |
/** |
|
53 |
* set the SpectrumErrorModel to be used. |
|
54 |
* |
|
55 |
* @param e |
|
56 |
*/ |
|
57 |
void SetErrorModel (Ptr<SpectrumErrorModel> e); |
|
58 |
||
59 |
/** |
|
60 |
* notify that the PHY is starting a RX attempt |
|
61 |
* |
|
62 |
* @param p the packet corresponding to the signal being RX |
|
63 |
* @param rxPsd the power spectral density of the signal being RX |
|
64 |
*/ |
|
65 |
void StartRx (Ptr<const Packet> p, Ptr<const SpectrumValue> rxPsd); |
|
66 |
||
67 |
||
68 |
/** |
|
69 |
* notify that the RX attempt has ended. The receiving PHY must call |
|
70 |
* this method upon RX end in order to: |
|
71 |
* 1) know if RX was successful or not |
|
72 |
* 2) free up resources that might eventually be used for the |
|
73 |
* calculation of interference. Note that for this reason this |
|
74 |
* method must also be called when RX is aborted. |
|
75 |
* |
|
76 |
* |
|
77 |
* @return true if RX was successful, false otherwise |
|
78 |
*/ |
|
79 |
bool EndRx (); |
|
80 |
||
81 |
||
82 |
/** |
|
83 |
* notify that a new signal is being perceived in the medium. This |
|
84 |
* method is to be called for all incoming signal, regardless of |
|
85 |
* wether they're useful signals or interferers. |
|
86 |
* |
|
87 |
* @param spd the power spectral density of the new signal |
|
88 |
* @param duration the duration of the new signal |
|
89 |
*/ |
|
6445 | 90 |
void AddSignal (Ptr<const SpectrumValue> spd, const Time duration); |
6349 | 91 |
|
92 |
||
93 |
/** |
|
94 |
* |
|
95 |
* @param noisePsd the Noise Power Spectral Density in power units |
|
96 |
* (Watt, Pascal...) per Hz. |
|
97 |
*/ |
|
98 |
void SetNoisePowerSpectralDensity (Ptr<const SpectrumValue> noisePsd); |
|
99 |
||
100 |
||
101 |
protected: |
|
102 |
void DoDispose (); |
|
103 |
||
104 |
private: |
|
105 |
void ConditionallyEvaluateChunk (); |
|
106 |
void DoAddSignal (Ptr<const SpectrumValue> spd); |
|
107 |
void DoSubtractSignal (Ptr<const SpectrumValue> spd); |
|
108 |
||
109 |
||
110 |
||
111 |
bool m_receiving; |
|
112 |
||
113 |
Ptr<const SpectrumValue> m_rxSignal; /**< stores the power spectral density of |
|
114 |
* the signal whose RX is being |
|
115 |
* attempted |
|
116 |
*/ |
|
117 |
||
118 |
Ptr<SpectrumValue> m_allSignals; /**< stores the spectral |
|
119 |
* power density of the sum of incoming signals; |
|
120 |
* does not include noise, includes the SPD of the signal being RX |
|
121 |
*/ |
|
122 |
||
123 |
Ptr<const SpectrumValue> m_noise; |
|
124 |
||
125 |
Time m_lastChangeTime; /**< the time of the last change in |
|
126 |
m_TotalPower */ |
|
127 |
||
128 |
Ptr<SpectrumErrorModel> m_errorModel; |
|
129 |
||
130 |
||
131 |
||
132 |
}; |
|
133 |
||
134 |
||
135 |
||
136 |
} // namespace ns3 |
|
137 |
||
138 |
||
139 |
||
140 |
||
141 |
||
142 |
#endif /* SPECTRUM_INTERFERENCE_H */ |