[ns] Fw: info.
kidA
loris.fichera at gmail.com
Wed Jun 10 09:43:15 PDT 2009
mohamed saad wrote:
a salamo alikom
> how are dear
> when i run this script:
> set val(chan) Channel/WirelessChannel
> set val(prop) Propagation/TwoRayGround
> set val(netif) Phy/WirelessPhy
> set val(mac) Mac/802_11
> set val(ifq) Queue/DropTail/PriQueue
> set val(ll) LL
> set val(ant) Antenna/OmniAntenna
> set val(x) 1000 ;# X dimension of the topography
> set val(y) 1000 ;# Y dimension of the topography
> set val(ifqlen) 50 ;# max packet in ifq
> set val(seed) 0.0
> set val(adhocRouting) SEAD # Same code will be implemented for Ariadne
> # by changing the protocol to Ariadne.
> # The source code for SEAD and Ariadne was taken from
> # http://www.monarch.cs.rice.edu/software.html
> # By Yih-Chun Hu, David B. Johnson, and Adrian Perrig.
> set val(nn) 20 ;# how many nodes are simulated
> set val(sc) "scen-20-test"
> set val(cp) "cbr-20-test"
> set val(stop) 800.0 ;# simulation time
> # =====================================================================
> # Core Program
> # =====================================================================
> #How many packets have been received by the traffic links?
> #Get the current time
> set now [$ns_ now]
> set bw1 [$sink1 set bytes_]
> set bw2 [$sink2 set bytes_]
> if $now = 25
> #Calculate the packets (in kbytes/s) and write it to the trace file
> puts $sead1 "$now [expr $[ (bw2/1024)/512) / (bw1/1024)/512) ]"
> else
> puts $sead1 "$now [expr $ (bw2/1024)/512) / (bw1/1024)/512) ]"
> #Reset the bytes_ values on the traffic sinks
> $sink1 set bytes_ 0
> $sink2 set bytes_ 0
> #Re-schedule the procedure
> $ns_ at [expr $now+$now] "record"
> }
>
> appear this error:
>
> can't read "ns_": no such variable
> while executing
> "$ns_ now"
> invoked from within
> set now [$ns_ now]"
>
> what i do to solve this error?
You have to declare and set the "ns_" variable.
At the beginning of your script just add:
set ns_ [new Simulator]
Loris
--
"let me take you down, 'cos i'm going to Strawberry Fields."
------------------------------------------------------------------
[ Loris Fichera a.k.a. kid_a |GPG key ID 179FC4DD ]
[ Fingerprint D546 D632 3057 CCBB DF63 A8EC 6858 7300 179F C4DD ]
More information about the Ns-users
mailing list