Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Ad Hoc/Wireless Mesh Network Simulation

Status
Not open for further replies.

suhanya

Newbie level 5
Newbie level 5
Joined
Jan 8, 2008
Messages
8
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,283
Activity points
1,339
Hi,

Where i can obtain source code (preferably MATLAB or C) for modeling an ad hoc or wireless mesh network?

I'd want to monitor the performance of a wireless mesh network under different methods of beamforming. Hence, it'll be helpful to have a basic wireless mesh network model for me to improvise on.

I've googled extensively in search of a basic source code for a ad hoc or wireless mesh, which can help me get started, but failed.

Any help would be greatly appreciated.
 

Hi I need some suggestion I am doing a project on RF-ID industry disaster basically the programing has on micro-controller but i want to run this project in MATLAB it possible.
 
Last edited by a moderator:

hi freind's . i write this code's and run in nam(((---->cygwin in window 7 ))) ( code is copy here :C:\cygwin-ori\usr\local\ns-allinone-2.29\ns-2.29\aodv))
code's download from here :
=================================================================================================
Code:
set val(chan)           Channel/WirelessChannel        ;# channel type
set val(prop)           Propagation/TwoRayGround       ;# radio-propagation model
set val(netif)          Phy/WirelessPhy                ;# network interface type
set val(mac)            Mac/802_11                     ;# MAC type
set val(ifq)            Queue/DropTail/PriQueue        ;# interface queue type
set val(ll)             LL                             ;# link layer type
set val(ant)            Antenna/OmniAntenna            ;# antenna model
set val(ifqlen)         50                             ;# max packet in ifq
set val(nn)             2                              ;# number of mobilenodes
set val(rp)             AODV                           ;# routing protocol
set val(stop)           100                            ;# time of simulation end
set val(x)              500                            ;# X dimension of topography
set val(y)              400                            ;# Y dimension of topography
set ns_ [new Simulator]
set tracefd [open wireless2node1.tr w]
$ns_ trace-all $tracefd
set namtrace [open wireless2node1.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
#create-god $val(nn)
set god_ [create-god $val(nn)]
# configure the nodes
$ns_ node-config -adhocRouting $val(rp) \
		-llType $val(ll) \
		-macType $val(mac) \
		-ifqType $val(ifq) \
		-ifqLen $val(ifqlen) \
		-antType $val(ant) \
		-propType $val(prop) \
		-phyType $val(netif) \
		-channelType [new $val(chan)] \
		-topoInstance $topo \
		-agentTrace ON \
		-routerTrace ON \
		-macTrace ON \
		-movementTrace OFF

#############################
for {set i 0} {$i < $val(nn) } {incr i} {
         set node_($i) [$ns_ node]
         $ns_ initial_node_pos $node_($i) 20.0
         $node_($i) random-motion 0
}
#########################
$node_(0) set X_ 5.0
$node_(0) set Y_ 10.0
$node_(0) set Z_ 0.0
$ns_  at 0.0 "$node_(0) setdest 5.0 10.0 0.0"
$node_(1) set X_ 400.0
$node_(1) set y_ 300.0
$node_(1) set Z_ 0.0

$ns_ at 1.0 "$node_(1) setdest 24.01 20.01 15.1" 
$ns_  at 0.0 "$node_(1) setdest 400.0 300.0 0.0"
$ns_ at 2.0 "$node_(0) setdest 155.0 110.0 55.0"
$ns_ at 5.0 "$node_(1) setdest 105.0 110.0 21.0"
$ns_ at 10.0 "$node_(0) setdest 185.0 260.0 45.0"
$ns_ at 40.0 "$node_(0) setdest 105.0 140.0 33.0"
$ns_ at 45.0 "$node_(1) setdest 125.0 210.0 33.0"
$ns_ at 50.0 "$node_(0) setdest 115.0 230.0 60.0"
$ns_ at 100.0 "$node_(1) setdest 200.0 280.0 10.0"
$ns_ at 130.0 "$node_(0) setdest 250.0 380.0 22.0"
proc stop {} {	
	global ns_ tracefd namtrace
	$ns_ flush-trace
	close $tracefd
	close $namtrace
	exit 0
}
set tcp [new Agent/TCP]
$ns_ attach-agent $node_(0) $tcp
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(1) $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ connect $tcp $sink
$ns_ at 0.0.050000 "$ftp start"
$ns_ at 150.0.050000 "stop"
puts "Starting Simulation for you.."
$ns_ run
and
Code:
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 25 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 500 ;# Y dimension of topography
#####
set val(cstop) 451 ;# time of connections end
#####
set val(stop) 100.0 ;# time of simulation end
set val(t1) 0.0 ;
set val(t2) 0.0 ;
set val(cp)"scen-25-nodes"
set val(cc) "cbr"
#######===================================
####### Initialization
#######===================================
#######Create a ns simulator
set ns_ [new Simulator]
#######Setup topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_[God instance]
source $val(cp)
#######Open the NS trace file
set tracefile [open out.tr w]
$ns_ trace-all $tracefile
#######Open the NAM trace file
set namfile [open out.nam w]
$ns_ namtrace-all $namfile
$ns_ namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)];#Create wireless channel
#######=######==================================
####### Mobile node parameter setup
#######===================================
$ns_ node-config -adhocRouting $val(rp) \
		 -llType $val(ll) \
		 -macType $val(mac) \
		 -ifqType $val(ifq) \
		 -ifqLen $val(ifqlen) \
		 -antType $val(ant) \
		 -propType $val(prop) \
		 -phyType $val(netif) \
		 -channelType $chan \
		 -topoInstance $topo \
		 -agentTrace ON \
		 -routerTrace ON \
		 -macTrace ON \
		 -movementTrace ON
puts "Creating nodes..."
for {set i 0} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;#######disable random motion
}
puts "Loading random movement pattern..."
set god_ [God instance]
source $val(cp)
####### CBR Connections generated by cbrgen
source $val(cc)
####### Define initial node position
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ initial_node_pos $node_($i) 30
}
####### CBR connections stops
for {set i 0} {$i < 3 } {incr i} {
$ns_ at $val(cstop) "$cbr_($i) stop"
}
####### Tell all nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).000000001 "$node_($i) reset";
}
#######===================================
####### Termination
#######===================================
#######Define a 'finish' procedure
proc finish {} {
global ns tracefile namfile
$ns_ flush-trace
close $tracefile
close $namfile
exec nam out.nam &
exit 0
}
for {set i 0} {$i < $val(nn) } { incr i } {
$ns_ at $val(stop) "\$node_($i) reset"
}
$ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)"
$ns_ at $val(stop) "finish"
$ns_ at $val(stop) "puts \"done\" ; $ns_ halt"
$ns_ run
and code hsoft_project.tcl fronm this forum

but all of code's display one error :((why and how solution :)))
$ ns wireless4_1node.tcl
invalid command name "i>>?set"
while executing
"i>>?set val(prop) propagation/TwoRayGround "
(file "wireless4_1node.tcl" line1)

please help me for solution error .!!!!!!
thx
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top