在NS2.33中,能量模型是节点属性,在~ns/mobile/energy-model.[h,cc]文件中定义,在~ns/mac/wireless-phy.[h,cc]文件中也有相关代码。
默认的,NS不会启用能量模型,使用方式为:
$ns_ node-config -energyModel "EnergyModel" \
-initialEnergy (焦耳)
-rxPower (瓦)
-txPower (瓦)
-idlePower (瓦)
-sleepPower (瓦)
-sleepTime (节点开始休眠前需要等待的时间,秒)
-transitionPower (在sleep和idle状态间切换所需的功率,瓦)
-transitionTime (在sleep和idle状态间切换所需的时间,秒)
在trace文件中,能量模型部分的格式为:
energy [total remaining energy] ei [idle consumption] es [sleep consumption] et[transmition consumption] er [receiving consumption]