plots of Delay vs Time(in microsec) and Packet Loss vs Time (in microsec) for various WiFi Mac schemes

302 views
Skip to first unread message

Sourav Chakraborty

unread,
Feb 7, 2016, 5:17:36 AM2/7/16
to ns-3-users
Hi All,
I am trying to derive plots of Delay vs Time(in microsec) and Packet Loss vs Time (in microsec) for various WiFi Mac schemes using GnuplotHelper class...............I have attached a script for the same which I am using.....in it I have used --
probeType = "ns3::ApplicationPacketProbe";
   tracePath = "/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx";

as example...I have read the documentation in
https://www.nsnam.org/docs/manual/html/data-collection.html


but am still not able to figure out how to get the above mentioned plots....I am lost with probeType and tracePath and could not understand their significance.
Also am not clear if I can use existing probeType and tracePath to get the above mentioned plots or not.

Waiting for response.

Thanks,
Sourav
test-pcf-sourav.cc

Sourav Chakraborty

unread,
Feb 10, 2016, 1:38:33 AM2/10/16
to ns-3-users
Hi All,
Any updates on the query below.....I am stuck on this and require help urgently.

Thanks in advance,
Best Regards,
Sourav

Tom Henderson

unread,
Feb 12, 2016, 1:51:08 AM2/12/16
to ns-3-...@googlegroups.com
Sourav, I was able to get your program to output the plot, if I set withData to true.  If there is no PacketSink in the scenario, the program will exit with an error that the GnuplotHelper is not able to match any trace sources in the wildcarded path. Can you let us know if the basic plot works for you, or if not, what is the problem? However, the plot you currently have is not going to give you delay vs. time or packet loss vs. time; it merely prints out the value 1472 (bytes) for each arrival of a packet.  I think you may have included it as an example to get it working first. I think there are a couple of options for what you want; I would consider first to use the SeqTsHeader in the application directory, which is associated with UdpClient/Server objects (it could be added to other applications).  On the receive side, you can see in UdpServer::HandleRead where measurements of delay and sequence count are logged.  You could consider to add a new traced value to UdpServer to emit a TracedValue<Time> for the measured delay, and to emit a count of the number of losses with a TracedValue<uint32_t> variable, which you increment by the number of losses observed, assuming in-sequence delivery (e.g. if observed seq goes from 1 to 4, you would emit a value of 2 at that time).  You could then use the GnuplotHelper such as in your posted program, by passing in a path string similar to what you have above..  The other option is to use the Gnuplot class such as is used in the wifi examples such as ofdm-validation.cc.  This can also create a gnuplot directly (without going through the data collection framework). - Tom
Message has been deleted

Sourav Chakraborty

unread,
Feb 21, 2016, 6:12:42 AM2/21/16
to ns-3-users

Hi Tom,
Thanks a ton for your response....I have modified my script to use UDPServer/Client application instead of onoffHelper application(check attached script)....
But still am having doubt with what to put in probeType and tracePath for my plots of delay vs time and packetloss vs time......how to implement new strings similar to --
/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx

probably I need 2 of them--one for delay and another for packetloss???

I have checked UDPServer code and found that delay is already calculated but not packet loss(I can implement 2 public variables m_delay and m_packetloss),but how to pass them to Gnuplothelper???
Below is the existing code for HandleRead() function...
void UdpServer::HandleRead (Ptr<Socket> socket)
{
  NS_LOG_FUNCTION (this << socket);
  Ptr<Packet> packet;
  Address from;
  while ((packet = socket->RecvFrom (from)))
    {
      if (packet->GetSize () > 0)
        {
          SeqTsHeader seqTs;
          packet->RemoveHeader (seqTs);
          uint32_t currentSequenceNumber = seqTs.GetSeq ();
          if (InetSocketAddress::IsMatchingType (from))
            {
              NS_LOG_INFO ("TraceDelay: RX " << packet->GetSize () <<
                           " bytes from "<< InetSocketAddress::ConvertFrom (from).GetIpv4 () <<
                           " Sequence Number: " << currentSequenceNumber <<
                           " Uid: " << packet->GetUid () <<
                           " TXtime: " << seqTs.GetTs () <<
                           " RXtime: " << Simulator::Now () <<
                           " Delay: " << Simulator::Now () - seqTs.GetTs ());
            }
          else if (Inet6SocketAddress::IsMatchingType (from))
            {
              NS_LOG_INFO ("TraceDelay: RX " << packet->GetSize () <<
                           " bytes from "<< Inet6SocketAddress::ConvertFrom (from).GetIpv6 () <<
                           " Sequence Number: " << currentSequenceNumber <<
                           " Uid: " << packet->GetUid () <<
                           " TXtime: " << seqTs.GetTs () <<
                           " RXtime: " << Simulator::Now () <<
                           " Delay: " << Simulator::Now () - seqTs.GetTs ());
            }

          m_lossCounter.NotifyReceived (currentSequenceNumber);
          m_received++;
test-pcf-delay-ploss-plots.cc

Sourav Chakraborty

unread,
Feb 23, 2016, 7:39:33 PM2/23/16
to ns-3-users
Hi ALL,
Please provide me a little bit of guidance on how to get the plots done....I have followed Tom's suggestion,but am not clear on how to get to the end goal....please take a look at the mail below and advise accordingly.
Waiting for your response as I am stuck at this point.

Thanks in advance,
BR,
Sourav

Sourav Chakraborty

unread,
Mar 16, 2016, 11:47:36 PM3/16/16
to ns-3-users
Hi All,
Please find attached 3 files that I have modified.....the intention is to emit m_delay (udp_server.cc) and plot it against time from inside the simulation script(test-pcf-delay-ploss-plots-sourav.cc)....
The compilation goes through but I am getting a runtime error as below --

sourav@sourav ~/ns-3-2-nov/wifi-pcf-dev $ sudo ./waf --run "test-pcf-delay-ploss-plots-sourav --withData=1 --enablePcf=1 --debug=0 --nWifi=2"
[sudo] password for sourav: 
Waf: Entering directory `/home/sourav/ns-3-2-nov/wifi-pcf-dev/build'
[ 900/2359] Compiling scratch/test-pcf-delay-ploss-plots-sourav.cc
[2348/2359] Linking build/scratch/test-pcf-delay-ploss-plots-sourav
Waf: Leaving directory `/home/sourav/ns-3-2-nov/wifi-pcf-dev/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (2.895s)
msg="Lookup of /Name/Stats got no matches", file=../src/stats/helper/gnuplot-helper.cc, line=200
terminate called without an active exception
Command ['/home/sourav/ns-3-2-nov/wifi-pcf-dev/build/scratch/test-pcf-delay-ploss-plots-sourav', '--withData=1', '--enablePcf=1', '--debug=0', '--nWifi=2'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").

Please suggest what I am missing....waiting eagerly for your reply.

BR,
Sourav
test-pcf-delay-ploss-plots-sourav.cc
udp-server.h
udp-server.cc

Sourav Chakraborty

unread,
Apr 6, 2016, 9:17:00 PM4/6/16
to ns-3-users

Hi All,
Any updates on the query below.

BR,
Sourav
Reply all
Reply to author
Forward
0 new messages