ورود

View Full Version : مشکل در اجرای فایل های شبیه سازی شده بیسیم در NS2



ahgrab
یک شنبه 30 بهمن 1390, 21:33 عصر
سلام خسته نباشید

من NS2 تو محیط ویندوز نصب کردم با استفاده از cygwin ،همه چی درست نصب شده و کار میکنه اما فقط برا ی شبکه

سیمی جوا ب میده و برا ی بقیه اطلا جواب نمیده؟

NS هم این ورژن نصب کردم ns-allinone-2.34

چیکار باید بکنم ؟خواهش میکنم کمکم کنید.؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟

aram_2
دوشنبه 01 اسفند 1390, 10:02 صبح
خب از کجا می فهمید که برا سیمی جواب نمیده..بیشتر توضیح بدید

ahgrab
دوشنبه 01 اسفند 1390, 11:57 صبح
سلام خب فایل های که شبکه سیمی هستند و اجرا میکنه و جواب میده

اما برا فایل های بیسیم جواب نمیده؟

ahgrab
دوشنبه 01 اسفند 1390, 12:08 عصر
برا مثال این اجرا میشه

set ns [new Simulator]

#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red

#Open the Trace file
set file1 [open out.tr w]
$ns trace-all $file1

#Open the NAM trace file
set file2 [open out.nam w]
$ns namtrace-all $file2

#Define a 'finish' procedure
proc finish {} {
global ns file1 file2
$ns flush-trace
close $file1
close $file2
exec nam out.nam &
exit 0
}

# Next line should be commented out to have the static routing
$ns rtproto DV

#Create six nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]

#Create links between the nodes
$ns duplex-link $n0 $n1 0.3Mb 10ms DropTail
$ns duplex-link $n1 $n2 0.3Mb 10ms DropTail
$ns duplex-link $n2 $n3 0.3Mb 10ms DropTail
$ns duplex-link $n1 $n4 0.3Mb 10ms DropTail
$ns duplex-link $n3 $n5 0.5Mb 10ms DropTail
$ns duplex-link $n4 $n5 0.5Mb 10ms DropTail

#Give node position (for NAM)
$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n1 $n2 orient right
$ns duplex-link-op $n2 $n3 orient up
$ns duplex-link-op $n1 $n4 orient up-left
$ns duplex-link-op $n3 $n5 orient left-up
$ns duplex-link-op $n4 $n5 orient right-up


#Setup a TCP connection
set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink/DelAck]
$ns attach-agent $n5 $sink
$ns connect $tcp $sink
$tcp set fid_ 1

#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP

$ns rtmodel-at 1.0 down $n1 $n4
$ns rtmodel-at 4.5 up $n1 $n4

$ns at 0.1 "$ftp start"

$ns at 6.0 "finish"

$ns run

ahgrab
دوشنبه 01 اسفند 1390, 12:10 عصر
اما برا این خطا میده.

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

# ================================================== ====================
# Define options
# ================================================== ====================

set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) Queue/DropTail/PriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(x) 670 ;# X dimension of the topography
set val(y) 670 ;# Y dimension of the topography
set val(ifqlen) 50 ;# max packet in ifq
set val(seed) 0.0
set val(adhocRouting) DSR
set val(nn) 3 ;# how many nodes are simulated
set val(cp) "../mobility/scene/cbr-3-test"
set val(sc) "../mobility/scene/scen-3-test"
set val(stop) 400.0 ;# simulation time

# ================================================== ===================
# Main Program
# ================================================== ====================

#
# Initialize Global Variables
#

# create simulator instance

set ns_ [new Simulator]

# setup topography object

set topo [new Topography]

# create trace object for ns and nam

set tracefd [open wireless1-out.tr w]
set namtrace [open wireless1-out.nam w]

$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

# define topology
$topo load_flatgrid $val(x) $val(y)

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

#
# define how node should be created
#

#global node setting

$ns_ node-config -adhocRouting $val(adhocRouting) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF

#
# Create the specified number of nodes [$val(nn)] and "attach" them
# to the channel.

for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}


#
# Define node movement model
#
puts "Loading connection pattern..."
source $val(cp)

#
# Define traffic model
#
puts "Loading scenario file..."
source $val(sc)

# Define node initial position in nam

for {set i 0} {$i < $val(nn)} {incr i} {

# 20 defines the node size in nam, must adjust it according to your scenario
# The function must be called after mobility model is defined

$ns_ initial_node_pos $node_($i) 20
}


#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).0 "$node_($i) reset";
}

$ns_ at $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"

puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocRouting)"
puts $tracefd "M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)"
puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"

puts "Starting Simulation..."
$ns_ run

Yama12
پنج شنبه 03 فروردین 1391, 00:19 صبح
سلام یه سوال.
برای نوشتن به زبان tcl برای ns2 از چه محیطی میشه استفاده کرد که شبی مثلا ویژوال سی شارپ خودش کتابخونه هارو داشته باشه و تو پرانتز گذاری کمک کنه

princoo
جمعه 01 اردیبهشت 1391, 22:56 عصر
تو هر محیط متنی می تونید بنویسید فقط پسوند فایل tcl باشد

pencel_2004
سه شنبه 04 مهر 1391, 10:35 صبح
salam man ham daghighan moshkele shoma ro daram. baraye shabake simi ns2 be khobi suport mikone , baraye shabake bi sim ham javab mideh vali kami zaif hast.
ageh dar in rabete betonim beham komak konim khaili khob mishe. man az ns-2 bekhatre prozham estefadeh mikonam vase hamin baraye tahvile prozham ziad vaght nadaram .
emaile man pencel_2004@yahoo.com hast ye email behem bezan
taaanx.................

pencel_2004
یک شنبه 09 مهر 1391, 12:53 عصر
پس چرا کسی جواب نمیده!!!!!!!!!!! مدیر لااقل تو جواب بده............!!!

aram_2
چهارشنبه 12 مهر 1391, 09:10 صبح
یه با دیگه مشکل و خطا رو بذار.کد tcl رو نذار فقط خطاشو بذار.