150 likes | 238 Views
Measurements and Modeling Table of Contents. Measurements Modeling and its Shortcomings Example of a Network Simulator: NS. Problem with Measurements. Real system does not exist Implementation of real test system is too expensive too dangerous
E N D
Measurements and ModelingTable of Contents • Measurements • Modeling and its Shortcomings • Example of a Network Simulator: NS
Problem with Measurements • Real system does not exist • Implementation of real test system is • too expensive • too dangerous • Measurements would interfere with normal operation of the real system Real System measure Result
generate Model measure infer ModelingResult Modeling Process • There are Analytical models and Simulation models Real System measure Result
Disadvantage of Modeling • Models give only an indication of the behavior of the real system • Models are an abstraction of the reality • Many details are not considered • Real systems are complex • Therefore: • Differences between measurements in models and reality exist
Example: TCP Sequence Number Measured in Simulator and Reality Simulator Reality
EE122 Projects – S03 • Assignment No.2 and No.3: • Analysis of ns simulation runs, showing the behavior of flows under different control mechanisms(Different TCPs and router implementations) • Implementation of ns module to analyze the impact of end-user decisions (in C++)(Adaptive routing and call control)
Modeling Using theNetwork Simulator: ns • ns is discrete event simulator targeted at networking research • ns started in 1985 • ns simulates • TCP, UDP, routing, and multicast protocols • over wired and wireless (local and satellite) networks
Simulation System tcl script (input) #Create a simulator object set ns [new Simulator] #Define different colors for data flows $ns color 1 Bluens Simulator Basics $ns color 2 Red #Open the nam trace filens Simulator Basics set nf [open project_b_task_1I.nam w] $ns namtrace-all $nf #open the measurement output files set f0 [open project_b_task_1I_out0.tr w] set f1 [open project_b_task_1I_out1.tr w] set f2 [open project_b_task_1I_out2.tr w] NAM (output) ns classes ns Gnuplot (output)
ns Architecture • Object oriented (C++ and OTcl) • Control operations in Otcl • Class hierarchy (extract):
ns Simulator Basics • Simulator API is a set of methods belonging to a simulator object • Simulator object is created with “set netsim [new Simulator] ” (Tcl script) • initializes the packet format • creates a scheduler(handles time, timers, and events) • Scheduler access through simulator methods • Example: “$ns at 0.0 "$ftp start"” (Tcl script)
Tcl Script - Example #create simulator set ns [new Simulator] #create node set n0 [$ns node]set n1 [$ns node] #create link between nodes$ns duplex-link $n0 $n2 10Mb 10ms DropTail #create a TCP agent and attach it to node n0set tcp0 [new Agent/TCP]$ns attach-agent $n0 $tcp0$tcp0 set window_ 40$tcp0 set packetSize_ 460 set sink [new Agent/TCPSink]$ns attach-agent $n1 $sink #create an FTP source "application” and attach it to tcp set ftp [new Application/FTP]$ftp attach-agent $tcp0
Tcl Script – Example (cont.) #open the nam trace file and measurement output fileset nf [open project_b.nam w]$ns namtrace-all $nf set f0 [open project_b.tr w] #schedule events$ns at 0.0 “$ftp start” $ns at 3.0 “puts $nf “[$ns now] \t [$ns now]””$ns at 6.0 “$ftp stop” $ns at 6.01 “#dump simulation result into files $ns flush-trace#Execute ‘NAM’ and ‘Gnuplot’exec nam project_b.nam &exec pgnuplot project_b.dem &#stop the simulationexit 0” #start the execution $ns run
NAM (Network Animator) • Reads trace file generated by ns • Example of trace file: V -t * -v 1.0a5 -a 0 A -t * -n 1 -p 0 -o 0xffffffff -c 31 -a 1 A -t * -h 1 -m 2147483647 -s 0 c -t * -i 1 -n Blue c -t * -i 2 -n Red n -t * -a 0 -s 0 -S UP -v circle -c black -i black ... NAM
Gnuplot (Graphic Tool) • Is distributed under the gnu license • Needs a script file (e.g. project_b.dem) and • file containing the data which has to be plotted • Example plot:
Literature and Help for ns • http://www.isi.edu/nsnam/ns/ • FAQ • ns-related mailing list • Tutorial • Manual