Mac Frame Error Rate

244 views
Skip to first unread message

adhysa...@gmail.com

unread,
Sep 6, 2017, 12:15:48 PM9/6/17
to ns-3-users
Hi,

I want to compute the Mac Frame Error rate (FER) and add it to a packet/byte tag. I came across the code below and some posts on this mailing list. Some added the FER in the simulation script, some added on the routing implementation.
I want to read the tag in the NetDevice Interface, as I am doing with SNR already (which I tweaked the yans-wifi-phy). What's the best way to implement this tag?

One more question: what does m_node->GetDevice(0) mean?

// ***** MAC Frame Error Rate **** //
 
Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (m_node->GetDevice(0));
 NS_ASSERT
(dev != NULL);
 
PointerValue ptr;
 dev
->GetAttribute ("Mac",ptr);
 
Ptr<AdhocWifiMac> mac = ptr.Get<AdhocWifiMac> ();
 NS_ASSERT
(mac != NULL);
 mac
->GetAttribute ("DcaTxop",ptr);
 
Ptr<DcaTxop> dca = ptr.Get<DcaTxop> ();
 NS_ASSERT
(dca != NULL);
 
Ptr<WifiMacQueue> queue = dca->GetQueue ();
 NS_ASSERT
(queue != NULL);
 NS_LOG_INFO
("Queue size: " << queue->GetSize ());
 uint32_t m_utilization
= queue->GetSize();
 NS_LOG_INFO
("Utilization: " << m_utilization);

Thank you

adhysa...@gmail.com

unread,
Sep 6, 2017, 8:21:10 PM9/6/17
to ns-3-users
Hi,

Just an update on the code and post in general (sorry, Googles doesn't let me edit the previous post).

The code snippet below is from the CLWPR approach, which was implemented in the routing protocol.
I implemented the code below on my NetDevice (for now). The frame error rate show zero in every transmission.
Frame Error Rate = 0

  // ***** MAC Frame Error Rate **** //
 
Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (m_node->GetDevice(0));
  NS_ASSERT
(dev != NULL);
 
PointerValue ptr;

 
PointerValue ptr2;

  dev
->GetAttribute ("Mac",ptr);
 
Ptr<AdhocWifiMac> mac = ptr.Get<AdhocWifiMac> ();
  NS_ASSERT
(mac != NULL);

  dev
->GetAttribute("RemoteStationManager", ptr2);
 
Ptr<WifiRemoteStationManager>  _wifiRemSt = ptr2.Get<WifiRemoteStationManager>();
  NS_ASSERT
(_wifiRemSt != NULL);
 
WifiRemoteStationInfo _wifiInfo = _wifiRemSt->GetInfo(mac->GetAddress());
  NS_LOG_INFO
("Frame Error Rate = " <<_wifiInfo.GetFrameErrorRate());

My Wireless configuration is the following:
  //PHY layer
  wifi
= WifiHelper::Default ();
  wifi
.SetStandard (WIFI_PHY_STANDARD_80211g);
  wifi
.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                               
"DataMode",StringValue ("ErpOfdmRate6Mbps"),
                               
"ControlMode", StringValue ("ErpOfdmRate6Mbps"));
 
  wifiChannel
.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
  wifiChannel
.AddPropagationLoss("ns3::LogDistancePropagationLossModel",
                                 
"Exponent", DoubleValue (3.0));
                                 
//"ReferenceLoss", DoubleValue(40.0)); // reference loss with Friis at 2.4GHz

  wifiPhy
= YansWifiPhyHelper::Default ();
  wifiPhy
.SetChannel (wifiChannel.Create ());
  wifiPhy
.Set("TxPowerStart", DoubleValue(15.0)); //Minimum available transmission level (dbm)
  wifiPhy
.Set("TxPowerEnd", DoubleValue(15.0)); //Maximum available transmission level (dbm)
  wifiPhy
.Set("EnergyDetectionThreshold", DoubleValue(-90.0) ); //Receive Sensivity (dbm)

 
//MAC layer
  wifiMac
= NqosWifiMacHelper::Default ();
  wifiMac
.SetType ("ns3::AdhocWifiMac");   // Set to adhoc mode

  wifiNetDevicesNodes
= wifi.Install(wifiPhy, wifiMac, nodes);



Regarding my second question, the NetDevice(0) is the first net device installed on the node (in my case WiFi).

adhysa...@gmail.com

unread,
Sep 9, 2017, 4:57:38 PM9/9/17
to ns-3-users
Dear list members,

I wonder if you had a chance to look into this issue.
I'm getting the MAC FER = 0 every time. Also, getting Bit Rate = 6 Mbps every time (which is what I set and I'm using ConstantRateWifiManager)

Any comments? Can you spot any errors that I may have made?

Thanks in advance 

Sebastien Deronne

unread,
Sep 11, 2017, 3:11:05 PM9/11/17
to ns-3-users
How do you compute your FER exactly? A test script and patch of your changes to the code related to that FER are more than welcome to help you.
When you say MAC FER, do you mean a measure of the number of packets dropped because the maximum number of MAC retries did fail? (I call this PER)
I usually define the FER as a measure of the number of frame transmissions that did fail (at PHY then).
Please clarify and provide files.

adhysa...@gmail.com

unread,
Sep 14, 2017, 8:36:35 AM9/14/17
to ns-3-users
Hi Sebastien,

The FER is computed by the ns3::WifiRemoteStatioInfo::GetFrameErrorRate(), defined here.
I'm using the snippet above in my code, which I'm able to get results. Though zero every time. I think it's because I'm using ConstantRateWifi, but I haven't had the time to experiment with different Rate managers yet.

I will work on providing simple files you can test and run.

Thank you
Reply all
Reply to author
Forward
0 new messages