A Discrete-Event Network Simulator
API
two-ray-spectrum-propagation-loss-model.cc
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 
21 
22 #include <ns3/double.h>
23 #include <ns3/log.h>
24 #include <ns3/node.h>
25 #include <ns3/object-factory.h>
26 #include <ns3/pointer.h>
27 #include <ns3/random-variable-stream.h>
28 #include <ns3/string.h>
29 
30 #include <algorithm>
31 
32 namespace ns3
33 {
34 
41  {"InH-OfficeOpen",
42  {{ChannelCondition::LosConditionValue::NLOS,
43  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
44  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
45  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
46  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
47  {TwoRaySpectrumPropagationLossModel::FtrParams(1.2695458989293662e+01,
48  3.081006083786e-03,
49  1.6128465196199136e+02,
50  2.7586206896551727e-05),
52  6.334753732969e-04,
53  7.882966657847448e+02,
54  3.4482758620689657e-05),
56  8.688106642961e-04,
57  5.744993815655636e+02,
58  1.3793103448275863e-05),
60  4.2221674779498e-03,
61  1.1742258806909902e+02,
62  3.4482758620689657e-05),
64  4.2211041740365e-03,
65  1.174524189370726e+02,
66  6.896551724137931e-05),
68  5.7752786216822e-03,
69  8.557590962327636e+01,
70  1.724137931034e-04),
72  5.7927052949143e-03,
73  8.53154561719156e+01,
74  1.36482758620689e-02),
76  1.295909468305e-04,
77  3.8572942113521017e+03,
78  6.9862068965517e-03),
80  2.44090689375e-04,
81  2.047418976079014e+03,
82  6.206896551724138e-05),
84  5.006171052321396e-05,
85  9.98667310933466e+03,
86  1.310344827586e-04),
88  9.428291321439076e-05,
89  5.302187851896829e+03,
90  1.03448275862e-04),
92  2.446180232004e-04,
93  2.0430031092487088e+03,
94  6.8896551724137e-03),
96  1.6399062365392e-03,
97  3.0389548052160666e+02,
98  8.965517241379312e-05),
100  1.296074026206e-04,
101  3.856804337484282e+03,
102  1.172413793103e-04),
103  TwoRaySpectrumPropagationLossModel::FtrParams(6.736930208361434e+00,
104  1.294265037695e-04,
105  3.862196373520788e+03,
106  6.6965517241379e-03),
107  TwoRaySpectrumPropagationLossModel::FtrParams(6.727524738792882e+00,
108  3.354626304689e-04,
109  1.4894789821180611e+03,
110  1.51724137931e-04),
112  1.07946501149867e-02,
113  4.531924098269983e+01,
114  6.206896551724138e-05),
115  TwoRaySpectrumPropagationLossModel::FtrParams(6.736074622586126e+00,
116  2.2451744578083e-03,
117  2.2169984332891184e+02,
118  7.0965517241379e-03),
119  TwoRaySpectrumPropagationLossModel::FtrParams(6.733508517158048e+00,
120  4.2274879823188e-03,
121  1.172735473385635e+02,
122  1.241379310344e-04),
123  TwoRaySpectrumPropagationLossModel::FtrParams(6.729233846942953e+00,
124  3.360165965941e-04,
125  1.487021737818881e+03,
126  6.896551724137932e-06)}}},
127  {ChannelCondition::LosConditionValue::LOS,
128  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
129  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
130  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
131  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
132  {TwoRaySpectrumPropagationLossModel::FtrParams(6.221618627242562e+01,
133  5.7818075439484e-03,
134  8.547814653106583e+01,
135  1.310344827586e-04),
136  TwoRaySpectrumPropagationLossModel::FtrParams(6.222408869140862e+01,
137  5.7868906372814e-03,
138  8.540218579193503e+01,
139  1.931034482758e-04),
140  TwoRaySpectrumPropagationLossModel::FtrParams(1.1712469578065404e+02,
141  7.9044249538951e-03,
142  6.225570840591133e+01,
143  2.e-04),
144  TwoRaySpectrumPropagationLossModel::FtrParams(1.174524189370726e+02,
145  7.9192593798279e-03,
146  6.213721725968569e+01,
147  1.586206896551e-04),
148  TwoRaySpectrumPropagationLossModel::FtrParams(6.212932587331828e+01,
149  4.2317491714902e-03,
150  1.1715445096995552e+02,
151  1.03448275862e-04),
153  7.9252008170168e-03,
154  6.208988397195024e+01,
155  5.517241379310345e-05),
156  TwoRaySpectrumPropagationLossModel::FtrParams(3.295678257898671e+01,
157  1.6409445497067e-03,
158  3.0370255688368803e+02,
159  1.448275862068e-04),
160  TwoRaySpectrumPropagationLossModel::FtrParams(1.1721398402813756e+02,
161  7.9222295504019e-03,
162  6.211354610705902e+01,
163  1.3793103448275863e-05),
164  TwoRaySpectrumPropagationLossModel::FtrParams(2.395445815898452e+01,
165  6.863706760298528e-05,
166  7.283693496699635e+03,
167  2.06896551724138e-05),
168  TwoRaySpectrumPropagationLossModel::FtrParams(6.220038444513843e+01,
169  5.7854378744067e-03,
170  8.542388196956914e+01,
171  1.3793103448275863e-05),
172  TwoRaySpectrumPropagationLossModel::FtrParams(3.293586044359225e+01,
173  2.246026238725e-03,
174  2.2161538684598275e+02,
175  1.724137931034e-04),
176  TwoRaySpectrumPropagationLossModel::FtrParams(4.534227035109218e+01,
177  4.2328151340042e-03,
178  1.1712469578065404e+02,
179  2.7586206896551727e-05),
180  TwoRaySpectrumPropagationLossModel::FtrParams(3.296096860066171e+01,
181  1.1934793291051e-03,
182  4.179431587180458e+02,
183  9.655172413793105e-05),
184  TwoRaySpectrumPropagationLossModel::FtrParams(2.395750074607037e+01,
185  4.990302323746383e-05,
186  1.0018433043580286e+04,
187  1.51724137931e-04),
188  TwoRaySpectrumPropagationLossModel::FtrParams(4.1831489711041263e+02,
189  7.926191482854e-03,
190  6.20819985968797e+01,
191  1.3793103448275863e-05),
192  TwoRaySpectrumPropagationLossModel::FtrParams(3.290659176610291e+01,
193  1.1937818051584e-03,
194  4.1783700843777945e+02,
195  1.448275862068e-04),
196  TwoRaySpectrumPropagationLossModel::FtrParams(4.176778335658431e+02,
197  7.926191482854e-03,
198  6.20819985968797e+01,
199  2.e-04),
200  TwoRaySpectrumPropagationLossModel::FtrParams(3.292331353831016e+01,
201  8.692513904904e-04,
202  5.742075929586678e+02,
203  1.3793103448275863e-05),
205  7.9212393717809e-03,
206  6.212143548915179e+01,
207  6.206896551724138e-05),
209  2.2511436839814e-03,
210  2.211093231666549e+02,
211  1.586206896551e-04)}}}}},
212  {"UMi-StreetCanyon",
213  {{ChannelCondition::LosConditionValue::NLOS,
214  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
215  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
216  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
217  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
218  {TwoRaySpectrumPropagationLossModel::FtrParams(1.2689010957474556e+01,
219  3.36059247219e-04,
220  1.486832887020803e+03,
221  1.724137931034e-04),
222  TwoRaySpectrumPropagationLossModel::FtrParams(1.2734216047612705e+01,
223  8.70685292542e-04,
224  5.732603031000779e+02,
225  7.0551724137931e-03),
226  TwoRaySpectrumPropagationLossModel::FtrParams(1.2690622658336885e+01,
227  3.086065900037e-03,
228  1.6101857516847045e+02,
229  0.e+00),
230  TwoRaySpectrumPropagationLossModel::FtrParams(1.2711593407712735e+01,
231  3.0864554585433e-03,
232  1.6099812591365952e+02,
233  1.931034482758e-04),
235  1.47463951390083e-02,
236  3.290659176610291e+01,
237  1.310344827586e-04),
238  TwoRaySpectrumPropagationLossModel::FtrParams(1.2718052915001302e+01,
239  3.0884039842316e-03,
240  1.6089591858864094e+02,
241  1.51724137931e-04),
242  TwoRaySpectrumPropagationLossModel::FtrParams(1.748207473187881e+01,
243  1.07973332444199e-02,
244  4.530773068511169e+01,
245  6.8068965517241e-03),
246  TwoRaySpectrumPropagationLossModel::FtrParams(9.255795670251574e+00,
247  5.00680684988557e-05,
248  9.985404808314654e+03,
249  6.9586206896551e-03),
250  TwoRaySpectrumPropagationLossModel::FtrParams(9.254620190193195e+00,
251  4.617679219256e-04,
252  1.0817950064503143e+03,
253  2.07655172413793e-02),
254  TwoRaySpectrumPropagationLossModel::FtrParams(1.7488737060551784e+01,
255  1.08201661923657e-02,
256  4.521001111357971e+01,
257  6.206896551724138e-05),
258  TwoRaySpectrumPropagationLossModel::FtrParams(9.264028212239072e+00,
259  2.445869720667e-04,
260  2.0432626022764905e+03,
261  1.655172413793e-04),
262  TwoRaySpectrumPropagationLossModel::FtrParams(9.251094645653469e+00,
263  1.295909468305e-04,
264  3.8572942113521017e+03,
265  1.655172413793e-04),
266  TwoRaySpectrumPropagationLossModel::FtrParams(9.261675310485298e+00,
267  6.868066254013259e-05,
268  7.27906954953051e+03,
269  1.103448275862e-04),
270  TwoRaySpectrumPropagationLossModel::FtrParams(9.242873597168312e+00,
271  2.443697244117e-04,
272  2.0450799765751449e+03,
273  1.241379310344e-04),
274  TwoRaySpectrumPropagationLossModel::FtrParams(9.264028212239072e+00,
275  6.329934316604e-04,
276  7.888976118731497e+02,
277  6.7241379310344e-03),
279  5.0074427281897054e-05,
280  9.984136668368055e+03,
281  1.03448275862e-04),
282  TwoRaySpectrumPropagationLossModel::FtrParams(9.242873597168312e+00,
283  1.7827515329e-04,
284  2.80365331692424e+03,
285  6.206896551724138e-05),
286  TwoRaySpectrumPropagationLossModel::FtrParams(9.242873597168312e+00,
287  2.448665741566e-04,
288  2.040928351071028e+03,
289  1.37862068965517e-02),
291  3.357181936422e-04,
292  1.4883443652113867e+03,
293  2.06896551724138e-05),
294  TwoRaySpectrumPropagationLossModel::FtrParams(9.262851686653192e+00,
295  2.2474465885176e-03,
296  2.21474697532092e+02,
297  1.379310344827e-04)}}},
298  {ChannelCondition::LosConditionValue::LOS,
299  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
300  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
301  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
302  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
303  {TwoRaySpectrumPropagationLossModel::FtrParams(6.212932587331828e+01,
304  3.0821730014407e-03,
305  1.6122321062648754e+02,
306  0.e+00),
307  TwoRaySpectrumPropagationLossModel::FtrParams(3.290659176610291e+01,
308  1.297720754633e-04,
309  3.8519090192542544e+03,
310  7.586206896551724e-05),
311  TwoRaySpectrumPropagationLossModel::FtrParams(3.297771800493267e+01,
312  2.445559248725e-04,
313  2.0435221282639047e+03,
314  6.896551724137931e-05),
315  TwoRaySpectrumPropagationLossModel::FtrParams(3.295259708893377e+01,
316  1.77777895565e-04,
317  2.81149813657053e+03,
318  6.896551724137932e-06),
319  TwoRaySpectrumPropagationLossModel::FtrParams(4.5181310193778565e+01,
320  1.6374169558852e-03,
321  3.043589974153497e+02,
322  1.51724137931e-04),
323  TwoRaySpectrumPropagationLossModel::FtrParams(3.2965155154026256e+01,
324  6.879413898912483e-05,
325  7.267061020126167e+03,
326  6.206896551724138e-05),
328  6.85760811693159e-05,
329  7.290171957835979e+03,
330  6.896551724137932e-06),
331  TwoRaySpectrumPropagationLossModel::FtrParams(3.295259708893377e+01,
332  1.77935963353e-04,
333  2.8089996795357683e+03,
334  8.965517241379312e-05),
335  TwoRaySpectrumPropagationLossModel::FtrParams(4.531348546843247e+01,
336  3.077119528339e-03,
337  1.614896255719667e+02,
338  6.896551724137932e-06),
339  TwoRaySpectrumPropagationLossModel::FtrParams(7.281843565459175e+03,
340  7.9123332420076e-03,
341  6.219248503657932e+01,
342  2.06896551724138e-05),
343  TwoRaySpectrumPropagationLossModel::FtrParams(3.8582741457603433e+03,
344  7.9143115301227e-03,
345  6.217668922899309e+01,
346  1.586206896551e-04),
347  TwoRaySpectrumPropagationLossModel::FtrParams(3.2948412130435365e+01,
348  1.294922559454e-04,
349  3.860234761488555e+03,
350  1.51724137931e-04),
351  TwoRaySpectrumPropagationLossModel::FtrParams(5.748643258446342e+02,
352  7.9143115301227e-03,
353  6.217668922899309e+01,
354  1.241379310344e-04),
355  TwoRaySpectrumPropagationLossModel::FtrParams(3.2965155154026256e+01,
356  1.779585559315e-04,
357  2.8086429383948757e+03,
358  1.586206896551e-04),
359  TwoRaySpectrumPropagationLossModel::FtrParams(6.215300303953259e+01,
360  3.0845081545813e-03,
361  1.6110039816473343e+02,
362  1.862068965517e-04),
364  7.9073896501251e-03,
365  6.223199211412119e+01,
366  7.586206896551724e-05),
367  TwoRaySpectrumPropagationLossModel::FtrParams(3.299866672987281e+01,
368  1.779585559315e-04,
369  2.8086429383948757e+03,
370  4.137931034482759e-05),
371  TwoRaySpectrumPropagationLossModel::FtrParams(3.8553350891312034e+03,
372  7.9054130644305e-03,
373  6.224780197124505e+01,
374  1.241379310344e-04),
375  TwoRaySpectrumPropagationLossModel::FtrParams(3.292749530889876e+01,
376  3.362299038257e-04,
377  1.4860777236373208e+03,
378  6.206896551724138e-05),
380  2.2451744578083e-03,
381  2.2169984332891184e+02,
382  1.448275862068e-04)}}}}},
383  {"InH-OfficeMixed",
384  {{ChannelCondition::LosConditionValue::NLOS,
385  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
386  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
387  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
388  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
389  {TwoRaySpectrumPropagationLossModel::FtrParams(1.2726131915259918e+01,
390  4.2274879823188e-03,
391  1.172735473385635e+02,
392  1.793103448275e-04),
393  TwoRaySpectrumPropagationLossModel::FtrParams(9.251094645653469e+00,
394  1.6390760575064e-03,
395  3.040499076660591e+02,
396  1.931034482758e-04),
397  TwoRaySpectrumPropagationLossModel::FtrParams(9.261675310485298e+00,
398  8.70354182635e-04,
399  5.734787696501294e+02,
400  1.793103448275e-04),
402  4.2211041740365e-03,
403  1.174524189370726e+02,
404  1.793103448275e-04),
405  TwoRaySpectrumPropagationLossModel::FtrParams(9.254620190193195e+00,
406  4.2179158550445e-03,
407  1.1754195701936764e+02,
408  1.586206896551e-04),
409  TwoRaySpectrumPropagationLossModel::FtrParams(9.254620190193195e+00,
410  4.2226992294898e-03,
411  1.1740767547642784e+02,
412  6.7379310344827e-03),
413  TwoRaySpectrumPropagationLossModel::FtrParams(6.731798323316221e+00,
414  9.44506754620425e-05,
415  5.292768388146024e+03,
416  1.03448275862e-04),
417  TwoRaySpectrumPropagationLossModel::FtrParams(9.245221722401345e+00,
418  5.77890490064e-03,
419  8.55215829982986e+01,
420  1.51724137931e-04),
421  TwoRaySpectrumPropagationLossModel::FtrParams(6.7258160647265015e+00,
422  6.329131436638e-04,
423  7.889978140847802e+02,
424  6.8344827586206e-03),
425  TwoRaySpectrumPropagationLossModel::FtrParams(6.724107824633563e+00,
426  8.691411880231e-04,
427  5.74280526213736e+02,
428  6.896551724137931e-05),
429  TwoRaySpectrumPropagationLossModel::FtrParams(6.736930208361434e+00,
430  2.448976607693e-04,
431  2.0406691544916384e+03,
432  1.37310344827586e-02),
433  TwoRaySpectrumPropagationLossModel::FtrParams(6.731798323316221e+00,
434  8.682600702285e-04,
435  5.748643258446342e+02,
436  1.793103448275e-04),
437  TwoRaySpectrumPropagationLossModel::FtrParams(6.737785902809381e+00,
438  1.6407368346666e-03,
439  3.03741131810801e+02,
440  1.724137931034e-04),
441  TwoRaySpectrumPropagationLossModel::FtrParams(6.736930208361434e+00,
442  1.77935963353e-04,
443  2.8089996795357683e+03,
444  1.03448275862e-04),
446  7.910355440443e-03,
447  6.22082848570447e+01,
448  6.7379310344827e-03),
449  TwoRaySpectrumPropagationLossModel::FtrParams(6.723253867292691e+00,
450  4.610068300136e-04,
451  1.0835826296873358e+03,
452  1.172413793103e-04),
453  TwoRaySpectrumPropagationLossModel::FtrParams(6.723253867292691e+00,
454  6.344403562566e-04,
455  7.870961465788879e+02,
456  2.e-04),
457  TwoRaySpectrumPropagationLossModel::FtrParams(6.744635372264776e+00,
458  6.33636101933e-04,
459  7.880964521665514e+02,
460  1.379310344827e-04),
461  TwoRaySpectrumPropagationLossModel::FtrParams(6.728379238600564e+00,
462  4.603053960641e-04,
463  1.0852353652060228e+03,
464  4.827586206896552e-05),
465  TwoRaySpectrumPropagationLossModel::FtrParams(6.740353638327108e+00,
466  2.2468783413341e-03,
467  2.2153096253672345e+02,
468  2.e-04)}}},
469  {ChannelCondition::LosConditionValue::LOS,
470  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
471  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
472  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
473  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
474  {TwoRaySpectrumPropagationLossModel::FtrParams(3.857539171618605e+03,
475  1.08074007896676e-02,
476  4.526459309976018e+01,
477  0.e+00),
478  TwoRaySpectrumPropagationLossModel::FtrParams(3.296096860066171e+01,
479  1.194841073721e-03,
480  4.174656947244478e+02,
481  1.310344827586e-04),
482  TwoRaySpectrumPropagationLossModel::FtrParams(2.2150282824788948e+02,
483  7.9271822705314e-03,
484  6.207411422324672e+01,
485  1.103448275862e-04),
486  TwoRaySpectrumPropagationLossModel::FtrParams(4.520426947143501e+01,
487  4.2317491714902e-03,
488  1.1715445096995552e+02,
489  1.931034482758e-04),
490  TwoRaySpectrumPropagationLossModel::FtrParams(5.749373425149475e+02,
491  7.9281731800636e-03,
492  6.206623085092408e+01,
493  1.793103448275e-04),
494  TwoRaySpectrumPropagationLossModel::FtrParams(6.221618627242562e+01,
495  5.7796304264225e-03,
496  8.551072181262026e+01,
497  7.586206896551724e-05),
498  TwoRaySpectrumPropagationLossModel::FtrParams(1.1719909792804452e+02,
499  7.9014613513626e-03,
500  6.227943373585816e+01,
501  1.448275862068e-04),
502  TwoRaySpectrumPropagationLossModel::FtrParams(3.289405601071394e+01,
503  3.355052108261e-04,
504  1.4892898192515456e+03,
505  8.965517241379312e-05),
506  TwoRaySpectrumPropagationLossModel::FtrParams(3.294004380783209e+01,
507  1.6378315743006e-03,
508  3.042816955330164e+02,
509  2.7586206896551727e-05),
510  TwoRaySpectrumPropagationLossModel::FtrParams(1.1724376190085948e+02,
511  7.9162903049039e-03,
512  6.2160897433266726e+01,
513  0.e+00),
514  TwoRaySpectrumPropagationLossModel::FtrParams(3.2965155154026256e+01,
515  1.1936305575734e-03,
516  4.178900802074444e+02,
517  6.896551724137932e-06),
518  TwoRaySpectrumPropagationLossModel::FtrParams(3.291495159031198e+01,
519  2.247730765756e-03,
520  2.214465703888772e+02,
521  5.517241379310345e-05),
522  TwoRaySpectrumPropagationLossModel::FtrParams(3.045523380497429e+02,
523  7.9133223252391e-03,
524  6.218458663124002e+01,
525  1.862068965517e-04),
526  TwoRaySpectrumPropagationLossModel::FtrParams(2.2150282824788948e+02,
527  7.9133223252391e-03,
528  6.218458663124002e+01,
529  6.896551724137931e-05),
530  TwoRaySpectrumPropagationLossModel::FtrParams(3.2948412130435365e+01,
531  1.6409445497067e-03,
532  3.0370255688368803e+02,
533  2.e-04),
534  TwoRaySpectrumPropagationLossModel::FtrParams(3.040112935246124e+02,
535  7.9153008566728e-03,
536  6.216879282971112e+01,
537  1.793103448275e-04),
538  TwoRaySpectrumPropagationLossModel::FtrParams(4.526171872148543e+01,
539  4.2232310474297e-03,
540  1.1739276477764624e+02,
541  7.586206896551724e-05),
542  TwoRaySpectrumPropagationLossModel::FtrParams(1.6130513761004684e+02,
543  7.9143115301227e-03,
544  6.217668922899309e+01,
545  1.862068965517e-04),
547  7.9242102730054e-03,
548  6.2097770348585485e+01,
549  2.06896551724138e-05),
550  TwoRaySpectrumPropagationLossModel::FtrParams(2.0417061383577973e+03,
551  1.08121021183973e-02,
552  4.524447628451687e+01,
553  2.e-04)}}}}},
554  {"RMa",
555  {{ChannelCondition::LosConditionValue::NLOS,
556  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
557  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
558  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
559  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
560  {TwoRaySpectrumPropagationLossModel::FtrParams(6.736074622586126e+00,
561  3.353349217972e-04,
562  1.4900466148894875e+03,
563  7.0275862068965e-03),
564  TwoRaySpectrumPropagationLossModel::FtrParams(6.745492045387843e+00,
565  6.33073729829e-04,
566  7.887974223871352e+02,
567  6.9862068965517e-03),
569  1.08228555237886e-02,
570  4.5198528558475154e+01,
571  8.275862068965519e-05),
572  TwoRaySpectrumPropagationLossModel::FtrParams(6.724107824633563e+00,
573  6.333146853796e-04,
574  7.884969302666273e+02,
575  4.827586206896552e-05),
576  TwoRaySpectrumPropagationLossModel::FtrParams(6.727524738792882e+00,
577  1.295580415165e-04,
578  3.8582741457603433e+03,
579  1.793103448275e-04),
580  TwoRaySpectrumPropagationLossModel::FtrParams(6.736930208361434e+00,
581  1.297555987707e-04,
582  3.8523982713408623e+03,
583  8.275862068965519e-05),
584  TwoRaySpectrumPropagationLossModel::FtrParams(6.731798323316221e+00,
585  2.448665741566e-04,
586  2.040928351071028e+03,
587  1.37724137931034e-02),
588  TwoRaySpectrumPropagationLossModel::FtrParams(1.2700297163351271e+01,
589  1.47354930616003e-02,
590  3.293167761063697e+01,
591  3.4482758620689657e-05),
592  TwoRaySpectrumPropagationLossModel::FtrParams(6.7258160647265015e+00,
593  1.780941716339e-04,
594  2.80650344277193e+03,
595  1.37310344827586e-02),
596  TwoRaySpectrumPropagationLossModel::FtrParams(9.235832799160756e+00,
597  7.910355440443e-03,
598  6.22082848570447e+01,
599  8.275862068965519e-05),
600  TwoRaySpectrumPropagationLossModel::FtrParams(6.741209767603669e+00,
601  9.430686099733985e-05,
602  5.300841188565312e+03,
603  2.7586206896551727e-05),
604  TwoRaySpectrumPropagationLossModel::FtrParams(6.736930208361434e+00,
605  4.613579473452e-04,
606  1.0827572060417654e+03,
607  2.7586206896551727e-05),
608  TwoRaySpectrumPropagationLossModel::FtrParams(6.735219145469659e+00,
609  3.363579531122e-04,
610  1.4855116028137206e+03,
611  6.8206896551724e-03),
612  TwoRaySpectrumPropagationLossModel::FtrParams(6.741209767603669e+00,
613  8.698026120933e-04,
614  5.738430655969447e+02,
615  2.06896551724138e-05),
616  TwoRaySpectrumPropagationLossModel::FtrParams(6.742066005621902e+00,
617  4.990302323746383e-05,
618  1.0018433043580286e+04,
619  6.896551724137931e-05),
620  TwoRaySpectrumPropagationLossModel::FtrParams(9.241699758204852e+00,
621  5.7934325329886e-03,
622  8.530462116421079e+01,
623  9.655172413793105e-05),
624  TwoRaySpectrumPropagationLossModel::FtrParams(6.741209767603669e+00,
625  3.355052108261e-04,
626  1.4892898192515456e+03,
627  1.379310344827e-04),
628  TwoRaySpectrumPropagationLossModel::FtrParams(1.2700297163351271e+01,
629  1.47282293521982e-02,
630  3.2948412130435365e+01,
631  1.3793103448275863e-05),
633  5.7956147886341e-03,
634  8.527212439663107e+01,
635  6.9448275862068e-03),
636  TwoRaySpectrumPropagationLossModel::FtrParams(6.728379238600564e+00,
637  4.996643770687291e-05,
638  1.0005716967361968e+04,
639  6.896551724137931e-05)}}},
640  {ChannelCondition::LosConditionValue::LOS,
641  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
642  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
643  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
644  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
645  {TwoRaySpectrumPropagationLossModel::FtrParams(2.804365576918811e+03,
646  1.47100852650808e-02,
647  3.29902856434769e+01,
648  2.06896551724138e-05),
649  TwoRaySpectrumPropagationLossModel::FtrParams(2.2153096253672345e+02,
650  1.08134457224711e-02,
651  4.523873026531778e+01,
652  1.103448275862e-04),
653  TwoRaySpectrumPropagationLossModel::FtrParams(1.171693313991936e+02,
654  1.08174775144271e-02,
655  4.522149658579409e+01,
656  8.275862068965519e-05),
657  TwoRaySpectrumPropagationLossModel::FtrParams(2.400013756546019e+01,
658  1.193328119751e-03,
659  4.1799624397043993e+02,
660  6.8620689655172e-03),
661  TwoRaySpectrumPropagationLossModel::FtrParams(1.6144861002079188e+02,
662  1.07973332444199e-02,
663  4.530773068511169e+01,
664  1.793103448275e-04),
665  TwoRaySpectrumPropagationLossModel::FtrParams(2.8125695840352355e+03,
666  1.4702833700715e-02,
667  3.300704994545942e+01,
668  1.448275862068e-04),
669  TwoRaySpectrumPropagationLossModel::FtrParams(4.520426947143501e+01,
670  7.9162903049039e-03,
671  6.2160897433266726e+01,
672  6.8068965517241e-03),
673  TwoRaySpectrumPropagationLossModel::FtrParams(1.0830322773699647e+03,
674  1.47445775831495e-02,
675  3.2910771412767524e+01,
676  9.655172413793105e-05),
677  TwoRaySpectrumPropagationLossModel::FtrParams(4.5296223310938565e+01,
678  7.9014613513626e-03,
679  6.227943373585816e+01,
680  2.7586206896551727e-05),
681  TwoRaySpectrumPropagationLossModel::FtrParams(3.859254329118079e+03,
682  1.47245987995756e-02,
683  3.295678257898671e+01,
684  1.793103448275e-04),
685  TwoRaySpectrumPropagationLossModel::FtrParams(1.1719909792804452e+02,
686  1.0795991598188e-02,
687  4.531348546843247e+01,
688  1.241379310344e-04),
689  TwoRaySpectrumPropagationLossModel::FtrParams(6.2160897433266726e+01,
690  7.9113442804138e-03,
691  6.220038444513843e+01,
692  4.827586206896552e-05),
693  TwoRaySpectrumPropagationLossModel::FtrParams(2.400013756546019e+01,
694  3.0778964494433e-03,
695  1.6144861002079188e+02,
696  1.931034482758e-04),
697  TwoRaySpectrumPropagationLossModel::FtrParams(1.7439938881994646e+01,
698  6.334753732969e-04,
699  7.882966657847448e+02,
700  1.3793103448275863e-05),
702  7.9153008566728e-03,
703  6.216879282971112e+01,
704  7.586206896551724e-05),
705  TwoRaySpectrumPropagationLossModel::FtrParams(3.2965155154026256e+01,
706  5.7781794648689e-03,
707  8.553244556351568e+01,
708  1.3793103448275863e-05),
709  TwoRaySpectrumPropagationLossModel::FtrParams(8.540218579193503e+01,
710  1.07973332444199e-02,
711  4.530773068511169e+01,
712  1.172413793103e-04),
713  TwoRaySpectrumPropagationLossModel::FtrParams(1.7439938881994646e+01,
714  9.44506754620425e-05,
715  5.292768388146024e+03,
716  3.4482758620689657e-05),
718  1.297391241696e-04,
719  3.8528875855700608e+03,
720  5.517241379310345e-05),
721  TwoRaySpectrumPropagationLossModel::FtrParams(8.535880996662047e+01,
722  1.07946501149867e-02,
723  4.531924098269983e+01,
724  1.379310344827e-04)}}}}},
725  {"UMa",
726  {{ChannelCondition::LosConditionValue::NLOS,
727  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
728  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
729  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
730  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
731  {TwoRaySpectrumPropagationLossModel::FtrParams(1.7439938881994646e+01,
732  2.2485835121112e-03,
733  2.2136221039019213e+02,
734  7.e-03),
735  TwoRaySpectrumPropagationLossModel::FtrParams(2.399708956352588e+01,
736  7.909366722081e-03,
737  6.221618627242562e+01,
738  3.4482758620689657e-05),
739  TwoRaySpectrumPropagationLossModel::FtrParams(1.7490958400945924e+01,
740  3.0778964494433e-03,
741  1.6144861002079188e+02,
742  2.e-04),
743  TwoRaySpectrumPropagationLossModel::FtrParams(1.2700297163351271e+01,
744  8.689208249277e-04,
745  5.744264205160073e+02,
746  4.137931034482759e-05),
747  TwoRaySpectrumPropagationLossModel::FtrParams(1.2700297163351271e+01,
748  4.993472040654454e-05,
749  1.00120729866762e+04,
750  1.241379310344e-04),
751  TwoRaySpectrumPropagationLossModel::FtrParams(1.272451570474495e+01,
752  2.447112002444e-04,
753  2.0422248278813e+03,
754  1.51724137931e-04),
755  TwoRaySpectrumPropagationLossModel::FtrParams(1.2716437730514135e+01,
756  2.2511436839814e-03,
757  2.211093231666549e+02,
758  6.903448275862e-03),
759  TwoRaySpectrumPropagationLossModel::FtrParams(1.2701910297736497e+01,
760  4.2253589833499e-03,
761  1.1733314091660613e+02,
762  1.103448275862e-04),
763  TwoRaySpectrumPropagationLossModel::FtrParams(1.2687399461297195e+01,
764  4.2205726216469e-03,
765  1.1746733721285608e+02,
766  7.0965517241379e-03),
767  TwoRaySpectrumPropagationLossModel::FtrParams(9.253444859420023e+00,
768  9.42948863457656e-05,
769  5.301514477472012e+03,
770  1.586206896551e-04),
771  TwoRaySpectrumPropagationLossModel::FtrParams(1.2693846674220437e+01,
772  5.7767288633179e-03,
773  8.555417483326706e+01,
774  6.896551724137932e-06),
775  TwoRaySpectrumPropagationLossModel::FtrParams(1.2722899699487671e+01,
776  5.7883437606822e-03,
777  8.538049512475196e+01,
778  8.965517241379312e-05),
780  1.781620182218e-04,
781  2.805434306201756e+03,
782  1.931034482758e-04),
783  TwoRaySpectrumPropagationLossModel::FtrParams(9.237005892929576e+00,
784  4.994740491021047e-05,
785  1.0009530094583308e+04,
786  1.586206896551e-04),
787  TwoRaySpectrumPropagationLossModel::FtrParams(9.252269677913102e+00,
788  1.29541591992e-04,
789  3.858764206316572e+03,
790  1.931034482758e-04),
791  TwoRaySpectrumPropagationLossModel::FtrParams(9.269913082102622e+00,
792  1.295909468305e-04,
793  3.8572942113521017e+03,
794  6.9310344827586e-03),
796  2.443387047809e-04,
797  2.0453397333972343e+03,
798  6.206896551724138e-05),
799  TwoRaySpectrumPropagationLossModel::FtrParams(9.262851686653192e+00,
800  9.421110633952792e-05,
801  5.306229894934544e+03,
802  1.379310344827e-04),
803  TwoRaySpectrumPropagationLossModel::FtrParams(9.237005892929576e+00,
804  1.298050351238e-04,
805  3.8509307014772426e+03,
806  1.38137931034482e-02),
808  1.297391241696e-04,
809  3.8528875855700608e+03,
810  1.103448275862e-04)}}},
811  {ChannelCondition::LosConditionValue::LOS,
812  {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
813  25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
814  50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
815  75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
816  {TwoRaySpectrumPropagationLossModel::FtrParams(8.553244556351568e+01,
817  3.0845081545813e-03,
818  1.6110039816473343e+02,
819  2.e-04),
820  TwoRaySpectrumPropagationLossModel::FtrParams(8.556504153815182e+01,
821  4.2290854294851e-03,
822  1.1722887201899576e+02,
823  6.896551724137932e-06),
824  TwoRaySpectrumPropagationLossModel::FtrParams(4.531348546843247e+01,
825  1.1945383299169e-03,
826  4.175717506735425e+02,
827  8.965517241379312e-05),
828  TwoRaySpectrumPropagationLossModel::FtrParams(4.534227035109218e+01,
829  1.6382462973584e-03,
830  3.042044132840143e+02,
831  1.03448275862e-04),
832  TwoRaySpectrumPropagationLossModel::FtrParams(1.6142810615183308e+02,
833  5.7847116281393e-03,
834  8.543473212524282e+01,
835  1.448275862068e-04),
836  TwoRaySpectrumPropagationLossModel::FtrParams(1.0824822045768908e+03,
837  7.9271822705314e-03,
838  6.207411422324672e+01,
839  1.03448275862e-04),
840  TwoRaySpectrumPropagationLossModel::FtrParams(5.307577927251286e+03,
841  7.9064012965024e-03,
842  6.223989654069086e+01,
843  6.7655172413793e-03),
844  TwoRaySpectrumPropagationLossModel::FtrParams(3.289823406514352e+01,
845  1.1928746063501e-03,
846  4.1815554018694206e+02,
847  1.793103448275e-04),
848  TwoRaySpectrumPropagationLossModel::FtrParams(5.742075929586678e+02,
849  7.9143115301227e-03,
850  6.217668922899309e+01,
851  6.206896551724138e-05),
852  TwoRaySpectrumPropagationLossModel::FtrParams(6.215300303953259e+01,
853  5.7847116281393e-03,
854  8.543473212524282e+01,
855  6.896551724137931e-05),
856  TwoRaySpectrumPropagationLossModel::FtrParams(3.290659176610291e+01,
857  8.689208249277e-04,
858  5.744264205160073e+02,
859  1.724137931034e-04),
861  7.909366722081e-03,
862  6.221618627242562e+01,
863  4.827586206896552e-05),
864  TwoRaySpectrumPropagationLossModel::FtrParams(6.220038444513843e+01,
865  5.7752786216822e-03,
866  8.557590962327636e+01,
867  4.137931034482759e-05),
868  TwoRaySpectrumPropagationLossModel::FtrParams(4.5181310193778565e+01,
869  4.2216357928014e-03,
870  1.1743750255590038e+02,
871  1.862068965517e-04),
872  TwoRaySpectrumPropagationLossModel::FtrParams(3.299447592055982e+01,
873  2.2485835121112e-03,
874  2.2136221039019213e+02,
875  1.448275862068e-04),
876  TwoRaySpectrumPropagationLossModel::FtrParams(6.206623085092408e+01,
877  5.7803560422275e-03,
878  8.549986200630548e+01,
879  1.931034482758e-04),
880  TwoRaySpectrumPropagationLossModel::FtrParams(1.1713957243052236e+02,
881  7.9153008566728e-03,
882  6.216879282971112e+01,
883  4.827586206896552e-05),
884  TwoRaySpectrumPropagationLossModel::FtrParams(2.4024535522229847e+01,
885  6.325118562159e-04,
886  7.894990160837534e+02,
887  1.448275862068e-04),
888  TwoRaySpectrumPropagationLossModel::FtrParams(2.394229167421632e+01,
889  1.778907867973e-04,
890  2.809713297758256e+03,
891  8.275862068965519e-05),
892  TwoRaySpectrumPropagationLossModel::FtrParams(3.2910771412767524e+01,
893  2.2474465885176e-03,
894  2.21474697532092e+02,
895  7.586206896551724e-05)}}}}},
896 };
897 
898 NS_LOG_COMPONENT_DEFINE("TwoRaySpectrumPropagationLossModel");
899 
900 NS_OBJECT_ENSURE_REGISTERED(TwoRaySpectrumPropagationLossModel);
901 
903 {
904  NS_LOG_FUNCTION(this);
905 
906  // Create the Random Number Generator (RNG) variables only once to speed-up the tests
907  m_uniformRv = CreateObject<UniformRandomVariable>();
909  m_uniformRv->SetAttribute("Max", DoubleValue(2 * M_PI));
910 
911  m_normalRv = CreateObject<NormalRandomVariable>();
912  m_normalRv->SetAttribute("Mean", DoubleValue(0));
913 
914  m_gammaRv = CreateObject<GammaRandomVariable>();
915 }
916 
918 {
919  NS_LOG_FUNCTION(this);
920 
921  m_uniformRv = nullptr;
922  m_normalRv = nullptr;
923  m_gammaRv = nullptr;
924 }
925 
926 void
928 {
929 }
930 
931 TypeId
933 {
934  static TypeId tid =
935  TypeId("ns3::TwoRaySpectrumPropagationLossModel")
937  .SetGroupName("Spectrum")
938  .AddConstructor<TwoRaySpectrumPropagationLossModel>()
939  .AddAttribute(
940  "ChannelConditionModel",
941  "Pointer to the channel condition model.",
942  PointerValue(),
944  MakePointerChecker<ChannelConditionModel>())
945  .AddAttribute(
946  "Scenario",
947  "The 3GPP scenario (RMa, UMa, UMi-StreetCanyon, InH-OfficeOpen, InH-OfficeMixed).",
948  StringValue("RMa"),
951  .AddAttribute("Frequency",
952  "The operating Frequency in Hz",
953  DoubleValue(500.0e6),
955  MakeDoubleChecker<double>());
956  return tid;
957 }
958 
959 void
961 {
962  NS_LOG_FUNCTION(this);
963  if (scenario != "RMa" && scenario != "UMa" && scenario != "UMi-StreetCanyon" &&
964  scenario != "InH-OfficeOpen" && scenario != "InH-OfficeMixed" && scenario != "V2V-Urban" &&
965  scenario != "V2V-Highway")
966  {
967  NS_ABORT_MSG("Unknown scenario (" + scenario +
968  "), choose between: RMa, UMa, UMi-StreetCanyon, "
969  "InH-OfficeOpen, InH-OfficeMixed, V2V-Urban or V2V-Highway");
970  }
971 
973  {
974  NS_ABORT_MSG("The specified scenario has not been calibrated yet.");
975  }
976 
977  m_scenario = scenario;
978 }
979 
980 void
982 {
983  NS_LOG_FUNCTION(this);
984  NS_ASSERT_MSG(f >= 500.0e6 && f <= 100.0e9,
985  "Frequency should be between 0.5 and 100 GHz but is " << f);
986  m_frequency = f;
987 }
988 
991  Ptr<const MobilityModel> b) const
992 {
993  NS_LOG_FUNCTION(this);
994 
996  auto cond = m_channelConditionModel->GetChannelCondition(a, b);
997 
998  return cond->GetLosCondition();
999 }
1000 
1003  Ptr<const MobilityModel> b) const
1004 {
1005  NS_LOG_FUNCTION(this);
1006 
1007  // Retrieve LOS condition
1009 
1010  // Retrieve the corresponding tuple and vectors
1011  NS_ASSERT_MSG(SIM_PARAMS_TO_FTR_PARAMS_TABLE.find(m_scenario)->second.find(cond) !=
1012  SIM_PARAMS_TO_FTR_PARAMS_TABLE.find(m_scenario)->second.end(),
1013  "The specified scenario and channel condition are not supported");
1014  auto scenAndCondTuple = SIM_PARAMS_TO_FTR_PARAMS_TABLE.find(m_scenario)->second.find(cond);
1015 
1016  // Get references to the corresponding vectors
1017  auto& fcVec = std::get<0>(scenAndCondTuple->second);
1018  auto& ftrParamsVec = std::get<1>(scenAndCondTuple->second);
1019 
1020  // Find closest carrier frequency which has been calibrated
1021  auto idxOfClosestFc = SearchClosestFc(fcVec, m_frequency);
1022 
1023  // Retrieve the corresponding FTR parameters
1024  NS_ASSERT(ftrParamsVec.size() >= idxOfClosestFc && idxOfClosestFc >= 0);
1025  FtrParams params = ftrParamsVec[idxOfClosestFc];
1026 
1027  return params;
1028 }
1029 
1030 double
1034  Ptr<const PhasedArrayModel> aPhasedArrayModel,
1035  Ptr<const PhasedArrayModel> bPhasedArrayModel) const
1036 {
1037  NS_LOG_FUNCTION(this);
1038 
1039  // Get the relative angles between tx and rx phased arrays
1040  Angles aAngle(b->GetPosition(), a->GetPosition());
1041  Angles bAngle(a->GetPosition(), b->GetPosition());
1042 
1043  // Compute the beamforming vectors and and array responses
1044  auto aArrayResponse = aPhasedArrayModel->GetSteeringVector(aAngle);
1045  auto aAntennaFields = aPhasedArrayModel->GetElementFieldPattern(aAngle);
1046  auto aBfVector = aPhasedArrayModel->GetBeamformingVector();
1047  auto bArrayResponse = bPhasedArrayModel->GetSteeringVector(bAngle);
1048  auto bAntennaFields = bPhasedArrayModel->GetElementFieldPattern(bAngle);
1049  auto bBfVector = bPhasedArrayModel->GetBeamformingVector();
1050 
1051  std::complex<double> aArrayOverallResponse = 0;
1052  std::complex<double> bArrayOverallResponse = 0;
1053 
1054  // Compute the dot products between the array responses and the beamforming vectors
1055  for (size_t i = 0; i < aPhasedArrayModel->GetNumberOfElements(); i++)
1056  {
1057  aArrayOverallResponse += aArrayResponse[i] * aBfVector[i];
1058  }
1059  for (size_t i = 0; i < bPhasedArrayModel->GetNumberOfElements(); i++)
1060  {
1061  bArrayOverallResponse += bArrayResponse[i] * bBfVector[i];
1062  }
1063 
1064  double gain = norm(aArrayOverallResponse) *
1065  (std::pow(aAntennaFields.first, 2) + std::pow(aAntennaFields.second, 2)) *
1066  norm(bArrayOverallResponse) *
1067  (std::pow(bAntennaFields.first, 2) + std::pow(bAntennaFields.second, 2));
1068 
1069  // Retrieve LOS condition to check if a correction factor needs to be introduced
1071  if (cond == ChannelCondition::NLOS)
1072  {
1073  // The linear penalty factor to be multiplied to the beamforming gain whenever the link is
1074  // in NLOS
1075  constexpr double NLOS_BEAMFORMING_FACTOR = 1.0 / 19;
1076  gain *= NLOS_BEAMFORMING_FACTOR;
1077  }
1078 
1079  return gain;
1080 }
1081 
1082 double
1084 {
1085  NS_LOG_FUNCTION(this);
1086 
1087  // Set the RNG parameters
1088  m_normalRv->SetAttribute("Variance", DoubleValue(params.m_sigma));
1089  m_gammaRv->SetAttribute("Alpha", DoubleValue(params.m_m));
1090  m_gammaRv->SetAttribute("Beta", DoubleValue(1.0 / params.m_m));
1091 
1092  // Compute the specular components amplitudes from the FTR parameters
1093  double cmnSqrtTerm = sqrt(1 - std::pow(params.m_delta, 2));
1094  double v1 = sqrt(params.m_sigma) * sqrt(params.m_k * (1 - cmnSqrtTerm));
1095  double v2 = sqrt(params.m_sigma) * sqrt(params.m_k * (1 + cmnSqrtTerm));
1096  double sqrtGamma = sqrt(m_gammaRv->GetValue());
1097 
1098  // Sample the random phases of the specular components, which are uniformly distributed in [0,
1099  // 2*PI]
1100  double phi1 = m_uniformRv->GetValue();
1101  double phi2 = m_uniformRv->GetValue();
1102 
1103  // Sample the normal-distributed real and imaginary parts of the diffuse components
1104  double x = m_normalRv->GetValue();
1105  double y = m_normalRv->GetValue();
1106 
1107  // Compute the channel response by combining the above terms
1108  std::complex<double> h = sqrtGamma * v1 * std::complex<double>(cos(phi1), sin(phi1)) +
1109  sqrtGamma * v2 * std::complex<double>(cos(phi2), sin(phi2)) +
1110  std::complex<double>(x, y);
1111 
1112  return norm(h);
1113 }
1114 
1120  Ptr<const PhasedArrayModel> aPhasedArrayModel,
1121  Ptr<const PhasedArrayModel> bPhasedArrayModel) const
1122 {
1123  NS_LOG_FUNCTION(this);
1124  uint32_t aId = a->GetObject<Node>()->GetId(); // Id of the node a
1125  uint32_t bId = b->GetObject<Node>()->GetId(); // Id of the node b
1126 
1127  NS_ASSERT_MSG(aId != bId, "The two nodes must be different from one another");
1128  NS_ASSERT_MSG(a->GetDistanceFrom(b) > 0.0,
1129  "The position of a and b devices cannot be the same");
1130 
1131  Ptr<SpectrumValue> rxPsd = Copy<SpectrumValue>(params->psd);
1132 
1133  // Retrieve the antenna of device a
1134  NS_ASSERT_MSG(aPhasedArrayModel, "Antenna not found for node " << aId);
1135  NS_LOG_DEBUG("a node " << a->GetObject<Node>() << " antenna " << aPhasedArrayModel);
1136 
1137  // Retrieve the antenna of the device b
1138  NS_ASSERT_MSG(bPhasedArrayModel, "Antenna not found for device " << bId);
1139  NS_LOG_DEBUG("b node " << bId << " antenna " << bPhasedArrayModel);
1140 
1141  // Retrieve FTR params from table
1142  FtrParams ftrParams = GetFtrParameters(a, b);
1143 
1144  // Compute the FTR fading
1145  double fading = GetFtrFastFading(ftrParams);
1146 
1147  // Compute the beamforming gain
1148  double bfGain = CalcBeamformingGain(a, b, aPhasedArrayModel, bPhasedArrayModel);
1149 
1150  // Apply the above terms to the TX PSD
1151  *rxPsd *= (fading * bfGain);
1152 
1153  return rxPsd;
1154 }
1155 
1156 std::size_t
1158  double targetFc) const
1159 {
1160  auto it = std::min_element(std::begin(frequencies),
1161  std::end(frequencies),
1162  [targetFc](double lhs, double rhs) {
1163  return std::abs(lhs - targetFc) < std::abs(rhs - targetFc);
1164  });
1165  return std::distance(std::begin(frequencies), it);
1166 }
1167 
1168 int64_t
1170 {
1171  NS_LOG_FUNCTION(this << stream);
1172  m_normalRv->SetStream(stream);
1173  m_uniformRv->SetStream(stream + 1);
1174  m_gammaRv->SetStream(stream + 2);
1175  return 3;
1176 }
1177 
1178 } // namespace ns3
double f(double x, void *params)
Definition: 80211b.c:71
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
LosConditionValue
Possible values for Line-of-Sight condition.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
A network Node.
Definition: node.h:56
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:200
spectrum-aware propagation loss model that is compatible with PhasedArrayModel type of ns-3 antenna
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Hold variables of type string.
Definition: string.h:56
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...
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:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
#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
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: double.h:43
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:231
Ptr< const AttributeChecker > MakeStringChecker()
Definition: string.cc:30
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: string.h:57
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
const double norm
Normalization to obtain randoms on [0,1).
Definition: rng-stream.cc:66
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const TwoRaySpectrumPropagationLossModel::FtrParamsLookupTable SIM_PARAMS_TO_FTR_PARAMS_TABLE
Lookup table associating the simulation parameters to the corresponding fitted FTR parameters.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Struct holding the Fluctuating Two Ray fast-fading model parameters.