Ns2

Fermé
bennacef Messages postés 1 Date d'inscription mercredi 17 février 2010 Statut Membre Dernière intervention 17 février 2010 - 17 févr. 2010 à 19:25
Bonsoir,

je m'appelle sana je travaille sur les systèmes à réseaux j ai utilisé
le simulateur ns pour la simulation
j'ai écris un code de file d'attente red ou j'ai emploi le flux ftp le probléme que pour un intervalle 200
la figure ne s'affiche pas
j utilise xgraph pour tracer les figures
et de même pour ce code qui utilise l'algorithme de PI

#Create a simulator object

set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
#set number of sources
set M 60
#making routers
set n(1) [$ns node]
set n(2) [$ns node]

#making sources and destinations

for {set i 1} {$i <=$M} {incr i} {

set s($i) [$ns node]
set r($i) [$ns node]
}

#creating the network link

$ns duplex-link $n(1) $n(2) 15Mb 50ms PI
$ns queue-limit $n(1) $n(2) 800

#creating the edge links

for {set i 1} {$i <= $M} {incr i} {
$ns duplex-link $s($i) $n(1) 15Mb 50ms DropTail
$ns duplex-link $n(2) $r($i) 15Mb 50ms DropTail
}

#Setup TCP connections

for {set i 1} {$i <= $M} {incr i} {
set tcp($i) [new Agent/TCP/Reno]
set sink($i) [new Agent/TCPSink]
$ns attach-agent $s($i) $tcp($i)
$ns attach-agent $r($i) $sink($i)
$ns connect $tcp($i) $sink($i)
$tcp($i) set ecn_ false
$tcp($i) set fid_ $i
$tcp($i) set window_ 15
}
#setup FTP applications
for {set i 1} {$i<= $M} {incr i} {
set ftp($i) [new Application/FTP]
$ftp($i) attach-agent $tcp($i)
$ftp($i) set type_ FTP
}
#creation des liens


#connexion udp
#set udp0 [new Agent/UDP]
#$ns attach-agent $n(1) $udp0
#cbr sur udp
#set cbr0 [new Application/Traffic/CBR]
#$cbr0 set packetSize_ 500
#$cbr0 set interval_ 0.005
#$cbr0 attach-agent $udp0
#null
#set null0 [new Agent/Null]
#$ns attach-agent $n(2) $null0

#connexion udp <->
#$ns connect $udp0 $null0

#$ns at 0.5 "$cbr0 start"
#$ns at 78 "$cbr0 stop"

#start FTP applications

for {set i 1} {$i<= $M} {incr i} {
$ns at 0 "$ftp($i) start"
$ns at 199 "$ftp($i) stop"
}
# Tracing a queue
set piq [[$ns link $n(1) $n(2)] queue]
$piq set setbit_ false

$piq set limit_ 800
#taille du buffer
$piq set mean_pktsize_ 500

#taille de chaque paquet en bytes
$piq set bytes_ false
$piq set queue_in_bytes_ false

$piq set setbit_ false
$piq set prob_ 0
$piq set curq_ 0

$piq set qref_ 175
$piq set w_ 160

$piq set a_ 1.82211e-05
$piq set b_ 1.8160e-05

set tchan_ [open all.q w]

$piq trace curq_
#$piq trace ave_
$piq attach $tchan_
# Define ’finish’ procedure (include post-simulation processes)

proc finish {} {

global ns nf tchan_
set awkCode {
{
if ($1 == "Q" && NF>1) {
# NF nombre de champ > 2
print $2, $3 >> "temp.q";
set end $2
}
# else if ($1 == "a" && NF>2)
# print $2, $3 >> "temp.a";
}
}
set f [open temp.queue w]
puts $f "TitleText:PI"
puts $f "Device: Postscript"
if { [info exists tchan_] } {
close $tchan_
}



exec rm -f temp.q temp.a
exec touch temp.a temp.q

exec awk $awkCode all.q
puts $f \"queue
exec cat temp.q >@ $f
puts $f \n\"ave_queue
exec cat temp.a >@ $f
close $f
close $nf


exec xgraph -t PI temp.q &
exit 0
}
#Call the finish procedure after 200 seconds of simulation time
$ns at 200 "finish"
#Run the simulation
$ns run


pour le temps 200 la figure ne s'affiche pas
et autre chose je veux introduire le http mais j'ai pas pu
aidez moi svp