diff options
Diffstat (limited to 'Windows/spice/share')
-rw-r--r-- | Windows/spice/share/man/man1/ngmultidec.1 | 105 | ||||
-rw-r--r-- | Windows/spice/share/man/man1/ngnutmeg.1 | 83 | ||||
-rw-r--r-- | Windows/spice/share/man/man1/ngsconvert.1 | 126 | ||||
-rw-r--r-- | Windows/spice/share/man/man1/ngspice.1 | 152 | ||||
-rw-r--r-- | Windows/spice/share/ngspice/scripts/ciderinit | 23 | ||||
-rw-r--r-- | Windows/spice/share/ngspice/scripts/devaxis | 69 | ||||
-rw-r--r-- | Windows/spice/share/ngspice/scripts/devload | 21 | ||||
-rw-r--r-- | Windows/spice/share/ngspice/scripts/setplot | 64 | ||||
-rw-r--r-- | Windows/spice/share/ngspice/scripts/spectrum | 165 | ||||
-rw-r--r-- | Windows/spice/share/ngspice/scripts/spinit | 31 |
10 files changed, 839 insertions, 0 deletions
diff --git a/Windows/spice/share/man/man1/ngmultidec.1 b/Windows/spice/share/man/man1/ngmultidec.1 new file mode 100644 index 00000000..617ed32d --- /dev/null +++ b/Windows/spice/share/man/man1/ngmultidec.1 @@ -0,0 +1,105 @@ +.TH NGMULTIDEC 1 ngpice +.SH NAME +ngmultidec \- make ngpice sub-circuit for coupled transmission lines +.SH SYNOPSIS +.B ngmultidec +[ +.IR options ... +] +.SH DESCRIPTION +.I ngmultidec +writes an ngspice input file to standard output which describes a sub-circuit for coupled lines +using uncoupled simple lossy lines. +.LP +Each generated subcircuit models a 4-conductor transmission line with +the following parameters: length +.IR l , +line capacitance +.IR c , +line resistance +.IR r , +line conductance +.IR g , +inductive_coeff_of_coupling +.IR k , +inter-line capacitance +.IR cm , +length +.IR l . +Derived parameters are: +.IR lm , +.IR ctot . +The values of +.IR l , +.IR c , +the model name, the number of conductors and the length of the line +must be specified. +.LP +It is important to note that the model is a simplified one - the +following assumptions are made: 1. The self-inductance l, the +self-capacitance ctot (note: not c), the series resistance r and the +parallel capacitance g are the same for all lines, and 2. Each line +is coupled only to the two lines adjacent to it, with the same +coupling parameters cm and lm. +The first assumption implies that edge effects have to be neglected. +The utility of these assumptions is +that they make the sL+R and sC+G matrices symmetric, tridiagonal and +Toeplitz, with useful consequences (see the paper referenced below). +.LP +It may be noted that a symmetric two-conductor line is +represented accurately by this model. +.LP +Standard C language scientific (exponent) notation may be used for options' numeric values. +.SH OPTIONS +.TP +.BI \-o "subcircuit_name" +Set the subcircuit name +.TP +.BI \-l "line_inductance" +Set the line inductance. +.TP +.BI \-c "line_capacitance" +Set the line capacitance. +.TP +.BI \-r "line_resistance" +Set the line resistance. +.TP +.BI \-g "line_conductance" +Set the line conductance. +.TP +.BI \-k "inductive_coefficient_of_coupling" +Set the value of the inductive coefficient of coupling, whose +absolute value +.I k +must be less than 1.0. +.TP +.BI \-x "line-to-line-capacitance" +Set the line-to-line capacitance. +.TP +.BI \-L "length" +Set the length of the line. +.TP +.BI \-n "number" +Set the number of conductors. +.TP +.B \-u +Write a usage message to standard error. +.SH EXAMPLE +.RS +.B ngmultidec -n4 -l9e9 -c20e-12 -r5.3 -x5e12 -k0.7 -otest -L5.4 > test.cir +.RE +.SH SEE ALSO +.nf +.IR "Efficient Transient Simulation of Lossy Interconnect" , +J.S. Roychowdhury and D.O. Pederson, +Proceedings of the Design Automation Conference, +pp. 740-745. +1991. +.B http://portal.acm.org/citation.cfm?doid=127601.127762 +.fi +.sp +.IR ngnutmeg (1), +.IR ngproc2mod (1), +.IR ngsconvert (1), +.IR ngspice (1), +.IR nghelp (1). diff --git a/Windows/spice/share/man/man1/ngnutmeg.1 b/Windows/spice/share/man/man1/ngnutmeg.1 new file mode 100644 index 00000000..bafc122b --- /dev/null +++ b/Windows/spice/share/man/man1/ngnutmeg.1 @@ -0,0 +1,83 @@ +.\" Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group +.ig + +(woman-find-file buffer-file-name) + +(let* ((man-args (concat "-l " buffer-file-name)) + (bufname (concat "*Man " man-args "*"))) + (when (get-buffer bufname) + (kill-buffer bufname)) + (man man-args)) + +(compile + (concat "groff -t -e -man -Tps " + buffer-file-name + " > /tmp/tmp.ps && gv /tmp/tmp.ps")) + +.. +.TH NGNUTMEG 1 "6 June 2010" +.ds = \-\^\- +.ds ngspice \s-2NGSPICE\s+2 +.SH "NAME" +ngnutmeg \- ngspice post-processor +.SH "SYNOPSIS" +\fBngnutmeg\fP [\fIoptions\fP] [\fIdatafile\fP ...] +.SH "DESCRIPTION" +This man page is just a small overview. +The primary documentation of ngspice is in the \*[ngspice] User's Manual, +which is available as a pdf file. +.br +\fBngnutmeg\fP is a post processor for \*[ngspice] \- it takes +the raw output file created by \fBngspice \-r\fP +and plots the data on a graphics terminal or a workstation display. +Note that the raw output file is different from the +data that \*[ngspice] writes to the standard output. +.SH "OPTIONS" +.TP +\fB\-\fP +.br +Don't try to load the default data file ("rawspice") if no other files +are given. +.TP +\fB\-n\fP or \fB\*=no\-spiceinit\fP +Don't try to source the file ".spiceinit" upon startup. Normally \fBngnutmeg\fP +tries to find the file in the current directory, and if it is not found then +in the user's home directory. +.TP +\fB\-q\fP or \fB\*=completion\fP +Enable command completion. (defect) +.TP +\fB\-t\fP \fIterm\fP or \fB\*=term=\fP\fIterm\fP +The program is being run on a terminal with \fBmfb\fP name \fIterm\fP. +.TP +\fB\-h\fP or \fB\*=help\fP +Display a verbose help on the arguments available to the program. +.TP +\fB\-v\fP or \fB\*=version\fP +Display a version number and copyright information of the program. +.PP +Further arguments are taken to be data files in binary or ascii format +(see \fBsconvert\fP(1)) which are loaded into ngnutmeg. +If the file +is in binary format, it may be only partially completed (useful for +examining \*[ngspice] output before the simulation is finished). +One file may contain any number of data sets from different analyses. +.SH "ENVIRONMENT" +See ngspice(1) +.SH "FILES" +See ngspice(1) +.SH "SEE ALSO" +sconvert(1), ngspice(1), mfb(3), writedata(3), and +.br +\*[ngspice] User's Manual at \fBhttp://ngspice.sourceforge.net/docs.html\fP +.SH "BUGS" +Please report bugs to the ngspice project via +.br +\fBhttp://ngspice.sourceforge.net/bugrep.html\fP +.SH "AUTHOR" +Wayne Christopher (faustus@cad.berkeley.edu) +.br +\fBngspice\fP: various authors (see \fBhttp://sourceforge.net/projects/ngspice/\fP) +.\" Local Variables: +.\" mode: nroff +.\" End: diff --git a/Windows/spice/share/man/man1/ngsconvert.1 b/Windows/spice/share/man/man1/ngsconvert.1 new file mode 100644 index 00000000..55f72967 --- /dev/null +++ b/Windows/spice/share/man/man1/ngsconvert.1 @@ -0,0 +1,126 @@ +.\" Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group +.TH SCONVERT 1 "20 March 1986" +.UC 4 +.SH NAME +sconvert \- convert spice formats +.SH SYNOPSIS +.B sconvert fromtype fromfile totype tofile +.br +.B sconvert fromtype totype +.br +.B sconvert +.br +.SH DESCRIPTION +.B Sconvert +translates spice output files among three formats: the old +binary format, a new binary format, and a new ascii format. +The formats are specified by the +.B fromtype +and +.B totype +arguments: `o' for the old format, `b' for the new binary format, +and `a' for the new ascii format. +.B Fromtype +specifies the format to be read, and +.B totype +specifies the format to be written. +If +.B fromfile +and +.B tofile +are given, then they are used as the input and output, otherwise +standard input and output are used. +(Note that this second option is only available on \s-2UNIX\s+2 systems +\- on VMS and other systems you must supply the filenames.) +If no arguments are given, the parameters are prompted for. +.PP +Binary format is the preferred format for general use, as it is +the most economical in terms of space and speed of access, and ascii is +provided to make it easy to modify data files and transfer them +between machines with different floating-point formats. +The old format is provided only +for backward compatibility. +The three formats are as follows: +.br +.nf + +.B Old: + + What Size in Bytes + + title 80 + date 8 + time 8 + numoutputs 2 + the integer 4 2 + variable names -- + char[numoutputs][8] numoutputs * 8 + types of output numoutputs * 2 + node index numoutputs * 2 + plot title numoutputs * 24 + the actual data numpoints * numoutputs * 8 + +.B Ascii: + + Title: \fITitle Card String\fR + Date: \fIDate\fR + [ Plotname: \fIPlot Name\fR + Flags: \fIcomplex\fR or \fIreal\fR + No. Variables: \fInumoutputs\fR + No. Points: \fInumpoints\fR + Command: \fInutmeg command\fR + Variables: 0 \fIvarname1\fR \fItypename1\fR + 1 \fIvarname2\fR \fItypename2\fR + etc... + Values: + 0 n n n n ... + 1 n n n n ... + And so forth... + ] repeated one or more times +.fi +.PP +If one of the flags is \fIcomplex\fR, the points look like r,i where r and i +are floating point (in %e format). +Otherwise they are in %e format. +Only one of \fIreal\fR and \fIcomplex\fR should appear. +.PP +The lines are guaranteed to be less than 80 columns wide (unless the +plot title or variable names are very long), so this format is safe +to mail between systems like CMS. +.PP +Any number of \fBCommand:\fR lines may appear between the \fBNo. Points:\fR +and the \fBVariables:\fR lines, and whenever the plot is loaded into +\fBnutmeg\fR they will be executed. +.nf + +.B Binary: + + \fITitle Card\fR (a NULL terminated string) + \fIDate, Time\fR (a NULL terminated string) + [ + \fIPlot title\fR (a NULL terminated string) + \fINumber of variables\fR (an int) + \fINumber of data points\fR (an int) + \fIflags\fR (a short) + \fIvariable header struct\fR (repeated numoutputs times) + \fIvariable name\fR (a NULL terminated string) + \fIvariable type\fR (an int) + \fIset of outputs\fR (repeated numpoints times) + ] repeated one or more times. +.fi +.PP +A set of outputs is a vector of doubles of length numoutputs, or +a vector of real-imaginary pairs of doubles if the data is complex. +.SH "SEE ALSO" +nutmeg(1), spice(1), writedata(3) +.SH AUTHOR +Wayne Christopher (faustus@cad.berkeley.edu) +.SH BUGS +If variable names and the title +and plotname strings have trailing +blanks in them they will be stripped off when the file is read, if +it is in ascii format. +.PP +If a plot title begins with "Title:" \fBnutmeg\fR will be fooled into thinking +that this is an ascii format file. +\fBSconvert\fR always requires the type to be specified, however. diff --git a/Windows/spice/share/man/man1/ngspice.1 b/Windows/spice/share/man/man1/ngspice.1 new file mode 100644 index 00000000..cd5e31db --- /dev/null +++ b/Windows/spice/share/man/man1/ngspice.1 @@ -0,0 +1,152 @@ +.\" Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group +.ig + +(woman-find-file buffer-file-name) + +(let* ((man-args (concat "-l " buffer-file-name)) + (bufname (concat "*Man " man-args "*"))) + (when (get-buffer bufname) + (kill-buffer bufname)) + (man man-args)) + +(compile (concat "groff -t -e -man -Tps " + buffer-file-name + " > /tmp/tmp.ps && gv /tmp/tmp.ps")) + +.. +.TH NGSPICE 1 "6 June 2010" +.ds = \-\^\- +.ds ngspice \s-2NGSPICE\s+2 +.SH "NAME" +ngspice \- circuit simulator derived from SPICE3f5 +.SH "SYNOPSIS" +\fBngspice\fP [\fIoptions\fP] [\fIfile\fP ...] +.SH "DESCRIPTION" +This man page is just a small overview. +The primary documentation of ngspice is in the \*[ngspice] User's Manual, +which is available as a pdf file. +.SH "OPTIONS" +.TP +\fB\-n\fP or \fB\*=no\-spiceinit\fP +Don't try to source the file ".spiceinit" upon startup. Normally \*[ngspice] +tries to find the file in the current directory, and if it is not found then +in the user's home directory. +.TP +\fB\-q\fP or \fB\*=completion\fP +Enable command completion. (defect) +.TP +\fB\-t\fP \fIterm\fP or \fB\*=term=\fP\fIterm\fP +The program is being run on a terminal with \fBmfb\fP name \fIterm\fP. +.TP +\fB\-b\fP or \fB\*=batch\fP +Run in batch mode. +\*[ngspice] will read the standard input or the specified +input file and do the simulation. +Note that if the standard input is not a terminal, \*[ngspice] will default +to batch mode, unless the \-i flag is given. +.TP +\fB\-s\fP or \fB\*=server\fP +Run in server mode. +This is like batch mode, except that a temporary rawfile is used and then +written to the standard output, preceded by a line with a single "@", after +the simulation is done. +This mode is used by the ngspice daemon. +.TP +\fB\-i\fP or \fB\*=interactive\fP +Run in interactive mode. +This is useful if the standard input is not a terminal but interactive mode +is desired. +Command completion is not available unless the standard input is a terminal, +however. +.TP +\fB\-r\fP \fIrawfile\fP or \fB\*=rawfile=\fP\fIfile\fP +Use \fIrawfile\fP as the default file into which the results of +the simulation are saved. +.TP +\fB\-c\fP \fIcircuitfile\fP or \fB\*=circuitfile=\fP\fIcircuitfile\fP +Use \fIcircuitfile\fP as the default input deck. +.TP +\fB\-h\fP or \fB\*=help\fP +Display a verbose help on the arguments available to the program. +.TP +\fB\-v\fP or \fB\*=version\fP +Display a version number and copyright information of the program. +.TP +\fB\-a\fP or \fB\*=autorun\fP +FIXME +.TP +\fB\-o\fP \fIoutfile\fP or \fB\*=output=\fP\fIoutfile\fP +All logs generated during a batch run (\fB\-b\fP) will be saved in \fIoutfile\fP. +.TP +\fB\-p\fP or \fB\*=pipe\fP +Allow a program (e.g., xcircuit) to act as a GUI frontend for +ngspice through a pipe. +Thus ngspice will assume that the pipe is a tty and allows one to run in +interactive mode. +.PP +Further arguments are taken to be SPICE input decks, which are read +and saved. +(If batch mode is requested then they are run immediately.) +.SH "ENVIRONMENT" +.TP +\fBSPICE_LIB_DIR\fP +.TP +\fBSPICE_EXEC_DIR\fP +.TP +\fBSPICE_HOST\fP +.TP +\fBSPICE_BUGADDR\fP +.TP +\fBSPICE_EDITOR\fP +.TP +\fBSPICE_ASCIIRAWFILE\fP default \fI0\fP +Format of the rawfile. +\fI0\fP for binary, and \fI1\fP for ascii. +.TP +\fBSPICE_NEWS\fP default \fI$SPICE_LIB_DIR/news\fP +A file which is copied verbatim to stdout when ngspice starts in interactive mode. +.TP +\fBSPICE_MFBCAP\fP default \fI$SPICE_LIB_DIR/mfbcap\fP +.TP +\fBSPICE_HELP_DIR\fP default \fI$SPICE_LIB_DIR/helpdir\fP +.TP +\fBSPICE_SCRIPTS\fP default \fI$SPICE_LIB_DIR/scripts\fP +In this directory the \fIspinit\fP file will be searched. +.TP +\fBSPICE_PATH\fP default \fI$SPICE_EXEC_DIR/ngspice\fP +.PP +various undocumented ngspice centric environment variables : +.TP +\fBNGSPICE_MEAS_PRECISION\fP +.TP +\fBSPICE_NO_DATASEG_CHECK\fP +.PP +Common environment variables : +.TP +\fBTERM\fP \fBLINES\fP \fBCOLS\fP \fBDISPLAY\fP \fBHOME\fP \fBPATH\fP \fBEDITOR\fP \fBSHELL\fP +.TP +\fBPOSIXLY_CORRECT\fP +.SH "FILES" +.TP +\fI$SPICE_LIB_DIR/scripts/spinit\fP +The System's Initialisation File. +.TP +\fI\&.spiceinit\fP or \fI$HOME/.spiceinit\fP +The User's Initialisation File. +.SH "SEE ALSO" +sconvert(1), ngnutmeg(1), mfb(3), writedata(3), and +.br +\*[ngspice] User's Manual at \fBhttp://ngspice.sourceforge.net/docs.html\fP +.SH "BUGS" +Please report bugs to the ngspice project via +.br +\fBhttp://ngspice.sourceforge.net/bugrep.html\fP +.SH "AUTHORS" +\fBspice3\fP: Tom Quarles (quarles@cad.berkeley.edu) +.br +\fBnutmeg\fP: User interface: Wayne Christopher (faustus@cad.berkeley.edu) +.br +\fBngspice\fP: various authors (see \fBhttp://sourceforge.net/projects/ngspice/\fP) +.\" Local Variables: +.\" mode: nroff +.\" End: diff --git a/Windows/spice/share/ngspice/scripts/ciderinit b/Windows/spice/share/ngspice/scripts/ciderinit new file mode 100644 index 00000000..56163322 --- /dev/null +++ b/Windows/spice/share/ngspice/scripts/ciderinit @@ -0,0 +1,23 @@ +*** This is a sample spice/cider initialization file. +alias pl print line +alias pc print col +alias ds display +alias hi history +alias li listing +alias p plot +alias pr print +alias q quit +alias bye quit +alias exit quit +alias so source +alias ld load +alias xg xgraph tmp +alias sp setplot +alias dl devload +alias dx devaxis +set width = 80 height = 24 nosort noaskquit nobreak +set xbrushheight = 3 xbrushwidth = 3 +set unixcom +set hcopydevtype = postscript +set pointstyle = markers +set term = vt100 diff --git a/Windows/spice/share/ngspice/scripts/devaxis b/Windows/spice/share/ngspice/scripts/devaxis new file mode 100644 index 00000000..7b3d23f3 --- /dev/null +++ b/Windows/spice/share/ngspice/scripts/devaxis @@ -0,0 +1,69 @@ +* initialize a device plot +.control +begin + unset axis + if $argc = 1 + set axis = $argv[1] + strcmp flag $axis "x" + if ($flag = 0) + echo "setting axis to x" + strcmp flag "$?&devaxis" "0" + if ($flag = 0) + strcmp flag "$?&xaxis" "0" + if ($flag = 0) + echo "Error: no x axis present" + else + transpose all + setscale xaxis + let devaxis = 1 + end + else + strcmp flag "$&devaxis" "-1" + if ($flag = 0) + strcmp flag "$?&xaxis" "0" + if ($flag = 0) + echo "Error: no x axis present" + else + transpose all + setscale xaxis + let devaxis = 1 + end + end + end + else + strcmp flag $axis "y" + if ($flag = 0) + echo "setting axis to y" + strcmp flag "$?&devaxis" "0" + if ($flag = 0) + strcmp flag "$?&yaxis" "0" + if ($flag = 0) + echo "Error: no y axis present" + else + setscale yaxis + let devaxis = -1 + end + else + strcmp flag "$&devaxis" "1" + if ($flag = 0) + strcmp flag "$?&yaxis" "0" + if ($flag = 0) + echo "Error: no y axis present" + else + transpose all + setscale yaxis + let devaxis = -1 + end + end + end + else + echo "Error: unknown axis" $axis + echo "usage: devaxis <x|y>" + end + end + else + echo "usage: devaxis <x|y>" + end + + unset axis flag +end diff --git a/Windows/spice/share/ngspice/scripts/devload b/Windows/spice/share/ngspice/scripts/devload new file mode 100644 index 00000000..d007fad5 --- /dev/null +++ b/Windows/spice/share/ngspice/scripts/devload @@ -0,0 +1,21 @@ +* initialize a device plot +.control +begin + unset devfile + if $argc = 1 + set devfile = $argv[1] + load $devfile + strcmp flag "$?&y" "1" + if ($flag = 0) + let yaxis = y[0] + transpose all + let xaxis = x[0] + transpose all + setscale yaxis + end + else + echo "usage: devload <filename>" + end + + unset devfile flag +end diff --git a/Windows/spice/share/ngspice/scripts/setplot b/Windows/spice/share/ngspice/scripts/setplot new file mode 100644 index 00000000..38ca0da1 --- /dev/null +++ b/Windows/spice/share/ngspice/scripts/setplot @@ -0,0 +1,64 @@ +* set the current working plot +.control + +begin + unset resp + if $argc + set resp = $argv[1] + else + if $?plots = 0 + echo Error: there aren\'t any plots currently loaded. + goto bottom + else + if $#plots = 0 + echo Error: there aren\'t any plots currently loaded. + goto bottom + end + end + + if $?resp = 0 + set oldplot = $curplot + echo ' Type the name of the desired plot:' + echo '' + echo ' new New plot' + foreach pl $plots + set curplot = $pl + strcmp i $pl $oldplot + if $i = 0 + echo "Current $pl $curplottitle ({$curplotname})" + else + echo " $pl $curplottitle ({$curplotname})" + end + end + set curplot = $oldplot + echo -n '? ' + set resp = $< + end + end + + + strcmp i $resp "" + if $i = 0 + goto bottom + end + + strcmp i $resp new + if $i = 0 + set curplot = new + goto bottom + end + + foreach pl $plots + strcmp i $resp $pl + if $i = 0 + set curplot = $pl + goto bottom + end + end + + echo Error: no such plot name $resp + + label bottom + + unset resp i pl newflag oldplot +end diff --git a/Windows/spice/share/ngspice/scripts/spectrum b/Windows/spice/share/ngspice/scripts/spectrum new file mode 100644 index 00000000..3e394432 --- /dev/null +++ b/Windows/spice/share/ngspice/scripts/spectrum @@ -0,0 +1,165 @@ +* Fourier Series Function for SPICE +* This script is offered here for learning purposes, even if it is outdated +* and superseeded by the spec function and especially by the much faster fft function. +* You may use this script in conjunction with e.g. a ringoscillator output (see +* the ngspice manual, chapter 17). + +.control + begin + +* Variable argc delivers the number of command line parameters given by the user +* after the 'spectrum' command + if ($argc lt 4) + echo Error: Too few arguments. + echo ' 'Spectrum produces a plot containing a fourier series transformation of + echo ' 'the specified vectors + echo usage: spectrum startfreq stop step vec [[vec] ...] + goto bottom + end + +* Check if vectors 'time' and any input vector(s) are available +* argv[n] delivers the command line entries after the 'spectrum' command, +* starting with argv[1]. $argv[4-len] delivers the value of all tokens, +* starting with postion 4 till the end of the command line + if ( time eq time ) + foreach vec $argv[4-len] + if ( $vec eq $vec ) + else + goto bottom + end + end + else + echo ' 'Spectrum can not work without a time vector from a transient analysis. + goto bottom + end + + * generate a new plot entitled 'scratch', which will hold intermediate + * results and will be discarded after their evaluation. + set dt=$curplot + set title=$curplottitle + set curplot=new + set scratch=$curplot + + * A vector 'span' is created in the 'scratch' plot to hold the time difference + * of the transient simulation. {$dt}.time allows to access the 'time' vector + * from the dt plot (which is normally named 'tranx' with x a consecutoive + * integer number, depending on the amount of transient simulations already run + * in the present job. + let span={$dt}.time[length({$dt}.time)-1]-{$dt}.time[0] + +* Calculate the number of steps in all of the spectra to be evaluated below + if ($argv[3] gt 0.999/span) + let fpoints= ( $argv[2] - $argv[1] ) / $argv[3] +1 + if (fpoints < 2) + echo frequency start stop or step not correctly specified + goto reset + end + else + echo Error: time span is not long enough for a step frequency of $argv[3] Hz + goto reset + end + let lent = length({$dt}.time) + set lent = "$&lent" + let nyquist = {$lent}/2/span + if ($argv[2] gt nyquist) + echo Error: The nyquist limit is exceeded, try a frequency less than "$&nyquist" Hz + goto reset + end + set fpoints="$&fpoints" + + * generate a new plot to hold the spectra + set curplot=new + set spec=$curplot + set curplottitle=$title + set curplotname='Spectrum Analysis' + +* argv[3] is the third agrgument from the input line +* spectrum 1 1000MEG 10MEG v(out25) +* that is the delta frequency +* The fcn vector(n) creates a vector of length n, its elements have +* the values 0, 1, 2, 3, ..., n-2, n-1. Each element then is multiplied +* with the frequency step value. + let frequency=vector( $fpoints )*$argv[3] + +* Add an frequency offset to each element of vector 'frequency' +* to suppress the (typically) large dc component. + dowhile frequency[1] < ( $argv[1] + 1e-9 ) + let frequency = frequency + $argv[3] + end + +* For each input vector given on the command line, +* create a new vector for complex numbers + foreach vec $argv[4-len] + let $vec = vector( $fpoints ) + j(vector( $fpoints )) + reshape $vec [{$fpoints}] + end + +* $scratch is a plot for intermediate results, will be destroyed during cleanup +* $dt is the plot with the original data +* $spec is a plot for storing the spectrum + set curplot=$scratch + + * some test + let npers=1 + let test = span-2/$argv[3] + 1e-9 + while test > 0 + let npers = npers + 1 + let test = test-1/$argv[3] + end + + * Do the spectrum calculations + let ircle = 2*pi*max(-1,({$dt}.time-{$dt}.time[{$lent}-1])*{$argv[3]}/npers) + let win = 1 - cos(ircle) + let ircle = npers*ircle + let circle = ircle * ({$spec}.frequency[0]/$argv[3] - 1) + let k=vector( $fpoints ) + foreach k $&k + let circle = circle + ircle + foreach vec $argv[4-len] + let tmp = win*{$dt}.{$vec} + let {$spec}.{$vec}[{$k}] = 2*(mean(cos(circle)*tmp),mean(sin(circle)*tmp)) + end + end + +* plot (and write) the generated spectrum + set curplot = $spec + settype frequency frequency + foreach vec $argv[4-len] + let spectrum = mag({$vec}) + plot spectrum + write specout.out spectrum + end + +* If you have an oscillator, fimd its frequency +* as maximum of vector spectrum or goto end (uncomment next line) +* goto cleanup + set curplot=$scratch + let counter = 0 + let contents = 0 + let freqmax = 0 + let spectrum = {$spec}.spectrum + + foreach spectrum $&spectrum + if counter > 4 + if ( contents < $spectrum ) + let contents = $spectrum + set count = "$&counter" + let freqmax = {$spec}.frequency[{$count}] + end + end + let counter = counter + 1 + end + + echo + echo Osc. frequency at "$&freqmax" Hz + echo + goto cleanup + + label reset + set curplot=$dt + label cleanup + destroy $scratch + unset fpoints dt scratch spec vec k title lent + label bottom + + end diff --git a/Windows/spice/share/ngspice/scripts/spinit b/Windows/spice/share/ngspice/scripts/spinit new file mode 100644 index 00000000..ed5cd0e6 --- /dev/null +++ b/Windows/spice/share/ngspice/scripts/spinit @@ -0,0 +1,31 @@ +* Standard ngspice init file +alias exit quit +alias acct rusage all +set x11lineararcs +*set rndseed=12 +** ascii rawfile ** +*set filetype=ascii +** frontend debug output ** +*set ngdebug +** no asking after quit ** +set noaskquit +** set the number of threads in openmp +** default (if compiled with --enable-openmp) is: 2 +*set num_threads=4 + +strcmp __flag $program "ngspice" +if $__flag = 0 + +* For SPICE2 POLYs, edit the below line to point to the location +* of your codemodel. + + codemodel C:/Spice/lib/ngspice/spice2poly.cm + +* The other codemodels + codemodel C:/Spice/lib/ngspice/analog.cm + codemodel C:/Spice/lib/ngspice/digital.cm + codemodel C:/Spice/lib/ngspice/xtradev.cm + codemodel C:/Spice/lib/ngspice/xtraevt.cm + +end +unset __flag |