Hi!
Why the node are overlapped although I defined their co-ordinates.
Also how the relay nodes be configured so that they play active role during 
communication, here what I am seeing that the source starts communication with 
the sink directly without interfering with the relay node even you drag the two 
to large distance... why?
I am seeking some useful help from yours side.
Thanks
--code---
# Generated by Topology Generator for Network Simulator (c) Elmurod Talipov
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type
set val(mac) Mac/802_15_4 ;# 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) 100 ;# max packet in ifq
set val(nn) 4;# number of mobilenodes1000 ; # X dimension of topography500 ;# Y 
dimension of topography#set val(energymodel) EnergyModel ;# Energy Model#
set ns [new Simulator]
$ns color 1 Blue
set tracefd [open atif1.tr w]
set namtrace [open atif1.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
 
 set val(initialenergy) 100 ;# value#Phy/WirelessPhy set CSThresh_ 3.44283e-09#
 
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
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) \
-channel [new $val(chan)] \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON 
#-IncomingErrProc MultistateErrorProc \
#-OutgoingErrProc MultistateErrorProc
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
 
for {set i 0} {$i < $val(nn) } { incr i } {
$mnode_($i) set X_ [ expr {20 + $i * 10} ] 
$mnode_($i) set Y_ 20.0 
$mnode_($i) set Z_ 0.0 
}
 
 
$mnode_(
$mnode_(0) label "Source"
for {set i 1} {$i <
$mnode_($i) label "relay"
}
# Set a TCP connection between node_(0) and node_(1) 
set tcp0 [new Agent/TCP/Newreno] 
$ns attach-agent $mnode_(0) $tcp0 
set sink0 [new Agent/TCPSink] 
$ns attach-agent $mnode_(
$ns connect $tcp0 $sink0 
set ftp0 [new Application/FTP] 
$ftp0 attach-agent $tcp0 
$ns at 0.
$ns at 10.0 "$ftp0 stop"
$tcp0 set fid_ 1 
 
 
# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# ending nam and the simulation
$ns at $val(stop) "stop"
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam atif1.nam & 
exit 0 
}
$ns run
 
 Phy/WirelessPhy set RXThresh_ 1.74293e-08#-energyModel $val(energymodel) 
\#-initialEnergy $val(initialenergy) \#-rxPower 35.28e-3 \#-txPower 31.32e-3 
\#-idlePower 712e-6 \#-sleepPower 144e-9 3) label "Sink"3} {incr i} {3) $sink0 
1"$ftp0 start" 
set val(rp) AODV ;# protocol tye
set val(x) 
set val(y) 
set val(stop) 10 ;# simulation period 


      

Reply via email to