RDV+DIAL chat illimit� dans ta r�g!
no save
Assistance
Achat
News

Forum | réseau
network simulator ns2
ericprins24, le ven. 19 janv. 2007 à 12:31:40
Salut
SVP j'ai besoin d'un coup de main je n'arrive pas a relier les noeuds tcp0 et tcp1 avec le wireless des technologies(wifi,wimax et hiperlan) afin d'obtenir les differents figures du throughput et du delay (retard)
Merci de votre aide

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(ifqlen) 50
set val(nn) 6
set val(rp) DSDV
set val(x) 800
set val(y) 700

proc create_topology {} {
global ns n num_node
set num_node 6

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]

# EDGES (from-node to-node length a b):
$ns duplex-link $n0 $n2 100Mb 10ms DropTail
$ns duplex-link $n1 $n2 100Mb 10ms DropTail
$ns duplex-link $n2 $n3 100Mb 10ms DropTail
$ns duplex-link $n3 $n4 100Mb 10ms DropTail
$ns duplex-link $n3 $n5 100Mb 10ms DropTail

$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
$ns duplex-link-op $n3 $n4 orient right-up
$ns duplex-link-op $n3 $n5 orient right-down

$ns queue-limit $n(2) $n(3) 25
$ns duplex-link-op $n(2) $n(3) queuePos 1.5

}
# end of create_topology
set ns [new Simulator]

# set up colors for nam
$ns color 1 Blue
$ns color 2 Red

# Create nam trace and generic packet trace
$ns namtrace-all [open out.nam w]
# trace-all is the generic trace we've been using
$ns trace-all [open out.tr w]

create_topology

set tcp0 [new Agent/TCP]
$tcp0 set class_ 1
set sink0 [new Agent/TCPSink]
$ns attach-agent $n0 $tcp0
$ns attach-agent $n4 $sink0
$ns connect $tcp0 $sink0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0

set tcp1 [new Agent/TCP]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns attach-agent $n1 $tcp1
$ns attach-agent $n5 $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1

$ns at 30.0 "finish"

proc finish {} {
global ns
$ns flush-trace
puts "running nam..."
# exec to run unix command
exec nam out.nam &
exit 0
}

set tracefd [open out.tr w]
$ns_ trace-all $tracefd
set namtrace [open out.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

set f0 [open out0.tr w]
set f1 [open out1.tr w]

set tot0 0
set tot1 0

proc clean {} {
global tcp0 tcp1
$tcp0 set ndatabytes_0
$tcp0 set nrexmitbytes_0

$tcp1 set ndatabytes_0
$tcp1 set nrexmitbytes_0

}

proc record {} {
global tcp0 tcp1 tot0 tot1 psize startrecord endrecord f0 f1
set ns_ [Simulator instance]

set time 0.06

set bw0_0 [$tcp0 set ndatabytes_]
set bw0_1 [$tcp0 set nrexmitbytes_]
set bw0 [expr $bw0_0 - $bw0_1]

set tot0 [expr $tot0 + $bw0]

set bw1_0 [$tcp1 set ndatabytes_]
set bw1_1 [$tcp1 set nrexmitbytes_]
set bw1 [expr $bw1_0 - $bw1_1]

set tot1 [expr $tot1 + $bw1]

set now [$ns_now]

puts $f0 "$now [expr $bw0/$time*8/1000000]"
puts $f1 "$now [expr $bw1/$time*8/1000000]"

if {$now > $startrecord } {
puts $f2 "$now [expr $tot0/($now-$startrecord)*8/1000000]"
puts $f3 "$now [expr $tot1/($now-$startrecord)*8/1000000]"

}

$tcp0 set ndatabytes_0
$tcp0 set nrexmibytes_0

$tcp1 set ndatabytes_0
$tcp1 set nrexmibytes_0

if {$now < $endrecord } {$ns_at [expr $now+$time] "record"}
}

create_topology

proc stop {} {
global ns_ tracefd namtrace f0 f1
$ns_ flush-trace
close $tracefd
close $namtrace
close $f0
close $f1
exec nam out.nam &
exec xgraph out0.tr out1.tr -geometry 800*700 &
exit 0

create-god $val(nn)

set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

set chan_1_ [new $val(chan)]

$ns_ node-config -adhocRouting $val(rp)\
-llType $val(ll)\
-macType $val(mac)\
-ifqType $val(ifq)\
-ifqLen $val(ifqlen)\
-antType $val(ant)\
-propType $val(prop)\
-phyType $val(netif)\
-topoInstance $topo\
-agentTrace ON\
-routerTrace ON\
-macTrace ON\
-movementTrace ON\
-channel $chan_1_

set n(0) [$ns node]

$n(0) random-motion 0;

$ns initial_node_pos $n(0) 20

$god_ set-dist 0 1 1
$god_ set-dist 0 2 1

$n(0) set X _ 5.0
$n(0) set Y _ 2.0
$n(0) set Z _ 0.0

set n(1) [$ns_ node]

$n(1) random-motion 0

$ns initial_node_pos $n(1) 20

$n(1) set X _ 300.0
$n(1) set Y _ 300.0
$n(1) set Z _ 0.0

$ns at 5.0 "$n(0) setdest 50.0 20.0 10.0"
$ns at 7.0 "$n(1) setdest 200.0 20.0 40.0"

$ns at 0.5 "$ftp0 start"
$ns at 1.0 "$ftp1 start"

$ns at 5.0 "$ftp0 stop"
$ns at 6.0 "$ftp1 stop"

$ns at 50.0 "$n(0) setdest 50.0 250.0 35.0"
$ns at 65.0 "$n(1) setdest 300.0 200.0 50.0"

for {set i 0} {$i < $val(nn)} {incr i} {
$ns at 95.0 "$n($i) reset";
}

$ns at 95.0001
$ns at 95.0002 "stop"

puts "Starting Simulation..."
# Start the simualtion
$ns run Configuration: Windows XP
Internet Explorer 6.0


Michel
mars 07
Suivant
REPONSES
Michel
mars 07
Providence
avr. 07
kingkong
mai 07
rachelstar
août 07
aymen
oct. 07
likepeace
nov. 07
naim
nov. 07
lag
déc. 07
KORACHSKI
déc. 07
KORACHSKI
déc. 07
Version Web
Réalisé par RedShift
no save