-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathwifi_dynamic.cc
1330 lines (1224 loc) · 49.8 KB
/
wifi_dynamic.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
*
* Author: Matteo Nerini
* Email: [email protected]
* Date: June 2020
*
*
* Network Topology:
*
* (xA,yA) (xB,yB) (xC,yC)
* * * *
* | x nStaA | x nStaB | x nStaC
* STA A STA B STA C
*
* (0,0)
* *
* | <- 3 APs devices in 1 node
* AP
*
*
* Building Topology:
*
* ^ -----------------------------
* 1 | | |
* 0 | | | StaA: Random Walk
* | | o | StaB: Constant Position
* m | | AP | StaC: Random Walk
* | | |
* v -----------------------------
* <--------------------------->
* 20 m
*
*/
#include "ns3/command-line.h"
#include "ns3/config.h"
#include "ns3/uinteger.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/string.h"
#include "ns3/pointer.h"
#include "ns3/log.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/spectrum-wifi-helper.h"
#include "ns3/ssid.h"
#include "ns3/mobility-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/udp-client-server-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet-sink.h"
#include "ns3/yans-wifi-channel.h"
#include "ns3/multi-model-spectrum-channel.h"
#include "ns3/wifi-net-device.h"
#include "ns3/qos-txop.h"
#include "ns3/wifi-mac.h"
#include "ns3/rng-seed-manager.h"
#include "ns3/flow-monitor.h"
#include "ns3/flow-monitor-helper.h"
#include "ns3/netanim-module.h"
#include "ns3/buildings-module.h"
#include "ns3/ipv4-flow-classifier.h"
#include <bits/stdc++.h>
#define ENDC "\033[0m"
#define ERROR "\033[91m"
#define OKGREEN "\033[92m"
#define WARNING "\033[93m"
#define OKBLUE "\033[94m"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("wifi_dynamic");
double tab1[12][8] = {
{7.10, 7.49, 14.4, 15.2, 30.1, 31.8, 60.2, 63.9},
{14.5, 15.3, 29.0, 30.7, 60.6, 64.3, 119, 125},
{21.7, 23.0, 43.4, 45.9, 90.8, 95.8, 170, 179},
{29.0, 30.8, 58.1, 61.6, 119, 125, 220, 231},
{43.6, 46.1, 87.1, 92.0, 171, 180, 307, 321},
{58.1, 61.6, 114, 120, 220, 231, 382, 399},
{65.4, 69.3, 127, 134, 243, 255, 419, 437},
{72.6, 76.9, 140, 147, 266, 279, 453, 471},
{87.1, 92.0, 165, 173, 307, 321, 506, 526},
{96.2, 101, 180, 190, 333, 349, 547, 567},
{107, 113, 201, 211, 366, 382, 584, 605},
{118, 125, 218, 229, 395, 412, 627, 648}
};
int tab2[12] = {-69, -66, -63, -59, -56, -52, -50, -48, -44, -43, -39, -37};
uint32_t payloadSize = 1472; // bytes (UDP)
double simulationTime = 15; // seconds
int seed = 1; // seed used in the simulation
std::string csvFileName = "test.csv"; // csv file name
std::string band = "AX_5"; // AC_5, AX_2.4 or AX_5
std::string phyModel = "spectrum"; // "spectrum" or "yans"
bool constantMcs = 1; // 0 Minstrel or 1 constant
bool enablePcap = 0; // 0 no Pcap or 1 Pcap
double x_max = 20.0; // meters
double y_max = 10.0; // meters
double z_max = 3.0; // meters
const int nStaA = 6; // number of stations A
const int nStaB = 100; // number of stations B
const int nStaC = 2; // number of stations C
// Network A
int channelNumberA = 42; // Channel number A
int channelWidthA = 20; // 20, 40, 80 or 160 MHz
int mcsA = 5; // from 0 to 11 (-1 = unset value)
int mcsA_min = 0;
int mcsA_max = 11;
int giA = 800; // 800, 1600 or 3200 ns
int txPowerA = 20; // dBm
std::string dataRateA_old = "10Mb/s";
// Network B
int channelNumberB = 114; // Channel number B
int channelWidthB = 20; // 20, 40, 80 or 160 MHz
int mcsB = 1; // from 0 to 11 (-1 = unset value)
int giB = 1600; // 800, 1600 or 3200 ns
int txPowerB = 0; // dBm
std::string dataRateB_old = "10Mb/s";
// Network C
int channelNumberC = 155; // Channel number B
int channelWidthC = 40; // 20, 40, 80 or 160 MHz
int mcsC = 5; // from 0 to 11 (-1 = unset value)
int mcsC_min = 0;
int mcsC_max = 11;
int giC = 800; // 800, 1600 or 3200 ns
int txPowerC = 20; // dBm
std::string dataRateC_old = "10Mb/s";
std::vector<int> dataRateA(nStaA);
std::vector<int> dataRateB(nStaB);
std::vector<int> dataRateC(nStaC);
int dataRateSumA = 0;
int dataRateSumB = 0;
int dataRateSumC = 0;
std::vector<uint64_t> rxPacketsA_meas(nStaA);
std::vector<uint64_t> rxPacketsB_meas(nStaB);
std::vector<uint64_t> rxPacketsC_meas(nStaC);
std::vector<double> pathLoss(nStaA+nStaB+nStaC);
std::vector<double> rxPower(nStaA+nStaB+nStaC);
std::vector<double> x(nStaA+nStaB+nStaC);
std::vector<double> y(nStaA+nStaB+nStaC);
Ptr<FlowMonitor> flowMonitor;
FlowMonitorHelper flowHelper;
std::vector<uint32_t> txPackets_unsort(nStaA+nStaB+nStaC);
std::vector<uint32_t> rxPackets_unsort(nStaA+nStaB+nStaC);
std::vector<double> latency_unsort(nStaA+nStaB+nStaC);
//std::vector<uint32_t> txPackets(nStaA+nStaB+nStaC);
//std::vector<uint32_t> rxPackets(nStaA+nStaB+nStaC);
//std::vector<double> latency(nStaA+nStaB+nStaC);
uint32_t txPackets[2][nStaA+nStaB+nStaC]; // # txPackets until t0 and t0-T
uint32_t rxPackets[2][nStaA+nStaB+nStaC]; // # rxPackets until t0 and t0-T
double latency[2][nStaA+nStaB+nStaC]; // # average latency until t0 and t0-T
std::vector<uint32_t> destPorts(nStaA+nStaB+nStaC);
//std::vector<double> prob_err(nStaA+nStaB+nStaC);
double probErr[2][nStaA+nStaB+nStaC]; // Pe on last T=[t0-T, t0] and on previous T=[t0-2T, t0-T]
bool sliceA;
bool sliceA_improved;
bool sliceB;
bool sliceB_improved;
bool sliceC;
bool sliceC_improved;
int channelWidthMulA = 1;
int mcsAddB = 1;
int txPowerAddB = 3;
int channelWidthMulC = 1;
// function to define the parameters which can be set when the script is called
void configure (int argc, char *argv[])
{
CommandLine cmd;
cmd.AddValue ("payloadSize", "Payload size in bytes", payloadSize);
cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
cmd.AddValue ("seed", "Seed", seed);
cmd.AddValue ("csvFileName", "Name of the .csv file", csvFileName);
cmd.AddValue ("band", "AC_5, AX_2.4 or AX_5", band);
cmd.AddValue ("phyModel", "PHY layer model", phyModel);
cmd.AddValue ("constantMcs", "0 Minstrel or 1 constant", constantMcs);
cmd.AddValue ("enablePcap", "Enable/disable pcap file generation", enablePcap);
// Network A
cmd.AddValue ("channelNumberA", "Channel number A", channelNumberA);
cmd.AddValue ("channelWidthA", "Channel width A", channelWidthA);
cmd.AddValue ("mcsA", "if set, limit testing to a specific MCS A", mcsA);
cmd.AddValue ("giA", "Guard interval A", giA);
cmd.AddValue ("txPowerA", "Transmission power A", txPowerA);
cmd.AddValue ("dataRateA_old", "Data rate A", dataRateA_old);
// Network B
cmd.AddValue ("channelNumberB", "Channel number B", channelNumberB);
cmd.AddValue ("channelWidthB", "Channel width B", channelWidthB);
cmd.AddValue ("mcsB", "if set, limit testing to a specific MCS B", mcsB);
cmd.AddValue ("giB", "Guard interval B", giB);
cmd.AddValue ("txPowerB", "Transmission power B", txPowerB);
cmd.AddValue ("dataRateB_old", "Data rate B", dataRateB_old);
// Network C
cmd.AddValue ("channelNumberC", "Channel number C", channelNumberC);
cmd.AddValue ("channelWidthC", "Channel width C", channelWidthC);
cmd.AddValue ("mcsC", "if set, limit testing to a specific MCS C", mcsC);
cmd.AddValue ("giC", "Guard interval C", giC);
cmd.AddValue ("txPowerC", "Transmission power C", txPowerC);
cmd.AddValue ("dataRateC_old", "Data rate C", dataRateC_old);
//cmd.AddValue ("nStaA", "Number Stations A", nStaA);
//cmd.AddValue ("nStaB", "Number Stations B", nStaB);
//cmd.AddValue ("nStaC", "Number Stations C", nStaC);
cmd.Parse (argc, argv);
}
// function to set the channel number
void set_channel_number()
{
for (int i = 0; i < nStaA; i++)
Config::Set ("/NodeList/" + std::to_string(i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelNumber",
UintegerValue (channelNumberA));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelNumber",
UintegerValue (channelNumberA)); ///NodeList/3/DeviceList 3?
for (int i = 0; i < nStaB; i++)
Config::Set ("/NodeList/" + std::to_string(nStaA+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelNumber",
UintegerValue (channelNumberB));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/1/$ns3::WifiNetDevice/Phy/ChannelNumber",
UintegerValue (channelNumberB));
for (int i = 0; i < nStaC; i++)
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelNumber",
UintegerValue (channelNumberC));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/2/$ns3::WifiNetDevice/Phy/ChannelNumber",
UintegerValue (channelNumberC));
}
// function to set the channel width
void set_channel_width()
{
for (int i = 0; i < nStaA; i++)
Config::Set ("/NodeList/" + std::to_string(i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelWidth",
UintegerValue (channelWidthA));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelWidth",
UintegerValue (channelWidthA));
for (int i = 0; i < nStaB; i++)
Config::Set ("/NodeList/" + std::to_string(nStaA+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelWidth",
UintegerValue (channelWidthB));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/1/$ns3::WifiNetDevice/Phy/ChannelWidth",
UintegerValue (channelWidthB));
for (int i = 0; i < nStaC; i++)
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/ChannelWidth",
UintegerValue (channelWidthC));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/2/$ns3::WifiNetDevice/Phy/ChannelWidth",
UintegerValue (channelWidthC));
}
// function to set the tx power
void set_tx_power()
{
for (int i = 0; i < nStaA; i++)
{
Config::Set ("/NodeList/" + std::to_string(i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerStart",
DoubleValue (txPowerA));
Config::Set ("/NodeList/" + std::to_string(i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerEnd",
DoubleValue (txPowerA));
}
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerStart",
DoubleValue (txPowerA));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerEnd",
DoubleValue (txPowerA));
for (int i = 0; i < nStaB; i++)
{
Config::Set ("/NodeList/" + std::to_string(nStaA+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerStart",
DoubleValue (txPowerB));
Config::Set ("/NodeList/" + std::to_string(nStaA+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerEnd",
DoubleValue (txPowerB));
}
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/1/$ns3::WifiNetDevice/Phy/TxPowerStart",
DoubleValue (txPowerB));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/1/$ns3::WifiNetDevice/Phy/TxPowerEnd",
DoubleValue (txPowerB));
for (int i = 0; i < nStaC; i++)
{
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerStart",
DoubleValue (txPowerC));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) + "/DeviceList/0/$ns3::WifiNetDevice/Phy/TxPowerEnd",
DoubleValue (txPowerC));
}
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/2/$ns3::WifiNetDevice/Phy/TxPowerStart",
DoubleValue (txPowerC));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/2/$ns3::WifiNetDevice/Phy/TxPowerEnd",
DoubleValue (txPowerC));
}
// function to set the guard interval
void set_guard_interval()
{
for (int i = 0; i < nStaA; i++)
Config::Set ("/NodeList/" + std::to_string(i) + "/DeviceList/0/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
TimeValue (NanoSeconds (giA)));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/0/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
TimeValue (NanoSeconds (giA)));
for (int i = 0; i < nStaB; i++)
Config::Set ("/NodeList/" + std::to_string(nStaA+i) + "/DeviceList/0/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
TimeValue (NanoSeconds (giB)));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/1/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
TimeValue (NanoSeconds (giB)));
for (int i = 0; i < nStaC; i++)
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) + "/DeviceList/0/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
TimeValue (NanoSeconds (giC)));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) + "/DeviceList/2/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
TimeValue (NanoSeconds (giC)));
}
// function to set the modulation and coding scheme
void set_mcs()
{
std::ostringstream ossA;
ossA << "HeMcs" << mcsA;
for (int i = 0; i < nStaA; i++)
{
Config::Set ("/NodeList/" + std::to_string(i) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/DataMode",
StringValue (ossA.str ()));
Config::Set ("/NodeList/" + std::to_string(i) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/ControlMode",
StringValue (ossA.str ()));
}
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/DataMode",
StringValue (ossA.str ()));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/ControlMode",
StringValue (ossA.str ()));
std::ostringstream ossB;
ossB << "HeMcs" << mcsB;
for (int i = 0; i < nStaB; i++)
{
Config::Set ("/NodeList/" + std::to_string(nStaA+i) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/DataMode",
StringValue (ossB.str ()));
Config::Set ("/NodeList/" + std::to_string(nStaA+i) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/ControlMode",
StringValue (ossB.str ()));
}
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) +
"/DeviceList/1/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/DataMode",
StringValue (ossB.str ()));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) +
"/DeviceList/1/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/ControlMode",
StringValue (ossB.str ()));
std::ostringstream ossC;
ossC << "HeMcs" << mcsC;
for (int i = 0; i < nStaC; i++)
{
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/DataMode",
StringValue (ossC.str ()));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+i) +
"/DeviceList/0/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/ControlMode",
StringValue (ossC.str ()));
}
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) +
"/DeviceList/2/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/DataMode",
StringValue (ossC.str ()));
Config::Set ("/NodeList/" + std::to_string(nStaA+nStaB+nStaC) +
"/DeviceList/2/$ns3::WifiNetDevice/RemoteStationManager/$ns3::ConstantRateWifiManager/ControlMode",
StringValue (ossC.str ()));
}
// function to create a new C/S application
void new_application (uint16_t& index, NodeContainer staNodes, NodeContainer apNode, std::string dataRate_str,
Ipv4InterfaceContainer& apInterface, ApplicationContainer& clientApp, ApplicationContainer& serverApp)
{
uint16_t port = 5000 + index;
UdpServerHelper server (port);
server.SetAttribute("Port", UintegerValue (port));
serverApp = server.Install (apNode.Get (0));
serverApp.Start (Seconds (0.0));
serverApp.Stop (Seconds (simulationTime + 2));
OnOffHelper client ("ns3::UdpSocketFactory", InetSocketAddress (apInterface.GetAddress (0), port));
client.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
client.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
client.SetAttribute ("DataRate", StringValue (dataRate_str));
client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
clientApp = client.Install (staNodes.Get (index-1));
clientApp.Start (Seconds (1.0));
clientApp.Stop (Seconds (simulationTime + 1));
index ++;
}
// function to update channel numbers, channel widths, GIs, MCSs, and Ptxs for each slice.
void update_channels (int i, Ptr<HybridBuildingsPropagationLossModel> lossModel,
NodeContainer staNodes, NodeContainer apNode)
{
std::cout << "At time " << i << "s update_channels is called" << std::endl;
// Compute Inputs: rx power through the path loss [dB] (meaningful only when mobility is involved), # of tx packets, # of rx packets and latency
for (int i = 0; i < nStaA; i++)
{
rxPower[i] = txPowerA - lossModel->GetLoss (staNodes.Get(i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
//std::cout << "Received power A: " << rxPower[i] << std::endl;
}
for (int i = 0; i < nStaB; i++)
{
rxPower[nStaA+i] = txPowerB - lossModel->GetLoss (staNodes.Get(nStaA+i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
//std::cout << "Received power B: " << rxPower[nStaA+i] << std::endl;
}
for (int i = 0; i < nStaC; i++)
{
rxPower[nStaA+nStaB+i] = txPowerC - lossModel->GetLoss (staNodes.Get(nStaA+nStaB+i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
//std::cout << "Received power C: " << rxPower[nStaA+nStaB+i] << std::endl;
}
//flowMonitor->CheckForLostPackets ();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowHelper.GetClassifier ());
FlowMonitor::FlowStatsContainer stats = flowMonitor->GetFlowStats ();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
{
txPackets_unsort[i->first-1] = i->second.txPackets;
rxPackets_unsort[i->first-1] = i->second.rxPackets;
latency_unsort[i->first-1] = i->second.delaySum.ToDouble(Time::MS) / i->second.rxPackets;
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
destPorts[i->first-1] = t.destinationPort;
//std::cout << "Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << "," << destPorts[i->first-1] << ")\n";
//std::cout << " Tx Packets: " << totTxPackets[i->first-1] << "\n";
//std::cout << " Rx Packets: " << totRxPackets[i->first-1] << "\n";
//std::cout << " Delay Sum: " << totDelay[i->first-1] << "\n";
//std::cout << " Delay Sum MS: " << i->second.delaySum.ToDouble(Time::MS) << "\n";
//std::cout << " Delay: " << i->second.delaySum / i->second.rxPackets << "\n";
//std::cout << " Delay MS: " << i->second.delaySum.ToDouble(Time::MS) / i->second.rxPackets << "\n";
}
// Shift txPackets, rxPackets, latency and probErr
for (int i = 0; i < nStaA+nStaB+nStaC; i++)
{
txPackets[1][i] = txPackets[0][i];
rxPackets[1][i] = rxPackets[0][i];
latency[1][i] = latency[0][i];
probErr[1][i] = probErr[0][i];
}
// Compute txPackets, rxPackets, latency and probErr
for (int i = 0; i < nStaA+nStaB+nStaC; i++)
{
txPackets[0][destPorts[i]-5001] = txPackets_unsort[i];
rxPackets[0][destPorts[i]-5001] = rxPackets_unsort[i];
latency[0][destPorts[i]-5001] = latency_unsort[i];
}
for (int i = 0; i < nStaA+nStaB+nStaC; i++)
{
// probErr[0][i] = (txPackets[0][i] - rxPackets[0][i]) / (double)txPackets[0][i];
probErr[0][i] = ((txPackets[0][i]-txPackets[1][i]) - (rxPackets[0][i]-rxPackets[1][i])) / (double)(txPackets[0][i]-txPackets[1][i]);
std::cout << "Error Prob: " << probErr[0][i] << std::endl;
}
// Compute Outputs: channel number, channel width, guard interval, mcs, tx power
// Slice A, goal: reach high throughput
sliceA = 1;
sliceA_improved = 0;
for (int i = 0; i < nStaA; i++)
{
if (probErr[0][i] > 0.02)
{
sliceA = 0;
break;
}
}
double probErrSumA = 0;
for (int i = 0; i < nStaA; i++)
{
probErrSumA = probErrSumA + probErr[0][i] - probErr[1][i];
}
if (probErrSumA < 0) sliceA_improved = 1;
if (!sliceA && !sliceA_improved) // SLA KO in the last T && Pe in the last T > in previous T
{
channelWidthMulA = 2;
}
if (sliceA && sliceA_improved) // SLA OK in the last T && Pe in the last T < in previous T
{
channelWidthMulA = 1;
}
double rxPowerA_min = 20;
for (int i = 0; i < nStaA; i++)
{
if (rxPower[i] < rxPowerA_min) rxPowerA_min = rxPower[i];
}
// max MCS according to tab2
for (int i = 0; i < 12; i++)
{
if (tab2[i] > rxPowerA_min)
{
mcsA_max = i-2;
break;
}
mcsA_max = 11;
}
// min channelWidth according to tab1
if (dataRateSumA < tab1[mcsA_max][1]) channelWidthA = 20*channelWidthMulA;
else if (dataRateSumA < tab1[mcsA_max][3]) channelWidthA = 40*channelWidthMulA;
else if (dataRateSumA < tab1[mcsA_max][5]) channelWidthA = 80*channelWidthMulA;
else channelWidthA = 160;
if (channelWidthA == 20) channelNumberA = 36;
else if (channelWidthA == 40) channelNumberA = 38;
else if (channelWidthA == 80) channelNumberA = 42;
else channelNumberA = 50;
// min MCS allowed by channelWidthA from tab1
for (int i = 0; i < 12; i++)
{
if (dataRateSumA < tab1[i][2* (int) log2(channelWidthA/10)-1])
{
mcsA_min = i;
break;
}
mcsA_min = 11;
}
// min MCS
if (mcsA_max >= mcsA_min + 1) mcsA = mcsA_min + 1;
else mcsA = mcsA_max;
std::cout << "Slice A: " << channelWidthA << ", " << channelNumberA <<
", " << giA << ", " << mcsA << ", " << txPowerA << std::endl;
std::cout << "Slice A mcs: " << mcsA_min << ", " << mcsA_max << std::endl;
// Slice B, goal: use the lowest txPower possible without losing in resource utilization
sliceB = 1;
sliceB_improved = 0;
int nSliceB_off = 0;
for (int i = 0; i < nStaB; i++)
{
if (probErr[0][nStaA+i] > 0.02) nSliceB_off++;
}
if (nSliceB_off > nStaB/10) sliceB = 0;
double probErrSumB = 0;
for (int i = 0; i < nStaB; i++)
{
probErrSumB = probErrSumB + probErr[0][nStaA+i] - probErr[1][nStaA+i];
}
if (probErrSumB < 0) sliceB_improved = 1;
if (!sliceB && !sliceB_improved) // SLA KO in the last T && Pe in the last T > in previous T
{
if (txPowerAddB < 6) txPowerAddB++;
else if (mcsAddB < 4)
{
mcsAddB++;
txPowerAddB = 3;
}
}
if (sliceB && sliceB_improved) // SLA OK in the last T && Pe in the last T < in previous T
{
if (txPowerAddB > 1) txPowerAddB--;
else if (mcsAddB > 1)
{
mcsAddB--;
txPowerAddB = 3;
}
}
// min MCS according to tab1
for (int i = 0; i < 12; i++)
{
if (tab1[i][0] > dataRateSumB/1000)
{
mcsB = i + mcsAddB;
break;
}
mcsB = 11;
}
// min txPower according to tab2
std::vector<double> lossB(nStaB);
for (int i = 0; i < nStaB; i++)
{
lossB[i] = lossModel->GetLoss (staNodes.Get(nStaA+i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
}
sort(lossB.begin(), lossB.end());
txPowerB = lossB[nStaB - nStaB/10 - 1] + tab2[mcsB] + txPowerAddB;
std::cout << "Slice B: " << channelWidthB << ", " << channelNumberB <<
", " << giB << ", " << mcsB << ", " << txPowerB << std::endl;
// Slice C, goal: reach high reliability and low latency
sliceC = 1;
sliceC_improved = 0;
for (int i = 0; i < nStaC; i++)
{
if (probErr[0][nStaA+nStaB+i] > 0.01 || latency[0][nStaA+nStaB+i] > 5)
{
sliceC = 0;
break;
}
}
double probErrSumC = 0;
for (int i = 0; i < nStaC; i++)
{
probErrSumC = probErrSumC + probErr[0][nStaA+nStaB+i] - probErr[1][nStaA+nStaB+i];
}
if (probErrSumC < 0) sliceC_improved = 1;
if (!sliceC && !sliceC_improved) // SLA KO in the last T && Pe in the last T > in previous T
{
//channelWidthMulC = 2;
channelWidthMulC = 1;
}
if (sliceC && sliceC_improved) // SLA OK in the last T && Pe in the last T < in previous T
{
channelWidthMulC = 1;
}
double rxPowerC_min = 20;
for (int i = 0; i < nStaC; i++)
{
if (rxPower[nStaA+nStaB+i] < rxPowerC_min) rxPowerC_min = rxPower[nStaA+nStaB+i];
}
// max MCS according to tab2
for (int i = 0; i < 12; i++)
{
if (tab2[i] > rxPowerC_min)
{
mcsC_max = i-2;
break;
}
mcsC_max = 11;
}
// min channelWidth according to tab1
if (dataRateSumC < tab1[mcsC_max][1]) channelWidthC = 20*channelWidthMulC;
else if (dataRateSumC < tab1[mcsC_max][3]) channelWidthC = 40*channelWidthMulC;
else if (dataRateSumC < tab1[mcsC_max][5]) channelWidthC = 80*channelWidthMulC;
else channelWidthC = 160;
if (channelWidthC == 20) channelNumberC = 161;
else if (channelWidthC == 40) channelNumberC = 159;
else if (channelWidthC == 80) channelNumberC = 155;
else channelNumberC = 163;
// min MCS allowed by channelWidthA from tab1
for (int i = 0; i < 12; i++)
{
if (dataRateSumC < tab1[i][2* (int) log2(channelWidthC/10)-1])
{
mcsC_min = i;
break;
}
mcsC_min = 11;
}
// MCS
if (mcsC_max >= mcsC_min + 1) mcsC = mcsC_max;
else mcsC = mcsC_min + 1;
std::cout << "Slice C: " << channelWidthC << ", " << channelNumberC <<
", " << giC << ", " << mcsC << ", " << txPowerC << std::endl;
std::cout << "Slice C mcs: " << mcsC_min << ", " << mcsC_max << std::endl;
// Set Outputs
set_channel_number();
set_channel_width();
set_tx_power();
set_guard_interval();
set_mcs();
// Write file
std::ofstream out (csvFileName.c_str (), std::ios::app);
out << "channelNumber, channelWidth, gi, mcs, txPower" << std::endl;
out << channelNumberA << "," << channelWidthA << "," << giA << "," << mcsA << "," << txPowerA << std::endl;
out << channelNumberB << "," << channelWidthB << "," << giB << "," << mcsB << "," << txPowerB << std::endl;
out << channelNumberC << "," << channelWidthC << "," << giC << "," << mcsC << "," << txPowerC << std::endl;
for (int i = 0; i < nStaA; i++)
{
out << dataRateA[i] << "," << x[i] << "," << y[i] << ","
<< txPackets[0][i] << "," << rxPackets[0][i] << "," << latency[0][i]
<< std::endl;
}
for (int i = 0; i < nStaB; i++)
{
out << dataRateB[i] << "," << x[nStaA+i] << "," << y[nStaA+i] << ","
<< txPackets[0][nStaA+i] << "," << rxPackets[0][nStaA+i] << "," << latency[0][nStaA+i] << std::endl;
}
for (int i = 0; i < nStaC; i++)
{
out << dataRateC[i] << "," << x[nStaA+nStaB+i] << "," << y[nStaA+nStaB+i] << ","
<< txPackets[0][nStaA+nStaB+i] << "," << rxPackets[0][nStaA+nStaB+i] << "," << latency[0][nStaA+nStaB+i] << std::endl;
}
out.close ();
}
// function to compute channel numbers and widths for each slice
void compute_channels (Ptr<HybridBuildingsPropagationLossModel> lossModel,
NodeContainer staNodes, NodeContainer apNode)
{
std::cout << "At the beginning compute_channels is called" << std::endl;
// Slice A
txPowerA = 20; // Maximum power
giA = 800; // Minimum GI
for (int i = 0; i < nStaA; i++)
{
rxPower[i] = txPowerA - lossModel->GetLoss (staNodes.Get(i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
//std::cout << "Received power A: " << rxPower[i] << std::endl;
}
double rxPowerA_min = 20;
for (int i = 0; i < nStaA; i++)
{
if (rxPower[i] < rxPowerA_min) rxPowerA_min = rxPower[i];
}
// max MCS according to tab2
for (int i = 0; i < 12; i++)
{
if (tab2[i] > rxPowerA_min)
{
mcsA_max = i-2;
break;
}
mcsA_max = 11;
}
// min channelWidth according to tab1
if (dataRateSumA < tab1[mcsA_max][1])
{
channelWidthA = 20;
channelNumberA = 36;
}
else if (dataRateSumA < tab1[mcsA_max][3])
{
channelWidthA = 40;
channelNumberA = 38;
}
else if (dataRateSumA < tab1[mcsA_max][5])
{
channelWidthA = 80;
channelNumberA = 42;
}
else
{
channelWidthA = 160;
channelNumberA = 50;
}
// min MCS allowed by channelWidthA from tab1
for (int i = 0; i < 12; i++)
{
if (dataRateSumA < tab1[i][2* (int) log2(channelWidthA/10)-1])
{
mcsA_min = i;
break;
}
mcsA_min = 11;
}
// min MCS
if (mcsA_max >= mcsA_min + 1) mcsA = mcsA_min + 1;
else mcsA = mcsA_max;
std::cout << "Slice A: " << channelWidthA << ", " << channelNumberA <<
", " << giA << ", " << mcsA << ", " << txPowerA << std::endl;
std::cout << "Slice A mcs: " << mcsA_min << ", " << mcsA_max << std::endl;
// Slice B
channelWidthB = 20;
channelNumberB = 100;
giB = 1600;
// min MCS according to tab1
for (int i = 0; i < 12; i++)
{
if (tab1[i][0] > dataRateSumB/1000)
{
mcsB = i+1;
break;
}
mcsB = 11;
}
// min txPower according to tab2
std::vector<double> lossB(nStaB);
for (int i = 0; i < nStaB; i++)
{
lossB[i] = lossModel->GetLoss (staNodes.Get(nStaA+i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
}
sort(lossB.begin(), lossB.end());
txPowerB = lossB[nStaB - nStaB/10 - 1] + tab2[mcsB] + 3;
std::cout << "Slice B: " << channelWidthB << ", " << channelNumberB <<
", " << giB << ", " << mcsB << ", " << txPowerB << std::endl;
// Slice C
txPowerC = 20; // Maximum power
giC = 800; // Minimum GI
for (int i = 0; i < nStaC; i++)
{
rxPower[nStaA+nStaB+i] = txPowerC - lossModel->GetLoss (staNodes.Get(nStaA+nStaB+i)->GetObject<MobilityModel> (), apNode.Get(0)->GetObject<MobilityModel> ());
//std::cout << "Received power C: " << rxPower[nStaA+nStaB+i] << std::endl;
}
double rxPowerC_min = 20;
for (int i = 0; i < nStaC; i++)
{
if (rxPower[nStaA+nStaB+i] < rxPowerC_min) rxPowerC_min = rxPower[nStaA+nStaB+i];
}
// max MCS according to tab2
for (int i = 0; i < 12; i++)
{
if (tab2[i] > rxPowerC_min)
{
mcsC_max = i-2;
break;
}
mcsC_max = 11;
}
// min channelWidth according to tab1
if (dataRateSumC < tab1[mcsC_max][1])
{
channelWidthC = 20;
channelNumberC = 161;
}
else if (dataRateSumC < tab1[mcsC_max][3])
{
channelWidthC = 40;
channelNumberC = 159;
}
else if (dataRateSumC < tab1[mcsC_max][5])
{
channelWidthC = 80;
channelNumberC = 155;
}
else
{
channelWidthC = 160;
channelNumberC = 144;
}
// min MCS allowed by channelWidthC from tab1
for (int i = 0; i < 12; i++)
{
if (dataRateSumC < tab1[i][2* (int) log2(channelWidthC/10)-1])
{
mcsC_min = i;
break;
}
mcsC_min = 11;
}
// MCS
if (mcsC_max >= mcsC_min + 1) mcsC = mcsC_max;
else mcsC = mcsC_min + 1;
std::cout << "Slice C: " << channelWidthC << ", " << channelNumberC <<
", " << giC << ", " << mcsC << ", " << txPowerC << std::endl;
std::cout << "Slice C mcs: " << mcsC_min << ", " << mcsC_max << std::endl;
// Set Outputs
set_channel_number();
set_channel_width();
set_tx_power();
set_guard_interval();
set_mcs();
// Write file
std::ofstream out (csvFileName.c_str (), std::ios::app);
out << "init_channelNumber, channelWidth, gi, mcs, txPower" << std::endl;
out << channelNumberA << "," << channelWidthA << "," << giA << "," << mcsA << "," << txPowerA << std::endl;
out << channelNumberB << "," << channelWidthB << "," << giB << "," << mcsB << "," << txPowerB << std::endl;
out << channelNumberC << "," << channelWidthC << "," << giC << "," << mcsC << "," << txPowerC << std::endl;
out.close ();
}
// function main
int main (int argc, char *argv[])
{
// Define CMD commands
configure(argc, argv);
// Set the PRNG seed
RngSeedManager::SetSeed (seed);
// Set random throughput for each flow in the the 3 slices
Ptr<UniformRandomVariable> dataRateA_ptr = CreateObject<UniformRandomVariable> ();
dataRateA_ptr->SetAttribute ("Min", DoubleValue (80));
dataRateA_ptr->SetAttribute ("Max", DoubleValue (101));
std::vector<std::string> dataRateA_str(nStaA);
for (int i = 0; i < nStaA; i++)
{
dataRateA[i] = (int) dataRateA_ptr->GetValue();
dataRateA_str[i] = std::to_string(dataRateA[i]) + "Mb/s";
}
Ptr<UniformRandomVariable> dataRateB_ptr = CreateObject<UniformRandomVariable> ();
dataRateB_ptr->SetAttribute ("Min", DoubleValue (30));
dataRateB_ptr->SetAttribute ("Max", DoubleValue (51));
std::vector<std::string> dataRateB_str(nStaB);
for (int i = 0; i < nStaB; i++)
{
dataRateB[i] = (int) dataRateB_ptr->GetValue();
dataRateB_str[i] = std::to_string(dataRateB[i]) + "Kb/s";
}
Ptr<UniformRandomVariable> dataRateC_ptr = CreateObject<UniformRandomVariable> ();
dataRateC_ptr->SetAttribute ("Min", DoubleValue (20));
dataRateC_ptr->SetAttribute ("Max", DoubleValue (41));
std::vector<std::string> dataRateC_str(nStaC);
for (int i = 0; i < nStaC; i++)
{
dataRateC[i] = (int) dataRateC_ptr->GetValue();
dataRateC_str[i] = std::to_string(dataRateC[i]) + "Mb/s";
}
// Set random positions for STAs
Ptr<UniformRandomVariable> x_ptr = CreateObject<UniformRandomVariable> ();
x_ptr->SetAttribute ("Min", DoubleValue (0));
x_ptr->SetAttribute ("Max", DoubleValue (x_max));
Ptr<UniformRandomVariable> y_ptr = CreateObject<UniformRandomVariable> ();
y_ptr->SetAttribute ("Min", DoubleValue (0));
y_ptr->SetAttribute ("Max", DoubleValue (y_max));
for (int i = 0; i < nStaA+nStaB+nStaC; i++)
{
x[i] = x_ptr->GetValue ();
y[i] = y_ptr->GetValue ();
}
// Compute Channels according to initialization algorithm
for(std::vector<int>::iterator it = dataRateA.begin(); it != dataRateA.end(); ++it)
dataRateSumA += *it;
for(std::vector<int>::iterator it = dataRateB.begin(); it != dataRateB.end(); ++it)
dataRateSumB += *it;
for(std::vector<int>::iterator it = dataRateC.begin(); it != dataRateC.end(); ++it)
dataRateSumC += *it;
// Create nStaA + nStaB + nStaC STAs node objects and 1 AP node object
NodeContainer staNodes;
staNodes.Create (nStaA + nStaB + nStaC);
NodeContainer apNode;
apNode.Create (1);
// Create a phy helper
SpectrumWifiPhyHelper spectrumPhy = SpectrumWifiPhyHelper::Default ();
YansWifiPhyHelper yansPhy = YansWifiPhyHelper::Default ();
Ptr<HybridBuildingsPropagationLossModel> lossModel = CreateObject<HybridBuildingsPropagationLossModel> ();
if (phyModel == "spectrum")
{
// Create the channel
Ptr<MultiModelSpectrumChannel> channel = CreateObject<MultiModelSpectrumChannel> ();
channel->AddPropagationLossModel (lossModel);
Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
channel->SetPropagationDelayModel (delayModel);
spectrumPhy.SetErrorRateModel ("ns3::NistErrorRateModel");
spectrumPhy.SetChannel (channel);
//spectrumPhy.Set ("TxPowerStart", DoubleValue (txPower));
//spectrumPhy.Set ("TxPowerEnd", DoubleValue (txPower));
}
else if (phyModel == "yans")
{
// Create the channel
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
yansPhy.SetChannel (channel.Create ());
//yansPhy.Set ("TxPowerStart", DoubleValue (txPower));
//yansPhy.Set ("TxPowerEnd", DoubleValue (txPower));
}
else
{
std::cout << "Wrong phyModel value!" << std::endl;
return 0;
}
//Create a WifiMacHelper and a WifiHelper
WifiMacHelper mac;
WifiHelper wifi;
std::ostringstream oss;
if (band == "AC_5")
{
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
Config::SetDefault ("ns3::HybridBuildingsPropagationLossModel::Frequency", DoubleValue (5.51e+09));
if (constantMcs == 0)
{
wifi.SetRemoteStationManager ("ns3::MinstrelHtWifiManager");
}
else if (constantMcs == 1)
{
oss << "VhtMcs" << mcsA;
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue (oss.str ()),
"ControlMode", StringValue (oss.str ()));
}
else
{
std::cout << "Wrong constantMcs value!" << std::endl;
return 0;
}
}
else if (band == "AX_5")
{
wifi.SetStandard (WIFI_PHY_STANDARD_80211ax_5GHZ);