- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- bind variables
Hello:
I want to bind two variables in TCL with two variables in C++. I realize the following thing:
In TCL script:
set zigbee [new Agent/ZIGBEE]
$zigbee set DestinoPaqID 79
$zigbee set OrigenPaqID 2
In lib/ns-default.tcl:
Agent/ZIGBEE set OrigenPaqID 1
Agent/ZIGBEE set DestinoPaqID 1
In C++:
In constructor function:
bind(“OrigenPaqID”,&OrigenPaqID);
bind(“DestinoPaqID”,&DestinoPaqID);
The problem is that if I execute the following sentence inside one C++ function, for example recv():
fprintf(stdout,”OrigenID=%dnn”,OrigenPaqID);
fprintf(stdout,”DestinoID=%d.nn”,DestinoPaqID);
I always obtain:
OrigenID=1
DestinoID=1
How I can see OrigenID=2 and DestinoID=79? What is the problem? Why I always obtain the same thing?
Thank you.
Generally, the new agent will be attached with a nodes.
If the receive function of a node or the agent attached with that node is receiving something, then at that point it can refer its variable only, That is , if the lines
$zigbee set DestinoPaqID 79
$zigbee set OrigenPaqID 2
refer that particular agent of the node, then the value at that post will be 79 and 2.
Other wise if you are setting these the values for an agent of a different node and referring those values from some other node, then it will show the default value only.