26 """The main function in this Battery discharge example
29 argv: System parameters to use if necessary
32 ns.core.LogComponentEnable("GenericBatteryModel", ns.core.LOG_LEVEL_DEBUG)
34 node = ns.network.Node()
35 batteryHelper = ns.energy.GenericBatteryModelHelper()
36 batteryModel = ns.CreateObject(
"GenericBatteryModel")
37 devicesEnergyModel = ns.energy.SimpleDeviceEnergyModel()
39 batteryModel.SetAttribute(
"FullVoltage", ns.core.DoubleValue(1.39))
40 batteryModel.SetAttribute(
"MaxCapacity", ns.core.DoubleValue(7.0))
42 batteryModel.SetAttribute(
"NominalVoltage", ns.core.DoubleValue(1.18))
43 batteryModel.SetAttribute(
"NominalCapacity", ns.core.DoubleValue(6.25))
45 batteryModel.SetAttribute(
"ExponentialVoltage", ns.core.DoubleValue(1.28))
46 batteryModel.SetAttribute(
"ExponentialCapacity", ns.core.DoubleValue(1.3))
48 batteryModel.SetAttribute(
"InternalResistance", ns.core.DoubleValue(0.0046))
49 batteryModel.SetAttribute(
"TypicalDischargeCurrent", ns.core.DoubleValue(1.3))
50 batteryModel.SetAttribute(
"CutoffVoltage", ns.core.DoubleValue(1.0))
52 batteryModel.SetAttribute(
"BatteryType", ns.core.EnumValue(ns.NIMH_NICD))
54 devicesEnergyModel.SetEnergySource(batteryModel)
55 batteryModel.AppendDeviceEnergyModel(devicesEnergyModel)
56 devicesEnergyModel.SetNode(node)
58 devicesEnergyModel.SetCurrentA(6.5)
61 ns.core.Simulator.Stop(ns.core.Seconds(3600))
62 ns.core.Simulator.Run()
63 ns.core.Simulator.Destroy()
67if __name__ ==
'__main__':