next up previous contents index
Next: Device Expressions Up: WRspice Input Format Previous: Uniform Distributed RC Model   Contents   Index


Voltage and Current Sources

General Form:
vname n+ n- [expr] [[dc] dcvalue] [ac [acmag [acphase]] | table(name)]
[distof1 [f1mag [f1phase]]] [distof2 [f2mag [f2phase]]]
iname n+ n- [expr] [[dc] dcvalue] [ac [acmag [acphase]] | table(name)]
[distof1 [f1mag [f1phase]]] [distof2 [f2mag [f2phase]]]
aname n+ n- V|I = expr [[dc] dcvalue] [ac [acmag [acphase]] | table(name)]
[distof1 [f1mag [f1phase]]] [distof2 [f2mag [f2phase]]]
Examples:
vcc 10 0 dc 6
vin 13 2 0.001 ac 1 sin(0 1 1meg)
v2 10 1 ac table(acvals)
isrc 23 21 ac 0.333 45.0 2*sffm(0 1 10k 5 1k)
vmeas 12 9
vin 1 0 2*v(2)+v(3)
azz 2 0 v=.5*exp(v(2))
ixx 2 4 pulse(0 1 1n 10n 10n) + pulse(0 1 40n 10n 10n)

In WRspice, the specification of an ``independent'' source is completely general, as the output can be governed by an arbitrary expression containing functions of other circuit variables. The syntax is a superset of the notation used in previous versions of SPICE, which separately keyed independent and dependent sources.

The leading letter ``v'' keys a voltage source, and ``i'' keys a current source. In addition, the ``arbitrary source'' used in SPICE3 is retained, but is keyed by ``a'', rather than ``b'' (``b'' is used for Josephson junctions in WRspice). This is a special case of the general source specification included for backward compatibility.

The n+ and n- are the positive and negative nodes, respectively. Note that voltage sources need not be grounded. Positive current is assumed to flow from the positive node, through the source, to the negative node. A current source of positive value will force current to flow in to the n+ node, through the source, and out of the n- node. Voltage sources, in addition to being used for circuit excitation, are often used as ``ammeters'' in WRspice, that is, zero valued voltage sources may be inserted into the circuit for the purpose of measuring current (in WRspice, an inductor can be used for this purpose as well). Zero-valued voltage sources will, of course, have no effect on circuit operation since they represent short-circuits, however they add complexity which might slightly affect simulation speed.

In transient and dc analysis, sources can in general have complex definitions which involve the dependent variable (e.g., time in transient analysis) and other circuit variables. There are built-in functions (pulse, pwl, etc.) which can be included in the expr.

Constant values associated with the source are specified by the following option keywords:

dc dcvalue
This specifies a fixed dc analysis value for the source, and enables the source to be used in a dc sweep if the expr is given. If the expr is not given, the source is available for use in a dc sweep whether or not the dc keyword is given. If an expr is present without ``dc dcvalue'', the time=0 value of the expr is used for dc analysis. If the source value is zero for both dc and transient analyses, this value and the expr may be omitted. If the source is the same constant value in dc and transient analysis, the keyword ``dc'' and the value can be omitted.

ac [[acmag [acphase]] | table(name)]
The parameter acmag is the ac magnitude and acphase is the ac phase. The source is set to this value in ac analysis. If acmag is omitted following the keyword ac, a value of unity is assumed. If acphase is omitted, a value of zero is assumed. If the source is not an ac small-signal input, the keyword ac and the ac values are omitted. Alternatively, a table can be specified, which contains complex values at different frequency points. In ac analysis the source value will be derived from the table. The table with the given name should be specified in a .table line, with the ac keyword present. The values in the table are the real and imaginary components, and not magnitude and phase.

distof1 and distof2
These are the keywords that specify that the independent source has distortion inputs at the frequencies f1 and f2 respectively for distortion analysis. The keywords may be followed by an optional magnitude and phase. The default values of the magnitude and phase are 1.0 and 0.0 respectively.

The expr is used to assign a time-dependent value for transient analysis and to supply a functional dependence for dc analysis. If a source is assigned a time-dependent value, the time-zero value is used for dc analysis, unless a dc value is also provided.



Subsections
next up previous contents index
Next: Device Expressions Up: WRspice Input Format Previous: Uniform Distributed RC Model   Contents   Index
Stephen R. Whiteley 2017-02-22