irwan setiawan

unread,
May 6, 2017, 8:48:23 AM5/6/17
to ns-3-users
Hi

Please provide information about the dsr problem bug on the flow monitor??

Reading symbols from /home/irwan/ns3/ns-allinone-3.19/ns-3.19/build/scratch/dsr...done.
(gdb) run
Starting program: /home/irwan/ns3/ns-allinone-3.19/ns-3.19/build/scratch/dsr \<args\>
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
0    0    0    0
5    0    0    0
10    0    0    0
15    0    0    0
20    0    0    2449
25    0    0    7139
25.5597    512
25.6488    512
25.7498    512
Flow Monitor Statistic
30    0    0    7139

Program received signal SIGFPE, Arithmetic exception.
0x0805e3bb in main (argc=2, argv=0xbffff474) at ../scratch/dsr.cc:301
301      NS_LOG_UNCOND("Average PDR: " << ((rxPacketsum * 100) / txPacketsum) << " %");
(gdb)

Screenshot from 2017-05-06 19:47:06.png

irwan setiawan

unread,
May 6, 2017, 10:01:17 AM5/6/17
to ns-3-users
please help me
where the wrong location of this sourcode
thank you very much
dsr.cc

Tommaso Pecorella

unread,
May 6, 2017, 10:05:35 AM5/6/17
to ns-3-users
Hi,

1) Please read the posting guidelines,
2) Please upgrade to ns-3.26 (or later), we can't ofer help on outdated ns-3 releases,
3) You need to use gdb, not just launch it - find a suitable gdb tutorial online.

T.

irwan setiawan

unread,
May 12, 2017, 4:22:07 AM5/12/17
to ns-3-...@googlegroups.com
What is the solution for application of DSR protocol with pdr parameter and delay throughput besides using flowmonitor?

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/iXTKliJs_EQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Konstantinos

unread,
May 12, 2017, 4:53:32 AM5/12/17
to ns-3-users
- Data collection framework https://www.nsnam.org/docs/models/html/data-collection.html.
- PCAP/Trace file analysis.

irwan setiawan

unread,
May 12, 2017, 5:03:09 AM5/12/17
to ns-3-...@googlegroups.com
/* DSR ROUTING */

#include "ns3/dsr-module.h"
#include "ns3/dsr-helper.h"
#include "ns3/netanim-module.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
#include "ns3/wifi-module.h"
#include "ns3/netanim-module.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/position-allocator.h"


#include <string>
#include <iostream>
#include <cassert>
#include <fstream>
#include "ns3/gnuplot.h"
#include <sstream>


using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Dsr-Routing");

void
ReceivePacket(Ptr<const Packet> p, const Address & addr)
{
    std::cout << Simulator::Now ().GetSeconds () << "\t" << p->GetSize() <<"\n";
}

uint32_t MacTxDropCount, PhyTxDropCount, PhyRxDropCount;

void
MacTxDrop(Ptr<const Packet> p)
{
  NS_LOG_INFO("Packet Drop");
  MacTxDropCount++;
}


void
PrintDrop()
{
  std::cout << Simulator::Now().GetSeconds() << "\t" << MacTxDropCount << "\t"<< PhyTxDropCount << "\t" << PhyRxDropCount << "\n";
  Simulator::Schedule(Seconds(5.0), &PrintDrop);
}

void
PhyTxDrop(Ptr<const Packet> p)
{
  NS_LOG_INFO("Packet Drop");
  PhyTxDropCount++;
}
void
PhyRxDrop(Ptr<const Packet> p)
{
  NS_LOG_INFO("Packet Drop");
  PhyRxDropCount++;
}



