LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2014 Universidad de la República - Uruguay | 3 * Copyright (c) 2014 Universidad de la República - Uruguay |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 { | 75 { |
76 public: | 76 public: |
77 NodeStatistics (NetDeviceContainer aps, NetDeviceContainer stas); | 77 NodeStatistics (NetDeviceContainer aps, NetDeviceContainer stas); |
78 | 78 |
79 void CheckStatistics (double time); | 79 void CheckStatistics (double time); |
80 | 80 |
81 void PhyCallback (std::string path, Ptr<const Packet> packet); | 81 void PhyCallback (std::string path, Ptr<const Packet> packet); |
82 void RxCallback (std::string path, Ptr<const Packet> packet, const Address &fr
om); | 82 void RxCallback (std::string path, Ptr<const Packet> packet, const Address &fr
om); |
83 void PowerCallback (std::string path, double oldPower, double newPower, Mac48A
ddress dest); | 83 void PowerCallback (std::string path, double oldPower, double newPower, Mac48A
ddress dest); |
84 void RateCallback (std::string path, DataRate oldRate, DataRate newRate, Mac48
Address dest); | 84 void RateCallback (std::string path, DataRate oldRate, DataRate newRate, Mac48
Address dest); |
85 void StateCallback (std::string path, Time init, Time duration, enum WifiPhySt
ate::State state); | 85 void StateCallback (std::string path, Time init, Time duration, WifiPhyState s
tate); |
86 | 86 |
87 Gnuplot2dDataset GetDatafile (); | 87 Gnuplot2dDataset GetDatafile (); |
88 Gnuplot2dDataset GetPowerDatafile (); | 88 Gnuplot2dDataset GetPowerDatafile (); |
89 Gnuplot2dDataset GetIdleDatafile (); | 89 Gnuplot2dDataset GetIdleDatafile (); |
90 Gnuplot2dDataset GetBusyDatafile (); | 90 Gnuplot2dDataset GetBusyDatafile (); |
91 Gnuplot2dDataset GetTxDatafile (); | 91 Gnuplot2dDataset GetTxDatafile (); |
92 Gnuplot2dDataset GetRxDatafile (); | 92 Gnuplot2dDataset GetRxDatafile (); |
93 | 93 |
94 double GetBusyTime (); | 94 double GetBusyTime (); |
95 | 95 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 currentPower[dest] = newPower; | 209 currentPower[dest] = newPower; |
210 } | 210 } |
211 | 211 |
212 void | 212 void |
213 NodeStatistics::RateCallback (std::string path, DataRate oldRate, DataRate newRa
te, Mac48Address dest) | 213 NodeStatistics::RateCallback (std::string path, DataRate oldRate, DataRate newRa
te, Mac48Address dest) |
214 { | 214 { |
215 currentRate[dest] = newRate; | 215 currentRate[dest] = newRate; |
216 } | 216 } |
217 | 217 |
218 void | 218 void |
219 NodeStatistics::StateCallback (std::string path, Time init, Time duration, enum
WifiPhyState::State state) | 219 NodeStatistics::StateCallback (std::string path, Time init, Time duration, WifiP
hyState state) |
220 { | 220 { |
221 if (state == WifiPhyState::CCA_BUSY) | 221 if (state == WifiPhyState::CCA_BUSY) |
222 { | 222 { |
223 busyTime += duration.GetSeconds (); | 223 busyTime += duration.GetSeconds (); |
224 totalBusyTime += duration.GetSeconds (); | 224 totalBusyTime += duration.GetSeconds (); |
225 } | 225 } |
226 else if (state == WifiPhyState::IDLE) | 226 else if (state == WifiPhyState::IDLE) |
227 { | 227 { |
228 idleTime += duration.GetSeconds (); | 228 idleTime += duration.GetSeconds (); |
229 totalIdleTime += duration.GetSeconds (); | 229 totalIdleTime += duration.GetSeconds (); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); | 376 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); |
377 | 377 |
378 wifiPhy.SetChannel (wifiChannel.Create ()); | 378 wifiPhy.SetChannel (wifiChannel.Create ()); |
379 | 379 |
380 NetDeviceContainer wifiApDevices; | 380 NetDeviceContainer wifiApDevices; |
381 NetDeviceContainer wifiStaDevices; | 381 NetDeviceContainer wifiStaDevices; |
382 NetDeviceContainer wifiDevices; | 382 NetDeviceContainer wifiDevices; |
383 | 383 |
384 //Configure the STA nodes | 384 //Configure the STA nodes |
385 wifi.SetRemoteStationManager ("ns3::AarfWifiManager", "RtsCtsThreshold", Uinte
gerValue (rtsThreshold)); | 385 wifi.SetRemoteStationManager ("ns3::AarfWifiManager", "RtsCtsThreshold", Uinte
gerValue (rtsThreshold)); |
386 //wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode",Str
ingValue ("ErpOfdmRate6Mbps"),"ControlMode",StringValue ("ErpOfdmRate6Mbps")); | |
387 wifiPhy.Set ("TxPowerStart", DoubleValue (maxPower)); | 386 wifiPhy.Set ("TxPowerStart", DoubleValue (maxPower)); |
388 wifiPhy.Set ("TxPowerEnd", DoubleValue (maxPower)); | 387 wifiPhy.Set ("TxPowerEnd", DoubleValue (maxPower)); |
389 | 388 |
390 Ssid ssid = Ssid ("AP0"); | 389 Ssid ssid = Ssid ("AP0"); |
391 wifiMac.SetType ("ns3::StaWifiMac", | 390 wifiMac.SetType ("ns3::StaWifiMac", |
392 "Ssid", SsidValue (ssid), | 391 "Ssid", SsidValue (ssid), |
393 "MaxMissedBeacons", UintegerValue (1000)); | 392 "MaxMissedBeacons", UintegerValue (1000)); |
394 wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0))); | 393 wifiStaDevices.Add (wifi.Install (wifiPhy, wifiMac, wifiStaNodes.Get (0))); |
395 | 394 |
396 ssid = Ssid ("AP1"); | 395 ssid = Ssid ("AP1"); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 gnuplot.SetTerminal ("post eps color enhanced"); | 650 gnuplot.SetTerminal ("post eps color enhanced"); |
652 gnuplot.SetLegend ("Time (seconds)", "Percent"); | 651 gnuplot.SetLegend ("Time (seconds)", "Percent"); |
653 gnuplot.SetTitle ("Percentage time AP1 in Idle state vs time"); | 652 gnuplot.SetTitle ("Percentage time AP1 in Idle state vs time"); |
654 gnuplot.AddDataset (statisticsAp1.GetIdleDatafile ()); | 653 gnuplot.AddDataset (statisticsAp1.GetIdleDatafile ()); |
655 gnuplot.GenerateOutput (outfileIdle1); | 654 gnuplot.GenerateOutput (outfileIdle1); |
656 | 655 |
657 Simulator::Destroy (); | 656 Simulator::Destroy (); |
658 | 657 |
659 return 0; | 658 return 0; |
660 } | 659 } |
LEFT | RIGHT |