LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   new simulator problem (https://www.linuxquestions.org/questions/linux-newbie-8/new-simulator-problem-726993/)

Nanda27 05-19-2009 05:03 AM

new simulator problem
 
Hi all i hav problem in NS2. whenever creating an new simulator it shows an error for invalid command name "new". how to solve this problem plz help me

Thanks in advance

Nanda

knudfl 05-20-2009 08:16 AM

Welcome to LQ.

A command in ns2 would be

'ns file.tcl'

Or what have you got, and which command are you doing ? ?

Nanda27 05-21-2009 05:16 AM

New simulator problem
 
set ns [new Simulator] - in this line throws an error for invalid command "new"

set n0 [$ns node]

set n1 [$ns node]

$ns duplex-link $n0 $n1 1Mb 2ms DropTail


set udp0 [new Agent/UDP]

$ns attach-agent $n0 $udp0

set cbr0 [new Application/Traffic/CBR]

$cbr0 attach-agent $udp0


set null0 [new Agent/Null]

$ns attach-agent $n1 $null0


$ns connect $udp0 $null0


$ns at 1.0 “$cbr0 start”
$ns run

why this happening and what software i need to install for this plz help me

thanks..
Nanda

knudfl 05-21-2009 08:43 AM

2 Attachment(s)
Example ( Template )
http://www.isi.edu/nsnam/ns/tutorial/nsscript1.html

The 'file.tcl' :
Code:

set ns [new Simulator]

set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
        global ns nf
        $ns flush-trace
        close $nf
        exec nam out.nam &
        exit 0
}

$ns at 5.0 "finish"

$ns run

And 'ns file.tcl' shows .... see attached file ...

Please try out some of the examples in ns-2.33/tcl/ex/
and also see how they are written.

EDIT : Your code works ? ? .. see attached 'tcl files'
Rename to suffix .tcl before use.
.....

knudfl 05-21-2009 09:24 AM

1 Attachment(s)
The file '3file3.tcl : Please push the play button ... and wait .....
.....

Nanda27 05-22-2009 05:47 AM

Ns pblm
 
I hav installed active tcl only, i hav ns2.33 but i dont no how to install that give me an procedure to install ns2.33

Regards..!

Nanda

Nanda27 05-22-2009 06:55 AM

i hav executed ur coding its not working throws an same error. I think i hav problem in my software, can u guide me how to install d ns 2.33.
Codings r correct but problem in only s/w i didnt installed ns and nam

knudfl 05-22-2009 07:49 AM

The commnand 'ns' will work only, when ns-2.33 +
nam-1.13 are compiled with no errors.

Suggest :
Install from source to /usr/local/ , in this order :
otcl-1.13, tclcl-1.19, ns-2.33, nam-1.13 .
cd /home/"user"/tmp
tar xvf <application>
cd <application>
./configure .......
make .. 'su' (or sudo) make install.

The source code for the tcl8.4 + tk8.4 installed on
your OS must be unpacked to the folder with otcl and
tclcl. Please configure otcl with :
'./configure --with-tcl=../tcl8.4(.xx)'
And tclcl :
'./configure --with-tcl=../tcl8.4(.xx) --with-tk=../tk8.4(.xx)'

The build requirements : It is a little different from Fedora's
to various Ubuntu's. Please tell which Linux, name, version,
to be used.
.....
Ubuntu, Debian : (sudo) apt-get install libx11-dev libxmu-dev \
libxmu-headers libxt-dev tcl8.4-dev tk8.4-dev
.....

Nanda27 05-23-2009 09:08 AM

Nam pblm
 
Hi i hav installed ns 2.29.2 with cygwin environment all my commands r working but if i execute $ ns example1b.tcl it throws an following error:

Sathya@server /usr/local/ns-allinone-2.29.2/ns-allinone-2.29/bin
$ ns example1b.tcl

