[ns] Computation of decrase in node energy

Divya Lakshmi Shivakumar divya_lakshmi at hotmail.com
Wed Feb 25 21:05:28 PST 2004


Hi,

  The energy to decrease due to transmission and reception is computed as in 
the following code in energy-model.cc:

  void EnergyModel::DecrTxEnergy(double txtime, double P_tx)
{
	double dEng = P_tx * txtime;
	if (energy_ <= dEng)
		energy_ = 0.0;
	else
		energy_ = energy_ - dEng;
	if (energy_ <= 0.0)
		God::instance()->ComputeRoute();
}


void EnergyModel::DecrRcvEnergy(double rcvtime, double P_rcv)
{
	double dEng = P_rcv * rcvtime;
      //  printf("recv time  @ %d is    %f\n",node_->address_,rcvtime);
	if (energy_ <= dEng)
		energy_ = 0.0;
	else
		energy_ = energy_ - dEng;
	if (energy_ <= 0.0)
		God::instance()->ComputeRoute();
}



  I want to know from where are the above two functions called?I searched 
mobilenode.cc, antenna.cc, couldn't find these function calls.
  Also, i would like to know how are the values for rcvtime and txtime 
calculated.
Is it just the packet size / bandwidth?

Please help.....

thanks,
Divya

_________________________________________________________________
Find and compare great deals on Broadband access at the MSN High-Speed 
Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/



More information about the Ns-users mailing list