Bug 844

Summary: YansWifiPhy::GetPowerDbm off-by-one problem when calculating Tx power
Product: ns-3 Reporter: Quincy Tse <quincy.tse>
Component: wifiAssignee: Nicola Baldo <nicola>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, quincy.tse, tomh
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Proposed patch. (Obsolete - Incorrect diff)
Proposed patch.

Description Quincy Tse 2010-03-14 22:15:16 UTC
For a system with n power levels, there are only (n - 1) intevals. Therefore the return value for YansWifiPhy::GetPowerDbm (uint8_t power) should be:
m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / (m_nTxPower - 1), (ie. divide by (m_nTxPower - 1) instead of m_nTxPower)
Comment 1 Quincy Tse 2010-03-14 22:18:31 UTC
Created attachment 792 [details]
Proposed patch. (Obsolete - Incorrect diff)
Comment 2 Quincy Tse 2010-03-14 22:20:59 UTC
Created attachment 793 [details]
Proposed patch.
Comment 3 Quincy Tse 2010-05-23 21:50:38 UTC
Patch not yet applied to ns-3-dev or ns-3.8.
Comment 4 Quincy Tse 2010-06-03 08:20:13 UTC
Nicola - could you please review and comment/commit?
Comment 5 Nicola Baldo 2010-06-07 11:10:32 UTC
Thanks for catching this! I guess that nobody noticed so far because the power level feature is almost unused in practice, as of now. 

Anyway, that's fixed now 
changeset:   6342:a2bdd767bb67