// for selected modules; the below lines suggest how to do this
int main (int argc, char *argv[])
{

  NS_LOG_INFO ("creating the nodes");

  // General parameters
  int nWifis = 50;
  int nSinks = 24;
  double simulationTime = 12.0;
  //double dataTime = 20.0;
  //double dataStart = 10.0; // start sending data at 100s
 
  double pauseTime = 0.0;
  double nodeSpeed = 0.0;
  double txpDistance = 250.0;

  bool enableFlowMonitor = false;
  //std::string rate = "0.512kbps";
  std::string phyMode ("DsssRate11Mbps");
  std::string dataMode ("DsssRate11Mbps");

  //Allow users to override the default parameters and set it to new ones from CommandLine.
  CommandLine cmd;
  cmd.AddValue ("nWifis", "Number of wifi nodes", nWifis);
  cmd.AddValue ("nSinks", "Number of SINK traffic nodes", nSinks);
  cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode);
  cmd.AddValue ("EnableMonitor", "Enable Flow Monitor", enableFlowMonitor);
  cmd.AddValue ("txpDistance", "Specify node's transmit range, Default:300", txpDistance);
  cmd.Parse (argc, argv);

  SeedManager::SetSeed (10);
  SeedManager::SetRun (1);

  NodeContainer adhocNodes;
  adhocNodes.Create (nWifis);
  NetDeviceContainer allDevices;

  NS_LOG_INFO ("setting the default phy and channel parameters");
  Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue (phyMode));
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
 

//VANET 802.11b 2.4 GHz
  WifiHelper wifi;
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
  wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11);

  YansWifiChannelHelper wifiChannel;
  wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
  wifiChannel.AddPropagationLoss ("ns3::RangePropagationLossModel", "MaxRange", DoubleValue (txpDistance));

  wifiPhy.SetChannel (wifiChannel.Create ());

  // Add a non-QoS upper mac, and disable rate control
  NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
  wifiMac.SetType ("ns3::AdhocWifiMac");

  // *****Set 802.11b standard
  wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                      "DataMode", StringValue (dataMode),
                                      "ControlMode", StringValue (phyMode));

  allDevices = wifi.Install (wifiPhy, wifiMac, adhocNodes);

/// Vanet_End ///

//Set Up Constant Mobility
  NS_LOG_INFO ("Configure Tracing.");
  MobilityHelper adhocMobility;
  int64_t streamIndex = 0; // used to get consistent mobility across scenarios
 
  ObjectFactory pos;
  pos.SetTypeId ("ns3::RandomRectanglePositionAllocator");
  pos.Set ("X", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=500.0]"));
  pos.Set ("Y", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1000.0]"));

  Ptr<PositionAllocator> taPositionAlloc = pos.Create ()->GetObject<PositionAllocator> ();
  streamIndex += adhocMobility.AssignStreams (adhocNodes, streamIndex);
  std::stringstream ssSpeed;
  ssSpeed << "ns3::UniformRandomVariable[Min=0.0|Max=" << nodeSpeed << "]";
  std::stringstream ssPause;
  ssPause << "ns3::ConstantRandomVariable[Constant=" << pauseTime << "]";
  adhocMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  adhocMobility.SetPositionAllocator (taPositionAlloc);
  adhocMobility.Install (adhocNodes);
 


  // *****Set up internet stack
  InternetStackHelper internet;
  DsrMainHelper dsrMain;
  DsrHelper dsr;
  internet.Install (adhocNodes);
  dsrMain.Install (dsr, adhocNodes);

  // *****Set up Addresses
  NS_LOG_INFO ("assigning ip address");
  Ipv4AddressHelper ipv4;
  ipv4.SetBase ("192.168.1.0", "255.255.255.0");
  Ipv4InterfaceContainer ifcont = ipv4.Assign (allDevices);

// *****Set Mobility for all nodes
  NS_LOG_INFO ("Create Applications.");

  OnOffHelper onoff1Helper ("ns3::UdpSocketFactory", Address());
  onoff1Helper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
  onoff1Helper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
  onoff1Helper.SetAttribute ("PacketSize", StringValue ("512Kbps"));
  //onoff1Helper.SetAttribute ("DataRate", DataRateValue (DataRate (rate)));


