[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[manet] wireless network in ns2
I'm an italian student at University of Parma, I'm studing wireless networks.
I have some problems with Network simulator 2.
I want to change the transmitting power (Pt_, in the file whireless-phy) of
each node, depending on the distance of the next hop's node. The scope is
minimizing power consumption.
The problem is that the nodes are continuosly moving: Pt_ must be continuosly
updated. What can i do?
I have found the function "distance (MobileNode *m)" in mobile-node.cc; i have
implemented a new function "powercontrol" in whireless-phy.cc, which
calculates Pt_, depending on distance about tx node and rx node.
void
WirelessPhy::powercontrol(Node *tnode Node *rnode)
{
MobileNode* tmnode = (MobileNode*)tnode;
MobileNode* rmnode = (MobileNode*)rnode;
double distance = 0;
distance = tmnode->distance(rmnode);
if (distance<=40) Pt_=0.001;
else if (distance >40 && distance <=60) Pt_=0.002;
else if (distance >60 && distance <=80) Pt_=0.00345;
else if (distance >80 && distance <=90) Pt_=0.0048;
else if (distance >90 && distance <=100) Pt_=0.00725;
else if (distance >100 && distance <=110) Pt_=0.0106;
else if (distance >110 && distance<=120) Pt_=0.015;
else if (distance >120 && distance <=150) Pt_=0.0366;
else if (distance >150 && distance <=180) Pt_=0.0758;
else if (distance >180) Pt_=0.2818;
}
Is it correct?
The problem is that Pt_ isn't the same for each node, and must be continuosly
updated. What can I do? Can i make all in C++, or I must modify my tcl
script? I included it in the mail.
Thank you for all, Bragalini Marco
_______________________________________________
manet mailing list
manet at ietf.org
https://www1.ietf.org/mailman/listinfo/manet