#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to get x and y position and speed of the mobile nodes in NS2?
Source Code

C++ part :

double xpos = 0.0;
double ypos = 0.0;
double zval = 0.0;
int node_speed = 0;
MobileNode *iNode;
iNode = (MobileNode*) (Node::get_node_by_address(index));
((MobileNode *) iNode)->getLoc(&xpos,&ypos,&zpos);
printf(“Position of %d, X=%f, Y=%f, Z=%f \n “, index, xpos, ypos, zpos);;
node_speed = ((MobileNode *) iNode)->speed();
printf(“Node %d, Speed=%d \n”, index, node_speed);