//Port ..
  uint32_t port = 9;

  //double randomStartTime = (1 / nSinks); //distributed btw 1s evenly as we are sending 4pkt/s

// *****Generate constant application ..
ApplicationContainer onoff1;

  for (uint32_t j = 1, i=24; j <= 6; j++,i--)
{

        //Remote is the address of the destination ..
         onoff1Helper.SetAttribute ("Remote", AddressValue
        (InetSocketAddress(ifcont.GetAddress(i),port)));
         onoff1.Add (onoff1Helper.Install(adhocNodes.Get(j)));
}

//*****Start to generate traffic ..
onoff1.Start(Seconds(10.0));

//*****Stop generating traffic ..
onoff1.Stop(Seconds(simulationTime));

//*****Recieve ..
ApplicationContainer apps_sink;

for (uint32_t k = 24; k >= 6; k--)
{
       PacketSinkHelper sink ("ns3::UdpSocketFactory",
       Address(InetSocketAddress (ifcont.GetAddress (k), port)));
       apps_sink.Add (sink.Install (adhocNodes.Get (k)));
apps_sink.Start(Seconds(10.0));
apps_sink.Stop(Seconds(simulationTime));
}

// Users may find it convenient to turn on explicit debugging

  //LogComponentEnable ("DsrOptions", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrHelper", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrRouting", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrOptionHeader", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrFsHeader", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrGraReplyTable", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrSendBuffer", LOG_LEVEL_ALL);
  //LogComponentEnable ("RouteCache", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrMaintainBuffer", LOG_LEVEL_ALL);
  //LogComponentEnable ("RreqTable", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrErrorBuffer", LOG_LEVEL_ALL);
  //LogComponentEnable ("DsrNetworkQueue", LOG_LEVEL_ALL);

// NetAnim Config

  AnimationInterface anim ("DSR-ROUTING.xml"); // Mandatory
  anim.EnablePacketMetadata(true);

//print out PCAP files
wifiPhy.EnablePcap("DSR-ROUTING", allDevices.Get(0), true);

//*****Print Out Ascii

  AsciiTraceHelper ascii;
  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("DSR-ROUTING.tr");
  wifiPhy.EnableAsciiAll (stream);


//*****Calculate Throughput using Flowmonitor

  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor = flowmon.InstallAll();
 
  Config::ConnectWithoutContext("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&ReceivePacket));
  Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTxDrop", MakeCallback(&MacTxDrop));
  Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop", MakeCallback(&PhyRxDrop));
  Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop", MakeCallback(&PhyTxDrop));

  NS_LOG_INFO ("Run Simulation.");
  Simulator::Schedule(Seconds(10.0),&PrintDrop);
  Simulator::Stop (Seconds(simulationTime));
  Simulator::Run ();
  NS_LOG_UNCOND ("Flow Monitor Statistic");


// *****GNU PLOT PARAMETER
  std::string graphicsFileName = "DSR-ROUTING.png";
  std::string plotFileName = "DSR-ROUTING.plt";
//
  Gnuplot gnuplot (graphicsFileName);
  Gnuplot2dDataset dataset;

  //Gnuplot ...continued
  gnuplot.AddDataset (dataset);
  // Open the plot file.
  std::ofstream plotFile (plotFileName.c_str());
  // Write the plot file.
  gnuplot.GenerateOutput (plotFile);
  // Close the plot file.
  plotFile.close ();


//.................
 PrintDrop();
  monitor->CheckForLostPackets ();

  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

        uint32_t txPacketsum = 0;
        uint32_t rxPacketsum = 0;
        uint32_t DropPacketsum = 0;
        uint32_t LostPacketsum = 0;
        uint32_t rxBytessum = 0;
        double Delaysum = 0;


  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)

    {
      Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
              if (t.destinationPort == 9)
            {

                txPacketsum += i->second.txPackets;
                rxPacketsum += i->second.rxPackets;
                LostPacketsum += i->second.lostPackets;
                DropPacketsum += i->second.packetsDropped.size();
                Delaysum += i->second.delaySum.GetSeconds();
                rxBytessum += i->second.rxBytes;
       
 
 NS_LOG_UNCOND("Flow ID: " << i->first << t.sourceAddress << t.destinationAddress );
 NS_LOG_UNCOND("Throughput: " << i->second.rxBytes * 8.0 / (i->second.timeLastRxPacket.GetSeconds()-i->second.timeFirstTxPacket.GetSeconds()) << " Kbps");  
 NS_LOG_UNCOND("Tx Packets: " << i->second.txPackets);
 NS_LOG_UNCOND("Rx Packets: " << i->second.rxPackets);
 NS_LOG_UNCOND("Delay: " << i->second.delaySum.GetSeconds());
 NS_LOG_UNCOND("Lost Packets: " << i->second.lostPackets);
 NS_LOG_UNCOND("Drop Packets: " << i->second.packetsDropped.size());
 NS_LOG_UNCOND("Packets Delivery Ratio: " << ((i->second.rxPackets * 100) / i->second.txPackets) << "%");
 NS_LOG_UNCOND("Packets Lost Ratio: " << ((i->second.lostPackets * 100) / i->second.txPackets) << "%" << "\n");
 //dataset.Add((double)Simulator::Now().GetSeconds(),(double) rxPacketsum);
   
        }
    }  
