A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rem-spectrum-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 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 REM_SPECTRUM_PHY_H
21#define REM_SPECTRUM_PHY_H
22
23#include <ns3/mobility-model.h>
24#include <ns3/net-device.h>
25#include <ns3/nstime.h>
26#include <ns3/packet.h>
27#include <ns3/spectrum-channel.h>
28#include <ns3/spectrum-phy.h>
29#include <ns3/spectrum-value.h>
30
31#include <fstream>
32#include <string>
33
34namespace ns3
35{
36
37/**
38 *
39 * This minimal SpectrumPhy implementation calculates the SINR with
40 * respect to the strongest signal for a given point. The original
41 * purpose of this class is to be used to generate a
42 * Radio Environment Map (REM) by locating several instances in a grid
43 * fashion, and connecting them to the channel only for a very short
44 * amount of time.
45 *
46 * The assumption on which this class works is that the system
47 * being considered is an infrastructure radio access network using
48 * FDD, hence all signals will be transmitted simultaneously.
49 */
51{
52 public:
54 ~RemSpectrumPhy() override;
55
56 // inherited from Object
57 void DoDispose() override;
58 /**
59 * \brief Get the type ID.
60 * \return the object TypeId
61 */
62 static TypeId GetTypeId();
63
64 // inherited from SpectrumPhy
65 void SetChannel(Ptr<SpectrumChannel> c) override;
66 void SetMobility(Ptr<MobilityModel> m) override;
67 void SetDevice(Ptr<NetDevice> d) override;
68 Ptr<MobilityModel> GetMobility() const override;
69 Ptr<NetDevice> GetDevice() const override;
71 Ptr<Object> GetAntenna() const override;
72 void StartRx(Ptr<SpectrumSignalParameters> params) override;
73
74 /**
75 * set the RX spectrum model to be used
76 *
77 * \param m
78 */
80
81 /**
82 *
83 * \param noisePower the noise power
84 * \return the Signal to Noise Ratio calculated
85 */
86 double GetSinr(double noisePower) const;
87
88 /**
89 * make StartRx a no-op from now on, and mark instance as inactive
90 *
91 */
92 void Deactivate();
93
94 /**
95 *
96 * \return true if active
97 */
98 bool IsActive() const;
99
100 /**
101 * Reset the SINR calculator
102 *
103 */
104 void Reset();
105
106 /**
107 * set usage of DataChannel
108 *
109 * \param value if true, data channel signal will be processed, control signal otherwise
110 */
111 void SetUseDataChannel(bool value);
112
113 /**
114 * set RB Id
115 *
116 * \param rbId Resource Block Id which will be processed
117 */
118 void SetRbId(int32_t rbId);
119
120 private:
121 Ptr<MobilityModel> m_mobility; ///< the mobility model
122 Ptr<const SpectrumModel> m_rxSpectrumModel; ///< receive spectrum model
123
124 double m_referenceSignalPower; ///< reference signal power
125 double m_sumPower; ///< sum power
126
127 bool m_active; ///< is active?
128
129 bool m_useDataChannel; ///< use data channel
130 int32_t m_rbId; ///< RBID
131};
132
133} // namespace ns3
134
135#endif /* REM_SPECTRUM_PHY_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This minimal SpectrumPhy implementation calculates the SINR with respect to the strongest signal for ...
double m_referenceSignalPower
reference signal power
Ptr< MobilityModel > m_mobility
the mobility model
void DoDispose() override
Destructor implementation.
void Reset()
Reset the SINR calculator.
double GetSinr(double noisePower) const
void Deactivate()
make StartRx a no-op from now on, and mark instance as inactive
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
void StartRx(Ptr< SpectrumSignalParameters > params) override
Notify the SpectrumPhy instance of an incoming signal.
Ptr< Object > GetAntenna() const override
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
void SetRbId(int32_t rbId)
set RB Id
static TypeId GetTypeId()
Get the type ID.
double m_sumPower
sum power
void SetRxSpectrumModel(Ptr< const SpectrumModel > m)
set the RX spectrum model to be used
Ptr< const SpectrumModel > GetRxSpectrumModel() const override
Ptr< NetDevice > GetDevice() const override
Get the associated NetDevice instance.
bool m_active
is active?
void SetMobility(Ptr< MobilityModel > m) override
Set the mobility model associated with this device.
void SetUseDataChannel(bool value)
set usage of DataChannel
Ptr< MobilityModel > GetMobility() const override
Get the associated MobilityModel instance.
void SetChannel(Ptr< SpectrumChannel > c) override
Set the channel attached to this device.
bool m_useDataChannel
use data channel
void SetDevice(Ptr< NetDevice > d) override
Set the associated NetDevice instance.
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.