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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
9#ifndef REM_SPECTRUM_PHY_H
10#define REM_SPECTRUM_PHY_H
11
12#include <ns3/mobility-model.h>
13#include <ns3/net-device.h>
14#include <ns3/nstime.h>
15#include <ns3/packet.h>
16#include <ns3/spectrum-channel.h>
17#include <ns3/spectrum-phy.h>
18#include <ns3/spectrum-value.h>
19
20#include <fstream>
21#include <string>
22
23namespace ns3
24{
25
26/**
27 *
28 * This minimal SpectrumPhy implementation calculates the SINR with
29 * respect to the strongest signal for a given point. The original
30 * purpose of this class is to be used to generate a
31 * Radio Environment Map (REM) by locating several instances in a grid
32 * fashion, and connecting them to the channel only for a very short
33 * amount of time.
34 *
35 * The assumption on which this class works is that the system
36 * being considered is an infrastructure radio access network using
37 * FDD, hence all signals will be transmitted simultaneously.
38 */
40{
41 public:
43 ~RemSpectrumPhy() override;
44
45 // inherited from Object
46 void DoDispose() override;
47 /**
48 * \brief Get the type ID.
49 * \return the object TypeId
50 */
51 static TypeId GetTypeId();
52
53 // inherited from SpectrumPhy
54 void SetChannel(Ptr<SpectrumChannel> c) override;
55 void SetMobility(Ptr<MobilityModel> m) override;
56 void SetDevice(Ptr<NetDevice> d) override;
57 Ptr<MobilityModel> GetMobility() const override;
58 Ptr<NetDevice> GetDevice() const override;
60 Ptr<Object> GetAntenna() const override;
61 void StartRx(Ptr<SpectrumSignalParameters> params) override;
62
63 /**
64 * set the RX spectrum model to be used
65 *
66 * \param m
67 */
69
70 /**
71 *
72 * \param noisePower the noise power
73 * \return the Signal to Noise Ratio calculated
74 */
75 double GetSinr(double noisePower) const;
76
77 /**
78 * make StartRx a no-op from now on, and mark instance as inactive
79 *
80 */
81 void Deactivate();
82
83 /**
84 *
85 * \return true if active
86 */
87 bool IsActive() const;
88
89 /**
90 * Reset the SINR calculator
91 *
92 */
93 void Reset();
94
95 /**
96 * set usage of DataChannel
97 *
98 * \param value if true, data channel signal will be processed, control signal otherwise
99 */
100 void SetUseDataChannel(bool value);
101
102 /**
103 * set RB Id
104 *
105 * \param rbId Resource Block Id which will be processed
106 */
107 void SetRbId(int32_t rbId);
108
109 private:
110 Ptr<MobilityModel> m_mobility; ///< the mobility model
111 Ptr<const SpectrumModel> m_rxSpectrumModel; ///< receive spectrum model
112
113 double m_referenceSignalPower; ///< reference signal power
114 double m_sumPower; ///< sum power
115
116 bool m_active; ///< is active?
117
118 bool m_useDataChannel; ///< use data channel
119 int32_t m_rbId; ///< RBID
120};
121
122} // namespace ns3
123
124#endif /* REM_SPECTRUM_PHY_H */
Smart pointer class similar to boost::intrusive_ptr.
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.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.