LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 08-31-2011, 05:52 PM   #1
AnasAmer
LQ Newbie
 
Registered: Aug 2011
Posts: 15

Rep: Reputation: Disabled
Diffusion (Rmst ) (Routing tables, reinforcement messages, )


Dear ns-2 users and developers
I have been working on ns2.29 using Directed Diffusion (RMST) to simulate my network.

1- I attached the rmst as DiffApp to the node that conflict NS2 that says agents should be attached to nodes and applications to the agents so should i create diffusion agents and attach it to the nodes before.


2- i managed to run the simulation with zigbee and in the trace file i can see packets being sent and received but as diffusion is defined to do gradient reinforcement so can i see the packets which execute these reinforcements in the trace file and what will they be labelled.

3- in term of packets forwarding i cannot see any packet being forwarded from the far nodes toward the rmst sink in the trace file so should i add the routing tables manually to each node or it is internally implemented in the diffusion application

i have added my scripts at the end

With all appreciate to any reply or suggestion
Regards
Anas


#===================================
# Simulation parameters setup
#===================================

set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type
set val(mac) Mac/802_15_4 ;# 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) 50 ;# max packet in ifq
set val(seed) 00.0
set val(nn) 20 ;# number of mobilenodes
set val(filters) GradientFilter ;# filters
set val(adhocRouting) Directed_Diffusion ;# routing protocol
set val(x) 400 ;# X dimension of topography
set val(y) 400 ;# Y dimension of topography
set val(stop) 80 ;# time of simulation end
set val(en) EnergyModel ;
set val(initialenergy) 10.0 ;

Phy/WirelessPhy set L_ 1.0 ;#System Loss Factor
Phy/WirelessPhy set freq_ 2.472e9 ;#channel
Phy/WirelessPhy set bandwidth_ 11Mb ;#Data Rate
Phy/WirelessPhy set Pt_ 1.8 ;#Transmit Power
Phy/WirelessPhy set CPThresh_ 100.0 ;#Collision Threshold
Phy/WirelessPhy set CSThresh_ 5.011872e-12 ;#Carrier Sense Power
Phy/WirelessPhy set RXThresh_ 5.82587e-09 ;#Receive Power Threshold
Mac/802_11 set dataRate_ 11Mb ;#Rate for ta Frames
Mac/802_11 set basicRate_ 1Mb ;#Rate for Control Frames


LL set mindelay_ 50us
LL set delay_ 25us
LL set bandwidth_ 0 ;# not used

Queue/DropTail/PriQueue set Prefer_Routing_Protocols 1
# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
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 the default ports
#Agent/UDP set sport_ 0
#Agent/UDP set dport_ 1
#Agent/Null set sport_ 2
#Agent/Null set dport_ 3
#Application/DiffApp/RmstSource set sport_ 4
#Application/DiffApp/RmstSink set dport_ 5
#===================================
# Initialization
#===================================
#Create a ns simulator
set ns_ [new Simulator]
$ns_ use-newtrace

#$ns_ puts "simulation starts"

# Create the God

set god_ [create-god $val(nn)]

#Setup topography object

set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)


#Open the NS trace file

set tracefile [open out.tr w]
$ns_ trace-all $tracefile

#Open the NAM trace file
set namfile [open rmst.nam w]
$ns_ namtrace-all $namfile
$ns_ namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)]; #Create wireless channel

#===================================
# Mobile node parameter setup
#===================================
#Setting the sensing nodes
#set val(adhocrouting) AODV
$ns_ node-config -adhocRouting $val(adhocRouting) \
-MPLS ON \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel $chan \
-topoInstance $topo \
-diffusionFilter $val(filters) \
-agentTrace ON \
-routerTrace OFF \
-macTrace ON \
-idlePower 1.0 \
-rxPower 1.0 \
-txPower 1.0 \
-sleepPower 0.001 \
-transitionPower 0.2 \
-transitionTime 0.005 \
-initialEnergy $val(initialenergy) \
-energyModel $val(en) \


#creating the desired number of nodes
for {set i 0} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node $i]
$node_($i) color black
$node_($i) random-motion 0 ;# disable random motion
$god_ new_node $node_($i)

}

