Hi,

               I am trying to make a simulation with
satellite+wired+wireless nodes in the scenario using hierarchical
addresses. it gives me following error:
******************************************************************************************************************************************

ERROR:
coscns2@ubuntu:~/ns-allinone-2.33/ns-2.33/tcl/ex$ ns MixedSat2.tcl
num_nodes is set 4
Stub No. 1
Error!!
str2addr:Address 1784827763 outside range of address field length 2048

IS IT A WAY TO AVOID USING HIERARCHICAL ADDRESSING?
******************************
here is my code
*****************************

# Satellite model (Baseline)

global ns
set ns [new Simulator]

$ns node-config -addressType hierarchical
AddrParams set domain_num_ 3           ;# number of domains
lappend cluster_num 4 1 1                ;# number of clusters in each
domain

AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 11 1 1 2 4     ;# number of nodes in each cluster
AddrParams set nodes_num_ $eilastlevel ;# for each domain

#========================== OPTIONS FOR SATELLITE NETWORK ==============

HandoffManager/Term set elevation_mask_ 8.2
HandoffManager/Term set term_handoff_int_ 10
HandoffManager set handoff_randomization_ false

global opt_sat
set opt_sat(chan)           Channel/Sat
set opt_sat(bw_down)    1.5Mb; # Downlink bandwidth
set opt_sat(bw_up)    1.5Mb; # Uplink bandwidth
set opt_sat(bw_isl)    25Mb
set opt_sat(phy)            Phy/Sat
set opt_sat(mac)            Mac/Sat
set opt_sat(ifq)            Queue/DropTail
set opt_sat(qlim)    50
set opt_sat(ll)             LL/Sat
set opt_sat(wiredRouting)   ON
set opt_sat(alt)    780; # Polar satellite altitude
set opt_sat(inc)    90; # Orbit inclination

#=================================== OPTIONS FOR MANET
 NETWORK=====================

global opt_manet
set opt_manet(chan)           Channel/WirelessChannel    ;# channel type
set opt_manet(prop)           Propagation/TwoRayGround   ;#
radio-propagation model
set opt_manet(netif)          Phy/WirelessPhy            ;# network
interface type
set opt_manet(mac)            Mac/802_11                 ;# MAC type
set opt_manet(ifq)            Queue/DropTail/PriQueue    ;# interface queue
type
set opt_manet(ll)             LL                         ;# link layer type
set opt_manet(ant)            Antenna/OmniAntenna        ;# antenna model
set opt_manet(ifqlen)         50                         ;# max packet in
ifq
set opt_manet(nn)             3                          ;# number of
mobilenodes
set opt_manet(adhocRouting)   DSDV                       ;# routing
protocol
set opt_manet(tr)      test-mobile-satellite.tr
set opt_manet(namtr)      test-mobile-satellite.nam
set opt_manet(stop)      250
set num_wired_nodes      2
set num_bs_nodes         1
set net_distance 10000.0
set opt(cp)             ""                         ;# connection pattern
file
#set opt(sc)     "../mobility/scene/scen-3-test"    ;# node movement file.

set opt_mobile(x) [expr $opt_manet(nn) * 100.0 * 2 + 100.0 + $net_distance]
 ;# x coordinate of topology
set opt_mobile(y) 1000 ;# y coordinate of topology

#set opt(seed)   0.0                            ;# seed for random number
gen.
#set opt(stop)   250                            ;# time to stop simulation

# create topology of the wireless nodes to keep connectivity info
  set topo   [new Topography]
  $topo load_flatgrid $opt_mobile(x) $opt_mobile(y)
  # god needs to know the number of all wireless interfaces
  create-god [expr $opt_manet(nn) + $num_bs_nodes]

#============================== TRACE FILES
====================================

set tracefd  [open $opt_manet(tr) w]
$ns trace-all $tracefd
$ns trace-all-satlinks $tracefd
set namtracefd [open $opt_manet(namtr) w]
$ns namtrace-all $namtracefd

set outfile [open out.tr w]
set f0 [open out0.tr w]
set f1 [open out1.tr w]
set f2 [open out2.tr w]


$ns trace-all $outfile

#============================== GEO SATELLITE NODE CONFIGURATION
=================

#geo-repeater uses type Phy/Repeater
  $ns node-config -satNodeType geo-repeater -phyType Phy/Repeater
-channelType $opt_sat(chan)-          -downlinkBW
$opt_sat(bw_down)-wiredRouting ON

# GEO satellite at 95 degrees longitude West
puts "Stub No. 1"
  set geo [$ns node 0.0.0]
puts "Stub No. 2"
 $geo set-position -100
 #$geo set-position 13#-95

$geo color red
$geo shape box

#============================== POLAR SATELLITE NODES CONFIGURATION
=================

