LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-25-2014, 05:25 PM   #16
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641

# 13 .

Ubuntu 10.04 : $ sudo apt-get install g++-4.1

* The Ubuntu 10.04 build command for all ns-2.26 ... ns-2.34 :
$ export CC=gcc-4.1 CXX=g++-4.1 && ./install

* If you are reconfiguring in ns-allinone-2.xx/2.xx/ :
$ make distclean && export CC=gcc-4.1 CXX=g++-4.1 && ./configure && make


-

Last edited by knudfl; 02-25-2014 at 05:27 PM.
 
Old 02-26-2014, 01:18 AM   #17
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
# 13 .

* If you are reconfiguring in ns-allinone-2.xx/2.xx/ :
$ make distclean && export CC=gcc-4.1 CXX=g++-4.1 && ./configure && make
-
this command should run in ns-2.34/
?

I have make clean and export CC=gcc-4.1 CXX=g++-4.1 && ./configure && make in ns-2.34

installed successfully

but again
same error
Code:
ns: record: can't read "firstPktTime_": no such variable
    while executing
"subst $[subst $var]"
    (procedure "_o99" line 5)
    (Object next line 5)
    invoked from within
"_o99 next firstPktTime_"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o99" line 18)
    (Agent set line 18)
    invoked from within
"$null_($i) set firstPktTime_"
I tried some other variables also but none is adding to loss-monitor.cc
all saying same error

Last edited by Aska123; 02-26-2014 at 01:31 AM.
 
Old 02-26-2014, 04:58 AM   #18
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 17 .

OK, better use ./install instead of reconfiguring.
The "make distclean" is then done automatically in tcl8.4*, tk8.4*, ns-2.34/,
.. so to be absolutely sure of a clean ns2, do the 'make distclean' manually
.. in otcl-1.13/ and tclcl-1.19/ .

Then it's : $ export CC=gcc-4.1 CXX=g++-4.1 && ./install

-
 
Old 02-26-2014, 05:20 AM   #19
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 17 .

