the code is shown below...........



puts "***************************** *******"
puts "The Program Shows the Operation "
puts "The Specfications of the Program are
      X-Maximum->200 & Y-Maximum->200(Grid Size)
      Number of Nodes are:50
      Pause Time : 2s
      Max speed :10m/s
      Simulation Time:100s
      Packet Size : 1024 bytes
      Transfer Rate : 4 pkts/s
      Output Trace File:project1.tr
      Output Nam File:project1.nam"

# ======================================================================
# 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)         50                         ;# max packet in ifq
set val(nn)             50                          ;# number of mobilenodes

set val(rp)             TORA                      ;# routing protocol

# ======================================================================

set AgentTrace            ON
set RouterTrace            ON
set MacTrace            OFF

LL set mindelay_        50us
LL set delay_            25us
LL set bandwidth_        0    ;# not used

Agent/Null set sport_        0
Agent/Null set dport_        0

Agent/CBR set sport_        0
Agent/CBR set dport_        0

Agent/TCPSink set sport_    0
Agent/TCPSink set dport_    0

Agent/TCP set sport_        0
Agent/TCP set dport_        0
Agent/TCP set packetSize_    1460

Queue/DropTail/PriQueue set Prefer_Routing_Protocols    1

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 9.8214e-09
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.036
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0

# =====================================================================

# ======================================================================
# Main Program
# ======================================================================


#
# Initialize Global Variables
#
set ns_        [new Simulator]
set tracefd     [open project1.tr w]
$ns_ trace-all $tracefd
set namfd     [open project1.nam w]
$ns_ namtrace-all-wireless $namfd 200 200

# set up topography object
set topo       [new Topography]

$topo load_flatgrid 200 200

#
# Create God
#
set god_ [create-god $val(nn)]
#
#Create Channel
#
set chan_1_ [new $val(chan)]

#
#  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 ON \
             -movementTrace ON \
             -channel $chan_1_\
             -energyModel EnergyModel \
             -initialEnergy 1.5 \
             -txPower 0.036 \
             -rxPower 0.009

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

source scen-50-2-10-100-200-200

set udp [new Agent/UDP]
set sink [new Agent/Null]
$ns_ attach-agent $node_(0) $udp
$ns_ attach-agent $node_(18) $sink
$ns_ connect $udp $sink
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set packetSize_ 1024
$cbr set rate_ 0.032768Mb
$cbr set random_ false
$ns_ at 1.0 "$cbr start"

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


    # 20 defines the node size in nam, must adjust it according to your
scenario
    # The function must be called after mobility model is defined


    $ns_ initial_node_pos $node_($i) 10
}


#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at 100.0 "$node_($i) reset";
}

$ns_ at 99.5 "$cbr stop"
$ns_ at 100.0 "stop"
$ns_ at 100.001 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
    global ns_ tracefd namfd
    $ns_ flush-trace
    close $tracefd
    close $namfd
}

puts "Starting Simulation..."
$ns_ run


when i run the above tcl with sceario file as scen-50-2-10-100-200-200
it list me the following error as
The Program Shows the  Operation
The Specfications of the Program are
      X-Maximum->200 & Y-Maximum->200(Grid Size)
      Number of Nodes are:50
      Pause Time : 2s
      Max speed :10m/s
      Simulation Time:100s
      Packet Size : 1024 bytes
      Transfer Rate : 4 pkts/s
      Output Trace File:project1.tr
      Output Nam File:project1.nam
num_nodes is set 50
INITIALIZE THE LIST xListHead

    (_o17 cmd line 1)
    invoked from within
"_o17 cmd port-dmux _o32"
    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 "_o17" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$agent port-dmux $dmux_"
    (procedure "_o14" line 11)
    (Node/MobileNode add-target-rtagent line 11)
    invoked from within
"$self add-target-rtagent $agent $port"
    (procedure "_o14" line 23)
    (Node/MobileNode add-target line 23)
    invoked from within
"$self add-target $agent $port"
    (procedure "_o14" line 15)
    (Node attach line 15)
    invoked from within
"$node attach $ragent [Node set rtagent_port_]"
    (procedure "_o3" line 72)
    (Simulator create-wireless-node line 72)
    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 "project1.tcl" line 128)


-- 
Regards,
dhayanithi.

Reply via email to