LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-07-2014, 12:05 PM   #1
kien2106
LQ Newbie
 
Registered: Apr 2014
Posts: 6

Rep: Reputation: Disabled
Error in mannasim simulation in ns2.35


Hi there !
I am newbie about network simulation.Right now i am worrking on project related to wireless sensor network.I am using mannasim in ns2.35 .After writting tcl file but when i begin run .Some error look like this appear:
{
Setting up mica 2 mote with Antenna/OmniAntenna and range = 10000
invalid command name "Node/MobileNode/SensorNode"
while executing
"Node/MobileNode/SensorNode set sensingPower_ 0.015"
(procedure "setup_mica2" line 18)
invoked from within
"setup_mica2 $val(antenna) $val(range)"
(file "exam.tcl" line 398)
}



Here is my code ,if any one have expericen in solving this problem,please help me :





# Generated by MannaSim
# http://www.mannasim.dcc.ufmg.br/

puts "Initializing MannaSim Script..."

#Consumo de energia do sensor node - Dados do Mica Motes
set mica(sensing_power) 0.015 ;# i = 5mA, V = 3 --> P = ixV = 15 mW = 0.015 W
set mica(processing_power) 0.024 ;# i = 8mA, V = 3 --> P = ixV = 24 mW = 0.024 W
set mica(instructions_per_second) 8000000 ;# Atmel 128L 8MHZ --> 8MIPS

#Consumo de energia do sensor node - Dados do WINS
set wins(sensing_power) 0.064 ;# 64 mW = 0.064 W
set wins(processing_power) 0.360 ;# 360 mW = 0.360 W
set wins(instructions_per_second) 150000000 ;# Intel StrongArm 1100 133 MHZ --> 150 MIPS

#Seta valores para consumo de energia com o radio
set mica(consumo_transmissao) 0.036 ;#i = 12mA, V = 3 --> P = ixV = 36mW = 0.036W
set mica(consumo_recepcao) 0.024 ;#i = 8mA, V = 3 --> P = ixV = 24mW = 0.024W

set wins(consumo_transmissao) 3.75 ;# 3.75 250m, 0.6 600 mW - 100m
set wins(consumo_recepcao) 1.875 ;# 1.875 250m, 0.3 300 mW

#seta a taxa de transmissao
#Phy/WirelessPhy set bandwidth_
set mica(taxa_transmissao) 28.8*10e3 ;#28.8 kbps
set wins(taxa_transmissao) 100*10e3 ;#100 kbps

proc setup_mica2 { antenna range } {

puts "Setting up mica 2 mote with $antenna and range = $range"

#Phy/WirelessPhy set CPThresh_ 10.0
#Phy/WirelessPhy set CSThresh_ 1.559e-11
#Phy/WirelessPhy set RXThresh_ 2.78869e-09 ; # 100 meters
#Phy/WirelessPhy set RXThresh_ 1.11548e-08 ; # 50 meters
#Phy/WirelessPhy set Rb_ 2*1e6

Phy/WirelessPhy set Pt_ 0.281838
Phy/WirelessPhy set freq_ 2.4e09
Phy/WirelessPhy set L_ 1.0
Phy/WirelessPhy set lambda_ 0.125
Phy/WirelessPhy set RXThresh_ [TwoRay 0.281838 [$antenna set Gt_] [$antenna set Gr_] 0.8 0.8 1.0 $range 0.125]
Phy/WirelessPhy set bandwidth_ 28.8*10e3 ;#28.8 kbps

Node/MobileNode/SensorNode set sensingPower_ 0.015
Node/MobileNode/SensorNode set processingPower 0.024
Node/MobileNode/SensorNode set instructionsPerSecond_ 8000000

}

##########################################
# CONSTANTES
#########################################
# Continuo: 0
# Programada: 1
# Sob Demanda: 2
########################################

proc create_common_app {destination_id disseminating_type disseminating_interval} {
global val
#kien
set app_ [new $val(commonApp)]
$app_ set destination_id_ $destination_id
$app_ set disseminating_type_ $disseminating_type
$app_ set disseminating_interval_ $disseminating_interval
return $app_
}
#kien


