Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • 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);