Dear all: I try to evaluate energy consumption using NS2 (version 2.33) simulator for 802.15.4. However, I think that there are some problems on the energy calculation. Therefore, I will modify the source code as described below. Can anyone give me any comments for my modifications?
----- Nodes go into sleep mode by setting T_sleep_ to 0.0. Energy calculations in transmitting, receiving, idle, and sleep modes are enabled by adding the following lines to wpan_demo1.tcl. -energyModel "EnergyModel" \ -initialEnergy 1000.0 \ -sleepTime 0.0 \ -rxPower 1.1 \ -txPower 1.0 \ -idlePower 1.0 \ -sleepPower 0.001 \ -transitionPower 0.2 \ -transitionTime 0.005 \ However, there are the following two problems. 1. When I run wpan_demo1.tcl, the energy of the nodes that are ALWAYS in idle mode is not decreased at all. Therefore, I modified as follows to enable the periodic decrease and display of the energy of each node. ---Line 60 in mac/wireless-phy.cc: Before: ``a_->UpdateSleepEnergy(); After: ``a_->UpdateIdleEnergy();" ``a_->UpdateSleepEnergy();" 2. By executing ``a_->UpdateIdleEnergy();" and ``a_->UpdateSleepEnergy();" as described above, the energy of the nodes that are in idle or sleep mode at the time is periodically decreased (default setting is every 10 sec). However, these decreases are not reflected on the energy calculation in wpan/p802_15_4phy.cc when DecrIdleEnergy() and DecrSleepEnergy() are executed. The problem is that energy is doubly decreased by the calculations in mac/wireless-phy.cc and wpan/p802_15_4phy.cc. This is caused by that the energy calculation in wpan/p802_15_4phy.cc does not know that the update_energy_time_ is changed by the calculation in mac/wireless-phy.cc. Therefore, I modified it as following. ---Line 619 in wpan/p802_15_4phy.cc: Before: node()->energy_model()->DecrIdleEnergy((NOW-4/getRate('s')-aTurnaroundTime/getRate('s'))-channel_idle_time_, P_idle_); After: node()->energy_model()->DecrIdleEnergy((NOW-4/getRate('s')-aTurnaroundTime/getRate('s'))-update_energy_time_, P_idle_); ---Line 840 in wpan/p802_15_4phy.cc: Before: node()->energy_model()->DecrSleepEnergy(NOW-channel_sleep_time_-T_transition_,P_sleep_); After: node()->energy_model()->DecrSleepEnergy(NOW-update_energy_time_-T_transition_,P_sleep_); Sincerely, Masatoshi