Dear ns-2 users and experts
Hello and good day

I am trying to use the Markov-chain idea to create TCP connections passing
from a backbone (chain). In my scenario we have a chain like this:

node(0)<---->node(1)<--->node(2)<---->node(3)<---> ...<----> node(n)

each node exactly sends several TCP connections (FTP) with random size and
random arrival time by an pre-specified order (variable cntcs(backbone) 5 ;
in this case 5)
However when I start the simulation in gives me "floating point exception".
I tried to check all variables and substitute them, but nothing changes, I
still get this error.
Here is the full Tcl code for your reference (I am using ns-2.29).

Thank you in advance for your contribution

set ns [new Simulator]
set policy [lindex $argv 0] ;# this is the qeueing policy to be applied
set tf [open tf.tr w]

# Simulation parameters stack
set backbone 10 ;# This is the number of Nodes in backbone!  (thus number of
hops will be backbone-1)
set childs 5 ;# This is the number of children nodes each backbone node is
connected to!
set qsize(backbone) 50 ;#Queue size for backbone nodes
set qsize(childs) 50 ;#Queue size for children nodes
set bw(backbone) 2Mb ;# link bandwidth for backbone nodes
set bw(childs) 2Mb ;#link bandwidth for children nodes
set delay(backbone) 10ms ;#link delay for backbone nodes
set delay(childs) 10ms ;#link delay for children nodes
set cnctn(backbone) 5 ;#Number of connection each backbone node established
to each other Backbone node (per backbone node)!
set lambda(backbone) 10; # lambda for each backbone node
set mu(backbone) 20000 ;# mu? (average file size in bytes for backbone
transfers)
set shape(backbone) 1.5 ;# Pareto file size shape of backbone tranfers

$ns trace-all $tf

proc finish {} {
        global ns tf
        $ns flush-trace
    close $tf         exit 0
}

# backbone node declaration
for {set i 0} {$i<$backbone} {incr i} {
set  n($i) [$ns node] ;# "n" series of nodes are in backbone only!
}

# children nodes declaration
for {set i 0} {$i<$backbone} {incr i} {
    for {set j 0} {$j<$childs} {incr j} {
    set  c($i,$j) [$ns node] ;# "c" series of nodes are children nodes only!
    }
}

#create wired links for backbone
for {set i 0} {$i<$backbone-1} {incr i} {
set k [expr $i+1]
$ns duplex-link $n($i) $n($k) $bw(backbone) $delay(backbone) $policy
$ns queue-limit $n($i) $n($k) $qsize(backbone)
$ns queue-limit $n($k) $n($i) $qsize(backbone)
}

#create wired links for children nodes
for {set i 0} {$i<$backbone} {incr i} {
    for {set j 0} {$j<$childs} {incr j} {
    $ns duplex-link $n($i) $c($i,$j) $bw(childs) $delay(childs) $policy
    $ns queue-limit $n($i) $c($i,$j) $qsize(childs)
    $ns queue-limit $c($i,$j) $n($i) $qsize(childs)
    }
}

#creating backbone/backbone TCP source and destinations
for {set i 0} {$i<$backbone} {incr i} {
    for {set j 0} {$j<$backbone} {incr j} {
        for {set k 0} {$k<$cnctn(backbone)} {incr k} {
        set tcp_back($i,$j,$k) [new Agent/TCP/Newreno]
        $ns attach-agent $n($i) $tcp_back($i,$j,$k)
        set sink_back($i,$j,$k) [new Agent/TCPSink/DelAck]
        $ns attach-agent $n($j) $sink_back($i,$j,$k)
        $ns connect $tcp_back($i,$j,$k) $sink_back($i,$j,$k)
        set ftp_back($i,$j,$k) [$tcp_back($i,$j,$k) attach-source FTP]
        # $tcp_back($i,$j,$k) set fid_ 1
        }
    }
}

# Generators for random file size and inter-arrival times
set rng1(back) [new RNG]
$rng1(back) seed 1
set rng2(back) [new RNG]
$rng2(back) seed 1

#Random inter-arrival times at each source
set RV(back) [new RandomVariable/Exponential]
$RV(back) set avg_ [expr 1/$lambda(backbone)]
$RV(back) use-rng $rng1(back)

#Random file sizes
set RVsize(back) [new RandomVariable/Pareto]
$RVsize(back) set avg_ $mu(backbone)
$RVsize(back) set shape_ $shape(backbone)
$RVsize(back) use-rng $rng2(back)

# Starting the connections (start time and size usage)
for {set i 0} {$i<$backbone} {incr i} {
    for {set j 0} {$j<$backbone} {incr j} {
        set t [$ns now]
        for {set k 0} {$k<$cnctn(backbone)} {incr k} {
        set t [expr $t+[$RV(back) value]]
        set Conct($i,$j,$k) $t
        set Size($j,$j,$k) [expr [$RVsize(back) value]]
        $ns at $Conct($i,$j,$k) "$ftp_back($i,$j,$k) send 10000"
        }
    }
}

$ns at 10 "finish"
$ns run

-- 
Naeem Khademi
---------------------------------------------------------
Student of Master of Computer Science
University  Putra  Malaysia
---------------------------------------------------------

Reply via email to