【文章內(nèi)容簡介】
m ? 移動節(jié)點:三個 ? N0和 N2是以 CBR/UDP連線。 ? 當(dāng) time=200時, N1從 (500, 500)移到 (500, 900)。 ? 當(dāng) time=500時, N1從 (500, 900)移到 (500, 100)。 ? 當(dāng) time=1000時結(jié)束。 2022/3/5 17 (500, 900) (500, 500) (650, 500) (350, 500) (500, 100) Time = 200 Time = 500 2022/3/5 18 Define options 定義一些變數(shù) =========================================================== set val(chan) Channel/WirelessChannel 。 channel type set val(prop) Propagation/TwoRayGround 。radiopropagation model set val(if) Phy/WirelessPhy 。 work interface type set val(mac) Mac/802_11 。 MAC type set val(ifq) Queue/DropTail/PriQueue 。 interface queue type set val(ll) LL 。 link layer type set val(ant) Antenna/OmniAntenna 。 antenna model (天線模型 ) set val(x) 1000 。拓樸範(fàn)圍 :X set val(y) 1000 。拓樸範(fàn)圍 :Y set val(ifqlen) 50 。 max packet in ifq set val(nn) 3 。 number of mobile nodes set val(seed) set val(stop) 。 simulation time set val(tr) 。 trace file name set val(rp) DSDV 。 routing protocol 2022/3/5 19 Initialize Global Variables set ns_ [new Simulator] Open trace file 開啟 trace file $ns_ usenewtrace set namfd [open w] $ns_ namtraceallwireless $namfd $val(x) $val(y) set tracefd [open $val(tr) w] $ns_ traceall $tracefd set up topography object 建立一個拓樸物件 ,以紀(jì)錄 mobilenodes在拓樸內(nèi)移動的情況