#set the initial positions of the nodes
$node_(0) set X_ 31.454512011851
$node_(0) set Y_ 10.109707387821
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 135.041034335395
$node_(1) set Y_ 405.737513651467
$node_(1) set Z_ 0.000000000000
$node_(2) set X_ 188.743485780117
$node_(2) set Y_ 55.526538996380
$node_(2) set Z_ 0.000000000000
$node_(3) set X_ 196.784683952856
$node_(3) set Y_ 84.409070913002
$node_(3) set Z_ 0.000000000000
$node_(4) set X_ 130.960117964937
$node_(4) set Y_ 144.467582355546
$node_(4) set Z_ 0.000000000000
$node_(5) set X_ 101.263135569806
$node_(5) set Y_ 17.451727909492
$node_(5) set Z_ 0.000000000000
$node_(6) set X_ 44.470459863044
$node_(6) set Y_ 184.344972563850
$node_(6) set Z_ 0.000000000000
$node_(7) set X_ 456.787528356492
$node_(7) set Y_ 23.395449357632
$node_(7) set Z_ 0.000000000000
$node_(8) set X_ 150.887841448344
$node_(8) set Y_ 285.005548452296
$node_(8) set Z_ 0.000000000000
$node_(9) set X_ 454.820029810669
$node_(9) set Y_ 16.247174558093
$node_(9) set Z_ 0.000000000000
$node_(10) set X_ 38.147386846751
$node_(10) set Y_ 314.880165037484
$node_(10) set Z_ 0.000000000000
$node_(11) set X_ 353.290764145665
$node_(11) set Y_ 304.586930864975
$node_(11) set Z_ 0.000000000000
$node_(12) set X_ 376.563479617518
$node_(12) set Y_ 436.784908373668
$node_(12) set Z_ 0.000000000000
$node_(13) set X_ 169.123011449721
$node_(13) set Y_ 426.037760711241
$node_(13) set Z_ 0.000000000000
$node_(14) set X_ 104.142933190272
$node_(14) set Y_ 443.761913991179
$node_(14) set Z_ 0.000000000000
$node_(15) set X_ 370.331934892815
$node_(15) set Y_ 187.819583473372
$node_(15) set Z_ 0.000000000000
$node_(16) set X_ 34.298816727045
$node_(16) set Y_ 61.539912549849
$node_(16) set Z_ 0.000000000000
$node_(17) set X_ 104.367920828175
$node_(17) set Y_ 276.111349796681
$node_(17) set Z_ 0.000000000000
$node_(18) set X_ 266.513537483945
$node_(18) set Y_ 247.013554996536
$node_(18) set Z_ 0.000000000000
$node_(19) set X_ 189.999330444229
$node_(19) set Y_ 248.468574993653
$node_(19) set Z_ 0.000000000000
#$ns_ at 2 $node_(0) setdest 275.0 275.0 15
for {set i 0} {$i < $val(nn)} {incr i} {
$ns_ initial_node_pos $node_($i) 25
}
#$ns_ initial_node_pos $node_(1) 25
#$ns_ initial_node_pos $node_(2) 25

#set the diffusion agents
for {set i 0} {$i < $val(nn)} {incr i} {
set d_($i) [new Agent/Diffusion]
$node_($i) attach $d_($i) $i
}

#connect the agents
#$ns_ connect $d_(1) $d_(0)
#$ns_ connect $d_(2) $d_(0)

#define the rmstfilers
for {set i 0} {$i < $val(nn)} {incr i} {
set rmst_filter_($i) [new Application/DiffApp/RmstFilter]
$ns_ attach-diffapp $node_($i) $rmst_filter_($i)
}
#define the rmst source application and attach it to the diffusion agents

for {set i 1} {$i < $val(nn)} {incr i} {
set src_($i) [new Application/DiffApp/RmstSource]
$ns_ attach-diffapp $node_($i) $src_($i)
}
#set src_(2) [new Application/DiffApp/RmstSource]
#$ns_ attach-diffapp $node_(2) $src_(2)


#Define the rmst sink

set snk [new Application/DiffApp/RmstSink]
$ns_ attach-diffapp $node_(0) $snk

#start the schedule
#$ns_ at 0.5 "$src_(1) subscribe"
#$ns_ at 0.6 "$src_(1) start"
#$ns_ at 0.7 "$src_(2) subscribe"
#$ns_ at 0.8 "$src_(2) start"
#$ns_ at 0.2 "$snk subscribe"
#$ns_ at 0.3 "$snk start"

for {set i 1} {$i < $val(nn) } {incr i} {
$ns_ at [expr $i + 0.5] "$src_($i) subscribe"
#$ns_ at [expr $i + 0.7] "$src_() subscribe"
$ns_ at $i "$snk subscribe"
$ns_ at 0.1 "$rmst_filter_($i) start"
}
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {

$ns_ at $val(stop).000000001 "$node_($i) reset";
}
# define finish proc

proc finish {} {
global ns_ tracefile namfile
$ns_ flush-trace
$ns_ halt
#$ns_ nam-end-wireless $val(stop)
close $tracefile
close $namfile
exit 0
}

$ns_ at $val(stop).000002 "finish"
puts "Starting Simulation..."
#puts "address [$node_(0) node-addr]"
#puts "neighbors [$node_(0) neighbors]"
for {set j 0} {$j < 10} {incr j} {
for {set i 0} {$i < $val(nn)} {incr i} {
puts "port $j of node$i has agent [$node_($i) agent $j]"
#puts "port $j has agent [$node_(1) agent $j]"
#puts "port $j has agent [$node_(2) agent $j]"
}
}
$ns_ run
 
Old 05-22-2015, 10:02 PM   #2
do7dat
LQ Newbie
 
Registered: May 2015
Posts: 1

Rep: Reputation: Disabled
hi
if you sloved it , plz send me this project. I must simulate RMST in a sensor network for my project in university. I'm newbie and i'm very confused. Thank you in advance
 
  


Reply

Tags
ns2



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
routing tables props666999 Linux - Networking 1 10-14-2005 08:27 PM
Routing tables TPB Linux - Networking 3 07-27-2005 09:01 PM
IP Routing Tables collern2 Linux - Security 1 05-23-2005 10:48 AM
two routing tables fugzi Linux - Networking 7 12-03-2004 06:02 PM
routing tables help hadoque Linux - Networking 0 08-28-2004 09:10 AM

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

All times are GMT -5. The time now is 04:25 PM.

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