[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Sat-Repeater.tcl - TCP low throughput



Hi all,

I have made some little changes to the script sat-repeater that comes with 
NS. I have also wrote a simple script in AWK to calculate the throughput 
over the link n2 <--> n1. According to this script the throughput is very low.
Is it correct or is the script wrong?
And if the throughput is low, what can I do to achieve a 1 Mb/s throughput? 
(Consider I have set tcp window size to 20000)

(Below you can find the two scripts)

Any help is appreciated. Thank you in advance,

Giuseppe Tringali

OS: Linux Red Hat 6.2
NS: ns-allinone-2.1b6
AWK: GNU Awk 3.0.4


BEGIN {slot = 0.5; bytes_counter = 0; t_sampling = 0.5;}
{
    action = $1;
    time = $2;
    node_1 = $3;
    node_2 = $4;
    size = $6;

    if ( (action == "r") && (node_2 == "2") ) {

         if ( time <= t_sampling) bytes_counter = bytes_counter + size;

         if ( time > t_sampling) {
                                 th = ( (bytes_counter * 8) / (1000000 * 
slot) );
                                 printf("%f %f\n", t_sampling, th);
                                 bytes_counter = size;
                                 t_sampling = t_sampling + slot;
                                 }
         }
}
END { }



#
# Copyright (c) 1999 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#       This product includes software developed by the MASH Research
#       Group at the University of California Berkeley.
# 4. Neither the name of the University nor of the Research Group may be
#    used to endorse or promote products derived from this software without
#    specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Contributed by Tom Henderson, UCB Daedalus Research Group, June 1999
#
# Simple script with a geostationary satellite and two terminals
# and an error module on the receiving terminal.  The traffic consists of
# a FTP source and a CBR stream

global ns
set ns [new Simulator]
$ns rtproto Dummy; # Using C++ routing agents and objects

# Global configuration parameters

global opt
set opt(chan)           Channel/Sat
set opt(bw_up)          10Mb; # Uplink bandwidth-- becomes downlink bw also
set opt(phy)            Phy/Sat
set opt(mac)            Mac/Sat
set opt(ifq)            Queue/DropTail
set opt(qlim)           50
set opt(ll)             LL/Sat

# XXX This tracing enabling must precede link and node creation
set f [open out.tr w]
$ns trace-all $f

# Set up satellite and terrestrial nodes

# GEO satellite at 95 degrees longitude West
set n1 [$ns satnode-geo-repeater -95 $opt(chan)]

# Two terminals: one in NY and one in SF
set n2 [$ns satnode-terminal 40.9 -73.9]; # NY
set n3 [$ns satnode-terminal 37.8 -122.4]; # SF

# Add GSLs to geo satellites
$n2 add-gsl geo $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) \
     $opt(phy) [$n1 set downlink_] [$n1 set uplink_]
$n3 add-gsl geo $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) \
     $opt(phy) [$n1 set downlink_] [$n1 set uplink_]

# Add an error model to the receiving terminal node
# and sets its packet error rate to 2 percent

set em_ [new ErrorModel]
$em_ unit pkt
$em_ set rate_ 0.02
$em_ ranvar [new RandomVariable/Uniform]
$n3 interface-errormodel $em_

$ns trace-all-satlinks $f

# Attach agents for FTP
set tcp0 [$ns create-connection TCP/Newreno $n2 TCPSink $n3 0]

# set segment size to 500 bytes
$tcp0 set packetSize_ 500

# set windows size to 20000 packets
$tcp0 set windows_ 20000


set ftp0 [$tcp0 attach-app FTP]

$ns at 1.0 "$ftp0 start"


# We use centralized routing
set satrouteobject_ [new SatRouteObject]
$satrouteobject_ compute_routes

$ns at 100.0 "finish"

proc finish {} {
         global ns f
         $ns flush-trace
         close $f

         exit 0
}

$ns run