P.S. : No errors here with `Ubuntu 10.04' :
(1) $ export CC=gcc-4.1 CXX=g++-4.1 && ./install
(2) $ cd ns-2.34/ && ./ns test.tcl

-
 
Old 02-26-2014, 06:08 AM   #20
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
# 17 .

OK, better use ./install instead of reconfiguring.
The "make distclean" is then done automatically in tcl8.4*, tk8.4*, ns-2.34/,
.. so to be absolutely sure of a clean ns2, do the 'make distclean' manually
.. in otcl-1.13/ and tclcl-1.19/ .

-
how to do it make distclean manually

should I delete ns-allinone-2.34 folder and re-install it?

Last edited by Aska123; 02-26-2014 at 06:14 AM.
 
Old 02-26-2014, 06:48 AM   #21
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
Question

dear Knudfi I try the same file on ns-2.29
after making chages to loss-monitor.h and .cc file and ns-default.tcl file

ALso I changed name of firstPktTime_ to first_packet_time_
Code:
ns: record: can't read "first_packet_time_": no such variable
    while executing
"subst $[subst $var]"
    (procedure "_o99" line 5)
    (Object next line 5)
    invoked from within
"_o99 next first_packet_time_"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o99" line 18)
    (Agent set line 18)
    invoked from within
"$null_($i) set first_packet_time_"
    (procedure "record" line 8)
    invoked from within
"record"
rohini@ubuntu:~/ns-allinone-2.29$

It seems that no new variable is being added in loss monitor file.
or it may be that we have to add first_packet_time_ some where also
 
Old 02-26-2014, 06:58 AM   #22
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 20 .
Quote:
how to do it make distclean manually
Well, it's like 'make clean' :

1) $ cd otcl-1.13/
2) $ make distclean
3) $ cd ../tclcl-1.19/
4) $ make distclean

-
 
Old 02-26-2014, 07:23 AM   #23
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
Dear kundfi
I did it same way as you explained in post #22

But again same error

now I am trying to install ns2.28 . I want to run this script in ns-2.28
may be it works here.

Please tell me steps of installing ns-2.28 in ubuntu 10.04

I trued it like
cd ns-allinone-2.28/ && export CC=gcc-4.1 CXX=g++-4.1 && ./install

error
Code:
tcl8.3.2 configuration failed! Exiting ...
Tcl is not part of the ns project.
if this script works in ns-2.28
then I will remove ns-2.34
 
Old 02-26-2014, 08:12 AM   #24
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 23 .
Quote:
then I will remove ns-2.34
No. Don't do that. You can have as many ns-allinone-2.xx as you want,
installed at the same time. But : Do never add any *PATH text to .bashrc.

The trick is : Use a copy of the executable 'ns' to e.g. 'ns228-througput',
and copy 'ns228-througput' to /usr/local/bin/ .
Then the executable is a system PATH, and you can do $ ns228-througput test.tcl
( I have 70 different named 'ns's in /usr/local/bin/, they all work perfectly.)

Building ns-2.28 :
1) tar xvf ns-allinone-2.28.tar.gz
2) patch -p0 < ns228-gcc40.patch
3) patch -p0 < ns-2.28-gcc410.patch <Enter> <Enter> <Enter>
4) cd ns-allinone-2.28/
5) export CC=gcc-4.1 CXX=g++-4.1 && ./install
6) cd ns-2.28/
7) cp ns ns228-througput
8) sudo cp ns228-througput /usr/local/bin/
... That's it, and you can immediately do $ ns228-througput test.tcl

Patches : Post #15 here http://www.linuxquestions.org/questi...4-a-842773/#15

-
 
1 members found this post helpful.
Old 02-26-2014, 08:18 AM   #25
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
hello
Knudfi
when I install ns-2.34 by using export CC=gcc-4.1 CXX=g++-4.1 && ./install

I got error of tcl is not part of this project , in both case ns-2.34 and ns-2,28

but when I use sudo su CC=gcc-4.1 CXX=g++-4.1 && ./install
It installed properly.
is this creating problem?

I used one of your previous post to install ns-2.28

It is being installed now.
when i t will get installed.
I will inform you

Last edited by Aska123; 02-26-2014 at 08:20 AM.
 
Old 02-26-2014, 08:30 AM   #26
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 25 .
Quote:
but when I use sudo su CC=gcc-4.1 CXX=g++-4.1 && ./install
It installed properly.
is this creating problem ?
* That's either a corrupt OS,
or you might have used a "sudo command" previously,
e.g. $ sudo tar xvf ns-allinone-2.xx.tar.gz,
which you are not supposed to do.
All ns2 commands : No sudo.
Except when you install or copy the executable to /usr/local/bin/.

-
 
Old 02-26-2014, 08:34 AM   #27
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
# 25 .
or you might have used a "sudo command" previously,
e.g. $ sudo tar xvf ns-allinone-2.xx.tar.gz,
which you are not supposed to do.
-
No I have not used sudo command previously.
I just used it to install

I while installing ns-2.28
error
Code:
make: *** [libotcl.so] Error 1
otcl-1.9 make failed! Exiting ...
 
Old 02-26-2014, 08:50 AM   #28
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
Installed ns-2.28 successfully without using sudo su

now trying to run test file
 
Old 02-26-2014, 09:03 AM   #29
Aska123
Member
 
Registered: Apr 2013
Posts: 197

Original Poster
Rep: Reputation: Disabled
I followed all these steps
1) tar xvf ns-allinone-2.28.tar.gz
2) patch -p0 < ns228-gcc40.patch
3) patch -p0 < ns-2.28-gcc410.patch <Enter> <Enter> <Enter>
4) cd ns-allinone-2.28/
5) export CC=gcc-4.1 CXX=g++-4.1 && ./install
6) cd ns-2.28/
7) cp ns ns228-througput
8) sudo cp ns228-througput /usr/local/bin/
$ ns228-througput test.tcl

made changes to loss-monitor.h , .cc and ns-default.tcl file
then in ns-2.28/ make clean and make

then $ ns228-througput test.tcl
Code:
rohini@ubuntu:~/test$ ns228-througput lossmonitor.tcl
num_nodes is set 5
INITIALIZE THE LIST xListHead
wireless node 0 created ...
X_:150.00135830880001 Y_:150.55588069999999
wireless node 1 created ...
X_:150.05681863999999 Y_:150.08812266999999
wireless node 2 created ...
X_:151.76469359999999 Y_:150.79915550000001
wireless node 3 created ...
X_:151.25184719999999 Y_:150.81647609999999
wireless node 4 created ...
X_:150.9384072 Y_:150.6388651
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!
ns: record: can't read "firstPktTime_": no such variable
    while executing
"subst $[subst $var]"
    (procedure "_o99" line 5)
    (Object next line 5)
    invoked from within
"_o99 next firstPktTime_"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o99" line 18)
    (Agent set line 18)
    invoked from within
"$null_($i) set firstPktTime_"
    (procedure "record" line 8)
    invoked from within
"record"
my test file is as follows
Code:
set val(chan)           Channel/WirelessChannel    ;# channel type
set val(prop)           Propagation/TwoRayGround   ;# radio-propagationmodel
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)         1000                       ;# max packet in ifq
set val(nn)             5                          ;# number of mobilenodes
set val(rp)             DSDV                       ;# routing protocol
 
Mac/802_11 set RTSThreshold_          3000             ;# bytes
Mac/802_11 set ShortRetryLimit_       7               ;# retransmittions
Mac/802_11 set LongRetryLimit_        4               ;# retransmissions
Mac/802_11 set PreambleLength_        144             ;# 144 bit
Mac/802_11 set PLCPHeaderLength_      48              ;# 48 bits
Mac/802_11 set PLCPDataRate_  1Mb                         ;# 1Mbps
Mac/802_11 set dataRate_      1Mb
Mac/802_11 set basicRate_     1Mb
Mac/802_11 set CWMin_         31
Mac/802_11 set CWMax_         1023
Mac/802_11 set SlotTime_      0.000020        ;# 20us
Mac/802_11 set SIFS_          0.000010        ;# 10us
 
set ns_              [new Simulator]
 
set tracefd     [open simple.tr w]
$ns_ trace-all $tracefd
 
set nf [open out.nam w]
$ns_ namtrace-all-wireless $nf 300 300
 
set topo       [new Topography]
 
$topo load_flatgrid 300 300
 
create-god $val(nn)
set chan_1_ [new $val(chan)]
 
        $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) \
                         -channel $chan_1_ \
                         -topoInstance $topo \
                         -agentTrace ON \
                         -routerTrace OFF \
                         -macTrace OFF \
                         -movementTrace OFF                   
       
        for {set i 0} {$i < $val(nn) } {incr i} {
                set node_($i) [$ns_ node]
                $node_($i) random-motion 0            ;# disable random motion
        }
      
set  rng  [new RNG]
$rng seed 1
set  rand1  [new RandomVariable/Uniform]
 
for {set i 0} {$i < $val(nn) } {incr i} {
    puts "wireless node $i created ..."
    set x [expr 150+[$rand1 value]*4]
    set y [expr 150+[$rand1 value]*1]
    $node_($i) set X_ $x
    $node_($i) set Y_ $y
    $node_($i) set Z_ 0.0
    puts "X_:$x Y_:$y"
}
 
for {set i 0} {$i < $val(nn) } {incr i} {
    set udp_($i) [new Agent/UDP]
    $ns_ attach-agent $node_($i) $udp_($i)
    set null_($i) [new Agent/LossMonitor]
    $ns_ attach-agent $node_($i) $null_($i)
}
 
for {set i 0} {$i < $val(nn) } {incr i} {
    if {$i == ($val(nn)-1)} {
            $ns_ connect $udp_($i) $null_(0)
    } else {
            set j [expr $i+1]
            $ns_ connect $udp_($i) $null_($j)
    }
   
    set cbr_($i) [new Application/Traffic/CBR]
    $cbr_($i) attach-agent $udp_($i)
    $cbr_($i) set type_ CBR
    $cbr_($i) set packet_size_ 1000
    $cbr_($i) set rate_ 500kb
    $cbr_($i) set random_ false
}
 
for {set i 0} {$i < $val(nn) } {incr i} {   
    $ns_ at 1.0  "$cbr_($i) start"
    $ns_ at 50.0 "$cbr_($i) stop"
}
 
# Tell nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at 100.0 "$node_($i) reset";
}
 
$ns_ at 100.0 "stop"
$ns_ at 100.01 "puts \"NS EXITING...\" ; $ns_ halt"
 
$ns_ at 45.0 "record"
 
proc record {} {
        global ns_ null_ val first_time last_time
       set sum 0
            for {set i 0} {$i < $val(nn) } {incr i} {
                    set th 0
                    set a [$null_($i) set bytes_]
                    set b [$null_($i) set lastPktTime_]
                    set c [$null_($i) set first_packet_time_]
                    set d [$null_($i) set npkts_]
                    if {$b>$c} {
                           set th [expr ($a-$d*20)*8/($b-$c)]
                           puts "flow $i has $th bps"
            }
            set sum [expr $sum+$th]
    }
    puts "total throughput:$sum bps"
}
 
proc stop {} {
    global ns_  tracefd
    $ns_ flush-trace
    close $tracefd
}
 
puts "Starting Simulation..."
$ns_ run
is there any problem with my OS
it is installed on vmware.

changes made are
Code:
1.      Modify the tools/loss-monitor.h
class LossMonitor : public Agent {
public:
        LossMonitor();
        virtual int command(int argc, const char*const* argv);
        virtual void recv(Packet* pkt, Handler*);
protected:
        int nlost_;
        int npkts_;
        int expected_;
        int bytes_;
        int seqno_;
        double last_packet_time_;
//add the following two lines
        double first_packet_time_;
        int first;
};
 
2.      Modify the tools/loss-monitor.cc
LossMonitor::LossMonitor() : Agent(PT_NTYPE)
{
        bytes_ = 0;
        nlost_ = 0;
        npkts_ = 0;
        expected_ = -1;
        last_packet_time_ = 0.;
        first_packet_time_ = 0.;
        first=0;
        seqno_ = 0;
        bind("nlost_", &nlost_);
        bind("npkts_", &npkts_);
        bind("bytes_", &bytes_);
        bind("lastPktTime_", &last_packet_time_);
        bind("firstPktTime_", &first_packet_time_);
        bind("expected_", &expected_);
}
 
void LossMonitor::recv(Packet* pkt, Handler*)
{
        hdr_rtp* p = hdr_rtp::access(pkt);
        seqno_ = p->seqno();
        bytes_ += hdr_cmn::access(pkt)->size();
        ++npkts_;
       
        if(first==0){
                first_packet_time_=Scheduler::instance().clock();
                first=1;
        }
        /*
         * Check for lost packets
         */
        if (expected_ >= 0) {
                int loss = seqno_ - expected_;
                if (loss > 0) {
                        nlost_ += loss;
                        Tcl::instance().evalf("%s log-loss", name());
                }
        }
        last_packet_time_ = Scheduler::instance().clock();
        expected_ = seqno_ + 1;
        Packet::free(pkt);
}
3. Modify ns-default.tcl file
add
Agent/LossMonitor set firstPktTime_ 0

Last edited by Aska123; 02-26-2014 at 09:07 AM.
 
Old 02-26-2014, 10:26 AM   #30
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 29 .
Quote:
my test file is as follows
Did you change "test.tcl" ? The original one in post #1 works OK.

# 28 : ""Installed ns-2.28 successfully without using sudo su""
* Any use of 'sudo su' will use a PATH different from using
unprivileged commands : No 'sudo' or 'sudo su' can be used :
If you did, please start from scratch, with a new unpacked
ns-allinone-2.28.tar.gz, in a new directory.

# 29 : ""changes made are""
* You are not supposed to make any changes.
The usable code is included in `throughput-without-parsing-the-trace-file-ns228.tar.bz2'
https://drive.google.com/file/d/0B7S...it?usp=sharing
(And if ns-2.34, in `throughput-without-parsing-the-trace-file-ns234.tar.bz2').

-
 
  


Reply

Tags
ns2, ns228, throughput-ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why directory record length is variable in ext2 filesystem? password636 Programming 7 01-11-2011 08:24 AM
[SOLVED] How to parse files with variable record length btacuso Programming 4 08-11-2010 11:49 AM
Find variable name by variable content using a subshell UltramaticOrange Programming 3 11-17-2008 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration