22 #include "ns3/wifi-phy.h"
31 static TypeId tid =
TypeId (
"ns3::dot11s::AirtimeLinkMetricCalculator")
33 .SetGroupName (
"Mesh")
35 .AddAttribute (
"TestLength",
36 "Number of bytes in test frame (a constant 1024 in the standard)",
40 MakeUintegerChecker<uint16_t> (1)
42 .AddAttribute (
"Dot11MetricTid",
43 "TID used to calculate metric (data rate)",
47 MakeUintegerChecker<uint8_t> (0)
66 m_testFrame = Create<Packet> (testLength + 6 + 36 );
85 double failAvg =
mac->GetWifiRemoteStationManager ()->GetInfo (peerAddress).GetFrameErrorRate ();
89 return (uint32_t) 0xffffffff;
96 uint32_t metric = (uint32_t)((
double)(
98 2 *
mac->GetWifiPhy ()->GetSifs () + 2 *
mac->GetWifiPhy ()->GetSlot ()
99 +
mac->GetWifiPhy ()->GetAckTxTime ()
101 ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
A base class which provides memory management and object aggregation.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
represent a single transmission mode
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
Airtime link metric calculator.
Ptr< Packet > m_testFrame
test frame
uint32_t CalculateMetric(Mac48Address peerAddress, Ptr< MeshWifiInterfaceMac > mac)
Airtime link metric is defined in Section 13.9 of IEEE 802.11-2012 as:
void SetHeaderTid(uint8_t tid)
Set header TID from the Dot11MetricTid attribute.
WifiMacHeader m_testHeader
test header
AirtimeLinkMetricCalculator()
void SetTestLength(uint16_t testLength)
Set number of bytes in test frame (a constant 1024 in the standard)
static TypeId GetTypeId()
Get the type ID.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.