Electric Circuit Equations Guide
Electric Circuit Equations Guide
By Tony R. Kuphaldt
iii
iv CONTENTS
2.5 Example #5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6 Example #6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 ALGEBRA REFERENCE 25
4.1 Basic identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Arithmetic properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2.1 The associative property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2.2 The commutative property . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2.3 The distributive property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3 Properties of exponents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4 Radicals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4.1 Definition of a radical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4.2 Properties of radicals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.5 Important constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.5.1 Euler’s number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.5.2 Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.6 Logarithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.6.1 Definition of a logarithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.6.2 Properties of logarithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.7 Factoring equivalencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.8 The quadratic formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.9 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.9.1 Arithmetic sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.9.2 Geometric sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.10 Factorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.10.1 Definition of a factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.10.2 Strange factorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.11 Solving simultaneous equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.11.1 Substitution method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.11.2 Addition method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.12 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5 TRIGONOMETRY REFERENCE 41
5.1 Right triangle trigonometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.1.1 Trigonometric identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.1.2 The Pythagorean theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.2 Non-right triangle trigonometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
CONTENTS v
6 CALCULUS REFERENCE 45
6.1 Rules for limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.2 Derivative of a constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.3 Common derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.4 Derivatives of power functions of e . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.5 Trigonometric derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.6 Rules for derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.1 Constant rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.2 Rule of sums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.3 Rule of differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.4 Product rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.5 Quotient rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.6 Power rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.6.7 Functions of other functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.7 The antiderivative (Indefinite integral) . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.8 Common antiderivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.9 Antiderivatives of power functions of e . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.10 Rules for antiderivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.10.1 Constant rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.10.2 Rule of sums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.10.3 Rule of differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.11 Definite integrals and the fundamental theorem of calculus . . . . . . . . . . . . . . . 50
6.12 Differential equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Ohm’s Law
E = IR I= E R= E
R I
Joule’s Law
2
P = IE P= E P = I2R
R
Where,
E = Voltage in volts
I = Current in amperes (amps)
R = Resistance in ohms
P = Power in watts
NOTE: the symbol ”V” (”U” in Europe) is sometimes used to represent voltage instead of ”E”.
In some cases, an author or circuit designer may choose to exclusively use ”V” for voltage, never
using the symbol ”E.” Other times the two symbols are used interchangeably, or ”E” is used to
represent voltage from a power source while ”V” is used to represent voltage across a load (voltage
”drop”).
1
2 CHAPTER 1. USEFUL EQUATIONS AND CONVERSION FACTORS
”The algebraic sum of all currents entering and exiting a node must equal zero.”
Kirchhoff ’s Current Law (KCL)
• Total resistance in a series circuit is equal to the sum of the individual resistances, making it
greater than any of the individual resistances. Rtotal = R1 + R2 + . . . Rn
• Total voltage in a series circuit is equal to the sum of the individual voltage drops. E total =
E1 + E 2 + . . . E n
• Total resistance in a parallel circuit is less than any of the individual resistances. R total = 1
/ (1/R1 + 1/R2 + . . . 1/Rn )
• Total current in a parallel circuit is equal to the sum of the individual branch currents. I total
= I1 + I2 + . . . I n
Resistances
Rseries = R1 + R2 + . . . Rn
1
Rparallel =
1 1 1
R1 + R2 + . . . Rn
1.5. CAPACITOR SIZING EQUATION 3
Inductances
Lseries = L1 + L2 + . . . Ln
1
Lparallel =
1 1 1
L1 + L2 + . . . Ln
Where,
L = Inductance in henrys
Capacitances
1
Cseries =
1 1 1
C1 + C2 + . . . Cn
Cparallel = C1 + C2 + . . . Cn
Where,
C = Capacitance in farads
εA
C=
d
Where,
C = Capacitance in Farads
ε = Permittivity of dielectric (absolute, not
relative)
A = Area of plate overlap in square meters
d = Distance between plates in meters
4 CHAPTER 1. USEFUL EQUATIONS AND CONVERSION FACTORS
ε = ε0 K
Where,
ε0 = Permittivity of free space
ε0 = 8.8562 x 10-12 F/m
K= Dielectric constant of material
between plates (see table)
Dielectric constants
Dielectric K Dielectric K
Vacuum 1.0000 Oil 2
Air 1.0004 Water 81
Glass 5-10 Al2O3 8
Rubber 3-35 Ta2O5 27.6
Mica 3-6 Ba2TiO3 1200-1500
0.0885K(n-1) A 0.225K(n-1)A’
C= =
d d’
A
Where, d
C = Capacitance in picofarads
K = Dielectric constant
A = Area of one plate in square centimeters
A’ = Area of one plate in square inches
d= Thickness in centimeters
d’ = Thickness in inches
n= Number of plates
1.6. INDUCTOR SIZING EQUATION 5
N2µA
L=
l
µ = µr µ0
Where,
L = Inductance of coil in Henrys
N = Number of turns in wire coil (straight wire = 1)
µ = Permeability of core material (absolute, not relative)
µr = Relative permeability, dimensionless ( µ0=1 for air)
-6
µ0 = 1.26 x 10 T-m/At permeability of free space
A = Area of coil in square meters
l = Average length of coil in meters
Wheeler’s formulas for inductance of air core coils follow are usefull for radio frequency induc-
tors. The following formula for the inductance of a single layer air core solenoid coil is accurate to
approximately 1% for 2r/l < 3. The thick coil formula is 1% accurate when the denominator terms
are approximately equal. Wheeler’s spiral formula is 1% accurate for c>0.2r. While this is a ”round
wire” formula, it may still be applicable to printed circuit spiral inductors at reduced accuracy.
r c c
r r
l
2 2
Nr
L=
9r + 10⋅l l
0.8N2r2 N2r2
L= L=
6r + 9⋅l + 10c 8r + 11c
Where,
L = Inductance of coil in microhenrys
N = Number of turns of wire
r = Mean radius of coil in inches
l = Length of coil in inches
c = Thickness of coil in inches
The wire table provides ”turns per inch” for enamel magnet wire for use with the inductance
6 CHAPTER 1. USEFUL EQUATIONS AND CONVERSION FACTORS
1
Change = (Final-Start) 1 -
et/τ
Where,
Final = Value of calculated variable after infinite time
(its ultimate value)
Start = Initial value of calculated variable
e = Euler’s number ( 2.7182818)
t = Time in seconds
τ = Time constant for circuit in seconds
1.8. AC CIRCUIT EQUATIONS 7
1
t=τ ln
Change
1-
Final - Start
XL = 2πfL
Where,
XL = Inductive reactance in ohms
f = Frequency in hertz
L = Inductance in henrys
XC = 1
2πfC
Where,
XC = Inductive reactance in ohms
f = Frequency in hertz
C = Capacitance in farads
ZC = R - jXC
8 CHAPTER 1. USEFUL EQUATIONS AND CONVERSION FACTORS
E = IZ I= E Z= E
Z I
Where,
E = Voltage in volts
I = Current in amperes (amps)
Z = Impedance in ohms
Zseries = Z1 + Z2 + . . . Zn
1
Zparallel =
1 1 1
Z1 + Z2 + . . . Zn
NOTE: All impedances must be calculated in complex number form for these equations to work.
1.8.6 Resonance
1
fresonant =
2π LC
NOTE: This equation applies to a non-resistive LC circuit. In circuits containing resistance as
well as inductance and capacitance, this equation applies only to series configurations and to parallel
configurations where R is very small.
1.9. DECIBELS 9
1.8.7 AC power
E2
P = true power P = I2R P=
R
Measured in units of Watts
E2
Q = reactive power Q = I2X Q=
X
Measured in units of Volt-Amps-Reactive (VAR)
E2
S = apparent power S = I2Z S= S = IE
Z
Measured in units of Volt-Amps
P = (IE)(power factor)
S= P2 + Q2
1.9 Decibels
AV(dB)
1 US gallon (gal) = 231.0 cubic inches (in3 ) = 4 quarts (qt) = 8 pints (pt) = 128
fluid ounces (fl. oz.) = 3.7854 liters (l)
1 Imperial gallon (gal) = 160 fluid ounces (fl. oz.) = 4.546 liters (l)
1 mile per hour (mi/h) = 88 feet per minute (ft/m) = 1.46667 feet per second (ft/s)
= 1.60934 kilometer per hour (km/h) = 0.44704 meter per second (m/s) = 0.868976
knot (knot – international)
9.806650 meters per second per second (m/s2 ) = 32.1740 feet per second per second
(ft/s2 )
1 acre = 43560 square feet (ft2 ) = 4840 square yards (yd2 ) = 4046.86 square meters
2
(m )
12 CHAPTER 1. USEFUL EQUATIONS AND CONVERSION FACTORS
1 pound per square inch (psi) = 2.03603 inches of mercury (in. Hg) = 27.6807
inches of water (in. W.C.) = 6894.757 pascals (Pa) = 0.0680460 atmospheres (Atm) =
0.0689476 bar (bar)
1 british thermal unit (BTU – ”International Table”) = 251.996 calories (cal – ”In-
ternational Table”) = 1055.06 joules (J) = 1055.06 watt-seconds (W-s) = 0.293071 watt-
hour (W-hr) = 1.05506 x 1010 ergs (erg) = 778.169 foot-pound-force (ft-lbf)
1 horsepower (hp – 550 ft-lbf/s) = 745.7 watts (W) = 2544.43 british thermal units
per hour (BTU/hr) = 0.0760181 boiler horsepower (hp – boiler)
Locate the row corresponding to known unit of torque along the left of the table. Multiply by the
factor under the column for the desired units. For example, to convert 2 oz-in torque to n-m, locate
oz-in row at table left. Locate 7.062 x 10−3 at intersection of desired n-m units column. Multiply 2
oz-in x (7.062 x 10−3 ) = 14.12 x 10−3 n-m.
Converting between units is easy if you have a set of equivalencies to work with. Suppose we
wanted to convert an energy quantity of 2500 calories into watt-hours. What we would need to do
is find a set of equivalent figures for those units. In our reference here, we see that 251.996 calories
is physically equal to 0.293071 watt hour. To convert from calories into watt-hours, we must form
a ”unity fraction” with these physically equal figures (a fraction composed of different figures and
different units, the numerator and denominator being physically equal to one another), placing the
desired unit in the numerator and the initial unit in the denominator, and then multiply our initial
value of calories by that fraction.
Since both terms of the ”unity fraction” are physically equal to one another, the fraction as a
whole has a physical value of 1, and so does not change the true value of any figure when multiplied
1.10. METRIC PREFIXES AND UNIT CONVERSIONS 13
by it. When units are canceled, however, there will be a change in units. For example, 2500 calories
multiplied by the unity fraction of (0.293071 w-hr / 251.996 cal) = 2.9075 watt-hours.
0.293071 watt-hour
"Unity fraction"
251.996 calories
. . . cancelling units . . .
The ”unity fraction” approach to unit conversion may be extended beyond single steps. Suppose
we wanted to convert a fluid flow measurement of 175 gallons per hour into liters per day. We have
two units to convert here: gallons into liters, and hours into days. Remember that the word ”per”
in mathematics means ”divided by,” so our initial figure of 175 gallons per hour means 175 gallons
divided by hours. Expressing our original figure as such a fraction, we multiply it by the necessary
unity fractions to convert gallons to liters (3.7854 liters = 1 gallon), and hours to days (1 day = 24
hours). The units must be arranged in the unity fraction in such a way that undesired units cancel
each other out above and below fraction bars. For this problem it means using a gallons-to-liters
unity fraction of (3.7854 liters / 1 gallon) and a hours-to-days unity fraction of (24 hours / 1 day):
14 CHAPTER 1. USEFUL EQUATIONS AND CONVERSION FACTORS
3.7854 liters
"Unity fraction"
1 gallon
24 hours
"Unity fraction"
1 day
. . . cancelling units . . .
1.11 Data
Conversion factors were found in the 78th edition of the CRC Handbook of Chemistry and Physics,
and the 3rd edition of Bela Liptak’s Instrument Engineers’ Handbook – Process Measurement and
Analysis.
1.12 Contributors
Contributors to this chapter are listed in chronological order of their contributions, from most recent
to first. See Appendix 2 (Contributor List) for dates and contact information.
Gerald Gardner (January 2003): Addition of Imperial gallons conversion.
Chapter 2
The colors brown, red, green, blue, and violet are used as tolerance codes on 5-band resistors
only. All 5-band resistors use a colored tolerance band. The blank (20%) ”band” is only used with
the ”4-band” code (3 colored bands + a blank ”band”).
15
16 CHAPTER 2. RESISTOR COLOR CODES
4-band code
5-band code
2.1 Example #1
2.2 Example #2
2.3 Example #3
A resistor colored White-Violet-Black would be 97 Ω with a tolerance of +/- 20%. When you
see only three color bands on a resistor, you know that it is actually a 4-band code with a blank
(20%) tolerance band.
2.4. EXAMPLE #4 17
2.4 Example #4
2.5 Example #5
2.6 Example #6
CONDUCTOR AND
INSULATOR TABLES
19
20 CHAPTER 3. CONDUCTOR AND INSULATOR TABLES
* = estimated values; normally, wire gages this small are not manufactured with these insulation
types.
3.7 Data
Tables of specific resistance and temperature coefficient of resistance for elemental materials (not
alloys) were derived from figures found in the 78th edition of the CRC Handbook of Chemistry and
Physics. Superconductivity data from Collier’s Encyclopedia (volume 21, 1968, page 640).
24 CHAPTER 3. CONDUCTOR AND INSULATOR TABLES
Chapter 4
ALGEBRA REFERENCE
a+0=a 1a = a 0a = 0
a =a 0 =0 a =1
1 a a
a = undefined
0
Note: while division by zero is popularly thought to be equal to infinity, this is not technically
true. In some practical applications it may be helpful to think the result of such a fraction approach-
ing infinity as the denominator approaches zero (imagine calculating current I=E/R in a circuit with
resistance approaching zero – current would approach infinity), but the actual fraction of anything
divided by zero is undefined in the scope of ”real” numbers.
a + (b + c) = (a + b) + c a(bc) = (ab)c
a+b=b+a ab=ba
25
26 CHAPTER 4. ALGEBRA REFERENCE
a(b + c) = ab + ac
am
(am)n = amn = am-n
an
4.4 Radicals
4.4.1 Definition of a radical
When people talk of a ”square root,” they’re referring to a radical with a root of 2. This is math-
ematically equivalent to a number raised to the power of 1/2. This equivalence is useful to know
when using a calculator to determine a strange root. Suppose for example you needed to find the
fourth root of a number, but your calculator lacks a ”4th root” button or function. If it has a y x
function (which any scientific calculator should have), you can find the fourth root by raising that
number to the 1/4 power, or x0.25 .
x
a = a1/x
It is important to remember that when solving for an even root (square root, fourth root, etc.)
of any number, there are two valid answers. For example, most people know that the square root of
nine is three, but negative three is also a valid answer, since (-3)2 = 9 just as 32 = 9.
x x x
a =a ax = a
x x x
ab = a b
x x
a a
= x
b b
4.5. IMPORTANT CONSTANTS 27
e= 1
k!
k=0
1 1 1 1 ... 1
0! + 1! + 2! + 3! + n!
4.5.2 Pi
Pi (π) is defined as the ratio of a circle’s circumference to its diameter.
Pi approximately equals:
3.14159 26535 89793 23846 26433 83279 50288 41971 69399 37511
Note: For both Euler’s constant (e) and pi (π), the spaces shown between each set of five digits
have no mathematical significance. They are placed there just to make it easier for your eyes to
”piece” the number into five-digit groups when manually copying.
4.6 Logarithms
4.6.1 Definition of a logarithm
If:
by = x
Then:
logb x = y
Where,
b = "Base" of the logarithm
”log” denotes a common logarithm (base = 10), while ”ln” denotes a natural logarithm (base =
e).
28 CHAPTER 4. ALGEBRA REFERENCE
a(log m) = m
These properties of logarithms come in handy for performing complex multiplication and division
operations. They are an example of something called a transform function, whereby one type of
mathematical operation is transformed into another type of mathematical operation that is simpler
to solve. Using a table of logarithm figures, one can multiply or divide numbers by adding or
subtracting their logarithms, respectively. then looking up that logarithm figure in the table and
seeing what the final product or quotient is.
Slide rules work on this principle of logarithms by performing multiplication and division through
addition and subtraction of distances on the slide.
Slide rule
Cursor
Slide
x2 - y2 = (x+y)(x-y)
x3 - y3 = (x-y)(x2 + xy + y2)
4.8. THE QUADRATIC FORMULA 29
+
x = -b - b2 - 4ac
2a
4.9 Sequences
4.9.1 Arithmetic sequences
An arithmetic sequence is a series of numbers obtained by adding (or subtracting) the same value
with each step. A child’s counting sequence (1, 2, 3, 4, . . .) is a simple arithmetic sequence, where
the common difference is 1: that is, each adjacent number in the sequence differs by a value of one.
An arithmetic sequence counting only even numbers (2, 4, 6, 8, . . .) or only odd numbers (1, 3, 5,
7, 9, . . .) would have a common difference of 2.
In the standard notation of sequences, a lower-case letter ”a” represents an element (a single
number) in the sequence. The term ”an ” refers to the element at the nth step in the sequence. For
example, ”a3 ” in an even-counting (common difference = 2) arithmetic sequence starting at 2 would
be the number 6, ”a” representing 4 and ”a1 ” representing the starting point of the sequence (given
in this example as 2).
A capital letter ”A” represents the sum of an arithmetic sequence. For instance, in the same
even-counting sequence starting at 2, A4 is equal to the sum of all elements from a1 through a4 ,
which of course would be 2 + 4 + 6 + 8, or 20.
an = an-1 + d an = a1 + d(n-1)
Where:
d = The "common difference"
An = a1 + a2 + . . . an
An = n (a1 + an)
2
30 CHAPTER 4. ALGEBRA REFERENCE
an = r(an-1) an = a1(rn-1)
Where:
r = The "common ratio"
An = a1 + a2 + . . . an
a1(1 - rn)
An =
1-r
4.10 Factorials
4.10.1 Definition of a factorial
Denoted by the symbol ”!” after an integer; the product of that integer and all integers in descent
to 1.
Example of a factorial:
5! = 5 x 4 x 3 x 2 x 1
5! = 120
0! = 1 1! = 1
x + y = 24
2x - y = -6
For this set of equations, there is but a single combination of values for x and y that will satisfy
both. Either equation, considered separately, has an infinitude of valid (x,y) solutions, but together
there is only one. Plotted on a graph, this condition becomes obvious:
(6,18)
x + y = 24
2x - y = -6
Each line is actually a continuum of points representing possible x and y solution pairs for each
equation. Each equation, separately, has an infinite number of ordered pair (x,y) solutions. There is
only one point where the two linear functions x + y = 24 and 2x - y = -6 intersect (where one of
their many independent solutions happen to work for both equations), and that is where x is equal
to a value of 6 and y is equal to a value of 18.
Usually, though, graphing is not a very efficient way to determine the simultaneous solution set
for two or more equations. It is especially impractical for systems of three or more variables. In a
three-variable system, for example, the solution would be found by the point intersection of three
planes in a three-dimensional coordinate space – not an easy scenario to visualize.
x + y = 24
y = 24 - x
Defining y in terms of x
Then, we take this new definition of one variable and substitute it for the same variable in the
other equation. In this case, we take the definition of y, which is 24 - x and substitute this for the
y term found in the other equation:
y = 24 - x
substitute
2x - y = -6
2x - (24 - x) = -6
Now that we have an equation with just a single variable (x), we can solve it using ”normal”
algebraic techniques:
2x - (24 - x) = -6
Distributive property
2x - 24 + x = -6
3x -24 = -6
3x = 18
x=6
Now that x is known, we can plug this value into any of the original equations and obtain a value
for y. Or, to save us some work, we can plug this value (6) into the equation we just generated to
define y in terms of x, being that it is already in a form to solve for y:
4.11. SOLVING SIMULTANEOUS EQUATIONS 33
x=6
substitute
y = 24 - x
y = 24 - 6
y = 18
Applying the substitution method to systems of three or more variables involves a similar pattern,
only with more work involved. This is generally true for any method of solution: the number of
steps required for obtaining solutions increases rapidly with each additional variable in the system.
To solve for three unknown variables, we need at least three equations. Consider this example:
x - y + z = 10
3x + y + 2z = 34
-5x + 2y - z = -14
Being that the first equation has the simplest coefficients (1, -1, and 1, for x, y, and z, respec-
tively), it seems logical to use it to develop a definition of one variable in terms of the other two. In
this example, I’ll solve for x in terms of y and z:
x - y + z = 10
Adding y and subtracting z
from both sides
x = y - z + 10
Now, we can substitute this definition of x where x appears in the other two equations:
x = y - z + 10 x = y - z + 10
substitute substitute
3x + y + 2z = 34 -5x + 2y - z = -14
Distributive property
3y - 3z + 30 + y + 2z = 34 -5y + 5z - 50 + 2y - z = -14
4y - z + 30 = 34 -3y + 4z - 50 = -14
4y - z = 4
Adding z to both sides;
subtracting 4 from both sides
z = 4y - 4
Next, we’ll substitute this definition of z in terms of y where we see z in the other equation:
z = 4y - 4
substitute
-3y + 4z = 36
-3y + 4(4y - 4) = 36
Distributive property
-3y + 16y - 16 = 36
Combining like terms
13y - 16 = 36
Now that y is a known value, we can plug it into the equation defining z in terms of y and obtain
a figure for z:
y=4
substitute
z = 4y - 4
z = 16 - 4
z = 12
Now, with values for y and z known, we can plug these into the equation where we defined x in
terms of y and z, to obtain a value for x:
y=4
substitute z = 12
substitute
x = y - z + 10
x = 4 - 12 + 10
x=2
In closing, we’ve found values for x, y, and z of 2, 4, and 12, respectively, that satisfy all three
equations.
x + y = 24
2x - y = -6
One of the most-used rules of algebra is that you may perform any arithmetic operation you wish
to an equation so long as you do it equally to both sides. With reference to addition, this means we
may add any quantity we wish to both sides of an equation – so long as it’s the same quantity –
without altering the truth of the equation.
36 CHAPTER 4. ALGEBRA REFERENCE
An option we have, then, is to add the corresponding sides of the equations together to form a
new equation. Since each equation is an expression of equality (the same quantity on either side
of the = sign), adding the left-hand side of one equation to the left-hand side of the other equation
is valid so long as we add the two equations’ right-hand sides together as well. In our example
equation set, for instance, we may add x + y to 2x - y, and add 24 and -6 together as well to form
a new equation. What benefit does this hold for us? Examine what happens when we do this to our
example equation set:
x + y = 24
+ 2x - y = -6
3x + 0 = 18
Because the top equation happened to contain a positive y term while the bottom equation
happened to contain a negative y term, these two terms canceled each other in the process of
addition, leaving no y term in the sum. What we have left is a new equation, but one with only a
single unknown variable, x! This allows us to easily solve for the value of x:
3x + 0 = 18
3x = 18
2x + 2y = 14
3x + y = 13
We could add these two equations together – this being a completely valid algebraic operation –
but it would not profit us in the goal of obtaining values for x and y:
2x + 2y = 14
+ 3x + y = 13
5x + 3y = 27
The resulting equation still contains two unknown variables, just like the original equations do,
and so we’re no further along in obtaining a solution. However, what if we could manipulate one
of the equations so as to have a negative term that would cancel the respective term in the other
equation when added? Then, the system would reduce to a single equation with a single unknown
variable just as with the last (fortuitous) example.
4.11. SOLVING SIMULTANEOUS EQUATIONS 37
If we could only turn the y term in the lower equation into a - 2y term, so that when the two
equations were added together, both y terms in the equations would cancel, leaving us with only
an x term, this would bring us closer to a solution. Fortunately, this is not difficult to do. If we
multiply each and every term of the lower equation by a -2, it will produce the result we seek:
-2(3x + y) = -2(13)
Distributive property
-6x - 2y = -26
Now, we may add this new equation to the original, upper equation:
2x + 2y = 14
+ -6x - 2y = -26
-4x + 0y = -12
Solving for x, we obtain a value of 3:
-4x + 0y = -12
Dropping the 0 term
-4x = -12
x=3
Substituting this new-found value for x into one of the original equations, the value of y is easily
determined:
x=3
substitute
2x + 2y = 14
6 + 2y = 14
two equations with two variables, then apply it again to obtain a single equation with one unknown
variable. To demonstrate, I’ll use the three-variable equation system from the substitution section:
x - y + z = 10
3x + y + 2z = 34
-5x + 2y - z = -14
Being that the top equation has coefficient values of 1 for each variable, it will be an easy equation
to manipulate and use as a cancellation tool. For instance, if we wish to cancel the 3x term from
the middle equation, all we need to do is take the top equation, multiply each of its terms by -3,
then add it to the middle equation like this:
x - y + z = 10
Multiply both sides by -3
-3(x - y + z) = -3(10)
Distributive property
-3x + 3y - 3z = -30
-3x + 3y - 3z = -30
(Adding)
+ 3x + y + 2z = 34
0x + 4y - z = 4
or
4y - z = 4
We can rid the bottom equation of its -5x term in the same manner: take the original top
equation, multiply each of its terms by 5, then add that modified equation to the bottom equation,
leaving a new equation with only y and z terms:
4.11. SOLVING SIMULTANEOUS EQUATIONS 39
x - y + z = 10
Distributive property
5x - 5y + 5z = 50
5x - 5y + 5z = 50
(Adding)
+ -5x + 2y - z = -14
0x - 3y + 4z = 36
or
-3y + 4z = 36
At this point, we have two equations with the same two unknown variables, y and z:
4y - z = 4
-3y + 4z = 36
By inspection, it should be evident that the -z term of the upper equation could be leveraged
to cancel the 4z term in the lower equation if only we multiply each term of the upper equation by
4 and add the two equations together:
4y - z = 4
Multiply both sides by 4
4(4y - z) = 4(4)
Distributive property
16y - 4z = 16
16y - 4z = 16
(Adding)
+ -3y + 4z = 36
13y + 0z = 52
or
13y = 52
Taking the new equation 13y = 52 and solving for y (by dividing both sides by 13), we get a
value of 4 for y. Substituting this value of 4 for y in either of the two-variable equations allows us to
40 CHAPTER 4. ALGEBRA REFERENCE
solve for z. Substituting both values of y and z into any one of the original, three-variable equations
allows us to solve for x. The final result (I’ll spare you the algebraic steps, since you should be
familiar with them by now!) is that x = 2, y = 4, and z = 12.
4.12 Contributors
Contributors to this chapter are listed in chronological order of their contributions, from most recent
to first. See Appendix 2 (Contributor List) for dates and contact information.
Chirvasuta Constantin (April 2, 2003): Pointed out error in quadratic equation formula.
Chapter 5
TRIGONOMETRY REFERENCE
Hypotenuse (H)
Opposite (O)
Angle 90o
x
Adjacent (A)
A right triangle is defined as having one angle precisely equal to 90 o (a right angle).
41
42 CHAPTER 5. TRIGONOMETRY REFERENCE
45o is equal to 1, then the ”arctangent” (arctan) of 1 is 45o . ”Arc” functions are useful for finding
angles in a right triangle if the side lengths are known.
H2 = A2 + O2
C A
a c
B
A2 = B2 + C2 - (2BC)(cos a)
B2 = A2 + C2 - (2AC)(cos b)
C2 = A2 + B2 - (2AB)(cos c)
5.3. TRIGONOMETRIC EQUIVALENCIES 43
2(tan x)
tan 2t =
1 - tan2 x
ex - e-x
sinh x =
2
ex + e-x
cosh x =
2
sinh x
tanh x =
cosh x
Note: all angles (x) must be expressed in units of radians for these hyperbolic functions. There
are 2π radians in a circle (360o ).
5.5 Contributors
Contributors to this chapter are listed in chronological order of their contributions, from most recent
to first. See Appendix 2 (Contributor List) for dates and contact information.
Harvey Lew (??? 2003): Corrected typographical error: ”tangent” should have been ”cotan-
gent”.
44 CHAPTER 5. TRIGONOMETRY REFERENCE
Chapter 6
CALCULUS REFERENCE
If:
f(x) = c
Then:
d f(x) = 0
dx
(”c” being a constant)
45
46 CHAPTER 6. CALCULUS REFERENCE
d ln x = 1
dx x
d ax = (an)(ln a)
dx
If: If:
f(x) = ex f(x) = eg(x)
Then: Then:
d f(x) = ex d f(x) = eg(x) d g(x)
dx dx dx
Example:
2
f(x) = e(x + 2x)
d [cf(x)] = c d f(x)
dx dx
d f[g(x)]
dx
Solve:
dy f[g(x)] = dy f(u) du g(x)
dx du dx
If:
d f(x) = g(x)
dx
Then:
g(x) is the derivative of f(x)
f(x) is the antiderivative of g(x)
∫g(x) dx = f(x) + c
Notice something important here: taking the derivative of f(x) may precisely give you g(x), but
taking the antiderivative of g(x) does not necessarily give you f(x) in its original form. Example:
f(x) = 3x2 + 5
d f(x) = 6x
dx
∫6x dx = 3x2 + c
Note that the constant c is unknown! The original function f(x) could have been 3x 2 + 5,
3x + 10, 3x2 + anything, and the derivative of f(x) would have still been 6x. Determining the
2
antiderivative of a function, then, is a bit less certain than determining the derivative of a function.
6.8. COMMON ANTIDERIVATIVES 49
∫xn dx = xn+1 + c
n+1
∫ 1x dx = (ln |x|) + c
Where,
c = a constant
∫ax dx = ax + c
ln a
∫ex dx = ex + c
Note: this is a very unique and useful property of e. As in the case of derivatives, the antideriva-
tive of such a function is that same function. In the case of the antiderivative, a constant term ”c”
is added to the end as well.
∫cf(x) dx = c ∫f(x) dx
Then:
b
∫f(x) dx = g(b) - g(a)
a
Where,
a and b are constants
If:
∫f(x) dx = g(x) and a=0
Then:
x
∫f(x) dx = g(x)
0
7.1 Introduction
”With Electronics Workbench, you can create circuit schematics that look just the
same as those you’re already familiar with on paper – plus you can flip the power switch
so the schematic behaves like a real circuit. With other electronics simulators, you may
have to type in SPICE node lists as text files – an abstract representation of a circuit
beyond the capabilities of all but advanced electronics engineers.”
(Electronics Workbench User’s guide – version 4, page 7)
This introduction comes from the operating manual for a circuit simulation program called
Electronics Workbench. Using a graphic interface, it allows the user to draw a circuit schematic and
then have the computer analyze that circuit, displaying the results in graphic form. It is a very
valuable analysis tool, but it has its shortcomings. For one, it and other graphic programs like it
tend to be unreliable when analyzing complex circuits, as the translation from picture to computer
code is not quite the exact science we would want it to be (yet). Secondly, due to its graphics
requirements, it tends to need a significant amount of computational ”horsepower” to run, and a
computer operating system that supports graphics. Thirdly, these graphic programs can be costly.
However, underneath the graphics skin of Electronics Workbench lies a robust (and free!) program
called SPICE, which analyzes a circuit based on a text-file description of the circuit’s components and
connections. What the user pays for with Electronics Workbench and other graphic circuit analysis
programs is the convenient ”point and click” interface, while SPICE does the actual mathematical
analysis.
By itself, SPICE does not require a graphic interface and demands little in system resources. It is
also very reliable. The makers of Electronic Workbench would like you to think that using SPICE in
its native text mode is a task suited for rocket scientists, but I’m writing this to prove them wrong.
SPICE is fairly easy to use for simple circuits, and its non-graphic interface actually lends itself
toward the analysis of circuits that can be difficult to draw. I think it was the programming expert
Donald Knuth who quipped, ”What you see is all you get” when it comes to computer applications.
Graphics may look more attractive, but abstracted interfaces (text) are actually more efficient.
51
52 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
This document is not intended to be an exhaustive tutorial on how to use SPICE. I’m merely
trying to show the interested user how to apply it to the analysis of simple circuits, as an alternative
to proprietary ($$$) and buggy programs. Once you learn the basics, there are other tutorials better
suited to take you further. Using SPICE – a program originally intended to develop integrated
circuits – to analyze some of the really simple circuits showcased here may seem a bit like cutting
butter with a chain saw, but it works!
All options and examples have been tested on SPICE version 2g6 on both MS-DOS and Linux
operating systems. As far as I know, I’m not using features specific to version 2g6, so these simple
functions should work on most versions of SPICE.
Computer
Source Interpreter
software Output
File
In a compiled computer language, the program you wrote is translated all at once into the
computer’s own language by a special program called a compiler. After the program you’ve written
has been ”compiled,” the resulting executable file needs no further translation to be understood
directly by the computer. It can now be ”run” on a computer whether or not compiler software has
been installed on that computer:
Computer
Source Compiler
File software
Computer
Executable Executable
File File
Output
SPICE is an interpreted language. In order for a computer to be able to understand the SPICE
instructions you type, it must have the SPICE program (interpreter) installed:
Computer
Source
File SPICE
software Output
"netlist"
SPICE source files are commonly referred to as ”netlists,” although they are sometimes known as
”decks” with each line in the file being called a ”card.” Cute, don’t you think? Netlists are created
by a person like yourself typing instructions line-by-line using a word processor or text editor.
Text editors are much preferred over word processors for any type of computer programming, as
54 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
they produce pure ASCII text with no special embedded codes for text highlighting (like italic or
boldface fonts), which are uninterpretable by interpreter and compiler software.
As in general programming, the source file you create for SPICE must follow certain conventions
of programming. It is a computer language in itself, albeit a simple one. Having programmed in
BASIC and C/C++, and having some experience reading PASCAL and FORTRAN programs, it
is my opinion that the language of SPICE is much simpler than any of these. It is about the same
complexity as a markup language such as HTML, perhaps less so.
There is a cycle of steps to be followed in using SPICE to analyze a circuit. The cycle starts
when you first invoke the text editing program and make your first draft of the netlist. The next
step is to run SPICE on that new netlist and see what the results are. If you are a novice user of
SPICE, your first attempts at creating a good netlist will be fraught with small errors of syntax.
Don’t worry – as every computer programmer knows, proficiency comes with lots of practice. If your
trial run produces error messages or results that are obviously incorrect, you need to re-invoke the
text editing program and modify the netlist. After modifying the netlist, you need to run SPICE
again and check the results. The sequence, then, looks something like this:
• Compose a new netlist with a text editing program. Save that netlist to a file with a name of
your choice.
• Run SPICE on that netlist and observe the results.
• If the results contain errors, start up the text editing program again and modify the netlist.
• Run SPICE again and observe the new results.
• If there are still errors in the output of SPICE, re-edit the netlist again with the text editing
program. Repeat this cycle of edit/run as many times as necessary until you are getting the
desired results.
• Once you’ve ”debugged” your netlist and are getting good results, run SPICE again, only this
time redirecting the output to a new file instead of just observing it on the computer screen.
• Start up a text editing program or a word processor program and open the SPICE output file
you just created. Modify that file to suit your formatting needs and either save those changes
to disk and/or print them out on paper.
To ”run” a SPICE ”program,” you need to type in a command at a terminal prompt interface,
such as that found in MS-DOS, UNIX, or the MS-Windows DOS prompt option:
The word ”spice” invokes the SPICE interpreting program (providing that the SPICE software
has been installed on the computer!), the ”<” symbol redirects the contents of the source file to the
SPICE interpreter, and [Link] is the name of the source file for this circuit example. The file
extension ”.cir” is not mandatory; I have seen ”.inp” (for ”input”) and just plain ”.txt” work
well, too. It will even work when the netlist file has no extension. SPICE doesn’t care what you
name it, so long as it has a name compatible with the filesystem of your computer (for old MS-DOS
machines, for example, the filename must be no more than 8 characters in length, with a 3 character
extension, and no spaces or other non-alphanumerical characters).
7.3. FUNDAMENTALS OF SPICE PROGRAMMING 55
When this command is typed in, SPICE will read the contents of the [Link] file, analyze
the circuit specified by that file, and send a text report to the computer terminal’s standard output
(usually the screen, where you can see it scroll by). A typical SPICE output is several screens worth
of information, so you might want to look it over with a slight modification of the command:
This alternative ”pipes” the text output of SPICE to the ”more” utility, which allows only one
page to be displayed at a time. What this means (in English) is that the text output of SPICE
is halted after one screen-full, and waits until the user presses a keyboard key to display the next
screen-full of text. If you’re just testing your example circuit file and want to check for any errors,
this is a good way to do it.
This second alternative (above) redirects the text output of SPICE to another file, called [Link],
where it can be viewed or printed. This option corresponds to the last step in the development cycle
listed earlier. It is recommended by this author that you use this technique of ”redirection” to a
text file only after you’ve proven your example circuit netlist to work well, so that you don’t waste
time invoking a text editor just to see the output during the stages of ”debugging.”
Once you have a SPICE output stored in a .txt file, you can use a text editor or (better yet!) a
word processor to edit the output, deleting any unnecessary banners and messages, even specifying
alternative fonts to highlight the headings and/or data for a more polished appearance. Then, of
course, you can print the output to paper if you so desire. Being that the direct SPICE output is
plain ASCII text, such a file will be universally interpretable on any computer whether SPICE is
installed on it or not. Also, the plain text format ensures that the file will be very small compared
to the graphic screen-shot files generated by ”point-and-click” simulators.
The netlist file format required by SPICE is quite simple. A netlist file is nothing more than
a plain ASCII text file containing multiple lines of text, each line describing either a circuit com-
ponent or special SPICE command. Circuit architecture is specified by assigning numbers to each
component’s connection points in each line, connections between components designated by common
numbers. Examine the following example circuit diagram and its corresponding SPICE file. Please
bear in mind that the circuit diagram exists only to make the simulation easier for human beings to
understand. SPICE only understands netlists:
1 1 R2
2
3.3 kΩ
15 V R1 2.2 kΩ R3
150 Ω
0 0 0
Example netlist
v1 1 0 dc 15
56 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
r1 1 0 2.2k
r2 1 2 3.3k
r3 2 0 150
.end
• v1 represents the battery (voltage source 1), positive terminal numbered 1, negative terminal
numbered 0, with a DC voltage output of 15 volts.
• r1 represents resistor R1 in the diagram, connected between points 1 and 0, with a value of
2.2 kΩ.
• r2 represents resistor R2 in the diagram, connected between points 1 and 2, with a value of
3.3 kΩ.
• r3 represents resistor R3 in the diagram, connected between points 2 and 0, with a value of
150 kΩ.
Electrically common points (or ”nodes”) in a SPICE circuit description share common numbers,
much in the same way that wires connecting common points in a large circuit typically share common
wire labels.
To simulate this circuit, the user would type those six lines of text on a text editor and save
them as a file with a unique name (such as [Link]). Once the netlist is composed and saved
to a file, the user then processes that file with one of the command-line statements shown earlier
(spice < [Link]), and will receive this text output on their computer’s screen:
SPICE begins by printing the time, date, and version used at the top of the output. It then lists
the input parameters (the lines of the source file), followed by a display of DC voltage readings from
each node (reference number) to ground (always reference number 0). This is followed by a list of
current readings through each voltage source (in this case there’s only one, v1). Finally, the total
power dissipation and computation time in seconds is printed.
All output values provided by SPICE are displayed in scientific notation.
The SPICE output listing shown above is a little verbose for most peoples’ taste. For a final
presentation, it might be nice to trim all the unnecessary text and leave only what matters. Here is
a sample of that same output, redirected to a text file (spice < [Link] > [Link]),
then trimmed down judiciously with a text editor for final presentation and printed:
example netlist
v1 1 0 dc 15
r1 1 0 2.2k
r2 1 2 3.3k
r3 2 0 150
.end
One of the very nice things about SPICE is that both input and output formats are plain-text,
which is the most universal and easy-to-edit electronic format around. Practically any computer
will be able to edit and display this format, even if the SPICE program itself is not resident on that
computer. If the user desires, he or she is free to use the advanced capabilities of word processing
programs to make the output look fancier. Comments can even be inserted between lines of the
output for further clarity to the reader.
For most applications, it’s nice to save your netlist work in a separate file and then let SPICE
interpret that file when you’re ready. This is the way I encourage SPICE to be used, and so this is
the way it’s presented in this lesson. In order to use SPICE this way in a command-line environment,
we need to use the ”<” redirection symbol to direct the contents of your netlist file to Standard
Input (stdin), which SPICE can then process.
r10 1 0 4.7e3 (Resistor R10 , 4.7e3 = 4.7 x 103 ohms = 4.7 kilo-ohms = 4.7 kΩ)
r11 1 0 1e-12 (Resistor R11 , 1e-12 = 1 x 10−12 ohms = 1 pico-ohm = 1 pΩ)
The unit (ohms, volts, farads, henrys, etc.) is automatically determined by the type of component
being specified. SPICE ”knows” that all of the above examples are ”ohms” because they are all
resistors (r1, r2, r3, . . . ). If they were capacitors, the values would be interpreted as ”farads,” if
inductors, then ”henrys,” etc.
CAPACITORS:
General form: c[name] [node1] [node2] [value] ic=[initial voltage]
Example 1: c1 12 33 10u
Example 2: c1 12 33 10u ic=3.5
Comments: The ”initial condition” (ic=) variable is the capacitor’s voltage in units of volts
at the start of DC analysis. It is an optional value, with the starting voltage assumed to be zero
if unspecified. Starting current values for capacitors are interpreted by SPICE only if the .tran
analysis option is invoked (with the ”uic” option).
INDUCTORS:
General form: l[name] [node1] [node2] [value] ic=[initial current]
Example 1: l1 12 33 133m
Example 2: l1 12 33 133m ic=12.7m
Comments: The ”initial condition” (ic=) variable is the inductor’s current in units of amps at
the start of DC analysis. It is an optional value, with the starting current assumed to be zero if
unspecified. Starting current values for inductors are interpreted by SPICE only if the .tran analysis
option is invoked.
RESISTORS:
General form: r[name] [node1] [node2] [value]
Example: rload 23 15 3.3k
Comments: In case you were wondering, there is no declaration of resistor power dissipation
rating in SPICE. All components are assumed to be indestructible. If only real life were this forgiving!
60 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
DIODES:
General form: d[name] [anode] [cathode] [model]
Example: d1 1 2 mod1
DIODE MODELS:
General form: .model [modelname] d [parmtr1=x] [parmtr2=x] . . .
Example: .model mod1 d
Example: .model mod2 d vj=0.65 rs=1.3
Parameter definitions:
is = saturation current in amps
rs = junction resistance in ohms
n = emission coefficient (unitless)
tt = transit time in seconds
cjo = zero-bias junction capacitance in farads
vj = junction potential in volts
m = grading coefficient (unitless)
eg = activation energy in electron-volts
xti = saturation-current temperature exponent (unitless)
kf = flicker noise coefficient (unitless)
af = flicker noise exponent (unitless)
fc = forward-bias depletion capacitance coefficient (unitless)
bv = reverse breakdown voltage in volts
ibv = current at breakdown voltage in amps
Comments: The model name must begin with a letter, not a number. If you plan to specify
a model for a 1N4003 rectifying diode, for instance, you cannot use ”1n4003” for the model name.
An alternative might be ”m1n4003” instead.
on a P-channel transistor or a negative value (-1 volts) on an N-channel transistor will specify that
transistor to be a depletion (otherwise known as depletion-enhancement) mode device. Conversely,
a negative value on a P-channel transistor or a positive value on an N-channel transistor will specify
that transistor to be an enhancement mode device.
Remember that enhancement mode transistors are normally-off devices, and must be turned
on by the application of gate voltage. Depletion-mode transistors are normally ”on,” but can be
”pinched off” as well as enhanced to greater levels of drain current by applied gate voltage, hence
the alternate designation of ”depletion-enhancement” MOSFETs. The ”vto” parameter specifies
the threshold gate voltage for MOSFET conduction.
7.5.3 Sources
AC SINEWAVE VOLTAGE SOURCES (when using .ac card to specify frequency):
General form: v[name] [+node] [-node] ac [voltage] [phase] sin
Example 1: v1 1 0 ac 12 sin
Example 2: v1 1 0 ac 12 240 sin (12 V 6 240o )
Comments: This method of specifying AC voltage sources works well if you’re using multiple
sources at different phase angles from each other, but all at the same frequency. If you need to
specify sources at different frequencies in the same circuit, you must use the next method!
AC SINEWAVE VOLTAGE SOURCES (when NOT using .ac card to specify fre-
quency):
General form: v[name] [+node] [-node] sin([offset] [voltage]
+ [freq] [delay] [damping factor])
Example 1: v1 1 0 sin(0 12 60 0 0)
Parameter definitions:
offset = DC bias voltage, offsetting the AC waveform by a specified voltage.
voltage = peak, or crest, AC voltage value for the waveform.
freq = frequency in Hertz.
delay = time delay, or phase offset for the waveform, in seconds.
damping factor = a figure used to create waveforms of decaying amplitude.
Comments: This method of specifying AC voltage sources works well if you’re using multi-
ple sources at different frequencies from each other. Representing phase shift is tricky, though,
necessitating the use of the delay factor.
AC SINEWAVE CURRENT SOURCES (when NOT using .ac card to specify fre-
quency):
General form: i[name] [+node] [-node] sin([offset]
+ [current] [freq] 0 0)
Example 1: i1 1 0 sin(0 1.5 60 0 0)
p = pulse value
td = delay time
tr = rise time
tf = fall time
pw = pulse width
pd = period
Example 1: i1 1 0 pulse (-3m 3m 0 0 0 17m 34m)
Comments: Example 1 is a perfect square wave oscillating between -3 mA and +3 mA, with
zero rise and fall times, a 34 millisecond period, and a 50 percent duty cycle (+3 mA for 17 ms,
then -3 mA for 17 ms).
DC ANALYSIS:
General form: .dc [source] [start] [final] [increment]
Example 1: .dc vin 1.5 15 0.5
Comments: The .dc card is necessary if you want to print or plot any voltage between two
nonzero nodes. Otherwise, the default ”small-signal” analysis only prints out the voltage between
each nonzero node and node zero.
TRANSIENT ANALYSIS:
General form: .tran [increment] [stop time] [start time]
66 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
+ [comp interval]
Example 1: .tran 1m 50m uic
Example 2: .tran .5m 32m 0 .01m
Comments: Example 1 has an increment time of 1 millisecond and a stop time of 50 milliseconds
(when only two parameters are specified, they are increment time and stop time, respectively).
Example 2 has an increment time of 0.5 milliseconds, a stop time of 32 milliseconds, a start time of
0 milliseconds (no delay on start), and a computation interval of 0.01 milliseconds.
Default value for start time is zero. Transient analysis always beings at time zero, but storage
of data only takes place between start time and stop time. Data output interval is increment time,
or (stop time - start time)/50, which ever is smallest. However, the computing interval variable can
be used to force a computational interval smaller than either. For large total interval counts, the
itl5 variable in the .options card may be set to a higher number. The ”uic” option tells SPICE
to ”use initial conditions.”
PLOT OUTPUT:
General form: .plot [type] [output1] [output2] . . . [output n]
Example 1: .plot dc v(1,2) i(v2)
Example 2: .plot ac v(3,4) vp(3,4) i(v1) ip(v1)
Example 3: .plot tran v(4,5) i(v2)
Comments: SPICE can’t handle more than eight data point requests on a single .plot or
.print card. If requesting more than eight data points, use multiple cards!
Also, here’s a major caveat when using SPICE version 3: if you’re performing AC analysis and
you ask SPICE to plot an AC voltage as in example #2, the v(3,4) command will only output
the real component of a rectangular-form complex number! SPICE version 2 outputs the polar
magnitude of a complex number: a much more meaningful quantity if only a single quantity is asked
for. To coerce SPICE3 to give you polar magnitude, you will have to re-write the .print or .plot
argument as such: vm(3,4).
PRINT OUTPUT:
General form: .print [type] [output1] [output2] . . . [output n]
Example 1: .print dc v(1,2) i(v2)
Example 2: .print ac v(2,4) i(vinput) vp(2,3)
Example 3: .print tran v(4,5) i(v2)
Comments: SPICE can’t handle more than eight data point requests on a single .plot or
.print card. If requesting more than eight data points, use multiple cards!
FOURIER ANALYSIS:
General form: .four [freq] [output1] [output2] . . . [output n]
Example 1: .four 60 v(1,2)
Comments: The .four card relies on the .tran card being present somewhere in the deck,
with the proper time periods for analysis of adequate cycles. Also, SPICE may ”crash” if a .plot
analysis isn’t done along with the .four analysis, even if all .tran parameters are technically correct.
Finally, the .four analysis option only works when the frequency of the AC source is specified in
that source’s card line, and not in an .ac analysis option line.
It helps to include a computation interval variable in the .tran card for better analysis precision.
A Fourier analysis of the voltage or current specified is performed up to the 9th harmonic, with the
[freq] specification being the fundamental, or starting frequency of the analysis spectrum.
7.6. ANALYSIS OPTIONS 67
MISCELLANEOUS:
General form: .options [option1] [option2]
Example 1: .options limpts=500
Example 2: .options itl5=0
Example 3: .options method=gear
Example 4: .options list
Example 5: .options nopage
Example 6: .options numdgt=6
Comments: There are lots of options that can be specified using this card. Perhaps the one
most needed by beginning users of SPICE is the ”limpts” setting. When running a simulation
that requires more than 201 points to be printed or plotted, this calculation point limit must be
increased or else SPICE will terminate analysis. The example given above (limpts=500) tells SPICE
to allocate enough memory to handle at least 500 calculation points in whatever type of analysis is
specified (DC, AC, or transient).
In example 2, we see an iteration variable (itl5) being set to a value of 0. There are actually six
different iteration variables available for user manipulation. They control the iteration cycle limits
for solution of nonlinear equations. The variable itl5 sets the maximum number of iterations for
a transient analysis. Similar to the limpts variable, itl5 usually needs to be set when a small
computation interval has been specified on a .tran card. Setting itl5 to a value of 0 turns off the
limit entirely, allowing the computer infinite iteration cycles (infinite time) to compute the analysis.
Warning: this may result in long simulation times!
Example 3 with ”method=gear” sets the numerical integration method used by SPICE. The
default is ”trapezoid” rather than ”gear,” trapezoid being a simple geometric approximation of area
under a curve found by slicing up the curve into trapezoids to approximate the shape. The ”gear”
method is based on second-order or better polynomial equations and is named after C.W. Gear
(Numerical Integration of Stiff Ordinary Equations, Report 221, Department of Computer Science,
University of Illinois, Urbana). The Gear method of integration is more demanding of the computer
(computationally ”expensive”) and will sometimes give slightly different results from the trapezoid
method.
The ”list” option shown in example 4 gives a verbose summary of all circuit components and
their respective values in the final output.
By default, SPICE will insert ASCII page-break control codes in the output to separate different
sections of the analysis. Specifying the ”nopage” option (example 5) will prevent such pagination.
The ”numdgt” option shown in example 6 specifies the number of significant digits output when
using one of the ”.print” data output options. SPICE defaults at a precision of 4 significant digits.
WIDTH CONTROL:
General form: .width in=[columns] out=[columns]
Example 1: .width out=80
Comments: The .width card can be used to control the width of text output lines upon
analysis. This is especially handy when plotting graphs with the .plot card. The default value is
120, which can cause problems on 80-character terminal displays unless set to 80 with this command.
68 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
7.7 Quirks
”Garbage in, garbage out.”
Anonymous
SPICE is a very reliable piece of software, but it does have its little quirks that take some getting
used to. By ”quirk” I mean a demand placed upon the user to write the source file in a particular
way in order for it to work without giving error messages. I do not mean any kind of fault with
SPICE which would produce erroneous or misleading results: that would be more properly referred
to as a ”bug.” Speaking of bugs, SPICE has a few of them as well.
Some (or all) of these quirks may be unique to SPICE version 2g6, which is the only version I’ve
used extensively. They may have been fixed in later versions.
In this analysis, there is a DC voltage of 15 volts between node 1 and ground (node 0), and a
DC voltage of 0.6522 volts between node 2 and ground (node 0). In both these cases, the voltage
polarity is negative at node 0 with reference to the other node (in other words, both nodes 1 and 2
are positive with respect to node 0).
7.7. QUIRKS 69
Parallel inductors
2 2 2
L1 10 mH L2 50 mH L3 25 mH
4 4 4
netlist
l1 2 4 10m
l2 2 4 50m
l3 2 4 25m
1 1
V1 12 V L1 150 mH
0 0
netlist
v1 1 0 dc 12
l1 1 0 150m
70 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
Series capacitors
5
C1 33 µF
C2 47 µF
netlist
c1 5 6 33u
c2 6 7 47u
The reason SPICE can’t handle these conditions stems from the way it performs DC analysis:
by treating all inductors as shorts and all capacitors as opens. Since short-circuits (0 Ω) and open
circuits (infinite resistance) either contain or generate mathematical infinitudes, a computer simply
cannot deal with them, and so SPICE will discontinue analysis if any of these conditions occur.
In order to make these component configurations acceptable to SPICE, you must insert resistors
of appropriate values into the appropriate places, eliminating the respective short-circuits and open-
circuits. If a series resistor is required, choose a very low resistance value. Conversely, if a parallel
resistor is required, choose a very high resistance value. For example:
To fix the parallel inductor problem, insert a very low-value resistor in series with each offending
inductor.
7.7. QUIRKS 71
Original circuit
2 2 2
L1 10 mH L2 50 mH L3 25 mH
4 4 4
"Fixed" circuit
3 Rbogus1 2 Rbogus2 5
L1 10 mH L2 50 mH L3 25 mH
4 4 4
original netlist
l1 2 4 10m
l2 2 4 50m
l3 2 4 25m
fixed netlist
rbogus1 2 3 1e-12
rbogus2 2 5 1e-12
l1 3 4 10m
l2 2 4 50m
l3 5 4 25m
The extremely low-resistance resistors Rbogus1 and Rbogus2 (each one with a mere 1 pico-ohm
of resistance) ”break up” the direct parallel connections that existed between L 1 , L2 , and L3 . It is
important to choose very low resistances here so that circuit operation is not substantially impacted
by the ”fix.”
To fix the voltage source / inductor loop, insert a very low-value resistor in series with the two
components.
72 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
Original circuit
1 1
V1 12 V L1 150 mH
0 0
"Fixed" circuit
Rbogus
1 2
V1 12 V L1 150 mH
0 0
original netlist
v1 1 0 dc 12
l1 1 0 150m
fixed netlist
v1 1 0 dc 12
l1 2 0 150m
rbogus 1 2 1e-12
As in the previous example with parallel inductors, it is important to make the correction resistor
(Rbogus ) very low in resistance, so as to not substantially impact circuit operation.
To fix the series capacitor circuit, one of the capacitors must have a resistor shunting across it.
SPICE requires a DC current path to each capacitor for analysis.
7.7. QUIRKS 73
C1 33 µF C1 33 µF
6 6
6
C2 47 µF C2 47 µF Rbogus
7
7 7
original netlist
c1 5 6 33u
c2 6 7 47u
fixed netlist
c1 5 6 33u
c2 6 7 47u
rbogus 6 7 9e12
The Rbogus value of 9 Tera-ohms provides a DC current path to C1 (and around C2 ) without
substantially impacting the circuit’s operation.
C1
4 7
22 µF
c1 4 7 22u
.print ac v(4,7)
However, if we wanted to have SPICE measure the current through that capacitor, it wouldn’t be
quite so easy. Currents in SPICE must be specified in relation to a voltage source, not any arbitrary
component. For example:
74 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
Vinput C1
6 4 7
I 22 µF
c1 4 7 22u
vinput 6 4 ac 1 sin
.print ac i(vinput)
This .print card instructs SPICE to print the current through voltage source V input , which
happens to be the same as the current through our capacitor between nodes 4 and 7. But what if
there is no such voltage source in our circuit to reference for current measurement? One solution is
to insert a shunt resistor into the circuit and measure voltage across it. In this case, I have chosen
a shunt resistance value of 1 Ω to produce 1 volt per amp of current through C1 :
Rshunt C1
6 4 7
1Ω 22 µF
I
c1 4 7 22u
rshunt 6 4 1
.print ac v(6,4)
However, the insertion of an extra resistance into our circuit large enough to drop a meaningful
voltage for the intended range of current might adversely affect things. A better solution for SPICE
is this, although one would never seek such a current measurement solution in real life:
Vbogus C1
6 4 7
0V 22 µF
I
c1 4 7 22u
vbogus 6 4 dc 0
.print ac i(vbogus)
Inserting a ”bogus” DC voltage source of zero volts doesn’t affect circuit operation at all, yet
it provides a convenient place for SPICE to take a current measurement. Interestingly enough, it
doesn’t matter that Vbogus is a DC source when we’re looking to measure AC current! The fact that
SPICE will output an AC current reading is determined by the ”ac” specification in the .print
card and nothing more.
It should also be noted that the way SPICE assigns a polarity to current measurements is a bit
odd. Take the following circuit as an example:
7.7. QUIRKS 75
R1
1 2
5 kΩ
V1 10 V R2 5 kΩ
0 0
example
v1 1 0
r1 1 2 5k
r2 2 0 5k
.dc v1 10 10 1
.print dc i(v1)
.end
With 10 volts total voltage and 10 kΩ total resistance, you might expect SPICE to tell you
there’s going to be 1 mA (1e-03) of current through voltage source V1 , but in actuality SPICE will
output a figure of negative 1 mA (-1e-03)! SPICE regards current out of the negative end of a DC
voltage source (the normal direction) to be a negative value of current rather than a positive value
of current. There are times I’ll throw in a ”bogus” voltage source in a DC circuit like this simply to
get SPICE to output a positive current value:
R1
1 2
5 kΩ
V1 10 V R2 5 kΩ
Vbogus
0 3
0V
example
v1 1 0
r1 1 2 5k
r2 2 3 5k
vbogus 3 0 dc 0
.dc v1 10 10 1
.print dc i(vbogus)
.end
Notice how Vbogus is positioned so that the circuit current will enter its positive side (node 3)
and exit its negative side (node 0). This orientation will ensure a positive output figure for circuit
current.
76 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
R1 2 R2
1 3
10 kΩ 8.1 kΩ
V1 24 V R3 4.7 kΩ V2 15 V
0 0 0
Without a .dc card and a .print or .plot card, the output for this netlist will only display
voltages for nodes 1, 2, and 3 (with reference to node 0, of course).
Netlist:
Multiple dc sources
v1 1 0 dc 24
v2 3 0 dc 15
r1 1 2 10k
r2 2 3 8.1k
r3 2 0 4.7k
7.8. EXAMPLE CIRCUITS AND NETLISTS 77
.end
Output:
node voltage node voltage node voltage
( 1) 24.0000 ( 2) 9.7470 ( 3) 15.0000
R1 2 R2
1 3
10 kΩ 8.1 kΩ
V1 24 V R3 4.7 kΩ V2 15 V
0 0 0
By adding a .dc analysis card and specifying source V1 from 24 volts to 24 volts in 1 step (in
other words, 24 volts steady), we can use the .print card analysis to print out voltages between any
two points we desire. Oddly enough, when the .dc analysis option is invoked, the default voltage
printouts for each node (to ground) disappears, so we end up having to explicitly specify them in
the .print card to see them at all.
Netlist:
Multiple dc sources
v1 1 0
v2 3 0 15
r1 1 2 10k
r2 2 3 8.1k
r3 2 0 4.7k
.dc v1 24 24 1
.print dc v(1) v(2) v(3) v(1,2) v(2,3)
.end
Output:
v1 v(1) v(2) v(3) v(1,2) v(2,3)
2.400E+01 2.400E+01 9.747E+00 1.500E+01 1.425E+01 -5.253E+00
78 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
1 1 1
V1 10 V C1 C2
47 µF 22 µF
R1
0 2 2
3.3 kΩ
For DC analysis, the initial conditions of any reactive component (C or L) must be specified
(voltage for capacitors, current for inductors). This is provided by the last data field of each capacitor
card (ic=0). To perform a DC analysis, the .tran (”transient”) analysis option must be specified,
with the first data field specifying time increment in seconds, the second specifying total analysis
timespan in seconds, and the ”uic” telling it to ”use initial conditions” when analyzing.
Netlist:
RC time delay circuit
v1 1 0 dc 10
c1 1 2 47u ic=0
c2 1 2 22u ic=0
r1 2 0 3.3k
.tran .05 1 uic
.print tran v(1,2)
.end
Output:
time v(1,2)
0.000E+00 7.701E-06
5.000E-02 1.967E+00
1.000E-01 3.551E+00
1.500E-01 4.824E+00
2.000E-01 5.844E+00
2.500E-01 6.664E+00
3.000E-01 7.322E+00
3.500E-01 7.851E+00
4.000E-01 8.274E+00
4.500E-01 8.615E+00
5.000E-01 8.888E+00
5.500E-01 9.107E+00
6.000E-01 9.283E+00
6.500E-01 9.425E+00
7.000E-01 9.538E+00
7.500E-01 9.629E+00
8.000E-01 9.702E+00
7.8. EXAMPLE CIRCUITS AND NETLISTS 79
8.500E-01 9.761E+00
9.000E-01 9.808E+00
9.500E-01 9.846E+00
1.000E+00 9.877E+00
1 1
V1
15 V Rload 10 kΩ
60 Hz
0 0
This exercise does show the proper setup for plotting instantaneous values of a sine-wave voltage
source with the .plot function (as a transient analysis). Not surprisingly, the Fourier analysis in this
deck also requires the .tran (transient) analysis option to be specified over a suitable time range.
The time range in this particular deck allows for a Fourier analysis with rather poor accuracy. The
more cycles of the fundamental frequency that the transient analysis is performed over, the more
precise the Fourier analysis will be. This is not a quirk of SPICE, but rather a basic principle of
waveforms.
Netlist:
v1 1 0 sin(0 15 60 0 0)
rload 1 0 10k
* change tran card to the following for better Fourier precision
* .tran 1m 30m .01m and include .options card:
* .options itl5=30000
.tran 1m 30m
.plot tran v(1)
.four 60 v(1)
.end
Output:
time v(1) -2.000E+01 -1.000E+01 0.000E+00 1.000E+01
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0.000E+00 0.000E+00 . . * . .
1.000E-03 5.487E+00 . . . * . .
2.000E-03 1.025E+01 . . . * .
3.000E-03 1.350E+01 . . . . * .
4.000E-03 1.488E+01 . . . . *.
5.000E-03 1.425E+01 . . . . * .
6.000E-03 1.150E+01 . . . . * .
7.000E-03 7.184E+00 . . . * . .
8.000E-03 1.879E+00 . . . * . .
9.000E-03 -3.714E+00 . . * . . .
80 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
1.000E-02 -8.762E+00 . . * . . .
1.100E-02 -1.265E+01 . * . . . .
1.200E-02 -1.466E+01 . * . . . .
1.300E-02 -1.465E+01 . * . . . .
1.400E-02 -1.265E+01 . * . . . .
1.500E-02 -8.769E+00 . . * . . .
1.600E-02 -3.709E+00 . . * . . .
1.700E-02 1.876E+00 . . . * . .
1.800E-02 7.191E+00 . . . * . .
1.900E-02 1.149E+01 . . . . * .
2.000E-02 1.425E+01 . . . . * .
2.100E-02 1.489E+01 . . . . *.
2.200E-02 1.349E+01 . . . . * .
2.300E-02 1.026E+01 . . . * .
2.400E-02 5.491E+00 . . . * . .
2.500E-02 1.553E-03 . . * . .
2.600E-02 -5.514E+00 . . * . . .
2.700E-02 -1.022E+01 . * . . .
2.800E-02 -1.349E+01 . * . . . .
2.900E-02 -1.495E+01 . * . . . .
3.000E-02 -1.427E+01 . * . . . .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
R1
1 2
30 Ω
V1 12 V C1 100 µF
60 Hz
0 0
The .ac card specifies the points of ac analysis from 60Hz to 60Hz, at a single point. This card,
of course, is a bit more useful for multi-frequency analysis, where a range of frequencies can be
analyzed in steps. The .print card outputs the AC voltage between nodes 1 and 2, and the AC
voltage between node 2 and ground.
Netlist:
Demo of a simple AC circuit
v1 1 0 ac 12 sin
r1 1 2 30
c1 2 0 100u
.ac lin 1 60 60
.print ac v(1,2) v(2)
.end
Output:
freq v(1,2) v(2)
6.000E+01 8.990E+00 7.949E+00
L1 L2
2 3 4
100 mH 250 mH
V1 24 V
1 C1 100 µF Rload 1 kΩ
V2 24 V
0 0 0
82 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
This low-pass filter blocks AC and passes DC to the Rload resistor. Typical of a filter used to
suppress ripple from a rectifier circuit, it actually has a resonant frequency, technically making it a
band-pass filter. However, it works well anyway to pass DC and block the high-frequency harmonics
generated by the AC-to-DC rectification process. Its performance is measured with an AC source
sweeping from 500 Hz to 15 kHz. If desired, the .print card can be substituted or supplemented
with a .plot card to show AC voltage at node 4 graphically.
Netlist:
Lowpass filter
v1 2 1 ac 24 sin
v2 1 0 dc 24
rload 4 0 1k
l1 2 3 100m
l2 3 4 250m
c1 3 0 100u
.ac lin 30 500 15k
.print ac v(4)
.plot ac v(4)
.end
freq v(4)
5.000E+02 1.935E-01
1.000E+03 3.275E-02
1.500E+03 1.057E-02
2.000E+03 4.614E-03
2.500E+03 2.402E-03
3.000E+03 1.403E-03
3.500E+03 8.884E-04
4.000E+03 5.973E-04
4.500E+03 4.206E-04
5.000E+03 3.072E-04
5.500E+03 2.311E-04
6.000E+03 1.782E-04
6.500E+03 1.403E-04
7.000E+03 1.124E-04
7.500E+03 9.141E-05
8.000E+03 7.536E-05
8.500E+03 6.285E-05
9.000E+03 5.296E-05
9.500E+03 4.504E-05
1.000E+04 3.863E-05
1.050E+04 3.337E-05
1.100E+04 2.903E-05
1.150E+04 2.541E-05
1.200E+04 2.237E-05
1.250E+04 1.979E-05
7.8. EXAMPLE CIRCUITS AND NETLISTS 83
1.300E+04 1.760E-05
1.350E+04 1.571E-05
1.400E+04 1.409E-05
1.450E+04 1.268E-05
1.500E+04 1.146E-05
L1 L2
1 2 3
450 mH 150 mH
+ +
V1 55 V C1 330 µF V2 43 V
30 Hz 30 Hz
- 0o - 25o
0 0 0
One of the idiosyncrasies of SPICE is its inability to handle any loop in a circuit exclusively
composed of series voltage sources and inductors. Therefore, the ”loop” of V 1 -L1 -L2 -V2 -V1 is
unacceptable. To get around this, I had to insert a low -resistance resistor somewhere in that loop to
break it up. Thus, we have Rbogus between 3 and 4 (with 1 pico-ohm of resistance), and V2 between
4 and 0. The circuit above is the original design, while the circuit below has R bogus inserted to avoid
the SPICE error.
L1 L2
1 2 3
450 mH 150 mH
Rbogus 1 pΩ
+
V1 55 V C1 330 µF 4
30 Hz +
- 0o V2 43 V
30 Hz
- 25o
0 0 0
Netlist:
Multiple ac source
v1 1 0 ac 55 0 sin
v2 4 0 ac 43 25 sin
l1 1 2 450m
c1 2 0 330u
l2 2 3 150m
7.8. EXAMPLE CIRCUITS AND NETLISTS 85
rbogus 3 4 1e-12
.ac lin 1 30 30
.print ac v(2)
.end
Output:
freq v(2)
3.000E+01 1.413E+02
1 1 1
Rshunt1 1 Ω Rshunt2 1Ω
2 3
L1 1H R1 6.3 kΩ
0 0 0
The currents through each leg are indicated by the voltage drops across each respective shunt
resistor (1 amp = 1 volt through 1 Ω), output by the v(1,2) and v(1,3) terms of the .print card.
The phase of the currents through each leg are indicated by the phase of the voltage drops across
each respective shunt resistor, output by the vp(1,2) and vp(1,3) terms in the .print card.
Netlist:
phase shift
v1 1 0 ac 4 sin
rshunt1 1 2 1
rshunt2 1 3 1
l1 2 0 1
r1 3 0 6.3k
.ac lin 1 1000 1000
.print ac v(1,2) v(1,3) vp(1,2) vp(1,3)
.end
Output:
freq v(1,2) v(1,3) vp(1,2) vp(1,3)
1.000E+03 6.366E-04 6.349E-04 -9.000E+01 0.000E+00
86 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
2
Rbogus0 L2 R1
1 1H
L1 4
V1 3
100 H L3
0 R2
25 H
5
Rbogus1 Rbogus2
0 0
Netlist:
transformer
v1 1 0 ac 120 sin
rbogus0 1 6 1e-3
l1 6 0 100
l2 2 4 1
l3 3 5 25
k1 l1 l2 0.999
k2 l2 l3 0.999
k3 l1 l3 0.999
r1 2 4 1000
r2 3 5 1000
rbogus1 5 0 1e10
rbogus2 4 0 1e10
.ac lin 1 60 60
.print ac v(1,0) v(2,0) v(3,0)
.end
7.8. EXAMPLE CIRCUITS AND NETLISTS 87
Output:
freq v(1) v(2) v(3)
6.000E+01 1.200E+02 1.199E+01 5.993E+01
In this example, Rbogus0 is a very low-value resistor, serving to break up the source/inductor
loop of V1 /L1 . Rbogus1 and Rbogus2 are very high-value resistors necessary to provide DC paths to
ground on each of the isolated circuits. Note as well that one side of the primary circuit is directly
grounded. Without these ground references, SPICE will produce errors!
1 1
D1 D3
Rload
V1 15 V 2 + - 3
60 Hz 10 kΩ
D2 D4
0 0
Diodes, like all semiconductor components in SPICE, must be modeled so that SPICE knows
all the nitty-gritty details of how they’re supposed to work. Fortunately, SPICE comes with a few
generic models, and the diode is the most basic. Notice the .model card which simply specifies ”d”
as the generic diode model for mod1. Again, since we’re plotting the waveforms here, we need to
specify all parameters of the AC source in a single card and print/plot all values using the .tran
option.
Netlist:
fullwave bridge rectifier
v1 1 0 sin(0 15 60 0 0)
rload 1 0 10k
d1 1 2 mod1
d2 0 2 mod1
d3 3 1 mod1
d4 3 0 mod1
.model mod1 d
.tran .5m 25m
.plot tran v(1,0) v(2,3)
.end
Output:
legend:
*: v(1)
+: v(2,3)
time v(1)
(*)--------- -2.000E+01 -1.000E+01 0.000E+00 1.000E+01 2.000E+01
88 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
2.200E-02 1.344E+01 . . . . * + .
2.250E-02 1.195E+01 . . . . *+ .
2.300E-02 1.016E+01 . . . +* .
2.350E-02 7.917E+00 . . . + * . .
2.400E-02 5.460E+00 . . + * . .
2.450E-02 2.809E+00 . . + . * . .
2.500E-02 -8.297E-04 . + * . .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Q1
β = 50
3 2
Re 100 Ω Rc 800 Ω
Vin Vsupply
4 0 1
0 to 5 V 24 V
This analysis sweeps the input voltage (Vin) from 0 to 5 volts in 0.1 volt increments, then prints
out the voltage between the collector and emitter leads of the transistor v(2,3). The transistor (Q1)
is an NPN with a forward Beta of 50.
Netlist:
Common-base BJT amplifier
vsupply 1 0 dc 24
vin 0 4 dc
rc 1 2 800
re 3 4 100
q1 2 0 3 mod1
.model mod1 npn bf=50
.dc vin 0 5 0.1
.print dc v(2,3)
.plot dc v(2,3)
.end
Output:
vin v(2,3)
0.000E+00 2.400E+01
1.000E-01 2.410E+01
2.000E-01 2.420E+01
3.000E-01 2.430E+01
4.000E-01 2.440E+01
5.000E-01 2.450E+01
90 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
6.000E-01 2.460E+01
7.000E-01 2.466E+01
8.000E-01 2.439E+01
9.000E-01 2.383E+01
1.000E+00 2.317E+01
1.100E+00 2.246E+01
1.200E+00 2.174E+01
1.300E+00 2.101E+01
1.400E+00 2.026E+01
1.500E+00 1.951E+01
1.600E+00 1.876E+01
1.700E+00 1.800E+01
1.800E+00 1.724E+01
1.900E+00 1.648E+01
2.000E+00 1.572E+01
2.100E+00 1.495E+01
2.200E+00 1.418E+01
2.300E+00 1.342E+01
2.400E+00 1.265E+01
2.500E+00 1.188E+01
2.600E+00 1.110E+01
2.700E+00 1.033E+01
2.800E+00 9.560E+00
2.900E+00 8.787E+00
3.000E+00 8.014E+00
3.100E+00 7.240E+00
3.200E+00 6.465E+00
3.300E+00 5.691E+00
3.400E+00 4.915E+00
3.500E+00 4.140E+00
3.600E+00 3.364E+00
3.700E+00 2.588E+00
3.800E+00 1.811E+00
3.900E+00 1.034E+00
4.000E+00 2.587E-01
4.100E+00 9.744E-02
4.200E+00 7.815E-02
4.300E+00 6.806E-02
4.400E+00 6.141E-02
4.500E+00 5.657E-02
4.600E+00 5.281E-02
4.700E+00 4.981E-02
4.800E+00 4.734E-02
4.900E+00 4.525E-02
5.000E+00 4.346E-02
7.8. EXAMPLE CIRCUITS AND NETLISTS 91
4.400E+00 6.141E-02 * . . .
4.500E+00 5.657E-02 * . . .
4.600E+00 5.281E-02 * . . .
4.700E+00 4.981E-02 * . . .
4.800E+00 4.734E-02 * . . .
4.900E+00 4.525E-02 * . . .
5.000E+00 4.346E-02 * . . .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3 3
Rdrain 10 kΩ
J1 2
1 VDD 20 V
4
Vin 1V
60 Hz Vout
Rsource 1 kΩ
0 0 0
Netlist:
common source jfet amplifier
vin 1 0 sin(0 1 60 0 0)
vdd 3 0 dc 20
rdrain 3 2 10k
rsource 4 0 1k
j1 2 1 4 mod1
.model mod1 njf
.tran 1m 30m
.plot tran v(2,0) v(1,0)
.end
Output:
legend:
*: v(2)
+: v(1)
time v(2)
(*)--------- 1.400E+01 1.600E+01 1.800E+01 2.000E+01 2.200E+01
(+)--------- -1.000E+00 -5.000E-01 0.000E+00 5.000E-01 1.000E+00
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7.8. EXAMPLE CIRCUITS AND NETLISTS 93
0.000E+00 1.708E+01 . . * + . .
1.000E-03 1.609E+01 . .* . + . .
2.000E-03 1.516E+01 . * . . . + .
3.000E-03 1.448E+01 . * . . . + .
4.000E-03 1.419E+01 .* . . . +
5.000E-03 1.432E+01 . * . . . +.
6.000E-03 1.490E+01 . * . . . + .
7.000E-03 1.577E+01 . * . . +. .
8.000E-03 1.676E+01 . . * . + . .
9.000E-03 1.768E+01 . . + *. . .
1.000E-02 1.841E+01 . + . . * . .
1.100E-02 1.890E+01 . + . . * . .
1.200E-02 1.912E+01 .+ . . * . .
1.300E-02 1.912E+01 .+ . . * . .
1.400E-02 1.890E+01 . + . . * . .
1.500E-02 1.842E+01 . + . . * . .
1.600E-02 1.768E+01 . . + *. . .
1.700E-02 1.676E+01 . . * . + . .
1.800E-02 1.577E+01 . * . . +. .
1.900E-02 1.491E+01 . * . . . + .
2.000E-02 1.432E+01 . * . . . +.
2.100E-02 1.419E+01 .* . . . +
2.200E-02 1.449E+01 . * . . . + .
2.300E-02 1.516E+01 . * . . . + .
2.400E-02 1.609E+01 . .* . + . .
2.500E-02 1.708E+01 . . * + . .
2.600E-02 1.796E+01 . . + * . .
2.700E-02 1.861E+01 . + . . * . .
2.800E-02 1.900E+01 . + . . * . .
2.900E-02 1.916E+01 + . . * . .
3.000E-02 1.908E+01 .+ . . * . .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
R2 1 R1
2 3
1.18 kΩ 3.29 kΩ
V1 0 to 3.5 V 1 −
(e) 3
+
0
0
94 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
Netlist:
Inverting opamp
v1 2 0 dc
e 3 0 0 1 999k
r1 3 1 3.29k
r2 1 2 1.18k
.dc v1 0 3.5 0.05
.print dc v(3,0)
.end
Output:
v1 v(3)
0.000E+00 0.000E+00
5.000E-02 -1.394E-01
1.000E-01 -2.788E-01
1.500E-01 -4.182E-01
2.000E-01 -5.576E-01
2.500E-01 -6.970E-01
3.000E-01 -8.364E-01
3.500E-01 -9.758E-01
4.000E-01 -1.115E+00
4.500E-01 -1.255E+00
5.000E-01 -1.394E+00
5.500E-01 -1.533E+00
6.000E-01 -1.673E+00
6.500E-01 -1.812E+00
7.000E-01 -1.952E+00
7.500E-01 -2.091E+00
8.000E-01 -2.231E+00
8.500E-01 -2.370E+00
9.000E-01 -2.509E+00
9.500E-01 -2.649E+00
1.000E+00 -2.788E+00
1.050E+00 -2.928E+00
1.100E+00 -3.067E+00
1.150E+00 -3.206E+00
1.200E+00 -3.346E+00
1.250E+00 -3.485E+00
1.300E+00 -3.625E+00
7.8. EXAMPLE CIRCUITS AND NETLISTS 95
1.350E+00 -3.764E+00
1.400E+00 -3.903E+00
1.450E+00 -4.043E+00
1.500E+00 -4.182E+00
1.550E+00 -4.322E+00
1.600E+00 -4.461E+00
1.650E+00 -4.600E+00
1.700E+00 -4.740E+00
1.750E+00 -4.879E+00
1.800E+00 -5.019E+00
1.850E+00 -5.158E+00
1.900E+00 -5.297E+00
1.950E+00 -5.437E+00
2.000E+00 -5.576E+00
2.050E+00 -5.716E+00
2.100E+00 -5.855E+00
2.150E+00 -5.994E+00
2.200E+00 -6.134E+00
2.250E+00 -6.273E+00
2.300E+00 -6.413E+00
2.350E+00 -6.552E+00
2.400E+00 -6.692E+00
2.450E+00 -6.831E+00
2.500E+00 -6.970E+00
2.550E+00 -7.110E+00
2.600E+00 -7.249E+00
2.650E+00 -7.389E+00
2.700E+00 -7.528E+00
2.750E+00 -7.667E+00
2.800E+00 -7.807E+00
2.850E+00 -7.946E+00
2.900E+00 -8.086E+00
2.950E+00 -8.225E+00
3.000E+00 -8.364E+00
3.050E+00 -8.504E+00
3.100E+00 -8.643E+00
3.150E+00 -8.783E+00
3.200E+00 -8.922E+00
3.250E+00 -9.061E+00
3.300E+00 -9.201E+00
3.350E+00 -9.340E+00
3.400E+00 -9.480E+00
3.450E+00 -9.619E+00
3.500E+00 -9.758E+00
96 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
R2 1 R1
3
10 kΩ 20 kΩ
0
1 −
2 (e) 3
2 +
Rbogus 10 kΩ
V1 5V
0 0
Another example of a SPICE quirk: since the dependent voltage source ”e” isn’t considered a
load to voltage source V1 , SPICE interprets V1 to be open-circuited and will refuse to analyze it.
The fix is to connect Rbogus in parallel with V1 to act as a DC load. Being directly connected across
V1 , the resistance of Rbogus is not crucial to the operation of the circuit, so 10 kΩ will work fine.
I decided not to sweep the V1 input voltage at all in this circuit for the sake of keeping the netlist
and output listing simple.
Netlist:
noninverting opamp
v1 2 0 dc 5
rbogus 2 0 10k
e 3 0 2 1 999k
r1 3 1 20k
r2 1 0 10k
.end
Output:
node voltage node voltage node voltage
( 1) 5.0000 ( 2) 5.0000 ( 3) 15.0000
7.8. EXAMPLE CIRCUITS AND NETLISTS 97
1 1 + R3 R4
3 7 9
(e1)
2 − 10 kΩ 10 kΩ
Rbogus1 V1
0 to 10 V
R1 10 kΩ
0 0
2
7 −
Rgain 10 kΩ (e3) 9
8 +
5 Rload 10 kΩ
R2 10 kΩ 0
5 − R5 R6
4 (e2) 0
4 + 6 10 kΩ 8 10 kΩ
Rbogus2 V2 5V
0 0
Note the very high-resistance Rbogus1 and Rbogus2 resistors in the netlist (not shown in schematic
for brevity) across each input voltage source, to keep SPICE from thinking V 1 and V2 were open-
circuited, just like the other op-amp circuit examples.
Netlist:
Instrumentation amplifier
v1 1 0
rbogus1 1 0 9e12
v2 4 0 dc 5
rbogus2 4 0 9e12
e1 3 0 1 2 999k
e2 6 0 4 5 999k
e3 9 0 8 7 999k
rload 9 0 10k
r1 2 3 10k
rgain 2 5 10k
r2 5 6 10k
r3 3 7 10k
r4 7 9 10k
r5 6 8 10k
r6 8 0 10k
.dc v1 0 10 1
.print dc v(9) v(3,6)
.end
Output:
v1 v(9) v(3,6)
98 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
R1 C1
1 2 3
10 kΩ 100 µF
15 V 2 −
Vin
60 Hz (e)
0 +
0 Vout
Netlist:
Integrator with sinewave input
vin 1 0 sin (0 15 60 0 0)
r1 1 2 10k
c1 2 3 150u ic=0
e 3 0 0 2 999k
.tran 1m 30m uic
.plot tran v(1,0) v(3,0)
.end
Output:
legend:
*: v(1)
+: v(3)
time v(1)
(*)-------- -2.000E+01 -1.000E+01 0.000E+00 1.000E+01
7.8. EXAMPLE CIRCUITS AND NETLISTS 99
R1 C1
1 2 3
10 kΩ 100 µF
1V 2 −
Vin
50 Hz (e)
0 +
0 Vout
Netlist:
Integrator with squarewave input
vin 1 0 pulse (-1 1 0 0 0 10m 20m)
r1 1 2 1k
c1 2 3 150u ic=0
e 3 0 0 2 999k
.tran 1m 50m uic
.plot tran v(1,0) v(3,0)
.end
Output:
legend:
*: v(1)
+: v(3)
time v(1)
(*)-------- -1.000E+00 -5.000E-01 0.000E+00 5.000E-01 1.000E+00
(+)-------- -1.000E-01 -5.000E-02 0.000E+00 5.000E-02 1.000E-01
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0.000E+00 -1.000E+00 * . + . .
1.000E-03 1.000E+00 . . + . *
2.000E-03 1.000E+00 . . + . . *
3.000E-03 1.000E+00 . . + . . *
4.000E-03 1.000E+00 . . + . . *
5.000E-03 1.000E+00 . . + . . *
6.000E-03 1.000E+00 . . + . . *
7.000E-03 1.000E+00 . . + . . *
8.000E-03 1.000E+00 . .+ . . *
9.000E-03 1.000E+00 . +. . . *
1.000E-02 1.000E+00 . + . . . *
7.8. EXAMPLE CIRCUITS AND NETLISTS 101
1.100E-02 1.000E+00 . + . . . *
1.200E-02 -1.000E+00 * + . . . .
1.300E-02 -1.000E+00 * + . . . .
1.400E-02 -1.000E+00 * +. . . .
1.500E-02 -1.000E+00 * .+ . . .
1.600E-02 -1.000E+00 * . + . . .
1.700E-02 -1.000E+00 * . + . . .
1.800E-02 -1.000E+00 * . + . . .
1.900E-02 -1.000E+00 * . + . . .
2.000E-02 -1.000E+00 * . + . . .
2.100E-02 1.000E+00 . . + . . *
2.200E-02 1.000E+00 . . + . . *
2.300E-02 1.000E+00 . . + . . *
2.400E-02 1.000E+00 . . + . . *
2.500E-02 1.000E+00 . . + . . *
2.600E-02 1.000E+00 . .+ . . *
2.700E-02 1.000E+00 . +. . . *
2.800E-02 1.000E+00 . + . . . *
2.900E-02 1.000E+00 . + . . . *
3.000E-02 1.000E+00 . + . . . *
3.100E-02 1.000E+00 . + . . . *
3.200E-02 -1.000E+00 * + . . . .
3.300E-02 -1.000E+00 * + . . . .
3.400E-02 -1.000E+00 * + . . . .
3.500E-02 -1.000E+00 * + . . . .
3.600E-02 -1.000E+00 * +. . . .
3.700E-02 -1.000E+00 * .+ . . .
3.800E-02 -1.000E+00 * . + . . .
3.900E-02 -1.000E+00 * . + . . .
4.000E-02 -1.000E+00 * . + . . .
4.100E-02 1.000E+00 . . + . . *
4.200E-02 1.000E+00 . . + . . *
4.300E-02 1.000E+00 . . + . . *
4.400E-02 1.000E+00 . .+ . . *
4.500E-02 1.000E+00 . +. . . *
4.600E-02 1.000E+00 . + . . . *
4.700E-02 1.000E+00 . + . . . *
4.800E-02 1.000E+00 . + . . . *
4.900E-02 1.000E+00 . + . . . *
5.000E-02 1.000E+00 + . . . *
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102 CHAPTER 7. USING THE SPICE CIRCUIT SIMULATION PROGRAM
Chapter 8
TROUBLESHOOTING –
THEORY AND PRACTICE
8.1
Perhaps the most valuable but difficult-to-learn skill any technical person could have is the ability
to troubleshoot a system. For those unfamiliar with the term, troubleshooting means the act of
pinpointing and correcting problems in any kind of system. For an auto mechanic, this means
determining and fixing problems in cars based on the car’s behavior. For a doctor, this means
correctly diagnosing a patient’s malady and prescribing a cure. For a business expert, this means
identifying the source(s) of inefficiency in a corporation and recommending corrective measures.
Troubleshooters must be able to determine the cause or causes of a problem simply by examining
its effects. Rarely does the source of a problem directly present itself for all to see. Cause/effect
relationships are often complex, even for seemingly simple systems, and often the proficient trou-
bleshooter is regarded by others as something of a miracle-worker for their ability to quickly discern
the root cause of a problem. While some people are gifted with a natural talent for troubleshooting,
it is a skill that can be learned like any other.
Sometimes the system to be analyzed is in so bad a state of affairs that there is no hope of
ever getting it working again. When investigators sift through the wreckage of a crashed airplane,
or when a doctor performs an autopsy, they must do their best to determine the cause of massive
failure after the fact. Fortunately, the task of the troubleshooter is usually not this grim. Typically,
a misbehaving system is still functioning to some degree and may be stimulated and adjusted by
the troubleshooter as part of the diagnostic procedure. In this sense, troubleshooting is a lot like
scientific method: determining cause/effect relationships by means of live experimentation.
Like science, troubleshooting is a mixture of standard procedure and personal creativity. There
are certain procedures employed as tools to discern cause(s) from effects, but they are impotent if not
coupled with a creative and inquisitive mind. In the course of troubleshooting, the troubleshooter
may have to invent their own specific technique – adapted to the particular system they’re working
on – and/or modify tools to perform a special task. Creativity is necessary in examining a problem
from different perspectives: learning to ask different questions when the ”standard” questions don’t
lead to fruitful answers.
103
104 CHAPTER 8. TROUBLESHOOTING – THEORY AND PRACTICE
If there is one personality trait I’ve seen positively associated with excellent troubleshooting
more than any other, it’s technical curiosity. People fascinated by learning how things work, and
who aren’t discouraged by a challenging problem, tend to be better at troubleshooting than oth-
ers. Richard Feynman, the late physicist who taught at Caltech for many years, illustrates to me
the ultimate troubleshooting personality. Reading any of his (auto)biographical books is both ed-
ucating and entertaining, and I recommend them to anyone seeking to develop their own scientific
reasoning/troubleshooting skills.
• What are the process quality concerns, before I start troubleshooting (what can I do without
causing interruptions in production)?
These preliminary questions are not trivial. Indeed, they are essential to expedient and safe trou-
bleshooting. They are especially important when the system to be trouble-shot is large, dangerous,
and/or expensive.
Sometimes the troubleshooter will be required to work on a system that is still in full operation
(perhaps the ultimate example of this is a doctor diagnosing a live patient). Once the cause or
causes are determined to a high degree of certainty, there is the step of corrective action. Correcting
a system fault without significantly interrupting the operation of the system can be very challenging,
and it deserves thorough planning.
When there is high risk involved in taking corrective action, such as is the case with performing
surgery on a patient or making repairs to an operating process in a chemical plant, it is essential for
the worker(s) to plan ahead for possible trouble. One question to ask before proceeding with repairs
is, ”how and at what point(s) can I abort the repairs if something goes wrong?” In risky situations,
it is vital to have planned ”escape routes” in your corrective action, just in case things do not go
as planned. A surgeon operating on a patient knows if there are any ”points of no return” in such
a procedure, and stops to re-check the patient before proceeding past those points. He or she also
knows how to ”back out” of a surgical procedure at those points if needed.
is probability assessment, and these tips help the troubleshooter determine which possible points of
failure are more or less likely than others. Final isolation of the system failure is usually determined
through more specific techniques (outlined in the next section – Specific Troubleshooting Techniques).
Example: The car’s engine is overheating. The last two times this happened, the cause was low
coolant level in the radiator.
What to do: Check the coolant level first. Of course, past history by no means guarantees the
present symptoms are caused by the same problem, but since this is more likely, it makes sense to
check this first.
If, however, the cause of routine failure in a system has been corrected (i.e. the leak causing low
coolant level in the past has been repaired), then this may not be a probable cause of trouble this
time.
Example: The mechanic recently tuned my car’s engine, and now I hear a rattling noise that I
didn’t hear before I took the car in for repair.
What to do: Check for something that may have been left loose by the mechanic after his or her
tune-up work.
Example: The radio works fine on the AM band, but not on the FM band.
What to do: Eliminate from the list of possible causes, anything in the radio necessary for the
AM band’s function. Whatever the source of the problem is, it is specific to the FM band and not
to the AM band. This eliminates the audio amplifier, speakers, fuse, power supply, and almost all
external wiring. Being able to eliminate sections of the system as possible failures reduces the scope
of the problem and makes the rest of the troubleshooting procedure more efficient.
106 CHAPTER 8. TROUBLESHOOTING – THEORY AND PRACTICE
8.3.4 Hypothesize
Based on your knowledge of how a system works, think of various kinds of failures that would cause
this problem (or these phenomena) to occur, and check for those failures (starting with the most
likely based on circumstances, history, or knowledge of component weaknesses).
suppose that a circuit develops a short, which ”blows” the protective fuse for that circuit. The
blown fuse is not evident by inspection, and you don’t have a meter to electrically test the fuse, so
you decide to swap the suspect fuse with one of the same rating from a working circuit. As a result
of this, the good fuse that you move to the shorted circuit blows as well, leaving you with two blown
fuses and two non-working circuits. At least you know for certain that the original fuse was blown,
because the circuit it was moved to stopped working after the swap, but this knowledge was gained
only through the loss of a good fuse and the additional ”down time” of the second circuit.
Another example to illustrate this caveat is the ignition system problem previously mentioned.
Suppose that the ”weak” ignition coil had caused the engine to backfire, damaging the muffler. If
swapping ignition system components with another vehicle causes the problem to move to the other
vehicle, damage may be done to the other vehicle’s muffler as well. As a general rule, the technique
of swapping identical components should be used only when there is minimal chance of causing
additional damage. It is an excellent technique for isolating non-destructive problems.
Example 1: You’re working on a CNC machine tool with X, Y, and Z-axis drives. The Y axis is
not working, but the X and Z axes are working. All three axes share identical components (feedback
encoders, servo motor drives, servo motors).
What to do: Exchange these identical components, one at a time, Y axis and either one of the
working axes (X or Z), and see after each swap whether or not the problem has moved with the
swap.
Example 2: A stereo system produces no sound on the left speaker, but the right speaker works
just fine.
What to do: Try swapping respective components between the two channels and see if the prob-
lem changes sides, from left to right. When it does, you’ve found the defective component. For
instance, you could swap the speakers between channels: if the problem moves to the other side (i.e.
the same speaker that was dead before is still dead, now that it’s connected to the right channel
cable) then you know that speaker is bad. If the problem stays on the same side (i.e. the speaker
formerly silent is now producing sound after having been moved to the other side of the room and
connected to the other cable), then you know the speakers are fine, and the problem must lie some-
where else (perhaps in the cable connecting the silent speaker to the amplifier, or in the amplifier
itself).
If the speakers have been verified as good, then you could check the cables using the same method.
Swap the cables so that each one now connects to the other channel of the amplifier and to the other
speaker. Again, if the problem changes sides (i.e. now the right speaker is now ”dead” and the left
speaker now produces sound), then the cable now connected to the right speaker must be defective.
If neither swap (the speakers nor the cables) causes the problem to change sides from left to right,
then the problem must lie within the amplifier (i.e. the left channel output must be ”dead”).
Example 1: A ”star” topology communications network between several computers has failed.
None of the computers are able to communicate with each other.
What to do: Try unplugging the computers, one at a time from the network, and see if the
network starts working again after one of them is unplugged. If it does, then that last unplugged
computer may be the one at fault (it may have been ”jamming” the network by constantly outputting
data or noise).
Example 2: A household fuse keeps blowing (or the breaker keeps tripping open) after a short
amount of time.
What to do: Unplug appliances from that circuit until the fuse or breaker quits interrupting the
circuit. If you can eliminate the problem by unplugging a single appliance, then that appliance
might be defective. If you find that unplugging almost any appliance solves the problem, then the
circuit may simply be overloaded by too many appliances, neither of them defective.
R 2R
−
R Vout
Vin1 +
R
Vin2
R
Vin3
What to do: I would test the passive averager network (the three resistors at the lower-left corner
of the schematic) to see that the proper (averaged) voltage was seen at the noninverting input of
the op-amp. I would then measure the voltage at the inverting input to see if it was the same as at
the noninverting input (or, alternatively, measure the voltage difference between the two inputs of
the op-amp, as it should be zero). Continue testing sections of the circuit (or just test points within
the circuit) to see if you measure the expected voltages and currents.
8.4. SPECIFIC TROUBLESHOOTING TECHNIQUES 109
Example #1: A turbine control system shuts automatically in response to an abnormal con-
dition. By the time a technician arrives at the scene to survey the turbine’s condition, however,
everything is in a ”down” state and it’s impossible to tell what signal or condition was responsible
for the initial shutdown, as all operating parameters are now ”abnormal.”
What to do: One technician I knew used a videocamera to record the turbine control panel, so
he could see what happened (by indications on the gauges) first in an automatic-shutdown event.
Simply by looking at the panel after the fact, there was no way to tell which signal shut the turbine
110 CHAPTER 8. TROUBLESHOOTING – THEORY AND PRACTICE
down, but the videotape playback would show what happened in sequence, down to a frame-by-frame
time resolution.
Example #2: An alarm system is falsely triggering, and you suspect it may be due to a specific
wire connection going bad. Unfortunately, the problem never manifests itself while you’re watching
it!
What to do: Many modern digital multimeters are equipped with ”record” settings, whereby
they can monitor a voltage, current, or resistance over time and note whether that measurement
deviates substantially from a regular value. This is an invaluable tool for use in ”intermittent”
electronic system failures.
discontinuity (circuit break) in higher-voltage systems tends to blast away insulating layers of dirt
and corrosion, and may even weld the two ends together if sustained long enough. Low-voltage
systems tend not to generate such vigorous arcing across the gap of a circuit break, and also tend
to be more sensitive to additional resistance in the circuit. Mechanical switch contacts used in low-
voltage systems benefit from having the recommended minimum wetting current conducted through
them to promote a healthy amount of arcing upon opening, even if this level of current is not
necessary for the operation of other circuit components.
Although open failures tend to more common than shorted failures, ”shorts” still constitute a
substantial percentage of wiring failure modes. Many shorts are caused by degradation of wire
insulation. This, again, is especially true when the environment is hostile, including such factors
as high vibration, high heat, high humidity, or high voltage. It is rare to find a mechanical switch
contact that is failed shorted, except in the case of high-current contacts where contact ”welding”
may occur in overcurrent conditions. Shorts may also be caused by conductive buildup across
terminal strip sections or the backs of printed circuit boards.
A common case of shorted wiring is the ground fault, where a conductor accidently makes contact
with either earth or chassis ground. This may change the voltage(s) present between other conductors
in the circuit and ground, thereby causing bizarre system malfunctions and/or personnel hazard.
• Capacitors (shorted), especially electrolytic capacitors. The paste electrolyte tends to lose
moisture with age, leading to failure. Thin dielectric layers may be punctured by overvoltage
transients.
112 CHAPTER 8. TROUBLESHOOTING – THEORY AND PRACTICE
• Inductor and transformer windings open or shorted to conductive core. Failures related to
overheating (insulation breakdown) are easily detected by smell.
• Resistors open, almost never shorted. Usually this is due to overcurrent heating, although it
is less frequently caused by overvoltage transient (arc-over) or physical damage (vibration or
impact). Resistors may also change resistance value if overheated!
Whereas the last section deals with component failures in systems that have been successfully
operating for some time, this section concentrates on the problems plaguing brand-new systems. In
this case, failure modes are generally not of the aging kind, but are related to mistakes in design
and assembly caused by human beings.
Trusting that a brand-new component will always be good. While it is generally true
that a new component will be in good condition, it is not always true. It is also possible that
a component has been mis-labeled and may have the wrong value (usually this mis-labeling is a
mistake made at the point of distribution or warehousing and not at the manufacturer, but again,
not always!).
114 CHAPTER 8. TROUBLESHOOTING – THEORY AND PRACTICE
Not periodically checking your test equipment. This is especially true with battery-
powered meters, as weak batteries may give spurious readings. When using meters to safety-check
for dangerous voltage, remember to test the meter on a known source of voltage both before and
after checking the circuit to be serviced, to make sure the meter is in proper operating condition.
Assuming there is only one failure to account for the problem. Single-failure system
problems are ideal for troubleshooting, but sometimes failures come in multiple numbers. In some
instances, the failure of one component may lead to a system condition that damages other compo-
nents. Sometimes a component in marginal condition goes undetected for a long time, then when
another component fails the system suffers from problems with both components.
Mistaking coincidence for causality. Just because two events occurred at nearly the same
time does not necessarily mean one event caused the other! They may be both consequences of a
common cause, or they may be totally unrelated! If possible, try to duplicate the same condition
suspected to be the cause and see if the event suspected to be the coincidence happens again. If not,
then there is either no causal relationship as assumed. This may mean there is no causal relationship
between the two events whatsoever, or that there is a causal relationship, but just not the one you
expected.
Self-induced blindness. After a long effort at troubleshooting a difficult problem, you may
become tired and begin to overlook crucial clues to the problem. Take a break and let someone
else look at it for a while. You will be amazed at what a difference this can make. On the other
hand, it is generally a bad idea to solicit help at the start of the troubleshooting process. Effective
troubleshooting involves complex, multi-level thinking, which is not easily communicated with others.
More often than not, ”team troubleshooting” takes more time and causes more frustration than doing
it yourself. An exception to this rule is when the knowledge of the troubleshooters is complementary:
for example, a technician who knows electronics but not machine operation, teamed with an operator
who knows machine function but not electronics.
Failing to question the troubleshooting work of others on the same job. This may
sound rather cynical and misanthropic, but it is sound scientific practice. Because it is easy to
overlook important details, troubleshooting data received from another troubleshooter should be
personally verified before proceeding. This is a common situation when troubleshooters ”change
shifts” and a technician takes over for another technician who is leaving before the job is done. It
is important to exchange information, but do not assume the prior technician checked everything
they said they did, or checked it perfectly. I’ve been hindered in my troubleshooting efforts on many
occasions by failing to verify what someone else told me they checked.
Being pressured to ”hurry up.” When an important system fails, there will be pressure
from other people to fix the problem as quickly as possible. As they say in business, ”time is
money.” Having been on the receiving end of this pressure many times, I can understand the need
for expedience. However, in many cases there is a higher priority: caution. If the system in question
harbors great danger to life and limb, the pressure to ”hurry up” may result in injury or death.
At the very least, hasty repairs may result in further damage when the system is restarted. Most
failures can be recovered or at least temporarily repaired in short time if approached intelligently.
Improper ”fixes” resulting in haste often lead to damage that cannot be recovered in short time, if
8.8. CONTRIBUTORS 115
ever. If the potential for greater harm is present, the troubleshooter needs to politely address the
pressure received from others, and maintain their perspective in the midst of chaos. Interpersonal
skills are just as important in this realm as technical ability!
Finger-pointing. It is all too easy to blame a problem on someone else, for reasons of ignorance,
pride, laziness, or some other unfortunate facet of human nature. When the responsibility for system
maintenance is divided into departments or work crews, troubleshooting efforts are often hindered
by blame cast between groups. ”It’s a mechanical problem . . . it’s an electrical problem . . . it’s
an instrument problem . . .” ad infinitum, ad nauseum, is all too common in the workplace. I have
found that a positive attitude does more to quench the fires of blame than anything else.
On one particular job, I was summoned to fix a problem in a hydraulic system assumed to be
related to the electronic metering and controls. My troubleshooting isolated the source of trouble to
a faulty control valve, which was the domain of the millwright (mechanical) crew. I knew that the
millwright on shift was a contentious person, so I expected trouble if I simply passed the problem on
to his department. Instead, I politely explained to him and his supervisor the nature of the problem
as well as a brief synopsis of my reasoning, then proceeded to help him replace the faulty valve, even
though it wasn’t ”my” responsibility to do so. As a result, the problem was fixed very quickly, and
I gained the respect of the millwright.
8.8 Contributors
Contributors to this chapter are listed in chronological order of their contributions, from most recent
to first. See Appendix 2 (Contributor List) for dates and contact information.
Alejandro Gamero Divasto (January 2002): contributed troubleshooting tips regarding po-
tential hazards of swapping two similar components, avoiding pressure placed on the troubleshooter,
perils of ”team” troubleshooting, wisdom of recording system history, operator error as a cause of
failure, and the perils of finger-pointing.
116 CHAPTER 8. TROUBLESHOOTING – THEORY AND PRACTICE
Chapter 9
CIRCUIT SCHEMATIC
SYMBOLS
Older convention
Newer convention
Older electrical schematics showed connecting wires crossing, while non-connecting wires ”jumped”
over each other with little half-circle marks. Newer electrical schematics show connecting wires join-
ing with a dot, while non-connecting wires cross with no dot. However, some people still use the
older convention of connecting wires crossing with no dot, which may create confusion.
For this reason, I opt to use a hybrid convention, with connecting wires unambiguously connected
by a dot, and non-connecting wires unambiguously ”jumping” over one another with a half-circle
117
118 CHAPTER 9. CIRCUIT SCHEMATIC SYMBOLS
mark. While this may be frowned upon by some, it leaves no room for interpretational error: in
each case, the intent is clear and unmistakable:
Variable
DC voltage DC current
A diagonal arrow +
represents variability
for any component! -
Generator AC current
Gen
9.3. RESISTORS 119
9.3 Resistors
Fixed-value Rheostat
to
Photoresistor
9.4 Capacitors
Variable
120 CHAPTER 9. CIRCUIT SCHEMATIC SYMBOLS
9.5 Inductors
Step-up/step-down
Transformer transformer Variac
Saturable
Transformer Transformer Transformer reactor
Synchro
Synchro
9.7. SWITCHES, HAND ACTUATED 121
Electronic R
Limit Limit Speed
F
It is very important to keep in mind that the ”normal” contact status of a process-actuated
switch refers to its status when the process is absent and/or inactive, not ”normal” in the sense of
process conditions as expected during routine operation. For instance, a normally-closed low-flow
detection switch installed on a coolant pipe will be maintained in the actuated state (open) when
there is regular coolant flow through the pipe. If the coolant flow stops, the flow switch will go to
its ”normal” (unactuated) status of closed.
A limit switch is one actuated by contact with a moving machine part. An electronic limit switch
senses mechanical motion, but does so using light, magnetic fields, or other non-contact means.
9.9. SWITCHES, ELECTRICALLY ACTUATED (RELAYS) 123
9.10 Connectors
Plug
(male)
124 CHAPTER 9. CIRCUIT SCHEMATIC SYMBOLS
9.11 Diodes
A = Anode
K = Cathode
C
H1 H2
9.12. TRANSISTORS, BIPOLAR 125
. . . with case
Bipolar NPN Bipolar PNP
B B
E C E C
Photo-
Dual-emitter NPN Dual-emitter PNP
B B
E C E1 C E1 C
E2 E2
C C
E E
S D S D
S = Source
G = Gate
D = Drain
126 CHAPTER 9. CIRCUIT SCHEMATIC SYMBOLS
S D S D S D S D
SS SS SS SS
S D S D S D S D
G = Gate
D = Drain
SS = Substrate
. . . with case
IGBT (NPN) IGBT (PNP)
G G
E C E C
. . . with case
IGBT (N-channel) IGBT (P-channel)
G G
E C E C
E = Emitter
G = Gate
C = Collector
9.16. THYRISTORS 127
9.16 Thyristors
G G
G G GK G
+ + +
Negative-AND Negative-OR
Buffer gate gate
S Q S Q S Q
E C
R Q R Q R Q
D Q D Q J Q
E C C
Q Q K Q
130 CHAPTER 9. CIRCUIT SCHEMATIC SYMBOLS
C C A
H1 H2
S
G S
G G
C C C
H1 H2 H1 H2 H1 H2
Sup
S S G
G G
C C C
H1 H2 H1 H2 H1 H2
I H V
P = Plate S = Screen
G = Grid A = Anode
C = Cathode H = Heater
I = Ignitor Sup = Suppressor
Chapter 10
131
10.1
132
H 1 He 2
Hydrogen
1.00794
Periodic Table of the Elements Helium
4.00260
Metalloids Nonmetals
1s1 1s2
Li 3 Be 4 Symbol K 19 Atomic number B 5 C 6 N 7 O 8 F 9 Ne 10
La 57 Ce 58 Pr 59 Nd 60 Pm 61 Sm 62 Eu 63 Gd 64 Tb 65 Dy 66 Ho 67 Er 68 Tm 69 Yb 70 Lu 71
Lanthanide Lanthanum Cerium Praseodymium Neodymium Promethium Samarium Europium Gadolinium Terbium Dysprosium Holmium Erbium Thulium Ytterbium Lutetium
series 138.9055 140.115 140.90765 144.24 (145) 150.36 151.965 157.25 158.92534 162.50 164.93032 167.26 168.93421 173.04 174.967
5d16s2 4f15d16s2 4f36s2 4f46s2 4f56s2 4f66s2 4f76s2 4f75d16s2 4f96s2 4f106s2 4f116s2 4f126s2 4f136s2 4f146s2 4f145d16s2
147
148 INDEX
SPICE performs Fourier analysis by evaluating the waveform in the frequency domain, requiring a .print or .plot card to correctly output the waveform. Important considerations include providing finite rise and fall times for square waveforms to avoid skewed results due to SPICE incorrectly calculating even harmonics for ideal square waves. Properly configuring the transient analysis with longer cycle durations can enhance output precision .
Listing voltages at non-zero nodes is crucial during SPICE DC analysis because it provides insight into the voltage levels within the circuit concerning the reference point, node 0. Node 0 serves as the ground reference, with all voltages measured relative to this point, allowing for a standardized baseline to compare voltages at different nodes. This helps ensure that the circuit behaves as expected, with voltages indicating the operational status of components and the integrity of voltage sources .
The command-line interface of SPICE is beneficial because it supports plain-text input and output, providing universal accessibility and ease of editing, even on systems where SPICE itself isn't installed. It also allows for interactive mode, interpreting commands as input rather than relying solely on predetermined files. This contrasts with a graphical user interface, which might offer more intuitive interaction but lacks the straightforward flexibility and detailed control command-line users might prefer .
Common pitfalls in troubleshooting include mistaking coincidence for causality, failing to verify the work of others, and succumbing to pressure to rush repairs. Fallacious reasoning, such as assuming causality based on temporal coincidence, can mislead solutions. Interpersonally, failing to question others' findings or ineffectively managing pressure can lead to overlooking errors, prolonged troubleshooting, or even causing harm. Effective troubleshooting requires both technical acumen and interpersonal skills to address these challenges .
SPICE has limitations when analyzing circuits with open circuits or uninterrupted loops of inductors or voltage sources due to its method of handling DC analysis. Open circuits create infinite resistance, while uninterrupted inductor loops are treated as shorts with zero resistance, leading to mathematical infinities that computers cannot process. This results in SPICE being unable to complete the analysis, necessitating modifications such as adding resistors to eliminate these conditions .
SPICE's plain-text format allows for easy editing and customization of input and output files, supporting troubleshooting by enabling users to strip unnecessary information for clarity. This text format aids users familiar with command-line operations by allowing direct manipulation of netlists and seamless integration with version control systems. Despite initial verbosity, it facilitates detailed examination and annotation, which is advantageous for users aiming for precision and clarity in circuit simulations .
Inaccuracies in transient analysis can skew Fourier analysis results in SPICE, as undersampling of the fundamental frequency cycle diminishes precision. Ensuring the analysis covers more cycles improves accuracy. Using the .options card in SPICE to refine analysis settings, or modulating the transient card for longer periods, can address this issue, leading to more reliable Fourier analysis results .
SPICE struggles with perfect square waves in Fourier analysis because it inaccurately calculates even harmonics when the rise and fall times are zero. To correct this, introducing finite rise and fall times into the waveform definition mitigates this issue, thus aligning SPICE's results closer to expected real-world outcomes where waveform transitions are not instantaneous .
Operator error is a frequent cause of system failure and often goes unacknowledged until after an investigation. It highlights the need for adequate training and clear communication. Mitigation measures include thorough training, fostering a positive learning environment where operators can contribute insights into system functionality, and procedural rigor to minimize error opportunities. Recognizing the human element in operations can convert potential failures into learning opportunities, enhancing system reliability .
To capture intermittent problems, using a datalogger or multimeter set on 'record' mode is recommended. This strategy is effective as it allows for continuous monitoring and recording of data over time, identifying deviations corresponding to the root cause. This persistent data collection captures anomalies not evident in momentary observation, providing a comprehensive view needed to diagnose intermittent faults .