Airtime metric finished
This commit is contained in:
@@ -27,10 +27,11 @@ uint32_t
|
||||
AirtimeLinkMetricCalculator::CalculateMetric(Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac)
|
||||
{
|
||||
WifiRemoteStation * station = mac->GetStationManager ()->Lookup(peerAddress);
|
||||
NS_ASSERT(station != 0);
|
||||
Ptr<Packet> test_frame = Create<Packet> (test_length);
|
||||
uint32_t rate = station->GetDataMode(test_frame, test_length+header_length).GetDataRate ();
|
||||
uint32_t payload_nanosec = (uint32_t)((double)(test_length*8)*1e9 / ((double)rate));
|
||||
uint32_t metric = (uint32_t)(((double)(payload_nanosec + overhead_nanosec))/102.4);
|
||||
uint32_t payload_nanosec = (uint32_t) ((double) (test_length * 8) * 1e9 / ((double)rate));
|
||||
uint32_t metric = (uint32_t) (((double) (payload_nanosec + overhead_nanosec)) / 102.4 * (station->GetAvgSlrc () + 1));
|
||||
return metric;
|
||||
}
|
||||
} //namespace dot11s
|
||||
|
||||
@@ -421,7 +421,9 @@ WifiRemoteStation::GetTypeId (void)
|
||||
WifiRemoteStation::WifiRemoteStation ()
|
||||
: m_state (BRAND_NEW),
|
||||
m_ssrc (0),
|
||||
m_slrc (0)
|
||||
m_slrc (0),
|
||||
m_avgSlrcCoefficient(0.9),
|
||||
m_avgSlrc (0.0)
|
||||
{}
|
||||
WifiRemoteStation::~WifiRemoteStation ()
|
||||
{}
|
||||
@@ -545,7 +547,11 @@ WifiRemoteStation::GetAckMode (WifiMode dataMode)
|
||||
{
|
||||
return GetControlAnswerMode (dataMode);
|
||||
}
|
||||
|
||||
double
|
||||
WifiRemoteStation::GetAvgSlrc ()
|
||||
{
|
||||
return m_avgSlrc;
|
||||
}
|
||||
uint32_t
|
||||
WifiRemoteStation::GetNSupportedModes (void) const
|
||||
{
|
||||
@@ -700,6 +706,7 @@ WifiRemoteStation::ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
void
|
||||
WifiRemoteStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
m_avgSlrc = m_avgSlrc * m_avgSlrcCoefficient + (double) m_slrc * (1 - m_avgSlrcCoefficient);
|
||||
m_slrc = 0;
|
||||
DoReportDataOk (ackSnr, ackMode, dataSnr);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
* handshake.
|
||||
*/
|
||||
WifiMode GetAckMode (WifiMode dataMode);
|
||||
|
||||
double GetAvgSlrc ();
|
||||
private:
|
||||
typedef std::vector<WifiMode> SupportedModes;
|
||||
virtual Ptr<WifiRemoteStationManager> GetManager (void) const = 0;
|
||||
@@ -286,6 +286,13 @@ private:
|
||||
SupportedModes m_modes;
|
||||
TracedValue<uint32_t> m_ssrc;
|
||||
TracedValue<uint32_t> m_slrc;
|
||||
///\name needed to calculate average SLRC
|
||||
///\{
|
||||
///\brief the coefficient: we valculate averages slrc as
|
||||
//m_avgSlrc = m_avgSlr*coefficient + m_slrc*(1-coefficient);
|
||||
double m_avgSlrcCoefficient;
|
||||
double m_avgSlrc;
|
||||
///\}
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user