Hi group,
I'm working on a wifi scenario with node failure and energy tracking. If I use Simulator::Stop(), the whole application will shut down. If I use a "manual" flag to condition the sending/receiving behavior, the energy consumption keeps going on. So I wonder whether there is a way to simulate a one node failure in wifi scenario.
On the other hand, I'm a little confused about the energy model. I'm currently using flag to label sending/receiving, and node 1 will stop sending at 1500s, node 2~5 keep sending until 3000s. The sending mechanism is gossip. However, they have almost the same energy consumption, so I wonder what's the main factor of energy consumption.
/***************************************************************************/
/* energy source */
BasicEnergySourceHelper basicSourceHelper;
// configure energy source
basicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (t_max * 20.0));
// install source
EnergySourceContainer sources = basicSourceHelper.Install (nodes);
/* device energy model */
WifiRadioEnergyModelHelper radioEnergyHelper;
// configure radio energy model
radioEnergyHelper.Set ("TxCurrentA", DoubleValue (0.0174));
// install device model
DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
/***************************************************************************/
/*** Setup Energy Tracing ****/
Ptr<BasicEnergySource>* basicSourcePtr = new Ptr<BasicEnergySource>[numNode];
for (int i = 0; i < numNode; ++i) {
basicSourcePtr[i] = DynamicCast<BasicEnergySource> (sources.Get(i));
basicSourcePtr[i]->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy));
// device energy model
Ptr<DeviceEnergyModel> basicRadioModelPtr =
basicSourcePtr[i]->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (0);
NS_ASSERT (basicRadioModelPtr != NULL);
basicRadioModelPtr->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy));
}
// print remaining energy
for (DeviceEnergyModelContainer::Iterator iter = deviceModels.Begin (); iter != deviceModels.End (); iter ++) {
double energyConsumed = (*iter)->GetTotalEnergyConsumption ();
std::cout << "Total energy consumed by radio = " << energyConsumed << "J \n";
}
I'll sincerely appreciate it if there is any suggestion
Thanks,
-Rui