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
38/**
39 * \ingroup spectrum
40 * \brief Two Ray Spectrum Propagation Loss Model
41 *
42 * This class implements a performance-oriented channel and beamforming models alternative to the
43 * ThreeGppSpectrumPropagationLossModel and ThreeGppChannelModel. The main method is
44 * DoCalcRxPowerSpectralDensity, which takes as input the power spectral density (PSD) of the
45 * transmitted signal, the mobility models of the transmitting node and receiving node, and returns
46 * the PSD of the received signal.
47 *
48 * The fading model is calibrated with the ThreeGppChannelModel, aiming to provide an end-to-end
49 * channel gain which matches as much as possible the TR 38.901-based channel model. Therefore, this
50 * model is to be used for large-scale simulations of MIMO wireless networks, for which the
51 * ThreeGppChannelModel would prove too computationally intensive. The target applicability of this
52 * model, in terms of frequency range, is 0.5-100 GHz.
53 *
54 * \see PhasedArrayModel
55 * \see ChannelCondition
56 */
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:
65 /**
66 * Struct holding the Fluctuating Two Ray fast-fading model parameters
67 */
68 struct FtrParams
69 {
70 /**
71 * Default constructor, requiring the Fluctuating Two Ray fading model parameters as
72 * arguments.
73 *
74 * \param m the m parameter of the FTR fading model, which represents the "Alpha" and "Beta"
75 * parameters of the Gamma-distributed random variable used to sample the power of the
76 * reflected components \param sigma the sigma parameter of the FTR fading model, which
77 * expresses the power of the diffuse real and imaginary components \param k the k parameter
78 * of the FTR fading model, which represents the ratio of the average power of the dominant
79 * components to the power of the remaining diffuse multipath \param delta the delta
80 * parameter of the FTR fading model, which express expressing how similar to each other are
81 * the average received powers of the specular components
82 */
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
94 /**
95 * Delete no-arguments default constructor.
96 */
97 FtrParams() = delete;
98
99 /**
100 * Parameter m for the Gamma variable. Used both as the shape and rate parameters.
101 */
102 double m_m = 0;
103
104 /**
105 * Parameter sigma. Used as the variance of the amplitudes of the normal diffuse components.
106 */
107 double m_sigma = 0;
108
109 /**
110 * Parameter K. Expresses ratio between dominant specular components and diffuse components.
111 */
112 double m_k = 0;
113
114 /**
115 * Parameter delta [0, 1]. Expresses how similar the amplitudes of the two dominant specular
116 * components are.
117 */
118 double m_delta = 0;
119 };
120
121 /**
122 * Tuple collecting vectors of carrier frequencies and FTR fading model parameters, encoded as a
123 * FtrParams struct
124 */
125 using CarrierFrequencyFtrParamsTuple = std::tuple<std::vector<double>, std::vector<FtrParams>>;
126
127 /**
128 * Nested map associating 3GPP scenario and LosCondition to the corresponding tuple of carrier
129 * frequencies and corresponding fitted FTR parameters
130 */
132 std::map<std::string,
133 std::map<ChannelCondition::LosConditionValue, CarrierFrequencyFtrParamsTuple>>;
134
135 /**
136 * Constructor
137 */
139
140 /**
141 * Destructor
142 */
144
145 void DoDispose() override;
146
147 /**
148 * Get the type ID.
149 * \return the object TypeId
150 */
151 static TypeId GetTypeId();
152
153 /**
154 * Sets the propagation scenario
155 * \param scenario the propagation scenario
156 */
157 void SetScenario(const std::string& scenario);
158
159 /**
160 * Sets the center frequency of the model
161 * \param f the center frequency in Hz
162 */
163 void SetFrequency(double f);
164
165 /**
166 * \brief Compute the received PSD.
167 *
168 * This function computes the received PSD by applying the Fluctuating Two-Ray (FTR)
169 * fast fading model and the beamforming gain.
170 * In particular, the beamforming gain is computed as the combination of the single-element
171 * and the array gains.
172 * The path loss and shadowing are to be computed separately, using the
173 * ThreeGppPropagationLossModel class.
174 *
175 * \param txPsd the PSD of the transmitted signal
176 * \param a first node mobility model
177 * \param b second node mobility model
178 * \param aPhasedArrayModel the antenna array of the first node
179 * \param bPhasedArrayModel the antenna array of the second node
180 * \return SpectrumSignalParameters including the PSD of the received signal
181 */
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:
193 /**
194 * Retrieves the LOS condition associated to the specified mobility models
195 *
196 * \param a the mobility model of the first node
197 * \param b the mobility model of the second node
198 * \return the LOS condition of the link between a and b
199 */
202
203 /**
204 * Retrieves the FTR fading model parameters related to the carrier frequency and LOS condition.
205 *
206 * The calibration has been undertaken using the 3GPP 38.901 as a reference. The latter's
207 * small-scale fading distributions depend on the scenario (UMa, UMi, RMa, InH), the LOS
208 * condition (LOS/NLOS) and the carrier frequency. Therefore, the output of the calibration is a
209 * map associating such simulation parameters to the specific FTR parameters. Specifically, such
210 * parameters represent the FTR distribution yielding channel realizations which exhibit the
211 * closest statistics to the small-scale fading obtained when using the 3GPP 38.901 model. The
212 * estimation relies on reference curves obtained by collecting multiple 38.901 channel
213 * realizations and computing the corresponding end-to-end channel gain by setting the speed of
214 * the TX and RX pair to 0, disabling the shadowing and fixing the LOS condition. In such a way,
215 * any variation of the received power around the mean is given by the small-scale fading only.
216 * Finally, the reference ECDF of the channel gains is compared to the ECDF obtained from the
217 * FTR distribution using different values of the parameters. The parameters which provide the
218 * best fit (in a goodness-of-fit sense) are kept for the specific scenario, LOS condition and
219 * carrier frequency. The goodness of the fit is measured using the well-known Anderson-Darling
220 * metric.
221 *
222 * For additional details, please refer to
223 * src/spectrum/examples/three-gpp-two-ray-channel-calibration.cc and
224 * src/spectrum/utils/two-ray-to-three-gpp-ch-calibration.py, which show how to obtain the
225 * reference curves and then estimate the FTR parameters based on the reference data,
226 * respectively.
227 *
228 * \param a first node mobility model
229 * \param b second node mobility model
230 * \return the corresponding FTR model parameters
231 */
233
234 /**
235 * Compute the stochastic power gain due to the fast fading, modeled according to the
236 * Fluctuating Two-Ray Model.
237 *
238 * Specifically, the amplitude of the random fading term is sampled as:
239 *
240 * TODO: Currently the equations are not rendered, but neither are other formulas. Fixed in the
241 * mainline, so this should also render properly after a rebase will be done
242 *
243 * \f$ V_r = \sqrt{\zeta} V_1 \exp(j \phi_1) + \sqrt{\zeta} V_2 \exp(j \phi_2) + X + jY \f$,
244 * where \f$ \zeta \f$ is a unit-mean Gamma distributed random variable of shape and rate \f$ m
245 * \f$, \f$ X \f$ and \f$ Y \f$ are zero-mean Gaussian random variables of variance \f$ \sigma^2
246 * \f$, \f$ \phi_n \f$ is a uniform random variable over \f$ \left[ 0, 2\pi \right] \f$, \f$ V_1
247 * \f$ and \f$ V_2 \f$ are the constant amplitudes of the reflected components.
248 *
249 * See J. M. Romero-Jerez, F. J. Lopez-Martinez, J. F. Paris and A. Goldsmith, "The Fluctuating
250 * Two-Ray Fading Model for mmWave Communications," 2016 IEEE Globecom Workshops (GC Wkshps) for
251 * further details on such model.
252 *
253 * \param params the FTR fading model parameters
254 * \return the stochastic power gain due to the fast fading
255 */
256 double GetFtrFastFading(const FtrParams& params) const;
257
258 /**
259 * Compute the beamforming gain by combining single-element and array gains.
260 *
261 * Computes the overall beamforming and array gain, assuming analog beamforming
262 * both at the transmitter and at the receiver and arbitrary single-element
263 * radiation patterns. The computation is performed following Rebato, Mattia, et al.
264 * "Study of realistic antenna patterns in 5G mmwave cellular scenarios.",
265 * 2018 IEEE International Conference on Communications (ICC). IEEE, 2018.
266 *
267 * Additionally, whenever the link is in NLOS a penalty factor is introduced, to take into
268 * account for the possible misalignment of the beamforming vectors due to the lack of a
269 * dominant multipath component. See Kulkarni, Mandar N., Eugene Visotsky, and Jeffrey G.
270 * Andrews. "Correction factor for analysis of MIMO wireless networks with highly directional
271 * beamforming." IEEE Wireless Communications Letters 7.5 (2018) for further details on this
272 * approach.
273 *
274 * \param a first node mobility model
275 * \param b second node mobility model
276 * \param aPhasedArrayModel the antenna array of the first node
277 * \param bPhasedArrayModel the antenna array of the second node
278 * \return the beamforming gain
279 */
282 Ptr<const PhasedArrayModel> aPhasedArrayModel,
283 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
284
285 /**
286 * Get the index of the closest carrier frequency for which the FTR estimated parameters are
287 * available.
288 *
289 * \param frequencies the vector of carrier frequencies which have been calibrated
290 * \param targetFc the carrier frequency of the current simulation
291 * \return the index of frequencies representing the argmin over frequencies of
292 * abs(frequencies[index] - targetFc)
293 */
294 std::size_t SearchClosestFc(const std::vector<double>& frequencies, double targetFc) const;
295
296 /**
297 * The operating frequency
298 */
300
301 /**
302 * Random variable used to sample the uniform distributed phases of the FTR specular components.
303 */
305
306 /**
307 * Random variable used to sample the normal distributed amplitudes of the FTR diffuse
308 * components.
309 */
311
312 /**
313 * Random variable used to sample the Nakagami distributed amplitude of the FTR specular
314 * components.
315 */
317
318 std::string m_scenario; //!< the 3GPP scenario
319
320 /**
321 * Channel condition model used to retrieve the LOS/NLOS condition of the communicating
322 * endpoints
323 */
325};
326
327} // namespace ns3
328
329#endif /* TWO_RAY_SPECTRUM_PROPAGATION_LOSS_H */
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.