Need help to trace packets and lost packets in the MmWave module

162 views
Skip to first unread message

aadesh shah

unread,
Apr 30, 2020, 4:05:38 AM4/30/20
to ns-3-users
Hello guys,

I am trying to trace the packets in the mmwave modules, my goal is to find the lost/dropped packets and the reason for the drop/lost.

I tried using flowmonitor, but flowmonitor provides the packets lost only at the application layer and there are outputs where the packets transmitted are more but the received are less still the lost packets are 0.

This is my flow monitor code:
 for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
    {
     
      Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
      std::stringstream protoStream;
      protoStream << (uint16_t) t.protocol;
      if (t.protocol == 6)
        {
          protoStream.str ("TCP");
        }
      if (t.protocol == 17)
        {
          protoStream.str ("UDP");
        }
      for (uint32_t reasonCode = 0; reasonCode < i->second.packetsDropped.size (); reasonCode++)
      {
          outFile<<"Print in";
          outFile << "<packetsDropped reasonCode=" << reasonCode
                  << " number=" << i->second.packetsDropped[reasonCode] << "\n";

      }

        outFile << "Flow " << i->first << " (" << t.sourceAddress << ":" << t.sourcePort << " -> " << t.destinationAddress << ":" << t.destinationPort << ") proto " << protoStream.str () << "\n";
        outFile << "  Tx Packets: " << i->second.txPackets << "\n";
        outFile << "  Tx Bytes:   " << i->second.txBytes << "\n";
        outFile << "  TxOffered:  " << i->second.txBytes * 8.0 / (endSimTime - startSimTime) / 1000 / 1000  << " Mbps\n";
        outFile << "  Rx Bytes:   " << i->second.rxBytes << "\n";
        outFile << "  Lost Packets: " << i->second.lostPackets<< "\n";
        // outFile << " Packets Dropped : " << i-> second.packetsDropped<<"\n";
        // outFile << " Byte Dropped: " << i->second.bytesDropped<<"\n";
        sumTxPackets += i->second.txPackets;
        sumLostPackets+= i->second.lostPackets;
      if (i->second.rxPackets > 0)
        {
          // Measure the duration of the flow from receiver's perspective
          double rxDuration = i->second.timeLastRxPacket.GetSeconds () - i->second.timeFirstTxPacket.GetSeconds ();

          averageFlowThroughput += i->second.rxBytes * 8.0 / rxDuration / 1000 / 1000;
          averageFlowDelay += 1000 * i->second.delaySum.GetSeconds () / i->second.rxPackets;

          outFile << "  Throughput: " << i->second.rxBytes * 8.0 / rxDuration / 1000 / 1000  << " Mbps\n";
          outFile << "  Mean delay:  " << 1000 * i->second.delaySum.GetSeconds () / i->second.rxPackets << " ms\n";
          //outFile << "  Mean upt:  " << i->second.uptSum / i->second.rxPackets / 1000/1000 << " Mbps \n";
          outFile << "  Mean jitter:  " << 1000 * i->second.jitterSum.GetSeconds () / i->second.rxPackets  << " ms\n";
//          for (uint32_t reasonCode = 0; reasonCode < i->second.packetsDropped.size (); reasonCode++)
//          {
//              outFile<<"Print in";
//              outFile << "<packetsDropped reasonCode=" << reasonCode
//                      << " number=" << i->second.packetsDropped[reasonCode] << "\n";
//
//          }
          // std::cout<<i->second.packetsDropped(0)<<std::endl;
          for (uint32_t reasonCode = 0; reasonCode < i->second.bytesDropped.size (); reasonCode++)
          {
              std::cout<<"\n"<< "<bytesDropped reasonCode=\"" << reasonCode << "\""
                      << " bytes=\"" << i->second.bytesDropped[reasonCode] << std::endl;
          }

        }
      else
        {
          outFile << "  Throughput:  0 Mbps\n";
          outFile << "  Mean delay:  0 ms\n";
          outFile << "  Mean upt:  0  Mbps \n";
          outFile << "  Mean jitter: 0 ms\n";
        }
      outFile << "\n" << "Loss Packet %" <<(((i->second.txPackets-i->second.rxPackets)*1.0)/i->second.txPackets);
      outFile << "  Rx Packets: " << i->second.rxPackets << "\n";

    }


    outFile << "\n" << "Packets Transmitted" << sumTxPackets << "\n";
    outFile << "\n" << "Packets Lost" << sumLostPackets << "\n";
   
    outFile << "\n\n  Mean flow throughput: " << averageFlowThroughput / stats.size() << "\n";
    outFile << "  Mean flow delay: " << averageFlowDelay / stats.size () << "\n";
    outFile <<"----------------------------------------Next Simulation -------------------------------------------------------------------------------------" << "\n";
  outFile.close ();

  flowMonitor->SerializeToXmlFile("test4.xml", true, true);


The bold loops are for the reasoncode but unfortunately I dont get any outputs for reason code when I run the ouputs.

For the packet trace I tried to locate the drop in the at the RLC and MAC layer with the following trace comments:
          Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/DataRadioBearerMap/*/LtePdcp/TxPDU",
                      MakeCallback (&PacketatMac));

          Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/DataRadioBearerMap/*/LteRlc/TxPDU",
                      MakeCallback (&PacketatRLC));

Still I dont get any output plus the trance gives rnti, lcid and bytes as an output how do you calculate the packets from that information?

I am relatively new to ns3 and mmwave module, I am trying to figure this issue for a while now.

I would be glad if someone can help me with the issue, I really want to know where and why my packets are being lost.

Any help will be appreciated.

Please help me solve this problem or suggest me an alternative to this problem.

Thank You.
Regards,
Aadesh Shah

Gabriela Romano

unread,
Sep 1, 2020, 2:56:39 AM9/1/20
to ns-3-users
Hello dear Aadesh
Could you please let me know if you found how to solve the issue? I have the same problem.
BR

Sampath

unread,
Sep 1, 2020, 5:26:12 AM9/1/20
to ns-3-users
Trace sources are the way to go. You might have some simple issue with connecting to the trace source. Just give it another try. 
I am not familiar with the mmwave module, so can't pin point the bug. 

Rima Benelmir

unread,
Feb 10, 2021, 9:44:31 AM2/10/21
to ns-3-users
Hello,
I have the same problem, did you have the solution please !

Thank you

Reply all
Reply to author
Forward
0 new messages