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
24
25#include "ns3/channel-condition-model.h"
26
27#include <map>
28
32
33namespace ns3
34{
35
36class NetDevice;
37
58{
59 // Test classes needs access to CalcBeamformingGain and GetFtrFastFading
60 friend class ::FtrFadingModelAverageTest;
61 friend class ::ArrayResponseTest;
62 friend class ::OverallGainAverageTest;
63
64 public:
68 struct FtrParams
69 {
83 FtrParams(double m, double sigma, double k, double delta)
84 {
85 // Make sure the parameter values belong to the proper domains
86 NS_ASSERT(delta >= 0.0 && delta <= 1.0);
87
88 m_m = m;
89 m_sigma = sigma;
90 m_k = k;
91 m_delta = delta;
92 }
93
97 FtrParams() = delete;
98
102 double m_m = 0;
103
107 double m_sigma = 0;
108
112 double m_k = 0;
113
118 double m_delta = 0;
119 };
120
125 using CarrierFrequencyFtrParamsTuple = std::tuple<std::vector<double>, std::vector<FtrParams>>;
126
132 std::map<std::string,
133 std::map<ChannelCondition::LosConditionValue, CarrierFrequencyFtrParamsTuple>>;
134
139
144
145 void DoDispose() override;
146
151 static TypeId GetTypeId();
152
157 void SetScenario(const std::string& scenario);
158
163 void SetFrequency(double f);
164
186 Ptr<const PhasedArrayModel> aPhasedArrayModel,
187 Ptr<const PhasedArrayModel> bPhasedArrayModel) const override;
188
189 protected:
190 int64_t DoAssignStreams(int64_t stream) override;
191
192 private:
202
233
256 double GetFtrFastFading(const FtrParams& params) const;
257
282 Ptr<const PhasedArrayModel> aPhasedArrayModel,
283 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
284
294 std::size_t SearchClosestFc(const std::vector<double>& frequencies, double targetFc) const;
295
300
305
311
317
318 std::string m_scenario;
319
325};
326
327} // namespace ns3
328
329#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:77
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< SpectrumSignalParameters > 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...
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
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.
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.