In WAVE, is it possible to get the actual transmission instant when the packet has to wait at queue in the MAC layer?

37 views
Skip to first unread message

Boong Baang

unread,
Oct 8, 2019, 8:09:19 PM10/8/19
to ns-3-users
1. As shown below, the GenerateTraffic function in my-wave-simple-802-11p.cc calls the Send() function inside of itself, so packet generation and transmission attempt happens at the same time. Suppose the packet gets queued in the MAC layer and so it has to undergo some queuing delay, is it possible to get the actual time in which the packet was transmitted after the wait at queue? 

static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize,
                             uint32_t pktCount, Time pktInterval )
{
  if (pktCount > 0)
    {
      SeqTsHeader seqTs;
      seqTs.SetSeq (pktCount);
      Ptr<Packet> p = Create<Packet> (pktSize-(12));
      p->AddHeader (seqTs); //confirm if size of seqTs is 12 or not??
      socket->Send(p);
      NS_LOG_UNCOND ("\nSending "<< pktCount  << " packet! \n");
      Simulator::Schedule (pktInterval, &GenerateTraffic, socket, pktSize,pktCount - 1, pktInterval);


2. The other question I have is that when we do not specify which class of service (BE, BK,VO, VI) the packet belongs to and I use QosWaveMacHelper for the MAC, which class's queue will the packet get added to and how to see that?

Adil Alsuhaim

unread,
Oct 11, 2019, 3:17:41 AM10/11/19
to ns-3-users
Every time a WifiMacQueueItem is created, there's a timestamp associated with the process. 

Queues have attributes and TraceSources that you can use. Loot at the traces associated with Queue<WifiMacQueueItem> here https://www.nsnam.org/doxygen/_trace_source_list.html

Assuming your code creates devices of type WaveNetDeviceyou can do this

std::string path = "/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/MacEntities/*/$ns3::OcbWifiMac/*/Queue/Dequeue"
Config::Connect(path,MakeCallback(&MyDequeueTraceFun))

and then you have to create a function MyDequeueTraceFun that matches the callback as follows
DequeueTrace(std::string context, Ptr<const WifiMacQueueItem> item)
{
   std
::cout << item->GetTimeStamp() << std::endl; //time packet was in queue
}


 
That's it! Keep in mind that a packet can be dequeued if the TTL in queue was exceeded. Study at all the other trace sources and see how they work. I believe one is used for packet drops due to full queue, and other events. 


2. 
If you're using WaveNetDevice, you're specifying the Access Category (AC), like BE, BK, VI or VO by using TxInfo struct, then the default value is 7, for VO. This can be found in wave-net-device.cc file 
Reply all
Reply to author
Forward
0 new messages