set val(commonApp) "Application/SensorBaseApp/CommonNodeApp"
set val(chApp) "Application/SensorBaseApp/ClusterHeadApp"
set val(apApp) "Application/AccessPointApp"

proc create_cluster_head_app {destination_id disseminating_type disseminating_interval} {
global val
set app_ [new $val(chApp)]
$app_ set destination_id_ $destination_id
$app_ set disseminating_type_ $disseminating_type
$app_ set disseminating_interval_ $disseminating_interval
return $app_
}

proc create_access_point_app {outside_network} {
global val
set app_ [new $val(apApp)]
$app_ set outside_network_ $outside_network
return $app_
}

proc create_temp_data_generator {sensing_interval sensing_type avg_measure std_deviation maximumTemperatureAllowedValue} {
set temp_gen_ [new DataGenerator/TemperatureDataGenerator]
$temp_gen_ set sensing_interval_ $sensing_interval
$temp_gen_ set sensing_type_ $sensing_type
$temp_gen_ set avg_measure $avg_measure
$temp_gen_ set std_deviation $std_deviation
$temp_gen_ set maximumTemperatureAllowedValue_ $maximumTemperatureAllowedValue
return $temp_gen_
}

proc create_data_generator {generator sensing_interval sensing_type avg_measure std_deviation maximumTemperatureAllowedValue} {
set temp_gen_ [new DataGenerator/$generator]
$temp_gen_ set sensing_interval_ $sensing_interval

if {$sensing_type=="continuous"} {
$temp_gen_ set sensing_type_ 0
} elseif {$sensing_type=="programmed"} {
$temp_gen_ set sensing_type_ 1
} elseif {$sensing_type=="on demand"} {
$temp_gen_ set sensing_type_ 2
} else {
$temp_gen_ set sensing_type_ $sensing_type
}
$temp_gen_ set avg_measure $avg_measure
$temp_gen_ set std_deviation $std_deviation
$temp_gen_ set maximumTemperatureAllowedValue_ $maximumTemperatureAllowedValue
return $temp_gen_
}

proc create_common_node { iniEnergy x y z father_addr start stop } {
global val ns_ node_ topo udp_ app_ gen_ contador_nodos rng trace

if { [llength $start] == 0 } {
set start [expr $val(start) + [$rng uniform 0 1]]
set stop $val(stop)
}

$ns_ node-config -sensorNode ON \
-adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(antenna) \
-propType $val(prop) \
-energyModel $val(en) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace $trace(agent) \
-routerTrace $trace(router) \
-macTrace $trace(mac) \
-rxPower 0.024 \
-txPower 0.036 \
-initialEnergy $iniEnergy \
-movementTrace $trace(movement)

#kien
# set god_ [create-god $val(nn)]
# set god_ [God instance]
set node_($contador_nodos) [$ns_ node]
$node_($contador_nodos) color black
$node_($contador_nodos) random-motion 0
$god_ new_node $node_($contador_nodos)
#kien


# set x [$rng uniform 0.0 $val(x)]
# set y [$rng uniform 0.0 $val(y)]

# set bla [expr int(sqrt($val(nn)))]
# set x [expr (($contador_nodos) % $bla) * $val(x) / ($bla - 1)]
# set y [expr (($contador_nodos) / $bla) * $val(y) / ($bla - 1)]

$node_($contador_nodos) set X_ $x
$node_($contador_nodos) set Y_ $y
$node_($contador_nodos) set Z_ $z

puts "* Node [$node_($contador_nodos) node-addr] = $contador_nodos created in ($x, $y, $z)"
#kien
set app_($contador_nodos) [create_common_app $father_addr $val(disseminating_type) $val(disseminating_interval)]

set udp_($contador_nodos) [new Agent/UDP]
$node_($contador_nodos) attach $udp_($contador_nodos) $val(port)

$node_($contador_nodos) add-app $app_($contador_nodos)

set processing_($contador_nodos) [new $val(processing)]

$app_($contador_nodos) node $node_($contador_nodos)
$app_($contador_nodos) attach-agent $udp_($contador_nodos)


$app_($contador_nodos) attach-processing $processing_($contador_nodos)
$processing_($contador_nodos) node $node_($contador_nodos)

for { set i 0 } { $i < [llength $start] } { incr i } {
$ns_ at $start "$app_($contador_nodos) start"
}

for { set i 0 } { $i < [llength $stop] } { incr i } {
$ns_ at $stop "$app_($contador_nodos) stop"
}
#kien

#[create_temp_data_generator 5.0 0 27.0 10.0 50]
set gen_($contador_nodos) $val(data_generator)

$app_($contador_nodos) attach_data_generator $gen_($contador_nodos)

incr contador_nodos

}

