Escolar Documentos
Profissional Documentos
Cultura Documentos
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\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
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:
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
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 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.