hi to all ns users,
hello sir/mam,
plz plz help me.
i want to stop the simulation of all those nodes having energy 0 and
simulation of other nodes should continue having energy greater than 0.
I've been trying to abort the execution in the Mobilenode::log_energy method
in mobilenode.cc file in common folder.
I'm doing something like this:
*//this code is already present.*
void
MobileNode::log_energy(int flag)
{
if (!log_target_)
return;
Scheduler &s = Scheduler::instance();
if (flag) {
// sprintf(log_target_->pt_->buffer(),"N -t %f -n %d -e %f", s.clock(),
sprintf(log_target_->pt_->buffer(),"N -t %f -n %d -e %.20f",
s.clock(),address_, energy_model_->energy());
} else {
sprintf(log_target_->pt_->buffer(),"N -t %f -n %d -e 0 ", s.clock(),
address_);
}
*// MY INCLUDED CODE
if (energy_model_->energy() <= 0) {
fprintf(stdout,"DEATH -t %f -n %d -e %.20f", s.clock(),
address_, energy_model_->energy());
fprintf(stderr,"DEATH -t %f -n %d -e %.20f", s.clock(),
address_, energy_model_->energy());
exit(1);
}
// END OF MY INCLUDED CODE*
log_target_->pt_->dump();
}
*// by exit(1) the network exits. so where should i use exit??
if i use return (TCL_ERROR); where should i write this in tcl file or here??
*