From 246319682f60293b132fca1ce6e24689c6682617 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Fri, 28 Feb 2020 11:38:58 +0530 Subject: initial commit --- Windows/spice/how-to-use-ngspice140111.txt | 359 +++++++++++++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 Windows/spice/how-to-use-ngspice140111.txt (limited to 'Windows/spice/how-to-use-ngspice140111.txt') diff --git a/Windows/spice/how-to-use-ngspice140111.txt b/Windows/spice/how-to-use-ngspice140111.txt new file mode 100644 index 00000000..b84e9684 --- /dev/null +++ b/Windows/spice/how-to-use-ngspice140111.txt @@ -0,0 +1,359 @@ + H. Vogt, Jan 12th, 2014 + +ngspice-26 has been compiled from the ngspice-26 tarball, Jan 11th, 2014. + +ngspice.exe was generated by MS Visual Studio 2008, configuration +ReleaseOMP, using full optimization (compiler flags /O2 /Oi /Ot /GL, linker 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.8.1 and MSYS 1.0.10 using the following configuration: + +./configure --with-windows --enable-xspice --enable-cider --disable-debug + +gcc is invoked with the -O2 compiler flag, which is set in configure.ac. + +This version of ngspice 26 thus does not contain the adms or ndev extensions. + +Expand the ngspice-26-140112.zip file directly into C: so that you will get C:\Spice\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 click 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 like 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: + +ngspice +load 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\transimpedanceamp: +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 + +ngspice + +*** ngspice window: +load timp.raw +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 cs.out cs_mixtv4.inp +* instead, you will get a raw file (simulator output data), +* .print and .plot will be ignored. +* You may plot the data 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 Converters: 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 mouse 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\transimpedanceamp: +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 click 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\transimpedanceamp: +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 ngspice + 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 look 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 keep 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 work. + + +********************************************************************* +********************************************************************* +* 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.uk/teaching/CDHW/Electronics2/userguide/index.html#toc + +For some information on CIDER see +http://embedded.eecs.berkeley.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/ -- cgit