WOW !! MUCH LOVE ! SO WORLD PEACE !
Fond bitcoin pour l'amélioration du site: 1memzGeKS7CB3ECNkzSn2qHwxU6NZoJ8o
  Dogecoin (tips/pourboires): DCLoo9Dd4qECqpMLurdgGnaoqbftj16Nvp


Home | Publier un mémoire | Une page au hasard

 > 

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
  

précédent sommaire suivant

Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy

Annexe

53 $ns node-config -adhocRouting $val ( rp ) \

54 -llType $val ( l l ) \

55 -macType $val (mac) \

56 -ifqType $val ( i f q ) \

57 -ifqLen $val ( i f q l e n ) \

58 -antType $val ( ant ) \

59 -propType $val ( prop ) \

60 -phyType $val ( n e t i f ) \

61 -channelType $val ( chan ) \

62 -topoInstance $topo \

63 -agentTrace ON \

64 -routerTrace ON \

65 -macTrace OFF \

66 -movementTrace ON

67

68 # Node Creation

69

70

for { set i 0} { $i < 6} { incr i } {

71

72

73

74

75

76

set node ( $i ) [ $ns node]

$node ( $i ) color black

}

77 #Location fixing for a single node

78

79

80

81

$node (0) set X 200 .0

$node (0) set Y 400 .0

$node (0) set Z 0 .0

82

83

84

85

$node (1) set X 500 .0

$node (1) set Y 400 .0

$node (1) set Z 0 .0

86

87

88

89

$node (2) set X 800 .0

$node (2) set Y 400 .0

$node (2) set Z 0 .0

90

91

92

93

$node (3) set X 200 .0

$node (3) set Y 200 .0

$node (3) set Z 0 .0

94

95

96

97

$node (4) set X 500 .0

$node (4) set Y 200 .0

$node (4) set Z 0 .0

98

99

100

101

15

$node (5) set X 800 .0

$node (5) set Y 200 .0

$node (5) set Z 0 .0

16

Annexe

102

103

104

105

 

# Label and coloring

 

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

 

for { set i 0} { $i < 6} { 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 < 6} { incr i } { $ns initial node pos $node ( $i ) 30 }

#Define a ' finish ' procedure proc finish {} { global f0 f1 f2

 

124 #Close the output files

 

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

 

close $f0

close $f1

close $f2

#Call xgraph to display the results

exec xgraph node 0.tr node 1.tr node 2.tr -geometry 800x400 &

exit 0

}

proc record {} {

global sink0 sink1 sink2 f0 f1 f2 #Get an instance of the simulator set ns [ Simulator instance]

 

140 #Set the time after which the procedure should be called again

 

141

142

143

144

145

146

147

148

149

150

 

set time 0 .1

#How many bytes have been received by the traffic sinks?

set bw0 [ $sink0 set bytes ]

set bw1 [ $sink1 set bytes ]

set bw2 [ $sink2 set bytes ]

#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]»

 
 
 
 
 
 
 
 
 

151

152

153

154

155

156

Annexe

 
 
 
 
 
 
 

puts $f2 »$now [ expr $bw2/$time*8 /1000000]»

#Reset the bytes values on the traffic sinks

$sink0 set bytes 0

$sink1 set bytes 0

$sink2 set bytes 0

#Re-schedule the procedure

 
 
 

157

$ns at [ expr $now+$time ] » record»

 
 
 

158

}

 
 
 

159

 
 
 
 

160

#*******Defining Communication Between node0 and

all

nodes

*******

161

 
 
 
 

162

 
 
 
 

163

set tcp0 [ new Agent/TCP]

 
 
 

164

set tcp1 [ new Agent/TCP]

 
 
 

165

set tcp2 [ new Agent/TCP]

 
 
 

166

 
 
 
 

167

$tcp0 set class 2

 
 
 

168

 
 
 
 

169

set sink0 [ new Agent/TCPSink ]

 
 
 

170

set sink1 [ new Agent/TCPSink ]

 
 
 

171

set sink2 [ new Agent/TCPSink ]

 
 
 

172

 
 
 
 

173

$ns attach-agent $node (0) $tcp0

 
 
 

174

$ns attach-agent $node (3) $sink0

 
 
 

175

$ns attach-agent $node (1) $tcp1

 
 
 

176

$ns attach-agent $node (4) $sink1

 
 
 

177

$ns attach-agent $node (2) $tcp2

 
 
 

178

$ns attach-agent $node (5) $sink2

 
 
 

179

 
 
 
 

180

$ns connect $tcp0 $sink0

 
 
 

181

$ns connect $tcp1 $sink1

 
 
 

182

$ns connect $tcp2 $sink2

 
 
 

183

 
 
 
 

184

set cbr0 [ new Application/ Traffic /CBR]

 
 
 

185

$cbr0 attach-agent $tcp0

 
 
 

186

$cbr0 set packetSize 1500

 
 
 

187

$cbr0 set rate 6 Mb

 
 
 

188

$cbr0 set interval 0 .0001

 
 
 

189

 
 
 
 

190

set cbr1 [ new Application / Traffic /CBR]

 
 
 

191

$cbr1 attach-agent $tcp1

 
 
 

192

$cbr1 set packetSize 1500

 
 
 

193

$cbr1 set rate 6 Mb

 
 
 

194

$cbr1 set interval 0 .0001

 
 
 

195

 
 
 
 

196

set cbr2 [ new Application/ Traffic /CBR]

 
 
 

197

$cbr2 attach-agent $tcp2

 
 
 

198

$cbr2 set packetSize 1500

 
 
 

199

$cbr2 set rate 6 Mb

 
 
 

17

Annexe

200

201

202

203

204

205

206

207

208

209

221

222

223

224

225

226

227

228

229

230

231

$cbr2 set interval 0 .0001

#Start logging the received bandwidth $ns at 0 .0 » record»

$ns at 1 .0 »$cbr0 start» $ns at 1 .5 »$cbr1 start» $ns at 1 .0 »$cbr2 start»

210

211

212

213

214

#Stop the traffic sources $ns at 10 .0 »$cbr0 stop» $ns at 10 .0 »$cbr1 stop» $ns at 10 .0 »$cbr2 stop»

215

216

217

#Call the finish procedure after 60 seconds simulation time $ns at 11 .0 » finish»

218

219 # Tell nodes when the simulation ends

220 #

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

18

précédent sommaire suivant






Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy








"Nous voulons explorer la bonté contrée énorme où tout se tait"   Appolinaire