Re: comparison of all the standards in instructure mode

106 views
Skip to first unread message
Message has been deleted

Tommaso Pecorella

unread,
Mar 29, 2014, 2:49:02 PM3/29/14
to ns-3-...@googlegroups.com
Hi,

sorry, but... no, I'm not going to help you.

Reasons:
  1. The fact that you did it for ad-hoc means that you should have learnt enough to do it in infrastructured mode as well.
  2. If you don't know (yet), it means that you didn't read the tutorial. Read it.
  3. This smells like a Class assignment.
Point 3 is the most important, and since I'm fairly sure it is a class assignment, I'm not going to help you cheating.

If you ask a more specific question, we can help, but wringing enough code to (basically) enable a blind copy-paste as the only effort to complete the assignment is cheating.

If I'm wrong, then we could as well help, but points 1 and 2 are still there. As a consequence, I'd sternly suggest to read the tutorial, understand at least the ns-3 ABC, plan an experiment and run it.

Cheers,

T.

PS: files aren't transferred to a distance...


On Saturday, March 29, 2014 7:32:12 PM UTC+1, neha singh wrote:
hi,

I have started working on this project  on ns-3 a week ago. What I need to do is  to compare the performance of the various standards of 802.11 in a similar network. I have already implemented the standards in adhoc mode by modifying wifi-adhoc.cc and have got those two gnu plots for each standard.
Next i need to compare their performance in infrastructure mode. I have seen wifi-infra.cc and what i found was that only one packet is sent. How can i use the pcap files generated to compare the standards and plot graphs?
Also i need some help in writing code for implementing instructure mode for the standards so that i can compare their throughput, goodput, delay, distance to which the files are tranferred and other similar attributes.
what changes am i supposed to do and in which of the examples.
If i get help for one of the standards, I can write the code for others easily..

neha singh

unread,
Mar 29, 2014, 3:06:53 PM3/29/14
to ns-3-...@googlegroups.com
Thank you for such a quick reply.

And by distance i meant the range of each standard(if that is possible).

I have read the tutorial, not very thoroughly though, so I would surely take your advice.
I have made the code for the infrastructure mode, its not complete yet.
As I am new to this, I will be posting my code once I am done, and hope that you can help me out then.

Thank you for your time.

Konstantinos

unread,
Mar 29, 2014, 3:29:22 PM3/29/14
to ns-3-...@googlegroups.com
Similar to Tommaso, I will not give you the code, but I will try to provide some help.
Just look at a different example code, that uses infrastructure mode. There are at least 5 files in the same folder that use infrastructure.

neha singh

unread,
Mar 30, 2014, 1:37:16 PM3/30/14
to ns-3-...@googlegroups.com
I never wanted the full code actually..
i just want small bits of information so that i can integrate them to plan my code.
So the information u gave will be helpful because I had just seen 3 of those examples, didn't know there were 5!

One more query i have is about those pcap files that are created in wifi-infra.cc.
Are the results different when implemented with some other standard?

Tommaso Pecorella

unread,
Mar 30, 2014, 11:29:02 PM3/30/14
to ns-3-...@googlegroups.com
Hi,

pcap are always different if you change something. They are the equivalent of sniffing the channel with a promiscuous mode interface, so yes, if you change standard they'll be different.

Cheers,

T.

neha singh

unread,
Mar 31, 2014, 1:15:14 PM3/31/14
to ns-3-...@googlegroups.com
Hi,

So, what can I conclude from the difference in context of the performance of each standard?

Konstantinos

unread,
Mar 31, 2014, 1:25:24 PM3/31/14
to ns-3-...@googlegroups.com
You have to define a metric and compare that on different scenarios, e.g. delay, throughput. For example what is the delay (average or CDF of per-packet delay) with different configurations (number of nodes, errors on the channel etc) for each standard.
You can get that metric analysing either from PCAP or other traces within NS-3.

neha singh

unread,
May 1, 2014, 10:43:47 AM5/1/14
to ns-3-...@googlegroups.com
Hi,
I have been trying to run this code.
It gets built but then nothing happens after that. I get no GNU plots, nor anything comes on the screen.
Please help me with this.

#include "ns3/netanim-module.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
#include "ns3/stats-module.h"
#include "ns3/wifi-module.h"
#include "ns3/config-store-module.h"
#include "ns3/internet-module.h"
#include <fstream>
#include <vector>
#include <string>
#include <iostream>

NS_LOG_COMPONENT_DEFINE ("Main");

using namespace ns3;

class Infra_g
{
public:
  Infra_g ();
  Infra_g (std::string name);
  Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
                        const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel);
private:
  void ReceivePacket (Ptr<Socket> socket);
  void SetPosition (Ptr<Node> node, Vector position);
  Vector GetPosition (Ptr<Node> node);
  void AdvancePosition (Ptr<Node> node);
  Ptr<Socket> SetupPacketReceive (Ptr<Node> node);

  uint32_t m_bytesTotal;
  Gnuplot2dDataset m_output;
};

Infra_g::Infra_g ()
{
}

Infra_g::Infra_g (std::string name)
  : m_output (name)
{
  m_output.SetStyle (Gnuplot2dDataset::LINES);
}

void
Infra_g::SetPosition (Ptr<Node> node, Vector position)
{
  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
  mobility->SetPosition (position);
}

Vector
Infra_g::GetPosition (Ptr<Node> node)
{
  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
  return mobility->GetPosition ();
}

