EECS122 - UCB 1Measurements and ModelingTable of Contents1. Measurements2. Modeling and its Shortcomings3. Example of a Network Simulator: NSEECS122 - UCB 2Problem with MeasurementsReal system does not existImplementation of real test system is too expensive too dangerousMeasurements would interfere with normal operation of the real systemReal SystemResultmeasureEECS122 - UCB 3Modeling ProcessReal SystemResultmeasureModelgeneratemeasureModelingResultinferThere are Analytical models and Simulation modelsEECS122 - UCB 4Disadvantage of ModelingModels give only an indication of the behavior of the real systemModels are an abstraction of the reality Many details are not consideredReal systems are complexTherefore: Differences between measurements in models and reality existEECS122 - UCB 5Example: TCP Sequence Number Measured in Simulator and RealitySimulatorRealityEECS122 - UCB 6EE122 Projects – S03Assignment No.2 and No.3: Analysis of nssimulation runs, showing the behavior of flows under different control mechanisms(Different TCPs and router implementations) Implementation of nsmodule to analyze the impact of end-user decisions (in C++)(Adaptive routing and call control)EECS122 - UCB 7Modeling Using theNetwork Simulator: nsnsis discrete event simulator targeted at networking researchnsstarted in 1985nssimulates TCP, UDP, routing, and multicast protocols over wired and wireless (local and satellite) networksEECS122 - UCB 8Simulation System00.20.40.60.810 1 2 3 4 5 6Throughput Measurement of all UDP and TCP Flowsthroughput all flowsthroughput udp flowstcl script (input)Gnuplot (output)NAM (output)#Create a simulator objectset 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 Basicsset nf [open project_b_task_1I.nam w]$ns namtrace-all $nf#open the measurement output filesset 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]ns classesnsEECS122 - UCB 9ns ArchitectureObject oriented (C++ and OTcl)Control operations in OtclClass hierarchy (extract):EECS122 - UCB 10ns Simulator BasicsSimulator API is a set of methods belonging to a simulator objectSimulator object is created with “set netsim [new Simulator] ”(Tclscript) initializes the packet format creates a scheduler(handles time, timers, and events)Scheduler access through simulator methods Example: “$ns at 0.0 "$ftp start"”(Tclscript)EECS122 - UCB 11Tcl Script - Example#create simulatorset ns [new Simulator]#create nodeset 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_ 460set sink [new Agent/TCPSink]$ns attach-agent $n1 $sink#create an FTP source "application” and attach it to tcpset ftp [new Application/FTP]$ftp attach-agent $tcp0EECS122 - UCB 12Tcl 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 runEECS122 - UCB 13NAM (Network Animator)Reads trace file generated by ns Example of trace file:V-t*-v1.0a5-a0A -t * -n 1 -p 0 -o 0xffffffff -c 31 -a 1A -t * -h 1 -m 2147483647 -s 0c-t*-i1-nBluec-t*-i2-nRedn -t * -a 0 -s 0 -S UP -v circle -c black -i black...NAMEECS122 - UCB 14Gnuplot (Graphic Tool)Is distributed under the gnu licenseNeeds a script file (e.g. project_b.dem) andfile containing the data which has to be plottedExample plot:00.20.40.60.810 1 2 3 4 5 6Throughput Measurement of all UDP and TCP Flowsthroughput all flowsthroughput udp flowsEECS122 - UCB 15Literature and Help for nshttp://www.isi.edu/nsnam/ns/ FAQ ns-related mailing list Tutorial
View Full Document