Etude et simulations des problèmes d'équité d'accès au canal dans les réseaux ad hoc( Télécharger le fichier original )par Menad BELHOUL et Farid TAOURIRT Université Abderrahmane Mira de Bejaia - Master Informatique; Option: Administration et Sécurité des Réseaux Informatiques. 2017 |
Annexe A
Xgraph est une application X-Windows qui inclut le traçage interactif et graphique, de portabilitéet de corrections de bugs. Donc, pour tracer les caractéristiques des paramètres NS2 comme le débit, la fin d'un retard de la fin, les paquets d'informations, etc peut être tracée en utilisant xgraph. Le fichier xgraph affiche les informations à propos de la surcharge avec la taille du réseau, Overhead est comparéavec quatre protocoles de routage comme AODV, DSR, DSDV et NEAODV. Les valeurs sont prises à partir des divers fichiers de trace. 1 2 3 4 5 6 Scriptes des simulations Noeud caché set ns [ new Simulator] set val(chan) Channel/WirelessChannel ;#Channel Type set val ( prop) Propagation/TwoRayGround ;# radio-propagation model set val( n e t i f ) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802 11 ;# MAC type set val ( i f q ) Queue/DropTail/PriQueue ;# interface queue type Annexe 7 8 9 10 11 12 13 14 15 16 set val ( l l ) LL ;# link layer type set val ( ant) Antenna/OmniAntenna ;# antenna model set val ( i f q l e n ) 50 ;# max packet in ifq set val (nn) 3 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set val(x) 500 set val(y) 500 Phy/WirelessPhy set CSThresh 2.28e-11 Mac/802 11 set dataRate 11Mb Mac/802 11 set RTSThreshold 10000 17 # set up topography object set topo [new Topography] $topo load flatgrid $val (x) $val (y) 20 set namfile [open sample33.nam w] #Tracing all the events and cofiguration $ns namtrace-all-wireless $namfile $val (x) $val (y) 24 #Trace File creation set tracefile [open sample33.tr w] 27 #Open the output files set f0 [open node 0.tr w] set f1 [open node 2.tr w] 31 #Tracing all the events and cofiguration $ns trace-all $ t r a c e f i l e 34 # general operational descriptor- storing the hop details in the network create-god $val (nn) 37 # configure the nodes $ns node-config -adhocRouting $val ( rp ) \ 40 -llType $val ( l l ) \ 41 -macType $val (mac) \ 42 -ifqType $val ( i f q ) \ 43 -ifqLen $val ( i f q l e n ) \ 44 -antType $val ( ant ) \ 45 -propType $val (prop) \ 46 -phyType $val ( n e t i f ) \ 47 -channelType $val ( chan ) \ 48 -topoInstance $topo \ 49 -agentTrace ON \ 50 -routerTrace ON \ 51 -macTrace OFF \ 52 -movementTrace ON 53 54 # Node Creation 55 38 39 35 36 32 33 28 29 30 25 26 21 22 23 18 19 2 Annexe } } } 62 #Location fixing for a single node 76 # Label and coloring for { set i 0} { $i < 3} { incr i } { 56 57 set node ( $i ) [ $ns node] $node ( $i ) color black 63 $node (0) set X 50 .0 $node (0) set Y 10 .0 $node (0) set Z 0 .0 67 $node (1) set X 250 .0 $node (1) set Y 10 .0 $node (1) set Z 0 .0 71 $node (2) set X 450 .0 $node (2) set Y 10 .0 $node (2) set Z 0 .0 75 77 for { set i 0} { $i < 3} { incr i } { 78 79 $ns at 0 .1 »$node ( $i ) color blue» $ns at 0 .1 »$node ( $i ) label Node$i» for { set i 0} { $i < 3} { incr i } { 84 #Size of the node 85 86 87 $ns initial node pos $node ( $i ) 30 #Define a ' finish ' procedure proc finish {} { global f0 f1 #Close the output files close $f0 close $f1 #Call xgraph to display the results exec xgraph node 0.tr node 2.tr -geometry 800x400 & exit 0 } #Define a procedure which periodically records the bandwidth received by the 104 #three traffic sinks sink0 /1/2 and writes i t to the three files f0 /1/2 . 58 59 60 61 64 65 66 68 69 70 72 73 74 80 81 82 83 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 3 Annexe 131 $tcp0 set class 2 proc record {} { global sink0 sink1 f0 f1 107 #Get an instance of the simulator set ns [ Simulator instance] #Set the time after which the procedure should be called again set time 0 .1 #How many bytes have been received by the traffic sinks? set bw0 [ $sink0 set bytes ] set bw1 [ $sink1 set bytes ] 114 #Get the current time set now [ $ns now] #Calculate the bandwidth ( in MBit/s ) and write i t to the files puts $f0 »$now [ expr $bw0/$time*8 /1000000]» puts $f1 »$now [ expr $bw1/$time*8 /1000000]» #Reset the bytes values on the traffic sinks $sink0 set bytes 0 $sink1 set bytes 0 #Re-schedule the procedure $ns at [ expr $now+$time ] » record» } #************Defining Communication Between node0 and node2 and node1 ******* set tcp0 [ new Agent/TCP] set tcp1 [ new Agent/TCP] 130 132 set sink0 [ new Agent/TCPSink ] set sink1 [ new Agent/TCPSink ] 135 $ns attach-agent $node (0) $tcp0 $ns attach-agent $node (1) $sink0 $ns attach-agent $node (2) $tcp1 $ns attach-agent $node (1) $sink1 140 $ns connect $tcp0 $sink0 $ns connect $tcp1 $sink1 143 set ftp0 [ new Application /FTP] $ftp0 attach-agent $tcp0 $ftp0 set packetSize 2000 set ftp1 [ new Application /FTP] $ftp1 attach-agent $tcp1 $ftp0 set packetSize 2000 152 153 105 106 108 109 110 111 112 113 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 133 134 136 137 138 139 141 142 144 145 146 147 148 149 150 151 4 5 Annexe 154 #Start logging the received bandwidth Noeuds cachées asymétriques 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 $ns at 0 .0 » record» $ns at 1 .0 » $ftp0 start» $ns at 1 .0 » $ftp1 start» #Stop the traffic sources $ns at 10 .0 » $ftp0 stop» $ns at 10 .0 » $ftp1 stop» #Call the finish procedure after 11 seconds simulation time $ns at 11 .0 » finish» # Tell nodes when the simulation ends # for { set i 0} { $i < $val (nn) } { incr i } { $ns at 10 .0 »$node ( $i ) reset»; } proc stop {} { global ns namfile $ns flush-trace close $namfile } puts » Starting Simulation...» $ns run set ns [ new Simulator] set val(chan) Channel/WirelessChannel ;#Channel Type set val ( prop) Propagation/FreeSpace ;# radio-propagation model set val( n e t i f ) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802 11 ;# MAC type set val ( i f q ) Queue/DropTail/PriQueue ;# interface queue type set val( l l ) LL ;# link layer type set val ( ant ) Antenna/OmniAntenna ;# antenna model set val ( i f q l e n ) 50 ;# max packet in i f q set val (nn) 4 ;# number of mobilenodes set val ( rp ) DSDV ;# routing protocol set val(x) 700 set val(y) 500 Phy/WirelessPhy set CSThresh 30.5e-10 6 Annexe
7 Annexe
8 116
9 Annexe $cbr1 attach-agent $tcp1 $cbr1 set packetSize 250 $cbr1 set rate 6 Mb $cbr1 set interval 0 .005 #Start logging the received bandwidth $ns at 0 .0 » record» $ns at 0 .0 »$cbr0 start» $ns at 0 .5 »$cbr1 start» #Stop the traffic sources $ns at 10 .0 »$cbr0 stop» $ns at 10 .0 »$cbr1 stop» #Call the finish procedure after 60 seconds simulation time $ns at 11 .0 » finish» # Tell nodes when the simulation ends # for { set i 0} { $i < $val (nn) } { incr i } { $ns at 10 .0 »$node ( $i ) reset»; } proc stop {} { global ns namfile $ns flush-trace close $namfile } puts » Starting Simulation...» $ns run Noeud exposé 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 1 2 3 4 5 6 7 8 9 10 11 12 set ns [ new Simulator] set val(chan) Channel/WirelessChannel ;#Channel Type set val(prop) Propagation/FreeSpace ;# radio-propagation model set val ( n e t i f ) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802 11 ;# MAC type set val ( i f q ) Queue/DropTail/PriQueue ;# interface queue type set val ( l l ) LL ;# link layer type set val ( ant ) Antenna/OmniAntenna ;# antenna model set val ( i f q l e n ) 50 ;# max packet in i f q set val (nn) 4 ;# number of mobilenodes 10 Annexe set val(rp) DSDV ;# routing protocol #set val(rp) DSR ;# routing protocol #set val(rp) AODV ;# routing protocol set val(x) 800 set val(y) 500 Phy/WirelessPhy set CSThresh 30.5e-10
set topo [new Topography] $topo load flatgrid $val (x) $val (y) set namfile [open sample33.nam w] #Tracing all the events and cofiguration $ns namtrace-all-wireless $namfile $val (x) $val (y) #Trace File creation set tracefile [open sample33.tr w] #Open the output files set f0 [open node 1.tr w] set f1 [open node 2.tr w] #Tracing all the events and cofiguration $ns trace-all $ t r a c e f i l e
create-god $val (nn)
$ns node-config -adhocRouting $val ( rp ) \
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 11 Annexe # Node Creation for { set i 0} { $i < 4} { incr i } { set node ( $i ) [ $ns node] $node ( $i ) color black } #Location fixing for a single node $node (0) set X 100 .0 $node (0) set Y 300 .0 $node (0) set Z 0 .0 $node (1) set X 300 .0 $node (1) set Y 300 .0 $node (1) set Z 0 .0 $node (2) set X 500 .0 $node (2) set Y 300 .0 $node (2) set Z 0 .0 $node (3) set X 700 .0 $node (3) set Y 300 .0 $node (3) set Z 0 .0 # Label and coloring for { set i 0} { $i < 4} { incr i } { $ns at 0 .1 »$node ( $i ) color blue» $ns at 0 .1 »$node ( $i ) label Node$i» } #Size of the node for { set i 0} { $i < 4} { incr i } { $ns initial node pos $node ( $i ) 30 } #Define a ' finish ' procedure proc finish {} { global f0 f1 #Close the output files 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
12 13 Annexe set cbr0 [ new Application / Traffic /CBR] $cbr0 attach-agent $tcp0 $cbr0 set packetSize 250 $cbr0 set rate 6 Mb $cbr0 set interval 0 .005 set cbr1 [ new Application / Traffic /CBR] $cbr1 attach-agent $tcp1 $cbr1 set packetSize 250 $cbr1 set rate 6 Mb $cbr1 set interval 0 .005 #Start logging the received bandwidth $ns at 0 .0 » record» $ns at 0 .0 »$cbr0 start» $ns at 0 .5 »$cbr1 start» #Stop the traffic sources $ns at 10 .0 »$cbr0 stop» $ns at 10 .0 »$cbr1 stop» #Call the finish procedure after 60 seconds simulation time $ns at 11 .0 » finish» # Tell nodes when the simulation ends # for { set i 0} { $i < $val (nn) } { incr i } { $ns at 10 .0 »$node ( $i ) reset»; } #$ns at 10 .0 »stop» #$ns at 10 .01 »puts \»NS EXITING...\» ; $ns halt» proc stop {} { global ns namfile $ns flush-trace close $namfile } puts » Starting Simulation...» $ns run Les trois paires 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 1 2 3 set ns [ new Simulator] #Fixing the co-ordinate of simulation area 14 Annexe
|
|