[ns] Accessing energy_model()

fhg07@c3sl.ufpr.br fhg07 at c3sl.ufpr.br
Tue Feb 3 04:46:33 PST 2009


Well, I have instantiated a MobileNode object, and I really need to access
its energy_model() functions, however, energy_model() points to NULL.

Here is a piece of MyAgent::command() in my C++ code:
119     if (strcasecmp(argv[1], "energy_ammount")==0) {
120       node = (MobileNode*) MobileNode::get_node_by_address(myaddr);
121       node->update_position();
122       fprintf(stdout,"FINAL  coords:
%1.1fX%1.1f->%d\n",node->X(),node->Y(),node->energy_model());
123       return TCL_OK;
124     }

And when I call this from my TCL code, the output is this:
FINAL  coords: 10.0X25.0->0

The right values for X and Y are printed, but node->energy_model() still
points to NULL. Must I initialize it somehow? If so, I would be glad if
someone could explain how to do it.


Thanks,
-- 
Fernando Henrique Gielow - UFPR - NR2
Computer Science graduation student.



More information about the Ns-users mailing list