A Discrete-Event Network Simulator
API
wifi-phy.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * S├ębastien Deronne <sebastien.deronne@gmail.com>
20  */
21 
22 #include <algorithm>
23 #include "ns3/simulator.h"
24 #include "ns3/log.h"
25 #include "ns3/pointer.h"
26 #include "ns3/mobility-model.h"
27 #include "ns3/random-variable-stream.h"
28 #include "ns3/error-model.h"
29 #include "wifi-net-device.h"
30 #include "wifi-phy.h"
31 #include "wifi-utils.h"
32 #include "frame-capture-model.h"
35 #include "error-rate-model.h"
36 #include "wifi-net-device.h"
37 #include "wifi-psdu.h"
38 #include "wifi-ppdu.h"
39 #include "ns3/dsss-phy.h"
40 #include "ns3/erp-ofdm-phy.h"
41 #include "ns3/he-phy.h" //includes OFDM, HT, and VHT
42 
43 namespace ns3 {
44 
45 NS_LOG_COMPONENT_DEFINE ("WifiPhy");
46 
47 /****************************************************************
48  * The actual WifiPhy class
49  ****************************************************************/
50 
52 
53 const std::set<FrequencyChannelInfo> WifiPhy::m_frequencyChannels =
54 {
55  //2.4 GHz channels
56  // 802.11b uses width of 22, while OFDM modes use width of 20
57  { std::make_tuple (1, 2412, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
58  { std::make_tuple (1, 2412, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
59  { std::make_tuple (2, 2417, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
60  { std::make_tuple (2, 2417, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
61  { std::make_tuple (3, 2422, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
62  { std::make_tuple (3, 2422, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
63  { std::make_tuple (4, 2427, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
64  { std::make_tuple (4, 2427, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
65  { std::make_tuple (5, 2432, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
66  { std::make_tuple (5, 2432, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
67  { std::make_tuple (6, 2437, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
68  { std::make_tuple (6, 2437, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
69  { std::make_tuple (7, 2442, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
70  { std::make_tuple (7, 2442, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
71  { std::make_tuple (8, 2447, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
72  { std::make_tuple (8, 2447, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
73  { std::make_tuple (9, 2452, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
74  { std::make_tuple (9, 2452, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
75  { std::make_tuple (10, 2457, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
76  { std::make_tuple (10, 2457, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
77  { std::make_tuple (11, 2462, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
78  { std::make_tuple (11, 2462, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
79  { std::make_tuple (12, 2467, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
80  { std::make_tuple (12, 2467, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
81  { std::make_tuple (13, 2472, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
82  { std::make_tuple (13, 2472, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
83  // Only defined for 802.11b
84  { std::make_tuple (14, 2484, 22, WIFI_PHY_DSSS_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
85  // 40 MHz channels
86  { std::make_tuple (3, 2422, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
87  { std::make_tuple (4, 2427, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
88  { std::make_tuple (5, 2432, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
89  { std::make_tuple (6, 2437, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
90  { std::make_tuple (7, 2442, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
91  { std::make_tuple (8, 2447, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
92  { std::make_tuple (9, 2452, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
93  { std::make_tuple (10, 2457, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
94  { std::make_tuple (11, 2462, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_2_4GHZ) },
95 
96  // Now the 5 GHz channels used for 802.11a/n/ac/ax
97  // 20 MHz channels
98  { std::make_tuple (36, 5180, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
99  { std::make_tuple (40, 5200, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
100  { std::make_tuple (44, 5220, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
101  { std::make_tuple (48, 5240, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
102  { std::make_tuple (52, 5260, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
103  { std::make_tuple (56, 5280, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
104  { std::make_tuple (60, 5300, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
105  { std::make_tuple (64, 5320, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
106  { std::make_tuple (100, 5500, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
107  { std::make_tuple (104, 5520, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
108  { std::make_tuple (108, 5540, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
109  { std::make_tuple (112, 5560, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
110  { std::make_tuple (116, 5580, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
111  { std::make_tuple (120, 5600, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
112  { std::make_tuple (124, 5620, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
113  { std::make_tuple (128, 5640, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
114  { std::make_tuple (132, 5660, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
115  { std::make_tuple (136, 5680, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
116  { std::make_tuple (140, 5700, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
117  { std::make_tuple (144, 5720, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
118  { std::make_tuple (149, 5745, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
119  { std::make_tuple (153, 5765, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
120  { std::make_tuple (157, 5785, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
121  { std::make_tuple (161, 5805, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
122  { std::make_tuple (165, 5825, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
123  { std::make_tuple (169, 5845, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
124  { std::make_tuple (173, 5865, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
125  { std::make_tuple (177, 5885, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
126  { std::make_tuple (181, 5905, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
127  // 40 MHz channels
128  { std::make_tuple (38, 5190, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
129  { std::make_tuple (46, 5230, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
130  { std::make_tuple (54, 5270, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
131  { std::make_tuple (62, 5310, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
132  { std::make_tuple (102, 5510, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
133  { std::make_tuple (110, 5550, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
134  { std::make_tuple (118, 5590, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
135  { std::make_tuple (126, 5630, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
136  { std::make_tuple (134, 5670, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
137  { std::make_tuple (142, 5710, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
138  { std::make_tuple (151, 5755, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
139  { std::make_tuple (159, 5795, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
140  { std::make_tuple (167, 5835, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
141  { std::make_tuple (175, 5875, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
142  // 80 MHz channels
143  { std::make_tuple (42, 5210, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
144  { std::make_tuple (58, 5290, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
145  { std::make_tuple (106, 5530, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
146  { std::make_tuple (122, 5610, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
147  { std::make_tuple (138, 5690, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
148  { std::make_tuple (155, 5775, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
149  { std::make_tuple (171, 5855, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
150  // 160 MHz channels
151  { std::make_tuple (50, 5250, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
152  { std::make_tuple (114, 5570, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
153  { std::make_tuple (163, 5815, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_5GHZ) },
154 
155  // 802.11p 10 MHz channels at the 5.855-5.925 band
156  { std::make_tuple (172, 5860, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
157  { std::make_tuple (174, 5870, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
158  { std::make_tuple (176, 5880, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
159  { std::make_tuple (178, 5890, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
160  { std::make_tuple (180, 5900, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
161  { std::make_tuple (182, 5910, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
162  { std::make_tuple (184, 5920, 10, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
163 
164  // 802.11p 5 MHz channels at the 5.855-5.925 band (for simplification, we consider the same center frequencies as the 10 MHz channels)
165  { std::make_tuple (171, 5860, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
166  { std::make_tuple (173, 5870, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
167  { std::make_tuple (175, 5880, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
168  { std::make_tuple (177, 5890, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
169  { std::make_tuple (179, 5900, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
170  { std::make_tuple (181, 5910, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
171  { std::make_tuple (183, 5920, 5, WIFI_PHY_80211p_CHANNEL, WIFI_PHY_BAND_5GHZ) },
172 
173  // Now the 6 GHz channels (802.11ax only)
174  // 20 MHz channels
175  { std::make_tuple (1, 5945, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
176  { std::make_tuple (5, 5965, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
177  { std::make_tuple (9, 5985, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
178  { std::make_tuple (13, 6005, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
179  { std::make_tuple (17, 6025, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
180  { std::make_tuple (21, 6045, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
181  { std::make_tuple (25, 6065, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
182  { std::make_tuple (29, 6085, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
183  { std::make_tuple (33, 6105, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
184  { std::make_tuple (37, 6125, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
185  { std::make_tuple (41, 6145, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
186  { std::make_tuple (45, 6165, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
187  { std::make_tuple (49, 6185, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
188  { std::make_tuple (53, 6205, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
189  { std::make_tuple (57, 6225, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
190  { std::make_tuple (61, 6245, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
191  { std::make_tuple (65, 6265, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
192  { std::make_tuple (69, 6285, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
193  { std::make_tuple (73, 6305, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
194  { std::make_tuple (77, 6325, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
195  { std::make_tuple (81, 6345, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
196  { std::make_tuple (85, 6365, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
197  { std::make_tuple (89, 6385, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
198  { std::make_tuple (93, 6405, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
199  { std::make_tuple (97, 6425, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
200  { std::make_tuple (101, 6445, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
201  { std::make_tuple (105, 6465, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
202  { std::make_tuple (109, 6485, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
203  { std::make_tuple (113, 6505, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
204  { std::make_tuple (117, 6525, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
205  { std::make_tuple (121, 6545, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
206  { std::make_tuple (125, 6565, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
207  { std::make_tuple (129, 6585, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
208  { std::make_tuple (133, 6605, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
209  { std::make_tuple (137, 6625, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
210  { std::make_tuple (141, 6645, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
211  { std::make_tuple (145, 6665, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
212  { std::make_tuple (149, 6685, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
213  { std::make_tuple (153, 6705, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
214  { std::make_tuple (157, 6725, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
215  { std::make_tuple (161, 6745, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
216  { std::make_tuple (165, 6765, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
217  { std::make_tuple (169, 6785, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
218  { std::make_tuple (173, 6805, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
219  { std::make_tuple (177, 6825, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
220  { std::make_tuple (181, 6845, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
221  { std::make_tuple (185, 6865, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
222  { std::make_tuple (189, 6885, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
223  { std::make_tuple (193, 6905, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
224  { std::make_tuple (197, 6925, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
225  { std::make_tuple (201, 6945, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
226  { std::make_tuple (205, 6965, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
227  { std::make_tuple (209, 6985, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
228  { std::make_tuple (213, 7005, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
229  { std::make_tuple (217, 7025, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
230  { std::make_tuple (221, 7045, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
231  { std::make_tuple (225, 7065, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
232  { std::make_tuple (229, 7085, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
233  { std::make_tuple (233, 7105, 20, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
234  // 40 MHz channels
235  { std::make_tuple (3, 5955, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
236  { std::make_tuple (11, 5995, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
237  { std::make_tuple (19, 6035, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
238  { std::make_tuple (27, 6075, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
239  { std::make_tuple (35, 6115, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
240  { std::make_tuple (43, 6155, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
241  { std::make_tuple (51, 6195, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
242  { std::make_tuple (59, 6235, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
243  { std::make_tuple (67, 6275, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
244  { std::make_tuple (75, 6315, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
245  { std::make_tuple (83, 6355, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
246  { std::make_tuple (91, 6395, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
247  { std::make_tuple (99, 6435, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
248  { std::make_tuple (107, 6475, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
249  { std::make_tuple (115, 6515, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
250  { std::make_tuple (123, 6555, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
251  { std::make_tuple (131, 6595, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
252  { std::make_tuple (139, 6635, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
253  { std::make_tuple (147, 6675, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
254  { std::make_tuple (155, 6715, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
255  { std::make_tuple (163, 6755, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
256  { std::make_tuple (171, 6795, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
257  { std::make_tuple (179, 6835, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
258  { std::make_tuple (187, 6875, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
259  { std::make_tuple (195, 6915, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
260  { std::make_tuple (203, 6955, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
261  { std::make_tuple (211, 6995, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
262  { std::make_tuple (219, 7035, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
263  { std::make_tuple (227, 7075, 40, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
264  // 80 MHz channels
265  { std::make_tuple (7, 5975, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
266  { std::make_tuple (23, 6055, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
267  { std::make_tuple (39, 6135, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
268  { std::make_tuple (55, 6215, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
269  { std::make_tuple (71, 6295, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
270  { std::make_tuple (87, 6375, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
271  { std::make_tuple (103, 6455, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
272  { std::make_tuple (119, 6535, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
273  { std::make_tuple (135, 6615, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
274  { std::make_tuple (151, 6695, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
275  { std::make_tuple (167, 6775, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
276  { std::make_tuple (183, 6855, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
277  { std::make_tuple (199, 6935, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
278  { std::make_tuple (215, 7015, 80, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
279  // 160 MHz channels
280  { std::make_tuple (15, 6015, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
281  { std::make_tuple (47, 6175, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
282  { std::make_tuple (79, 6335, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
283  { std::make_tuple (111, 6495, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
284  { std::make_tuple (143, 6655, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
285  { std::make_tuple (175, 6815, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) },
286  { std::make_tuple (207, 6975, 160, WIFI_PHY_OFDM_CHANNEL, WIFI_PHY_BAND_6GHZ) }
287 };
288 
289 
290 TypeId
292 {
293  static TypeId tid = TypeId ("ns3::WifiPhy")
294  .SetParent<Object> ()
295  .SetGroupName ("Wifi")
296  .AddAttribute ("Frequency",
297  "The center frequency (MHz) of the operating channel. "
298  "If the operating channel for this object has not been set yet, the "
299  "value of this attribute is saved and will be used, along with the channel "
300  "number and width configured via other attributes, to set the operating "
301  "channel when the standard and band are configured. The default value of "
302  "this attribute is 0, which means unspecified center frequency. Note that "
303  "if center frequency and channel number are both 0 when the standard and "
304  "band are configured, a default channel (of the configured width, if any, "
305  "or the default width for the current standard and band, otherwise) is set. "
306  "If the operating channel for this object has been already set, the "
307  "specified center frequency must uniquely identify a channel in the "
308  "band being used.",
309  UintegerValue (0),
312  MakeUintegerChecker<uint16_t> ())
313  .AddAttribute ("ChannelNumber",
314  "The channel number of the operating channel. "
315  "If the operating channel for this object has not been set yet, the "
316  "value of this attribute is saved and will be used, along with the center "
317  "frequency and width configured via other attributes, to set the operating "
318  "channel when the standard and band are configured. The default value of "
319  "this attribute is 0, which means unspecified channel number. Note that "
320  "if center frequency and channel number are both 0 when the standard and "
321  "band are configured, a default channel (of the configured width, if any, "
322  "or the default width for the current standard and band, otherwise) is set. "
323  "If the operating channel for this object has been already set, the "
324  "specified channel number must uniquely identify a channel in the "
325  "band being used.",
326  UintegerValue (0),
329  MakeUintegerChecker<uint8_t> (0, 233))
330  .AddAttribute ("ChannelWidth",
331  "The width in MHz of the operating channel (5, 10, 20, 22, 40, 80 or 160). "
332  "If the operating channel for this object has not been set yet, the "
333  "value of this attribute is saved and will be used, along with the center "
334  "frequency and channel number configured via other attributes, to set the "
335  "operating channel when the standard and band are configured. The default value "
336  "of this attribute is 0, which means unspecified channel width. Note that "
337  "if center frequency and channel number are both 0 when the standard and "
338  "band are configured, a default channel (of the configured width, if any, "
339  "or the default width for the current standard and band, otherwise) is set. "
340  "Do not set this attribute when the standard and band of this object have "
341  "been already configured, because it cannot uniquely identify a channel in "
342  "the band being used.",
343  UintegerValue (0),
346  MakeUintegerChecker<uint16_t> (5, 160))
347  .AddAttribute ("Primary20MHzIndex",
348  "The index of the primary 20 MHz channel within the operating channel "
349  "(0 indicates the 20 MHz subchannel with the lowest center frequency). "
350  "This attribute is only valid if the width of the operating channel is "
351  "a multiple of 20 MHz.",
352  UintegerValue (0),
354  MakeUintegerChecker<uint8_t> (0, 7))
355  .AddAttribute ("RxSensitivity",
356  "The energy of a received signal should be higher than "
357  "this threshold (dBm) for the PHY to detect the signal. "
358  "This threshold refers to a width of 20 MHz and will be "
359  "scaled to match the width of the received signal.",
360  DoubleValue (-101.0),
363  MakeDoubleChecker<double> ())
364  .AddAttribute ("CcaEdThreshold",
365  "The energy of a non Wi-Fi received signal should be higher than "
366  "this threshold (dBm) to allow the PHY layer to declare CCA BUSY state. "
367  "This check is performed on the 20 MHz primary channel only.",
368  DoubleValue (-62.0),
371  MakeDoubleChecker<double> ())
372  .AddAttribute ("TxGain",
373  "Transmission gain (dB).",
374  DoubleValue (0.0),
377  MakeDoubleChecker<double> ())
378  .AddAttribute ("RxGain",
379  "Reception gain (dB).",
380  DoubleValue (0.0),
383  MakeDoubleChecker<double> ())
384  .AddAttribute ("TxPowerLevels",
385  "Number of transmission power levels available between "
386  "TxPowerStart and TxPowerEnd included.",
387  UintegerValue (1),
389  MakeUintegerChecker<uint8_t> ())
390  .AddAttribute ("TxPowerEnd",
391  "Maximum available transmission level (dBm).",
392  DoubleValue (16.0206),
395  MakeDoubleChecker<double> ())
396  .AddAttribute ("TxPowerStart",
397  "Minimum available transmission level (dBm).",
398  DoubleValue (16.0206),
401  MakeDoubleChecker<double> ())
402  .AddAttribute ("RxNoiseFigure",
403  "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
404  " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
405  "\"the difference in decibels (dB) between"
406  " the noise output of the actual receiver to the noise output of an "
407  " ideal receiver with the same overall gain and bandwidth when the receivers "
408  " are connected to sources at the standard noise temperature T0 (usually 290 K)\".",
409  DoubleValue (7),
411  MakeDoubleChecker<double> ())
412  .AddAttribute ("State",
413  "The state of the PHY layer.",
414  PointerValue (),
416  MakePointerChecker<WifiPhyStateHelper> ())
417  .AddAttribute ("ChannelSwitchDelay",
418  "Delay between two short frames transmitted on different frequencies.",
419  TimeValue (MicroSeconds (250)),
421  MakeTimeChecker ())
422  .AddAttribute ("Antennas",
423  "The number of antennas on the device.",
424  UintegerValue (1),
427  MakeUintegerChecker<uint8_t> (1, 8))
428  .AddAttribute ("MaxSupportedTxSpatialStreams",
429  "The maximum number of supported TX spatial streams."
430  "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
431  UintegerValue (1),
434  MakeUintegerChecker<uint8_t> (1, 8))
435  .AddAttribute ("MaxSupportedRxSpatialStreams",
436  "The maximum number of supported RX spatial streams."
437  "This parameter is only valuable for 802.11n/ac/ax STAs and APs.",
438  UintegerValue (1),
441  MakeUintegerChecker<uint8_t> (1, 8))
442  .AddAttribute ("ShortPlcpPreambleSupported",
443  "Whether or not short PHY preamble is supported."
444  "This parameter is only valuable for 802.11b STAs and APs."
445  "Note: 802.11g APs and STAs always support short PHY preamble.",
446  BooleanValue (false),
450  .AddAttribute ("FrameCaptureModel",
451  "Ptr to an object that implements the frame capture model",
452  PointerValue (),
454  MakePointerChecker <FrameCaptureModel> ())
455  .AddAttribute ("PreambleDetectionModel",
456  "Ptr to an object that implements the preamble detection model",
457  PointerValue (),
459  MakePointerChecker <PreambleDetectionModel> ())
460  .AddAttribute ("PostReceptionErrorModel",
461  "An optional packet error model can be added to the receive "
462  "packet process after any propagation-based (SNR-based) error "
463  "models have been applied. Typically this is used to force "
464  "specific packet drops, for testing purposes.",
465  PointerValue (),
467  MakePointerChecker<ErrorModel> ())
468  .AddAttribute ("Sifs",
469  "The duration of the Short Interframe Space. "
470  "NOTE that the default value is overwritten by the value defined "
471  "by the standard; if you want to set this attribute, you have to "
472  "do it after that the PHY object is initialized.",
473  TimeValue (MicroSeconds (0)),
475  MakeTimeChecker ())
476  .AddAttribute ("Slot",
477  "The duration of a slot. "
478  "NOTE that the default value is overwritten by the value defined "
479  "by the standard; if you want to set this attribute, you have to "
480  "do it after that the PHY object is initialized.",
481  TimeValue (MicroSeconds (0)),
483  MakeTimeChecker ())
484  .AddAttribute ("Pifs",
485  "The duration of the PCF Interframe Space. "
486  "NOTE that the default value is overwritten by the value defined "
487  "by the standard; if you want to set this attribute, you have to "
488  "do it after that the PHY object is initialized.",
489  TimeValue (MicroSeconds (0)),
491  MakeTimeChecker ())
492  .AddAttribute ("PowerDensityLimit",
493  "The mean equivalent isotropically radiated power density"
494  "limit (in dBm/MHz) set by regulators.",
495  DoubleValue (100.0), //set to a high value so as to have no effect
497  MakeDoubleChecker<double> ())
498  .AddTraceSource ("PhyTxBegin",
499  "Trace source indicating a packet "
500  "has begun transmitting over the channel medium",
502  "ns3::WifiPhy::PhyTxBeginTracedCallback")
503  .AddTraceSource ("PhyTxPsduBegin",
504  "Trace source indicating a PSDU "
505  "has begun transmitting over the channel medium",
507  "ns3::WifiPhy::PsduTxBeginCallback")
508  .AddTraceSource ("PhyTxEnd",
509  "Trace source indicating a packet "
510  "has been completely transmitted over the channel.",
512  "ns3::Packet::TracedCallback")
513  .AddTraceSource ("PhyTxDrop",
514  "Trace source indicating a packet "
515  "has been dropped by the device during transmission",
517  "ns3::Packet::TracedCallback")
518  .AddTraceSource ("PhyRxBegin",
519  "Trace source indicating a packet "
520  "has begun being received from the channel medium "
521  "by the device",
523  "ns3::WifiPhy::PhyRxBeginTracedCallback")
524  .AddTraceSource ("PhyRxPayloadBegin",
525  "Trace source indicating the reception of the "
526  "payload of a PPDU has begun",
528  "ns3::WifiPhy::PhyRxPayloadBeginTracedCallback")
529  .AddTraceSource ("PhyRxEnd",
530  "Trace source indicating a packet "
531  "has been completely received from the channel medium "
532  "by the device",
534  "ns3::Packet::TracedCallback")
535  .AddTraceSource ("PhyRxDrop",
536  "Trace source indicating a packet "
537  "has been dropped by the device during reception",
539  "ns3::Packet::TracedCallback")
540  .AddTraceSource ("MonitorSnifferRx",
541  "Trace source simulating a wifi device in monitor mode "
542  "sniffing all received frames",
544  "ns3::WifiPhy::MonitorSnifferRxTracedCallback")
545  .AddTraceSource ("MonitorSnifferTx",
546  "Trace source simulating the capability of a wifi device "
547  "in monitor mode to sniff all frames being transmitted",
549  "ns3::WifiPhy::MonitorSnifferTxTracedCallback")
550  ;
551  return tid;
552 }
553 
555  : m_txMpduReferenceNumber (0xffffffff),
556  m_rxMpduReferenceNumber (0xffffffff),
557  m_endPhyRxEvent (),
558  m_endTxEvent (),
559  m_currentEvent (0),
560  m_previouslyRxPpduUid (UINT64_MAX),
561  m_standard (WIFI_PHY_STANDARD_UNSPECIFIED),
562  m_band (WIFI_PHY_BAND_UNSPECIFIED),
563  m_initialFrequency (0),
564  m_initialChannelNumber (0),
565  m_initialChannelWidth (0),
566  m_initialPrimary20Index (0),
567  m_sifs (Seconds (0)),
568  m_slot (Seconds (0)),
569  m_pifs (Seconds (0)),
570  m_ackTxTime (Seconds (0)),
571  m_blockAckTxTime (Seconds (0)),
572  m_powerRestricted (false),
573  m_channelAccessRequested (false),
574  m_txSpatialStreams (0),
575  m_rxSpatialStreams (0),
576  m_wifiRadioEnergyModel (0),
577  m_timeLastPreambleDetected (Seconds (0))
578 {
579  NS_LOG_FUNCTION (this);
580  m_random = CreateObject<UniformRandomVariable> ();
581  m_state = CreateObject<WifiPhyStateHelper> ();
582 }
583 
585 {
586  NS_LOG_FUNCTION (this);
587 }
588 
589 void
591 {
592  NS_LOG_FUNCTION (this);
593  m_endTxEvent.Cancel ();
595  for (auto & phyEntity : m_phyEntities)
596  {
597  phyEntity.second->CancelAllEvents ();
598  }
599  m_device = 0;
600  m_mobility = 0;
606  m_random = 0;
607  m_state = 0;
608  m_currentEvent = 0;
609  for (auto & preambleEvent : m_currentPreambleEvents)
610  {
611  preambleEvent.second = 0;
612  }
613  m_currentPreambleEvents.clear ();
614 
615  for (auto & phyEntity : m_phyEntities)
616  {
617  phyEntity.second = 0;
618  }
619  m_phyEntities.clear ();
620 }
621 
622 std::map<WifiModulationClass, Ptr<PhyEntity> > &
624 {
625  static std::map<WifiModulationClass, Ptr<PhyEntity> > g_staticPhyEntities;
626  return g_staticPhyEntities;
627 }
628 
630 WifiPhy::GetState (void) const
631 {
632  return m_state;
633 }
634 
635 void
637 {
638  m_state->SetReceiveOkCallback (callback);
639 }
640 
641 void
643 {
644  m_state->SetReceiveErrorCallback (callback);
645 }
646 
647 void
649 {
650  m_state->RegisterListener (listener);
651 }
652 
653 void
655 {
656  m_state->UnregisterListener (listener);
657 }
658 
659 void
661 {
663 }
664 
665 void
666 WifiPhy::SetRxSensitivity (double threshold)
667 {
668  NS_LOG_FUNCTION (this << threshold);
669  m_rxSensitivityW = DbmToW (threshold);
670 }
671 
672 double
674 {
675  return WToDbm (m_rxSensitivityW);
676 }
677 
678 void
679 WifiPhy::SetCcaEdThreshold (double threshold)
680 {
681  NS_LOG_FUNCTION (this << threshold);
682  m_ccaEdThresholdW = DbmToW (threshold);
683 }
684 
685 double
687 {
688  return WToDbm (m_ccaEdThresholdW);
689 }
690 
691 void
692 WifiPhy::SetRxNoiseFigure (double noiseFigureDb)
693 {
694  NS_LOG_FUNCTION (this << noiseFigureDb);
695  m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb));
697 }
698 
699 void
701 {
702  NS_LOG_FUNCTION (this << start);
704 }
705 
706 double
708 {
709  return m_txPowerBaseDbm;
710 }
711 
712 void
714 {
715  NS_LOG_FUNCTION (this << end);
716  m_txPowerEndDbm = end;
717 }
718 
719 double
721 {
722  return m_txPowerEndDbm;
723 }
724 
725 void
727 {
728  NS_LOG_FUNCTION (this << +n);
729  m_nTxPower = n;
730 }
731 
732 uint8_t
734 {
735  return m_nTxPower;
736 }
737 
738 void
739 WifiPhy::SetTxGain (double gain)
740 {
741  NS_LOG_FUNCTION (this << gain);
742  m_txGainDb = gain;
743 }
744 
745 double
746 WifiPhy::GetTxGain (void) const
747 {
748  return m_txGainDb;
749 }
750 
751 void
752 WifiPhy::SetRxGain (double gain)
753 {
754  NS_LOG_FUNCTION (this << gain);
755  m_rxGainDb = gain;
756 }
757 
758 double
759 WifiPhy::GetRxGain (void) const
760 {
761  return m_rxGainDb;
762 }
763 
764 void
766 {
767  NS_LOG_FUNCTION (this << enable);
768  m_shortPreamble = enable;
769 }
770 
771 bool
773 {
774  return m_shortPreamble;
775 }
776 
777 void
779 {
780  m_device = device;
781 }
782 
784 WifiPhy::GetDevice (void) const
785 {
786  return m_device;
787 }
788 
789 void
791 {
793 }
794 
797 {
798  if (m_mobility != 0)
799  {
800  return m_mobility;
801  }
802  else
803  {
804  return m_device->GetNode ()->GetObject<MobilityModel> ();
805  }
806 }
807 
808 void
810 {
813 }
814 
815 void
817 {
818  NS_LOG_FUNCTION (this << em);
820 }
821 
822 void
824 {
825  m_frameCaptureModel = model;
826 }
827 
828 void
830 {
831  m_preambleDetectionModel = model;
832 }
833 
834 void
836 {
837  m_wifiRadioEnergyModel = wifiRadioEnergyModel;
838 }
839 
840 double
841 WifiPhy::GetPowerDbm (uint8_t power) const
842 {
844  NS_ASSERT (m_nTxPower > 0);
845  double dbm;
846  if (m_nTxPower > 1)
847  {
848  dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / (m_nTxPower - 1);
849  }
850  else
851  {
852  NS_ASSERT_MSG (m_txPowerBaseDbm == m_txPowerEndDbm, "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
853  dbm = m_txPowerBaseDbm;
854  }
855  return dbm;
856 }
857 
858 Time
860 {
861  return m_channelSwitchDelay;
862 }
863 
864 double
865 WifiPhy::CalculateSnr (const WifiTxVector& txVector, double ber) const
866 {
867  return m_interference.GetErrorRateModel ()->CalculateSnr (txVector, ber);
868 }
869 
872 {
873  const auto it = GetStaticPhyEntities ().find (modulation);
874  NS_ABORT_MSG_IF (it == GetStaticPhyEntities ().end (), "Unimplemented Wi-Fi modulation class");
875  return it->second;
876 }
877 
880 {
881  const auto it = m_phyEntities.find (modulation);
882  NS_ABORT_MSG_IF (it == m_phyEntities.end (), "Unsupported Wi-Fi modulation class");
883  return it->second;
884 }
885 
886 void
888 {
889  NS_LOG_FUNCTION (modulation);
890  NS_ASSERT_MSG (GetStaticPhyEntities ().find (modulation) == GetStaticPhyEntities ().end (), "The PHY entity has already been added. The setting should only be done once per modulation class");
891  GetStaticPhyEntities ()[modulation] = phyEntity;
892 }
893 
894 void
896 {
897  NS_LOG_FUNCTION (this << modulation);
898  NS_ABORT_MSG_IF (GetStaticPhyEntities ().find (modulation) == GetStaticPhyEntities ().end (), "Cannot add an unimplemented PHY to supported list. Update the former first.");
899  NS_ASSERT_MSG (m_phyEntities.find (modulation) == m_phyEntities.end (), "The PHY entity has already been added. The setting should only be done once per modulation class");
900  phyEntity->SetOwner (this);
901  m_phyEntities[modulation] = phyEntity;
902 }
903 
904 void
906 {
907  m_sifs = sifs;
908 }
909 
910 Time
911 WifiPhy::GetSifs (void) const
912 {
913  return m_sifs;
914 }
915 
916 void
918 {
919  m_slot = slot;
920 }
921 
922 Time
923 WifiPhy::GetSlot (void) const
924 {
925  return m_slot;
926 }
927 
928 void
930 {
931  m_pifs = pifs;
932 }
933 
934 Time
935 WifiPhy::GetPifs (void) const
936 {
937  return m_pifs;
938 }
939 
940 Time
942 {
943  return m_ackTxTime;
944 }
945 
946 Time
948 {
949  return m_blockAckTxTime;
950 }
951 
952 void
954 {
955  NS_LOG_FUNCTION (this);
956  AddPhyEntity (WIFI_MOD_CLASS_OFDM, Create<OfdmPhy> ());
957 
958  // See Table 17-21 "OFDM PHY characteristics" of 802.11-2016
959  SetSifs (MicroSeconds (16));
960  SetSlot (MicroSeconds (9));
961  SetPifs (GetSifs () + GetSlot ());
962  // See Table 10-5 "Determination of the EstimatedAckTxTime based on properties
963  // of the PPDU causing the EIFS" of 802.11-2016
964  m_ackTxTime = MicroSeconds (44);
965 }
966 
967 void
969 {
970  NS_LOG_FUNCTION (this);
971  Ptr<DsssPhy> phyEntity = Create<DsssPhy> ();
973  AddPhyEntity (WIFI_MOD_CLASS_DSSS, phyEntity); //when plain DSSS modes are used
974 
975  // See Table 16-4 "HR/DSSS PHY characteristics" of 802.11-2016
976  SetSifs (MicroSeconds (10));
977  SetSlot (MicroSeconds (20));
978  SetPifs (GetSifs () + GetSlot ());
979  // See Table 10-5 "Determination of the EstimatedAckTxTime based on properties
980  // of the PPDU causing the EIFS" of 802.11-2016
981  m_ackTxTime = MicroSeconds (304);
982 }
983 
984 void
986 {
987  NS_LOG_FUNCTION (this);
988  // See Table 18-5 "ERP characteristics" of 802.11-2016
989  // Slot time defaults to the "long slot time" of 20 us in the standard
990  // according to mixed 802.11b/g deployments. Short slot time is enabled
991  // if the user sets the ShortSlotTimeSupported flag to true and when the BSS
992  // consists of only ERP STAs capable of supporting this option.
993  Configure80211b ();
994  AddPhyEntity (WIFI_MOD_CLASS_ERP_OFDM, Create<ErpOfdmPhy> ());
995 }
996 
997 void
999 {
1000  NS_LOG_FUNCTION (this);
1001  if (GetChannelWidth () == 10)
1002  {
1003  AddPhyEntity (WIFI_MOD_CLASS_OFDM, Create<OfdmPhy> (OFDM_PHY_10_MHZ));
1004 
1005  // See Table 17-21 "OFDM PHY characteristics" of 802.11-2016
1006  SetSifs (MicroSeconds (32));
1007  SetSlot (MicroSeconds (13));
1008  SetPifs (GetSifs () + GetSlot ());
1009  m_ackTxTime = MicroSeconds (88);
1010  }
1011  else if (GetChannelWidth () == 5)
1012  {
1013  AddPhyEntity (WIFI_MOD_CLASS_OFDM, Create<OfdmPhy> (OFDM_PHY_5_MHZ));
1014 
1015  // See Table 17-21 "OFDM PHY characteristics" of 802.11-2016
1016  SetSifs (MicroSeconds (64));
1017  SetSlot (MicroSeconds (21));
1018  SetPifs (GetSifs () + GetSlot ());
1019  m_ackTxTime = MicroSeconds (176);
1020  }
1021  else
1022  {
1023  NS_FATAL_ERROR ("802.11p configured with a wrong channel width!");
1024  }
1025 }
1026 
1027 void
1029 {
1030  NS_LOG_FUNCTION (this);
1032  {
1033  Configure80211g ();
1034  }
1035  else
1036  {
1037  Configure80211a ();
1038  }
1040 
1041  // See Table 10-5 "Determination of the EstimatedAckTxTime based on properties
1042  // of the PPDU causing the EIFS" of 802.11-2016
1044 }
1045 
1046 void
1048 {
1049  NS_LOG_FUNCTION (this);
1050  Configure80211n ();
1051  AddPhyEntity (WIFI_MOD_CLASS_VHT, Create<VhtPhy> ());
1052 }
1053 
1054 void
1056 {
1057  NS_LOG_FUNCTION (this);
1059  {
1060  Configure80211n ();
1061  }
1062  else
1063  {
1064  Configure80211ac ();
1065  }
1066  AddPhyEntity (WIFI_MOD_CLASS_HE, Create<HePhy> ());
1067 }
1068 
1069 void
1071 {
1072  NS_LOG_FUNCTION (this << standard << band);
1073  m_standard = standard;
1074  m_band = band;
1075 
1076  if (m_initialFrequency == 0 && m_initialChannelNumber == 0)
1077  {
1078  // set a default channel if the user did not specify anything
1079  if (m_initialChannelWidth == 0)
1080  {
1081  // set a default channel width
1083  }
1084 
1086  }
1087  else
1088  {
1090  m_standard, m_band);
1091  }
1093 
1094  switch (standard)
1095  {
1097  Configure80211a ();
1098  break;
1100  Configure80211b ();
1101  break;
1103  Configure80211g ();
1104  break;
1106  Configure80211p ();
1107  break;
1109  Configure80211n ();
1110  break;
1112  Configure80211ac ();
1113  break;
1115  Configure80211ax ();
1116  break;
1118  default:
1119  NS_ASSERT_MSG (false, "Unsupported standard");
1120  break;
1121  }
1122 }
1123 
1126 {
1127  return m_band;
1128 }
1129 
1130 
1133 {
1134  return m_standard;
1135 }
1136 
1139 {
1140  return m_operatingChannel;
1141 }
1142 
1143 void
1144 WifiPhy::SetFrequency (uint16_t frequency)
1145 {
1146  NS_LOG_FUNCTION (this << frequency);
1147 
1148  if (!m_operatingChannel.IsSet ())
1149  {
1150  // ConfigureStandardAndBand has not been called yet, so store the frequency
1151  // into m_initialFrequency
1152  NS_LOG_DEBUG ("Saving frequency configuration for initialization");
1153  m_initialFrequency = frequency;
1154  return;
1155  }
1156 
1157  if (GetFrequency () == frequency)
1158  {
1159  NS_LOG_DEBUG ("No frequency change requested");
1160  return;
1161  }
1162 
1163  // if the frequency does not uniquely identify an operating channel,
1164  // the simulation aborts
1165  SetOperatingChannel (0, frequency, 0);
1166 }
1167 
1168 uint16_t
1170 {
1171  return m_operatingChannel.GetFrequency ();
1172 }
1173 
1174 void
1176 {
1177  NS_LOG_FUNCTION (this << +nch);
1178 
1179  if (!m_operatingChannel.IsSet ())
1180  {
1181  // ConfigureStandardAndBand has not been called yet, so store the channel
1182  // into m_initialChannelNumber
1183  NS_LOG_DEBUG ("Saving channel number configuration for initialization");
1184  m_initialChannelNumber = nch;
1185  return;
1186  }
1187 
1188  if (GetChannelNumber () == nch)
1189  {
1190  NS_LOG_DEBUG ("No channel change requested");
1191  return;
1192  }
1193 
1194  // if the channel number does not uniquely identify an operating channel,
1195  // the simulation aborts
1196  SetOperatingChannel (nch, 0, 0);
1197 }
1198 
1199 uint8_t
1201 {
1202  return m_operatingChannel.GetNumber ();
1203 }
1204 
1205 void
1206 WifiPhy::SetChannelWidth (uint16_t channelWidth)
1207 {
1208  NS_LOG_FUNCTION (this << channelWidth);
1209 
1210  if (channelWidth != 0)
1211  {
1212  AddSupportedChannelWidth (channelWidth);
1213  }
1214 
1215  if (!m_operatingChannel.IsSet ())
1216  {
1217  // ConfigureStandardAndBand has not been called yet, so store the channel width
1218  // into m_initialChannelWidth
1219  NS_LOG_DEBUG ("Saving channel width configuration for initialization");
1220  m_initialChannelWidth = channelWidth;
1221  return;
1222  }
1223 
1224  if (GetChannelWidth () == channelWidth)
1225  {
1226  NS_LOG_DEBUG ("No channel width change requested");
1227  return;
1228  }
1229 
1230  NS_ABORT_MSG ("The channel width does not uniquely identify an operating channel.");
1231 }
1232 
1233 uint16_t
1235 {
1236  return m_operatingChannel.GetWidth ();
1237 }
1238 
1239 void
1241 {
1242  NS_LOG_FUNCTION (this << +index);
1243 
1244  if (!m_operatingChannel.IsSet ())
1245  {
1246  // ConfigureStandardAndBand has not been called yet, so store the primary20
1247  // index into m_initialPrimary20Index
1248  NS_LOG_DEBUG ("Saving primary20 index configuration for initialization");
1249  m_initialPrimary20Index = index;
1250  return;
1251  }
1252 
1254 }
1255 
1256 void
1257 WifiPhy::SetOperatingChannel (uint8_t number, uint16_t frequency, uint16_t width)
1258 {
1259  Time delay = Seconds (0);
1260 
1261  if (IsInitialized ())
1262  {
1263  delay = DoChannelSwitch ();
1264  }
1265 
1266  if (delay.IsStrictlyNegative ())
1267  {
1268  // switching channel is not possible now
1269  return;
1270  }
1271  if (delay.IsStrictlyPositive ())
1272  {
1273  // switching channel has been postponed
1274  Simulator::Schedule (delay, &WifiPhy::SetOperatingChannel, this, number, frequency, width);
1275  return;
1276  }
1277 
1278  // channel can be switched now.
1279  uint16_t prevChannelWidth = 0;
1280  if (m_operatingChannel.IsSet ())
1281  {
1282  prevChannelWidth = GetChannelWidth ();
1283  }
1284 
1285  m_operatingChannel.Set (number, frequency, width, m_standard, m_band);
1286 
1287  if (GetChannelWidth () != prevChannelWidth)
1288  {
1290 
1291  // If channel width changed after initialization, invoke the capabilities changed callback
1293  {
1295  }
1296  }
1297 }
1298 
1299 Time
1301 {
1302  m_powerRestricted = false;
1303  m_channelAccessRequested = false;
1304  m_currentEvent = 0;
1305  m_currentPreambleEvents.clear ();
1306  if (!IsInitialized ())
1307  {
1308  //this is not channel switch, this is initialization
1309  NS_LOG_DEBUG ("Before initialization, nothing to do");
1310  return Seconds (0);
1311  }
1312 
1313  Time delay = Seconds (0);
1314 
1316  switch (m_state->GetState ())
1317  {
1318  case WifiPhyState::RX:
1319  NS_LOG_DEBUG ("drop packet because of channel switching while reception");
1321  for (auto & phyEntity : m_phyEntities)
1322  {
1323  phyEntity.second->CancelAllEvents ();
1324  }
1325  break;
1326  case WifiPhyState::TX:
1327  NS_LOG_DEBUG ("channel switching postponed until end of current transmission");
1328  delay = GetDelayUntilIdle ();
1329  break;
1331  case WifiPhyState::IDLE:
1332  for (auto & phyEntity : m_phyEntities)
1333  {
1334  phyEntity.second->CancelAllEvents ();
1335  }
1336  break;
1337  case WifiPhyState::SLEEP:
1338  NS_LOG_DEBUG ("channel switching ignored in sleep mode");
1339  delay = Seconds (-1); // negative value to indicate switching not possible
1340  break;
1341  default:
1342  NS_ASSERT (false);
1343  break;
1344  }
1345 
1346  if (delay.IsZero ())
1347  {
1348  // channel switch can be done now
1349  NS_LOG_DEBUG ("switching channel");
1350  m_state->SwitchToChannelSwitching (GetChannelSwitchDelay ());
1352  /*
1353  * Needed here to be able to correctly sensed the medium for the first
1354  * time after the switching. The actual switching is not performed until
1355  * after m_channelSwitchDelay. Packets received during the switching
1356  * state are added to the event list and are employed later to figure
1357  * out the state of the medium after the switching.
1358  */
1359  }
1360 
1361  return delay;
1362 }
1363 
1364 void
1366 {
1367  NS_ASSERT_MSG (antennas > 0 && antennas <= 4, "unsupported number of antennas");
1368  m_numberOfAntennas = antennas;
1370 }
1371 
1372 uint8_t
1374 {
1375  return m_numberOfAntennas;
1376 }
1377 
1378 void
1380 {
1381  NS_ASSERT (streams <= GetNumberOfAntennas ());
1382  bool changed = (m_txSpatialStreams != streams);
1383  m_txSpatialStreams = streams;
1384  if (changed)
1385  {
1386  auto phyEntity = m_phyEntities.find (WIFI_MOD_CLASS_HT);
1387  if (phyEntity != m_phyEntities.end ())
1388  {
1389  Ptr<HtPhy> htPhy = DynamicCast<HtPhy> (phyEntity->second);
1390  if (htPhy)
1391  {
1392  htPhy->SetMaxSupportedNss (m_txSpatialStreams); //this is essential to have the right MCSs configured
1393  }
1394 
1396  {
1398  }
1399  }
1400  }
1401 }
1402 
1403 uint8_t
1405 {
1406  return m_txSpatialStreams;
1407 }
1408 
1409 void
1411 {
1412  NS_ASSERT (streams <= GetNumberOfAntennas ());
1413  bool changed = (m_rxSpatialStreams != streams);
1414  m_rxSpatialStreams = streams;
1415  if (changed && !m_capabilitiesChangedCallback.IsNull ())
1416  {
1418  }
1419 }
1420 
1421 uint8_t
1423 {
1424  return m_rxSpatialStreams;
1425 }
1426 
1427 std::list<uint8_t>
1429 {
1430  std::list<uint8_t> list;
1431  for (const auto & phyEntity : m_phyEntities)
1432  {
1433  Ptr<HtPhy> htPhy = DynamicCast<HtPhy> (phyEntity.second);
1434  if (htPhy)
1435  {
1436  list.emplace_back (htPhy->GetBssMembershipSelector ());
1437  }
1438  }
1439  return list;
1440 }
1441 
1442 void
1444 {
1445  NS_LOG_FUNCTION (this << width);
1446  for (std::vector<uint32_t>::size_type i = 0; i != m_supportedChannelWidthSet.size (); i++)
1447  {
1448  if (m_supportedChannelWidthSet[i] == width)
1449  {
1450  return;
1451  }
1452  }
1453  NS_LOG_FUNCTION ("Adding " << width << " to supported channel width set");
1454  m_supportedChannelWidthSet.push_back (width);
1455 }
1456 
1457 std::vector<uint16_t>
1459 {
1461 }
1462 
1463 void
1465 {
1466  NS_LOG_FUNCTION (this);
1467  m_powerRestricted = false;
1468  m_channelAccessRequested = false;
1469  switch (m_state->GetState ())
1470  {
1471  case WifiPhyState::TX:
1472  NS_LOG_DEBUG ("setting sleep mode postponed until end of current transmission");
1474  break;
1475  case WifiPhyState::RX:
1476  NS_LOG_DEBUG ("setting sleep mode postponed until end of current reception");
1478  break;
1480  NS_LOG_DEBUG ("setting sleep mode postponed until end of channel switching");
1482  break;
1484  case WifiPhyState::IDLE:
1485  NS_LOG_DEBUG ("setting sleep mode");
1486  m_state->SwitchToSleep ();
1487  break;
1488  case WifiPhyState::SLEEP:
1489  NS_LOG_DEBUG ("already in sleep mode");
1490  break;
1491  default:
1492  NS_ASSERT (false);
1493  break;
1494  }
1495 }
1496 
1497 void
1499 {
1500  NS_LOG_FUNCTION (this);
1501  m_powerRestricted = false;
1502  m_channelAccessRequested = false;
1504  m_endTxEvent.Cancel ();
1505  for (auto & phyEntity : m_phyEntities)
1506  {
1507  phyEntity.second->CancelAllEvents ();
1508  }
1509  m_state->SwitchToOff ();
1510 }
1511 
1512 void
1514 {
1515  NS_LOG_FUNCTION (this);
1516  m_currentPreambleEvents.clear ();
1517  switch (m_state->GetState ())
1518  {
1519  case WifiPhyState::TX:
1520  case WifiPhyState::RX:
1521  case WifiPhyState::IDLE:
1524  {
1525  NS_LOG_DEBUG ("not in sleep mode, there is nothing to resume");
1526  break;
1527  }
1528  case WifiPhyState::SLEEP:
1529  {
1530  NS_LOG_DEBUG ("resuming from sleep mode");
1532  m_state->SwitchFromSleep (delayUntilCcaEnd);
1533  break;
1534  }
1535  default:
1536  {
1537  NS_ASSERT (false);
1538  break;
1539  }
1540  }
1541 }
1542 
1543 void
1545 {
1546  NS_LOG_FUNCTION (this);
1547  switch (m_state->GetState ())
1548  {
1549  case WifiPhyState::TX:
1550  case WifiPhyState::RX:
1551  case WifiPhyState::IDLE:
1554  case WifiPhyState::SLEEP:
1555  {
1556  NS_LOG_DEBUG ("not in off mode, there is nothing to resume");
1557  break;
1558  }
1559  case WifiPhyState::OFF:
1560  {
1561  NS_LOG_DEBUG ("resuming from off mode");
1563  m_state->SwitchFromOff (delayUntilCcaEnd);
1564  break;
1565  }
1566  default:
1567  {
1568  NS_ASSERT (false);
1569  break;
1570  }
1571  }
1572 }
1573 
1574 Time
1576 {
1577  return MicroSeconds (4);
1578 }
1579 
1580 Time
1582 {
1583  return MicroSeconds (4);
1584 }
1585 
1586 Time
1587 WifiPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype, uint16_t staId)
1588 {
1589  uint32_t totalAmpduSize;
1590  double totalAmpduNumSymbols;
1591  return GetPayloadDuration (size, txVector, band, mpdutype, false, totalAmpduSize, totalAmpduNumSymbols, staId);
1592 }
1593 
1594 Time
1595 WifiPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
1596  bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
1597  uint16_t staId)
1598 {
1599  return GetStaticPhyEntity (txVector.GetModulationClass ())->GetPayloadDuration (size, txVector, band, mpdutype,
1600  incFlag, totalAmpduSize, totalAmpduNumSymbols,
1601  staId);
1602 }
1603 
1604 Time
1606 {
1607  return GetStaticPhyEntity (txVector.GetModulationClass ())->CalculatePhyPreambleAndHeaderDuration (txVector);
1608 }
1609 
1610 Time
1611 WifiPhy::CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, uint16_t staId)
1612 {
1613  Time duration = CalculatePhyPreambleAndHeaderDuration (txVector)
1614  + GetPayloadDuration (size, txVector, band, NORMAL_MPDU, staId);
1615  NS_ASSERT (duration.IsStrictlyPositive ());
1616  return duration;
1617 }
1618 
1619 Time
1621 {
1622  return CalculateTxDuration (GetWifiConstPsduMap (psdu, txVector), txVector, band);
1623 }
1624 
1625 Time
1627 {
1628  return GetStaticPhyEntity (txVector.GetModulationClass ())->CalculateTxDuration (psduMap, txVector, band);
1629 }
1630 
1631 uint32_t
1633 {
1634  return GetStaticPhyEntity (modulation)->GetMaxPsduSize ();
1635 }
1636 
1637 void
1639 {
1640  if (!m_phyTxBeginTrace.IsEmpty ())
1641  {
1642  for (auto const& psdu : psdus)
1643  {
1644  for (auto& mpdu : *PeekPointer (psdu.second))
1645  {
1646  m_phyTxBeginTrace (mpdu->GetProtocolDataUnit (), txPowerW);
1647  }
1648  }
1649  }
1650 }
1651 
1652 void
1654 {
1655  if (!m_phyTxEndTrace.IsEmpty ())
1656  {
1657  for (auto const& psdu : psdus)
1658  {
1659  for (auto& mpdu : *PeekPointer (psdu.second))
1660  {
1661  m_phyTxEndTrace (mpdu->GetProtocolDataUnit ());
1662  }
1663  }
1664  }
1665 }
1666 
1667 void
1669 {
1670  if (!m_phyTxDropTrace.IsEmpty ())
1671  {
1672  for (auto& mpdu : *PeekPointer (psdu))
1673  {
1674  m_phyTxDropTrace (mpdu->GetProtocolDataUnit ());
1675  }
1676  }
1677 }
1678 
1679 void
1681 {
1682  if (psdu && !m_phyRxBeginTrace.IsEmpty ())
1683  {
1684  for (auto& mpdu : *PeekPointer (psdu))
1685  {
1686  m_phyRxBeginTrace (mpdu->GetProtocolDataUnit (), rxPowersW);
1687  }
1688  }
1689 }
1690 
1691 void
1693 {
1694  if (psdu && !m_phyRxEndTrace.IsEmpty ())
1695  {
1696  for (auto& mpdu : *PeekPointer (psdu))
1697  {
1698  m_phyRxEndTrace (mpdu->GetProtocolDataUnit ());
1699  }
1700  }
1701 }
1702 
1703 void
1705 {
1706  if (psdu && !m_phyRxDropTrace.IsEmpty ())
1707  {
1708  for (auto& mpdu : *PeekPointer (psdu))
1709  {
1710  m_phyRxDropTrace (mpdu->GetProtocolDataUnit (), reason);
1711  }
1712  }
1713 }
1714 
1715 void
1716 WifiPhy::NotifyMonitorSniffRx (Ptr<const WifiPsdu> psdu, uint16_t channelFreqMhz, WifiTxVector txVector,
1717  SignalNoiseDbm signalNoise, std::vector<bool> statusPerMpdu, uint16_t staId)
1718 {
1719  MpduInfo aMpdu;
1720  if (psdu->IsAggregate ())
1721  {
1722  //Expand A-MPDU
1723  NS_ASSERT_MSG (txVector.IsAggregation (), "TxVector with aggregate flag expected here according to PSDU");
1725  size_t nMpdus = psdu->GetNMpdus ();
1726  NS_ASSERT_MSG (statusPerMpdu.size () == nMpdus, "Should have one reception status per MPDU");
1727  if (!m_phyMonitorSniffRxTrace.IsEmpty ())
1728  {
1729  aMpdu.type = (psdu->IsSingle ()) ? SINGLE_MPDU : FIRST_MPDU_IN_AGGREGATE;
1730  for (size_t i = 0; i < nMpdus;)
1731  {
1732  if (statusPerMpdu.at (i)) //packet received without error, hand over to sniffer
1733  {
1734  m_phyMonitorSniffRxTrace (psdu->GetAmpduSubframe (i), channelFreqMhz, txVector, aMpdu, signalNoise, staId);
1735  }
1736  ++i;
1737  aMpdu.type = (i == (nMpdus - 1)) ? LAST_MPDU_IN_AGGREGATE : MIDDLE_MPDU_IN_AGGREGATE;
1738  }
1739  }
1740  }
1741  else
1742  {
1743  NS_ASSERT_MSG (statusPerMpdu.size () == 1, "Should have one reception status for normal MPDU");
1744  if (!m_phyMonitorSniffRxTrace.IsEmpty ())
1745  {
1746  aMpdu.type = NORMAL_MPDU;
1747  m_phyMonitorSniffRxTrace (psdu->GetPacket (), channelFreqMhz, txVector, aMpdu, signalNoise, staId);
1748  }
1749  }
1750 }
1751 
1752 void
1753 WifiPhy::NotifyMonitorSniffTx (Ptr<const WifiPsdu> psdu, uint16_t channelFreqMhz, WifiTxVector txVector, uint16_t staId)
1754 {
1755  MpduInfo aMpdu;
1756  if (psdu->IsAggregate ())
1757  {
1758  //Expand A-MPDU
1759  NS_ASSERT_MSG (txVector.IsAggregation (), "TxVector with aggregate flag expected here according to PSDU");
1761  if (!m_phyMonitorSniffTxTrace.IsEmpty ())
1762  {
1763  size_t nMpdus = psdu->GetNMpdus ();
1764  aMpdu.type = (psdu->IsSingle ()) ? SINGLE_MPDU: FIRST_MPDU_IN_AGGREGATE;
1765  for (size_t i = 0; i < nMpdus;)
1766  {
1767  m_phyMonitorSniffTxTrace (psdu->GetAmpduSubframe (i), channelFreqMhz, txVector, aMpdu, staId);
1768  ++i;
1769  aMpdu.type = (i == (nMpdus - 1)) ? LAST_MPDU_IN_AGGREGATE : MIDDLE_MPDU_IN_AGGREGATE;
1770  }
1771  }
1772  }
1773  else
1774  {
1775  if (!m_phyMonitorSniffTxTrace.IsEmpty ())
1776  {
1777  aMpdu.type = NORMAL_MPDU;
1778  m_phyMonitorSniffTxTrace (psdu->GetPacket (), channelFreqMhz, txVector, aMpdu, staId);
1779  }
1780  }
1781 }
1782 
1785 {
1786  return GetStaticPhyEntity (txVector.GetModulationClass ())->GetWifiConstPsduMap (psdu, txVector);
1787 }
1788 
1789 void
1791 {
1792  NS_LOG_FUNCTION (this << *psdu << txVector);
1793  Send (GetWifiConstPsduMap (psdu, txVector), txVector);
1794 }
1795 
1796 void
1798 {
1799  NS_LOG_FUNCTION (this << psdus << txVector);
1800  /* Transmission can happen if:
1801  * - we are syncing on a packet. It is the responsibility of the
1802  * MAC layer to avoid doing this but the PHY does nothing to
1803  * prevent it.
1804  * - we are idle
1805  */
1806  NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ());
1808 
1809  if (txVector.GetNssMax () > GetMaxSupportedTxSpatialStreams ())
1810  {
1811  NS_FATAL_ERROR ("Unsupported number of spatial streams!");
1812  }
1813 
1814  if (m_state->IsStateSleep ())
1815  {
1816  NS_LOG_DEBUG ("Dropping packet because in sleep mode");
1817  for (auto const& psdu : psdus)
1818  {
1819  NotifyTxDrop (psdu.second);
1820  }
1821  return;
1822  }
1823 
1824  // Set RU PHY indices
1825  if (txVector.IsMu ())
1826  {
1827  for (auto& heMuUserInfo : txVector.GetHeMuUserInfoMap ())
1828  {
1829  heMuUserInfo.second.ru.SetPhyIndex (txVector.GetChannelWidth (),
1831  }
1832  }
1833 
1834  Time txDuration = CalculateTxDuration (psdus, txVector, GetPhyBand ());
1835 
1836  bool noEndPreambleDetectionEvent = true;
1837  for (const auto & it : m_phyEntities)
1838  {
1839  noEndPreambleDetectionEvent &= it.second->NoEndPreambleDetectionEvents ();
1840  }
1841  if (!noEndPreambleDetectionEvent || ((m_currentEvent != 0) && (m_currentEvent->GetEndTime () > (Simulator::Now () + m_state->GetDelayUntilIdle ()))))
1842  {
1844  //that packet will be noise _after_ the transmission.
1846  }
1847 
1848  for (auto & it : m_phyEntities)
1849  {
1850  it.second->CancelRunningEndPreambleDetectionEvents ();
1851  }
1852  m_currentPreambleEvents.clear ();
1854 
1855  if (m_powerRestricted)
1856  {
1857  NS_LOG_DEBUG ("Transmitting with power restriction for " << txDuration.As (Time::NS));
1858  }
1859  else
1860  {
1861  NS_LOG_DEBUG ("Transmitting without power restriction for " << txDuration.As (Time::NS));
1862  }
1863 
1864  if (m_state->GetState () == WifiPhyState::OFF)
1865  {
1866  NS_LOG_DEBUG ("Transmission canceled because device is OFF");
1867  return;
1868  }
1869 
1870  Ptr<WifiPpdu> ppdu = GetPhyEntity (txVector.GetModulationClass ())->BuildPpdu (psdus, txVector, txDuration);
1871  m_previouslyRxPpduUid = UINT64_MAX; //reset (after creation of PPDU) to use it only once
1872 
1873  double txPowerW = DbmToW (GetTxPowerForTransmission (ppdu) + GetTxGain ());
1874  NotifyTxBegin (psdus, txPowerW);
1875  if (!m_phyTxPsduBeginTrace.IsEmpty ())
1876  {
1877  m_phyTxPsduBeginTrace (psdus, txVector, txPowerW);
1878  }
1879  for (auto const& psdu : psdus)
1880  {
1881  NotifyMonitorSniffTx (psdu.second, GetFrequency (), txVector, psdu.first);
1882  }
1883  m_state->SwitchToTx (txDuration, psdus, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector);
1884 
1885  if (m_wifiRadioEnergyModel != 0 && m_wifiRadioEnergyModel->GetMaximumTimeInState (WifiPhyState::TX) < txDuration)
1886  {
1887  ppdu->SetTruncatedTx ();
1888  }
1889 
1890  m_endTxEvent = Simulator::Schedule (txDuration, &WifiPhy::NotifyTxEnd, this, psdus); //TODO: fix for MU
1891 
1892  StartTx (ppdu);
1893 
1894  m_channelAccessRequested = false;
1895  m_powerRestricted = false;
1896 
1897  Simulator::Schedule (txDuration, &WifiPhy::Reset, this);
1898 }
1899 
1900 uint64_t
1902 {
1903  return m_previouslyRxPpduUid;
1904 }
1905 
1906 void
1908 {
1909  NS_LOG_FUNCTION (this);
1910  m_currentPreambleEvents.clear ();
1911  m_currentEvent = 0;
1912  for (auto & phyEntity : m_phyEntities)
1913  {
1914  phyEntity.second->CancelAllEvents ();
1915  }
1916 }
1917 
1918 void
1920 {
1921  WifiModulationClass modulation = ppdu->GetTxVector ().GetModulationClass ();
1922  auto it = m_phyEntities.find (modulation);
1923  if (it != m_phyEntities.end ())
1924  {
1925  it->second->StartReceivePreamble (ppdu, rxPowersW, rxDuration);
1926  }
1927  else
1928  {
1929  //TODO find a fallback PHY for receiving the PPDU (e.g. 11a for 11ax due to preamble structure)
1930  NS_LOG_DEBUG ("Unsupported modulation received (" << modulation << "), consider as noise");
1931  if (ppdu->GetTxDuration () > m_state->GetDelayUntilIdle ())
1932  {
1933  m_interference.Add (ppdu, ppdu->GetTxVector (), rxDuration, rxPowersW);
1935  }
1936  }
1937 }
1938 
1940 WifiPhy::ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
1941  HeRu::SubcarrierRange range, uint8_t bandIndex) const
1942 {
1943  NS_ASSERT_MSG (false, "802.11ax can only be used with SpectrumWifiPhy");
1944  WifiSpectrumBand convertedSubcarriers;
1945  return convertedSubcarriers;
1946 }
1947 
1948 void
1950 {
1951  NS_LOG_FUNCTION (this);
1953  {
1954  m_powerRestricted = false;
1955  }
1956 }
1957 
1958 void
1960 {
1961  NS_LOG_FUNCTION (this << *event);
1962  NS_ASSERT (!IsStateRx ());
1964  m_currentEvent = 0;
1965  m_currentPreambleEvents.clear ();
1966  SwitchMaybeToCcaBusy (GetMeasurementChannelWidth (event->GetPpdu ()));
1967 }
1968 
1969 void
1971 {
1972  NS_LOG_FUNCTION (this);
1973  m_channelAccessRequested = true;
1974 }
1975 
1976 bool
1978 {
1979  for (const auto & phyEntity : m_phyEntities)
1980  {
1981  if (phyEntity.second->IsModeSupported (mode))
1982  {
1983  return true;
1984  }
1985  }
1986  return false;
1987 }
1988 
1989 WifiMode
1991 {
1992  //Start from oldest standards and move up (guaranteed by fact that WifModulationClass is ordered)
1993  for (const auto & phyEntity : m_phyEntities)
1994  {
1995  for (const auto & mode : *(phyEntity.second))
1996  {
1997  return mode;
1998  }
1999  }
2000  NS_ASSERT_MSG (false, "Should have found at least one default mode");
2001  return WifiMode ();
2002 }
2003 
2004 bool
2005 WifiPhy::IsMcsSupported (WifiModulationClass modulation, uint8_t mcs) const
2006 {
2007  const auto phyEntity = m_phyEntities.find (modulation);
2008  if (phyEntity == m_phyEntities.end ())
2009  {
2010  return false;
2011  }
2012  return phyEntity->second->IsMcsSupported (mcs);
2013 }
2014 
2015 std::list<WifiMode>
2017 {
2018  std::list<WifiMode> list;
2019  for (const auto & phyEntity : m_phyEntities)
2020  {
2021  if (!phyEntity.second->HandlesMcsModes ()) //to exclude MCSs from search
2022  {
2023  for (const auto & mode : *(phyEntity.second))
2024  {
2025  list.emplace_back (mode);
2026  }
2027  }
2028  }
2029  return list;
2030 }
2031 
2032 std::list<WifiMode>
2034 {
2035  std::list<WifiMode> list;
2036  const auto phyEntity = m_phyEntities.find (modulation);
2037  if (phyEntity != m_phyEntities.end ())
2038  {
2039  if (!phyEntity->second->HandlesMcsModes ()) //to exclude MCSs from search
2040  {
2041  for (const auto & mode : *(phyEntity->second))
2042  {
2043  list.emplace_back (mode);
2044  }
2045  }
2046  }
2047  return list;
2048 }
2049 
2050 uint16_t
2051 WifiPhy::GetNMcs (void) const
2052 {
2053  uint16_t numMcs = 0;
2054  for (const auto & phyEntity : m_phyEntities)
2055  {
2056  if (phyEntity.second->HandlesMcsModes ()) //to exclude non-MCS modes from search
2057  {
2058  numMcs += phyEntity.second->GetNumModes ();
2059  }
2060  }
2061  return numMcs;
2062 }
2063 
2064 std::list<WifiMode>
2066 {
2067  std::list<WifiMode> list;
2068  for (const auto & phyEntity : m_phyEntities)
2069  {
2070  if (phyEntity.second->HandlesMcsModes ()) //to exclude non-MCS modes from search
2071  {
2072  for (const auto & mode : *(phyEntity.second))
2073  {
2074  list.emplace_back (mode);
2075  }
2076  }
2077  }
2078  return list;
2079 }
2080 
2081 std::list<WifiMode>
2083 {
2084  std::list<WifiMode> list;
2085  auto phyEntity = m_phyEntities.find (modulation);
2086  if (phyEntity != m_phyEntities.end ())
2087  {
2088  if (phyEntity->second->HandlesMcsModes ()) //to exclude non-MCS modes from search
2089  {
2090  for (const auto & mode : *(phyEntity->second))
2091  {
2092  list.emplace_back (mode);
2093  }
2094  }
2095  }
2096  return list;
2097 }
2098 
2099 WifiMode
2100 WifiPhy::GetMcs (WifiModulationClass modulation, uint8_t mcs) const
2101 {
2102  NS_ASSERT_MSG (IsMcsSupported (modulation, mcs), "Unsupported MCS");
2103  return m_phyEntities.at (modulation)->GetMcs (mcs);
2104 }
2105 
2106 bool
2108 {
2109  return m_state->IsStateCcaBusy ();
2110 }
2111 
2112 bool
2114 {
2115  return m_state->IsStateIdle ();
2116 }
2117 
2118 bool
2120 {
2121  return m_state->IsStateRx ();
2122 }
2123 
2124 bool
2126 {
2127  return m_state->IsStateTx ();
2128 }
2129 
2130 bool
2132 {
2133  return m_state->IsStateSwitching ();
2134 }
2135 
2136 bool
2138 {
2139  return m_state->IsStateSleep ();
2140 }
2141 
2142 bool
2144 {
2145  return m_state->IsStateOff ();
2146 }
2147 
2148 Time
2150 {
2151  return m_state->GetDelayUntilIdle ();
2152 }
2153 
2154 Time
2156 {
2157  return m_state->GetLastRxStartTime ();
2158 }
2159 
2160 Time
2162 {
2163  return m_state->GetLastRxEndTime ();
2164 }
2165 
2166 void
2167 WifiPhy::SwitchMaybeToCcaBusy (uint16_t channelWidth)
2168 {
2169  NS_LOG_FUNCTION (this << channelWidth);
2170  //We are here because we have received the first bit of a packet and we are
2171  //not going to be able to synchronize on it
2172  //In this model, CCA becomes busy when the aggregation of all signals as
2173  //tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
2174  Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW, GetPrimaryBand (channelWidth));
2175  if (!delayUntilCcaEnd.IsZero ())
2176  {
2177  NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S));
2178  m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd);
2179  }
2180 }
2181 
2182 void
2184 {
2185  NS_LOG_FUNCTION (this << reason);
2186  if (reason != OBSS_PD_CCA_RESET || m_currentEvent) //Otherwise abort has already been called previously
2187  {
2188  for (auto & phyEntity : m_phyEntities)
2189  {
2190  phyEntity.second->CancelAllEvents ();
2191  }
2192  if (m_endPhyRxEvent.IsRunning ())
2193  {
2195  }
2197  if (!m_currentEvent)
2198  {
2199  return;
2200  }
2201  NotifyRxDrop (GetAddressedPsduInPpdu (m_currentEvent->GetPpdu ()), reason);
2202  if (reason == OBSS_PD_CCA_RESET)
2203  {
2204  m_state->SwitchFromRxAbort ();
2205  }
2206  for (auto it = m_currentPreambleEvents.begin (); it != m_currentPreambleEvents.end (); ++it)
2207  {
2208  if (it->second == m_currentEvent)
2209  {
2210  it = m_currentPreambleEvents.erase (it);
2211  break;
2212  }
2213  }
2214  m_currentEvent = 0;
2215  }
2216 }
2217 
2218 void
2219 WifiPhy::ResetCca (bool powerRestricted, double txPowerMaxSiso, double txPowerMaxMimo)
2220 {
2221  NS_LOG_FUNCTION (this << powerRestricted << txPowerMaxSiso << txPowerMaxMimo);
2222  // This method might be called multiple times when receiving TB PPDUs with a BSS color
2223  // different than the one of the receiver. The first time this method is called, the call
2224  // to AbortCurrentReception sets m_currentEvent to 0. Therefore, we need to check whether
2225  // m_currentEvent is not 0 before executing the instructions below.
2226  if (m_currentEvent != 0)
2227  {
2228  m_powerRestricted = powerRestricted;
2229  m_txPowerMaxSiso = txPowerMaxSiso;
2230  m_txPowerMaxMimo = txPowerMaxMimo;
2231  NS_ASSERT ((m_currentEvent->GetEndTime () - Simulator::Now ()).IsPositive ());
2233  Simulator::ScheduleNow (&WifiPhy::AbortCurrentReception, this, OBSS_PD_CCA_RESET); //finish processing field first
2234  }
2235 }
2236 
2237 double
2239 {
2240  NS_LOG_FUNCTION (this << m_powerRestricted << ppdu);
2241  const WifiTxVector& txVector = ppdu->GetTxVector ();
2242  // Get transmit power before antenna gain
2243  double txPowerDbm;
2244  if (!m_powerRestricted)
2245  {
2246  txPowerDbm = GetPowerDbm (txVector.GetTxPowerLevel ());
2247  }
2248  else
2249  {
2250  if (txVector.GetNssMax () > 1)
2251  {
2252  txPowerDbm = std::min (m_txPowerMaxMimo, GetPowerDbm (txVector.GetTxPowerLevel ()));
2253  }
2254  else
2255  {
2256  txPowerDbm = std::min (m_txPowerMaxSiso, GetPowerDbm (txVector.GetTxPowerLevel ()));
2257  }
2258  }
2259 
2260  //Apply power density constraint on EIRP
2261  uint16_t channelWidth = ppdu->GetTransmissionChannelWidth ();
2262  double txPowerDbmPerMhz = (txPowerDbm + GetTxGain ()) - RatioToDb (channelWidth); //account for antenna gain since EIRP
2263  NS_LOG_INFO ("txPowerDbm=" << txPowerDbm << " with txPowerDbmPerMhz=" << txPowerDbmPerMhz << " over " << channelWidth << " MHz");
2264  txPowerDbm = std::min (txPowerDbmPerMhz, m_powerDensityLimit) + RatioToDb (channelWidth);
2265  txPowerDbm -= GetTxGain (); //remove antenna gain since will be added right afterwards
2266  NS_LOG_INFO ("txPowerDbm=" << txPowerDbm << " after applying m_powerDensityLimit=" << m_powerDensityLimit);
2267  return txPowerDbm;
2268 }
2269 
2272 {
2273  //TODO: wrapper. See if still needed
2274  return GetPhyEntity (ppdu->GetModulation ())->GetAddressedPsduInPpdu (ppdu);
2275 }
2276 
2277 uint16_t
2279 {
2280  if (ppdu == nullptr)
2281  {
2282  // Here because PHY was not receiving anything (e.g. resuming from OFF) nor expecting anything (e.g. sleep)
2283  // nor processing a Wi-Fi signal.
2284  return GetChannelWidth () >= 40 ? 20 : GetChannelWidth ();
2285  }
2286  return GetPhyEntity (ppdu->GetModulation ())->GetMeasurementChannelWidth (ppdu);
2287 }
2288 
2290 WifiPhy::GetBand (uint16_t /*bandWidth*/, uint8_t /*bandIndex*/)
2291 {
2292  WifiSpectrumBand band;
2293  band.first = 0;
2294  band.second = 0;
2295  return band;
2296 }
2297 
2299 WifiPhy::GetPrimaryBand (uint16_t bandWidth)
2300 {
2301  if (GetChannelWidth () % 20 != 0)
2302  {
2303  return GetBand (bandWidth);
2304  }
2305 
2306  return GetBand (bandWidth, m_operatingChannel.GetPrimaryChannelIndex (bandWidth));
2307 }
2308 
2309 int64_t
2310 WifiPhy::AssignStreams (int64_t stream)
2311 {
2312  NS_LOG_FUNCTION (this << stream);
2313  int64_t currentStream = stream;
2314  m_random->SetStream (currentStream++);
2315  currentStream += m_interference.GetErrorRateModel ()->AssignStreams (currentStream);
2316  return (currentStream - stream);
2317 }
2318 
2319 std::ostream& operator<< (std::ostream& os, RxSignalInfo rxSignalInfo)
2320 {
2321  os << "SNR:" << RatioToDb (rxSignalInfo.snr) << " dB"
2322  << ", RSSI:" << rxSignalInfo.rssi << " dBm";
2323  return os;
2324 }
2325 
2326 } //namespace ns3
ns3::WifiPhy::m_ackTxTime
Time m_ackTxTime
estimated Ack TX time
Definition: wifi-phy.h:1400
ns3::WifiPhy::GetMaxPsduSize
static uint32_t GetMaxPsduSize(WifiModulationClass modulation)
Get the maximum PSDU size in bytes for the given modulation class.
Definition: wifi-phy.cc:1632
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::WifiPhy::m_random
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1179
ns3::WifiPhy::Configure80211ac
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard.
Definition: wifi-phy.cc:1047
ns3::WifiPhy::m_phyTxDropTrace
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the PHY layer drops a packet as it tries to transmit it.
Definition: wifi-phy.h:1309
ns3::WifiPhy::m_txSpatialStreams
uint8_t m_txSpatialStreams
Number of supported TX spatial streams.
Definition: wifi-phy.h:1419
ns3::WifiPhy::WifiPhy
WifiPhy()
Definition: wifi-phy.cc:554
ns3::WifiPhy::m_initialChannelNumber
uint8_t m_initialChannelNumber
Store channel number until initialization.
Definition: wifi-phy.h:1390
ns3::OFDM_PHY_5_MHZ
@ OFDM_PHY_5_MHZ
Definition: ofdm-phy.h:47
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
ns3::WifiPhy::m_postReceptionErrorModel
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1430
ns3::WIFI_MOD_CLASS_ERP_OFDM
@ WIFI_MOD_CLASS_ERP_OFDM
ERP-OFDM (18.4)
Definition: wifi-phy-common.h:128
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::WifiPhy::Configure80211n
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard.
Definition: wifi-phy.cc:1028
ns3::WifiPhy::SetPrimary20Index
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
Definition: wifi-phy.cc:1240
ns3::WifiPhy::GetPreambleDetectionDuration
static Time GetPreambleDetectionDuration(void)
Definition: wifi-phy.cc:1575
ns3::Time::NS
@ NS
nanosecond
Definition: nstime.h:118
ns3::WifiPhy::SetSifs
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:905
ns3::WifiPhy::m_frameCaptureModel
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1427
ns3::WifiPhy::m_phyTxPsduBeginTrace
TracedCallback< WifiConstPsduMap, WifiTxVector, double > m_phyTxPsduBeginTrace
The trace source fired when a PSDU map begins the transmission process on the medium.
Definition: wifi-phy.h:1293
ns3::WifiSpectrumBand
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
Definition: wifi-spectrum-value-helper.h:34
min
#define min(a, b)
Definition: 80211b.c:42
ns3::WifiPhy::GetSlot
Time GetSlot(void) const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:923
ns3::Callback< void, Ptr< WifiPsdu >, RxSignalInfo, WifiTxVector, std::vector< bool > >
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiPhy::IsStateRx
bool IsStateRx(void) const
Definition: wifi-phy.cc:2119
RX
@ RX
The PHY layer is receiving a packet.
Definition: wifi-phy-state.h:48
ns3::WifiPhy::EndReceiveInterBss
void EndReceiveInterBss(void)
For HE receptions only, check and possibly modify the transmit power restriction state at the end of ...
Definition: wifi-phy.cc:1949
ns3::WifiPhy::m_wifiRadioEnergyModel
Ptr< WifiRadioEnergyModel > m_wifiRadioEnergyModel
Wifi radio energy model.
Definition: wifi-phy.h:1429
ns3::WifiPhy::CalculateTxDuration
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1611
ns3::WIFI_PHY_OFDM_CHANNEL
@ WIFI_PHY_OFDM_CHANNEL
Definition: wifi-standards.h:209
ns3::WifiPhy::m_phyRxBeginTrace
TracedCallback< Ptr< const Packet >, RxPowerWattPerChannelBand > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Definition: wifi-phy.h:1317
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
ns3::WIFI_MOD_CLASS_HT
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
Definition: wifi-phy-common.h:130
ns3::WIFI_MOD_CLASS_HE
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
Definition: wifi-phy-common.h:132
ns3::WifiPhy::m_capabilitiesChangedCallback
Callback< void > m_capabilitiesChangedCallback
Callback when PHY capabilities changed.
Definition: wifi-phy.h:1433
ns3::WifiPhy::m_supportedChannelWidthSet
std::vector< uint16_t > m_supportedChannelWidthSet
Supported channel width set (MHz)
Definition: wifi-phy.h:1395
ns3::WifiPhy::SetPifs
void SetPifs(Time pifs)
Set the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:929
ns3::WifiPhy::NotifyMonitorSniffRx
void NotifyMonitorSniffRx(Ptr< const WifiPsdu > psdu, uint16_t channelFreqMhz, WifiTxVector txVector, SignalNoiseDbm signalNoise, std::vector< bool > statusPerMpdu, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being received.
Definition: wifi-phy.cc:1716
ns3::WifiPhy::GetDelayUntilIdle
Time GetDelayUntilIdle(void)
Definition: wifi-phy.cc:2149
ns3::InterferenceHelper::GetEnergyDuration
Time GetEnergyDuration(double energyW, WifiSpectrumBand band)
Definition: interference-helper.cc:260
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
ns3::GetDefaultChannelWidth
uint16_t GetDefaultChannelWidth(WifiPhyStandard standard, WifiPhyBand band)
Get the default channel width for the given PHY standard and band.
Definition: wifi-standards.h:267
ns3::WifiPhyListener
receive notifications about PHY events.
Definition: wifi-phy-listener.h:33
ns3::WifiPhy::SetTxPowerStart
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:700
IDLE
@ IDLE
The PHY layer is IDLE.
Definition: wifi-phy-state.h:36
ns3::InterferenceHelper::GetErrorRateModel
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model.
Definition: interference-helper.cc:248
ns3::WIFI_PHY_BAND_5GHZ
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
ns3::WifiPhy::AddPhyEntity
void AddPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of supported PHY entities for the given modulation class for the WifiPh...
Definition: wifi-phy.cc:895
ns3::WifiTxVector::GetNssMax
uint8_t GetNssMax(void) const
Definition: wifi-tx-vector.cc:184
ns3::WifiPhy::GetPifs
Time GetPifs(void) const
Return the PCF Interframe Space (PIFS) for this PHY.
Definition: wifi-phy.cc:935
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
ns3::WifiPhy::GetLastRxStartTime
Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
Definition: wifi-phy.cc:2155
ns3::WifiPhy::GetDevice
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:784
frame-capture-model.h
ns3::InterferenceHelper::SetErrorRateModel
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
Definition: interference-helper.cc:242
ns3::WifiPhy::m_initialFrequency
uint16_t m_initialFrequency
Store frequency until initialization (MHz)
Definition: wifi-phy.h:1389
ns3::WifiPhy::m_txPowerEndDbm
double m_txPowerEndDbm
Maximum transmission power (dBm)
Definition: wifi-phy.h:1408
ns3::WifiPhy::GetTxGain
double GetTxGain(void) const
Return the transmission gain (dB).
Definition: wifi-phy.cc:746
ns3::WifiPhy::ResetReceive
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
Definition: wifi-phy.cc:1959
ns3::WifiPhy::CalculatePhyPreambleAndHeaderDuration
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1605
ns3::WifiPhy::GetChannelNumber
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1200
ns3::Time::IsStrictlyPositive
bool IsStrictlyPositive(void) const
Exactly equivalent to t > 0.
Definition: nstime.h:333
ns3::WifiPhy::GetFrequency
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1169
OFF
@ OFF
The PHY layer is switched off.
Definition: wifi-phy-state.h:60
ns3::InterferenceHelper::SetNumberOfReceiveAntennas
void SetNumberOfReceiveAntennas(uint8_t rx)
Set the number of RX antennas in the receiver corresponding to this interference helper.
Definition: interference-helper.cc:254
ns3::WifiPhy::NotifyChannelAccessRequested
void NotifyChannelAccessRequested(void)
Notify the PHY that an access to the channel was requested.
Definition: wifi-phy.cc:1970
ns3::WToDbm
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:43
ns3::WifiPhy::SetTxPowerEnd
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:713
ns3::WifiPhy::Configure80211g
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard.
Definition: wifi-phy.cc:985
ns3::OBSS_PD_CCA_RESET
@ OBSS_PD_CCA_RESET
Definition: wifi-phy-common.h:281
ns3::PointerValue
Hold objects of type Ptr<T>.
Definition: pointer.h:37
ns3::WifiPhy::m_sifs
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: wifi-phy.h:1397
ns3::WifiPhyOperatingChannel::IsSet
bool IsSet(void) const
Return true if a valid channel has been set, false otherwise.
Definition: wifi-phy-operating-channel.cc:43
ns3::WifiPhy::GetTxPowerStart
double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
Definition: wifi-phy.cc:707
ns3::WifiPhy::IsStateOff
bool IsStateOff(void) const
Definition: wifi-phy.cc:2143
ns3::WIFI_MOD_CLASS_OFDM
@ WIFI_MOD_CLASS_OFDM
OFDM (Clause 17)
Definition: wifi-phy-common.h:129
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
wifi-phy.h
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
ns3::WifiPhy::StartTx
virtual void StartTx(Ptr< WifiPpdu > ppdu)=0
ns3::WifiPhy::SetReceiveOkCallback
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:636
ns3::WifiConstPsduMap
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:43
ns3::WifiPhy::SetMaxSupportedTxSpatialStreams
void SetMaxSupportedTxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1379
ns3::WifiPhy::SetShortPhyPreambleSupported
void SetShortPhyPreambleSupported(bool preamble)
Enable or disable short PHY preamble.
Definition: wifi-phy.cc:765
ns3::WifiPhy::m_channelAccessRequested
bool m_channelAccessRequested
Flag if channels access has been requested (used for OBSS_PD SR)
Definition: wifi-phy.h:1415
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::WifiPhyStandard
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Definition: wifi-standards.h:35
ns3::WifiPhy::GetAckTxTime
Time GetAckTxTime(void) const
Return the estimated Ack TX time for this PHY.
Definition: wifi-phy.cc:941
ns3::WifiPhy::SetChannelWidth
virtual void SetChannelWidth(uint16_t channelWidth)
If the operating channel for this object has not been set yet, the given channel width is saved and w...
Definition: wifi-phy.cc:1206
ns3::WifiPhy::GetPowerDbm
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:841
CCA_BUSY
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
Definition: wifi-phy-state.h:40
ns3::WifiPhy::AddStaticPhyEntity
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
Definition: wifi-phy.cc:887
ns3::WifiPhy::GetPhyEntity
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance.
Definition: wifi-phy.cc:879
ns3::FIRST_MPDU_IN_AGGREGATE
@ FIRST_MPDU_IN_AGGREGATE
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate.
Definition: wifi-mpdu-type.h:37
ns3::PeekPointer
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:415
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::WifiPhy::m_rxGainDb
double m_rxGainDb
Reception gain (dB)
Definition: wifi-phy.h:1406
ns3::WifiPhy::m_operatingChannel
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1394
ns3::WifiPhy::GetNMcs
uint16_t GetNMcs(void) const
Definition: wifi-phy.cc:2051
ns3::WifiPhyOperatingChannel::GetWidth
uint16_t GetWidth(void) const
Return the width of the whole operating channel (in MHz).
Definition: wifi-phy-operating-channel.cc:144
ns3::WifiPhy::GetPayloadDuration
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1587
ns3::InterferenceHelper::EraseEvents
void EraseEvents(void)
Erase all events.
Definition: interference-helper.cc:600
ns3::SignalNoiseDbm
SignalNoiseDbm structure.
Definition: phy-entity.h:53
ns3::WifiPhy::IsStateSwitching
bool IsStateSwitching(void) const
Definition: wifi-phy.cc:2131
ns3::WifiPhy::GetStaticPhyEntities
static std::map< WifiModulationClass, Ptr< PhyEntity > > & GetStaticPhyEntities(void)
Definition: wifi-phy.cc:623
ns3::WifiPhy::m_band
WifiPhyBand m_band
WifiPhyBand.
Definition: wifi-phy.h:1388
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::WifiPhy::GetBlockAckTxTime
Time GetBlockAckTxTime(void) const
Return the estimated BlockAck TX time for this PHY.
Definition: wifi-phy.cc:947
ns3::WifiPhy::m_txGainDb
double m_txGainDb
Transmission gain (dB)
Definition: wifi-phy.h:1405
ns3::WifiPhy::Configure80211p
void Configure80211p(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11p standard.
Definition: wifi-phy.cc:998
ns3::WifiPhy::m_channelSwitchDelay
Time m_channelSwitchDelay
Time required to switch between channel.
Definition: wifi-phy.h:1422
ns3::WifiPhy::AddSupportedChannelWidth
void AddSupportedChannelWidth(uint16_t width)
Definition: wifi-phy.cc:1443
ns3::WifiPhy::IsStateTx
bool IsStateTx(void) const
Definition: wifi-phy.cc:2125
ns3::MpduInfo::mpduRefNumber
uint32_t mpduRefNumber
MPDU ref number.
Definition: phy-entity.h:62
ns3::WifiPhy::m_interference
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1178
wifi-psdu.h
ns3::WifiPhy::DoChannelSwitch
Time DoChannelSwitch(void)
Perform any actions necessary when user changes operating channel after initialization.
Definition: wifi-phy.cc:1300
ns3::WIFI_PHY_DSSS_CHANNEL
@ WIFI_PHY_DSSS_CHANNEL
Definition: wifi-standards.h:208
ns3::WifiPhy::GetState
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
Definition: wifi-phy.cc:630
ns3::WIFI_MOD_CLASS_HR_DSSS
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
Definition: wifi-phy-common.h:127
ns3::WifiPhy::RegisterListener
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:648
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::WifiPhy::m_phyTxBeginTrace
TracedCallback< Ptr< const Packet >, double > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
Definition: wifi-phy.h:1286
ns3::WifiPhy::GetMaxSupportedTxSpatialStreams
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1404
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::WifiPhy::SetCapabilitiesChangedCallback
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:660
ns3::WIFI_PHY_STANDARD_80211ax
@ WIFI_PHY_STANDARD_80211ax
HE PHY (clause 26)
Definition: wifi-standards.h:49
ns3::WifiPhy::GetDefaultMode
WifiMode GetDefaultMode(void) const
Get the default WifiMode supported by the PHY.
Definition: wifi-phy.cc:1990
ns3::NORMAL_MPDU
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
Definition: wifi-mpdu-type.h:33
visualizer.core.start
def start()
Definition: core.py:1855
ns3::WifiPhy::GetStartOfPacketDuration
static Time GetStartOfPacketDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1581
ns3::WifiPhy::SetRxSensitivity
void SetRxSensitivity(double threshold)
Sets the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:666
ns3::WIFI_PHY_STANDARD_80211p
@ WIFI_PHY_STANDARD_80211p
OFDM PHY (Clause 17 - amendment for 10 MHz and 5 MHz channels)
Definition: wifi-standards.h:43
ns3::MIDDLE_MPDU_IN_AGGREGATE
@ MIDDLE_MPDU_IN_AGGREGATE
The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last aggregate.
Definition: wifi-mpdu-type.h:39
ns3::WifiPhyOperatingChannel
Class that keeps track of all information about the current PHY operating channel.
Definition: wifi-phy-operating-channel.h:44
ns3::WifiPhy::m_powerDensityLimit
double m_powerDensityLimit
the power density limit (dBm/MHz)
Definition: wifi-phy.h:1410
ns3::RECEPTION_ABORTED_BY_TX
@ RECEPTION_ABORTED_BY_TX
Definition: wifi-phy-common.h:274
ns3::WifiPhy::SetRxGain
void SetRxGain(double gain)
Sets the reception gain (dB).
Definition: wifi-phy.cc:752
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
ns3::WifiPhy::m_phyTxEndTrace
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
Definition: wifi-phy.h:1301
ns3::WifiTxVector::GetModulationClass
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
Definition: wifi-tx-vector.cc:128
ns3::WifiPhyRxfailureReason
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
Definition: wifi-phy-common.h:263
ns3::WifiPhy::GetNTxPower
uint8_t GetNTxPower(void) const
Return the number of available transmission power levels.
Definition: wifi-phy.cc:733
ns3::MpduInfo
MpduInfo structure.
Definition: phy-entity.h:60
ns3::WifiPhy::m_state
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1180
ns3::WifiPhy::UnregisterListener
void UnregisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:654
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::WifiPhy::m_slot
Time m_slot
Slot duration.
Definition: wifi-phy.h:1398
ns3::WifiPhy::ConvertHeRuSubcarriers
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
Definition: wifi-phy.cc:1940
ns3::WifiPhy::GetTxPowerForTransmission
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2238
ns3::WifiPhy::SetReceiveErrorCallback
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:642
ns3::WifiPhy::GetShortPhyPreambleSupported
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:772
ns3::WifiPhy::GetPhyStandard
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1132
ns3::WifiPhy::NotifyRxDrop
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1704
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::Time::IsZero
bool IsZero(void) const
Exactly equivalent to t == 0.
Definition: nstime.h:301
ns3::WifiPhy::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-phy.cc:291
ns3::WifiPhy::Configure80211a
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard.
Definition: wifi-phy.cc:953
wifi-net-device.h
ns3::WifiPhy::SetNTxPower
void SetNTxPower(uint8_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
Definition: wifi-phy.cc:726
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::WifiPhy::GetLastRxEndTime
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2161
ns3::WifiPhy::m_phyMonitorSniffRxTrace
TracedCallback< Ptr< const Packet >, uint16_t, WifiTxVector, MpduInfo, SignalNoiseDbm, uint16_t > m_phyMonitorSniffRxTrace
A trace source that emulates a Wi-Fi device in monitor mode sniffing a packet being received.
Definition: wifi-phy.h:1362
ns3::WifiPhy::GetPreviouslyRxPpduUid
uint64_t GetPreviouslyRxPpduUid(void) const
Definition: wifi-phy.cc:1901
ns3::WifiNetDevice::GetNode
Ptr< Node > GetNode(void) const override
Definition: wifi-net-device.cc:336
ns3::WifiPhy::ResumeFromOff
void ResumeFromOff(void)
Resume from off mode.
Definition: wifi-phy.cc:1544
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
wifi-ppdu.h
Declaration of ns3::WifiPpdu class and ns3::WifiConstPsduMap.
ns3::WifiPhy::m_rxSpatialStreams
uint8_t m_rxSpatialStreams
Number of supported RX spatial streams.
Definition: wifi-phy.h:1420
ns3::WifiPhyOperatingChannel::SetPrimary20Index
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
Definition: wifi-phy-operating-channel.cc:178
ns3::WifiTxVector::GetHeMuUserInfoMap
const HeMuUserInfoMap & GetHeMuUserInfoMap(void) const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
Definition: wifi-tx-vector.cc:421
ns3::WifiPhy::GetCcaEdThreshold
double GetCcaEdThreshold(void) const
Return the CCA threshold (dBm).
Definition: wifi-phy.cc:686
ns3::WIFI_PHY_STANDARD_80211a
@ WIFI_PHY_STANDARD_80211a
OFDM PHY (Clause 17)
Definition: wifi-standards.h:37
ns3::WifiPhy::Configure80211b
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard.
Definition: wifi-phy.cc:968
ns3::WifiPhy::SetNumberOfAntennas
void SetNumberOfAntennas(uint8_t antennas)
Definition: wifi-phy.cc:1365
ns3::RxSignalInfo::rssi
double rssi
RSSI in dBm.
Definition: phy-entity.h:69
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::WifiTxVector::IsAggregation
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
Definition: wifi-tx-vector.cc:208
ns3::WifiPsdu::GetNMpdus
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:319
ns3::WifiPhy::GetPhyBand
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1125
ns3::WifiPhy::SetFrequency
virtual void SetFrequency(uint16_t freq)
If the operating channel for this object has not been set yet, the given center frequency is saved an...
Definition: wifi-phy.cc:1144
ns3::WifiPhy::AbortCurrentReception
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2183
ns3::WifiPhy::SetMaxSupportedRxSpatialStreams
void SetMaxSupportedRxSpatialStreams(uint8_t streams)
Definition: wifi-phy.cc:1410
ns3::WifiPhy::Reset
void Reset(void)
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1907
ns3::WifiPhy::GetOperatingChannel
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1138
ns3::WIFI_PHY_STANDARD_80211b
@ WIFI_PHY_STANDARD_80211b
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
Definition: wifi-standards.h:39
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::WifiPhy::ResumeFromSleep
void ResumeFromSleep(void)
Resume from sleep mode.
Definition: wifi-phy.cc:1513
ns3::WifiPhy::m_initialChannelWidth
uint16_t m_initialChannelWidth
Store channel width (MHz) until initialization.
Definition: wifi-phy.h:1391
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
NS_ASSERT_MSG
#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:88
wifi-radio-energy-model.h
ns3::WifiPhy::m_phyRxDropTrace
TracedCallback< Ptr< const Packet >, WifiPhyRxfailureReason > m_phyRxDropTrace
The trace source fired when the PHY layer drops a packet it has received.
Definition: wifi-phy.h:1348
list
#define list
Definition: openflow-interface.h:47
ns3::WifiPhy::m_phyEntities
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1210
ns3::WifiTxVector::GetChannelWidth
uint16_t GetChannelWidth(void) const
Definition: wifi-tx-vector.cc:154
ns3::WifiPhy::m_phyMonitorSniffTxTrace
TracedCallback< Ptr< const Packet >, uint16_t, WifiTxVector, MpduInfo, uint16_t > m_phyMonitorSniffTxTrace
A trace source that emulates a Wi-Fi device in monitor mode sniffing a packet being transmitted.
Definition: wifi-phy.h:1376
ns3::WifiTxVector::IsMu
bool IsMu(void) const
Return true if this TX vector is used for a multi-user transmission.
Definition: wifi-tx-vector.cc:370
SLEEP
@ SLEEP
The PHY layer is sleeping.
Definition: wifi-phy-state.h:56
ns3::WifiPhy::SetMobility
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:790
ns3::WifiPhy::m_phyRxEndTrace
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Definition: wifi-phy.h:1341
ns3::WifiPhy::SetSlot
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:917
ns3::MakePointerAccessor
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:227
ns3::RatioToDb
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:49
ns3::WIFI_PHY_STANDARD_80211n
@ WIFI_PHY_STANDARD_80211n
HT PHY (clause 20)
Definition: wifi-standards.h:45
ns3::WIFI_PHY_STANDARD_80211ac
@ WIFI_PHY_STANDARD_80211ac
VHT PHY (clause 22)
Definition: wifi-standards.h:47
ns3::WifiPhy::NotifyMonitorSniffTx
void NotifyMonitorSniffTx(Ptr< const WifiPsdu > psdu, uint16_t channelFreqMhz, WifiTxVector txVector, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being transmitted.
Definition: wifi-phy.cc:1753
ns3::WifiPhy::m_mobility
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
Definition: wifi-phy.h:1425
ns3::WifiPhy::SetRxNoiseFigure
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
Definition: wifi-phy.cc:692
ns3::MakeDoubleAccessor
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:42
ns3::WifiPhy::SetOffMode
void SetOffMode(void)
Put in off mode.
Definition: wifi-phy.cc:1498
ns3::WifiPhy::IsMcsSupported
bool IsMcsSupported(WifiModulationClass modulation, uint8_t mcs) const
Check if the given MCS of the given modulation class is supported by the PHY.
Definition: wifi-phy.cc:2005
ns3::WifiPhy::StartReceivePreamble
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1919
ns3::WifiPhy::GetBand
virtual WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0)
Get the start band index and the stop band index for a given band.
Definition: wifi-phy.cc:2290
ns3::WifiPhy::NotifyRxBegin
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1680
ns3::WifiPhy::IsStateSleep
bool IsStateSleep(void) const
Definition: wifi-phy.cc:2137
ns3::WifiPhy::GetMcs
WifiMode GetMcs(WifiModulationClass modulation, uint8_t mcs) const
Get the WifiMode object corresponding to the given MCS of the given modulation class.
Definition: wifi-phy.cc:2100
ns3::WifiPhy::IsStateCcaBusy
bool IsStateCcaBusy(void) const
Definition: wifi-phy.cc:2107
ns3::WifiPhy::SetFrameCaptureModel
void SetFrameCaptureModel(const Ptr< FrameCaptureModel > frameCaptureModel)
Sets the frame capture model.
Definition: wifi-phy.cc:823
ns3::WifiPhy::m_currentEvent
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1188
ns3::WifiPhy::IsModeSupported
bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
Definition: wifi-phy.cc:1977
ns3::WifiPsdu::IsAggregate
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition: wifi-psdu.cc:81
ns3::WIFI_PHY_BAND_2_4GHZ
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
ns3::WifiPhy::SwitchMaybeToCcaBusy
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: wifi-phy.cc:2167
ns3::Time::IsStrictlyNegative
bool IsStrictlyNegative(void) const
Exactly equivalent to t < 0.
Definition: nstime.h:325
ns3::WifiPhy::Configure80211ax
void Configure80211ax(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ax standard.
Definition: wifi-phy.cc:1055
ns3::WifiPhy::AssignStreams
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: wifi-phy.cc:2310
ns3::WifiPhy::GetWifiConstPsduMap
static WifiConstPsduMap GetWifiConstPsduMap(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
Definition: wifi-phy.cc:1784
ns3::RxSignalInfo::snr
double snr
SNR in linear scale.
Definition: phy-entity.h:68
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::DbmToW
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:37
ns3::WifiPhy::m_txPowerMaxSiso
double m_txPowerMaxSiso
SISO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1413
ns3::WifiPhy::SetTxGain
void SetTxGain(double gain)
Sets the transmission gain (dB).
Definition: wifi-phy.cc:739
SWITCHING
@ SWITCHING
The PHY layer is switching to other channel.
Definition: wifi-phy-state.h:52
wifi-utils.h
ns3::WIFI_PHY_STANDARD_UNSPECIFIED
@ WIFI_PHY_STANDARD_UNSPECIFIED
Unspecified.
Definition: wifi-standards.h:51
ns3::WifiPsdu::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
Definition: wifi-psdu.cc:87
ns3::WifiPhy::GetMeasurementChannelWidth
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: wifi-phy.cc:2278
ns3::WifiPhy::GetRxGain
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:759
ns3::WifiPhy::GetPrimaryBand
WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth)
If the operating channel width is a multiple of 20 MHz, return the start band index and the stop band...
Definition: wifi-phy.cc:2299
ns3::RxSignalInfo
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:67
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::WifiPhy::SetCcaEdThreshold
void SetCcaEdThreshold(double threshold)
Sets the CCA threshold (dBm).
Definition: wifi-phy.cc:679
ns3::WifiPhy::GetRxSensitivity
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:673
ns3::WifiPhy::GetMobility
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
Definition: wifi-phy.cc:796
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::WifiPhy::ConfigureStandardAndBand
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1070
ns3::WifiPhy::GetNumberOfAntennas
uint8_t GetNumberOfAntennas(void) const
Definition: wifi-phy.cc:1373
ns3::WifiPhy::~WifiPhy
virtual ~WifiPhy()
Definition: wifi-phy.cc:584
ns3::WifiPhy::NotifyTxEnd
void NotifyTxEnd(WifiConstPsduMap psdus)
Public method used to fire a PhyTxEnd trace.
Definition: wifi-phy.cc:1653
ns3::WifiPhy::m_numberOfAntennas
uint8_t m_numberOfAntennas
Number of transmitters.
Definition: wifi-phy.h:1418
ns3::WifiTxVector::GetTxPowerLevel
uint8_t GetTxPowerLevel(void) const
Definition: wifi-tx-vector.cc:142
ns3::WifiPhy::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:590
ns3::WifiPhy::m_powerRestricted
bool m_powerRestricted
Flag whether transmit power is restricted by OBSS PD SR.
Definition: wifi-phy.h:1412
ns3::InterferenceHelper::Add
Ptr< Event > Add(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector, Time duration, RxPowerWattPerChannelBand &rxPower, bool isStartOfdmaRxing=false)
Add the PPDU-related signal to interference helper.
Definition: interference-helper.cc:190
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
ns3::WifiPhy::m_pifs
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: wifi-phy.h:1399
ns3::WifiPhy::GetChannelWidth
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1234
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::WifiPhy::GetChannelSwitchDelay
Time GetChannelSwitchDelay(void) const
Definition: wifi-phy.cc:859
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition: mobility-model.h:40
ns3::DbToRatio
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:31
ns3::WIFI_PHY_BAND_6GHZ
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
Definition: wifi-phy-band.h:39
ns3::WifiPhy::GetMaxSupportedRxSpatialStreams
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1422
preamble-detection-model.h
ns3::WifiPhy::m_currentPreambleEvents
std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > m_currentPreambleEvents
store event associated to a PPDU (that has a unique ID and preamble combination) whose preamble is be...
Definition: wifi-phy.h:1189
ns3::WifiPhyOperatingChannel::GetPrimaryChannelIndex
uint8_t GetPrimaryChannelIndex(uint16_t primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
Definition: wifi-phy-operating-channel.cc:151
ns3::WifiPhy::GetModeList
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2016
ns3::WifiPhy::m_initialPrimary20Index
uint8_t m_initialPrimary20Index
Store the index of primary20 until initialization.
Definition: wifi-phy.h:1392
ns3::InterferenceHelper::SetNoiseFigure
void SetNoiseFigure(double value)
Set the noise figure.
Definition: interference-helper.cc:236
ns3::WifiPhy::m_shortPreamble
bool m_shortPreamble
Flag if short PHY preamble is supported.
Definition: wifi-phy.h:1417
ns3::OFDM_PHY_10_MHZ
@ OFDM_PHY_10_MHZ
Definition: ofdm-phy.h:46
ns3::RxPowerWattPerChannelBand
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:75
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::WifiPhy::m_rxMpduReferenceNumber
uint32_t m_rxMpduReferenceNumber
A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU.
Definition: wifi-phy.h:1183
ns3::WifiPhyOperatingChannel::Set
void Set(uint8_t number, uint16_t frequency, uint16_t width, WifiPhyStandard standard, WifiPhyBand band)
Set the channel according to the specified parameters if a unique frequency channel matches the speci...
Definition: wifi-phy-operating-channel.cc:49
ns3::WifiPhy::GetBssMembershipSelectorList
std::list< uint8_t > GetBssMembershipSelectorList(void) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1428
ns3::WifiPhy::GetAddressedPsduInPpdu
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Definition: wifi-phy.cc:2271
ns3::WifiPhy::m_standard
WifiPhyStandard m_standard
WifiPhyStandard.
Definition: wifi-phy.h:1387
ns3::WifiPhy::m_phyRxPayloadBeginTrace
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1333
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::WifiPhy::NotifyTxBegin
void NotifyTxBegin(WifiConstPsduMap psdus, double txPowerW)
Public method used to fire a PhyTxBegin trace.
Definition: wifi-phy.cc:1638
ns3::WifiPhy::m_device
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-phy.h:1424
ns3::LAST_MPDU_IN_AGGREGATE
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
Definition: wifi-mpdu-type.h:41
ns3::WifiPhy::CalculateSnr
double CalculateSnr(const WifiTxVector &txVector, double ber) const
Definition: wifi-phy.cc:865
ns3::WifiPhy::m_txPowerMaxMimo
double m_txPowerMaxMimo
MIMO maximum transmit power due to OBSS PD SR power restriction (dBm)
Definition: wifi-phy.h:1414
ns3::WifiPhyBand
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
ns3::WifiPhyOperatingChannel::GetFrequency
uint16_t GetFrequency(void) const
Return the center frequency of the operating channel (in MHz).
Definition: wifi-phy-operating-channel.cc:137
ns3::HeRu::SubcarrierRange
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
ns3::WifiPhyOperatingChannel::SetDefault
void SetDefault(uint16_t width, WifiPhyStandard standard, WifiPhyBand band)
Set the default channel of the given width and for the given PHY standard and band.
Definition: wifi-phy-operating-channel.cc:71
ns3::MpduInfo::type
MpduType type
type of MPDU
Definition: phy-entity.h:61
ns3::TracedCallback::IsEmpty
bool IsEmpty() const
Checks if the Callbacks list is empty.
Definition: traced-callback.h:198
ns3::WifiPhy::m_endPhyRxEvent
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1185
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
ns3::WIFI_MOD_CLASS_VHT
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
Definition: wifi-phy-common.h:131
ns3::WifiPhy::NotifyRxEnd
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1692
ns3::WifiPhy::NotifyTxDrop
void NotifyTxDrop(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyTxDrop trace.
Definition: wifi-phy.cc:1668
ns3::WifiPhy::SetChannelNumber
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1175
ns3::WifiPhy::m_endTxEvent
EventId m_endTxEvent
the end of transmit event
Definition: wifi-phy.h:1186
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
ns3::WifiPhy::m_rxSensitivityW
double m_rxSensitivityW
Receive sensitivity threshold in watts.
Definition: wifi-phy.h:1403
TX
@ TX
The PHY layer is sending a packet.
Definition: wifi-phy-state.h:44
ns3::WifiPhy::m_preambleDetectionModel
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1428
ns3::WifiPhy::m_txPowerBaseDbm
double m_txPowerBaseDbm
Minimum transmission power (dBm)
Definition: wifi-phy.h:1407
ns3::WifiPhy::GetSupportedChannelWidthSet
std::vector< uint16_t > GetSupportedChannelWidthSet(void) const
Definition: wifi-phy.cc:1458
ns3::WifiPhy::SetDevice
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:778
ns3::WifiPhy::GetMcsList
std::list< WifiMode > GetMcsList(void) const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition: wifi-phy.cc:2065
ns3::WifiPhy::SetPostReceptionErrorModel
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
Definition: wifi-phy.cc:816
ns3::WifiPhy::GetSifs
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:911
ns3::WifiPhy::m_ccaEdThresholdW
double m_ccaEdThresholdW
Clear channel assessment (CCA) threshold in watts.
Definition: wifi-phy.h:1404
ns3::WifiPsdu::IsSingle
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
Definition: wifi-psdu.cc:75
ns3::WifiPhy::SetOperatingChannel
void SetOperatingChannel(uint8_t number, uint16_t frequency, uint16_t width)
Set the operating channel according to the specified parameters.
Definition: wifi-phy.cc:1257
ns3::WifiPhy::GetStaticPhyEntity
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:871
error-rate-model.h
ns3::Simulator::ScheduleNow
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:587
ns3::WIFI_PHY_80211p_CHANNEL
@ WIFI_PHY_80211p_CHANNEL
Definition: wifi-standards.h:210
ns3::WifiPhy::SetErrorRateModel
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:809
ns3::WifiPhy::IsStateIdle
bool IsStateIdle(void) const
Definition: wifi-phy.cc:2113
ns3::WifiPhy::m_frequencyChannels
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
Definition: wifi-phy.h:61
ns3::WifiPhy::Send
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
Definition: wifi-phy.cc:1790
ns3::WIFI_MOD_CLASS_DSSS
@ WIFI_MOD_CLASS_DSSS
DSSS (Clause 15)
Definition: wifi-phy-common.h:126
ns3::SINGLE_MPDU
@ SINGLE_MPDU
The MPDU is a single MPDU.
Definition: wifi-mpdu-type.h:35
sample-rng-plot.n
n
Definition: sample-rng-plot.py:37
ns3::WifiPhy::SetWifiRadioEnergyModel
void SetWifiRadioEnergyModel(const Ptr< WifiRadioEnergyModel > wifiRadioEnergyModel)
Sets the wifi radio energy model.
Definition: wifi-phy.cc:835
ns3::WIFI_PHY_STANDARD_80211g
@ WIFI_PHY_STANDARD_80211g
ERP-OFDM PHY (Clause 19, Section 19.5)
Definition: wifi-standards.h:41
third.mobility
mobility
Definition: third.py:108
ns3::WIFI_PHY_BAND_UNSPECIFIED
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
Definition: wifi-phy-band.h:41
ns3::WifiModulationClass
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
Definition: wifi-phy-common.h:122
ns3::WifiPsdu::GetAmpduSubframe
Ptr< Packet > GetAmpduSubframe(std::size_t i) const
Get a copy of the i-th A-MPDU subframe (includes subframe header, MPDU, and possibly padding)
Definition: wifi-psdu.cc:290
ns3::WifiPhy::SetPreambleDetectionModel
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
Definition: wifi-phy.cc:829
ns3::WifiPhyOperatingChannel::GetNumber
uint8_t GetNumber(void) const
Return the channel number identifying the whole operating channel.
Definition: wifi-phy-operating-channel.cc:130
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1354
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:65
ns3::WifiPhy::m_previouslyRxPpduUid
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1191
ns3::WifiPhy::GetTxPowerEnd
double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
Definition: wifi-phy.cc:720
ns3::WifiPhy::ResetCca
void ResetCca(bool powerRestricted, double txPowerMaxSiso=0, double txPowerMaxMimo=0)
Reset PHY to IDLE, with some potential TX power restrictions for the next transmission.
Definition: wifi-phy.cc:2219
ns3::MpduType
MpduType
The type of an MPDU.
Definition: wifi-mpdu-type.h:31
ns3::WifiPhy::m_nTxPower
uint8_t m_nTxPower
Number of available transmission power levels.
Definition: wifi-phy.h:1409
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
ns3::WifiPhy::SetSleepMode
void SetSleepMode(void)
Put in sleep mode.
Definition: wifi-phy.cc:1464
ns3::InterferenceHelper::NotifyRxEnd
void NotifyRxEnd(Time endTime)
Notify that RX has ended.
Definition: interference-helper.cc:642
ns3::WifiPhy::m_blockAckTxTime
Time m_blockAckTxTime
estimated BlockAck TX time
Definition: wifi-phy.h:1401
ns3::Object::IsInitialized
bool IsInitialized(void) const
Check if the object has been initialized.
Definition: object.cc:208