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

[ns] What is wrong in this TCL script ?



Hi all,
I have to simulate a satellite link to test TCP performance on it. I 
prepare the following script, where I try to insert an error model but I 
don't get any packet dropping.

set ns [new Simulator]
$ns rtproto Dummy

# File di trace
set file [open out.tr w]
set error_file [open error.tr w]
$ns trace-all $file

# I parametri dei link
set opt(chan)		Channel/Sat
set opt(bw_down)	1.5Mb
set opt(bw_up)		1.5Mb
set opt(bw_isl)		25Mb
set opt(phy)		Phy/Sat
set opt(mac)		Mac/Sat
set opt(ifq)		Queue/DropTail
set opt(qlim)		50
set opt(ll)			LL/Sat

set linkargs "$opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_down) 
$opt(phy)"

# Satellite
set n0 [$ns satnode-geo 0.0 $linkargs $opt(chan)]

# Terminale a terra
set n1 [$ns satnode-terminal 0 0]

# Aggiungiamo il collegamento fra terminale a terra e satellite
$n1 add-gsl geo $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) 
$opt(phy) \
	[$n0 set downlink_] [$n0 set uplink_]

# Agenti
set agent1 [new Agent/UDP]
$ns attach-agent $n1 $agent1
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $agent1

set agent0 [new Agent/Null]
$ns attach-agent $n0 $agent0

# Colleghiamo i due agenti
$ns connect $agent0 $agent1

# Routing
set satrouteobject [new SatRouteObject]
$satrouteobject compute_routes

# Per il trace dei pacchetti trasmessi
$ns trace-all-satlinks $file

# Per il trace dei pacchetti persi
# $ns trace-error $error_file

# Aggiungiamo un modello di errore
set EModel [new ErrorModel]
$EModel unit pkt
$EModel set rate_ 0.9
$EModel ranvar [new RandomVariable/Uniform]
$n0 interface-errormodel $EModel

# Procedura di fine simulazione
proc finish {} {
	global ns file error_file
	$ns flush-trace
	close $file
	close $error_file
	exit 0
}

# Eventi
$ns at 0.0 "$cbr start"
$ns at 100.0 "$cbr stop"
$ns at 100.0 "finish"

$ns run

Where is the error ? Why there aren't packets dropped ?
Thank for your help.
Bye
Federico Orlandini