在NAM的模拟和分组差异的大小期间,模拟时间不相同

时间:2015-02-28 04:22:36

标签: networking adhoc ns2

我有TCL文件,并且每次修改代码的某些部分面对不同的模拟时间在NAM运行,我需要它是1000秒,但模拟似乎不到这个时间,我应该怎么做?如果我选择128的数据包大小更好或不?如果我有更大的数据包大小有什么区别?

# Define options

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)     150             ;# max packet in ifq

set val(nn)         150             ;# total number of nodes

set val(att)        10

set flows       4           ;# No.of Flows  

set val(speed)          9

set val(nn2)    [expr $val(nn) - $val(att)] 

set val(rp)         DSR         ;# routing protocol

set val(x)      800         ;# X dimension of topography

set val(y)      800         ;# Y dimension of topography

set val(cstop)      451             ;# time of connections end

set val(stop)       50          ;# time of simulation end

set val(engmodel)       EnergyModel            ;# Energy type model

set val(initeng)        8.5                ;# Initial energy in Joules

set val(txPower)        0.660;             ;# Initial transmit power

set val(rxPower)        0.395;             ;# Initial receive power

set val(idlePower)      0.035;             ;# Initial idle power

set val(cp)         "../scen/scen-750x750-N150-S$val(speed)"

set val(cc)         "../scen/CBR-$flows-expo"

set psize       512

set rate        50


# Initialize Global Variables

set ns_ [new Simulator]

#$ns_ use-newtrace

set tracefd [open out.tr w]

$ns_ trace-all $tracefd

set namtrace [open out.nam w]

$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)


# configure node, please note the change below.

$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 \

    #-energyModel $val(engmodel) \

    #-initialEnergy $val(initeng) \

        #-txPower $val(txPower) \

        #-rxPower $val(rxPower) \

    #-idlePower $val(idlePower) \

    -agentTrace ON \

    -routerTrace ON \

    -macTrace OFF \

    -movementTrace ON \

    -channel $chan_1_



puts "Loading random connection pattern..."

set god_ [God instance]

source $val(cp)

source $val(cc)




# Tell all nodes when the simulation ends

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

    $ns_ at $val(stop).000000001 "$node_($i) reset";

}



# Ending nam and simulation

$ns_ at $val(stop) "finish"

$ns_ at $val(stop).0 "$ns_ trace-annotate \"Simulation has ended\""

$ns_ at $val(stop).00000001 "puts \"NS EXITING...\" ; $ns_ halt"



proc finish {} {

    global ns_ tracefd namtrace

    $ns_ flush-trace

    close $tracefd

    close $namtrace

    # exec nam out.nam &

    exec ./find1.bin

    exit 0

}

puts "Starting Simulation..."

$ns_ run

1 个答案:

答案 0 :(得分:0)

»»我需要1000秒......««

您在帖子中显示的文件已停止= 50。

并且“停止”是最长时间。

当模拟具有例如文件中“工作”5秒钟:

无论你设定多长时间,都会在5秒后停止。

..............

设置val(停止)50; #stop是停止模拟的时间,如果它仍在运行。

..............