$ns node-config -satNodeType polar \
                -llType $opt_sat(ll) \
                -ifqType $opt_sat(ifq) \
                -ifqLen $opt_sat(qlim) \
                -macType $opt_sat(mac) \
                -phyType $opt_sat(phy) \
                -channelType $opt_sat(chan) \
                -downlinkBW $opt_sat(bw_down) \
                -wiredRouting $opt_sat(wiredRouting)

# Create nodes n0 through n10
set n0 [$ns node 0.1.0]; set n1 [$ns node 0.1.1]; set n2 [$ns node 0.1.2];
set n3 [$ns node 0.1.3]
set n4 [$ns node 0.1.4]; set n5 [$ns node 0.1.5]; set n6 [$ns node 0.1.6];
set n7 [$ns node 0.1.7]
set n8 [$ns node 0.1.8]; set n9 [$ns node 0.1.9]; set n10 [$ns node 0.1.10]

# Provide position information for each of these nodes
set plane 1
$n0 set-position $opt(alt) $opt(inc) 0 0 $plane
$n1 set-position $opt(alt) $opt(inc) 0 32.73 $plane
$n2 set-position $opt(alt) $opt(inc) 0 65.45 $plane
$n3 set-position $opt(alt) $opt(inc) 0 98.18 $plane
$n4 set-position $opt(alt) $opt(inc) 0 130.91 $plane
$n5 set-position $opt(alt) $opt(inc) 0 163.64 $plane
$n6 set-position $opt(alt) $opt(inc) 0 196.36 $plane
$n7 set-position $opt(alt) $opt(inc) 0 229.09 $plane
$n8 set-position $opt(alt) $opt(inc) 0 261.82 $plane
$n9 set-position $opt(alt) $opt(inc) 0 294.55 $plane
$n10 set-position $opt(alt) $opt(inc) 0 327.27 $plane

# Set up polar satellite connection
$n0 set_next $n10; $n1 set_next $n0; $n2 set_next $n1; $n3 set_next $n2
$n4 set_next $n3; $n5 set_next $n4; $n6 set_next $n5; $n7 set_next $n6
$n8 set_next $n7; $n9 set_next $n8; $n10 set_next $n9

# ISLs for the polar satellites
$ns add-isl intraplane $n0 $n1 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n1 $n2 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n2 $n3 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n3 $n4 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n4 $n5 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n5 $n6 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n6 $n7 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n7 $n8 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n8 $n9 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n9 $n10 $opt(bw_isl) $opt(ifq) $opt(qlim)
$ns add-isl intraplane $n10 $n0 $opt(bw_isl) $opt(ifq) $opt(qlim)

#============================== SATELLITE TERMINAL NODES CONFIGURATION
===================

# Configure the node generator for satellite terminals
$ns node-config -satNodeType terminal \
                -llType $opt_sat(ll) \
                -ifqType $opt_sat(ifq) \
                -ifqLen $opt_sat(qlim) \
                -macType $opt_sat(mac) \
                -phyType $opt_sat(phy) \
                -channelType $opt_sat(chan) \
                -downlinkBW $opt_sat(bw_down) \
                -wiredRouting ON

set vsat1 [$ns node 0.2.0]
set vsat2 [$ns node 0.3.0]
$vsat1 set-position 37.9 -122.3;
$vsat2 set-position 42.3 -71.1;

$vsat1 color blue
$vsat1 shape hexagone

$vsat2 color green
$vsat2 shape hexagone

 #$vsat1 set-position 43.71 10.38; # NY
 #$vsat2 set-position 43.71 10.38; # SF


# Connect terminals to geo satellites
 $vsat1 add-gsl geo $opt_sat(ll) $opt_sat(ifq) $opt_sat(qlim) $opt_sat(mac)
$opt_sat(bw_up) \
     $opt_sat(phy) [$geo set downlink_] [$geo set uplink_]
 $vsat2 add-gsl geo $opt_sat(ll) $opt_sat(ifq) $opt_sat(qlim) $opt_sat(mac)
$opt_sat(bw_up) \
     $opt_sat(phy) [$geo set downlink_] [$geo set uplink_]

# Connect terminals to the polar satellites

$vsat1 add-gsl polar $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) \
  $opt(phy) [$n5 set downlink_] [$n5 set uplink_]
$vsat2 add-gsl polar $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) \
  $opt(phy) [$n5 set downlink_] [$n5 set uplink_]

#======================== SOME DESKTOPS TO SATELLITE
========================================

# unset the satellite node type, to create other nodes.
$ns unset satNodeType_
$ns unset channelType_
$ns node-config -reset


# create some desktop pc to transfer data from olsr to satellite
set w1 [$ns node 2.0.0]
$w1 color blue
$ns at 0.0 "$w1 add-mark w1 blue"

