New to ns3, thanks! I added energyModel to my ns3 nodes, and they work well. But I found that when the remaining energy is 0 the node is still work (send and receive packet), I set the EnergyDepletionCallback but I don't how to shutdown the node or NetDevice in my callback.
Here is my energy model:
Ptr<BasicEnergySource> energySource = CreateObject<BasicEnergySource>(); Ptr<WifiRadioEnergyModel> energyModel = CreateObject<WifiRadioEnergyModel>(); energySource->SetInitialEnergy (1); energyModel->SetEnergySource (energySource); energySource->AppendDeviceEnergyModel (energyModel); WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback callback = MakeCallback (&FqAodvExample::EnergyDepletionCallback, this); energyModel->SetEnergyDepletionCallback (callback); // aggregate energy source to node nodes.Get (i)->AggregateObject (energySource);
https://stackoverflow.com/questions/66540196/how-can-i-shutdown-a-node-after-energy-depletion-in-ns-3 March 09, 2021 at 11:01AM
没有评论:
发表评论