10.5 Variables
The operation of both Nutmeg and Ngspice may be affected by setting
variables with the "set" command. In addition to the variables
mentioned below, the set command in Ngspice also affect the behaviour of
the simulator via the options previously described under the section on
".OPTIONS".
The variables meaningful to nutmeg which may be altered by the set
command are:
diff_abstol
-
The absolute tolerance used by the diff command. appendwrite Append to
the file when a write command is is sued, if one already exists.
colorN
-
These variables determine the colors used, if X is being run on a color
display. N may be between 0 and 15. Color 0 is the background, color 1
is the grid and text color, and colors 2 through 15 are used in order
for vectors plot ted. The value of the color variables should be names
of colors, which may be found in the file /usr/lib/rgb.txt.
combplot
-
Plot vectors by drawing a vertical line from each point to the X-axis,
as opposed to joining the points. Note that this option is subsumed in
the plottype option, below.
cpdebug
-
Print cshpar debugging information (must be com plied with the -DCPDEBUG
flag). Unsupported in the current release.
debug
-
If set then a lot of debugging information is printed (must be compiled
with the -DFTEDEBUG flag). Unsupported in the current release.
device
-
The name (
/dev/tty??
) of the graphics device. If this variable
isn't set then the user's terminal is used. To do plotting on another
monitor you probably have to set both the device and term variables.
(If device is set to the name of a file, nutmeg dumps the graphics
control codes into this file – this is useful for saving plots.)
echo
-
Print out each command before it is executed.
filetype
-
This can be either ascii or binary, and determines what format are. The
default is ascii.
fourgridsize
-
How many points to use for interpolating into when doing fourier
analysis.
gridsize
-
If this variable is set to an integer, this number is used as the number
of equally spaced points to use for the Y axis when plotting. Otherwise
the current scale is used (which may not have equally spaced points).
If the current scale isn't strictly monotonic, then this option has no
effect.
hcopydev
-
If this is set, when the hardcopy command is run the resulting file is
automatically printed on the printer named hcopydev with the command
lpr -Phcopydev -g file
.
hcopyfont
-
This variable specifies the font name for hardcopy output plots. The
value is device dependent.
hcopyfontsize
-
This is a scaling factor for the font used in hardcopy plots.
hcopydevtype
-
This variable specifies the type of the printer output to use in the
hardcopy command. If hcopydevtype is not set, plot (5) format is
assumed. The standard distribution currently recognizes postscript as
an alternative output for mat. When used in conjunction with hcopydev,
hcopydevtype should specify a format supported by the printer.
height
-
The length of the page for asciiplot and print col.
history
-
The number of events to save in the his tory list.
lprplot5
-
This is a printf(3s) style format string used to specify the command to
use for sending plot(5)-style plots to a printer or plotter. The first
parameter sup plied is the printer name, the second parameter supplied
is a file name containing the plot. Both parameters are strings. It
is trivial to cause Ngspice to abort by supplying a unreasonable format
string.
lprps
-
This is a printf(3s) style format string used to specify the command to
use for sending PostScript plots to a printer or plotter. The first
parameter supplied is the printer name, the second parameter supplied
is a file name containing the plot. Both parameters are strings. It is
trivial to cause Ngspice to abort by supplying a unreasonable format
string.
nfreqs
-
The number of frequencies to compute in the fourier command. (Defaults
to 10.)
nobreak
-
Don't have asciiplot and print col break between pages.
noasciiplotvalue
-
Don't print the first vector plotted to the left when doing an
asciiplot.
noclobber
-
Don't overwrite existing files when do ing IO redirection.
noglob
-
Don't expand the global characters `*', `?', `[', and `]'. This is the
default.
nogrid
-
Don't plot a grid when graphing curves (but do label the axes).
nomoremode
-
If nomoremode is not set, whenever a large amount of data is being
printed to the screen (e.g, the print or asciiplot commands), the output
is stopped every screenful and continues when a carriage return is
typed. If nomoremode is set then data scrolls off the screen without
check.
nonomatch
-
If noglob is unset and a global expression cannot be matched, use the
global characters literally instead of complaining.
nosort
-
Don't have display sort the variable names.
noprintscale
-
Don't print the scale in the leftmost column when a print col command is
given.
numdgt
-
The number of digits to print when printing tables of data (fourier,
print col). The default precision is 6 digits. On the VAX,
approximately 16 decimal digits are avail able using double precision,
so numdgt should not be more than 16. If the number is negative, one
fewer digit is printed to ensure constant widths in tables.
plottype
-
This should be one of normal, comb, or point:chars. normal, the
default, causes points to be plotted as parts of connected lines. comb
causes a comb plot to be done (see the description of the combplot
variable above). point causes each point to be plotted separately - the
chars are a list of characters that are used for each vector plotted.
If they are omitted then a de fault set is used.
polydegree
-
The degree of the polynomial that the plot command should fit to the
data. If polydegree is N, then nutmeg fits a degree N polynomial to
every set of N points and draw 10 intermediate points in between each
end point. If the points aren't monotonic, then it tries rotating the
curve and reducing the degree until a fit is achieved.
polysteps
-
The number of points to interpolate between every pair of points
available when doing curve fitting. The default is 10.
program
-
The name of the current program (argv[0]).
prompt
-
The prompt, with the character `!' replaced by the current event number.
rawfile
-
The default name for rawfiles created.
diff_reltol
-
The relative tolerance used by the diff command.
remote_shell
-
Overrides the name used for generating rspice runs (default is
"rsh").
rhost
-
The machine to use for remote NGSPICE runs, in stead of the default one
(see the description of the rspice command, below).
rprogram
-
The name of the remote program to use in the rspice command.
slowplot
-
Stop between each graph plotted and wait for the user to type return
before continuing.
sourcepath
-
A list of the directories to search when a source command is given. The
default is the current directory and the standard ngspice library
(/usr/local/lib/ngspice, or whatever LIBPATH is #defined to in the Ngspice
source.
spicepath
-
The program to use for the aspice command. The default is
/cad/bin/spice.
term
-
The mfb name of the current terminal.
units
-
If this is degrees, then all the trig functions will use degrees instead
of radians.
unixcom
-
If a command isn't defined, try to execute it as a UNIX command.
Setting this option has the effect of giving a rehash command, below.
This is useful for people who want to use nutmeg as a login shell.
verbose
-
Be verbose. This is midway between echo and de bug / cpdebug.
diff _vntol
-
The absolute voltage tolerance used by the diff command.
width
-
The width of the page for asciiplot and print col.
x11lineararcs
-
Some X11 implementations have poor arc drawing. If you set this option,
Ngspice will plot using an approximation to the curve using straight
lines.
xbrushheight
-
The height of the brush to use if X is being run.
xbrushwidth
-
The width of the brush to use if X is being run.
xfont
-
The name of the X font to use when plotting data and entering labels.
The plot may not look good if this is a variable-width font.
There are several set variables that Ngspice uses but Nutmeg does
not. They are:
editor
-
The editor to use for the edit command.
modelcard
-
The name of the model card (normally
noaskquit
-
Do not check to make sure that there are no circuits suspended and no
plots un saved. Normally Ngspice warns the user when he tries to quit if
this is the case.
nobjthack
-
Assume that BJTs have 4 nodes.
noparse
-
Don't attempt to parse input files when they are read in (useful for
debugging). Of course, they cannot be run if they are not parsed.
nosubckt Don't expand subcircuits.
renumber
-
Renumber input lines when an input file has .include's. subend The card
to end subcircuits (normally
subinvoke
-
The prefix to invoke subcircuits (nor mally x). substart The card to
begin subcircuits (normally
10.6 INIT FILES
Ngspice reads some initialization information and paths from a file called
"spinit" or "tclspinit" (the latter if you have compiled tclspice). The init
file is read by ngspice or ngnutmeg as they start. The init script contains
spice commands (interactive commands). The following example show the standard
ngspice init file.
* Standard spice and nutmeg init file
alias exit quit
alias acct rusage all
set x11lineararcs
*unset brief
strcmp __flag $program "ngspice"
if $__flag = 0
*set numparams
* For SPICE2 POLYs, edit the below line to point to the location
* of your codemode.
codemodel /usr/local/lib/spice/spice2poly.cm
* The other codemodels
codemodel /usr/local/lib/spice/analog.cm
codemodel /usr/local/lib/spice/digital.cm
codemodel /usr/local/lib/spice/xtradev.cm
codemodel /usr/local/lib/spice/xtraevt.cm
end
unset __flag
The spice init file location depends of the operating system you are running
and the configuration parameters.
The init file is the best place to put commands you always input when the
simulator starts.
10.7 MISCELLANEOUS
If there are subcircuits in the input file, Ngspice expands instances of
them. A subcircuit is delimited by the cards .subckt and .ends, or
whatever the value of the variables substart and subend is,
respectively. An instance of a subcircuit is created by specifying a
device with type 'x' - the device line is written
xname node1 node2 ... subcktname
where the nodes are the node names that replace the formal parameters on
the .subckt line. All nodes that are not formal parameters are
prepended with the name given to the instance and a ':', as are the
names of the devices in the subcircuit. If there are several nested
subcircuits, node and device names look like subckt1:subckt2:...:name.
If the variable subinvoke is set, then it is used as the prefix that
specifies instances of subcircuits, instead of 'x'.
Nutmeg occasionally checks to see if it is getting close to running out
of space, and warns the user if this is the case. (This is more likely
to be useful with the NGSPICE front end.)
C-shell type quoting with "" and ”, and backquote substitution may be
used. Within single quotes, no further substitution (like history
substitution) is done, and within double quotes, the words are kept
together but further substitution is done. Any text between backquotes
is replaced by the result of executing the text as a command to the
shell.
Tenex-style ('set filec' in the 4.3 C-shell) command, filename, and
keyword completion is possible: If EOF (control-D) is typed after the
first character on the line, a list of the commands or possible
arguments is printed (If it is alone on the line it exits nutmeg). If
escape is typed, then nutmeg tries to complete what the user has already
typed. To get a list of all commands, the user should type <space> ^D.
The values of variables may be used in commands by writing $varname
where the value of the variable is to appear. The special variables $$
and $< refer to the process ID of the program and a line of input which
is read from the terminal when the variable is evaluated, respectively.
If a variable has a name of the form $&word, then word is considered a
vector (see above), and its value is taken to be the value of the
variable. If $foo is a valid variable, and is of type list, then the
expression $foo[low-high] represents a range of elements. Either the
upper index or the lower may be left out, and the reverse of a list may
be obtained with $foo[len-0]. Also, the notation $?foo evaluates to 1
if the variable foo is defined, 0 otherwise, and $#foo evaluates to the
number of elements in foo if it is a list, 1 if it is a number or
string, and 0 if it is a boolean variable.
History substitutions, similar to C-shell history substitutions, are
also available - see the C-shell manual page for all of the details.
The characters ~, {, and } have the same effects as they do in the
C-Shell, i.e., home directory and alternative expansion. It is possible
to use the wildcard characters *, ?, [, and ] also, but only if you
unset noglob first. This makes them rather useless for typing algebraic
expressions, so you should set noglob again after you are done with
wildcard expansion. Note that the pattern [^abc] matchs all characters
except a, b, and c.
IO redirection is available - the symbols >, >>, >&, >>&, and < have the
same effects as in the C-shell.
You may type multiple commands on one line, separated by semicolons.
If you want to use a different mfbcap file than the default (usually
~cad/lib/mfbcap), you have to set the environment variable SPICE_MFBCAP
before you start nutmeg or ngspice. The -m option and the mfbcap variable
no longer work.
If X is being used, the cursor may be positioned at any point on the
screen when the window is up and characters typed at the keyboard are
added to the window at that point. The window may then be sent to a
printer using the xpr(1) program.
Nutmeg can be run under VAX/VMS, as well as several other operating
systems. Some features like command completion, expansion of *, ?, and
[], backquote substitution, the shell command, and so forth do not work.
On some systems you have to respond to the -moreprompt during plot with
a carriage return instead of any key as you can do on UNIX.