Sei sulla pagina 1di 7

H. Vogt, Jan 28th, 2012 ngspice-23 has been compiled from the ngspice-24 tarball, Jan 28th, 2012.

ngspice.exe was generated by MS Visual Studio 2008, configuration ReleaseOMP, using full optimization (compiler flags /O2 /Oi /Ot /GL, lin er flag /ltcg). vcomp90.dll is the microsoft runtime distributable for OpenMP (see C:\Program Files (x86)\Microsoft Visual Studio 9.0\1031\redist.txt). The XSPICE code models *.cm were generated with TDM mingw gcc 4.6.1 and MSYS 1.0.10 using the following configuration: ./configure --with-windows --enable-xspice --enable-cider --disable-debug gcc is invo ed with the -O2 compiler flag, which is set in configure.ac. This version of ngspice 24 thus does not contain the adms or ndev extensions. Expand the ngspice-24-120129.zip file directly into C: so that you will get C:\S pice\bin etc. For other places for ngspice installation, see below. The following examples are tested under Windows XP professional and Windows 7 64 Bit. Directory /examples offers some example input files for special commands. *** How to use ngspice with examples provided in directory /tests *** ********************************************************************* Starting ngspice from MS Explorer window (interactive mode): Double clic on ngspice.exe in C:\Spice\bin *** ngspice window: cd c:\spice\tests\bsim4 source comprt.cir run display plot v(1) v(2) v(3) v(8) v(9) write comprt2.raw quit ********************************************************************* ********************************************************************* * Starting ngspice within the msys window, interactive mode: * Open an MSYS window. *** msys window:

export PATH=$PATH:/c/Spice/bin cd /c/Spice/tests/bsim4 ngspice comprt.cir *** ngspice window: run display plot all *** write data into raw file to actual directory /c/Spice/tests/bsim4: write comprt.raw quit If you want to use interactive mode with a circuit file in a different directory (e.g. C:\test\comprt.cir) , you have to call ngspice li e this: ngspice C:\\test\\comprt.cir or ngspice C:\\test/comprt.cir MSYS 1.0.10 is specific about file and directory names! You cannot start ngspice from C:\ or D:\ directly if you don't have administrator rights. You may choose a subdirectory instead. ********************************************************************* ********************************************************************* * Starting ngspice within the msys window, batch mode: * Open an MSYS window. *** msys window: export PATH=$PATH:/c/Spice/bin cd /c/Spice/tests/bsim4 ngspice -b -r comprt3.raw -o comprt3.out comprt.cir * Plotting *** msys window: ngnutmeg comprt3.raw plot v(1) v(2) v(3) v(8) v(9) quit * The data in the raw file comprt3.raw are stored in a compact binary * format. If you want them to be ASCII, you have to uncomment line set filetype=ascii * in C:\Spice\share\ngspice\scripts\spinit (remove the '*').

********************************************************************* ********************************************************************* * Starting ngspice within the dos window (cmd.exe) , interactive mode: * (also an example for using xspice extension) * Open a DOS window. *** DOS window: set PATH=%PATH%;C:\Spice\bin cd C:\Spice\examples\transimpedanceamp ngspice output.net *** ngspice window: run display * end display with 'q' plot vout2 * write all data into raw file to actual directory C:\Spice\tests\transimpedance amp: write timp.raw * write only input and output write timp2.raw v3#branch vout2 quit Calling a source file in a different directory is done by: ngspice D:\testinput\output.net ********************************************************************* ********************************************************************* * Use ngnutmeg for plotting within the dos window (cmd.exe), using the raw file timp.raw created above: * Open a DOS window. *** DOS window: set PATH=%PATH%;C:\Spice\bin cd C:\Spice\examples\transimpedanceamp ngnutmeg timp.raw *** ngnutmeg window: plot vout2 plot i(v3) quit ********************************************************************* ********************************************************************* * Starting ngspice within the dos window (cmd.exe) , batch mode, using * .plot and/or .print commands in the input file (printer plot output),

* no raw file, similar to SPICE2G6: * Open a DOS window. *** DOS window: set PATH=%PATH%;C:\Spice\bin cd C:\Spice\examples\ ngspice -b -o cs.out cs_mixtv4.inp * The ouput will be plotted and printed to C:\Spice\examples\cs.out. * If you enter ngspice -b -r cs.raw -o * instead, you will get * .print and .plot will * You may plot the data cs.out cs_mixtv4.inp a raw file (simulator output data), be ignored. by using ngnutmeg (see example above).