#kien
proc create_access_point { iniEnergy x y z start stop} {
global ns_ val node_ app_ udp_ contador_nodos topo trace rng

if { [llength $start] == 0 } {
set start [expr $val(start) + [$rng uniform 0 1]]
set stop $val(stop)
}

$ns_ node-config -sensorNode ON \
-adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(antenna) \
-propType $val(prop) \
-energyModel $val(en) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace $trace(agent) \
-routerTrace $trace(router) \
-macTrace $trace(mac) \
-rxPower 0.5 \
-txPower 0.5 \
-initialEnergy $iniEnergy \
-movementTrace $trace(movement)

set node_($contador_nodos) [$ns_ node]
$node_($contador_nodos) color black
$node_($contador_nodos) random-motion 0
$god_ new_node $node_($contador_nodos)

set app_($contador_nodos) [create_access_point_app [$node_(0) node-addr]]

set udp_($contador_nodos) [new Agent/UDP]
$node_($contador_nodos) attach $udp_($contador_nodos) $val(port)
$app_($contador_nodos) attach-agent $udp_($contador_nodos)

$node_($contador_nodos) set X_ $x
$node_($contador_nodos) set Y_ $y
$node_($contador_nodos) set Z_ $z

puts "* Access point [$node_($contador_nodos) node-addr] = $contador_nodos created in ($x, $y, $z)"

for { set i 0 } { $i < [llength $start] } { incr i } {
$ns_ at $start "$app_($contador_nodos) start"
}

for { set i 0 } { $i < [llength $stop] } { incr i } {
$ns_ at $stop "$app_($contador_nodos) stop"
}

incr contador_nodos

}
###
# Grid distribution.

proc get_next_x {} {

global val

set aux [expr int(sqrt($val(nn)))]

return [expr (($contador_nodos) % $aux) * $val(x) / ($aux - 1)]

}

proc get_next_y {} {

global val

set aux [expr int(sqrt($val(nn)))]

return [expr (($contador_nodos) / $aux) * $val(y) / ($aux - 1)]

}

####
# Calculating the receiving threshold (RXThresh_ for Phy/Wireless)
# Wei Ye, weiye@isi.edu, 2000

proc Friis { Pt Gt Gr lambda L d} {
set M [expr $lambda / (4 * 3.14159265359 * $d)]
return [expr ($Pt * $Gt * $Gr * ($M * $M)) / $L]
}

proc TwoRay { Pt Gt Gr ht hr L d lambda } {
set crossover_dist [expr (4 * 3.14159265359 * $ht * $hr) / $lambda]

if { $d < $crossover_dist } {
return [Friis $Pt $Gt $Gr $lambda $L $d]
} else {
return [expr $Pt * $Gt * $Gr * ($hr * $hr * $ht * $ht) / ($d * $d * $d * $d * $L)]
}
}

###
proc set_default_settings {} {

global val


####
# Default network settings


set val(antenna) "Antenna/OmniAntenna"
Antenna/OmniAntenna set X_ 0 ;
Antenna/OmniAntenna set Y_ 0 ;
Antenna/OmniAntenna set Z_ 1.5 ;
Antenna/OmniAntenna set Gt_ 1.0 ;
Antenna/OmniAntenna set Gr_ 1.0 ;

set val(bandwidth) [Phy/WirelessPhy set bandwidth_]
set val(mac) Mac/802_11
set val(ifq) Queue/DropTail
set val(ifqlen) 200
set val(ll) LL
set val(rp) "AODV"
# Configuration adjustment
set val(leach) 0
}

set var(father_addr) 0
set var(port) 2020
set val(netif) Phy/WirelessPhy
# Global network settings
set_default_settings
set contador_nodos 0
set val(chan) Channel/WirelessChannel
# Propagation
set val(prop) Propagation/TwoRayGround
# Energy model
set val(en) EnergyModel/Battery

