2016-02-17 2 views
2

Je suis nouveau à ns2 et j'utilise AquaSim qui est un simulateur basé sur ns2. J'essaye de faire un réseau sans fil sous-marin simple. Le code suivant fonctionne bien lorsque "Propagation" et "Phy" sont réglés respectivement sur "TwoRayGround" et "WirelessPhy" mais quand je les change en "UnderwaterPropagation" et "UnderwaterPhy", il donne une erreur (attachée après le code). Merci de conseiller des moyens pour faire face à cela. CordialementComment puis-je résoudre une erreur lors de la création d'un réseau de capteurs sous-marins simple dans AquaSim (ns2)?

set val(chan)   Channel/UnderwaterChannel; 
set val(prop)   Propagation/UnderwaterPropagation; 
set val(netif)   Phy/WirelessPhy; 
set val(mac)   Mac/802_11; 
set val(ifq)   Queue/DropTail/PriQueue; 
set val(ll)    LL; 
set val(ant)   Antenna/OmniAntenna; 
set val(ifqlen)   50; 
set val(nn)    2; 
set val(rp)    DSDV; 

set ns_  [new Simulator] 

set tracefd  [open simple.tr w] 
$ns_ trace-all $tracefd 

# set up topography object 
set topo  [new Topography] 
$topo load_flatgrid 500 500 

create-god $val(nn) 

# =============================================== 
# Create channel #1 
# =============================================== 
set chan_1_ [new $val(chan)] 

# 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) \ 
      -topoInstance $topo \ 
      -agentTrace ON \ 
      -routerTrace ON \ 
      -macTrace ON \ 
      -channel $chan_1_\ 
      -movementTrace OFF   


    for {set i 0} {$i < $val(nn) } {incr i} { 
     set node_($i) [$ns_ node] 
     $node_($i) random-motion 0  ; 
    } 


$node_(0) set X_ 5.0 
$node_(0) set Y_ 2.0 
$node_(0) set Z_ 0.0 
$node_(1) set X_ 390.0 
$node_(1) set Y_ 385.0 
$node_(1) set Z_ 0.0 

$ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0" 
$ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0" 

$ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0" 

set tcp [new Agent/TCP] 
$tcp set class_ 2 
set sink [new Agent/TCPSink] 
$ns_ attach-agent $node_(0) $tcp 
$ns_ attach-agent $node_(1) $sink 
$ns_ connect $tcp $sink 

set ftp [new Application/FTP] 
$ftp attach-agent $tcp 
$ns_ at 10.0 "$ftp start" 

for {set i 0} {$i < $val(nn) } {incr i} { 
    $ns_ at 150.0 "$node_($i) reset"; 
} 
$ns_ at 150.0 "stop" 
$ns_ at 150.01 "puts \"NS EXITING...\" ; $ns_ halt" 
proc stop {} { 
    global ns_ tracefd 
    $ns_ flush-trace 
    close $tracefd 
} 

puts "Starting Simulation..." 
$ns_ run 

Le message d'erreur:

num_nodes is set 2 

    (_o20 cmd line 1) 
    invoked from within 
"_o20 cmd node_on _o15" 
    invoked from within 
"catch "$self cmd $args" ret" 
    invoked from within 
"if [catch "$self cmd $args" ret] { 
set cls [$self info class] 
global errorInfo 
set savedInfo $errorInfo 
error "error when calling class $cls: $args" $..." 
    (procedure "_o20" line 2) 
    (SplitObject unknown line 2) 
    invoked from within 
"$mac node_on $self" 
    (procedure "_o15" line 95) 
    (Node/MobileNode/UnderwaterSensorNode add-interface line 95) 
    invoked from within 
"$node add-interface $chan $propInstance_ $llType_ $macType_ $ifqType_ $ifqlen_ $phyType_ $antType_ $topoInstance_ $inerrProc_ $outerrProc_ $FECProc_" 
    (procedure "_o3" line 96) 
    (Simulator create-wireless-node line 96) 
    invoked from within 
"_o3 create-wireless-node" 
    ("eval" body line 1) 
    invoked from within 
"eval $self create-wireless-node $args" 
    (procedure "_o3" line 23) 
    (Simulator node line 23) 
    invoked from within 
"$ns_ node" 
    ("for" body line 2) 
    invoked from within 
"for {set i 0} {$i < $val(nn) } {incr i} { 
       set node_($i) [$ns_ node] 
       $node_($i) random-motion 0    ;# disable random motion 
     }" 
    (file "simw.tcl" line 107) 

Répondre