********************************************************************* ********************************************************************* * A numparam example with convergence and ringing problems (Xiaoqun Wu e.a.: "Bifurcation Behavior of SPICE Simulations of Switching Conver ters: A Systematic Analysis of Erroneous Results", IEEE TRANSACTIONS ON POWER ELECTRONICS, VOL. 22, NO. 5, SEPTEMBER 2007, p.1743 dos window (cmd.exe) , interactive mode: * Open a DOS window. *** DOS window: set PATH=%PATH%;C:\Spice\bin cd C:\Spice\examples\numparam ngspice power.cir *** ngspice window: run plot vc#branch *** compare to literature by selecting appropriate plot windows using right mous e tab * write all data into raw file to actual directory C:\Spice\examples\numparam: write power-all.raw * write only relevant output write power.raw vc#branch quit ********************************************************************* ********************************************************************* * Running ngspice from a different directory (for example D:\tmp) * Starting ngspice within the dos window (cmd.exe) , interactive mode: * Extract ngspice.zip to D:\tmp

* Edit spinit (found in D:\tmp\Spice\share\ngspice\scripts) to have the correct path for the XSPICE codemodels: Line codemodel C:/Spice/lib/spice/spice2poly.cm has to be replaced by codemodel D:/temp/Spice/lib/spice/spice2poly.cm the other codemodels lines have to be changed respectively. * Open a DOS window. *** DOS window: set SPICE_LIB_DIR=D:\tmp\Spice\share\ngspice set PATH=%PATH%;D:\tmp\Spice\bin cd D:\tmp\Spice\examples\transimpedanceamp D: ngspice output.net *** ngspice window: run plot vout2 * write all data into raw file to actual directory D:\tmp\Spice\tests\transimped anceamp: write timp.raw * write only input and output write timp2.raw v3#branch vout2 quit ********************************************************************* ********************************************************************* * Running ngspice from a different directory (for example D:\tmp) * Starting ngspice within the dos window (cmd.exe) , interactive mode or starting with double clic on ngspice in MS explorer: * Extract ngspice.zip to D:\tmp * under Windows XP you may put the following lines into C:\autoexec.bat: set SPICE_LIB_DIR=D:\tmp\Spice\share\ngspice set PATH=%PATH%;D:\tmp\Spice\bin * Edit spinit (found in D:\tmp\share\ngspice\scripts) to have the correct path for the XSPICE codemodels: Line codemodel C:/Spice/lib/spice/spice2poly.cm has to be replaced by codemodel D:/temp/Spice/lib/spice/spice2poly.cm the other codemodels lines have to be changed respectively. * You may then start immediately after opening the command window (cmd.exe) with: cd D:\tmp\Spice\examples\transimpedanceamp D: ngspice output.net

*** ngspice window: run plot vout2 * write all data into raw file to actual directory D:\tmp\Spice\tests\transimped anceamp: write timp.raw * write only input and output write timp2.raw v3#branch vout2 quit ********************************************************************* ********************************************************************* ********************************************************************* * spinit * spinit is used to set options or to set varioables. spinit is read into ngspic e before any input file. The codemeodel path for xspice may be set as well. There is a search sequence for spinit. 1) If the invironmental variable is SPICE_LIB_DIR is set to a path, e.g. to SPICE_LIB_DIR=D:\tmp\Spice\share\ngspice, then spinit is searched for in D:\tmp\Spice\share\ngspice\scripts. If not set then we loo for it in C:\Spice\share\ngspice\scripts. If this path is not available or spinit is not there, then ngspice searches for spinit in the path where ngspice.exe resides. If not found there, a warning note is issued. * .spiceinit * .spiceinit is read directly after the spinit file. You may eep spinit as is, and put any personal preset variables or scripts into .spiceinit. Data in .spiceinit will override data from spinit. ngspice will search for .spiceinit either in your home directory or in the directory where ngspice.exe is located. ********************************************************************* ********************************************************************* * Universial, simple install Put ngspice.exe and spinit into a subdirectory myspice\bin Put the codemodels (e.g. analog.cm) into a subdirectoty myspice\codemodels. Edit spinit and change the codemodel lines to codemodel ../codemodels/spice2poly.cm etc. Instead of 'myspice' you may now choose any directory for your installation of \bin and \codemodels, even C:\ will wor . ********************************************************************* ********************************************************************* * miscellaneous Documentation specific to ngspice is available at http://ngspice.sourceforge.net/docs.html.

For additional info I recommend the Spice3 user manual at: http://newton.ex.ac.u /teaching/CDHW/Electronics2/userguide/index.html#toc For some information on CIDER see http://embedded.eecs.ber eley.edu/pubs/downloads/cider/index.htm A manual however is missing on this web site. For an xspice manual see http://users.ece.gatech.edu/~mrichard/Xspice/

Potrebbero piacerti anche