Measurements and Modeling Table of Contents 1 Measurements
Measurements and Modeling Table of Contents 1. Measurements 2. Modeling and its Shortcomings 3. Example of a Network Simulator: NS EECS 122 - UCB 1
Problem with Measurements Real System measure Real system does not exist Implementation of real test system is n n Result EECS 122 - UCB too expensive too dangerous Measurements would interfere with normal operation of the real system 2
Modeling Process Real System generate measure Result Model measure infer Modeling Result There are Analytical models and Simulation models EECS 122 - UCB 3
Disadvantage of Modeling Models give only an indication of the behavior of the real system Models are an abstraction of the reality n Many details are not considered Real systems are complex Therefore: n Differences between measurements in models and reality exist EECS 122 - UCB 4
Example: TCP Sequence Number Measured in Simulator and Reality Simulator Reality EECS 122 - UCB 5
EE 122 Projects – S 03 Assignment No. 2 and No. 3: n Analysis of ns simulation runs, showing the behavior of flows under different control mechanisms (Different TCPs and router implementations) n Implementation of ns module to analyze the impact of end-user decisions (in C++) (Adaptive routing and call control) EECS 122 - UCB 6
Modeling Using the Network Simulator: ns ns is discrete event simulator targeted at networking research ns started in 1985 ns simulates n n TCP, UDP, routing, and multicast protocols over wired and wireless (local and satellite) networks EECS 122 - UCB 7
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_1 I. nam w] $ns namtrace-all $nf #open the measurement output files ns classes NAM (output) ns set f 0 [open project_b_task_1 I_out 0. tr w] set f 1 [open project_b_task_1 I_out 1. tr w] set f 2 [open project_b_task_1 I_out 2. tr w] Gnuplot (output) EECS 122 - UCB 8
ns Architecture Object oriented (C++ and OTcl) Control operations in Otcl Class hierarchy (extract): EECS 122 - UCB 9
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) n n initializes the packet format creates a scheduler (handles time, timers, and events) Scheduler access through simulator methods n Example: “$ns at 0. 0 "$ftp start" ” (Tcl script) EECS 122 - UCB 10
Tcl Script - Example #create simulator set ns [new Simulator] #create node set n 0 [$ns node] set n 1 [$ns node] #create link between nodes $ns duplex-link $n 0 $n 2 10 Mb 10 ms Drop. Tail #create a TCP agent and attach it to node n 0 set tcp 0 [new Agent/TCP] $ns attach-agent $n 0 $tcp 0 set window_ 40 $tcp 0 set packet. Size_ 460 set sink [new Agent/TCPSink] $ns attach-agent $n 1 $sink #create an FTP source "application” and attach it to tcp set ftp [new Application/FTP] $ftp attach-agent $tcp 0 EECS 122 - UCB 11
Tcl Script – Example (cont. ) #open the nam trace file and measurement output file set nf [open project_b. nam w] $ns namtrace-all $nf set f 0 [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 simulation exit 0” #start the execution $ns run EECS 122 - UCB 12
NAM (Network Animator) Reads trace file generated by ns Example of trace file: V -t A -t c -t n -t. . . * * * -v -n -h -i -i -a 1. 0 a 5 -a 0 1 -p 0 -o 0 xffff -c 31 -a 1 1 -m 2147483647 -s 0 1 -n Blue 2 -n Red 0 -s 0 -S UP -v circle -c black -i black NAM EECS 122 - UCB 13
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: EECS 122 - UCB 14
Literature and Help for ns http: //www. isi. edu/nsnam/ns/ n n FAQ ns-related mailing list Tutorial Manual EECS 122 - UCB 15
- Slides: 15