From b4fe088aca999df6d007bde8a8508d78e7cf5e90 Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Mon, 14 Mar 2016 19:28:26 +0100 Subject: [PATCH] uan: (fixes #1631) fix Acoustic Modem drawn energy calculation. --- RELEASE_NOTES | 1 + src/uan/model/acoustic-modem-energy-model.cc | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 4c778e547..724b32591 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -113,6 +113,7 @@ Bugs fixed - Bug 1132 - useless for loops in block-ack-test-suite.cc - Bug 1205 - EDCA is incorrectly modelled as DCF - Bug 1571 - TCP zero-window and flow control window updates by the receiver +- Bug 1631 - Acoustic modem Energy consumption calc is wrong - Bug 1761 - Rounding with olsr::EmfToSeconds - Bug 1783 - BytesInFlight value fixed - Bug 1954 - Serialized size of wifi-net-device differ for TX and RX trace diff --git a/src/uan/model/acoustic-modem-energy-model.cc b/src/uan/model/acoustic-modem-energy-model.cc index 164002f82..e64b01e9c 100644 --- a/src/uan/model/acoustic-modem-energy-model.cc +++ b/src/uan/model/acoustic-modem-energy-model.cc @@ -200,20 +200,20 @@ AcousticModemEnergyModel::ChangeState (int newState) // energy to decrease = current * voltage * time double energyToDecrease = 0.0; - double supplyVoltage = m_source->GetSupplyVoltage (); + switch (m_currentState) { case UanPhy::TX: - energyToDecrease = duration.GetSeconds () * m_txPowerW * supplyVoltage; + energyToDecrease = duration.GetSeconds () * m_txPowerW; break; case UanPhy::RX: - energyToDecrease = duration.GetSeconds () * m_rxPowerW * supplyVoltage; + energyToDecrease = duration.GetSeconds () * m_rxPowerW; break; case UanPhy::IDLE: - energyToDecrease = duration.GetSeconds () * m_idlePowerW * supplyVoltage; + energyToDecrease = duration.GetSeconds () * m_idlePowerW; break; case UanPhy::SLEEP: - energyToDecrease = duration.GetSeconds () * m_sleepPowerW * supplyVoltage; + energyToDecrease = duration.GetSeconds () * m_sleepPowerW; break; default: NS_FATAL_ERROR ("AcousticModemEnergyModel:Undefined radio state!");