Professional Documents
Culture Documents
Introduction To NS-2: Part 4. Queuing Simulation
Introduction To NS-2: Part 4. Queuing Simulation
Outline
OTcl AWK script GNUplot script Parameters from command line Batch Script
Rate: /h Server
...
3
Simulation Design
There should be 3 scenarios to verify the impact of the 3 kind of queuing systems
1)Event Rate <= Service Rate 2)Event Rate > Service Rate & Queuing Length is finite 3)Event Rate > Service Rate & Queuing Length is infinite
End to End Delay can represents the network capacity in this simulation
cbr
udp
null
udp
null
cbr
udp
null
11
} END{ for(packet_id=0; packet_id < highest_packet_id; packet_id++) { start = start_time[packet_id]; end = end_time[packet_id]; packet_duration = end-start; if( start < end ) printf("%f %f\n",start, packet_duration); } }
13
Simulation Work
ns 4-cbr-queuing.tcl
To run the OTcl Script To calculate real-time delay Queuing Length: 10, Data Rate: 1Mb
14
15
Review of GNUplot
gpl script cbr-compare.gpl:
set title "CBR Delay Comparison" set xlabel "Simulation Time (s)" set ylabel "Delay (s)" set terminal png set output "cbr_delay.png" plot "cbr-delay-10-1.txt" with lines 1, "cbr-delay-10-1.5.txt" with lines 2, "cbr-delay-10000-1.5.txt" with lines 3
~$ gnuplot cbr-compare.gpl
16
17
When you run simulations, put the value of the parameters by the end of the command, divided by space Examples:
More Efficiency?
To use batch processing to make everything in one statement! An example of Batch Script (cbr-compare.bat):
ns 4-cbr-queuing.tcl 10 1.0 awk -f delay.awk out.tr > cbr-delay-10-1.txt ns 4-cbr-queuing.tcl 10 1.5 awk -f delay.awk out.tr > cbr-delay-10-1.5.txt ns 4-cbr-queuing.tcl 10000 1.5 awk -f delay.awk out.tr > cbr-delay-10000-1.5.txt gnuplot cbr-compare.gpl
19
Result
20
Make the random number different in each simulation Random everytime Follows a certain behavior in a long term view The behavior in statistical view Famous Distributions: Uniform, Exponential, Poisson
21
Random Numbers
Distribution
23
24
In exponential traffic, the system assume that in some periods the application is sending packets while in some other periods it stay idle Thus in simulations, we have specify the burst time and idle time
26