Sathya@server /usr/local/ns-allinone-2.29.2/ns-allinone-2.29/bin
$ nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[string equal [tk windowingsystem] "classic"]
|| [string equal [tk windowingsystem] "aqua"]} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {..."

Sathya@server /usr/local/ns-allinone-2.29.2/ns-allinone-2.29/bin

knudfl 05-23-2009 10:35 AM

'example1b.tcl' : Where did you find it ?

Please provide location, a link to the code,
or please show the code, attached or in code tags.

http://www.linuxquestions.org/questi....php?do=bbcode

Nanda27 05-25-2009 12:55 AM

1 Attachment(s)
I got the code from here : http://www.isi.edu/nsnam/ns/tutorial/nsscript1.html. coding has correct but problem in nam only it showing an error for nam could not open msg.
Plz help me..

Thanks and Regards..!

Nanda

knudfl 05-25-2009 03:33 PM

1 Attachment(s)
Can 'nam' itself be run ?
Please try the command ./nam or nam , depending on
the PATH you have set ... and location, cd nam-1/ ?

'nam' will display the attached image ....
.....

Nanda27 05-26-2009 01:49 AM

Hi i hav installed ns2 with cygwin environment nam also working fine now thanks for ur kind reply. i need one more help how to transfer file between one computer to another using ns2. if u hav any coding plz attach

Thanks and Regards..!

Nanda

Nanda27 05-27-2009 07:14 AM

1 Attachment(s)
Hi while running my program it shows an following error:

$ ns tcp.tcl
invalid command name "Application/TCPCNT"
while executing
"Application/TCPCNT create _o65 "
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new Application/TCPCNT"
("for" body line 17)
invoked from within
"for {set i 0} {$i < $streams} {incr i} {
# 3. Create objects for the TCP sender and receiver and specify maximum
# window sizes
set tcpz($i) [new ..."
(file "tcp.tcl" line 37)
I want to send the file to another computer if u hav any coding plz attach me..!

Thanks and Regards

Nanda

knudfl 05-27-2009 12:06 PM

1 Attachment(s)
# 14 : Code bug ?
.....
Have a look at this 'tcp.tcl' ( Attached ) :
http://www.informatik.uni-mannheim.d...xample/tcp.tcl

http://www.informatik.uni-mannheim.d...IP/ns-example/

'ns 2tcp.tcl.txt' will create the file 'out.nam' in the
current directory. 'out.nam' can be used with nam :

'nam' > > File > "Open..." :
will display the simulation, please push "Play", and wait for a minute ...
.....

Nanda27 05-29-2009 12:38 AM

Hi.. I want to transfer the file between two computers, while sending the file i need to trace for congestion node by using system ip adress. if its possible or not? is it possible means tell me how to do that.

Thanks and Regards

Nanda

knudfl 05-29-2009 08:07 AM

Ns2 simulates certain things, but I doubt
it can be used for the transfer directly,
may be by calling another utility ?

Suggest : start a new thread, asking for
file transferring in general.
( I know too little about the subject to
give any advise.)
.....
.....
And just another nice ns2 site, I found
http://nile.wpi.edu/NS/simple_ns.html
.....

knudfl 06-04-2009 03:39 PM

1 Attachment(s)
Please have a look at this
http://www.isi.edu/nsnam/archive/ns-.../msg03804.html
'congestion_parameter.tcl' is attached.
I edited line 139, was a comment only.
Running the file with 'ns' will generate 'nam.out'
to be run with 'nam' ... and click the play button.
.....
.....
Post # 16, quote
Quote:

.. I want to transfer the file between two computers, while sending the file I need to trace for congestion node by using system IP adress.
Suggest : Ask Google, using parts of the text.
I used the keyword .. trace for congestion node ..
..... and found the above link.
.....
.....
If you want to ask about file transfer, you will
have to rephrase the text. Ask for it generally,
and do not start with mentioning ns2 or any of the
ns2 specific words.
.....

Nanda27 06-06-2009 01:04 AM

1 Attachment(s)
Hi i hav attached my screen design. in this form when i click browse button it will show open file dialog box after that i was selected one file. by clicking the send button i need to find out the priority of file transformation ie: High or low priority in the option button. i want to transfer the file Varsha.doc to another system in the mean while i want to show the file transfering informaiton in Nam. Is this possible or not? plz tell me


Thanks and Regards..!

Nanda

neeraj.dwivedi 11-07-2009 03:02 AM

1 Attachment(s)
When i execute attached file as "ns example1.tcl" following errors i get ...


neeraj@ubuntu:~/mypractice$ ns example2.tcl
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o18: no target for slot -1
_o18 type: Classifier/Hash/Dest
content dump:
classifier _o18
0 offset
0 shift
2147483647 mask
1 slots
slot 2: _o112 (Classifier/Port)
-1 default
---------- Finished standard no-slot{} default handler ----------


please help me out.

knudfl 11-07-2009 05:23 PM

@ neeraj.dwivedi # 20.

Why do you think, there are errors in the ns reply ? ?
Quote:

please help me out.
I can see, you almost have the solution = " out. "

Suggest : move your example1.tcl to a new empty folder,
so you can see, what happens :
' cd new-folder/ '
' ns example1.tcl '
...which creates a new file : 'nam.out' .

Please then do the command ' nam nam.out ',
.. and the nam GUI will open. Hit the play button,
.. wait for the traffic to show up ..

And discover, that everything is OK. .. :) ..
.....

neeraj.dwivedi 11-08-2009 12:54 AM

thank you very much ...

when i perform according u , u were very true .
now i am able to see the nam . but this is not performing as my expectations.
during ns example2.tcl i got following response :-


--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o18: no target for slot -1
_o18 type: Classifier/Hash/Dest
content dump:
classifier _o18
0 offset
0 shift
2147483647 mask
1 slots
slot 2: _o112 (Classifier/Port)
-1 default
---------- Finished standard no-slot{} default handler ----------


is this gives any hint about my problem.

my problem is ...

in this script i have created 5 nodes, n0,n1,n2 provide traffic to n3 , and sink n4 gets traffic from n3. (as my expectations)

but in this nam , nam shows traffic only from node n0 & n1 to n3, and n4 works as sink. but n2 is not start traffic. why ?

neeraj.dwivedi 11-08-2009 01:25 AM

yeaaahhhaaaaa


i got the error .. error in script code.

thank you a ton brother.

knudfl 11-08-2009 01:53 AM

*
Can you attach the new script ..
.. Or replace the one in post # 20 ??

Please ..

neeraj.dwivedi 11-09-2009 02:33 AM

now it is perfect having no error.

but i have a new problem ..
please explain queuing theory as coded below ..

#Monitor the queue for the link between node 2 and node 3

$ns duplex-link-op $n2 $n3 queuePos 0.5


Actually i m not able to understand this line of code of TCL.please explain it.

neeraj.dwivedi 11-09-2009 02:33 AM

now it is perfect having no error.

but i have a new problem ..
please explain queuing theory as coded below ..

#Monitor the queue for the link between node 2 and node 3

$ns duplex-link-op $n2 $n3 queuePos 0.5


Actually i m not able to understand this line of code of TCL.please explain it.

neeraj.dwivedi 11-09-2009 02:43 AM

1 Attachment(s)
new script is attached with this ,now it is perfect having no error.

but i have a new problem ..
please explain queuing theory as coded below ..

#Monitor the queue for the link between node 2 and node 3

$ns duplex-link-op $n2 $n3 queuePos 0.5


Actually i m not able to understand this line of code of TCL.please explain it.

knudfl 11-09-2009 07:12 AM

Sorry, in fact I don't use ns2 very much.
So, for an explanation, please
Google .. $ns duplex-link-op $n2 $n3 queuePos 0.5 ..
http://www.google.com/search?hl=da&s...ng&lr=&aq=&oq=

.. and get 1,200 hits . Then you might find an explanation
quicker than I can. I would have to read through all that
text too.
.....

priya86mohanty 05-23-2012 11:57 AM

Hi,
I am trying to simulate WiMAX on ns-2.28. I have installed ns-2.28 on Ubuntu 11.04. Downloaded WimAX module from the website "http://www.lrc.ic.unicamp.br/wimax_ns2/". I followed the below steps as mentioned in the website:
1. Download the software ns-allinone-2.28 package
2. Download the latest ns-2 WiMAX module source code.
3. Unzip the ns-2 WiMAX module source code file.
4. Put the files from "mac" directory into ns-allinone-2.28\ns-2.28\mac.
5. Put the files which are in common and tcl respectively into ns-allinone-2.28\ns-2.28\common and ns-allinone-2.28\ns-2.28\tcl.
6. Modify the Makefile.in as follows
- After the sentence mac/mac-802_3.o add:
- mac/mac-802_16-base.o mac/mac-802_16-ss.o mac/mac-802_16-bs.o \
- mac/mac-802_16-FSM.o mac/mac-802_16-timers.o \
7. Go to the ns-allinone-2.28/ns-2.28 directory and execute "./configure", "make clean" and "make".

The Makefile.in is recompiled and .o files for the newly added WiMAX files are also generated. But when I am trying to run the example.tcl, I get an error saying:
xyz@xyz-Presario-V3000-GN367PA-ACJ:~/ns-allinone-2.28/ns-2.28$ ns example.tcl
invalid command name "Mac/802_16BS"
while executing
"Mac/802_16BS set window_ 0.05"

(file "example.tcl" line 36)

I got to know that there is some problem after re-compilation but I am unable to find out what it is and what should be corrected so that the script runs. Kindly help me out with this.

Thanks.

knudfl 05-23-2012 04:45 PM

# 29.

That's right, wimax 1.02 / ns-2.28 doesn't work with the two tcl examples.
Wimax version 2.03 for ns-2.31 : OK.
ns example.tcl generates an example.tr 5MB.
ns example2.tcl : example2.tr 2.8 MB.

The binary ns from the 32bits Ubuntu 11.04 : ns231-wimax203-i686.tar.gz
> https://docs.google.com/open?id=0B7S...Wl2bmxDTTZ0ejg

.

priya86mohanty 05-23-2012 08:23 PM

#30
 
Ok. I removed ns-allinone-2.28 and tried installing ns-allinone-2.31. Followed the below procedure for installation:
1) sudo ln -s i386-linux-gnu/asm/
2) sudo apt-get update
3) sudo apt-get install linux-libc-dev
4) sudo apt-get install g++ autoconf automake libtool libxmu-dev
5) tar xvf ns-allinone-2.31.tar.gz
6) cd ns-allinone-2.31/
7) ./install

