examples: Fix incorrect energy calculation in wifi power adaptation examples
This commit is contained in:
@@ -272,9 +272,9 @@ NodeStatistics::PhyCallback(std::string path, Ptr<const Packet> packet, double p
|
||||
|
||||
if (head.GetType() == WIFI_MAC_DATA)
|
||||
{
|
||||
m_totalEnergy += pow(10.0, m_currentPower[dest] / 10.0) *
|
||||
GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalTime += GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
const auto txTimeSeconds = GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalEnergy += DbmToW(m_currentPower[dest]) * txTimeSeconds;
|
||||
m_totalTime += txTimeSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -293,9 +293,9 @@ NodeStatistics::PhyCallback(std::string path, Ptr<const Packet> packet, double p
|
||||
|
||||
if (head.GetType() == WIFI_MAC_DATA)
|
||||
{
|
||||
m_totalEnergy += pow(10.0, m_currentPower[dest] / 10.0) *
|
||||
GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalTime += GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
const auto txTimeSeconds = GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalEnergy += DbmToW(m_currentPower[dest]) * txTimeSeconds;
|
||||
m_totalTime += txTimeSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user