Re: Printing packet sizes and timestamps in a Wifi network

116 views
Skip to first unread message
Message has been deleted
Message has been deleted

Rediet

unread,
Jul 12, 2017, 2:56:18 AM7/12/17
to ns-3-users
Hello,

I believe that the best way to do it is to use MonitorSnifferTx and MonitorSnifferRx traces at the AP (see doxygen). As to how identify the AP, it'll be the nth node to have been created.
If it's the first node, it will give something like this (example taken from example/wireless/wifi-spectrum-per-interference of ns-dev branch):
Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&MonitorSniffRx));

One final point, is to how to identify ACKs: in your called back methods, extract the WifiMacHeader of the received packet and put a condition on it (hdr.IsAck () && hdr.GetAddr1 () == [Mac@]) by mimicing the MacLow::ReceiveOk. By the way, you can obtain the MAC address of the AP by going through the WifiNetDevice (using GetMac, then casting the pointer into a RegularWifiMac in order to use its GetAddress method).

Regards,

Rediet

Le mardi 11 juillet 2017 23:22:40 UTC+2, PN a écrit :
I have been trying to check how to print out the information I need by making modifications to the module. I have a question: when MacLow::SendDataPacket() or MacLow::SendDataAfterCts() are called at the AP, is it accurate to assume that the AP will not call these functions again to send another packet before a MAC layer ACK is received or a timeout occurs?

So technically if I store the packet size value in a variable after this function is called by using Packet::GetSize(), and print it out each time an ACK is received from MacLow::ReceiveOk(), will this be accurate?

Thanks.

On Tuesday, July 11, 2017 at 1:48:59 AM UTC-5, PN wrote:
I'm trying to print packet sizes and timestamps for successfully transmitted and received packets by the access point in a wifi network. I refer to packets which have been transmitted and their corresponding MAC ACKs have been received by the AP as successfully transmitted packets. Similarly packets whose MAC ACKs have been transmitted by the AP as successfully received packets. Also, I'm looking for values only from the AP and not the STAs.

I looked at the available list of traces for the WiFi module. Unfortunately, I could not find any trace that could help me get these values. If I missed anything, please do let me know.

However, I decided to take a look at the module itself and see if there was any class from which all these values were available so I can print them out manually. I'm faced with a couple of problems:

Unable to find a class from which I can print these values: In the WiFi module, my understanding is that the packet is passed by the transmitter's PHY object to the YansWifiChannel object which then passes it to the receiver. At the receiver, the duration and the end time of transmission is calculated and whether to drop the packet or not is decided based on the other packets that are received within this duration and their received signal strength. So technically these timestamp values are available at the receiver (but the ACK hasn't been sent yet) instead of the transmitter.

At the transmitter side, the duration of transmission is calculated in the SendDataPacket() in mac-low but this variable is not a globally accessible variable since it is declared inside this function itself. Also, while sending data, it is not known whether this packet will be successfully received so multiple transmissions might be made by the AP due to collisions/errors. In the receiveok() function in mac-low, after an ACK is successfully received, I could not figure out how to print out the size of the original packet that was transmitted (corresponding to this ACK) since the size does not seem to be stored anywhere. So overall, I don't know which class to look at to print these values.

Unable to identify the AP:
I suppose even if I do figure out where to put this print statement, it will start printing values from all the nodes in the simulation irrespective of whether they are AP or not. Is there a way to uniquely identify the AP. For instance, is there any MAC address assignment pattern in ns 3 that help identify who is AP? Eg: the lowest MAC address is assigned to the AP and the following to the STAs (this might sound crazy but I'm hoping that assignments are not random). So perhaps, I can leverage this to put a if statement and print these values only if the node has a particular MAC address.

I know that I can print out a log from multiple classes with all possible variable values and use a script to analyze the log file and identify the ones I need. However, the reason why I'm trying to print these values is because I need to modify the WiFi module for my experiment. However, the modifications will go into the class that has these values available (hopefully just one class).

Does anyone know any simpler way of doing this compared to what I'm trying? Or can anyone please tell me where I'm going wrong?

Thank you so much for your time! I understand that this was a very lengthy post. But I wanted to make sure I don't miss out on any detail. Let me know if I missed out anything, and I'll modify this to reflect the missing detail.

Again, thanks a lot!
Message has been deleted

Rediet

unread,
Jul 13, 2017, 3:14:25 AM7/13/17
to ns-3-users
Hello Peshal,

Correct. You have two options then: either track sent packets (by looking at the Retry flag or following-up the fragment/sequence number), or go up the stack and use the MacTx trace source of WifiMac. The problem with the latter is that you'll also have to check if the packet was dropped by MAC queues (through MacTxDrop). If you opt for this option, I would recommend to use the ns-dev branch. It benefits from improvements made by Stefano/Pasquale on queue management.

BR,

Rediet

Le mercredi 12 juillet 2017 21:23:44 UTC+2, PN a écrit :
Hey,

Thanks for your reply. I really appreciate it.

I have a follow up question though: wouldn't the method you suggested give me all the packets that are transmitted including retransmissions?

Thanks.
Peshal
Reply all
Reply to author
Forward
0 new messages