Skip to first unread message

Mahesh

unread,
Sep 11, 2019, 9:58:09 AM9/11/19
to ns-3-users
Hi ns3 users,

I have a modified version of wifi-simple-infra script in which I want to log statistics like throughput, delay etc using FlowMonitor module. However, they are not getting logged. The results.xml is empty too. Can you please guide me where I am going wrong? I've attached the script.

Thanks,
Mahesh
wifi-simple-infra.cc

Mahesh

unread,
Sep 13, 2019, 2:09:07 AM9/13/19
to ns-3-users
Can someone please help. I'm stuck on this issue.

Enid

unread,
Sep 13, 2019, 8:20:01 AM9/13/19
to ns-3-users
hi Mahesh

you have to add the flow monitor setup  before simulation stop command. 

thanks

Giacomo Segala

unread,
Sep 16, 2019, 4:22:26 AM9/16/19
to ns-3-users
Hello, does it change something if Flow Monitor setup is after Simulator::Stop(...) but before Simulator::Run()? 
The fundamental thing is that the setup is before Simulator::Run(), isn't it?

Mahesh

unread,
Sep 16, 2019, 9:30:26 AM9/16/19
to ns-3-users
Hi Enid,

I added the flow monitor setup before simulation stop command as below but still it does not work. Can you please check if I am missing something else in my code. 

Ptr<FlowMonitor> monitor;
FlowMonitorHelper flowmon;
monitor = flowmon.InstallAll();

Simulator::ScheduleWithContext (source1->GetNode ()->GetId (),
                                Seconds (1.0), &GenerateTraffic,
                                source1, packetSize, numPackets, interPacketInterval);

// Print per flow statistics
//FlowMonitorHelper flowmon;
//Ptr<FlowMonitor> monitor = flowmon.InstallAll();
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 iter = stats.begin (); iter != stats.end (); ++iter)
{
    Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);

    NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress);
    NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets);
    NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets);
    NS_LOG_UNCOND("Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024  << " Kbps");
}

monitor->SerializeToXmlFile ("results.xml" , true, true );
  
Simulator::Stop (Seconds (30.0));
Simulator::Run ();

Simulator::Destroy ();

Looking forward to your reply at the earliest.

Thanks,
Mahesh

Giacomo Segala

unread,
Sep 16, 2019, 9:36:06 AM9/16/19
to ns-3-users
Lines of codes from monitor->CheckForLostPackets () to monitor->SerializeToXmlFile ("results.xml" , true, true ) must be put after Simulator::Run ().

Mahesh

unread,
Sep 16, 2019, 9:39:53 AM9/16/19
to ns-3-users
Hi Giacomo,

It is still not working! Can you please execute my code (it runs without any errors) and see what is the issue. I am really unable to figure out.

Mahesh

unread,
Sep 17, 2019, 1:21:42 PM9/17/19
to ns-3-users
Can someone please help me with this issue? I am stuck.

Mahesh

unread,
Sep 19, 2019, 11:50:24 AM9/19/19
to ns-3-users
Please help me out with this issue. Anyone?

Thanks,
M

Mahesh

unread,
Sep 23, 2019, 11:19:26 AM9/23/19
to ns-3-users
Can someone please help me out with this issue that I'm facing? It's been long since I posted and it's not resolved yet.

Enid

unread,
Oct 1, 2019, 5:32:36 AM10/1/19
to ns-3-users
Hi Mahesh

Hope you found an answer. But if you didn't, you'll be able to find the exact reason here: https://groups.google.com/d/msg/ns-3-users/jB3bdou0TwQ/qkoRkA6_JEgJ
Sorry about the delay in reply.

Thanks
Enid

Enid

unread,
Oct 1, 2019, 5:36:11 AM10/1/19
to ns-3-users
Just changing the remote address makes the difference (mentioned in the link posted above) as flowmonitor doesn't log the broadcast data. 
Reply all
Reply to author
Forward
0 new messages