Hi All,
Thank you for reading my post.
I am trying to calculate the overall throughput for ad hoc wireless network (no access point is being used) I studied the flow monitor and I understand it now and I understand the following commands:
#include "ns3/flow-monitor-helper.h"
#include "ns3/flow-monitor-module.h"
Ptr<FlowMonitor> mon;
FlowMonitorHelper flowhelp;
mon->SetAttribute("DelayBinWidth", DoubleValue(0.001));
mon->SetAttribute("JitterBinWidth", DoubleValue(0.001));
mon->SetAttribute("PacketSizeBinWidth", DoubleValue(20));
mon = flowhelp.InstallAll();
but the problem now that I cant find a documentation for the flow monitor that explains it in more detail so we can use it to find the throughput.
for example I cant understand the following lines :
// Calculate Throughput using Flowmonitor
//
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.InstallAll();
//
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds(11.0));
Simulator::Run ();
monitor->CheckForLostPackets ();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
if ((t.sourceAddress=="10.1.1.1" && t.destinationAddress == "10.1.2.2"))
{
std::cout << "Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
std::cout << " Tx Bytes: " << i->second.txBytes << "\n";
std::cout << " Rx Bytes: " << i->second.rxBytes << "\n";
std::cout << " Throughput: " << i->second.rxBytes * 8.0 / (i->second.timeLastRxPacket.GetSeconds() - i->second.timeFirstTxPacket.GetSeconds())/1024/1024 << " Mbps\n";
}
}
monitor->SerializeToXmlFile("lab-1.flowmon", true, true);
So please Help me and any one can show me the way in studying the flow monitor.
Thank you a lot.