Flow Monitor:
A set
of evaluation criteria are the focus of every simulation, using which a
proposed scheme can be evaluated. In communications, specifically wireless
communications, more specifically LTE, major evaluation criteria are:
- - Delay (end-to-end mean delay)
- - Throughput
- - Packet loss ratio
- - Mean Jitter
- - Mean transmitted packet size (bytes)
- - Mean received packet size (bytes)
- - Means transmitted bitrate (bit/s)
- - Means received bitrate (bit/s)
- - Mean hop count
- - Lost packets
In any NS3 simulations, you can easily calculate parameters
mentioned above using FLOW-MONITOR.
How to use flow-monitor in code:
1-
Include flow-monitor header
file.
#include "ns3/flow-monitor-module.h"
2-
Add following code snippet before
“Simulator∷ Stop();”. This code will assign a monitor to each
node.
Ptr<FlowMonitor> flowMonitor;
FlowMonitorHelper flowHelper;
flowMonitor = flowHelper.InstallAll();
Simulator::Stop(Seconds(simTime));
If you are interested in installing monitor
to each node separately, then use “Install” method instead of “InstallAll”. But I would prefer to install
flow-monitor on all nodes J
.
flowMonitor = flowHelper.Install (nodes);
3-
Finally, we print output to
an XML file. Add this line after “Simulator∷
Run();”.
flowMonitor->SerializeToXmlFile("NameOfFile.xml", true,
true);
That’s it. Using above three steps, you can easily add flow monitor to all node. The NameOfFile.XML file will be generated in your NS3 directory.
How to visualize output:
The XML file can be viewed by any XML viewer. I found
NetAnim (A basic guide to netanim is here) to be the best viewer for the flow
monitor.
1-
Open NetAnim (Make sure you
see three tabs in netanim, Animator, Stats, and Packets)
2-
Click “Stats” tab
3-
From dropdown menu, select
Flow-monitor. (The dropdown menu will show IP-MAC in start)
4-
Click “FlowMon file” button
on the right.
5-
Browse to your NS3
directory and select “NameOfFile.XML” file.
6-
The file will display every
flow with its parameters and values.
For your convenience J
.
Using all these values, many evaluation parameters can be
calculated. Next section will show you how to calculate those parameters from
these values.
Parameters:
Some parameters are directly calculated and rest can be
calculated using these formulae.
Throughput (bps): rxBytes*8 / [(timeLastRxPacket/1,000,000,000)-
(timeFirstRxPacket/1,000,000,000)]
And
Throughput (Mbps): rxBytes*8 / [(timeLastRxPacket/1,000,000,000)-
(timeFirstRxPacket/1,000,000,000)] / 1024 / 1024
References and material:
- FlowMonitor — a network monitoring framework for the Network Simulator 3 (NS-3), online: http://telecom.inesctec.pt/~gjc/flowmon-presentation.pdf
- NS-3 Advanced Tutorial: Visualization and Data Collection, Online: https://www.nsnam.org/tutorials/consortium13/visualization-tutorial.pdf
- https://www.nsnam.org/docs/models/html/flow-monitor.html
- Throughput: http://comments.gmane.org/gmane.network.simulator.ns3.user/18301
- https://groups.google.com/forum/#!topic/ns-3-users/NuScxlCA8H0
- https://groups.google.com/forum/#!msg/ns-3-users/Z2pgY6tbJgM/viiOwlfeu4kJ
- https://groups.google.com/forum/#!topic/ns-3-users/8rxd2VfHsFg
- https://groups.google.com/forum/#!topic/ns-3-users/nXuyOZaazbU
its not working sir
ReplyDeleteflowMonitor->SerializeToXmlFile("flow-monitor.xml", true, true);
DeleteThis line should be after Simulator::Run () and before Simulator::Destroy ().
still not works
Deletehello sir,
ReplyDeletethe xml file shows no data
please reply
If there is no data then either you have not added flow monitor on the node which is transmitting, or there is no packet flow. Try again from scratch by following the instructions.
DeleteThis comment has been removed by the author.
Deletehave u shown any data now?
DeleteNO DATA FOR ME TOO
ReplyDeleteflowMonitor->SerializeToXmlFile("flow-monitor.xml", true, true);
DeleteThis line should be after Simulator::Run () and before Simulator::Destroy ().
Dear Sir,
ReplyDeleteWe are thankful to your services about ndnsim.We are giving tips for ndnsim research scholars.Please use our links.
https://www.youtube.com/channel/UCoojSNObgcYBKxk4IlVH2iw?view_as=subscriber
http://www.ndnsim.com/
Thanks
Sir can you share your code. Mine is not working
ReplyDeleteAwesome tutorial. Kudos!!
ReplyDeleteI tried it for mpi/examples/p2p-nix-distribution code. its not working.
ReplyDelete