Documente Academic
Documente Profesional
Documente Cultură
#utline
A Simulation and its results The Format of Trace File The AWK language Result Analysis
Figure "ut#ut
'
s1
s'
null
,-1 s . /-0 s
c(r
ud#
$ns duplex-link $s1 $r 2Mb 10ms DropTail $ns duplex-link $s2 $r 2Mb 10ms DropTail $ns duplex-link $r $d 1.7Mb 20ms DropTail $ns queue-limit $r $d 10 $ns duplex-link-op $s1 $r orient right-down $ns duplex-link-op $s2 $r orient right-up $ns duplex-link-op $r $d orient right $ns duplex-link-op $r $d queuePos 0.5
$tcp set fid_ 1 set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP
$udp set fid_ 2 set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 1mb $cbr set random_ false
$ns at 4.5 "$ns detach-agent $s1 $tcp; $ns detach-agent $d $sink" $ns at 5.0 "finish"
N"M !esult
%race 'ile
+ 0.1 1 2 cbr 1000 ------- 2 1.0 3.1 0 0 - 0.1 1 2 cbr 1000 ------- 2 1.0 3.1 0 0 + 0.108 1 2 cbr 1000 ------- 2 1.0 3.1 1 1 - 0.108 1 2 cbr 1000 ------- 2 1.0 3.1 1 1 r 0.114 1 2 cbr 1000 ------- 2 1.0 3.1 0 0 + 0.114 2 3 cbr 1000 ------- 2 1.0 3.1 0 0 - 0.114 2 3 cbr 1000 ------- 2 1.0 3.1 0 0 + 0.116 1 2 cbr 1000 ------- 2 1.0 3.1 2 2 - 0.116 1 2 cbr 1000 ------- 2 1.0 3.1 2 2 r 0.122 1 2 cbr 1000 ------- 2 1.0 3.1 1 1 + 0.122 2 3 cbr 1000 ------- 2 1.0 3.1 1 1 - 0.122 2 3 cbr 1000 ------- 2 1.0 3.1 1 1 + 0.124 1 2 cbr 1000 ------- 2 1.0 3.1 3 3 - 0.124 1 2 cbr 1000 ------- 2 1.0 3.1 3 3 r 0.13 1 2 cbr 1000 ------- 2 1.0 3.1 2 2 + 0.13 2 3 cbr 1000 ------- 2 1.0 3.1 2 2 - 0.13 2 3 cbr 1000 ------- 2 1.0 3.1 2 2 + 0.132 1 2 cbr 1000 ------- 2 1.0 3.1 4 4 ...
%race 'ormat
+ 0.1 1 2 cbr 1000 ------- 2 1.0 3.1 0 0
Event Time From node To node Packet Type Packet Size Flags Flow ID Source address Destination address Sequence number Packet ID r: +: -: d: receive enqueue dequeue drop
src_node.port dest_node.port
1,
"() *anguage
Designed for te5t analysis Similar to * (ut more sim#le Read the records line (y line
6,7 the 8hole string in the corres#onding line 617 the first data in the corres#onding line 6'7 the second data in the corres#onding line --61 62 63 64 61, 611 61'
11
Process Procedure
1; Read one record '; &#date the #arameters ); Run the Pattern *ode /; Re#eat until no record remain
1'
1)
1/
:n this e5am#leF 8e calculate the end-to-end delay for the c(r traffic Iia ud# transmission
10
11
12
"nalysis 2$ /itter
:n this e5am#leF 8e calculate the Ritter for the c(r traffic Iia ud# transmission
14
"nalysis 2$ /itter+Cont ,
9E$:% < highestK#ac etKid=,> ? < action = 61> time = 6'> from = 6)> to = 6/> ty#e = 60> # tsiGe = 61> flo8Kid = 63> src = 64> dst = 61,> seCKno = 611> #ac etKid = 61'> if @ #ac etKid H highestK#ac etKid ; highestK#ac etKid = #ac etKid> if @ startKtimeL#ac etKidM == , ; < # tKseCnoL#ac etKidM = seCKno> startKtimeL#ac etKidM = time> ? if @ flo8Kid == ' NN action O= AdA ; < if@ action == ArA ; < endKtimeL#ac etKidM = time> ? else < endKtimeL#ac etKidM = -1> ? ? ?
',
"nalysis 2$ /itter+Cont ,
E%D < lastKseCuno = ,> lastKdelay = ,> seCnoKdiff = ,> for@#ac etKid=,> #ac etKid P highestK#ac etKid> #ac etKidBB; < start = startKtimeL#ac etKidM> end = endKtimeL#ac etKidM> #ac etKduration = end-start> if@ start P end ; < seCnoKdiff = # tKseCnoL#ac etKidM-lastKseCno> delayKdiff = #ac etKduration - lastKdelay> if @ seCnoKdiff == , ; < Ritter = ,> ? else < Ritter = delayKdiffSseCnoKdiff> ? #rintf@ADf DfEnAFstartF Ritter;> lastKseCno = # tKseCnoL#ac etKidM> lastKdelay = #ac etKduration> ? ? ? '1
"nalysis 2$ /itter+Cont ,
:n the transmissionF some of the #ac ets may (e lost due to the oIerflo8 of the Cueue
!oss = Pac etsKSent - Pac etsKRecieIe
r d End Time s' Start Time
:n this e5am#leF 8e calculate the #ac et loss for the c(r traffic Iia ud# transmission
')
Practice .$ %hroughput
To calculate the aIerage through#ut of the c(r traffic (et8een node ' and node )
AIerage Through#ut = Total RecieIed 9ytes S Ela#sed Time
"nce node ) recieIe a #ac etF #rint out the real-time though#ut
'0
'igure #utput
A #icture #aints a thousand 8ords :n a #a#erF figures@#lots; are al8ays the essential #arts of the simulation and analysis section Tools for figure dra8ing
'1
1NUplot
Porta(le command-line driIen gra#hing utility Su##ort !inu5F Windo8sF Tac "S--:t allo8s scientists and students to IisualiGe mathematical functions and data Su##orts many ty#es of #lots in either 'D and )Dhtt#7SS888-gnu#lot-infoS :nstallation in &(untu from source
'2
Dra8 a #lot
gnu#lot H #lot Udelay-t5tU
'4
Set A5is
E5am#le
Sho8ing range
VV
),
Sho8 grid
gnu#lot H set grid gnu#lot H #lot sin@5;
)1
!a(els
title title
yla(el yla(el arro8 arro8 5la(el 5la(el gnu#lot H set title U*9R DelayU gnu#lot H set 5la(el USimulation Time @s;U gnu#lot H set yla(el UDelay @s;U gnu#lot H unset ey gnu#lot H set la(el Uconstant delay = ,-)321,1 secU at ,-1F,-,0 gnu#lot H set arro8 from ,-0F,-,0 to ,-0F,-,/ gnu#lot H #lot Udelay-t5tU 8ith lines#oints
la(el la(el
)'
im#ulses
Styles
))
"ut#ut
Wset the #icture format gnu#lot H set terminal #ng Wset the out#ut file name gnu#lot H set out#ut Udelay-#ngU Wdra8 the #lot gnu#lot H #lot Udelay-t5tU 8ith lines#oints
)/
1P* script
Ty#os ma e errors We may redra8 the #lot for many times Write the $P! scri#t as g#l file
set title A*9R DelayA set 5la(el ASimulation Time @s;A set yla(el ADelay @s;A unset ey set la(el Aconstant delay = ,-)321,1 secA at ,-1F,-,0 set arro8 from ,-0F,-,0 to ,-0F,-,/ set terminal #ng set out#ut Ac(rKdelay-#ngA #lot Adelay-t5tA 8ith lines#oints
Solution
6uestions7
Than you O