A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-interference.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 CTTC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#ifndef SPECTRUM_INTERFERENCE_H
21#define SPECTRUM_INTERFERENCE_H
22
23#include "spectrum-value.h"
24
25#include <ns3/nstime.h>
26#include <ns3/object.h>
27#include <ns3/packet.h>
28
29namespace ns3
30{
31
32class SpectrumErrorModel;
33
34/**
35 * \ingroup spectrum
36 *
37 * This class implements a gaussian interference model, i.e., all
38 * incoming signals are added to the total interference.
39 *
40 */
42{
43 public:
45 ~SpectrumInterference() override;
46
47 /**
48 * Register this type.
49 * \return The TypeId.
50 */
51 static TypeId GetTypeId();
52
53 /**
54 * Set the SpectrumErrorModel to be used.
55 *
56 * @param e the error model
57 */
59
60 /**
61 * Notify that the PHY is starting a RX attempt
62 *
63 * @param p the packet corresponding to the signal being RX
64 * @param rxPsd the power spectral density of the signal being RX
65 */
67
68 /**
69 * Notify that the PHY has aborted RX
70 */
71 void AbortRx();
72
73 /**
74 * Notify that the RX attempt has ended. The receiving PHY must call
75 * this method upon RX end in order to:
76 * 1) know if RX was successful or not
77 * 2) free up resources that might eventually be used for the
78 * calculation of interference. Note that for this reason this
79 * method must also be called when RX is aborted.
80 *
81 *
82 * @return true if RX was successful, false otherwise
83 */
84 bool EndRx();
85
86 /**
87 * Notify that a new signal is being perceived in the medium. This
88 * method is to be called for all incoming signal, regardless of
89 * whether they're useful signals or interferers.
90 *
91 * @param spd the power spectral density of the new signal
92 * @param duration the duration of the new signal
93 */
94 void AddSignal(Ptr<const SpectrumValue> spd, const Time duration);
95
96 /**
97 * Set the Noise Power Spectral Density
98 *
99 * @param noisePsd the Noise Power Spectral Density in power units
100 * (Watt, Pascal...) per Hz.
101 */
103
104 protected:
105 void DoDispose() override;
106
107 private:
108 /**
109 * Evaluate a Chunk, depending on the Rx status and the last update time
110 */
112 /**
113 * Adds a signal perceived in the medium.
114 * @param spd the power spectral density of the new signal
115 */
117 /**
118 * Removes a signal perceived in the medium.
119 * @param spd the power spectral density of the new signal
120 */
122
123 bool m_receiving; //!< True if in Rx status
124
125 /**
126 * Stores the power spectral density of the signal whose RX is being attempted
127 */
129
130 /**
131 * Stores the spectral power density of the sum of incoming signals;
132 * does not include noise, includes the SPD of the signal being RX
133 */
135
136 Ptr<const SpectrumValue> m_noise; //!< Noise spectral power density
137
138 Time m_lastChangeTime; //!< the time of the last change in m_TotalPower
139
141};
142
143} // namespace ns3
144
145#endif /* SPECTRUM_INTERFERENCE_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This class implements a gaussian interference model, i.e., all incoming signals are added to the tota...
void AbortRx()
Notify that the PHY has aborted RX.
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Set the Noise Power Spectral Density.
void ConditionallyEvaluateChunk()
Evaluate a Chunk, depending on the Rx status and the last update time.
Ptr< SpectrumValue > m_allSignals
Stores the spectral power density of the sum of incoming signals; does not include noise,...
bool EndRx()
Notify that the RX attempt has ended.
Time m_lastChangeTime
the time of the last change in m_TotalPower
bool m_receiving
True if in Rx status.
static TypeId GetTypeId()
Register this type.
Ptr< const SpectrumValue > m_noise
Noise spectral power density.
void SetErrorModel(Ptr< SpectrumErrorModel > e)
Set the SpectrumErrorModel to be used.
void DoSubtractSignal(Ptr< const SpectrumValue > spd)
Removes a signal perceived in the medium.
void StartRx(Ptr< const Packet > p, Ptr< const SpectrumValue > rxPsd)
Notify that the PHY is starting a RX attempt.
Ptr< SpectrumErrorModel > m_errorModel
Error model.
void DoAddSignal(Ptr< const SpectrumValue > spd)
Adds a signal perceived in the medium.
void DoDispose() override
Destructor implementation.
void AddSignal(Ptr< const SpectrumValue > spd, const Time duration)
Notify that a new signal is being perceived in the medium.
Ptr< const SpectrumValue > m_rxSignal
Stores the power spectral density of the signal whose RX is being attempted.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.