fixed bug 844

This commit is contained in:
Nicola Baldo
2010-06-07 17:05:29 +02:00
parent 1f4865f20c
commit 71728fa264

View File

@@ -726,7 +726,16 @@ YansWifiPhy::GetPowerDbm (uint8_t power) const
{
NS_ASSERT (m_txPowerBaseDbm <= m_txPowerEndDbm);
NS_ASSERT (m_nTxPower > 0);
double dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / m_nTxPower;
double dbm;
if (m_nTxPower > 1)
{
dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / (m_nTxPower - 1);
}
else
{
NS_ASSERT_MSG (m_txPowerBaseDbm == m_txPowerEndDbm, "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
dbm = m_txPowerBaseDbm;
}
return dbm;
}