Physics and Astronomy
Home Our Teaching Resources CDHW Electronics2 Userguide secC.html

# SPICE 3 User's Manual - Appendix C

## APPENDIX C: SPICE2 NONLINEAR DEPENDENT SOURCES

[Note: The SPICE3 non-linear sources are not compatible with the poly() syntax used in SPICE2. This appendix is included to facilitate conversion of old source. CDHW.]

SPICE2 allows circuits to contain dependent sources characterized by any of the four equations
```i=f(v)  v=f(v)  i=f(i)  v=f(i)
```
where the functions must be polynomials, and the arguments may be multidimensional. The polynomial functions are specified by a set of coefficients p0, p1, ..., pn. Both the number of dimensions and the number of coefficients are arbitrary. The meaning of the coefficients depends upon the dimension of the polynomial, as shown in the following examples:

Suppose that the function is one-dimensional (that is, a function of one argument). Then the function value fv is determined by the following expression in fa (the function argument):

```fv = p0 + (p1*fa) + (p2*fa**2) + (p3*fa**3) + (p4*fa**4) + (p5*fa**5) + ...
```
Suppose now that the function is two-dimensional, with arguments fa and fb. Then the function value fv is determined by the following expression:
```fv = p0 + (p1*fa) +  (p2*fb)  +  (p3*fa**2)  +  (p4*fa*fb)  +  (p5*fb**2)
+ (p6*fa**3)  +   (p7*fa**2*fb)   +   (p8*fa*fb**2)   +  (p9*fb**3) + ...
```
Consider now the case of a three-dimensional polynomial function with arguments fa, fb, and fc. Then the function value fv is determined by the following expression:
```fv = p0  +  (p1*fa)  +  (p2*fb)  +  (p3*fc)  +  (p4*fa**2)  + (p5*fa*fb)
+ (p6*fa*fc) + (p7*fb**2) + (p8*fb*fc)  +  (p9*fc**2)  + (p10*fa**3)
+ (p11*fa**2*fb) + (p12*fa**2*fc) + (p13*fa*fb**2) + (p14*fa*fb*fc)
+  (p15*fa*fc**2)  +  (p16*fb**3)  +  (p17*fb**2*fc)   + (p18*fb*fc**2)
+ (p19*fc**3) + (p20*fa**4) + ...
```
Note: if the polynomial is one-dimensional and exactly one coefficient is specified, then SPICE assumes it to be p1 (and p0 = 0.0), in order to facilitate the input of linear controlled sources.

For all four of the dependent sources described below, the initial condition parameter is described as optional. If not specified, SPICE assumes 0 the initial condition for dependent sources is an initial 'guess' for the value of the controlling variable. The program uses this initial condition to obtain the dc operating point of the circuit. After convergence has been obtained, the program continues iterating to obtain the exact value for the controlling variable. Hence, to reduce the computational effort for the dc operating point (or if the polynomial specifies a strong nonlinearity), a value fairly close to the actual controlling variable should be specified for the initial condition.

### C.1 Voltage-Controlled Current Sources

```General form:

GXXXXXXX N+ N- <POLY(ND)> NC1+ NC1- ... P0 <P1 ...> <IC=...>

Examples:
G1 1 0 5 3 0 0.1M
GR 17 3 17 3 0 1M 1.5M IC=2V
GMLT 23 17 POLY(2) 3 5 1 2 0 1M 17M 3.5U IC=2.5, 1.3
```
N+ and N- are the positive and negative nodes, respectively. Current flow is from the positive node, through the source, to the negative node. POLY(ND) only has to be specified if the source is multi-dimensional (one-dimensional is the default). If specified, ND is the number of dimensions, which must be positive. NC1+, NC1-, ... Are the positive and negative controlling nodes, respectively. One pair of nodes must be specified for each dimension. P0, P1, P2, ..., Pn are the polynomial coefficients. The (optional) initial condition is the initial guess at the value(s) of the controlling voltage(s). If not specified, 0.0 is assumed. The polynomial specifies the source current as a function of the controlling voltage(s). The second example above describes a current source with value
```       I = 1E-3*V(17,3) + 1.5E-3*V(17,3)**2
```
note that since the source nodes are the same as the controlling nodes, this source actually models a nonlinear resistor.

### C.2 Voltage-Controlled Voltage Sources

```General form:

EXXXXXXX N+ N- <POLY(ND)> NC1+ NC1- ... P0 <P1 ...> <IC=...>

Examples:

E1 3 4 21 17 10.5 2.1 1.75
EX 17 0 POLY(3) 13 0 15 0 17 0 0 1 1 1 IC=1.5,2.0,17.35

```
N+ and N- are the positive and negative nodes, respectively. POLY(ND) only has to be specified if the source is multidimensional (one-dimensional is the default). If specified, ND is the number of dimensions, which must be positive. NC1+, NC1-, ... are the positive and negative controlling nodes, respectively. One pair of nodes must be specified for each dimension. P0, P1, P2, ..., Pn are the polynomial coefficients. The (optional) initial condition is the initial guess at the value(s) of the controlling voltage(s). If not specified, 0.0 is assumed. The polynomial specifies the source voltage as a function of the controlling voltage(s). The second example above describes a voltage source with value
```V = V(13,0) + V(15,0) + V(17,0)
```
(in other words, an ideal voltage summer).

### C.3 Current-Controlled Current Sources

```General form:

FXXXXXXX N+ N- <POLY(ND)> VN1 <VN2 ...> P0 <P1 ...> <IC=...>

Examples:

F1 12 10 VCC 1MA 1.3M
FXFER 13 20 VSENS 0 1
```
N+ and N- are the positive and negative nodes, respectively. Current flow is from the positive node, through the source, to the negative node. POLY(ND) only has to be specified if the source is multi-dimensional (one-dimensional is the default). If specified, ND is the number of dimensions, which must be positive. VN1, VN2, ... are the names of voltage sources through which the controlling current flows; one name must be specified for each dimension. The direction of positive controlling current flow is from the positive node, through the source, to the negative node of each voltage source. P0, P1, P2, ..., Pn are the polynomial coefficients. The (optional) initial condition is the initial guess at the value(s) of the controlling current(s) (in Amps). If not specified, 0.0 is assumed. The polynomial specifies the source current as a function of the controlling current(s). The first example above describes a current source with value
```       I = 1E-3 + 1.3E-3*I(VCC)
```

### C.4 Current-Controlled Voltage Sources

```General form:

HXXXXXXX N+ N- <POLY(ND)> VN1 <VN2 ...> P0 <P1 ...> <IC=...>

Examples:

HXY 13 20 POLY(2) VIN1 VIN2 0 0 0 0 1 IC=0.5 1.3
HR 4 17 VX 0 0 1

```
N+ and N- are the positive and negative nodes, respectively. POLY(ND) only has to be specified if the source is multidimensional (one-dimensional is the default). If specified, ND is the number of dimensions, which must be positive. VN1, VN2, ... are the names of voltage sources through which the controlling current flows; one name must be specified for each dimension. The direction of positive controlling current flow is from the positive node, through the source, to the negative node of each voltage source. P0, P1, P2, ..., Pn are the polynomial coefficients. The (optional) initial condition is the initial guess at the value(s) of the controlling current(s) (in Amps). If not specified, 0.0 is assumed. The polynomial specifies the source voltage as a function of the controlling current(s). The first example above describes a voltage source with value
```       V = I(VIN1)*I(VIN2)
```