monitor->SerializeToXmlFile("DSR-ROUTING.xml", true, true);

  NS_LOG_UNCOND("Average PDR: " << ((rxPacketsum * 100) / txPacketsum) << " %");
  //NS_LOG_UNCOND("Average PLR: " << ((LostPacketsum * 100) / txPacketsum) << " %");
  NS_LOG_UNCOND("Average Throughput: " << ((rxBytessum * 8.0) / (simulationTime - 10.0)) / 24 << " Kbps");
  NS_LOG_UNCOND("Average Delay: " << (Delaysum / rxPacketsum) * 1000 << " ms" << "\n");             

}

irwan setiawan

unread,
May 12, 2017, 5:06:27 AM5/12/17
to ns-3-...@googlegroups.com
Please help where is this wrong? Why the results of PDR, THROUGHPUT, AND DELAY parameters can not be detected

irwan setiawan

unread,
May 12, 2017, 5:06:59 AM5/12/17
to ns-3-...@googlegroups.com
Please help where is this wrong? Why the results of PDR, THROUGHPUT, AND DELAY parameters can not be detected

irwan setiawan

unread,
May 12, 2017, 5:07:56 AM5/12/17
to ns-3-...@googlegroups.com

Tommaso Pecorella

unread,
May 12, 2017, 4:34:47 PM5/12/17
to ns-3-users
Please read the posting guidelines.
I already said it once, I don't like to repeat myself.
Moreover, it seems to me that you're not even trying to understand the answers that me or Kostantinos gave you, and this is even more unsettling.

T.


On Friday, May 12, 2017 at 11:07:56 AM UTC+2, irwan setiawan wrote:
Please help where is this wrong? Why the results of PDR, THROUGHPUT, AND DELAY parameters can not be detected
2017-05-12 16:06 GMT+07:00 irwan setiawan <isetia...@gmail.com>:
Please help where is this wrong? Why the results of PDR, THROUGHPUT, AND DELAY parameters can not be detected
2017-05-12 16:06 GMT+07:00 irwan setiawan <isetia...@gmail.com>:
Please help where is this wrong? Why the results of PDR, THROUGHPUT, AND DELAY parameters can not be detected
2017-05-12 16:02 GMT+07:00 irwan setiawan <isetia...@gmail.com>:
/* DSR ROUTING */

- PCAP/Trace file analysis.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/iXTKliJs_EQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages