next up previous contents index
Next: Title, Comments, and Inclusions Up: WRspice Input Format Previous: Input Format   Contents   Index

Circuit Description

The circuit to be analyzed is described to WRspice by a set of element lines, which define the circuit topology and element values, and a set of control lines, which define the model parameters and the run controls. The first line in the input file must be a title line. The order of the remaining circuit definition and control lines is arbitrary, except that continuation lines must immediately follow the line being continued, and certain constructs are expected to contain blocks of lines, the order of which is generally arbitrary within the block except for shell commands which of course must be ordered. Certain special input file formats are recognized, such as operating range analysis control files, and files generated by the schematic capture front end. Exceptions to the rule of arbitrary line placement will be described in the sections describing these files.

As the file is being read, any shell variable references are expanded. The WRspice shell is described in 3.12, but at this point the reader should be aware that just about any text within the circuit description can be specified through the shell substitution mechanism.

Each element in the circuit is specified by an element line that contains the element name, the circuit nodes to which the element is connected, and the values of the parameters that determine the electrical characteristics of the element. The first letter of the element name specifies the element type (case insensitive). For example, a resistor name must begin with the letter `R' or `r' and can contain one or more characters. Hence, R, r1, Rse, ROUT, and r3ac2zY are valid resistor names.

In the descriptions that follow, data fields that are enclosed in square brackets `[', `]' are optional. All indicated punctuation (parentheses, equal signs, etc.) is optional and merely indicates the presence of any delimiter. A consistent style such as that shown here will make the input easier to understand. With respect to branch voltages and currents, WRspice uniformly uses the associated reference convention (current flows in the direction of voltage drop).

Node names must begin with an alphanumeric character, but may have trailing or embedded punctuation (but this is generally not recommended). In some cases, ``strange'' node names must be quoted when referenced in WRspice as v("nodename"). The datum (ground) node must be named ``0'', however. Note the difference with SPICE2, where nodes are evaluated as numbers. Thus, `00' and `0' are distinct in WRspice, but not in SPICE2.

The circuit cannot contain a loop of voltage sources. If a dc operating point analysis is performed, which is true for all analysis except for transient analysis with the uic (use initial conditions) flag set, the circuit can not contain a loop of voltage sources and/or inductors and cannot contain a cutset of current sources and/or capacitors. In transient analysis with the uic flag set (which is always the case when Josephson junctions are present), inductor/voltage source loops are allowed, as are capacitor/current source cut sets. However, parallel voltage sources and series current sources are not accepted. It is not strictly necessary that each node in the circuit have a dc path to ground with the uic flag given, however convergence problems may result. It is sometimes necessary to add a large-valued resistor to ground in these cases. In general, nodes should have at least two connections.

Text can contain references to shell variables, i.e., variable names that begin with `$'. These variables are evaluated as the circuit is read in, or with the reset command once the circuit is loaded. The variables must be known to the shell before the circuit is parsed, so if they are defined in the input file, the definition must occur in .exec blocks or .options lines, which are evaluated before the circuit is parsed, and not .control blocks, which are evaluated after the circuit is parsed. If the '$' is preceded with a backslash (` \'), the shell substitution is suppressed, but the construct forms a comment delimiter so that the remainder of the line is ignored.

Any text enclosed in single quotes (') will be evaluated as an expression as the file is read (before shell substitution) and the string will be replaced by the result. Since evaluation is performed before shell substitution, the expression can not contain shell variables or other `$' references, but it can contain vectors (which must be defined before the circuit is read).

If the first line of text in a file starts with the characters ``#!'', that line will be discarded when the file is read. This enables WRspice input files to be self-executing using the mechanisms of the UNIX shell. For example, if the following line is prepended to an input file

#! wrspice
and the file is made executable, then typing the name of the file will initiate WRspice on the circuit contained in the file.


next up previous contents index
Next: Title, Comments, and Inclusions Up: WRspice Input Format Previous: Input Format   Contents   Index
Stephen R. Whiteley 2006-10-23