I got the error as:
otcl.o: In function `OTclDispatch':
/home/xyz/ns-2.31/ns-allinone-2.31/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/xyz/ns-2.31/ns-allinone-2.31/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Bad value
make: *** [libotcl.so] Error 1
otcl-1.13 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems


a) How to correct it? What is the gcc version needed for ns-2.31? For ns-2.28, I had used gcc410. Does it work with ns-2.31 also or is it different?
b) And why is that wimax 1.02 / ns-2.28 is not working with the tcl examples? Is it like this combination does not work on Ubuntu 11.04 or irrespective to any platform it'll not work?
c) Also let me know about "ns231-wimax203-i686" that you have provided for download. How am I supposed to install it with ns-2.31 after ns-allinone-2.31 is installed successfully?

Thanks.

Quote:

Originally Posted by knudfl (Post 4685871)
# 29.

That's right, wimax 1.02 / ns-2.28 doesn't work with the two tcl examples.
Wimax version 2.03 for ns-2.31 : OK.

.


knudfl 05-24-2012 03:02 AM

# 31.

Ns-allinone-2.31 : gcc / g++ version 4.1 will work.
The reason to show the "ns231-wimax203-i686" :
I used a 'dirty trick' to compile it : ns-2.31/packmime/* failed,
so I copied the five packmime/<file>.o from an unpatched ns-2.31.

The binary will work as a standalone, when you have /home/<name>/lib/,
where "lib/" is the lib/ folder from a compiled ns-allinone-2.31/lib/.
Tested OK with the two example*.tcl on an OS with no other ns2 than "lib/"


P.S. : How did you make / get a gcc410, that works on Ubuntu 11.04 ?
(I used the home made g++41-compat-4.1.2_i386.deb, gcc41-compat-4.1.2_i386.deb
once created on a clean install of Ubuntu 11.04 with no updates.)

.

priya86mohanty 05-24-2012 03:44 AM

#31
 
Can you please provide me the steps that I need to carry out? g++41-compat-4.1.2_i386.deb, gcc41-compat-4.1.2_i386.deb should be installed first is it? Before even ns-2.28 is installed on Ubuntu 11.04?
The link which I referred for gcc compilers is "http://www.linuxquestions.org/questions/linux-software-2/how-to-integrate-the-resource-energy-leach-class-into-ns-2-34-a-870368/page13.html". The downloadable given there are to be used no?

Quote:

Originally Posted by knudfl (Post 4686155)
# 31.

Ns-allinone-2.31 : gcc / g++ version 4.1 will work.

P.S. : How did you make / get a gcc410, that works on Ubuntu 11.04 ?
(I used the home made g++41-compat-4.1.2_i386.deb, gcc41-compat-4.1.2_i386.deb
once created on a clean install of Ubuntu 11.04 with no updates.)

.


knudfl 05-24-2012 04:07 AM

# 33
http://www.linuxquestions.org/questi...68/page13.html
> post # 181

Yes, those two packages have been available for about a year.
( Google will find them easily too.)
Will work with ns-allinone, versions 2.26, 2.27, 2.28, 2.29, 2.30, 2.31, 2.33, 2.34.
( 2.26, 2.27, 2.28 with a "gcc410-patch" ).

.

priya86mohanty 05-24-2012 04:15 AM

#34
 
2 Attachment(s)
I have 2 patches with me. ns228-gcc40[1].patch and ns-2[1].28-gcc410.patch. Will patching these two files work or should I patch just the later one only?

Quote:

Originally Posted by knudfl (Post 4686198)
# 33

Will work with ns-allinone, versions 2.26, 2.27, 2.28, 2.29, 2.30, 2.31, 2.33, 2.34.
( 2.26, 2.27, 2.28 with a "gcc410-patch" ).

.


knudfl 05-24-2012 05:29 AM

# 35 : ns-allinone-2.28 for Ubuntu , both patches.

Please see post #15 here ...
http://www.linuxquestions.org/questi...4-a-842773/#15

tanveer_ahmed 05-24-2012 03:24 PM

Hello everyone. I am facing a problem in running the Network Animator (nam package) when installing ns2. While I run "./configure" it says that "failed to open shared file libotcl.so". And so if i enter the "make" and "make install" it doesn't work. That means my nam is not installed. I don't know how to recover this problem. I have successfully installed ns2 in my Red Hat Enterprise 6 and i can simulate and get an output file(like .tr). But the tcl files that are written to run the nam i. e. network animator also, it doesn't run. But it is compiled and gives the output file(in .tr). Can anyone please help me in this case? I really need to install nam package. I am a bit new user in RedHat Enterprise 6. I have installed the required and optional packages except Xgraph. Because installing Xgraph also shows some errors. But first can anybody help me installing nam-1.14.i386.rpm this package please? I would be grateful.

knudfl 05-24-2012 03:51 PM

Post # 37, @tanveer_ahmed : Welcome to LQ.

Better use a well tested static nam : No dependencies are required.
And : I don't know the referred rpm package, which is also unknown by Google.

Nam i586 : https://docs.google.com/open?id=0B7S...k4NGI5NzliM2Ux
>> nam-1.14.i586.tar.gz : unpack, and 1) su 2) cp nam /usr/local/bin/


Xgraph is never built in any ns-allinone-2.xx .
Building xgraph from source : Post # 2 here ..
http://www.linuxquestions.org/questi...34-a-862233/#2

.

tanveer_ahmed 05-24-2012 04:24 PM

Thank you so much for that file in google docs. It was so kind being helped. I am happy and grateful. Thank you so much....

zakizakizaki 04-05-2015 08:28 AM

Quote:

Originally Posted by neeraj.dwivedi (Post 3750015)
new script is attached with this ,now it is perfect having no error.

but i have a new problem ..
please explain queuing theory as coded below ..

#Monitor the queue for the link between node 2 and node 3

$ns duplex-link-op $n2 $n3 queuePos 0.5


Actually i m not able to understand this line of code of TCL.please explain it.




Hey, where was the problem please? Because i'm having the exact same problem which is :
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o42: no target for slot 4294967295
_o42 type: Classifier/Hash/Dest
content dump:
classifier _o42
0 offset
0 shift
1073741823 mask
1 slots
slot 10: _o408 (Classifier/Port)
-1 default
---------- Finished standard no-slot{} default handler ----------

knudfl 04-05-2015 09:03 AM

Re post #40, @zakizakizaki : Welcome to LQ.

No posts by @neeraj.dwivedi in six years : '09 Sept 2009'.


So please explain what you are doing ....
http://www.linuxquestions.org/linux/...Ask_a_Question
The version of ns2. The command that causes the errors, etc.
And the OS used, like Fedora 21 - 32bits, CentOS 6 - 32bits, Ubuntu 14.04 - 32bits.


-


All times are GMT -5. The time now is 12:30 PM.