how to plot the gaph for measuring through put

2,466 views
Skip to first unread message

Sreedevi Veerathu

unread,
Mar 30, 2010, 8:06:58 AM3/30/10
to ns-3-...@googlegroups.com
Hai to all,

I am working on ns3 which plays an important role in my project. I like to plot a graph for throughput from the ns3 simulation.If any one of you are working on this topic of wireles adhoc network using TCP with 802.11b connection please do help me.I had coded a simple program related to wireless adhoc consisting of 2 nodes in the network and i am trying to plot the throughput for this.So,please help me in this regard.

Thanking you in advance.

with regards,
Sreedevi veerathu,
Lulea university,
Sweden.

Sreedevi Veerathu

unread,
Mar 30, 2010, 7:58:04 AM3/30/10
to ns-3-...@googlegroups.com
Hai to all users,


Gustavo Carneiro

unread,
Mar 30, 2010, 9:39:36 AM3/30/10
to ns-3-...@googlegroups.com
On Tue, Mar 30, 2010 at 1:06 PM, Sreedevi Veerathu <veerathu...@gmail.com> wrote:
Hai to all,

I am working on ns3 which plays an important role in my project. I like to plot a graph for throughput from the ns3 simulation.If any one of you are working on this topic of wireles adhoc network using TCP with 802.11b connection please do help me.I had coded a simple program related to wireless adhoc consisting of 2 nodes in the network and i am trying to plot the throughput for this.So,please help me in this regard.

I wrote a python based simulation that does it using FlowMonitor:

1. ./waf shell
2. python examples/flowmon/wifi-olsr-flowmon.py --Plot
 
This plots a histogram of delay, not throughput, but you get the picture...

There is also examples/wireless/wifi-adhoc.cc, which uses gnuplot instead of matplotlib.

Either of these examples should help you.


Thanking you in advance.

with regards,
Sreedevi veerathu,
Lulea university,
Sweden.

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Gustavo J. A. M. Carneiro
INESC Porto, UTM, WiN, http://win.inescporto.pt/gjc
"The universe is always one step beyond logic." -- Frank Herbert

Sreedevi Veerathu

unread,
Mar 30, 2010, 9:57:33 AM3/30/10
to ns-3-...@googlegroups.com
Thank you very much for the reply at present i am working on the gnuplot. I have installed and worked on tutorial example of the gnuplot. If you have any idea about this please help me in getting the gnuplot output for throughput for the program ahich we have created. Are you can help me the link for gnuplot information which can be used for plotting the graph for ns3 programs.Is the command given in the tutorial is same for the new or created programs.

pranjal sharma

unread,
Mar 30, 2010, 3:29:49 PM3/30/10
to ns-3-...@googlegroups.com
Hi

With 'Tracing' system of NS3 u can out the important values to the output terminal or to a particular file (say text file).
As u had seen the tutorial for gnuplot, u know that on command line we can pass a script (containing information about type of graph) and a data file containing data.
so create a default script file by your own and create data file from the values obtained from tracing system of NS3, using simple file handling properties of C++. Afterwards pass them to gnuplot to create your graph.

For tracing system see  

For better solution consider classes 'Gnuplot' 'GnuplotCollection' and 'GnuplotDataset' from NS3 Documentation.

Regards
Rulebreaker

Sreedevi Veerathu

unread,
Mar 31, 2010, 3:35:15 AM3/31/10
to ns-3-...@googlegroups.com
Thanq very much.


Sreedevi Veerathu

unread,
Mar 31, 2010, 6:07:37 AM3/31/10
to ns-3-...@googlegroups.com
Hai,
I need help in tracing system. I went through the tutorial i got the basic idea  but i had a difficulty to implement it in practical.If any one of you having the program with the tracing commands it will be a good example for me to implement it and have you found any example programs which uses gnuplot classes in their program. so, it will be helpful to me if there are such programs like that.Mainly i am working on plotting graphs so i am going through all the sources.And i would like to say you your suggestion towards my work which graghing style will be good for plotting graphs in ns3 regarding the tcp protocol.As i am in initial stage keeping eye on all styles and not getting output. So, help me in this regard.
Thanking You.


With best regards,
Sreedevi.
Message has been deleted
Message has been deleted
Message has been deleted

Antti Mäkelä

unread,
Mar 31, 2010, 7:38:33 AM3/31/10
to ns-3-users
On Mar 31, 1:07 pm, Sreedevi Veerathu <veerathu.sreed...@gmail.com>
wrote:

> through all the sources.And i would like to say you your suggestion towards
> my work which graghing style will be good for plotting graphs in ns3
> regarding the tcp protocol.As i am in initial stage keeping eye on all
> styles and not getting output. So, help me in this regard.

I have something like this:

class RxTracer : public RefCountBase
{
Ptr<NetDevice> m_netdevice;
Ptr<Node> m_node;
Ptr<OutputStreamWrapper> m_stream;
uint32_t m_bytesbucket;

void CallbackMethod(Ptr<Packet const> packet)
{
uint32_t size = packet->GetSize();
m_bytesbucket += size;
return;

}

void Setup(Ptr<PointToPointNetDevice> netdev, Ptr<Node> node)
{
m_node = node;
m_netdevice = netdev;
m_bytesbucket = 0;
netdev->TraceConnectWithoutContext("MacRx",
MakeCallback(&RxTracer::CallbackMethod, this));
AsciiTraceHelper ath;
std::ostringstream oss;
oss << Names::FindName(node);
oss << "-";
oss << Names::FindName(netdev);
oss << ".thru";
m_stream = ath.CreateFileStream(oss.str());

}

uint64_t GetThroughput()
{
uint64_t result = m_bytesbucket;
*m_stream -> GetStream() << Now().GetSeconds() << " " <<
m_bytesbucket << "\n";
m_bytesbucket = 0;
return result;

}
};

Then, I create an object of this class and start the trace with

Ptr<RxTracer> rxtracer = Create<RxTracer> ();
rxtracer->Setup(netdev, GetNode());

to start the count, and then I call another function that fetches the
throughput and writes it to log file and re-schedules itself to call
itself again after a second. You can change the return type of
GetThroughput to void in case you don't need the info directly (I use
it to run a loadbalancing algorithm).

void thisclass::measurer()
{
rxtracer->GetThroughput();
Simulator::Schedule(Seconds(1), &thisclass::measurer, this);

}

Anyway, with this you get trace per second for each node/interface to
a file.

Sreedevi Veerathu

unread,
Mar 31, 2010, 7:51:51 AM3/31/10
to ns-3-...@googlegroups.com
Thank You for all and i will try it now.

--
Reply all
Reply to author
Forward
0 new messages