A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
10
11#include <ns3/double.h>
12#include <ns3/log.h>
13#include <ns3/node.h>
14#include <ns3/object-factory.h>
15#include <ns3/pointer.h>
16#include <ns3/random-variable-stream.h>
17#include <ns3/string.h>
18
19#include <algorithm>
20
21namespace ns3
22{
23
24/**
25 * Lookup table associating the simulation parameters to the corresponding fitted FTR parameters.
26 * The table is implemented as a nested map.
27 */
30 {"InH-OfficeOpen",
32 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
33 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
34 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
35 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
37 3.081006083786e-03,
38 1.6128465196199136e+02,
39 2.7586206896551727e-05),
41 6.334753732969e-04,
42 7.882966657847448e+02,
43 3.4482758620689657e-05),
45 8.688106642961e-04,
46 5.744993815655636e+02,
47 1.3793103448275863e-05),
49 4.2221674779498e-03,
50 1.1742258806909902e+02,
51 3.4482758620689657e-05),
53 4.2211041740365e-03,
54 1.174524189370726e+02,
55 6.896551724137931e-05),
57 5.7752786216822e-03,
58 8.557590962327636e+01,
59 1.724137931034e-04),
61 5.7927052949143e-03,
62 8.53154561719156e+01,
63 1.36482758620689e-02),
65 1.295909468305e-04,
66 3.8572942113521017e+03,
67 6.9862068965517e-03),
69 2.44090689375e-04,
70 2.047418976079014e+03,
71 6.206896551724138e-05),
73 5.006171052321396e-05,
74 9.98667310933466e+03,
75 1.310344827586e-04),
77 9.428291321439076e-05,
78 5.302187851896829e+03,
79 1.03448275862e-04),
81 2.446180232004e-04,
82 2.0430031092487088e+03,
83 6.8896551724137e-03),
85 1.6399062365392e-03,
86 3.0389548052160666e+02,
87 8.965517241379312e-05),
89 1.296074026206e-04,
90 3.856804337484282e+03,
91 1.172413793103e-04),
93 1.294265037695e-04,
94 3.862196373520788e+03,
95 6.6965517241379e-03),
97 3.354626304689e-04,
98 1.4894789821180611e+03,
99 1.51724137931e-04),
101 1.07946501149867e-02,
102 4.531924098269983e+01,
103 6.206896551724138e-05),
105 2.2451744578083e-03,
106 2.2169984332891184e+02,
107 7.0965517241379e-03),
109 4.2274879823188e-03,
110 1.172735473385635e+02,
111 1.241379310344e-04),
113 3.360165965941e-04,
114 1.487021737818881e+03,
115 6.896551724137932e-06)}}},
117 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
118 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
119 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
120 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
122 5.7818075439484e-03,
123 8.547814653106583e+01,
124 1.310344827586e-04),
126 5.7868906372814e-03,
127 8.540218579193503e+01,
128 1.931034482758e-04),
130 7.9044249538951e-03,
131 6.225570840591133e+01,
132 2.e-04),
134 7.9192593798279e-03,
135 6.213721725968569e+01,
136 1.586206896551e-04),
138 4.2317491714902e-03,
139 1.1715445096995552e+02,
140 1.03448275862e-04),
142 7.9252008170168e-03,
143 6.208988397195024e+01,
144 5.517241379310345e-05),
146 1.6409445497067e-03,
147 3.0370255688368803e+02,
148 1.448275862068e-04),
150 7.9222295504019e-03,
151 6.211354610705902e+01,
152 1.3793103448275863e-05),
154 6.863706760298528e-05,
155 7.283693496699635e+03,
156 2.06896551724138e-05),
158 5.7854378744067e-03,
159 8.542388196956914e+01,
160 1.3793103448275863e-05),
162 2.246026238725e-03,
163 2.2161538684598275e+02,
164 1.724137931034e-04),
166 4.2328151340042e-03,
167 1.1712469578065404e+02,
168 2.7586206896551727e-05),
170 1.1934793291051e-03,
171 4.179431587180458e+02,
172 9.655172413793105e-05),
174 4.990302323746383e-05,
175 1.0018433043580286e+04,
176 1.51724137931e-04),
178 7.926191482854e-03,
179 6.20819985968797e+01,
180 1.3793103448275863e-05),
182 1.1937818051584e-03,
183 4.1783700843777945e+02,
184 1.448275862068e-04),
186 7.926191482854e-03,
187 6.20819985968797e+01,
188 2.e-04),
190 8.692513904904e-04,
191 5.742075929586678e+02,
192 1.3793103448275863e-05),
194 7.9212393717809e-03,
195 6.212143548915179e+01,
196 6.206896551724138e-05),
198 2.2511436839814e-03,
199 2.211093231666549e+02,
200 1.586206896551e-04)}}}}},
201 {"UMi-StreetCanyon",
203 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
204 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
205 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
206 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
207 {TwoRaySpectrumPropagationLossModel::FtrParams(1.2689010957474556e+01,
208 3.36059247219e-04,
209 1.486832887020803e+03,
210 1.724137931034e-04),
212 8.70685292542e-04,
213 5.732603031000779e+02,
214 7.0551724137931e-03),
216 3.086065900037e-03,
217 1.6101857516847045e+02,
218 0.e+00),
220 3.0864554585433e-03,
221 1.6099812591365952e+02,
222 1.931034482758e-04),
224 1.47463951390083e-02,
225 3.290659176610291e+01,
226 1.310344827586e-04),
228 3.0884039842316e-03,
229 1.6089591858864094e+02,
230 1.51724137931e-04),
232 1.07973332444199e-02,
233 4.530773068511169e+01,
234 6.8068965517241e-03),
236 5.00680684988557e-05,
237 9.985404808314654e+03,
238 6.9586206896551e-03),
240 4.617679219256e-04,
241 1.0817950064503143e+03,
242 2.07655172413793e-02),
244 1.08201661923657e-02,
245 4.521001111357971e+01,
246 6.206896551724138e-05),
248 2.445869720667e-04,
249 2.0432626022764905e+03,
250 1.655172413793e-04),
252 1.295909468305e-04,
253 3.8572942113521017e+03,
254 1.655172413793e-04),
256 6.868066254013259e-05,
257 7.27906954953051e+03,
258 1.103448275862e-04),
260 2.443697244117e-04,
261 2.0450799765751449e+03,
262 1.241379310344e-04),
264 6.329934316604e-04,
265 7.888976118731497e+02,
266 6.7241379310344e-03),
268 5.0074427281897054e-05,
269 9.984136668368055e+03,
270 1.03448275862e-04),
272 1.7827515329e-04,
273 2.80365331692424e+03,
274 6.206896551724138e-05),
276 2.448665741566e-04,
277 2.040928351071028e+03,
278 1.37862068965517e-02),
280 3.357181936422e-04,
281 1.4883443652113867e+03,
282 2.06896551724138e-05),
284 2.2474465885176e-03,
285 2.21474697532092e+02,
286 1.379310344827e-04)}}},
288 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
289 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
290 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
291 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
293 3.0821730014407e-03,
294 1.6122321062648754e+02,
295 0.e+00),
297 1.297720754633e-04,
298 3.8519090192542544e+03,
299 7.586206896551724e-05),
301 2.445559248725e-04,
302 2.0435221282639047e+03,
303 6.896551724137931e-05),
305 1.77777895565e-04,
306 2.81149813657053e+03,
307 6.896551724137932e-06),
309 1.6374169558852e-03,
310 3.043589974153497e+02,
311 1.51724137931e-04),
313 6.879413898912483e-05,
314 7.267061020126167e+03,
315 6.206896551724138e-05),
317 6.85760811693159e-05,
318 7.290171957835979e+03,
319 6.896551724137932e-06),
321 1.77935963353e-04,
322 2.8089996795357683e+03,
323 8.965517241379312e-05),
325 3.077119528339e-03,
326 1.614896255719667e+02,
327 6.896551724137932e-06),
329 7.9123332420076e-03,
330 6.219248503657932e+01,
331 2.06896551724138e-05),
333 7.9143115301227e-03,
334 6.217668922899309e+01,
335 1.586206896551e-04),
337 1.294922559454e-04,
338 3.860234761488555e+03,
339 1.51724137931e-04),
341 7.9143115301227e-03,
342 6.217668922899309e+01,
343 1.241379310344e-04),
345 1.779585559315e-04,
346 2.8086429383948757e+03,
347 1.586206896551e-04),
349 3.0845081545813e-03,
350 1.6110039816473343e+02,
351 1.862068965517e-04),
353 7.9073896501251e-03,
354 6.223199211412119e+01,
355 7.586206896551724e-05),
357 1.779585559315e-04,
358 2.8086429383948757e+03,
359 4.137931034482759e-05),
361 7.9054130644305e-03,
362 6.224780197124505e+01,
363 1.241379310344e-04),
365 3.362299038257e-04,
366 1.4860777236373208e+03,
367 6.206896551724138e-05),
369 2.2451744578083e-03,
370 2.2169984332891184e+02,
371 1.448275862068e-04)}}}}},
372 {"InH-OfficeMixed",
374 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
375 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
376 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
377 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
378 {TwoRaySpectrumPropagationLossModel::FtrParams(1.2726131915259918e+01,
379 4.2274879823188e-03,
380 1.172735473385635e+02,
381 1.793103448275e-04),
383 1.6390760575064e-03,
384 3.040499076660591e+02,
385 1.931034482758e-04),
387 8.70354182635e-04,
388 5.734787696501294e+02,
389 1.793103448275e-04),
391 4.2211041740365e-03,
392 1.174524189370726e+02,
393 1.793103448275e-04),
395 4.2179158550445e-03,
396 1.1754195701936764e+02,
397 1.586206896551e-04),
399 4.2226992294898e-03,
400 1.1740767547642784e+02,
401 6.7379310344827e-03),
403 9.44506754620425e-05,
404 5.292768388146024e+03,
405 1.03448275862e-04),
407 5.77890490064e-03,
408 8.55215829982986e+01,
409 1.51724137931e-04),
411 6.329131436638e-04,
412 7.889978140847802e+02,
413 6.8344827586206e-03),
415 8.691411880231e-04,
416 5.74280526213736e+02,
417 6.896551724137931e-05),
419 2.448976607693e-04,
420 2.0406691544916384e+03,
421 1.37310344827586e-02),
423 8.682600702285e-04,
424 5.748643258446342e+02,
425 1.793103448275e-04),
427 1.6407368346666e-03,
428 3.03741131810801e+02,
429 1.724137931034e-04),
431 1.77935963353e-04,
432 2.8089996795357683e+03,
433 1.03448275862e-04),
435 7.910355440443e-03,
436 6.22082848570447e+01,
437 6.7379310344827e-03),
439 4.610068300136e-04,
440 1.0835826296873358e+03,
441 1.172413793103e-04),
443 6.344403562566e-04,
444 7.870961465788879e+02,
445 2.e-04),
447 6.33636101933e-04,
448 7.880964521665514e+02,
449 1.379310344827e-04),
451 4.603053960641e-04,
452 1.0852353652060228e+03,
453 4.827586206896552e-05),
455 2.2468783413341e-03,
456 2.2153096253672345e+02,
457 2.e-04)}}},
459 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
460 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
461 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
462 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
464 1.08074007896676e-02,
465 4.526459309976018e+01,
466 0.e+00),
468 1.194841073721e-03,
469 4.174656947244478e+02,
470 1.310344827586e-04),
472 7.9271822705314e-03,
473 6.207411422324672e+01,
474 1.103448275862e-04),
476 4.2317491714902e-03,
477 1.1715445096995552e+02,
478 1.931034482758e-04),
480 7.9281731800636e-03,
481 6.206623085092408e+01,
482 1.793103448275e-04),
484 5.7796304264225e-03,
485 8.551072181262026e+01,
486 7.586206896551724e-05),
488 7.9014613513626e-03,
489 6.227943373585816e+01,
490 1.448275862068e-04),
492 3.355052108261e-04,
493 1.4892898192515456e+03,
494 8.965517241379312e-05),
496 1.6378315743006e-03,
497 3.042816955330164e+02,
498 2.7586206896551727e-05),
500 7.9162903049039e-03,
501 6.2160897433266726e+01,
502 0.e+00),
504 1.1936305575734e-03,
505 4.178900802074444e+02,
506 6.896551724137932e-06),
508 2.247730765756e-03,
509 2.214465703888772e+02,
510 5.517241379310345e-05),
512 7.9133223252391e-03,
513 6.218458663124002e+01,
514 1.862068965517e-04),
516 7.9133223252391e-03,
517 6.218458663124002e+01,
518 6.896551724137931e-05),
520 1.6409445497067e-03,
521 3.0370255688368803e+02,
522 2.e-04),
524 7.9153008566728e-03,
525 6.216879282971112e+01,
526 1.793103448275e-04),
528 4.2232310474297e-03,
529 1.1739276477764624e+02,
530 7.586206896551724e-05),
532 7.9143115301227e-03,
533 6.217668922899309e+01,
534 1.862068965517e-04),
536 7.9242102730054e-03,
537 6.2097770348585485e+01,
538 2.06896551724138e-05),
540 1.08121021183973e-02,
541 4.524447628451687e+01,
542 2.e-04)}}}}},
543 {"RMa",
545 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
546 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
547 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
548 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
550 3.353349217972e-04,
551 1.4900466148894875e+03,
552 7.0275862068965e-03),
554 6.33073729829e-04,
555 7.887974223871352e+02,
556 6.9862068965517e-03),
558 1.08228555237886e-02,
559 4.5198528558475154e+01,
560 8.275862068965519e-05),
562 6.333146853796e-04,
563 7.884969302666273e+02,
564 4.827586206896552e-05),
566 1.295580415165e-04,
567 3.8582741457603433e+03,
568 1.793103448275e-04),
570 1.297555987707e-04,
571 3.8523982713408623e+03,
572 8.275862068965519e-05),
574 2.448665741566e-04,
575 2.040928351071028e+03,
576 1.37724137931034e-02),
578 1.47354930616003e-02,
579 3.293167761063697e+01,
580 3.4482758620689657e-05),
582 1.780941716339e-04,
583 2.80650344277193e+03,
584 1.37310344827586e-02),
586 7.910355440443e-03,
587 6.22082848570447e+01,
588 8.275862068965519e-05),
590 9.430686099733985e-05,
591 5.300841188565312e+03,
592 2.7586206896551727e-05),
594 4.613579473452e-04,
595 1.0827572060417654e+03,
596 2.7586206896551727e-05),
598 3.363579531122e-04,
599 1.4855116028137206e+03,
600 6.8206896551724e-03),
602 8.698026120933e-04,
603 5.738430655969447e+02,
604 2.06896551724138e-05),
606 4.990302323746383e-05,
607 1.0018433043580286e+04,
608 6.896551724137931e-05),
610 5.7934325329886e-03,
611 8.530462116421079e+01,
612 9.655172413793105e-05),
614 3.355052108261e-04,
615 1.4892898192515456e+03,
616 1.379310344827e-04),
618 1.47282293521982e-02,
619 3.2948412130435365e+01,
620 1.3793103448275863e-05),
622 5.7956147886341e-03,
623 8.527212439663107e+01,
624 6.9448275862068e-03),
626 4.996643770687291e-05,
627 1.0005716967361968e+04,
628 6.896551724137931e-05)}}},
630 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
631 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
632 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
633 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
635 1.47100852650808e-02,
636 3.29902856434769e+01,
637 2.06896551724138e-05),
639 1.08134457224711e-02,
640 4.523873026531778e+01,
641 1.103448275862e-04),
643 1.08174775144271e-02,
644 4.522149658579409e+01,
645 8.275862068965519e-05),
647 1.193328119751e-03,
648 4.1799624397043993e+02,
649 6.8620689655172e-03),
651 1.07973332444199e-02,
652 4.530773068511169e+01,
653 1.793103448275e-04),
655 1.4702833700715e-02,
656 3.300704994545942e+01,
657 1.448275862068e-04),
659 7.9162903049039e-03,
660 6.2160897433266726e+01,
661 6.8068965517241e-03),
663 1.47445775831495e-02,
664 3.2910771412767524e+01,
665 9.655172413793105e-05),
667 7.9014613513626e-03,
668 6.227943373585816e+01,
669 2.7586206896551727e-05),
671 1.47245987995756e-02,
672 3.295678257898671e+01,
673 1.793103448275e-04),
675 1.0795991598188e-02,
676 4.531348546843247e+01,
677 1.241379310344e-04),
679 7.9113442804138e-03,
680 6.220038444513843e+01,
681 4.827586206896552e-05),
683 3.0778964494433e-03,
684 1.6144861002079188e+02,
685 1.931034482758e-04),
687 6.334753732969e-04,
688 7.882966657847448e+02,
689 1.3793103448275863e-05),
691 7.9153008566728e-03,
692 6.216879282971112e+01,
693 7.586206896551724e-05),
695 5.7781794648689e-03,
696 8.553244556351568e+01,
697 1.3793103448275863e-05),
699 1.07973332444199e-02,
700 4.530773068511169e+01,
701 1.172413793103e-04),
703 9.44506754620425e-05,
704 5.292768388146024e+03,
705 3.4482758620689657e-05),
707 1.297391241696e-04,
708 3.8528875855700608e+03,
709 5.517241379310345e-05),
711 1.07946501149867e-02,
712 4.531924098269983e+01,
713 1.379310344827e-04)}}}}},
714 {"UMa",
716 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
717 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
718 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
719 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
720 {TwoRaySpectrumPropagationLossModel::FtrParams(1.7439938881994646e+01,
721 2.2485835121112e-03,
722 2.2136221039019213e+02,
723 7.e-03),
725 7.909366722081e-03,
726 6.221618627242562e+01,
727 3.4482758620689657e-05),
729 3.0778964494433e-03,
730 1.6144861002079188e+02,
731 2.e-04),
733 8.689208249277e-04,
734 5.744264205160073e+02,
735 4.137931034482759e-05),
737 4.993472040654454e-05,
738 1.00120729866762e+04,
739 1.241379310344e-04),
741 2.447112002444e-04,
742 2.0422248278813e+03,
743 1.51724137931e-04),
745 2.2511436839814e-03,
746 2.211093231666549e+02,
747 6.903448275862e-03),
749 4.2253589833499e-03,
750 1.1733314091660613e+02,
751 1.103448275862e-04),
753 4.2205726216469e-03,
754 1.1746733721285608e+02,
755 7.0965517241379e-03),
757 9.42948863457656e-05,
758 5.301514477472012e+03,
759 1.586206896551e-04),
761 5.7767288633179e-03,
762 8.555417483326706e+01,
763 6.896551724137932e-06),
765 5.7883437606822e-03,
766 8.538049512475196e+01,
767 8.965517241379312e-05),
769 1.781620182218e-04,
770 2.805434306201756e+03,
771 1.931034482758e-04),
773 4.994740491021047e-05,
774 1.0009530094583308e+04,
775 1.586206896551e-04),
777 1.29541591992e-04,
778 3.858764206316572e+03,
779 1.931034482758e-04),
781 1.295909468305e-04,
782 3.8572942113521017e+03,
783 6.9310344827586e-03),
785 2.443387047809e-04,
786 2.0453397333972343e+03,
787 6.206896551724138e-05),
789 9.421110633952792e-05,
790 5.306229894934544e+03,
791 1.379310344827e-04),
793 1.298050351238e-04,
794 3.8509307014772426e+03,
795 1.38137931034482e-02),
797 1.297391241696e-04,
798 3.8528875855700608e+03,
799 1.103448275862e-04)}}},
801 {{500000000.0, 5500000000.0, 10500000000.0, 15500000000.0, 20500000000.0,
802 25500000000.0, 30500000000.0, 35500000000.0, 40500000000.0, 45500000000.0,
803 50500000000.0, 55500000000.0, 60500000000.0, 65500000000.0, 70500000000.0,
804 75500000000.0, 80500000000.0, 85500000000.0, 90500000000.0, 95500000000.0},
806 3.0845081545813e-03,
807 1.6110039816473343e+02,
808 2.e-04),
810 4.2290854294851e-03,
811 1.1722887201899576e+02,
812 6.896551724137932e-06),
814 1.1945383299169e-03,
815 4.175717506735425e+02,
816 8.965517241379312e-05),
818 1.6382462973584e-03,
819 3.042044132840143e+02,
820 1.03448275862e-04),
822 5.7847116281393e-03,
823 8.543473212524282e+01,
824 1.448275862068e-04),
826 7.9271822705314e-03,
827 6.207411422324672e+01,
828 1.03448275862e-04),
830 7.9064012965024e-03,
831 6.223989654069086e+01,
832 6.7655172413793e-03),
834 1.1928746063501e-03,
835 4.1815554018694206e+02,
836 1.793103448275e-04),
838 7.9143115301227e-03,
839 6.217668922899309e+01,
840 6.206896551724138e-05),
842 5.7847116281393e-03,
843 8.543473212524282e+01,
844 6.896551724137931e-05),
846 8.689208249277e-04,
847 5.744264205160073e+02,
848 1.724137931034e-04),
850 7.909366722081e-03,
851 6.221618627242562e+01,
852 4.827586206896552e-05),
854 5.7752786216822e-03,
855 8.557590962327636e+01,
856 4.137931034482759e-05),
858 4.2216357928014e-03,
859 1.1743750255590038e+02,
860 1.862068965517e-04),
862 2.2485835121112e-03,
863 2.2136221039019213e+02,
864 1.448275862068e-04),
866 5.7803560422275e-03,
867 8.549986200630548e+01,
868 1.931034482758e-04),
870 7.9153008566728e-03,
871 6.216879282971112e+01,
872 4.827586206896552e-05),
874 6.325118562159e-04,
875 7.894990160837534e+02,
876 1.448275862068e-04),
878 1.778907867973e-04,
879 2.809713297758256e+03,
880 8.275862068965519e-05),
882 2.2474465885176e-03,
883 2.21474697532092e+02,
884 7.586206896551724e-05)}}}}},
885};
886
887NS_LOG_COMPONENT_DEFINE("TwoRaySpectrumPropagationLossModel");
888
889NS_OBJECT_ENSURE_REGISTERED(TwoRaySpectrumPropagationLossModel);
890
892{
893 NS_LOG_FUNCTION(this);
894
895 // Create the Random Number Generator (RNG) variables only once to speed-up the tests
897 m_uniformRv->SetAttribute("Min", DoubleValue(0));
898 m_uniformRv->SetAttribute("Max", DoubleValue(2 * M_PI));
899
901 m_normalRv->SetAttribute("Mean", DoubleValue(0));
902
904}
905
914
915void
919
920TypeId
922{
923 static TypeId tid =
924 TypeId("ns3::TwoRaySpectrumPropagationLossModel")
926 .SetGroupName("Spectrum")
927 .AddConstructor<TwoRaySpectrumPropagationLossModel>()
928 .AddAttribute(
929 "ChannelConditionModel",
930 "Pointer to the channel condition model.",
931 PointerValue(),
934 .AddAttribute(
935 "Scenario",
936 "The 3GPP scenario (RMa, UMa, UMi-StreetCanyon, InH-OfficeOpen, InH-OfficeMixed).",
937 StringValue("RMa"),
940 .AddAttribute("Frequency",
941 "The operating Frequency in Hz",
942 DoubleValue(500.0e6),
945 return tid;
946}
947
948void
950{
951 NS_LOG_FUNCTION(this);
952 if (scenario != "RMa" && scenario != "UMa" && scenario != "UMi-StreetCanyon" &&
953 scenario != "InH-OfficeOpen" && scenario != "InH-OfficeMixed" && scenario != "V2V-Urban" &&
954 scenario != "V2V-Highway")
955 {
956 NS_ABORT_MSG("Unknown scenario (" + scenario +
957 "), choose between: RMa, UMa, UMi-StreetCanyon, "
958 "InH-OfficeOpen, InH-OfficeMixed, V2V-Urban or V2V-Highway");
959 }
960
962 {
963 NS_ABORT_MSG("The specified scenario has not been calibrated yet.");
964 }
965
966 m_scenario = scenario;
967}
968
969void
971{
972 NS_LOG_FUNCTION(this);
973 NS_ASSERT_MSG(f >= 500.0e6 && f <= 100.0e9,
974 "Frequency should be between 0.5 and 100 GHz but is " << f);
975 m_frequency = f;
976}
977
981{
982 NS_LOG_FUNCTION(this);
983
985 auto cond = m_channelConditionModel->GetChannelCondition(a, b);
986
987 return cond->GetLosCondition();
988}
989
993{
994 NS_LOG_FUNCTION(this);
995
996 // Retrieve LOS condition
998
999 // Retrieve the corresponding tuple and vectors
1000 NS_ASSERT_MSG(SIM_PARAMS_TO_FTR_PARAMS_TABLE.find(m_scenario)->second.find(cond) !=
1001 SIM_PARAMS_TO_FTR_PARAMS_TABLE.find(m_scenario)->second.end(),
1002 "The specified scenario and channel condition are not supported");
1003 auto scenAndCondTuple = SIM_PARAMS_TO_FTR_PARAMS_TABLE.find(m_scenario)->second.find(cond);
1004
1005 // Get references to the corresponding vectors
1006 auto& fcVec = std::get<0>(scenAndCondTuple->second);
1007 auto& ftrParamsVec = std::get<1>(scenAndCondTuple->second);
1008
1009 // Find closest carrier frequency which has been calibrated
1010 auto idxOfClosestFc = SearchClosestFc(fcVec, m_frequency);
1011
1012 // Retrieve the corresponding FTR parameters
1013 NS_ASSERT(ftrParamsVec.size() >= idxOfClosestFc && idxOfClosestFc >= 0);
1014 FtrParams params = ftrParamsVec[idxOfClosestFc];
1015
1016 return params;
1017}
1018
1019double
1023 Ptr<const PhasedArrayModel> aPhasedArrayModel,
1024 Ptr<const PhasedArrayModel> bPhasedArrayModel) const
1025{
1026 NS_LOG_FUNCTION(this);
1027
1028 // Get the relative angles between tx and rx phased arrays
1029 Angles aAngle(b->GetPosition(), a->GetPosition());
1030 Angles bAngle(a->GetPosition(), b->GetPosition());
1031
1032 // Compute the beamforming vectors and and array responses
1033 auto aArrayResponse = aPhasedArrayModel->GetSteeringVector(aAngle);
1034 auto aAntennaFields = aPhasedArrayModel->GetElementFieldPattern(aAngle);
1035 auto aBfVector = aPhasedArrayModel->GetBeamformingVector();
1036 auto bArrayResponse = bPhasedArrayModel->GetSteeringVector(bAngle);
1037 auto bAntennaFields = bPhasedArrayModel->GetElementFieldPattern(bAngle);
1038 auto bBfVector = bPhasedArrayModel->GetBeamformingVector();
1039
1040 std::complex<double> aArrayOverallResponse = 0;
1041 std::complex<double> bArrayOverallResponse = 0;
1042
1043 // Compute the dot products between the array responses and the beamforming vectors
1044 for (size_t i = 0; i < aPhasedArrayModel->GetNumElems(); i++)
1045 {
1046 aArrayOverallResponse += aArrayResponse[i] * aBfVector[i];
1047 }
1048 for (size_t i = 0; i < bPhasedArrayModel->GetNumElems(); i++)
1049 {
1050 bArrayOverallResponse += bArrayResponse[i] * bBfVector[i];
1051 }
1052
1053 double gain = norm(aArrayOverallResponse) *
1054 (std::pow(aAntennaFields.first, 2) + std::pow(aAntennaFields.second, 2)) *
1055 norm(bArrayOverallResponse) *
1056 (std::pow(bAntennaFields.first, 2) + std::pow(bAntennaFields.second, 2));
1057
1058 // Retrieve LOS condition to check if a correction factor needs to be introduced
1060 if (cond == ChannelCondition::NLOS)
1061 {
1062 // The linear penalty factor to be multiplied to the beamforming gain whenever the link is
1063 // in NLOS
1064 constexpr double NLOS_BEAMFORMING_FACTOR = 1.0 / 19;
1065 gain *= NLOS_BEAMFORMING_FACTOR;
1066 }
1067
1068 return gain;
1069}
1070
1071double
1073{
1074 NS_LOG_FUNCTION(this);
1075
1076 // Set the RNG parameters
1077 m_normalRv->SetAttribute("Variance", DoubleValue(params.m_sigma));
1078 m_gammaRv->SetAttribute("Alpha", DoubleValue(params.m_m));
1079 m_gammaRv->SetAttribute("Beta", DoubleValue(1.0 / params.m_m));
1080
1081 // Compute the specular components amplitudes from the FTR parameters
1082 double cmnSqrtTerm = sqrt(1 - std::pow(params.m_delta, 2));
1083 double v1 = sqrt(params.m_sigma) * sqrt(params.m_k * (1 - cmnSqrtTerm));
1084 double v2 = sqrt(params.m_sigma) * sqrt(params.m_k * (1 + cmnSqrtTerm));
1085 double sqrtGamma = sqrt(m_gammaRv->GetValue());
1086
1087 // Sample the random phases of the specular components, which are uniformly distributed in [0,
1088 // 2*PI]
1089 double phi1 = m_uniformRv->GetValue();
1090 double phi2 = m_uniformRv->GetValue();
1091
1092 // Sample the normal-distributed real and imaginary parts of the diffuse components
1093 double x = m_normalRv->GetValue();
1094 double y = m_normalRv->GetValue();
1095
1096 // Compute the channel response by combining the above terms
1097 std::complex<double> h = sqrtGamma * v1 * std::complex<double>(cos(phi1), sin(phi1)) +
1098 sqrtGamma * v2 * std::complex<double>(cos(phi2), sin(phi2)) +
1099 std::complex<double>(x, y);
1100
1101 return norm(h);
1102}
1103
1109 Ptr<const PhasedArrayModel> aPhasedArrayModel,
1110 Ptr<const PhasedArrayModel> bPhasedArrayModel) const
1111{
1112 NS_LOG_FUNCTION(this);
1113 uint32_t aId = a->GetObject<Node>()->GetId(); // Id of the node a
1114 uint32_t bId = b->GetObject<Node>()->GetId(); // Id of the node b
1115
1116 NS_ASSERT_MSG(aId != bId, "The two nodes must be different from one another");
1117 NS_ASSERT_MSG(a->GetDistanceFrom(b) > 0.0,
1118 "The position of a and b devices cannot be the same");
1119
1120 // Retrieve the antenna of device a
1121 NS_ASSERT_MSG(aPhasedArrayModel, "Antenna not found for node " << aId);
1122 NS_LOG_DEBUG("a node " << a->GetObject<Node>() << " antenna " << aPhasedArrayModel);
1123
1124 // Retrieve the antenna of the device b
1125 NS_ASSERT_MSG(bPhasedArrayModel, "Antenna not found for device " << bId);
1126 NS_LOG_DEBUG("b node " << bId << " antenna " << bPhasedArrayModel);
1127
1128 // Retrieve FTR params from table
1129 FtrParams ftrParams = GetFtrParameters(a, b);
1130
1131 // Compute the FTR fading
1132 double fading = GetFtrFastFading(ftrParams);
1133
1134 // Compute the beamforming gain
1135 double bfGain = CalcBeamformingGain(a, b, aPhasedArrayModel, bPhasedArrayModel);
1136
1137 Ptr<SpectrumSignalParameters> rxParams = params->Copy();
1138 // Apply the above terms to the TX PSD to calculate RX PSD
1139 (*(rxParams->psd)) *= (fading * bfGain);
1140
1141 return rxParams;
1142}
1143
1144std::size_t
1145TwoRaySpectrumPropagationLossModel::SearchClosestFc(const std::vector<double>& frequencies,
1146 double targetFc) const
1147{
1148 auto it = std::min_element(std::begin(frequencies),
1149 std::end(frequencies),
1150 [targetFc](double lhs, double rhs) {
1151 return std::abs(lhs - targetFc) < std::abs(rhs - targetFc);
1152 });
1153 return std::distance(std::begin(frequencies), it);
1154}
1155
1156int64_t
1158{
1159 NS_LOG_FUNCTION(this << stream);
1160 m_normalRv->SetStream(stream);
1161 m_uniformRv->SetStream(stream + 1);
1162 m_gammaRv->SetStream(stream + 2);
1163 return 3;
1164}
1165
1166} // namespace ns3
Class holding the azimuth and inclination angles of spherical coordinates.
Definition angles.h:107
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:31
A network Node.
Definition node.h:46
spectrum-aware propagation loss model that is compatible with PhasedArrayModel type of ns-3 antenna
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
Definition string.h:45
std::map< std::string, std::map< ChannelCondition::LosConditionValue, CarrierFrequencyFtrParamsTuple > > FtrParamsLookupTable
Nested map associating 3GPP scenario and LosCondition to the corresponding tuple of carrier frequenci...
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...
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
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:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#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:75
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:248
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:269
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
const double norm
Normalization to obtain randoms on [0,1).
Definition rng-stream.cc:55
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
static const TwoRaySpectrumPropagationLossModel::FtrParamsLookupTable SIM_PARAMS_TO_FTR_PARAMS_TABLE
Lookup table associating the simulation parameters to the corresponding fitted FTR parameters.
Ptr< const AttributeChecker > MakeStringChecker()
Definition string.cc:19
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition string.h:46
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
Struct holding the Fluctuating Two Ray fast-fading model parameters.