set w2 [$ns node 2.0.1]
$w2 color green
$ns at 0.0 "$w2 add-mark w2 green"


# create links from desktop to vsat
$ns duplex-link $w1 $vsat1 100Mb 0.01ms DropTail
$ns duplex-link $w2 $vsat2 100Mb 0.01ms DropTail


#========================= MANET BASE STATION CONFIGURATION
=======================

$ns node-config -adhocRouting $opt_mobile(adhocRouting) \
                 -llType $opt_manet(ll) \
                 -macType $opt_manet(mac) \
                 -ifqType $opt_manet(ifq) \
                 -ifqLen $opt_manet(ifqlen) \
                 -antType $opt_manet(ant) \
                 -propInstance [new $opt_manet(prop)] \
                 -phyType $opt_manet(netif) \
                 -channel [new $opt_manet(chan)] \
                 -topoInstance $topo \
                 -wiredRouting ON \
                 -agentTrace ON \
                 -routerTrace ON \
                 -macTrace ON


set temp {1.0.0 1.0.1 1.0.2 1.0.3}
# create base station 1
  set BS1 [ $ns_ node [lindex $temp 0]]
  $BS1 random-motion 0


  $BS1 color yellow
  $BS1 shape box


  $BS1 set X_ [expr $opt_manet(nn) * 100.0]
  $BS1 set Y_ [expr 500.0 + ((($opt_manet(nn) * 93) % 21) - 10 ) * 10.0]
  $BS1 set Z_ 0.0

# ================ CREATE MOBILE NODES ================================

for {set i 0} {$i < $opt_mobile(nn)} {incr i} {
     #set node1($i) [$ns node 1.0.[expr $i+1]]
     set node_($i) [ $ns_ node [lindex $temp [expr $i+1]] ]
     $node1($i) color green


    $node1($i) random-motion 0
    $node1($i) set X_ [expr $i * 100.0 + $net_distance]
    $node1($i) set Y_ [expr 500.0 + ((($i * 93) % 21) - 10 ) * 10.0]
    $node1($i) set Z_ 0.0
    #$ns initial_node_pos $node1($i) 20
    $node1($i) base-station [AddrParams addr2id [$BS1 node-addr]]
}

# create links between wired and BS nodes
#$ns duplex-link $w1 $BS1 100Mb 1ms DropTail
$ns duplex-link $vsat1 $BS1 100Mb 1ms DropTail


#===================== CREATE TRAFFIC / SETUP CONNECTIONS
==============================

#Create a UDP agent 1
set udp1 [new Agent/UDP]
#Attach agent udp1 to mobile node 0
$ns attach-agent $node1(0) $udp1
#Create traffic generator for udp agent
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set packet_size_ 1000
$cbr1 set interval_ 5.0

#Create a UDP agent 2
set udp2 [new Agent/UDP]
#Attach agent udp1 to mobile node 0
$ns attach-agent $node1(0) $udp2
#Create traffic generator for udp agent
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set packet_size_ 1000
$cbr2 set interval_ 5.0

#Create a UDP agent 3
set udp3 [new Agent/UDP]
#Attach agent udp1 to mobile node 0
$ns attach-agent $w1 $udp3
#Create traffic generator for udp agent
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set packet_size_ 1000
$cbr3 set interval_ 7.5

#Create a null agent
set sink1 [new Agent/Null]
#Attach agent sink1 to node W2
$ns attach-agent $W2 $sink1

# Connect the agents
$ns connect $udp1 $sink1
$ns connect $udp2 $sink1
$ns connect $udp3 $sink1

#=================================== Log files
===================================
proc record {} {
        global null1 f0 f1 f2

        # Get an instance of the simulator
                set ns [Simulator instance]

        # Set the time after which the procedure should be called again
        set time 5.0

        # How many bytes have been received by the traffic sinks?
        set bw1 [$null1 set bytes_]

        # Get the current time
        set now [$ns now]
        # Calculate the throughput and write it to the files
                puts $f1 "$now [expr $bw1]"

        # Reset the bytes_ values on the traffic sinks
        $null1 set bytes_ 0

        # Re-schedule the procedure
        $ns at [expr $now+$time] "record"

}


set satrouteobject_ [new SatRouteObject]
$satrouteobject_ compute_routes

$ns at 1.0 "record"
$ns at 1.0 "$cbr1 start"
$ns at 40.0 "$cbr2 start"
$ns at 20.0 "$cbr3 start"
$ns at 797.0 "finish"

proc finish {} {

        global ns outfile f0 f1 f2

        $ns flush-trace
        close $outfile
        close $f0
        close $f1
        close $f2


        exit 0
}

$ns at $opt_mobile(stop).1 "puts \"NS EXITING...\" ; $ns halt"

puts "Starting Simulation..."
$ns run

Reply via email to