Hi,

I have problem when I run a Evan Jones program. I had change a node connection 
to 3 nodes and a nodes 0 and 1 connect to node 2 but when running just node 1 
is connecting to node 2.

it is very urgent.

Thanks

# ======================================================================
# Define options
# ======================================================================
set val(chan)         Channel/WirelessChannel  ;# channel type
set val(prop)         Propagation/TwoRayGround ;# radio-propagation model
set val(ant)          Antenna/OmniAntenna      ;# Antenna type
set val(ll)           LL                       ;# Link layer type
set val(ifq)          Queue/DropTail/PriQueue  ;# Interface queue type
set val(ifqlen)       50                       ;# max packet in ifq
set val(netif)        Phy/WirelessPhy          ;# network interface type
set val(mac)          Mac/802_11               ;# MAC type
set val(rp)           DSDV                     ;# ad-hoc routing protocol  
set val(nn)           3                        ;# number of mobilenodes



# Create simulator
set ns_    [new Simulator]

# Set up trace file
$ns_ use-newtrace
set tracefd [open essai.tr w]
$ns_ trace-all $tracefd

# Create the "general operations director"
# Used internally by MAC layer: must create!
create-god $val(nn)

# Create and configure topography (used for mobile scenarios)
set topo [new Topography]
# 500x500m terrain
$topo load_flatgrid 500 500

#

#  Create the specified number of mobilenodes [$val(nn)] and "attach" them

#  to the channel. 

#  Here two nodes are created : node(0) and node(1)

 
# configure node

 
        $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 $val(chan) \

             -topoInstance $topo \

             -agentTrace ON \

             -routerTrace ON \

             -macTrace OFF \

             -movementTrace OFF             
             

    for {set i 0} {$i < $val(nn) } {incr i} {

        set node_($i) [$ns_ node]     
        $node_($i) random-motion 0        ;# disable random motion
                $node_($i) set Z_ 0.0

    }

$node_(0) set X_ 0.0

$node_(0) set Y_ 0.0

$node_(1) set X_ 50.0
$node_(1) set Y_ 50.0

$node_(2) set X_ 150.0
$node_(2) set Y_ 150.0

# 1500 - 20 byte IP header - 40 byte TCP header = 1440 bytes
Agent/TCP set packetSize_ 1440 ;# This size EXCLUDES the TCP header

set agent1 [new Agent/TCP]
set app [new Application/FTP]
set sink1 [new Agent/TCPSink]

$app attach-agent $agent1

 
$ns_ attach-agent $node_(0) $agent1
$ns_ attach-agent $node_(2) $sink1

$ns_ connect $agent1 $sink1

# 1500 - 20 byte IP header - 40 byte TCP header = 1440 bytes
Agent/TCP set packetSize_ 1440 ;# This size EXCLUDES the TCP header

set agent2 [new Agent/TCP]
set app [new Application/FTP]
set sink2 [new Agent/TCPSink]

$app attach-agent $agent2

 
$ns_ attach-agent $node_(1) $agent2
$ns_ attach-agent $node_(2) $sink2

$ns_ connect $agent2 $sink2

#30 seconds of warmup time for routing
$ns_ at 0.0 "$app start"
# 180 seconds of running the simulation time
$ns_ at 240.0 "$ns_ halt"
$ns_ run

$ns_ flush-trace
close $tracefd





      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

Reply via email to