LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to integrate the "Resource/Energy" leach class into NS-2.34? (https://www.linuxquestions.org/questions/linux-software-2/how-to-integrate-the-resource-energy-leach-class-into-ns-2-34-a-870368/)

nzny 02-03-2012 02:10 AM

tq farab

i've edited my bashrc. however, could you show me how did you exactly edit your bashrc?

thanks

knudfl 02-05-2012 03:51 AM

# 201.

Actually ns will do fine with no "adding any *PATH"
or changes at all in .bashrc .
Which is also impossible, if you have more than one ns2 version installed.
( I can have easily have 10 versions of ns-allinone-2.xx on each OS.)

***** ns is hard coded to know, where its libraries are located !


The old text about adding *PATH is probably only valid for Windows/Cygwin.

.

ayaan 02-08-2012 04:27 AM

hi ! i have succesfully patched ns2.34 leach and i run the test it is showing no errors.
but when i try to run leach.tcl file i am getting this error

moin@moin-Precision-WorkStation-370:~/Desktop$ ns leach.tcl
couldn't read file "mit/uAMPS/ns-leach.tcl": no such file or directory
while executing
"source.orig mit/uAMPS/ns-leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/ns-leach.tcl"
(file "leach.tcl" line 7)
plz reply soon

ayaan 02-08-2012 04:39 AM

hi ! and when i try to run leach_test i got this error
moin@moin-Precision-WorkStation-370:~/ns-allinone-2.34/ns-2.34/ns-234-leach$ ns leach_test
invalid command name "alg=leach"
while executing
"alg=leach"
(file "leach_test" line 5)

ayaan 02-08-2012 04:42 AM

hi ! i want to know how to check the tcl and nam files of leach protocol can u plz reply as soon as possible

khushbushah 02-08-2012 07:54 AM

I have same problem but in fedora 14
 
Quote:

Originally Posted by knudfl (Post 4300082)
Welcome to LQ.

Add 'hardy' to /etc/apt/sources.list : g++-3.3....gcc-4.2((g++-4.2)) will be available.
sudo gedit /etc/apt/sources.list ; sudo apt-get update
Code:

deb http://76.73.4.58/ubuntu/ hardy-updates main
deb http://76.73.4.58/ubuntu/ hardy universe
deb http://security.ubuntu.com/ubuntu hardy-security main
deb http://security.ubuntu.com/ubuntu hardy-security universe

A missing "Resource/Energy" : It was not compiled into ns.
All new objects must be added to 'Makefile' ( Makefile.in ).
Patch ns234-leach.tar.bz2 https://docs.google.com/uc?id=0B7S25...CJzYt5QP&hl=en
May be compare the Makefile with the original ns-2.27 LEACH Makefile :
https://docs.google.com/uc?id=0B7S25...CNPCuaYP&hl=en

EDIT : See post # 22

..

Hi
please help i had same problem of Resource/energy in leach.err file
What can i do?where do I require changes?I cant find location in Fedora14
Thanks
Khushbu

knudfl 02-08-2012 09:13 AM

Post # 206, @khushbushah.

Fedora 14 : With no other error indications, suggest ...
Start from scratch in /home/<user-name>/ns-allinone-2.34/
http://www.linuxquestions.org/questi...dora13-907076/
.. using the script leach-HOME-setup234.sh
And don't forget the new modified file cmu-trace.h

And then : cd ns-allinone-2.34/ns-2.34/ &&
./configure && make clean && make && ./test

.

ayaan 02-09-2012 01:02 AM

Hi !i have this problem when i am running some of the files of leach after succesfully patching with no errors or warnings

moin@moin-Precision-WorkStation-370:~/ns-allinone-2.34/ns-2.34/ns-234-leach/tcl/ex$ ns wireless.tcl
couldn't read file "tcl/lib/ns-mobilenode.tcl": no such file or directory
while executing
"source.orig tcl/lib/ns-mobilenode.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/lib/ns-mobilenode.tcl"
(file "wireless.tcl" line 184)
plz help me out

knudfl 02-09-2012 02:05 AM

@ayaan, post #208.

The correct way of doing the command "ns wireless.tcl" is :
cd /ns-allinone-2.34/ns-2.34/ns-234-leach/tcl/ex/ && ns wireless.tcl

Some files.tcl can be used from a random location, some from the
ns-2.34/ folder, and for others you will have to cd to their location.


#204 about leach_test : Please read the file 'test'.
And I think there are some answers about leach_test
somewhere in the thread.

.

ayaan 02-10-2012 12:09 AM

Hi ! i want to know which of the files to be generated for leach simulations and where the results will be stored,
bcos when i try to run stats.tcl the file is generating but i cant find the output.so plz help me to solve this problem.

the other thing is that when i try to run some tcl files i get this error what it means ?

moin@moin-Precision-WorkStation-370:~/ns-allinone-2.34/ns-2.34/ns-234-leach/mit/uAMPS/sims$ ns leach.tcl
couldn't read file "mit/uAMPS/ns-leach.tcl": no such file or directory
while executing
"source.orig mit/uAMPS/ns-leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/ns-leach.tcl"
(file "leach.tcl" line 7)

deepa_2111 02-11-2012 11:16 AM

Hi ayaan,

you do not execute the tcl files individually. you run the leach_test file in your command prompt.

ayaan 02-20-2012 11:33 PM

hi i am getting this error in leach.err

couldn't read file "tcl/lib/ns-mobilenode.tcl": no such file or directory
while executing
"source.orig tcl/lib/ns-mobilenode.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/lib/ns-mobilenode.tcl"
(file "tcl/ex/wireless.tcl" line 184)
plz reply soon

kinjal_patel 02-24-2012 12:08 AM

hi I have installed Ns-2.27 and mit leach protocol . But when I Execute ./test it gives following error in leach.err file .I have seen that file is present at that location.


couldn't read file "mit/uAMPS/ns-leach.tcl": no such file or directory
while executing
"source.orig mit/uAMPS/ns-leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/ns-leach.tcl"
(file "leach.tcl" line 7)

please reply quickly

knudfl 02-28-2012 01:37 PM

# 212, @ayaan

The "sh test" command must be done in ns-allinone-2.34/ns-2.34/
for the files to be found.



# 213, @kinjal_patel : Probably the same as above.
And : This thread is not about LEACH + ns-2.27.
Please start a new thread, if you have further questions.
( Or : http://www.linuxquestions.org/questi...2-27-a-785379/ )
Please read the ns-2.27 thread too.

.

Bhargava Ram Buri 03-01-2012 01:01 AM

Hi all , ( I'm new to Linux and NS2)
I got LEACH installed properly (with the help of posts in this forum, thanks to knudfl).
leach.out and leach.err are okay... But how Can we get the LEACH on nam console i.e, which tcl file should I execute to see the topology on NAM console?

Please help me through this .. :-(

@knufdl thanks for all the help.

Please get back to me with solution.

rajub 03-02-2012 02:51 AM

hi,

Thanks everyone. I've been able to integrate LEACH with your help. can anyone tell me if it possible anyway to view the simulation results in 'nam'.

I also want to know if anyone can help me in integrating SPIN. I've searched many threads with no success so far. Please help me out.

Thanks.

Bhargava Ram Buri 03-02-2012 05:58 AM

Please help me!!! First I got the simulation successfully but later I dont find any result in leach.out

Please help me :( :(

leach.err has the following

Code:

couldn't read file "tcl/lib/ns-mobilenode.tcl": no such file or directory
    while executing
"source.orig tcl/lib/ns-mobilenode.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source tcl/lib/ns-mobilenode.tcl"
    (file "tcl/ex/wireless.tcl" line 184)


keep-up 03-04-2012 12:13 AM

Hey everyone .I'm trying to simulate the LEACH-C but getting the following errors, Leach works perfectly!can any one help me to solve this problem.



can't read "env(uAMPS_LIBRARY)": no such variable
while executing
"source $env(uAMPS_LIBRARY)/ns-leach.tcl"
(file "tcl/mobility/leach-c.tcl" line 7)
invoked from within
"source.orig tcl/mobility/leach-c.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)

shanky 03-05-2012 12:06 PM

Hi,

I have been trying to run leach protocol on ns-2.34 using ubuntu 10.10 as platform for quite sometime now but am stuck with some problems please be kind enough to help me.

I have been referring to posts # 51,52,53,56,58 of this thread since i was facing similar errors but to no avail.

I have edited my uAMPs.tcl as in the mentioned posts in this way
Code:

############################################################################
#
# This code was developed as part of the MIT uAMPS project. (June, 2000)
#
############################################################################

global opt bs

#source $env(RCA_LIBRARY)/ns-ranode.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl

#source $env(uAMPS_LIBRARY)/ns-bsapp.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-bsapp.tcl

#source $env(uAMPS_LIBRARY)/extras.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/extras.tcl

#source $env(uAMPS_LIBRARY)/stats.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/stats.tcl


#Uncomment these lines to use gdb to debug the c code
#source mit/uAMPS/ns-bsapp.tcl
#source mit/uAMPS/extras.tcl
#source mit/uAMPS/stats.tcl

#source $env(RCA_LIBRARY)/resources/ns-resource-manager.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-resource-manager.tcl

#source $env(RCA_LIBRARY)/resources/ns-energy-resource.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl

#source $env(RCA_LIBRARY)/resources/ns-neighbor-resource.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-neighbor-resource.tcl

# ========================================================================
# Default Script Options
# ========================================================================

set opt(bsapp)        "Application/BSApp" ;# BS application type
set opt(mtype)        ""                ;# No meta-data used
set opt(nn_)          [expr $opt(nn) - 1] ;# Number of non-BS nodes
set opt(bsID)        $opt(nn_)          ;# BS node number
set opt(bsCode)      0                  ;# Spreading code for BS
set opt(quiet)        1                  ;# 0=print info, 1=quiet

set opt(bw)          1e6                ;# 1 Mbps radio speed
set opt(delay)        1e-12              ;# Links delay
set opt(prop_speed)  3e8;                ;# Meters per second
set opt(ll)          RCALinkLayer        ;# Arpless link-layer
set opt(mac)          Mac/Sensor          ;# Sensor mac protocol
set opt(ifq)          Queue/DropTail      ;# DropTail Q
set opt(ifqlen)      100                ;# Max packets in ifq
set opt(netif)        Phy/WirelessPhy    ;# Wireless channel
set opt(ant)          Antenna/OmniAntenna ;# Omnidirectional antena

# Time required to transmit numbytes bytes of data
proc TxTime {numbytes} {
  global opt
  return [expr $numbytes*8/$opt(bw)]
}

set opt(hdr_size)    25                  ;# Bytes for header
set opt(sig_size)    500                ;# Bytes for data signal
# Packet transmission time
set opt(slot_time)    [expr [TxTime [expr $opt(sig_size)+$opt(hdr_size)]]]
# Spread-spectrum packet transmission time
set opt(ss_slot_time) [expr $opt(slot_time) * $opt(spreading)]
# Maximum TDMA frame time (if all nodes in one cluster)
set opt(frame_time)  [expr $opt(ss_slot_time) * $opt(nn_)]

set opt(ch_change)    [expr 10 * $opt(init_energy)]  ;# Time for each round
set opt(check_energy) 10                            ;# Time btwn energy traces

set opt(freq)          914e+6            ;# Carrier frequency
set opt(L)            1.0                ;# System (non-propogation) loss
set opt(Gt)            1.0                ;# Tx antenna gain
set opt(Gr)            1.0                ;# Rx antenna gain
set opt(ht)            1.5                ;# Antenna height
set opt(CSThresh)      1e-9              ;# Receive threshold is 1 nW
set opt(RXThresh)      6e-9              ;# Success threshold is 6 nW
set PI                3.1415926
set l                  [expr 3e8 / $opt(freq)]    ;# Wavelength of carrier

############################################################################
#
# Energy Models
#
############################################################################

# Efriss_amp = RXThresh * (4pi)^2 / (Rb Gt Gr lambda^2)
set opt(Efriss_amp)  [expr [expr 1.1 * $opt(RXThresh) * 16 * $PI * $PI] / \
                            [expr $opt(bw) * $opt(Gt) * $opt(Gr) * $l * $l]]
# Etwo_ray_amp = RXThresh / (Rb Gt Gr ht^2 hr^2)
set opt(Etwo_ray_amp) [expr 1.1 * $opt(RXThresh) / \
                      [expr $opt(bw) * $opt(Gt) * $opt(Gr) * \
                            $opt(ht) * $opt(ht) * $opt(ht) * $opt(ht)]]
set opt(EXcvr)        50e-9              ;# Energy for radio circuitry
set opt(e_bf)          5e-9              ;# Beamforming energy (J/bit)
set opt(Esense)        0                  ;# Sensing energy (J/bit)
set opt(thresh_energy) 0.00              ;# Threshold for power adaptation
set opt(Pidle)        0                  ;# Idle power (W)
set opt(Psleep)        0                  ;# Sleep power (W)


# ===== Get rid of the warnings in bind ================================
Resource/Energy set energyLevel_  $opt(init_energy)
Resource/Energy set alarmLevel_    $opt(thresh_energy)
Resource/Energy set expended_      0

Agent/RCAgent set sport_          0
Agent/RCAgent set dport_          0
Agent/RCAgent set packetMsg_      0
Agent/RCAgent set distEst_        0
Agent/RCAgent set packetSize_      0
Agent/BSAgent set packetMsg_      0
Agent/BSAgent set packetSize_      0
Agent/BSAgent set recv_code_      0

RCALinkLayer set delay_            25us
RCALinkLayer set bandwidth_        0   
RCALinkLayer set off_prune_        0   
RCALinkLayer set off_CtrMcast_    0 
RCALinkLayer set macDA_            0 
RCALinkLayer set debug_            0 
RCALinkLayer set avoidReordering_  0 

Phy/WirelessPhy set bandwidth_    $opt(bw)
Phy/WirelessPhy set CSThresh_      $opt(CSThresh)
Phy/WirelessPhy set RXThresh_      $opt(RXThresh)
Phy/WirelessPhy set Efriss_amp_    $opt(Efriss_amp)
Phy/WirelessPhy set Etwo_ray_amp_  $opt(Etwo_ray_amp)
Phy/WirelessPhy set EXcvr_        $opt(EXcvr)
Phy/WirelessPhy set freq_          $opt(freq)
Phy/WirelessPhy set L_            $opt(L)
Phy/WirelessPhy set sleep_        0
Phy/WirelessPhy set alive_        1
Phy/WirelessPhy set ss_            $opt(spreading)
Phy/WirelessPhy set dist_          0

Antenna/OmniAntenna set Gt_        $opt(Gt)
Antenna/OmniAntenna set Gr_        $opt(Gr)
Antenna/OmniAntenna set Z_        $opt(ht)

set MacTrace                      OFF
Mac set bandwidth_                $opt(bw)
Mac/Sensor set code_              0
Mac/Sensor set node_num_          0
Mac/Sensor set ss_                $opt(spreading)
Mac/Sensor set CHheard_            0
Mac/Sensor set myADVnum_          0

set bs[list $opt(bs_x) $opt(bs_y)]
set BS_NODE 1

set outf [open "$opt(dirname)/conditions.txt" a]
puts $outf "Simulation will stop after $opt(stop) seconds."
puts $outf "Base station at ($opt(bs_x), $opt(bs_y))"
if {$opt(eq_energy) == 1} {
  puts $outf "Each node starting with $opt(init_energy) Joules of energy.\n"
}
puts $outf "Energy Model:"
puts $outf "\t\tRXThresh = $opt(RXThresh)"
puts $outf "\t\tCSThresh = $opt(CSThresh)"
puts $outf "\t\tRb = $opt(bw)"
puts $outf "\t\tExcvr = $opt(EXcvr)"
puts $outf "\t\tEfriss_amp = $opt(Efriss_amp)"
puts $outf "\t\tEtwo_ray_amp = $opt(Etwo_ray_amp)"
puts $outf "\t\tEbf = $opt(e_bf)"
puts $outf "\t\tPidle = $opt(Pidle)"
puts $outf "\t\tPsleep = $opt(Psleep)\n"
close $outf

set initialized 0
set rng_ [new RNG]

proc leach-create-mobile-node { id } {
    global ns_ chan prop topo tracefd opt node_
    global initialized BS_NODE rng_

    if {$initialized == 0} {
      sens_init
      set initialized 1
    }

    # Create nodes.
    if {$id != $opt(nn_)} {
      puts -nonewline "$id "
      set node_($id) [new MobileNode/ResourceAwareNode]
    } else {
      puts "($opt(nn_) == BS)"
      set node_($id) [new MobileNode/ResourceAwareNode $BS_NODE]
    }

    set node $node_($id)
    if {$id != $opt(nn_)} {
      # Set initial node energy.
      if {$opt(eq_energy) == 1} {
        $node set-energy $opt(init_energy) $opt(thresh_energy)
      } else {
        #set E [$rng_ uniform $opt(lower_e) $opt(upper_e)]
        #set rn [$rng_ uniform 0 1]
        #if {$rn < 0.1} {
        #  set E 200
        #} else {
        #  set E 2
        #}
        set high_e_nodes[list 97 19 12 87 8 22 83 55 34 72]
        if {[lsearch $high_e_nodes $id] == -1} {
          set E 2
        } else {
          set E 200
        }
        $node set-energy $E $opt(thresh_energy)
        set initf [open "$opt(dirname)/init.energy" a]
        puts $initf "$id\t$E"
        close $initf
      }
    } else {
      # Base station has an infinite amount of energy.
      $node set-energy 50000 $opt(thresh_energy)
    }

    # Disable random motion.
    $node random-motion 0     
    $node topography $topo

    if ![info exist inerrProc_] {
        set inerrProc_ ""
    }
    if ![info exist outerrProc_] {
        set outerrProc_ ""
    }
    if ![info exist FECProc_] {
        set FECProc_ ""
    }

    # Connect the node to the channel.
    $node add-interface $chan $prop $opt(ll) $opt(mac)  \
      $opt(ifq) $opt(ifqlen) $opt(netif) $opt(ant) \
      $topo $inerrProc_ $outerrProc_ $FECProc_

    # Set up the trace target.
    set T [new Trace/Generic]
    $T target [$ns_ set nullAgent_]
    $T attach $tracefd
    $T set src_ $id
    $node log-target $T

    $ns_ at 0.0 "$node_($id) start-app"
}

proc sens_init {} {

    global ns_ opt ns

    # The timer code has hard-coded the global variable ns to
    # be the simulator.
    set ns $ns_

    # Remove old trace files.
    catch "eval exec rm [glob -nocomplain $opt(dirname)/TDMAschedule.*.txt]"
    catch "exec rm $opt(dirname)/$opt(filename).energy"
    catch "exec rm $opt(dirname)/$opt(filename).data"
    catch "exec rm $opt(dirname)/$opt(filename).alive"
    catch "exec rm $opt(dirname)/startup.energy"
    catch "exec rm $opt(dirname)/init.energy"

    puts "Creating sensor nodes..."
 
    sens_init_stats "$opt(dirname)/$opt(filename)"

    $ns_ at $opt(stop) "sens_finish"
    # Start logging simulation statistics.
    $ns_ at $opt(check_energy) "sens_gather_stats"
}

but in leach.err i still get an error like this
Code:

couldn't read file "/opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl": no such file or directory
    while executing
"source.orig /opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source /opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl"
    (file "mit/uAMPS/sims/uamps.tcl" line 10)
    invoked from within
"source.orig mit/uAMPS/sims/uamps.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source mit/uAMPS/sims/uamps.tcl"
    (file "tcl/mobility/leach.tcl" line 18)
    invoked from within
"source.orig tcl/mobility/leach.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source tcl/mobility/$opt(rp).tcl"
    (file "tcl/ex/wireless.tcl" line 187)

Also i get the leach.out file as an empty file and as usual the get the warnings on the console.
Please help me out.

Regards

shanky 03-05-2012 12:25 PM

Hi

I have solved this problem of mine.Lot of mistakes on my part.My bad.Just another doubt the leach.out file although tells me that the simulation is complete it includes a lot of warnings such as this

Code:

Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
Use dst_addr_ and dst_port_ instead

What does this signify or can they be ignored??

Thank you so much.This thread has been really helpful :)

keep-up 03-05-2012 07:15 PM

Quote:

Originally Posted by shanky (Post 4619063)
Hi,

I have been trying to run leach protocol on ns-2.34 using ubuntu 10.10 as platform for quite sometime now but am stuck with some problems please be kind enough to help me.

I have been referring to posts # 51,52,53,56,58 of this thread since i was facing similar errors but to no avail.

I have edited my uAMPs.tcl as in the mentioned posts in this way
Code:

############################################################################
#
# This code was developed as part of the MIT uAMPS project. (June, 2000)
#
############################################################################

global opt bs

#source $env(RCA_LIBRARY)/ns-ranode.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl

#source $env(uAMPS_LIBRARY)/ns-bsapp.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-bsapp.tcl

#source $env(uAMPS_LIBRARY)/extras.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/extras.tcl

#source $env(uAMPS_LIBRARY)/stats.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/stats.tcl


#Uncomment these lines to use gdb to debug the c code
#source mit/uAMPS/ns-bsapp.tcl
#source mit/uAMPS/extras.tcl
#source mit/uAMPS/stats.tcl

#source $env(RCA_LIBRARY)/resources/ns-resource-manager.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-resource-manager.tcl

#source $env(RCA_LIBRARY)/resources/ns-energy-resource.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl

#source $env(RCA_LIBRARY)/resources/ns-neighbor-resource.tcl
source /opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-neighbor-resource.tcl

# ========================================================================
# Default Script Options
# ========================================================================

set opt(bsapp)        "Application/BSApp" ;# BS application type
set opt(mtype)        ""                ;# No meta-data used
set opt(nn_)          [expr $opt(nn) - 1] ;# Number of non-BS nodes
set opt(bsID)        $opt(nn_)          ;# BS node number
set opt(bsCode)      0                  ;# Spreading code for BS
set opt(quiet)        1                  ;# 0=print info, 1=quiet

set opt(bw)          1e6                ;# 1 Mbps radio speed
set opt(delay)        1e-12              ;# Links delay
set opt(prop_speed)  3e8;                ;# Meters per second
set opt(ll)          RCALinkLayer        ;# Arpless link-layer
set opt(mac)          Mac/Sensor          ;# Sensor mac protocol
set opt(ifq)          Queue/DropTail      ;# DropTail Q
set opt(ifqlen)      100                ;# Max packets in ifq
set opt(netif)        Phy/WirelessPhy    ;# Wireless channel
set opt(ant)          Antenna/OmniAntenna ;# Omnidirectional antena

# Time required to transmit numbytes bytes of data
proc TxTime {numbytes} {
  global opt
  return [expr $numbytes*8/$opt(bw)]
}

set opt(hdr_size)    25                  ;# Bytes for header
set opt(sig_size)    500                ;# Bytes for data signal
# Packet transmission time
set opt(slot_time)    [expr [TxTime [expr $opt(sig_size)+$opt(hdr_size)]]]
# Spread-spectrum packet transmission time
set opt(ss_slot_time) [expr $opt(slot_time) * $opt(spreading)]
# Maximum TDMA frame time (if all nodes in one cluster)
set opt(frame_time)  [expr $opt(ss_slot_time) * $opt(nn_)]

set opt(ch_change)    [expr 10 * $opt(init_energy)]  ;# Time for each round
set opt(check_energy) 10                            ;# Time btwn energy traces

set opt(freq)          914e+6            ;# Carrier frequency
set opt(L)            1.0                ;# System (non-propogation) loss
set opt(Gt)            1.0                ;# Tx antenna gain
set opt(Gr)            1.0                ;# Rx antenna gain
set opt(ht)            1.5                ;# Antenna height
set opt(CSThresh)      1e-9              ;# Receive threshold is 1 nW
set opt(RXThresh)      6e-9              ;# Success threshold is 6 nW
set PI                3.1415926
set l                  [expr 3e8 / $opt(freq)]    ;# Wavelength of carrier

############################################################################
#
# Energy Models
#
############################################################################

# Efriss_amp = RXThresh * (4pi)^2 / (Rb Gt Gr lambda^2)
set opt(Efriss_amp)  [expr [expr 1.1 * $opt(RXThresh) * 16 * $PI * $PI] / \
                            [expr $opt(bw) * $opt(Gt) * $opt(Gr) * $l * $l]]
# Etwo_ray_amp = RXThresh / (Rb Gt Gr ht^2 hr^2)
set opt(Etwo_ray_amp) [expr 1.1 * $opt(RXThresh) / \
                      [expr $opt(bw) * $opt(Gt) * $opt(Gr) * \
                            $opt(ht) * $opt(ht) * $opt(ht) * $opt(ht)]]
set opt(EXcvr)        50e-9              ;# Energy for radio circuitry
set opt(e_bf)          5e-9              ;# Beamforming energy (J/bit)
set opt(Esense)        0                  ;# Sensing energy (J/bit)
set opt(thresh_energy) 0.00              ;# Threshold for power adaptation
set opt(Pidle)        0                  ;# Idle power (W)
set opt(Psleep)        0                  ;# Sleep power (W)


# ===== Get rid of the warnings in bind ================================
Resource/Energy set energyLevel_  $opt(init_energy)
Resource/Energy set alarmLevel_    $opt(thresh_energy)
Resource/Energy set expended_      0

Agent/RCAgent set sport_          0
Agent/RCAgent set dport_          0
Agent/RCAgent set packetMsg_      0
Agent/RCAgent set distEst_        0
Agent/RCAgent set packetSize_      0
Agent/BSAgent set packetMsg_      0
Agent/BSAgent set packetSize_      0
Agent/BSAgent set recv_code_      0

RCALinkLayer set delay_            25us
RCALinkLayer set bandwidth_        0   
RCALinkLayer set off_prune_        0   
RCALinkLayer set off_CtrMcast_    0 
RCALinkLayer set macDA_            0 
RCALinkLayer set debug_            0 
RCALinkLayer set avoidReordering_  0 

Phy/WirelessPhy set bandwidth_    $opt(bw)
Phy/WirelessPhy set CSThresh_      $opt(CSThresh)
Phy/WirelessPhy set RXThresh_      $opt(RXThresh)
Phy/WirelessPhy set Efriss_amp_    $opt(Efriss_amp)
Phy/WirelessPhy set Etwo_ray_amp_  $opt(Etwo_ray_amp)
Phy/WirelessPhy set EXcvr_        $opt(EXcvr)
Phy/WirelessPhy set freq_          $opt(freq)
Phy/WirelessPhy set L_            $opt(L)
Phy/WirelessPhy set sleep_        0
Phy/WirelessPhy set alive_        1
Phy/WirelessPhy set ss_            $opt(spreading)
Phy/WirelessPhy set dist_          0

Antenna/OmniAntenna set Gt_        $opt(Gt)
Antenna/OmniAntenna set Gr_        $opt(Gr)
Antenna/OmniAntenna set Z_        $opt(ht)

set MacTrace                      OFF
Mac set bandwidth_                $opt(bw)
Mac/Sensor set code_              0
Mac/Sensor set node_num_          0
Mac/Sensor set ss_                $opt(spreading)
Mac/Sensor set CHheard_            0
Mac/Sensor set myADVnum_          0

set bs[list $opt(bs_x) $opt(bs_y)]
set BS_NODE 1

set outf [open "$opt(dirname)/conditions.txt" a]
puts $outf "Simulation will stop after $opt(stop) seconds."
puts $outf "Base station at ($opt(bs_x), $opt(bs_y))"
if {$opt(eq_energy) == 1} {
  puts $outf "Each node starting with $opt(init_energy) Joules of energy.\n"
}
puts $outf "Energy Model:"
puts $outf "\t\tRXThresh = $opt(RXThresh)"
puts $outf "\t\tCSThresh = $opt(CSThresh)"
puts $outf "\t\tRb = $opt(bw)"
puts $outf "\t\tExcvr = $opt(EXcvr)"
puts $outf "\t\tEfriss_amp = $opt(Efriss_amp)"
puts $outf "\t\tEtwo_ray_amp = $opt(Etwo_ray_amp)"
puts $outf "\t\tEbf = $opt(e_bf)"
puts $outf "\t\tPidle = $opt(Pidle)"
puts $outf "\t\tPsleep = $opt(Psleep)\n"
close $outf

set initialized 0
set rng_ [new RNG]

proc leach-create-mobile-node { id } {
    global ns_ chan prop topo tracefd opt node_
    global initialized BS_NODE rng_

    if {$initialized == 0} {
      sens_init
      set initialized 1
    }

    # Create nodes.
    if {$id != $opt(nn_)} {
      puts -nonewline "$id "
      set node_($id) [new MobileNode/ResourceAwareNode]
    } else {
      puts "($opt(nn_) == BS)"
      set node_($id) [new MobileNode/ResourceAwareNode $BS_NODE]
    }

    set node $node_($id)
    if {$id != $opt(nn_)} {
      # Set initial node energy.
      if {$opt(eq_energy) == 1} {
        $node set-energy $opt(init_energy) $opt(thresh_energy)
      } else {
        #set E [$rng_ uniform $opt(lower_e) $opt(upper_e)]
        #set rn [$rng_ uniform 0 1]
        #if {$rn < 0.1} {
        #  set E 200
        #} else {
        #  set E 2
        #}
        set high_e_nodes[list 97 19 12 87 8 22 83 55 34 72]
        if {[lsearch $high_e_nodes $id] == -1} {
          set E 2
        } else {
          set E 200
        }
        $node set-energy $E $opt(thresh_energy)
        set initf [open "$opt(dirname)/init.energy" a]
        puts $initf "$id\t$E"
        close $initf
      }
    } else {
      # Base station has an infinite amount of energy.
      $node set-energy 50000 $opt(thresh_energy)
    }

    # Disable random motion.
    $node random-motion 0     
    $node topography $topo

    if ![info exist inerrProc_] {
        set inerrProc_ ""
    }
    if ![info exist outerrProc_] {
        set outerrProc_ ""
    }
    if ![info exist FECProc_] {
        set FECProc_ ""
    }

    # Connect the node to the channel.
    $node add-interface $chan $prop $opt(ll) $opt(mac)  \
      $opt(ifq) $opt(ifqlen) $opt(netif) $opt(ant) \
      $topo $inerrProc_ $outerrProc_ $FECProc_

    # Set up the trace target.
    set T [new Trace/Generic]
    $T target [$ns_ set nullAgent_]
    $T attach $tracefd
    $T set src_ $id
    $node log-target $T

    $ns_ at 0.0 "$node_($id) start-app"
}

proc sens_init {} {

    global ns_ opt ns

    # The timer code has hard-coded the global variable ns to
    # be the simulator.
    set ns $ns_

    # Remove old trace files.
    catch "eval exec rm [glob -nocomplain $opt(dirname)/TDMAschedule.*.txt]"
    catch "exec rm $opt(dirname)/$opt(filename).energy"
    catch "exec rm $opt(dirname)/$opt(filename).data"
    catch "exec rm $opt(dirname)/$opt(filename).alive"
    catch "exec rm $opt(dirname)/startup.energy"
    catch "exec rm $opt(dirname)/init.energy"

    puts "Creating sensor nodes..."
 
    sens_init_stats "$opt(dirname)/$opt(filename)"

    $ns_ at $opt(stop) "sens_finish"
    # Start logging simulation statistics.
    $ns_ at $opt(check_energy) "sens_gather_stats"
}

but in leach.err i still get an error like this
Code:

couldn't read file "/opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl": no such file or directory
    while executing
"source.orig /opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source /opt/ns-allinone-2.34/ns-2.34/mit/rca/ns-ranode.tcl"
    (file "mit/uAMPS/sims/uamps.tcl" line 10)
    invoked from within
"source.orig mit/uAMPS/sims/uamps.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source mit/uAMPS/sims/uamps.tcl"
    (file "tcl/mobility/leach.tcl" line 18)
    invoked from within
"source.orig tcl/mobility/leach.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source tcl/mobility/$opt(rp).tcl"
    (file "tcl/ex/wireless.tcl" line 187)

Also i get the leach.out file as an empty file and as usual the get the warnings on the console.
Please help me out.

Regards

You should run ‘make clean‘ and ‘make’.

scoder 03-06-2012 12:15 AM

LEACH in ns2.34
 
hey guys,
after following all the instructions, iam at 'make' now..and getting following error::

mac/mac-802_11.cc: In constructor ‘Mac802_11::Mac802_11()’:
mac/mac-802_11.cc:190: error: no matching function for call to ‘BeaconTimer::BeaconTimer()’
mac/mac-timers.h:97: note: candidates are: BeaconTimer::BeaconTimer(Mac802_11*)
mac/mac-timers.h:95: note: BeaconTimer::BeaconTimer(const BeaconTimer&)
mac/mac-802_11.cc:190: error: no matching function for call to ‘ProbeTimer::ProbeTimer()’
mac/mac-timers.h:105: note: candidates are: ProbeTimer::ProbeTimer(Mac802_11*)
mac/mac-timers.h:103: note: ProbeTimer::ProbeTimer(const ProbeTimer&)
make: *** [mac/mac-802_11.o] Error 1


kindly help!!

knudfl 03-07-2012 04:07 AM

# 222.

Wrong OS ? Wrong compiler ? Please specify.


I.e the used Linux OS should be specified by every question ..
http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html

.

khushbushah 03-07-2012 05:36 AM

How to analyse data in leach on ns2.34
 
Hi
I want to know that how to work with leach.out file and leach.tr file
I want to plot graph for avg. energy consumption ,control overhead, network lifetime,avg.delivery ratio, load balancing at each node...etc.....
I have awk file for leach which can be used for end-to-end delay and throughput

http://mohittahiliani.blogspot.in/20...s-for-ns2.html

total no.of dropped packets are 0 and end to end delays is also always 0 when I measure with my leach.tr file

can anyone please help me? Leach protocol also generate TDMA schedule but i dont knw how can we use for our analysis?
Please its urgent....

deepa_2111 03-07-2012 08:25 AM

#222,

scoder,

I think you are using the wrong MAC layer
Did you include the mac files written for LEACH ?

deepa_2111 03-07-2012 08:27 AM

#224,

To claculate the delay, I wrote separate post processing functions which takes leach.out and the TDMA schedules as input. I was not sure of working with leach.tr

shailu 03-14-2012 11:42 PM

i did all the steps mentioned to run leach in ns2.34 but i got some error in leach.err and no output in leach.out. can you help me out.

shailu 03-15-2012 01:20 AM

@ everyone
i did all the written steps. but after i run ./test i get leach.err which says invalid command name resource/energy and m using ubuntu 11.10 and i have installed everyhing in gcc 4.4.i tried changing the version 4.3 as mentioned but i culd not. i need help.

Alexsan 03-16-2012 07:10 AM

no such variable error when executing tcl script
 
[root@Alexsan anonymity-mix]# ns mixroute.tcl
can't read "mixagent_": no such variable
while executing
"set entry_point_ $mixagent_"
(file "mix.tcl" line 11)
invoked from within
"source.orig mix.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mix.tcl"
(file "mixroute.tcl" line 73)
plz anyone can reply me with the answer

knudfl 03-16-2012 09:22 AM

Post #229, @Alexan : Welcome to LQ.
This thread is about {LEACH + ns-2.34} only.
Please do not ask off topic questions in another LQ members thread.
Start your own thread http://www.linuxquestions.org/questions/linux-newbie-8/
> New Thread.

mixroute.tcl :
http://orbit.dtu.dk/app;jsessionid=1...304962bcb545a3
.

shailu 03-16-2012 08:59 PM

i tried with ubuntu 10.10 too but i again get same result with leach.err that resource/energy failed. i went to the site that has given gcc4.1 and installed it tried running make file. i am not able to do it. could you please help me..

knudfl 03-17-2012 04:29 AM

#231, @shailu : Welcome to LQ. Use a gcc/g++ 4.1 compiler: Install g++-4.1.
Ubuntu 10.10 , Synaptic :
Settings > Repositories > Other Software
... Tick the 3 Lucid entries, and then "Reload".
Now the g++-4.1 package can be installed. (Binary names = gcc-4.1, g++-4.1).

Or install the g++41-compat :
sudo dpkg -i gcc41-compat-4.1.2_i386.deb g++41-compat-4.1.2_i386.deb

gcc41-compat https://docs.google.com/open?id=0B7S...RjNjJhOTZjNjI2
g++41-compat https://docs.google.com/open?id=0B7S...hjMjljN2M2MGU4
( Binary names = gcc41, g++41 ).


About leach.err : Please read the other "Long LEACH thread" ..
http://www.linuxquestions.org/questi...2-27-a-785379/

.

shailu 03-18-2012 01:22 AM

i see a lot of people having trouble just the way i am having, to install leach with ns2. its been 15 days i've been reading forums and try installing. but sadly i couldn't. i request the experts, if possible, could you please make some virtual image(possiblye vmware) with ns2(leach) installed, and upload it somewhere?. a lot of us come from windows background, and most of us are using ns2 in virtual environment anyway. this can be a lifesaver for most of us.
thanks

TSE_2011 03-19-2012 12:32 PM

Install Leach in fedora14
 
hi.
please say me Impelemention Leach Algorithm in Fedroa 14 & ns-2.34.
please say me from first.because i am Amatuor in subject.
Tnx

TSE_2011 03-19-2012 05:10 PM

Response
 
void format_imep(Packet *p, int offset);
void format_aodv(Packet *p, int offset);
void format_aomdv(Packet *p, int offset);
#ifdef MIT_uAMPS
void format_rca(Packet *p, int offset);
#endif
#ifdef MIT_uAMPS
#define ADV_CHAR 'A'
#define REQ_CHAR 'R'
#define DATA_CHAR 'D'
#endif

add these lines to CMU_Trace.h to class CMUTrace

TSE_2011 03-19-2012 05:12 PM

void format_imep(Packet *p, int offset);
void format_aodv(Packet *p, int offset);
void format_aomdv(Packet *p, int offset);
#ifdef MIT_uAMPS
void format_rca(Packet *p, int offset);
#endif
#ifdef MIT_uAMPS
#define ADV_CHAR 'A'
#define REQ_CHAR 'R'
#define DATA_CHAR 'D'
#endif

add these lines to CMU_Trace.h to class CMUTrace

TSE_2011 03-19-2012 05:13 PM

???

TSE_2011 03-19-2012 06:17 PM

deepa_2111.
Tnx About all thing.

but i want see Wave figure for energy,coverage ... in leach
What should I do?
please help me...

shailu 03-22-2012 02:51 AM

@knudfl
Thanks i finally managed to install leach with ns2.34. :D

TSE_2011 03-22-2012 03:27 AM

hi shailu.

i install ns-2.34 & leach Protocol in ns2.
i want see out graph leach but i'v this message after enter instruction ns leach.tcl:
couldn't read file "mit/uAMPS/ns-leach.tcl": no such file or directory
while executing
"source.orig mit/uAMPS/ns-leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/ns-leach.tcl"
(file "leach.tcl" line 7)
plz help;

shailu 03-22-2012 08:32 PM

Hello TSE_2011
u have to provide path in the uAMPS directory. the answer is given by deepa in few page ahead in this same thread try that it will work.

prat810 03-28-2012 08:05 AM

@deepa_2111...need help..!! what to do
 
leach.err:

invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/home/sameep/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/sameep/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source /home/sameep/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 30)
invoked from within
"source.orig mit/uAMPS/sims/uamps.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/sims/uamps.tcl"
(file "tcl/mobility/leach.tcl" line 18)
invoked from within
"source.orig tcl/mobility/leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)

deepa_2111 03-29-2012 08:43 AM

Hi prat,

you have to give the proper address of your libraries.

prat810 03-29-2012 09:51 AM

@deepa_2111.....
 
where do i change the addresses of libraries...am unable to detect the value to change..!!
please can u give alittle detail on the three errors..??

auvikuet 03-30-2012 02:32 AM

sorry for the duplicate post

naitikshah 04-04-2012 04:26 AM

Leach on ns2.34 in ubuntu 11.10
 
Hi frndzz,

I want help to install leach on ns2.34 in ubuntu 11.10.
Will the steps given for installation in Post 5 work? Ubuntu 11.10 doesnot have gcc4.3 ....
I have gcc 4.4 and 4.6 installed.

knudfl 04-04-2012 05:04 AM

Post #246 , @naitikshah : Welcome to LQ.

No Ubuntu version can use gcc-4.3 for ns-2.xx any more, I think.
That was more than a year ago.
Some packages got updated. Now it's gcc-4.1 for ns-2.33 , ns-2.34 etc.
And : Ubuntu 11.04, 11.10 ( 12.04 ? ) cannot use old Ubuntu gcc compilers.

There is a fix to install ns-2.34 to Ubuntu 11.10 :
http://erl1.wordpress.com/2011/10/14...neiric-ocelot/
.. But no guarantees with the validate result / leach result.
If it must be Ubuntu : 10.04 produces the best result.
Default OS for ns2 is CentOS 6 ( or CentOS 5 or any Fedora.)

LEACH, ns234 : Please read posts #9, #11 here
http://www.linuxquestions.org/questi...dora13-907076/

.

engr 04-04-2012 05:14 PM

mobility models to leach
 
hi everyone..!
i have installed leach on ns2.34 successfully thnx alot.
now but now i dont know how to generate graphs :( plz help me.
plz help me to add mobility models to leach.. its urgent plz
Regards

meprogrammer 04-06-2012 10:16 AM

Quote:

Originally Posted by prat810 (Post 4638706)
leach.err:

invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/home/sameep/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/sameep/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source /home/sameep/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 30)
invoked from within
"source.orig mit/uAMPS/sims/uamps.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/sims/uamps.tcl"
(file "tcl/mobility/leach.tcl" line 18)
invoked from within
"source.orig tcl/mobility/leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)

I have the same problem than u please tell me what I should do to resolve it

naitikshah 04-13-2012 01:59 PM

@ knudfl

As per your explanation I have successfully installed leach on ns2.34 on ubuntu 10.04. Thank you for that.

But now I have a doubt regarding the output of it.
By default the number of clusters are set to 5. What does that mean? Does it mean that the number of clusters should be exactly 5 till the end or that they cant be more than 5 or etc?

The reason why I am asking is that my TDMA Schedule files show the number of clusters varying from 1 to 8.


All times are GMT -5. The time now is 05:00 PM.