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.
--
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.
Hai,
> 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.
--