# Nodes
set val(n_pas) 1
set val(n_common) 100
set val(n_ch) 0
set val(nn) [expr $val(n_pas) + $val(n_common) + $val(n_ch)]

puts "\nNodes count:"
puts " - $val(n_pas) access points"
puts " - $val(n_common) common nodes"
puts " - $val(n_ch) cluster heads"
puts " - $val(nn) nodes"
puts " - $val(rp) routing protocol"
puts " - $val(ll) link layer"
puts " - $val(netif) network interface"

# Scenario size
set val(x) 1000.0
set val(y) 1000.0

puts "\nScenario size: $val(x) x $val(y)"
set val(start) 0.0
set val(stop) [expr $val(start) + 100.0]

set ns_ [new Simulator]


# Trace
puts "\nUsing trace.tr as trace file"
set traceFile [open trace.tr w]
$ns_ trace-all $traceFile

set namtrace [open trace.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

set trace(mac) ON
set trace(router) ON
set trace(agent) ON
set trace(movement) ON


set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
set rng [new RNG]
$rng seed [clock seconds]

#-------------------------------------------------------------------------------------------



# Creating an access point
puts "Creating an access point..."
set val(range) 10000
setup_mica2 $val(antenna) $val(range)
set local(x) 500.0
set local(y) 500.0
set local(z) 0.0
set local(start) ""
set local(stop) ""
set local(energy) 100.0

set val(apApp) Application/AccessPointApp
create_access_point $local(energy) $local(x) $local(y) $local(z) $local(start) $local(stop)

# Creating common node
puts "Creating common node..."
set val(range) 100
setup_mica2 $val(antenna) $val(range)

# Disseminating settings
set val(disseminating_type) 1 ;# Programmed
set val(disseminating_interval) 20.0
set local(start) ""
set local(stop) ""
set local(energy) 1000.0
set local(father_addr) $val(father_addr)
set val(processing) Processing/AggregateProcessing
set val(data_generator) "[create_data_generator {TemperatureDataGenerator} {5.0} {programmed} {25.0} {5.0} {30.0}]"

for { set common_node_i 0 } { $common_node_i < 100 } { incr common_node_i }
{

set local(x) [$rng uniform 0.0 $val(x)]
set local(y) [$rng uniform 0.0 $val(y)]
#set local(x) [get_next_x]
#set local(y) [get_next_y]
set local(z) 0.0
set val(commonApp) Application/SensorBaseApp/CommonNodeApp
create_common_node $local(energy) $local(x) $local(y) $local(z) $local(father_addr) $local(start) $local(stop)
}

for {set i 0} {$i < $val(nn)} {incr i} {
$ns_ initial_node_pos $node_($i) 50
}

$ns_ at [expr $val(stop)] "flush stdout"
$ns_ at [expr $val(stop)+0.0001] "finish"

proc finish {} {
global ns_ traceFile namtrace tempoInicio val

$ns_ flush-trace


$ns_ halt
$ns_ flush-trace
$ns_ nam-end-wireless $val(stop)

close $traceFile
close $namtrace

flush stdout

exit 0
}

puts "Starting Simulation..."
$ns_ run
#kien
 
Old 05-07-2014, 02:41 PM   #2
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
Welcome to LQ.

Can you edit your post to "Code Tags", please ?
Code (and error output) is supposed to be presented in `code tags´...
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
I.e. use the # button is the 'Advanced Editor',
or simply type [/code] at code end, and [code] at code start.

How to build ns-2.35 with mannasim :
https://github.com/paultsr/ns-allinone-2.35
>>> $ git clone https://github.com/paultsr/ns-allinone-2.35
$ cd ns-allinone-2.35/ && ./install
$ cd ns-2.35/
$ cp ns ns235-mannasim
$ sudo cp ns235-mannasim /usr/local/bin/ .
... Then you are absolutely sure that the right 'ns' is used :
$ ns235-mannasim exam.tcl

I did a couple of edits in your file, please see the attached output,
as it looks now. ( No »invalid command name "Node/MobileNode/SensorNode"«,
when mannasim works OK ?)
* Did you test your 'ns' with mannasim-rede-hierarquica.tcl, mannasim-rede-plana.tcl ?

Mannasim info http://www.linuxquestions.org/questions/tags/mannasim/
-
Attached Files
File Type: txt kien2106-exam.tcl.txt (12.3 KB, 125 views)
File Type: txt _kien2106-exam-output.txt (1.3 KB, 67 views)

Last edited by knudfl; 05-07-2014 at 03:08 PM.
 
Old 05-08-2014, 01:22 AM   #3
kien2106
LQ Newbie
 
Registered: Apr 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for your attention Mr Knudfl !.Sorry because i am a newbie of this forum

When i run command ns kien2106-exam.tcl it show the result

Code:
Initializing MannaSim Script...

Nodes count:
 - 1 access points
 - 100 common nodes
 - 0 cluster heads
 - 101 nodes
 - AODV routing protocol
 - LL link layer
 - Phy/WirelessPhy network interface

Scenario size: 1000.0 x 1000.0

Using trace.tr as trace file
num_nodes is set 101
Creating an access point...
Setting up mica 2 mote with Antenna/OmniAntenna and range = 10000
invalid command name "Node/MobileNode/SensorNode"
    while executing
"Node/MobileNode/SensorNode set sensingPower_ 0.015"
    (procedure "setup_mica2" line 18)
    invoked from within
"setup_mica2 $val(antenna) $val(range)"
    (file "kien2106-exam.tcl" line 404)
but when i run command ./ns kien2106-exam.tcl it show the result same as the output of you
i run sucessfully 2 file mannasim-rede-hierarquica.tcl and mannasim-rede-plana.tcl by command ./ns

Last edited by kien2106; 05-08-2014 at 09:20 PM.
 
Old 05-08-2014, 06:55 AM   #4
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
# 3 .
Quote:
When I run command ns kien2106-exam.tcl it show
The wrong 'ns' is used. Read post #2 :
Do not use the naming "ns". Unless for a default unpatched ns-2.xx.


Quote:
when I run command ./ns kien2106-exam.tcl it show the result same as .. you
That's when the "ns -mannasim" is used.
Make a copy of that one : 1) $ cp ns ns235-mannasim
2) $ sudo cp ns235-mannasim /usr/local/bin/

Then please do :
a) $ ns235-mannasim mannasim-rede-plana.tcl
b) $ ns235-mannasim mannasim-rede-hierarquica.tcl
.... to test the executable ``ns235-mannasim´´

P.S. : Edit post #1 to 'Code Tags'.


-

Last edited by knudfl; 05-08-2014 at 08:13 AM.
 
1 members found this post helpful.
Old 05-08-2014, 02:54 PM   #5
kien2106
LQ Newbie
 
Registered: Apr 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for your help !
Could you do me one more favour.I read through 2 example mannasim-rede-plana.tcl and my example.But i haven't still didn't understand how to negotiate coordinate of each node in topology,is the coordinate of node in 3 example above was provided randomly ?
 
Old 05-08-2014, 05:44 PM   #6
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
# 5 .

Sorry, I can't answer that. Is beyond my knowledge.

Remark :
You are supposed to edit your posts to "Code tags" when you are asked to do so.
Editing : That's the ``Edit´´ button.

-
 
Old 05-08-2014, 09:22 PM   #7
kien2106
LQ Newbie
 
Registered: Apr 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
OK ,thanks Mr knudlf, i fixed it .
 
  


Reply

Tags
mannasim, mannasim-ns235, 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
[SOLVED] installed Mannasim Path on Ns2.34 . Now got error Aska123 Linux - Software 34 11-28-2014 10:15 AM
i have done a simulation in ns2 where i got these error ranjani Linux - Wireless Networking 3 02-03-2014 01:51 PM
want to install ns2.29.3 along with mannasim patch for ns2.29 jeevanpinto Linux - Software 4 10-02-2013 01:09 AM
NS2 WirelessMeshNetwork Simulation Error in add_interface uj100 Linux - Newbie 1 11-07-2012 02:29 PM
NS2 network simulation problem:Change queue parameters dynamically during simulation raeisy Linux - Networking 1 11-21-2010 12:30 PM

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

All times are GMT -5. The time now is 09:21 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