A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
two-ray-spectrum-propagation-loss-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 SIGNET Lab, Department of Information Engineering,
3 * University of Padova
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
19#ifndef TWO_RAY_SPECTRUM_PROPAGATION_LOSS_H
20#define TWO_RAY_SPECTRUM_PROPAGATION_LOSS_H
21
22#include "ns3/channel-condition-model.h"
23#include "ns3/phased-array-spectrum-propagation-loss-model.h"
24#include "ns3/spectrum-signal-parameters.h"
25
26#include <map>
27
31
32namespace ns3
33{
34
35class NetDevice;
36
57{
58 // Test classes needs access to CalcBeamformingGain and GetFtrFastFading
59 friend class ::FtrFadingModelAverageTest;
60 friend class ::ArrayResponseTest;
61 friend class ::OverallGainAverageTest;
62
63 public:
67 struct FtrParams
68 {
82 FtrParams(double m, double sigma, double k, double delta)
83 {
84 // Make sure the parameter values belong to the proper domains
85 NS_ASSERT(delta >= 0.0 && delta <= 1.0);
86
87 m_m = m;
88 m_sigma = sigma;
89 m_k = k;
90 m_delta = delta;
91 }
92
96 FtrParams() = delete;
97
101 double m_m = 0;
102
106 double m_sigma = 0;
107
111 double m_k = 0;
112
117 double m_delta = 0;
118 };
119
124 using CarrierFrequencyFtrParamsTuple = std::tuple<std::vector<double>, std::vector<FtrParams>>;
125
131 std::map<std::string,
132 std::map<ChannelCondition::LosConditionValue, CarrierFrequencyFtrParamsTuple>>;
133
138
143
144 void DoDispose() override;
145
150 static TypeId GetTypeId();
151
156 void SetScenario(const std::string& scenario);
157
162 void SetFrequency(double f);
163
171 int64_t AssignStreams(int64_t stream);
172
194 Ptr<const PhasedArrayModel> aPhasedArrayModel,
195 Ptr<const PhasedArrayModel> bPhasedArrayModel) const override;
196
197 private:
207
238
261 double GetFtrFastFading(const FtrParams& params) const;
262
287 Ptr<const PhasedArrayModel> aPhasedArrayModel,
288 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
289
299 std::size_t SearchClosestFc(const std::vector<double>& frequencies, double targetFc) const;
300
305
310
316
322
323 std::string m_scenario;
324
330};
331
332} // namespace ns3
333
334#endif /* TWO_RAY_SPECTRUM_PROPAGATION_LOSS_H */
double f(double x, void *params)
Definition: 80211b.c:70
Test case for the TwoRaySpectrumPropagationLossModel class.
Test case for the TwoRaySpectrumPropagationLossModel class.
Test case for the TwoRaySpectrumPropagationLossModel class.
LosConditionValue
Possible values for Line-of-Sight condition.
spectrum-aware propagation loss model that is compatible with PhasedArrayModel type of ns-3 antenna
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
double CalcBeamformingGain(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b, Ptr< const PhasedArrayModel > aPhasedArrayModel, Ptr< const PhasedArrayModel > bPhasedArrayModel) const
Compute the beamforming gain by combining single-element and array gains.
ChannelCondition::LosConditionValue GetLosCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Retrieves the LOS condition associated to the specified mobility models.
FtrParams GetFtrParameters(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Retrieves the FTR fading model parameters related to the carrier frequency and LOS condition.
Ptr< NormalRandomVariable > m_normalRv
Random variable used to sample the normal distributed amplitudes of the FTR diffuse components.
Ptr< SpectrumValue > DoCalcRxPowerSpectralDensity(Ptr< const SpectrumSignalParameters > txPsd, Ptr< const MobilityModel > a, Ptr< const MobilityModel > b, Ptr< const PhasedArrayModel > aPhasedArrayModel, Ptr< const PhasedArrayModel > bPhasedArrayModel) const override
Compute the received PSD.
double GetFtrFastFading(const FtrParams &params) const
Compute the stochastic power gain due to the fast fading, modeled according to the Fluctuating Two-Ra...
std::map< std::string, std::map< ChannelCondition::LosConditionValue, CarrierFrequencyFtrParamsTuple > > FtrParamsLookupTable
Nested map associating 3GPP scenario and LosCondition to the corresponding tuple of carrier frequenci...
std::tuple< std::vector< double >, std::vector< FtrParams > > CarrierFrequencyFtrParamsTuple
Tuple collecting vectors of carrier frequencies and FTR fading model parameters, encoded as a FtrPara...
Ptr< GammaRandomVariable > m_gammaRv
Random variable used to sample the Nakagami distributed amplitude of the FTR specular components.
Ptr< ChannelConditionModel > m_channelConditionModel
Channel condition model used to retrieve the LOS/NLOS condition of the communicating endpoints.
std::size_t SearchClosestFc(const std::vector< double > &frequencies, double targetFc) const
Get the index of the closest carrier frequency for which the FTR estimated parameters are available.
void SetFrequency(double f)
Sets the center frequency of the model.
Ptr< UniformRandomVariable > m_uniformRv
Random variable used to sample the uniform distributed phases of the FTR specular components.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void SetScenario(const std::string &scenario)
Sets the propagation scenario.
a unique identifier for an interface.
Definition: type-id.h:59
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Struct holding the Fluctuating Two Ray fast-fading model parameters.
FtrParams(double m, double sigma, double k, double delta)
Default constructor, requiring the Fluctuating Two Ray fading model parameters as arguments.
FtrParams()=delete
Delete no-arguments default constructor.