Same kind of tag Problem

82 views
Skip to first unread message

Krishna Bharadwaj

unread,
Dec 23, 2016, 2:14:15 AM12/23/16
to ns-3-users
Hi,

I've added a small code snippet in sta-wifi-mac.cc receive ()
  SnrTag tag;
  double snrValue = 0;
 
  if (packet->PeekPacketTag (tag))
  {
     NS_LOG_DEBUG ("Received Packet with SNR = " << tag.Get());
     snrValue = tag.Get();
  }

I've used the snrvalue for the purpose of user association. But when I'm running my code it's showing an assert "Cannot add same kind of tag twice", I've added a cout phrase before this assert statement in packet-tag-list.cc. Then o/p was ns3::SnrTag assert failed .......and the statement continued. I didn't get this error. Please explain.

Thanks and Regards,
pvnskbs.

Krishna Bharadwaj

unread,
Dec 23, 2016, 2:30:18 AM12/23/16
to ns-3-users
If the tag was added twice how and where can we find that???

Konstantinos

unread,
Dec 23, 2016, 6:40:00 AM12/23/16
to ns-3-users
Hi,

The code snippet you attached only investigates IF there is SnrTag attached to the packet, and if yes get it.
Somewhere else in your code, you are adding the SnrTag. I would guess this is done in YansWifiPhy and you (or someone else) blindly adds the tag without checking if it is already there. This is usually due to forwarded packets. 

Regards,
K

Krishna Bharadwaj

unread,
Dec 28, 2016, 3:19:28 AM12/28/16
to ns-3-users
Hi Konstantinos,

Thank you very much for suggesting me. As it was 3.26 version snr tag was sent from somewhere (but i did not get that part where snr tag is sent) inside yanswifiphy. as u said i commented the tags that i created in that file. it worked well. 'Coz snr tag tag was explicitly defined in 3.23 version. but in this the tag is created and sent from somewhere. if you know where the tag was added please let me know.

Thanks and Regards,
pvnskbs.

Konstantinos

unread,
Dec 28, 2016, 7:38:18 AM12/28/16
to ns-3-users
Hi,

Sorry, but I did not understand your question.

K.

Krishna Bharadwaj

unread,
Dec 28, 2016, 1:38:59 PM12/28/16
to ns-3-users
Hi,

In InterferenceHelper.cc

double
InterferenceHelper::CalculateSnr (double signal, double noiseInterference, uint32_t channelWidth) const
{
   ...........................
   .....................
  double snr = signal / noise; //linear scale
  return snr;
}

From above signal variable is getting it's value whenever there's a call for CalculateSnr. But when calling this function, value of powerW is sent to signal variable,
 
powerW is getting it's value from double powerW = event->GetRxPowerW () : this function returns m_rxPowerW, m_rxPowerW is defined as    

m_rxPowerW (rxPower) in InterferenceHelper::Event::Event (.........). Thus rxPower is processed as signal power and snr is calculated.

My question is from where does this variable rxPower get it's value???

Thanks and Regards,
pvnskbs.

Krishna Bharadwaj

unread,
Dec 28, 2016, 1:51:40 PM12/28/16
to ns-3-users
And also please clarify me that whether snr tag is created or not from snr value.If created how it is added and sent??

Konstantinos

unread,
Dec 28, 2016, 6:29:23 PM12/28/16
to ns-3-users
Hi,

This is a totally different question, not related to the problem of 'double tagging' that you have asked again in a different thread.
You can use a debugger and I would recommend a graphical one (e.g. the debugges in Eclipse), or simply enable the logging in wifi module to identify the calling sequence.
Also the study of the manual should help understand the desing of the model

Now, regarding the SnrTag, if you search the wifi model code you can see when it is used.
Simply by using 'grep -r "SnrTag" <path_to_src>' you can find all the occurences of SnrTag.
Further, the API gives you some hints if you look closer in the SnrTag class reference:
In all those methods, SnrTag::Set() is referenced, which implies that at those points the tag is attached to the packet sent at that particular point.
So, if you try to attach it again onto the same packets, you get the error.

Regards,
K

Krishna Bharadwaj

unread,
Dec 30, 2016, 12:23:16 AM12/30/16
to ns-3-users
Hi,

First of all I'm sorry to ask a question which is related to another thread. But the explanation you gave for snr-tag is the one which I was asking.Thank you for highlighting the points.I have tried these, it worked well.

Thanks and Regards,
pvnskbs.
Reply all
Reply to author
Forward
0 new messages