hello I m trying to run a simple wired cum wireless problem. but its giving segmenation error ---- can anyone suggest how can i get rid of that error ? I m sending my code. set ns [new Simulator] set num_wired_nodes 2 set num_mobile_nodes 1 set num_bs_nodes 1 ;# number of base stations set num_nodes [expr $num_wired_nodes + $num_mobile_nodes + $num_bs_nodes] set bs_id $num_wired_nodes # Parameter for wireless nodes set opt(chan) Channel/WirelessChannel ;# channel type set opt(prop) Propagation/TwoRayGround ;# radio-propagation model set opt(netif) Phy/WirelessPhy ;# network interface type set opt(mac) Mac/802_11 ;# MAC type set opt(ifq) Queue/DropTail/PriQueue set opt(ifqlen) 50 set opt(ll) LL ;# link layer type set opt(ant) Antenna/OmniAntenna ;# antenna model set opt(adhocRouting) DSDV ;# routing protocol set opt(x) 500 ;# X dimension of the topography set opt(y) 500 ;# Y dimension of the topography Mac/802_11 set SlotTime_ 0.000020 ;# 20us Mac/802_11 set SIFS_ 0.000010 ;# 10us Mac/802_11 set PreambleLength_ 144 ;# 144 bit Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits Mac/802_11 set PLCPDataRate_ 1.0e6 ;# 1Mbps Mac/802_11 set dataRate_ 11.0e6 ;# 11Mbps Mac/802_11 set basicRate_ 1.0e6 ;# 1Mbps Mac/802_11 set RTSThreshold_ 3000 Mac/802_11 set ShortRetryLimit_ 7 ;# retransmittions Mac/802_11 set LongRetryLimit_ 4 ;# retransmissions #set up for hierarchical routing #(needed for routing over a basestation) $ns node-config -addressType hierarchical AddrParams set domain_num_ 2 ;# domain number lappend cluster_num 1 1 ;# cluster number for each domain AddrParams set cluster_num_ $cluster_num lappend eilastlevel $num_wired_nodes [expr $num_mobile_nodes + $num_bs_nodes] ;# number of nodes for each cluster AddrParams set nodes_num_ $eilastlevel set ntr [open out.tr w] $ns trace-all $ntr set chan [new $opt(chan)] set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) # Create God create-god [expr $num_mobile_nodes + $num_bs_nodes] # create wired nodes set temp {0.0.0 0.1.0} ;# hierarchical addresses to be used for {set i 0} {$i < $num_wired_nodes} {incr i} { set W($i) [$ns node [lindex $temp $i]] } # creating base station $ns node-config -adhocRouting $opt(adhocRouting) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channel $chan \ -topoInstance $topo \ -wiredRouting ON \ -agentTrace OFF \ -routerTrace OFF \ -macTrace OFF \ -movementTrace OFF set BS(0) [$ns node 1.0.0] $BS(0) random-motion 0 puts "Base-Station node $bs_id created" #provide some co-ord (fixed) to base station node $BS(0) set X_ 250.0 $BS(0) set Y_ 250.0 $BS(0) set Z_ 0.0 set rng [new RNG] $rng seed 1 set rand1 [new RandomVariable/Uniform] $rand1 use-rng $rng $rand1 set min_ -50.0 $rand1 set max_ 50.0 # creating mobile nodes $ns node-config -wiredRouting ON for {set i 0} {$i < $num_mobile_nodes} {incr i} { set wl_node_($i) [$ns node 1.0.[expr $i + 1]] $wl_node_($i) random-motion 0 ;# disable random motion puts "wireless node $i created ..." $wl_node_($i) base-station [AddrParams addr2id [$BS(0) node-addr]] set x [expr 250+[$rand1 value]] set y [expr 250+[$rand1 value]] $wl_node_($i) set X_ $x $wl_node_($i) set Y_ $y $wl_node_($i) set Z_ 0.0 puts "X_:$x Y_:$y" } # linking of wired node to base-station node $ns duplex-link $W(0) $W(1) 100Mb 10ms DropTail $ns duplex-link $W(1) $BS(0) 100Mb 20ms DropTail #$ns duplex-link-op $W(0) $W(1) orient down #$ns duplex-link-op $W(1) $BS(0) orient left-down $ns duplex-link $W(1) $BS(0) 100Mb 1ms DropTail #set tcp1 [new Agent/TCP/Reno] #$ns attach-agent $W(1) $tcp1 #set tcpsink1 [new Agent/TCPSink/] #$tcpsink1 set_filename tcp_sink #$ns attach-agent $wl_node_(0) $tcpsink1 #$ns connect $tcp1 $tcpsink1 #set ftp1 [$tcp1 attach-source FTP] # Set a TCP connection between node_(0) and node_(1) set tcp [new Agent/TCP/Newreno] $tcp set class_ 2 set sink [new Agent/TCPSink] $ns attach-agent $W(1) $tcp $ns attach-agent $wl_node_(0) $sink $ns connect $tcp $sink set ftp1 [new Application/FTP] $ftp1 attach-agent $tcp #$ns at 10.0 "$ftp start" proc stop {} { global ns ntr $ns flush-trace close $ntr } $ns at 0.0 "$ftp1 start" $ns at 45.0 "$ftp1 stop" #$ns at 50.0 "$tcpsink1 closefile" $ns at 50.1 "stop" $ns at 50.2 "puts \"NS EXITING...\" ; $ns halt" $ns run
--------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.