[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] problem with flow monitoring



I think the problem comes from
[$ns link $n0 $n3 ]
where n0 and n3 is not directly connected in your topology.

Kun-chan Lan

On Mon, 6 Aug 2001, swetha swetha wrote:

> hi all
> 
> This is james and iam a new user of ns2.Actually I
> have to calculate throughput and delay on a per flow
> basis.
> and iam also trying to trace the size of the
> congestion window.
> i am getting an error whicle using flowmonitor.can any
> one please help me in solving this error. Any help
> would be greatly appreciated.
> 
> I have a simple scenario like this
> 
> n0----|       |-----n3
>        n2-----|
> n1----|       ------n4
> 
> #Create a simulator object
> set ns [new Simulator]
> 
> #Define different colors for data flows (for NAM)
> $ns color 1 Blue
> $ns color 2 Red
>  
> 
> #Open the NAM trace file
> set nf [open out.nam w]
> $ns namtrace-all $nf
> 
> #Open the Trace file
> set tf [open out.tr w]
> $ns trace-all $tf
> 
> 
> #Define a 'finish' procedure
> proc finish {} {
>         global ns nf tf
>         $ns flush-trace
>         #Close the NAM trace file
>         close $nf
>         #Close the Trace file
>         close $tf
>         #Execute NAM on the trace file
>         exec nam out.nam &
>         exit 0
> }
> 
> 
> 
> #Create four nodes
> set n0 [$ns node]
> set n1 [$ns node]
> set n2 [$ns node]
> set n3 [$ns node]
> set n4 [$ns node]
>  
> 
> 
> #Create links between the nodes
> $ns duplex-link $n0 $n2 2Mb 10ms DropTail
> $ns duplex-link $n1 $n2 2Mb 10ms DropTail
>  
> $ns duplex-link $n2 $n3 1.7Mb 20ms RED
> $ns duplex-link $n2 $n4 1.7Mb 20ms DropTail
>  
> #Give node position (for NAM)
> $ns duplex-link-op $n0 $n2 orient right-down
> $ns duplex-link-op $n1 $n2 orient right-up 
>  
> $ns duplex-link-op $n2 $n3 orient right-down 
> $ns duplex-link-op $n2 $n4 orient right-up
>  
>    
> set fm [open all.fm w]
> set fmon [$ns makeflowmon Fid ]
> $ns attach-fmon [$ns link $n0 $n3 ]  $fmon    
> $ns attach-fmon [$ns link $n1 $n4 ]  $fmon    
>  
> $fmon attach $fm
>   
> $ns at 5.0 "$fmon dump"
> 
> #Setup a TCP connection
> set tcp [new Agent/TCP]
> $tcp set class_ 2
> $tcp trace cwnd_
> $tcp attach [open siri.tr w]
> $ns attach-agent $n0 $tcp
> set sink [new Agent/TCPSink]
> $tcp set fid_ 1
> 
> $ns attach-agent $n3 $sink
> $ns connect $tcp $sink
> $tcp set fid_ 1
>  $sink set interval_ 100
>  $tcp set window_ 10
> $tcp set packetSize_ 500
>  
>  
> 
> set tcp1 [new Agent/TCP]
> $tcp1 set class_ 1
> $ns attach-agent $n1 $tcp1
> set sink1 [new Agent/TCPSink]
> $sink1 set fid_ 2
> $ns attach-agent $n4 $sink1
> $ns connect $tcp1 $sink1
> $tcp1 set fid_ 2
> $tcp1 trace cwnd_
> $tcp1 attach [open siri.tr w]
> $sink1 set interval_ 10
> $tcp1 set window_ 1000
> $tcp1 set packetSize_ 700
>  
> 
> 
>  
> #Setup a FTP over TCP connection
> set telnet [new Application/FTP]
> $telnet attach-agent $tcp
> $telnet set type_ TELNET
> $telnet set interval_ 100
> 
> set telnet0 [new Application/FTP]
> $telnet0 attach-agent $tcp1
> $telnet0 set type_ TELNET
> $telnet0 set interval_ 100
> 
>  
>  
> #Schedule events for the CBR and FTP agents
> $ns at 0.1 "$telnet start"
> $ns at 1.0 "$telnet0 start"
> $ns at 3.0 "$telnet0 stop"
> $ns at 4.5 "$telnet stop"
>  
> 
> #Call the finish procedure after 5 seconds of
> simulation time
> $ns at 5.0 "finish"
> 
>  #Run the simulation
> $ns run
> 
> following is the error being generated
> % ns tcp1.tcl
> invalid command name ""
>     while executing
> "$
> 
> hi all
> 
> This is james and iam a new user of ns2.Actually I
> have to calculate throughput and delay on a per flow
> basis.
> and iam also trying to trace the size of the
> congestion window.
> i am getting an error whicle using flowmonitor.can any
> one please help me in solving this error. Any help
> would be greatly appreciated.
> 
> I have a simple scenario like this
> 
> n0----|       |-----n3
>        n2-----|
> n1----|       ------n4
> 
> #Create a simulator object
> set ns [new Simulator]
> 
> #Define different colors for data flows (for NAM)
> $ns color 1 Blue
> $ns color 2 Red
>  
> 
> #Open the NAM trace file
> set nf [open out.nam w]
> $ns namtrace-all $nf
> 
> #Open the Trace file
> set tf [open out.tr w]
> $ns trace-all $tf
> 
> 
> #Define a 'finish' procedure
> proc finish {} {
>         global ns nf tf
>         $ns flush-trace
>         #Close the NAM trace file
>         close $nf
>         #Close the Trace file
>         close $tf
>         #Execute NAM on the trace file
>         exec nam out.nam &
>         exit 0
> }
> 
> 
> 
> #Create four nodes
> set n0 [$ns node]
> set n1 [$ns node]
> set n2 [$ns node]
> set n3 [$ns node]
> set n4 [$ns node]
>  
> 
> 
> #Create links between the nodes
> $ns duplex-link $n0 $n2 2Mb 10ms DropTail
> $ns duplex-link $n1 $n2 2Mb 10ms DropTail
>  
> $ns duplex-link $n2 $n3 1.7Mb 20ms RED
> $ns duplex-link $n2 $n4 1.7Mb 20ms DropTail
>  
> #Give node position (for NAM)
> $ns duplex-link-op $n0 $n2 orient right-down
> $ns duplex-link-op $n1 $n2 orient right-up 
>  
> $ns duplex-link-op $n2 $n3 orient right-down 
> $ns duplex-link-op $n2 $n4 orient right-up
>  
>    
> set fm [open all.fm w]
> set fmon [$ns makeflowmon Fid ]
> $ns attach-fmon [$ns link $n0 $n3 ]  $fmon    
> $ns attach-fmon [$ns link $n1 $n4 ]  $fmon    
>  
> $fmon attach $fm
>   
> $ns at 5.0 "$fmon dump"
> 
> #Setup a TCP connection
> set tcp [new Agent/TCP]
> $tcp set class_ 2
> $tcp trace cwnd_
> $tcp attach [open siri.tr w]
> $ns attach-agent $n0 $tcp
> set sink [new Agent/TCPSink]
> $tcp set fid_ 1
> 
> $ns attach-agent $n3 $sink
> $ns connect $tcp $sink
> $tcp set fid_ 1
>  $sink set interval_ 100
>  $tcp set window_ 10
> $tcp set packetSize_ 500
>  
>  
> 
> set tcp1 [new Agent/TCP]
> $tcp1 set class_ 1
> $ns attach-agent $n1 $tcp1
> set sink1 [new Agent/TCPSink]
> $sink1 set fid_ 2
> $ns attach-agent $n4 $sink1
> $ns connect $tcp1 $sink1
> $tcp1 set fid_ 2
> $tcp1 trace cwnd_
> $tcp1 attach [open siri.tr w]
> $sink1 set interval_ 10
> $tcp1 set window_ 1000
> $tcp1 set packetSize_ 700
>  
> 
> 
>  
> #Setup a FTP over TCP connection
> set telnet [new Application/FTP]
> $telnet attach-agent $tcp
> $telnet set type_ TELNET
> $telnet set interval_ 100
> 
> set telnet0 [new Application/FTP]
> $telnet0 attach-agent $tcp1
> $telnet0 set type_ TELNET
> $telnet0 set interval_ 100
> 
>  
>  
> #Schedule events for the CBR and FTP agents
> $ns at 0.1 "$telnet start"
> $ns at 1.0 "$telnet0 start"
> $ns at 3.0 "$telnet0 stop"
> $ns at 4.5 "$telnet stop"
>  
> 
> #Call the finish procedure after 5 seconds of
> simulation time
> $ns at 5.0 "finish"
> 
>  #Run the simulation
> $ns run
> 
> following is the error being generated
> % ns tcp1.tcl
> invalid command name ""
>     while executing
> "$lnk attach-monitors $isnoop $osnoop $dsnoop $fm"
>     (procedure "_o3" line 5)
>     (Simulator attach-fmon line 5)
>     invoked from within
> "$ns attach-fmon [$ns link $n0 $n3 ]  $fmon    "
>     (file "tcp1.tcl" line 59)
> 
> 
> please some one help me in this regard..
> 
> Thanx
> james
>  
> 
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>