void 
Infra_g::AdvancePosition (Ptr<Node> node) 
{
  Vector pos = GetPosition (node);
  double mbs = ((m_bytesTotal * 8.0) / 1000000);
  m_bytesTotal = 0;
  m_output.Add (pos.x, mbs);
  pos.x += 1.0;
  if (pos.x >= 210.0) 
    {
      return;
    }
  SetPosition (node, pos);
  //std::cout << "x="<<pos.x << std::endl;
  Simulator::Schedule (Seconds (1.0), &Infra_g::AdvancePosition, this, node);
}

void
Infra_g::ReceivePacket (Ptr<Socket> socket)
{
  Ptr<Packet> packet;
  while ((packet = socket->Recv ()))
    {
      m_bytesTotal += packet->GetSize ();
    }
}

Ptr<Socket>
Infra_g::SetupPacketReceive (Ptr<Node> node)
{
  TypeId tid = TypeId::LookupByName ("ns3::PacketSocketFactory");
  Ptr<Socket> sink = Socket::CreateSocket (node, tid);
  sink->Bind ();
  sink->SetRecvCallback (MakeCallback (&Infra_g::ReceivePacket, this));
  return sink;
}

Gnuplot2dDataset
Infra_g::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
                 const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
{
  m_bytesTotal = 0;

  NodeContainer c;
  c.Create (2);

  PacketSocketHelper packetSocket;
  packetSocket.Install (c);

  YansWifiPhyHelper phy = wifiPhy;
  phy.SetChannel (wifiChannel.Create ());

  NqosWifiMacHelper mac = wifiMac;
//  NetDeviceContainer devices = wifi.Install (phy, mac, c);
   Ssid ssid = Ssid ("wifi-default");
  // setup sta.
  mac.SetType ("ns3::StaWifiMac",
                   "Ssid", SsidValue (ssid),
                   "ActiveProbing", BooleanValue (false));
  NetDeviceContainer staDevice = wifi.Install (phy, mac, c.Get (0));
  NetDeviceContainer devices = staDevice;
  // setup ap.
  mac.SetType ("ns3::ApWifiMac",
                   "Ssid", SsidValue (ssid));
  NetDeviceContainer apDevice = wifi.Install (phy, mac, c.Get (1));
  devices.Add (apDevice);

  MobilityHelper mobility;
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
  positionAlloc->Add (Vector (5.0, 0.0, 0.0));
  mobility.SetPositionAllocator (positionAlloc);
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");

  mobility.Install (c);

  PacketSocketAddress socket;
  socket.SetSingleDevice (devices.Get (0)->GetIfIndex ());
  socket.SetPhysicalAddress (devices.Get (1)->GetAddress ());
  socket.SetProtocol (1);

  OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
  onoff.SetConstantRate (DataRate (60000000));
  onoff.SetAttribute ("PacketSize", UintegerValue (2000));

  ApplicationContainer apps = onoff.Install (c.Get (0));
  apps.Start (Seconds (0.5));
  apps.Stop (Seconds (250.0));

  Simulator::Schedule (Seconds (1.5), &Infra_g::AdvancePosition, this, c.Get (1));
  Ptr<Socket> recvSink = SetupPacketReceive (c.Get (1));


  Simulator::Run ();

  Simulator::Destroy ();

  return m_output;
}

int main (int argc, char *argv[])
{
  // disable fragmentation
  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));

  CommandLine cmd;
  cmd.Parse (argc, argv);

  Gnuplot gnuplot = Gnuplot ("reference-rates_a.png");

  Infra_g experiment;
  WifiHelper wifi = WifiHelper::Default ();
  wifi.SetStandard (WIFI_PHY_STANDARD_80211g);
  NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
  Gnuplot2dDataset dataset;

  wifiMac.SetType ("ns3::AdhocWifiMac");

  NS_LOG_DEBUG ("54");
  experiment = Infra_g ("54mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate54Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("48");
  experiment = Infra_g ("48mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate48Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("36");
  experiment = Infra_g ("36mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate36Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("24");
  experiment = Infra_g ("24mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate24Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("18");
  experiment = Infra_g ("18mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate18Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("12");
  experiment = Infra_g ("12mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate12Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("9");
  experiment = Infra_g ("9mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate9Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("6");
  experiment = Infra_g ("6mb");
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                "DataMode", StringValue ("OfdmRate6Mbps"));
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  gnuplot.GenerateOutput (std::cout);

/*
  gnuplot = Gnuplot ("rate-control_a.png");
  wifi.SetStandard (WIFI_PHY_STANDARD_80211a);


  NS_LOG_DEBUG ("arf");
  experiment = Infra_g ("arf");
  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("aarf");
  experiment = Infra_g ("aarf");
  wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("aarf-cd");
  experiment = Infra_g ("aarf-cd");
  wifi.SetRemoteStationManager ("ns3::AarfcdWifiManager");
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("cara");
  experiment = Infra_g ("cara");
  wifi.SetRemoteStationManager ("ns3::CaraWifiManager");
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("rraa");
  experiment = Infra_g ("rraa");
  wifi.SetRemoteStationManager ("ns3::RraaWifiManager");
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  NS_LOG_DEBUG ("ideal");
  experiment = Infra_g ("ideal");
  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
  gnuplot.AddDataset (dataset);

  gnuplot.GenerateOutput (std::cout);
 */ 
  
  

  return 0;
}
 
Reply all
Reply to author
Forward
0 new messages