LinuxQuestions.org
Review your favorite Linux distribution.
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 10-18-2014, 07:50 AM   #1
godfather9112
LQ Newbie
 
Registered: Oct 2014
Posts: 10

Rep: Reputation: Disabled
tcl error


hello all
when i run my .tcl this error occure :

Code:
Default value for cluster_num set to 4

Default value for nodes_num set to 5

ns: Record2: can't read "f0": no such variable
    while executing
"puts $f0 "$now [expr $bw0/$time*8/1000000]""
    (procedure "Record2" line 13)
    invoked from within
"Record2"
my .tcl code is:
Code:
proc record {} {
global null4 tf
#Get an instance of the simulator
set ns [Simulator instance]
#Set the time after which the procedure should be called again
set time 0.1
#How many bytes have been received by the traffic sinks?
set bw0 [$null4 set bytes_]
#Get the current time
set now [$ns now]
#Calculate the bandwidth (in MBit/s) and write it to the files
puts $tf "$now [expr $bw0/$time*8/1000000]"
#Reset the bytes_ values on the traffic sinks
$null4 set bytes_ 0
#Re-schedule the procedure
$ns at [expr $now+$time] "record"
}
proc Record2 {} {
global null0 tf

#Get an instance of the simulator
set ns_ [Simulator instance]
#Set the time after which the procedure should be called again
set time 0.01
#How many bytes have been received by the traffic sinks?
set DP [$null0 set nlost_]
#Get the current time
set now [$ns_ now]
#Calculate the bandwidth (in MBit/s) and write it to the files
puts $f0 "$now [expr $bw0/$time*8/1000000]"
puts $tf "$now $DP"
$null0 set nlost_ 0
#Reset the bytes_ values on the traffic sinks
$sink1 set bytes_ 0
#Re-schedule the procedure
$ns_ at [expr $now+$time] "Record2"
}
 
Old 10-18-2014, 08:30 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,492

Rep: Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639
The tcl code you show in post #1 is not a simulation file.

Is it a configuration file for another file.tcl ? Or ?

If you want an answer, please attach your file "simulation-name.tcl"
as simulation-name.tcl.txt

Attachments : The paper clip tool in the 'Advanced Editor'.

-
 
Old 10-18-2014, 12:03 PM   #3
godfather9112
LQ Newbie
 
Registered: Oct 2014
Posts: 10

Original Poster
Rep: Reputation: Disabled
my tcl file

dear knudfl my file attached.
Attached Files
File Type: txt sip.tcl.txt (8.0 KB, 23 views)
 
Old 10-20-2014, 04:17 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,492

Rep: Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639
← #3 .

What's the idea with the tcl code in post #1 then ? ?


Examples with "the f0 variable" are plenty.
Please find `f0' examples in `xgraph_ns2-files-tcl_10.2014.tar.gz'.
Download from https://drive.google.com/file/d/0B7S...ew?usp=sharing

You should use 'grep' to get the line numbers with f0 :
$ cd xgraph_ns2-files-tcl/
$ grep -n f0 *.tcl

-
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Little error (not harmful) exists in tcl.SlackBuild (source slackbuilds for Tcl) blancamolinos Slackware 3 01-14-2013 05:46 AM
tcl.h error immortaltechnique Linux - Newbie 2 01-16-2007 08:30 AM
tcl compilation error bangoram Linux - Software 0 07-27-2006 11:33 AM
tcl error ! wizex Debian 3 09-05-2005 03:21 PM
tcl/tk: Bwidget error Onemessedupjedi Programming 0 07-05-2004 05:24 PM

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

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