[ns] node id in c++
Hi all I am trying to get the node id in the aodv and the udpagent c++ codes. Can anyone provide my with the way to do that and I will be grateful. Regards Anas
[ns] counting the number of packets sent during the simulation
Hi all I am using ns-2.29 and as part of my research I am trying to count the number of packets sent by a node. I added a method called counting to count the number of packets to the source code of the UDP agent ( I wonder if this is the right place). And what I want after that is to calculate the number of packet at some time during the simulation this is as example of what I did: set udp_(0) [new Agent/UDP] $ns_ attach-agent $node_(0) $udp_(0) set null_(0) [new Agent/Null] $ns_ attach-agent $node_(1) $null_(0) set cbr_(0) [new Application/Traffic/CBR] $cbr_(0) set packetSize_ 512 $cbr_(0) set rate_ 81920 $cbr_(0) set random_ 1 $cbr_(0) set maxpkts_ 1 $cbr_(0) attach-agent $udp_(0) #$ns_ link_lossmodel $val(err) $node_(0) $node_(1) $ns_ connect $udp_(0) $null_(0) $ns_ at 0 "$cbr_(0) start" $ns_ at 90 "$cbr_(0) stop" if { [$ns_ at 5 "$udp_(0) counting"] < 120 } { set x_coor [$node_(0) getX] set y_coor [$node_(0) getY] $node_(4) setdest $x_coor $y_coor 15.0 } However the code is working fine but it is not recognizing the condition in the if statement. I will be grateful for your help Anas - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[ns] energy model variables
Hi all I am trying to access the value of the initial energy for the energy model after configuring the nodes. for example after $ns_ node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -topoInstance $topo \ -agentTrace OFF \ -routerTrace OFF \ -macTrace ON \ -movementTrace OFF \ -energyModel "EnergyModel" \ -initialEnergy 3 \ -rxPower 0.3 \ -txPower 0.3 \ -IDLE 0.3 \ -channel $chan_1_ #-errProc UniformErr #-IncomingErrProc UniformErrorProc #-IncomingErrProc $val(err) for {set i 2} {$i < $val(nn) } {incr i} { set node_($i) [$ns_ node] $node_($i) random-motion 0 ;# disable random motion } I want to check the initial energy using an if statement if {$initialEnergy > 2} { DO WHATEVER} I will be grateful for your help Regards Anas - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[ns] energy model variables
Hi all I am trying to acces the initial energy value after configuring the wireless node, unfortunally i did not succeed to do that. As a result I wonder anyone knows a way to do that and I will be grateful for the help Regards Anas - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[ns] LEACH total energy consumpsion
Hi Finally I managed to run leach under ns-allinone-2.29. Unfortunatelly, when I ran the example script the output said that the total energy comsumed is equal to 367.6739273 ... etc. but this doen not look right as the every node has 2 joules as initial energy and if you run the simulation for 100 nodes this mean that the total initial energy is 200. so how come the totat energy consumed is larger than the total initial energy? Please help me to solve this problem and if the output is correct could you please provide me with an explanation for that and I will be grateful. Regards Anas - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[ns] ns-leach extesion problems
Dear Sir I am using ns-2.31 under cygwin and I have been trying to extend it with the leach extension developed for ns-2.27. after following the procedure specified in the pfd document that comes with it I got the following error: trace/trace.cc: In static member function `static int Trace::get_seqno(Packet*)' : trace/trace.cc:206: error: `PT_XCP' undeclared (first use this function) trace/trace.cc:206: error: (Each undeclared identifier is reported only once for each function it appears in.) trace/trace.cc: In member function `virtual void DequeTrace::recv(Packet*, Handl er*)': trace/trace.cc:567: warning: int format, nsaddr_t arg (arg 5) trace/trace.cc:567: warning: int format, nsaddr_t arg (arg 6) trace/trace.cc:586: warning: int format, nsaddr_t arg (arg 5) trace/trace.cc:586: warning: int format, nsaddr_t arg (arg 6) make: *** [trace/trace.o] Error 1 I do not know what is wrong, and I wonder if I have to install ns-2.27, but I tried to install it but it did not work. I am grateful for your help Regards Anas - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.