I like to create my own thread that should get input file from me and has to use ngspice source code to run it(it should not use the installed ngspice).That means i want to alter the source code and make file to create an executable . Once i finished compilation ,It has to ask me to enter the file name ,like example.cir .It must show output.
Tamil Vanan K
what is your question?
For downloading and compiling the source code, please have a look at the actual manual, chapt. 31, available at http://ngspice.sourceforge.net/docs/ngspice-manual.pdf
Thanks for your reply.I want to design an application in linux in which it contains 2 threads, thread 1 will continuously get the input file and thread 2 will generate the output simultaneously.i have tried it my installing the ngspice ,in that thread 1 will read .cir file(for example) and thread2 will invoke the ngspice using the shell script . Now my question is ,i am downloaded the source code of ngspice-24 , now i have change the file reading part of ngspice and like to make it as thread2 and compile it to make it as one single application.
Thanks for your reply.I want to design an application in linux in which it contains 2 threads, thread 1 will continuously get the input file and thread 2 will generate the output simultaneously. I have tried it by installing the ngspice ,in that thread 1 will read .cir file(for example) and thread2 will invoke the ngspice using the shell script . Now my question is ,i am downloaded the source code of ngspice-24 , now i to have change the file reading part of ngspice and like to make it as thread2 and compile it to make it as one single application. guide me on how do i change the file reading part of ngspice ?
ngspice is a complex piece of software.
Changing the input section for example will take a major effort. You should start working on the source code only if you are a really, really good C programmer. It is of no avail if you want to use ngspice for learning about programming.
I would suggest that you use ngspice as is. You may create another application (program), which generates input files for ngspice, starts ngspice, and, if ready, reads the ngspice output for further processing.
A good albeit already very complex example is the ASCO optimizer, which as a single program, generates input files, invokes several ngspice threads in parallel, and then reads the output, processes it and starts a new round of simulation. Plaese have a look at http://ngspice.sourceforge.net/extras.html#ASCOo, where you find a link to the original web site and a source download (tested only on MS Windows).
Once again thank you very much for your valuable suggestion.I will go through the link given by you and will keep you posted ,if any doubt arise.
Is there any API() functions available to invoke the ngspice.
ngspice is a stand-alone executable, thus no api functions.
In LINUX you may invoke and control ngspice via a script and input/output fifos (see actual manual, chapt. 16.12.
If you are familiar with tcl scripts, tclspice may be another option, where ngspice is compiled as a shared library, being controllable from a tcl script (see manual chapt. 19 and http://ngspice.sourceforge.net/tclspice.html.
Thanks for your reply man .i like to go with altering the nspice source code to make my own executable which contains two threads like one said in earlier post .Please guide from where i should start ?.
first of all you have to specify in detail what you want to achive:
"Once i finished compilation ,It has to ask me to enter the file name ,like example.cir .It must show output. "
You have that already: Start ngspice, enter command
and if example.cir is made adequately, then you will get whatever output you need.
"thread 1 will continuously get the input file and thread 2 will generate the output simultaneously"
This is not possible. ngspice needs a complete input file, inluding circuit netlist, simulation options, dot commands, and control section. Only when everything is available, ngspice is enabled to start the simulation.
You may seperate that by first loading the netlist only, then ngspice will wait in interactive mode for further commands until simulation can be started (see all the available starting modes)..
So the question, why two threads are needed, is not obvious to me. Maybe you can detail this more.
Next what you need to do is to become familiar with all the modes how ngspice may be started: batch, control mode, interactive mode. This may help to formulate your specification.
Next step would be to become aquainted with the source code, for example by generating a debug executable, using a debugger and running through the code step by step, just figuring out what ngspice is doing upon start up. Alone for the input section this may involve several hundred steps. So you will need some time to do so.
But starting with the specification is the most important issue.
Thanks for your valuable suggestion. Lets remove the threads now.. Let me reframe my question:
My current program:
The *.cir file is executed using the installed ngspice (patch mode). Command: 'ngspice *.cir'
What i want to improve:
Instead of executing the ngspice in the patch mode, i want the whole ngspice source code to be in a program (So that to get the *.cir file executed, there should be no requirement of the installed ngspice), so when this receives the *.cir file, it has to execute and send the result.
I like to know how far my aim is achievable, the way to achieve it and the disadvatages of implementing it.
I hope i made my question clear..
You may look at
Is it that what you want to do?
yes, i want to develop an application like one in http://www.ngspice.com/ of my own ,how do i proceed?
Log in to post a comment.