A Discrete-Event Network Simulator
API
power-adaptation-distance.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Universidad de la República - Uruguay
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: Matias Richart <mrichart@fing.edu.uy>
19  */
20 
88 #include <sstream>
89 #include <fstream>
90 #include <math.h>
91 
92 #include "ns3/core-module.h"
93 #include "ns3/network-module.h"
94 #include "ns3/internet-module.h"
95 #include "ns3/mobility-module.h"
96 #include "ns3/wifi-module.h"
97 #include "ns3/applications-module.h"
98 #include "ns3/stats-module.h"
99 #include "ns3/flow-monitor-module.h"
100 
101 using namespace ns3;
102 using namespace std;
103 
104 NS_LOG_COMPONENT_DEFINE ("PowerAdaptationDistance");
105 
106 // packet size generated at the AP
107 static const uint32_t packetSize = 1420;
108 
110 {
111 public:
113 
114  void CheckStatistics (double time);
115 
116  void PhyCallback (std::string path, Ptr<const Packet> packet);
117  void RxCallback (std::string path, Ptr<const Packet> packet, const Address &from);
118  void PowerCallback (std::string path, uint8_t power, Mac48Address dest);
119  void RateCallback (std::string path, uint32_t rate, Mac48Address dest);
120  void SetPosition (Ptr<Node> node, Vector position);
121  void AdvancePosition (Ptr<Node> node, int stepsSize, int stepsTime);
122  Vector GetPosition (Ptr<Node> node);
123 
124  Gnuplot2dDataset GetDatafile ();
125  Gnuplot2dDataset GetPowerDatafile ();
126 
127 private:
128  typedef std::vector<std::pair<Time,WifiMode> > TxTime;
129  void SetupPhy (Ptr<WifiPhy> phy);
130  Time GetCalcTxTime (WifiMode mode);
131 
132  std::map<Mac48Address, double> actualPower;
133  std::map<Mac48Address, WifiMode> actualMode;
134  uint32_t m_bytesTotal;
135  double totalEnergy;
136  double totalTime;
138  TxTime timeTable;
141 };
142 
144 {
145  Ptr<NetDevice> device = aps.Get (0);
146  Ptr<WifiNetDevice> wifiDevice = DynamicCast<WifiNetDevice> (device);
147  Ptr<WifiPhy> phy = wifiDevice->GetPhy ();
148  myPhy = phy;
149  SetupPhy (phy);
150  for (uint32_t j = 0; j < stas.GetN (); j++)
151  {
152  Ptr<NetDevice> staDevice = stas.Get (j);
153  Ptr<WifiNetDevice> wifiStaDevice = DynamicCast<WifiNetDevice> (staDevice);
154  Mac48Address addr = wifiStaDevice->GetMac ()->GetAddress ();
155  actualPower[addr] = 17;
156  actualMode[addr] = phy->GetMode (0);
157  }
158  actualMode[Mac48Address ("ff:ff:ff:ff:ff:ff")] = phy->GetMode (0);
159  totalEnergy = 0;
160  totalTime = 0;
161  m_bytesTotal = 0;
162  m_output.SetTitle ("Throughput Mbits/s");
163  m_output_power.SetTitle ("Average Transmit Power");
164 }
165 
166 void
168 {
169  uint32_t nModes = phy->GetNModes ();
170  for (uint32_t i = 0; i < nModes; i++)
171  {
172  WifiMode mode = phy->GetMode (i);
173  WifiTxVector txVector;
174  txVector.SetMode (mode);
175  timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode));
176  }
177 }
178 
179 Time
181 {
182  for (TxTime::const_iterator i = timeTable.begin (); i != timeTable.end (); i++)
183  {
184  if (mode == i->second)
185  {
186  return i->first;
187  }
188  }
189  NS_ASSERT (false);
190  return Seconds (0);
191 }
192 
193 void
195 {
196  WifiMacHeader head;
197  packet->PeekHeader (head);
198  Mac48Address dest = head.GetAddr1 ();
199 
200  if (head.GetType() == WIFI_MAC_DATA)
201  {
202  totalEnergy += pow (10.0, actualPower[dest] / 10.0) * GetCalcTxTime (actualMode[dest]).GetSeconds ();
203  totalTime += GetCalcTxTime (actualMode[dest]).GetSeconds ();
204  }
205 }
206 
207 void
208 NodeStatistics::PowerCallback (std::string path, uint8_t power, Mac48Address dest)
209 {
210  double txPowerBaseDbm = myPhy->GetTxPowerStart ();
211  double txPowerEndDbm = myPhy->GetTxPowerEnd ();
212  uint32_t nTxPower = myPhy->GetNTxPower ();
213  double dbm;
214  if (nTxPower > 1)
215  {
216  dbm = txPowerBaseDbm + power * (txPowerEndDbm - txPowerBaseDbm) / (nTxPower - 1);
217  }
218  else
219  {
220  NS_ASSERT_MSG (txPowerBaseDbm == txPowerEndDbm, "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
221  dbm = txPowerBaseDbm;
222  }
223  actualPower[dest] = dbm;
224 }
225 
226 void
227 NodeStatistics::RateCallback (std::string path, uint32_t rate, Mac48Address dest)
228 {
229  actualMode[dest] = myPhy->GetMode (rate);
230 }
231 
232 void
233 NodeStatistics::RxCallback (std::string path, Ptr<const Packet> packet, const Address &from)
234 {
235  m_bytesTotal += packet->GetSize ();
236 }
237 
238 void
240 {
241 
242 }
243 
244 void
245 NodeStatistics::SetPosition (Ptr<Node> node, Vector position)
246 {
248  mobility->SetPosition (position);
249 }
250 
251 Vector
253 {
255  return mobility->GetPosition ();
256 }
257 
258 void
259 NodeStatistics::AdvancePosition (Ptr<Node> node, int stepsSize, int stepsTime)
260 {
261  Vector pos = GetPosition (node);
262  double mbs = ((m_bytesTotal * 8.0) / (1000000 * stepsTime));
263  m_bytesTotal = 0;
264  double atp = totalEnergy / stepsTime;
265  totalEnergy = 0;
266  totalTime = 0;
267  m_output_power.Add (pos.x, atp);
268  m_output.Add (pos.x, mbs);
269  pos.x += stepsSize;
270  SetPosition (node, pos);
271  NS_LOG_INFO ("At time " << Simulator::Now ().GetSeconds () << " sec; setting new position to " << pos);
272  Simulator::Schedule (Seconds (stepsTime), &NodeStatistics::AdvancePosition, this, node, stepsSize, stepsTime);
273 }
274 
277 {
278  return m_output;
279 }
280 
283 {
284  return m_output_power;
285 }
286 
287 void PowerCallback (std::string path, uint8_t power, Mac48Address dest)
288 {
289  NS_LOG_INFO ((Simulator::Now ()).GetSeconds () << " " << dest << " Power " << (int)power);
290 }
291 
292 void RateCallback (std::string path, uint32_t rate, Mac48Address dest)
293 {
294  NS_LOG_INFO ((Simulator::Now ()).GetSeconds () << " " << dest << " Rate " << rate);
295 }
296 
297 int main (int argc, char *argv[])
298 {
299  double maxPower = 17;
300  double minPower = 0;
301  uint32_t powerLevels = 18;
302 
303  uint32_t rtsThreshold = 2346;
304  std::string manager = "ns3::ParfWifiManager";
305  std::string outputFileName = "parf";
306  int ap1_x = 0;
307  int ap1_y = 0;
308  int sta1_x = 5;
309  int sta1_y = 0;
310  uint32_t steps = 200;
311  uint32_t stepsSize = 1;
312  uint32_t stepsTime = 1;
313 
315  cmd.AddValue ("manager", "PRC Manager", manager);
316  cmd.AddValue ("rtsThreshold", "RTS threshold", rtsThreshold);
317  cmd.AddValue ("outputFileName", "Output filename", outputFileName);
318  cmd.AddValue ("steps", "How many different distances to try", steps);
319  cmd.AddValue ("stepsTime", "Time on each step", stepsTime);
320  cmd.AddValue ("stepsSize", "Distance between steps", stepsSize);
321  cmd.AddValue ("maxPower", "Maximum available transmission level (dbm).", maxPower);
322  cmd.AddValue ("minPower", "Minimum available transmission level (dbm).", minPower);
323  cmd.AddValue ("powerLevels", "Number of transmission power levels available between "
324  "TxPowerStart and TxPowerEnd included.", powerLevels);
325  cmd.AddValue ("AP1_x", "Position of AP1 in x coordinate", ap1_x);
326  cmd.AddValue ("AP1_y", "Position of AP1 in y coordinate", ap1_y);
327  cmd.AddValue ("STA1_x", "Position of STA1 in x coordinate", sta1_x);
328  cmd.AddValue ("STA1_y", "Position of STA1 in y coordinate", sta1_y);
329  cmd.Parse (argc, argv);
330 
331  if (steps == 0)
332  {
333  std::cout << "Exiting without running simulation; steps value of 0" << std::endl;
334  }
335 
336  uint32_t simuTime = (steps + 1) * stepsTime;
337 
338  // Define the APs
339  NodeContainer wifiApNodes;
340  wifiApNodes.Create (1);
341 
342  //Define the STAs
344  wifiStaNodes.Create (1);
345 
348  WifiMacHelper wifiMac;
351 
352  wifiPhy.SetChannel (wifiChannel.Create ());
353 
354  NetDeviceContainer wifiApDevices;
355  NetDeviceContainer wifiStaDevices;
356  NetDeviceContainer wifiDevices;
357 
358  //Configure the STA node
359  wifi.SetRemoteStationManager ("ns3::MinstrelWifiManager", "RtsCtsThreshold", UintegerValue (rtsThreshold));
360  wifiPhy.Set ("TxPowerStart", DoubleValue (maxPower));
361  wifiPhy.Set ("TxPowerEnd", DoubleValue (maxPower));
362 
363  Ssid ssid = Ssid ("AP");
364  wifiMac.SetType ("ns3::StaWifiMac",
365  "Ssid", SsidValue (ssid));
366  wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0)));
367 
368  //Configure the AP node
369  wifi.SetRemoteStationManager (manager, "DefaultTxPowerLevel", UintegerValue (maxPower), "RtsCtsThreshold", UintegerValue (rtsThreshold));
370  wifiPhy.Set ("TxPowerStart", DoubleValue (minPower));
371  wifiPhy.Set ("TxPowerEnd", DoubleValue (maxPower));
372  wifiPhy.Set ("TxPowerLevels", UintegerValue (powerLevels));
373 
374  ssid = Ssid ("AP");
375  wifiMac.SetType ("ns3::ApWifiMac",
376  "Ssid", SsidValue (ssid));
377  wifiApDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiApNodes.Get (0)));
378 
379  wifiDevices.Add (wifiStaDevices);
380  wifiDevices.Add (wifiApDevices);
381 
382  // Configure the mobility.
384  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
385  //Initial position of AP and STA
386  positionAlloc->Add (Vector (ap1_x, ap1_y, 0.0));
387  NS_LOG_INFO ("Setting initial AP position to " << Vector (ap1_x, ap1_y, 0.0));
388  positionAlloc->Add (Vector (sta1_x, sta1_y, 0.0));
389  NS_LOG_INFO ("Setting initial STA position to " << Vector (sta1_x, sta1_y, 0.0));
390  mobility.SetPositionAllocator (positionAlloc);
391  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
392  mobility.Install (wifiApNodes.Get (0));
393  mobility.Install (wifiStaNodes.Get (0));
394 
395  //Statistics counter
396  NodeStatistics statistics = NodeStatistics (wifiApDevices, wifiStaDevices);
397 
398  //Move the STA by stepsSize meters every stepsTime seconds
399  Simulator::Schedule (Seconds (0.5 + stepsTime), &NodeStatistics::AdvancePosition, &statistics, wifiStaNodes.Get (0), stepsSize, stepsTime);
400 
401  //Configure the IP stack
403  stack.Install (wifiApNodes);
404  stack.Install (wifiStaNodes);
406  address.SetBase ("10.1.1.0", "255.255.255.0");
407  Ipv4InterfaceContainer i = address.Assign (wifiDevices);
408  Ipv4Address sinkAddress = i.GetAddress (0);
409  uint16_t port = 9;
410 
411  //Configure the CBR generator
412  PacketSinkHelper sink ("ns3::UdpSocketFactory", InetSocketAddress (sinkAddress, port));
413  ApplicationContainer apps_sink = sink.Install (wifiStaNodes.Get (0));
414 
415  OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (sinkAddress, port));
416  onoff.SetConstantRate (DataRate ("54Mb/s"), packetSize);
417  onoff.SetAttribute ("StartTime", TimeValue (Seconds (0.5)));
418  onoff.SetAttribute ("StopTime", TimeValue (Seconds (simuTime)));
419  ApplicationContainer apps_source = onoff.Install (wifiApNodes.Get (0));
420 
421  apps_sink.Start (Seconds (0.5));
422  apps_sink.Stop (Seconds (simuTime));
423 
424  //------------------------------------------------------------
425  //-- Setup stats and data collection
426  //--------------------------------------------
427 
428  //Register packet receptions to calculate throughput
429  Config::Connect ("/NodeList/1/ApplicationList/*/$ns3::PacketSink/Rx",
430  MakeCallback (&NodeStatistics::RxCallback, &statistics));
431 
432  //Register power and rate changes to calculate the Average Transmit Power
433  Config::Connect ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$" + manager + "/PowerChange",
435  Config::Connect ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$" + manager + "/RateChange",
437 
438  Config::Connect ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin",
439  MakeCallback (&NodeStatistics::PhyCallback, &statistics));
440 
441  //Callbacks to print every change of power and rate
442  Config::Connect ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$" + manager + "/PowerChange",
444  Config::Connect ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$" + manager + "/RateChange",
446 
447  Simulator::Stop (Seconds (simuTime));
448  Simulator::Run ();
449 
450  std::ofstream outfile (("throughput-" + outputFileName + ".plt").c_str ());
451  Gnuplot gnuplot = Gnuplot (("throughput-" + outputFileName + ".eps").c_str (), "Throughput");
452  gnuplot.SetTerminal ("post eps color enhanced");
453  gnuplot.SetLegend ("Time (seconds)", "Throughput (Mb/s)");
454  gnuplot.SetTitle ("Throughput (AP to STA) vs time");
455  gnuplot.AddDataset (statistics.GetDatafile ());
456  gnuplot.GenerateOutput (outfile);
457 
458  if (manager.compare ("ns3::ParfWifiManager") == 0 ||
459  manager.compare ("ns3::AparfWifiManager") == 0)
460  {
461  std::ofstream outfile2 (("power-" + outputFileName + ".plt").c_str ());
462  gnuplot = Gnuplot (("power-" + outputFileName + ".eps").c_str (), "Average Transmit Power");
463  gnuplot.SetTerminal ("post eps color enhanced");
464  gnuplot.SetLegend ("Time (seconds)", "Power (mW)");
465  gnuplot.SetTitle ("Average transmit power (AP to STA) vs time");
466  gnuplot.AddDataset (statistics.GetPowerDatafile ());
467  gnuplot.GenerateOutput (outfile2);
468  }
469 
471 
472  return 0;
473 }
Custom version of log2() to deal with Bug 1467.
Ptr< PacketSink > sink
Definition: wifi-tcp.cc:47
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:112
holds a vector of ns3::Application pointers.
void SetupPhy(Ptr< WifiPhy > phy)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
an Inet address class
void PowerCallback(std::string path, uint8_t power, Mac48Address dest)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetPosition(Ptr< Node > node, Vector position)
static void AdvancePosition(Ptr< Node > node)
Definition: wifi-ap.cc:100
Class to represent a 2D points plot.
Definition: gnuplot.h:113
holds a vector of std::pair of Ptr and interface index.
Ptr< YansWifiChannel > Create(void) const
void SetRemoteStationManager(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())
Definition: wifi-helper.cc:683
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.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:315
#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
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
enum WifiMacType GetType(void) const
Return the type (enum WifiMacType)
aggregate IP/TCP/UDP functionality to existing Nodes.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:792
Vector GetPosition(void) const
void AddDataset(const GnuplotDataset &dataset)
Definition: gnuplot.cc:756
void RateCallback(std::string path, uint32_t rate, Mac48Address dest)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
STL namespace.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:231
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
tuple cmd
Definition: second.py:35
Gnuplot2dDataset GetPowerDatafile()
void AdvancePosition(Ptr< Node > node, int stepsSize, int stepsTime)
static void SetPosition(Ptr< Node > node, Vector position)
Definition: wifi-ap.cc:86
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wifi-helper.cc:712
uint16_t port
Definition: dsdv-manet.cc:44
a polymophic address class
Definition: address.h:90
Gnuplot2dDataset GetDatafile()
void RxCallback(std::string path, Ptr< const Packet > packet, const Address &from)
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Class for representing data rates.
Definition: data-rate.h:88
Keep track of the current position and velocity of an object.
void SetChannel(Ptr< YansWifiChannel > channel)
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
tuple phy
Definition: third.py:86
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
void SetTitle(const std::string &title)
Definition: gnuplot.cc:730
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Hold an unsigned integer type.
Definition: uinteger.h:44
void RateCallback(std::string path, uint32_t rate, Mac48Address dest)
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Definition: wifi-helper.cc:706
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency)
Definition: wifi-phy.cc:1942
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Definition: gnuplot.cc:762
Time GetCalcTxTime(WifiMode mode)
virtual uint32_t GetFrequency(void) const
Definition: wifi-phy.cc:1143
virtual uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:2850
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
void PowerCallback(std::string path, uint8_t power, Mac48Address dest)
Parse command-line arguments.
Definition: command-line.h:205
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:835
void SetLegend(const std::string &xLegend, const std::string &yLegend)
Definition: gnuplot.cc:736
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:165
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:278
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Gnuplot2dDataset m_output_power
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())
an EUI-48 address
Definition: mac48-address.h:43
tuple ssid
Definition: third.py:93
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:224
void SetPosition(const Vector &position)
tuple stack
Definition: first.py:34
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void PhyCallback(std::string path, Ptr< const Packet > packet)
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())
#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:90
Helper class used to assign positions and mobility models to nodes.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
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
std::map< Mac48Address, WifiMode > actualMode
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
std::vector< std::pair< Time, WifiMode > > TxTime
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
AttributeValue implementation for Ssid.
Definition: ssid.h:95
void Add(Vector v)
Add a position to the list of positions.
NodeStatistics(NetDeviceContainer aps, NetDeviceContainer stas)
Ptr< WifiMac > GetMac(void) const
void CheckStatistics(double time)
void Parse(int argc, char *argv[])
Parse the program arguments.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
tuple wifi
Definition: third.py:89
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
static const uint32_t packetSize
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
tuple address
Definition: first.py:37
std::map< Mac48Address, double > actualPower
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
void SetTerminal(const std::string &terminal)
Definition: gnuplot.cc:724
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
Vector GetPosition(Ptr< Node > node)
Implements the IEEE 802.11 MAC header.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
virtual WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:2856
tuple wifiStaNodes
Definition: third.py:81