Swamy
Swamy

Reputation: 171

Unable to create new Simulator in NC2 on Cygwin error : invalid command name "new"

 $ tclsh
 % set ns [new Simulator]
 invalid command name "new"

I started today with NS2. I'm running on Cygwin. How to overcome this error.

I mostly think the error is due to the absence of this command

"#! /usr/home/homedir/very/long/path/tclsh"

But i dont know what this path corresponds in my system.

Upvotes: 0

Views: 353

Answers (1)

Knud Larsen
Knud Larsen

Reputation: 5909

tclsh is a component from tcl. The ns2 tclsh is e.g. tclsh8.5, and is required for running the executable ns. Ns2 "speaks" otcl, not plain tcl.

The ns2 interpreter is ns, not tclsh (tclsh8.5). Running simulations is as simple as # ns simulation-file.tcl. The executable ns knows the command set ns [new Simulator]. The tclsh* doesn't. Examples : See ns-2.xx/tcl/ex/*, and "all ~3,000 examples" https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?usp=sharing

There are no examples with the ns2 versions from this century (AFAIK) which can run commands from the % prompt, to create any results.

Creating a basic simulation : Write a file.tcl or edit a current example, or generate files.tcl with e.g. NSG2.1.jar https://ns2blogger.blogspot.dk/2014/04/nsg-21-tcl-script-generator.html# java -jar NSG2.1.jar

Introduction to "create simulations" : https://www.isi.edu/nsnam/ns/tutorial/nsscript1.html#first

Upvotes: 1

Related Questions