LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-24-2017, 02:11 PM   #1
h3am
LQ Newbie
 
Registered: Dec 2017
Posts: 3

Rep: Reputation: Disabled
ns2 "_o3 self class proc file optx opty"


hi
i have problem whit ns2
Code:
wrong # args: should be "_o3 self class proc file optx opty"
    (Simulator namtrace-all-wireless line 1)
    invoked from within
"$ns namtrace-all-wireless $namFile "
    (file "test6.tcl" line 19)
Code:
set val(chan)			Channel/WirelessChannel
set val(prop)			Propagation/TwoRayGround
set val(netif)			Phy/WirelessPhy
set val(mac)			Mac/Simple
set val(ifq)			Queue/DropTail/PriQueue   
set val(ll)				LL
set val(ant)			Antenna/OmniAntenna
set val(ifqlen)         50
set val(nn)				2
set val(rp)				DumbAgent  
set val(x)               250
set val(y)               250

set ns [new Simulator]
$ns use-newtrace
set traceFile [open out.tr w]
$ns trace-all $traceFile
set namFile [open out.nam w]
$ns namtrace-all-wireless $namFile 
	$val(x) $val(y)

set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
set chan_ [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) \
	-topoInstance $topo a-agentTrace ON \
	-routerTrace ON -macTrace ON \
	-movementTrace ON -channel $chan_
for {set i 0} {$i < $val(nn)} {incr i} {
set n($i) [$ns node]
$n($i) random-motion 0
}

$n(0) set x_ 20.0
$n(0) set y_ 20.0
$n(0) set z_ 0.0
$n(1) set x_ 120.0
$n(1) set Y_ 20.0
$n(1) set z_ 0.0


$ns at 0.0 "$n(0) setdest [$n(0) set x_] [$n(0)	set y_] 0.0"
$ns at 0.0 "$n(1) setdest [$n(1) set x_] [$n(1)	set y_] 0.0"
	
set tcp [new Agent/TCP]
set sink[new Agent/TCPSink]
$ns attach-agent $n(0) $tcp
$ns attach-agent $n(1) $sink
$ns connect $tcp $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp

proc stop {} {
	global ns traceFile namFile
	$ns flush-trace
	close $traceFile; close $nameFile
	exit 0
}
$ns at 0.5 "$ftp start" 
$ns at 5.0 "$ftp stop"
$ns at 6.0 "stop"
$ns run
Attached Files
File Type: txt test6.tcl.txt (1.7 KB, 4 views)

Last edited by h3am; 12-24-2017 at 02:42 PM.
 
Old 12-25-2017, 01:41 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,802

Rep: Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354Reputation: 3354
Welcome to LQ.

Some typo´s ...

Line 19
Code:
$ns namtrace-all-wireless $namFile 
	$val(x) $val(y)
must be :
Code:
$ns namtrace-all-wireless $namFile $val(x) $val(y)
Line 42
Code:
$n(1) set Y_ 20.0
Edit to
Code:
$n(1) set y_ 20.0
Line 50
Code:
set sink[new Agent/TCPSink]
Edit to
Code:
set sink [new Agent/TCPSink]
Line 61
Code:
	close $traceFile; close $nameFile
Edit to
Code:
	close $traceFile; close $namFile
 
  


Reply

Tags
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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Practical Unix" - Courses From Stanford's "Open Class Room" mjolnir Linux - General 2 06-26-2014 03:15 AM
[SOLVED] Correlation between "free -m" shared line & "/proc/meminfo" shmem RHEL 6.2 - Anyone? xenner Linux - General 3 11-15-2012 06:36 PM
Read file in folder /proc/"pid"/fd/0 in ubuntu v11.10? newbie_member Linux - Newbie 4 07-19-2012 06:05 AM
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 05:23 AM
"Extra bytes at the end of class file" when installing WTK2.2 eikeland Linux - Software 1 03-06-2007 09:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:54 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration