A Discrete-Event Network Simulator
API
ideal-wifi-manager-example.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 University of Washington
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  * Author: Tom Henderson <tomhend@u.washington.edu>
19  */
20 
21 // Test the operation of IdealWifiManager as the SNR is varied, and create
22 // a gnuplot output file for plotting
23 //
24 // By default, the 802.11b standard is plotted. Several command line
25 // arguments can change the following options:
26 // --standard (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz)
27 // --shortGuard (for 802.11n/ac)
28 // --nss (for 802.11n/ac)
29 // --channelWidth (for 802.11n/ac)
30 // --broadcast instead of unicast (default is unicast)
31 // --rtsThreshold (by default, value of 99999 disables it)
32 
33 #include <cmath>
34 #include <sstream>
35 
36 #include "ns3/core-module.h"
37 #include "ns3/network-module.h"
38 #include "ns3/wifi-module.h"
39 #include "ns3/stats-module.h"
40 #include "ns3/mobility-module.h"
41 #include "ns3/propagation-module.h"
42 
43 using namespace ns3;
44 
45 NS_LOG_COMPONENT_DEFINE ("IdealWifiManagerExample");
46 
47 // 290K @ 20 MHz
48 const double NOISE_DBM_Hz = -174.0;
50 
51 double g_intervalBytes = 0;
52 uint64_t g_intervalRate = 0;
53 
54 void
56 {
57  NS_LOG_DEBUG ("Received size " << pkt->GetSize ());
58  g_intervalBytes += pkt->GetSize ();
59 }
60 
61 void
62 RateChange (uint64_t oldVal, uint64_t newVal)
63 {
64  NS_LOG_DEBUG ("Change from " << oldVal << " to " << newVal);
65  g_intervalRate = newVal;
66 }
67 
68 struct Step
69 {
70  double stepSize;
71  double stepTime;
72 };
73 
75 {
77  {
78  m_name = "none";
79  }
80  StandardInfo (std::string name, enum WifiPhyStandard standard, uint32_t width, bool sgi, double snrLow, double snrHigh, double xMin, double xMax, double yMax)
81  : m_name (name),
82  m_standard (standard),
83  m_width (width),
84  m_snrLow (snrLow),
85  m_snrHigh (snrHigh),
86  m_xMin (xMin),
87  m_xMax (xMax),
88  m_yMax (yMax)
89  {}
90  std::string m_name;
91  enum WifiPhyStandard m_standard;
92  uint32_t m_width;
93  double m_snrLow;
94  double m_snrHigh;
95  double m_xMin;
96  double m_xMax;
97  double m_yMax;
98 };
99 
100 void
101 ChangeSignalAndReportRate (Ptr<FixedRssLossModel> rssModel, struct Step step, double rss, Gnuplot2dDataset& rateDataset, Gnuplot2dDataset& actualDataset)
102 {
103  NS_LOG_FUNCTION (rssModel << step.stepSize << step.stepTime << rss);
104  double snr = rss - noiseDbm;
105  rateDataset.Add (snr, g_intervalRate / 1000000.0);
106  // Calculate received rate since last interval
107  double currentRate = ((g_intervalBytes * 8)/step.stepTime) / 1e6; // Mb/s
108  actualDataset.Add (snr, currentRate);
109  rssModel->SetRss (rss - step.stepSize);
110  NS_LOG_INFO ("At time " << Simulator::Now ().As (Time::S) << "; observed rate " << currentRate << "; setting new power to " << rss - step.stepSize);
111  g_intervalBytes = 0;
112  Simulator::Schedule (Seconds (step.stepTime), &ChangeSignalAndReportRate, rssModel, step, (rss - step.stepSize), rateDataset, actualDataset);
113 }
114 
115 int main (int argc, char *argv[])
116 {
117  std::vector <StandardInfo> standards;
118  uint32_t steps;
119 
120  uint32_t rtsThreshold = 999999; // disabled even for large A-MPDU
121  double stepSize = 1; // dBm
122  double stepTime = 0.5; // seconds
123  uint32_t packetSize = 1024; // bytes
124  int broadcast = 0;
125  int ap1_x = 0;
126  int ap1_y = 0;
127  int sta1_x = 5;
128  int sta1_y = 0;
129  uint16_t nss = 1;
130  bool shortGuardInterval = false;
131  uint32_t channelWidth = 20;
132  std::string standard ("802.11b");
133  StandardInfo selectedStandard;
134 
136  cmd.AddValue ("rtsThreshold", "RTS threshold", rtsThreshold);
137  cmd.AddValue ("stepSize", "Power between steps (dBm)", stepSize);
138  cmd.AddValue ("stepTime", "Time on each step (seconds)", stepTime);
139  cmd.AddValue ("broadcast", "Send broadcast instead of unicast", broadcast);
140  cmd.AddValue ("channelWidth", "Set channel width (valid only for 802.11n or ac)", channelWidth);
141  cmd.AddValue ("nss", "Set nss (valid only for 802.11n or ac)", nss);
142  cmd.AddValue ("shortGuard", "Set short guard interval (802.11n/ac)", shortGuardInterval);
143  cmd.AddValue ("standard", "Set standard (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz)", standard);
144  cmd.Parse (argc, argv);
145 
146  if (standard == "802.11b")
147  {
148  NS_ABORT_MSG_IF (channelWidth != 20 && channelWidth != 22, "Invalid channel width for standard " << standard);
149  NS_ABORT_MSG_IF (nss != 1, "Invalid nss for standard " << standard);
150  }
151  else if (standard == "802.11a" || standard == "802.11g")
152  {
153  NS_ABORT_MSG_IF (channelWidth != 20, "Invalid channel width for standard " << standard);
154  NS_ABORT_MSG_IF (nss != 1, "Invalid nss for standard " << standard);
155  }
156  else if (standard == "802.11n-5GHz" || standard == "802.11n-2.4GHz")
157  {
158  NS_ABORT_MSG_IF (channelWidth != 20 && channelWidth != 40, "Invalid channel width for standard " << standard);
159  NS_ABORT_MSG_IF (nss == 0 || nss > 4, "Invalid nss " << nss << " for standard " << standard);
160  }
161  else if (standard == "802.11ac")
162  {
163  NS_ABORT_MSG_IF (channelWidth != 20 && channelWidth != 40 && channelWidth != 80 && channelWidth != 160, "Invalid channel width for standard " << standard);
164  NS_ABORT_MSG_IF (nss == 0 || nss > 4, "Invalid nss " << nss << " for standard " << standard);
165  }
166 
167  std::string plotName = "ideal-wifi-manager-example-";
168  std::string dataName = "ideal-wifi-manager-example-";
169  plotName += standard;
170  dataName += standard;
171  if (standard == "802.11n-5GHz" || standard == "802.11n-2.4GHz" || standard == "802.11ac")
172  {
173  std::ostringstream oss;
174  std::string gi;
175  if (shortGuardInterval)
176  {
177  gi = "SGI";
178  }
179  else
180  {
181  gi = "LGI";
182  }
183  oss << "-" << channelWidth << "MHz-" << gi << "-" <<nss << "SS";
184  plotName += oss.str ();
185  dataName += oss.str ();
186  }
187  plotName += ".eps";
188  dataName += ".plt";
189  std::ofstream outfile (dataName.c_str ());
190  Gnuplot gnuplot = Gnuplot (plotName);
191 
192  // As channel width increases, scale up plot's yRange value
193  uint32_t channelRateFactor = channelWidth / 20;
194  channelRateFactor = channelRateFactor * nss;
195 
196  // The first number is channel width, second is minimum SNR, third is maximum
197  // SNR, fourth and fifth provide xrange axis limits, and sixth the yaxis
198  // maximum
199  standards.push_back (StandardInfo ("802.11a", WIFI_PHY_STANDARD_80211a, 20, false, 3, 27, 0, 30, 60));
200  standards.push_back (StandardInfo ("802.11b", WIFI_PHY_STANDARD_80211b, 22, false, -5, 11, -6, 15, 15));
201  standards.push_back (StandardInfo ("802.11g", WIFI_PHY_STANDARD_80211g, 20, false, -5, 27, -6, 30, 60));
202  standards.push_back (StandardInfo ("802.11n-5GHz", WIFI_PHY_STANDARD_80211n_5GHZ, channelWidth, shortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor));
203  standards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_PHY_STANDARD_80211n_2_4GHZ, channelWidth, shortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor));
204  standards.push_back (StandardInfo ("802.11ac", WIFI_PHY_STANDARD_80211ac, channelWidth, shortGuardInterval, 5, 35, 0, 40, 120 * channelRateFactor));
205  standards.push_back (StandardInfo ("802.11-holland", WIFI_PHY_STANDARD_holland, 20, false, 3, 27, 0, 30, 60));
206  standards.push_back (StandardInfo ("802.11-10MHz", WIFI_PHY_STANDARD_80211_10MHZ, 10, false, 3, 27, 0, 30, 60));
207  standards.push_back (StandardInfo ("802.11-5MHz", WIFI_PHY_STANDARD_80211_5MHZ, 5, false, 3, 27, 0, 30, 60));
208 
209  for (std::vector<StandardInfo>::size_type i = 0; i != standards.size(); i++)
210  {
211  if (standard == standards[i].m_name)
212  {
213  selectedStandard = standards[i];
214  }
215  }
216  NS_ABORT_IF (selectedStandard.m_name == "none");
217  std::cout << "Testing " << selectedStandard.m_name << "..." << std::endl;
218  NS_ABORT_MSG_IF (selectedStandard.m_snrLow >= selectedStandard.m_snrHigh, "SNR values in wrong order");
219  steps = static_cast<uint32_t> (std::floor ((selectedStandard.m_snrHigh - selectedStandard.m_snrLow )/stepSize)) + 1;
220  NS_LOG_DEBUG ("Using " << steps << " steps for SNR range " << selectedStandard.m_snrLow << ":" << selectedStandard.m_snrHigh);
221  Ptr<Node> clientNode = CreateObject<Node> ();
222  Ptr<Node> serverNode = CreateObject<Node> ();
223 
225  wifi.SetStandard (selectedStandard.m_standard);
227  wifiPhy.Set ("RxGain", DoubleValue (0.0));
228  wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0));
229  wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0));
230  wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0));
231 
232  Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> ();
233  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
234  wifiChannel->SetPropagationDelayModel (delayModel);
235  Ptr<FixedRssLossModel> rssLossModel = CreateObject<FixedRssLossModel> ();
236  wifiChannel->SetPropagationLossModel (rssLossModel);
237  wifiPhy.SetChannel (wifiChannel);
238 
239  wifi.SetRemoteStationManager ("ns3::IdealWifiManager", "RtsCtsThreshold", UintegerValue (rtsThreshold));
240 
241  // Use Adhoc so we don't get into association issues
242  NetDeviceContainer serverDevice;
243  NetDeviceContainer clientDevice;
244 
245  WifiMacHelper wifiMac;
246  wifiMac.SetType ("ns3::AdhocWifiMac");
247  serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode);
248  clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode);
249 
250  Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::IdealWifiManager/Rate", MakeCallback(&RateChange));
251  // Configure the mobility.
253  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
254  //Initial position of AP and STA
255  positionAlloc->Add (Vector (ap1_x, ap1_y, 0.0));
256  NS_LOG_INFO ("Setting initial AP position to " << Vector (ap1_x, ap1_y, 0.0));
257  positionAlloc->Add (Vector (sta1_x, sta1_y, 0.0));
258  NS_LOG_INFO ("Setting initial STA position to " << Vector (sta1_x, sta1_y, 0.0));
259  mobility.SetPositionAllocator (positionAlloc);
260  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
261  mobility.Install (clientNode);
262  mobility.Install (serverNode);
263 
264  Gnuplot2dDataset rateDataset (selectedStandard.m_name + std::string ("-rate selected"));
265  Gnuplot2dDataset actualDataset (selectedStandard.m_name + std::string ("-observed"));
266  struct Step step;
267  step.stepSize = stepSize;
268  step.stepTime = stepTime;
269 
270  // Perform post-install configuration from defaults for channel width,
271  // guard interval, and nss, if necessary
272  // Obtain pointer to the WifiPhy
273  Ptr<NetDevice> ndClient = clientDevice.Get (0);
274  Ptr<NetDevice> ndServer = serverDevice.Get (0);
275  Ptr<WifiNetDevice> wndClient = ndClient->GetObject<WifiNetDevice> ();
276  Ptr<WifiNetDevice> wndServer = ndServer->GetObject<WifiNetDevice> ();
277  Ptr<WifiPhy> wifiPhyPtrClient = wndClient->GetPhy ();
278  Ptr<WifiPhy> wifiPhyPtrServer = wndServer->GetPhy ();
279  wifiPhyPtrClient->SetNumberOfTransmitAntennas (nss);
280  wifiPhyPtrClient->SetNumberOfReceiveAntennas (nss);
281  wifiPhyPtrServer->SetNumberOfTransmitAntennas (nss);
282  wifiPhyPtrServer->SetNumberOfReceiveAntennas (nss);
283  // Only set the channel width and guard interval for HT and VHT modes
284  if (selectedStandard.m_name == "802.11n-5GHz" ||
285  selectedStandard.m_name == "802.11n-2.4GHz" ||
286  selectedStandard.m_name == "802.11ac")
287  {
288  wifiPhyPtrClient->SetChannelWidth (selectedStandard.m_width);
289  wifiPhyPtrServer->SetChannelWidth (selectedStandard.m_width);
290  wifiPhyPtrClient->SetGuardInterval (shortGuardInterval);
291  wifiPhyPtrServer->SetGuardInterval (shortGuardInterval);
292  }
293  NS_LOG_DEBUG ("Channel width " << wifiPhyPtrClient->GetChannelWidth () << " noiseDbm " << noiseDbm);
294  NS_LOG_DEBUG ("NSS " << wifiPhyPtrClient->GetSupportedTxSpatialStreams ());
295 
296  // Configure signal and noise, and schedule first iteration
297  noiseDbm += 10 * log10 (selectedStandard.m_width * 1000000);
298  double rssCurrent = (selectedStandard.m_snrHigh + noiseDbm);
299  rssLossModel->SetRss (rssCurrent);
300  NS_LOG_INFO ("Setting initial Rss to " << rssCurrent);
301  //Move the STA by stepsSize meters every stepTime seconds
302  Simulator::Schedule (Seconds (0.5 + stepTime), &ChangeSignalAndReportRate, rssLossModel, step, rssCurrent, rateDataset, actualDataset);
303 
304  PacketSocketHelper packetSocketHelper;
305  packetSocketHelper.Install (serverNode);
306  packetSocketHelper.Install (clientNode);
307 
308  PacketSocketAddress socketAddr;
309  socketAddr.SetSingleDevice (serverDevice.Get (0)->GetIfIndex ());
310  if (broadcast)
311  {
312  socketAddr.SetPhysicalAddress (serverDevice.Get (0)->GetBroadcast ());
313  }
314  else
315  {
316  socketAddr.SetPhysicalAddress (serverDevice.Get (0)->GetAddress ());
317  }
318  // Arbitrary protocol type.
319  // Note: PacketSocket doesn't have any L4 multiplexing or demultiplexing
320  // The only mux/demux is based on the protocol field
321  socketAddr.SetProtocol (1);
322 
323  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
324  client->SetRemote (socketAddr);
325  client->SetStartTime (Seconds (0.5)); // allow simulation warmup
326  client->SetAttribute ("MaxPackets", UintegerValue (0)); // unlimited
327  client->SetAttribute ("PacketSize", UintegerValue (packetSize));
328 
329  // Set a maximum rate 10% above the yMax specified for the selected standard
330  double rate = selectedStandard.m_yMax * 1e6 * 1.10;
331  double clientInterval = static_cast<double> (packetSize) * 8 / rate;
332  NS_LOG_DEBUG ("Setting interval to " << clientInterval << " sec for rate of " << rate << " bits/sec");
333 
334  client->SetAttribute ("Interval", TimeValue (Seconds (clientInterval)));
335  clientNode->AddApplication (client);
336 
337  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
338  server->SetLocal (socketAddr);
340  serverNode->AddApplication (server);
341 
342  Simulator::Stop (Seconds ((steps + 1) * stepTime));
343  Simulator::Run ();
345 
346  gnuplot.AddDataset (rateDataset);
347  gnuplot.AddDataset (actualDataset);
348 
349  std::ostringstream xMinStr, xMaxStr, yMaxStr;
350  std::string xRangeStr ("set xrange [");
351  xMinStr << selectedStandard.m_xMin;
352  xRangeStr.append (xMinStr.str ());
353  xRangeStr.append (":");
354  xMaxStr << selectedStandard.m_xMax;
355  xRangeStr.append (xMaxStr.str ());
356  xRangeStr.append ("]");
357  std::string yRangeStr ("set yrange [0:");
358  yMaxStr << selectedStandard.m_yMax;
359  yRangeStr.append (yMaxStr.str ());
360  yRangeStr.append ("]");
361 
362  std::ostringstream widthStrStr;
363  std::ostringstream nssStrStr;
364  std::string title ("Wi-Fi ideal rate control: ");
365  title.append (standard);
366  title.append (" channel width: ");
367  widthStrStr << selectedStandard.m_width;
368  title.append (widthStrStr.str ());
369  title.append (" MHz nss: ");
370  nssStrStr << nss;
371  title.append (nssStrStr.str ());
372  if (shortGuardInterval == true)
373  {
374  title.append (" shortGuard: true");
375  }
376 
377  gnuplot.SetTerminal ("postscript eps color enh \"Times-BoldItalic\"");
378  gnuplot.SetLegend ("SNR (dB)", "Rate (Mb/s)");
379  gnuplot.SetTitle (title);
380  gnuplot.SetExtra (xRangeStr);
381  gnuplot.AppendExtra (yRangeStr);
382  gnuplot.AppendExtra ("set key top left");
383  gnuplot.GenerateOutput (outfile);
384  outfile.close ();
385 
386  return 0;
387 }
388 
ERP-OFDM PHY (Clause 19, Section 19.5)
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:112
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:157
virtual void SetNumberOfTransmitAntennas(uint32_t tx)
Definition: wifi-phy.cc:1163
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
OFDM PHY for the 5 GHz band (Clause 17 with 5 MHz channel bandwidth)
void ChangeSignalAndReportRate(Ptr< FixedRssLossModel > rssModel, struct Step step, double rss, Gnuplot2dDataset &rateDataset, Gnuplot2dDataset &actualDataset)
const double NOISE_DBM_Hz
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
HT OFDM PHY for the 5 GHz band (clause 20)
Class to represent a 2D points plot.
Definition: gnuplot.h:113
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:462
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Make it easy to create and manage PHY objects for the yans model.
void PacketRx(Ptr< const Packet > pkt, const Address &addr)
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
an address for a packet socket
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
static void Run(void)
Run the simulation.
Definition: simulator.cc:201
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:792
virtual void SetNumberOfReceiveAntennas(uint32_t rx)
Definition: wifi-phy.cc:1170
second
Definition: nstime.h:114
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
HT OFDM PHY for the 2.4 GHz band (clause 20)
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
virtual void SetGuardInterval(bool guardInterval)
Enable or disable short/long guard interval.
Definition: wifi-phy.cc:572
STL namespace.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:231
StandardInfo(std::string name, enum WifiPhyStandard standard, uint32_t width, bool sgi, double snrLow, double snrHigh, double xMin, double xMax, double yMax)
uint64_t g_intervalRate
Give ns3::PacketSocket powers to ns3::Node.
tuple cmd
Definition: second.py:35
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
a polymophic address class
Definition: address.h:90
void SetChannel(Ptr< YansWifiChannel > channel)
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Ptr< WifiPhy > GetPhy(void) const
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1238
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition: gnuplot.h:367
AttributeValue implementation for Time.
Definition: nstime.h:957
virtual void SetChannelWidth(uint32_t channelwidth)
Definition: wifi-phy.cc:1149
Hold an unsigned integer type.
Definition: uinteger.h:44
holds a vector of ns3::NetDevice pointers
Hold together all Wifi-related objects.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:824
void Add(double x, double y)
Definition: gnuplot.cc:359
Parse command-line arguments.
Definition: command-line.h:205
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:165
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
enum WifiPhyStandard m_standard
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:299
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
VHT OFDM PHY (clause 22)
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
create MAC layers for a ns3::WifiNetDevice.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:224
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
Helper class used to assign positions and mobility models to nodes.
double noiseDbm
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:495
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:209
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
void SetProtocol(uint16_t protocol)
Set the protocol.
void Add(Vector v)
Add a position to the list of positions.
void Parse(int argc, char *argv[])
Parse the program arguments.
tuple wifi
Definition: third.py:89
static const uint32_t packetSize
void RateChange(uint64_t oldVal, uint64_t newVal)
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:191
double g_intervalBytes
void SetStartTime(Time start)
Specify application start time.
Definition: application.cc:69