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