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)(
97 mac->GetPifs () +
mac->GetSlot () +
mac->GetEifsNoDifs () +
99 ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
Smart pointer class similar to boost::intrusive_ptr.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void SetHeaderTid(uint8_t tid)
Set header TID from the Dot11MetricTid attribute.
uint32_t CalculateMetric(Mac48Address peerAddress, Ptr< MeshWifiInterfaceMac > mac)
Airtime link metric is defined in Section 13.9 of IEEE 802.11-2012 as:
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
AirtimeLinkMetricCalculator()
Hold an unsigned integer type.
Airtime link metric calculator.
static TypeId GetTypeId()
Get the type ID.
void SetTestLength(uint16_t testLength)
Set number of bytes in test frame (a constant 1024 in the standard)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
Ptr< Packet > m_testFrame
test frame
A base class which provides memory management and object aggregation.
WifiMacHeader m_testHeader
test header
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.