Power Electronics

SPICE Analog Behavioral Modeling of Variable Passives

Very often when simulating an electrical circuit in SPICE, there is a need for a variable passive element such as a resistor, a capacitor or an inductor. If an electrical source could externally control the value of such devices, it would naturally open the door to analog behavioral modeling expressions for capacitors and inductors: nonlinear behaviors, inductance variations with current, etc. Unfortunately, few SPICE-based simulators accept in-line equations for passive elements. To work around this drawback, this column describes passive elements whose values can be adjusted via an external voltage source. In part one of this article, the variable resistor is examined.

A resistor R when crossed by a current I develops a voltage V. Yes, everyone knows Ohm's Law, derived by Georg Simon Ohm (1789-1854), a German physicist. However, the same resistor R can be represented by a current source I, where 1 and 2 are the resistor terminals:
I=V(1,2)/R (Eq. 1)

Fig. 1 shows this representation.

In light of this simple equation, it becomes possible in both Intusoft's IsSpice and Cadence's PSpice to construct a variable resistor subcircuit, where the R in equation 1 will be implemented directly by a control source via the CTRL node:

IsSpice

.subckt VARIRES 1 2 CTRL
R1 1 2 1E10
B1 1 2 I=V(1,2)/(V(CTRL)+1µ)
.ENDS

PSpice

.subckt VARIRES 1 2 CTRL
R1 1 2 1E10
G1 1 2 Value = {V(1,2)/(V(CTRL)+1µ)}
.ENDS

In the current source expression, the 1µ quantity avoids divide-by-zero overflows in case of extremely low control values. If V(CTRL) equals 100 kV, then the equivalent resistor will be 100 kΩ. Fig. 2 shows the results of a simple resistive divider built around our subcircuit, which generates a 1-Ω resistor. Now, a complex voltage source can be built for V3, and nonlinear relationships can be easily envisaged.