[ns] problem when adding a new routing protocol to NS2:please help

2008-12-17 Thread Nadine Chen

Hi all.
I added a new routing protocol to NS2. I made the appropriate changes to 
tcl/lib/ns-default.tcl, ns-packet.tcl,ns-lib.tcl , common/paquet.h, 
queue/priqueue.cc and trace:cmu-trace.h and .cc .i recompiled ns2 and I had an 
error free compilation. 
I wanted to test my protocol: I changed in wireless.tcl "set opt(rp)
 dsr" by  "set opt(rp) newprotocolname"
but when I wrote  ns wireless.tcl I had this :

num_nodes is set 50
Loading connection pattern...
can't read "node_(1)": no such variable
while executing
"$ns_ attach-agent $node_(1) $udp_(0)"
(file "../mobility/scene/cbr-50-10-4-512" line 8)
invoked from within
"source.orig ../mobility/scene/cbr-50-10-4-512"
("uplevel" body line 1)
invoked from within
"uplevel source.orig [list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig [list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source $opt(cp)"
invoked from within
"if { $opt(cp) == "" } {
puts "*** NOTE: no connection pattern specified."
set opt(cp) "none"
} else {
puts "Loading connection pattern..."
..."
(file "wireless.tcl" line 257)


So please if anyone has an idea about this error , help me.
I don't know if I should add a file in mobility or what should I do exactly.
help me please.


  


Re: [ns] problem when adding a new routing protocol to NS2:please help

2008-12-18 Thread Waleed Tuffaha

Hell Nadine,

I think you have an error in your Tcl simulation script. When you create the
wireless nodes you have to create them in an array called node_  because the
traffic generator (that generated the cbr-50-10-4-512 file ) expect the
nodes to be created in that array.

You can use this code to create the node:
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
}

 val(nn) here holds the number of nodes.


On Wed, Dec 17, 2008 at 10:06 PM, Nadine Chen  wrote:

>
> Hi all.
> I added a new routing protocol to NS2. I made the appropriate changes to
> tcl/lib/ns-default.tcl, ns-packet.tcl,ns-lib.tcl , common/paquet.h,
> queue/priqueue.cc and trace:cmu-trace.h and .cc .i recompiled ns2 and I had
> an error free compilation.
> I wanted to test my protocol: I changed in wireless.tcl "set opt(rp)
>   dsr" by  "set opt(rp)
> newprotocolname"
> but when I wrote  ns wireless.tcl I had this :
>
> num_nodes is set 50
> Loading connection pattern...
> can't read "node_(1)": no such variable
>while executing
> "$ns_ attach-agent $node_(1) $udp_(0)"
>(file "../mobility/scene/cbr-50-10-4-512" line 8)
>invoked from within
> "source.orig ../mobility/scene/cbr-50-10-4-512"
>("uplevel" body line 1)
>invoked from within
> "uplevel source.orig [list $fileName]"
>invoked from within
> "if [$instance_ is_http_url $fileName] {
> set buffer [$instance_ read_url $fileName]
> uplevel eval $buffer
> } else {
> uplevel source.orig [list $fileName]
> ..."
>(procedure "source" line 8)
>invoked from within
> "source $opt(cp)"
>invoked from within
> "if { $opt(cp) == "" } {
>puts "*** NOTE: no connection pattern specified."
>set opt(cp) "none"
> } else {
>puts "Loading connection pattern..."
>..."
>(file "wireless.tcl" line 257)
>
>
> So please if anyone has an idea about this error , help me.
> I don't know if I should add a file in mobility or what should I do
> exactly.
> help me please.
>
>
>
>


-- 
Waleed Tuffaha.