Bài 1 phần đầu cho Dung

0 views
Skip to first unread message

Nguyen Tai Phong

unread,
Apr 28, 2011, 9:55:29 AM4/28/11
to H09VT4-PTIT
đây là bài 1 phần đầu tiên, dạo này mình bận quá, đnag làm cả đồ án
bên BK cũng sắp bv tốt nghiệp,
đây là bài phần đầu, chưa có nghẽn

http://www.mediafire.com/?1eszploywe7mags
hoặc code ở đây:
#bai thuc hanh 01 DUng

set ns [new Simulator]
set nf [open out.nam w]
$ns namtrace-all $nf
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}

#Tao node
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]


#Tao lien ket giua cac node , da tao nghen
$ns duplex-link $n0 $n1 2.5Mb 15ms DropTail
$ns duplex-link $n0 $n2 2.6Mb 15ms DropTail
$ns duplex-link $n1 $n3 2.5Mb 15ms DropTail
$ns duplex-link $n2 $n3 2.5Mb 15ms DropTail

# Tao mot agent UDP va gan no vao nut n0
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0

# Tao nguon luu luong loai CBR va gan no la udp0 , da tao nghen
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 205
$cbr0 set interval_ 0.005

$cbr0 attach-agent $udp0

# Gan cho nut khoi dau la n0 va nut di ra la n4
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0

$ns connect $udp0 $null0

# Dat thoi diem khoi dau cbr va ket thuc
$ns at 0.5 "$cbr0 start"
$ns at 2.5 "$cbr0 stop"


$ns at 3.0 "finish"
$ns run

truong ngoo

unread,
Apr 30, 2011, 12:53:33 PM4/30/11
to h09vt...@googlegroups.com
thanks!
to nhan dc bai rui.dang hoc ca o 2 noi co ah? the thi vat va rui
Reply all
Reply to author
Forward
0 new messages