Wireless Mesh Network (WMN) has its potential in many practical applications such as battlefield surveillance, file sharing and so on. WMN consists of mesh routers, mesh clients, and gateway. In file mesh_network.tcl, mesh routers and gateway are static nodes and mesh clients are mobile devices.
#Filename: mesh_network.tcl
proc MeshRouters {} {
if { $a < [expr $rc + 1] } {
for {set i $f} {$i < $a } { incr i } {
set xx($i) [expr $xx([expr $i – 1]) + 150]
set yy($i) $yy([expr $i – 1])
$node_($i) set X_ $xx($i)
$node_($i) set Y_ $yy($i)
}
set f [expr $a + 1]
set a [expr $f + [expr $column -1]]
}
}
proc MeshClients {} {
for {set i $rc } {$i < $val(nn) } { incr i } {
set xx($i) [expr rand()*$val(x)]
set yy($i) [expr [expr rand()*300] + 200]
$ns at $tm "$node_($i) setdest $xx($i) $yy($i) 500"
}
}