NS-2 Tutorial (Part 2)

Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides). Outline: Ns-2 internals: script - internal structure. How to Extend ns. | ns-2 Tutorial, part 2 Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides) Outline Ns-2 internals script -> internal structure How to Extend ns Script Code # Create a topology Set ns [new Simulator] set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail # Add Transport agents set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp set tcpsink [new Agent/TCPSink] $ns attach-agent $n1 $tcpsink $tcp connect $tcpsink # Add application set ftp [new Application/FTP] $ftp attach-agent $tcp # Create a schedule $ns at "$ftp start" $ns at "$ftp stop" #Run the simulation $ns run n0 n1 1Mb 10ms FTP TCP FTP TCP How are you going to fit this whole thing onto one slide? Consider making one slide for the topology, one time to schedule the events. Discrete Event-Driven Simulator time_, uid_, next_, handler_ head_ -> handler_ -> handle() time_, uid_, next_, handler_ insert $ns at “$ftp start” $ns at “$ftp stop” $ns run Ns Node n0 n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 0 1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 1 0 set n0 [$ns node] set n1 [$ns node] Network Topology - Link n0 n1 enqT_ queue_ deqT_ drophead_ drpT_ link_ ttl_ n1 entry_ head_ $ns duplex-link $n0 $n1 1Mb 10ms DropTail Routing n0 n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 0 1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 1 0 Link n0-n1 Link n1-n0 0 1 Transport n0 n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 0 Agent/TCP agents_ Addr Classifier Port Classifier classifier_ dmux_ entry_ 1 0 Link n0-n1 Link n1-n0 0 Agent/TCPSink agents_ dst_= dst_= set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp Application 0 1 n0 n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ 0 Agent/TCP agents_ Addr Classifier Port Classifier classifier_ dmux_ entry_ 1 0 Link n0-n1 Link n1-n0 0 Agent/TCPSink agents_ dst_= dst_= Application/FTP set ftp [new Application/FTP] . | ns-2 Tutorial, part 2 Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides) Outline Ns-2 internals script -> internal structure How to Extend ns Script Code # Create a topology Set ns [new Simulator] set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1Mb 10ms DropTail # Add Transport agents set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp set tcpsink [new Agent/TCPSink] $ns attach-agent $n1 $tcpsink $tcp connect $tcpsink # Add application set ftp [new Application/FTP] $ftp attach-agent $tcp # Create a schedule $ns at "$ftp start" $ns at "$ftp stop" #Run the simulation $ns run n0 n1 1Mb 10ms FTP TCP FTP TCP How are you going to fit this whole thing onto one slide? Consider making one slide for the topology, one time to schedule the events. Discrete Event-Driven Simulator time_, uid_, next_, handler_ head_ -> handler_ -> handle() time_, uid_, next_, handler_ insert $ns at “$ftp start” $ns at “$ftp stop” $ns run Ns Node n0 n1 Addr .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.