MicroSim Application Notes PDF
MicroSim Application Notes PDF
MicroSim Corporation
20 Fairbanks
Irvine, California 92618
(714) 770-3022
Version 8.0, June, 1997.
TradeMarks
Referenced herein are the trademarks used by MicroSim Corporation to identify its products. MicroSim
Corporation is the exclusive owners of “MicroSim,” “PSpice,” “PLogic,” “PLSyn.”
Additional marks of MicroSim include: “StmEd,” “Stimulus Editor,” “Probe,” “Parts,” “Monte Carlo,” “Analog
Behavioral Modeling,” “Device Equations,” “Digital Simulation,” “Digital Files,” “Filter Designer,” “Schematics,”
“PLogic,” ”PCBoards,” “PSpice Optimizer,” and “PLSyn” and variations theron (collectively the “Trademarks”)
are used in connection with computer programs. MicroSim owns various trademark registrations for these marks in
the United States and other countries.
Microsoft, MS-DOS, Windows, Windows NT and the Windows logo are either registered trademarks or trademarks
of Microsoft Corporation.
Adobe, the Adobe logo, Acrobat, the Acrobat logo, Exchange and PostScript are trademarks of Adobe Systems
Incorporated or its subsidiaries and may be registered in certain jurisdictions.
All other company/product names are trademarks/registered trademarks of their respective holders.
Copyright Notice
Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced
or distributed in any form or by any means, or stored in a data base or retrieval system, without the prior written
permission of MicroSim Corporation.
As described in the license agreement, you are permitted to run one copy of the MicroSim software on one
computer at a time. Unauthorized duplication of the software or documentation is prohibited by law. Corporate
Program Licensing and multiple copy discounts are available.
Technical Support
Internet Tech.Support@microsim.com
Customer Service
Internet Sales@MicroSim.com
Phone (714) 770-3022
Contents
Preface
Analog Behavioral Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Analog Behavioral Modeling Using PSpice . . . . . . . . . . . . . . . . . . . . 8
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Extending Simulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
SPICE Polynomial Controlled Sources . . . . . . . . . . . . . . . . . . . . 9
Code Modification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Macro Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Functional Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Time domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Frequency domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Device Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Modeling Tunnel Diode . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Parameterization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
System Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Behavioral Modeling as Abstraction . . . . . . . . . . . . . . . . . . . 14
Modeling a Phase-Locked Loop . . . . . . . . . . . . . . . . . . . . . 15
Future Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Modeling state behavior . . . . . . . . . . . . . . . . . . . . . . . . . 17
Managing Convergence and Time-Step Control . . . . . . . . . . . . . . . 19
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Analyzing Amplifier’s Settling Time . . . . . . . . . . . . . . . . . . . . . . . 23
Analyzing Ground Bounce in High Speed Designs . . . . . . . . . . . . . . . . 28
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
What Is Ground Bounce? . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Example Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Creating Package Models and Symbols . . . . . . . . . . . . . . . . . . . . 31
Simulating the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
ii Contents
Analog Behavioral
Modeling
MicroSim Corporation Newsletter, October 1989
Let’s take a look at examples of how the Analog Behavioral
Modeling feature of PSpice can cope when generic SPICE fails.
First, let’s say you need to create a signal whose voltage is the
square root of another signal’s voltage. Calculating square roots
is simple, even for SPICE, through the use of a feedback circuit.
However, this technique fails if the reference signal ever goes
negative. In this case the functional form of Analog Behavioral
Modeling works nicely:
Esqrt out_hi out_lo value={sqrt(abs(v(input)))}
This takes the absolute value of the ground-referenced signal
“input” before evaluating the square-root function (you could
also use a floating signal-pair by replacing v(input) with
v(in_hi)-v(in_lo) or v(in_hi,in_lo), for example). The absolute-
value function is a nonlinear function difficult to perform in
generic SPICE.
We can also introduce ideal nonlinearities using the table lookup
form of Analog Behavioral Modeling. For example, the one-
line, ideal opamp model:
Eamp out 0 table {200K*(v(in_hi)-v(in_lo))}=
+ (-15,-15) (15,15)
has high gain, but its output is clamped between ±15 volts. The
input to the table is the differential gain formula, but the lookup
table has only two entries: so the output of the table is
interpolated between these two endpoints and clamped when the
input exceeds the table’s range. This is a convenient use of the
table lookup form, which is not available in generic SPICE.
Small systems of behavioral models are easy to design, also. For
example, a true-RMS circuit can be built by decomposing the
RMS function: (i) square the signal, (ii) integrate over time, and
(iii) take the square-root of the time average. These three
operations can be bundled in a tiny subcircuit for use as a
module:
4
.param H=1
*
V1 in 0 SIN (0 1 1)
Xrms 1 rms RMSXhys 1 hys HYS
param: H=1
*
.tran 10m 1
.end
A 1 Hz sine wave was used for the stimulus to the RMS and
HYS circuits.
Analog Behavioral Modeling 7
Code Modification
Any simulator can be extended to include new types of device
by writing code similar to that already in place for the basic
SPICE set. A few vendors provide a mechanism for users to do
this. Languages are typically Fortran or C.
There are significant problems with this approach. The
environment in which SPICE device code operates is far from
simple. Expert programming skills are required both to ensure
that the additional code operates as expected and that the
simulator continues to operate correctly. Additionally, detailed
understanding of the SPICE implementation is required. This is
likely to be a feasible approach only in academic environments
or device foundries.
10
Macro Models
A device can be modeled by constructing a macro model using
existing primitives. This approach works well for composite
devices such as optocouplers. There is typically a one-to- one
correspondence between components of the composite device
and those of the macro model, although some functions may be
abstracted using controlled voltage or current sources.
The approach does not work so well when the device
characteristics are given in equation form or as a set of measured
values. In these cases it may be necessary to resort to techniques
such as synthesizing a log function by converting voltage to
current, passing this through an ideal diode and sensing the
voltage across the diode. Macro models built using these
techniques soon become complex, difficult to maintain, and can
be slow and inaccurate.
Functional Approach
The capabilities of a simulator can be extended by including the
ability to evaluate expressions which are functions of circuit
variables (voltages, currents, simulation time). The
microgrammar that defines the language may include constructs
such as assignment and explicit control statements
(“procedural”); or it may exclude these (“nonprocedural”).
The functional approach works well when device characteristics
are known in equation form, and the device is state-free. It is not
so useful when only a physical model of device behavior is
available or when the device has several internal states.
Analog Behavioral Modeling Using PSpice 11
Time domain
• arbitrary expressions, can include constants, parameters,
node voltages & currents, TIME, math functions including
log, exp, and trig
E1 1 0 VALUE {sin(twopi * fc * TIME)}
• table lookups; value of a controlling expression is linearly
interpolated in a table
E2 2 0 TABLE {1.0 + v(4)} (0 0)
+ (0.1 0.2) (0.2 0.25)
Frequency domain
• Laplace expressions, including constants, parameters, and
math functions in S including log, exp, and trig
E3 3 0 LAPLACE {v(5)+v(6)} {1/(1 + t1*S)}
• table lookups; magnitude and phase are linearly interpolated
in a table
E4 4 0 FREQ {v(7)} (0 0 0)
+ (5k 0 -5760) (6k -60 -6912)
12
Device Modeling
Modeling Tunnel Diode
The tunnel diode has frequently been used as an example of
SPICE device modeling using polynomials. The static current/
voltage characteristic of the device contains a region of negative
dynamic resistance. The transitions from positive to negative
resistance and back again are smooth - there are no
discontinuities in slope and the device does not exhibit
hysteresis. The device is only operated in the vicinity of the
negative resistance region; typically a span of one or two volts.
These attributes make the device eminently suitable for
polynomial representation (it is no coincidence that this device
has been used for illustration so often in the past).
Main characteristics of a tunnel diode current/voltage curve are
peak voltage and current (Vp, Ip), valley voltage and current
(Vv, Iv) and projected peak voltage (Vpp). Specific device
parameters for this example:
Vp = 50mv; Ip = 4.2ma; Vv = 370mv;
+ Iv = 370ua; Vpp = 525mv
Parameterization
Consider modeling devices with parameters different from the
example set used above, for example to produce a library of
devices for general use. The polynomial approach would require
a set of coefficients for each distinct device. This becomes
impractical for anything more than a handful of devices. It may
be possible to define a “generic” tunnel diode device and map
14
usage:
X1 4 5 TD PARAMS: Vp=55mv ;
+ override 50mv default
For more difficult devices, where straightforward equations may
not be available, or where the relationship between the
parameters in the equations and data sheet values for the device
is not obvious, a lookup table approach may be used. Where
possible, a normalized device characteristic can be modeled by
the table, with parameterized expressions used to transform
inputs and outputs.
System Modeling
Behavioral Modeling as Abstraction
In the early stages of system design, the emphasis is on high-
level issues rather than on low-level details. Behavioral models
allow systems to be simulated with reduced complexity and with
improved computational efficiency.
Analog Behavioral Modeling Using PSpice 15
in
Phase
Detector
out
Loop
Filter
VCO
Compared with the Circuit model, it took about 20% of the time
to develop the Behavioral model, and the transient analysis ran
in about 4% of the time.
The time required to run the analysis is significant. The
Behavioral model allows many more analyses to be run in a
given time, permitting a higher degree of design refinement and/
or test.
* lines 9 43
Future Challenges
Modeling state behavior
Many real devices exhibit two or more stable states. Transitions
between these states occur under well-defined circumstances.
For example, consider a spark gap. This has two persistent
states. An arc may be present, in which case the device is in its
ON (low resistance) state. Or there may be no arc, in which case
the device is in its OFF state. A combination of applied voltage
and dV/dt causes the device to transition from its OFF to its ON
state, via a transitory “arc forming” phase. If the arc current falls
below a holding value, the device turns OFF, via an “arc
extinguishing” phase.
The question arises, how to model this kind of device with
SPICE-based simulators. Macro models are difficult to
construct. Representing the state variable requires some
component with memory. Possibilities include hysteresis blocks
and digital primitives (if a mixed-mode simulator is available).
Neither of these offers an easy or elegant solution.
18
if(STATE == 1) {
Iout = Vin / (RON + (ROFF-RON)* (1 -
+ (time - Tarc)/TON))
}
The second line gives the State 1 behavior of the device. The
third line gives a transition (0->1) and a condition to be met for
this transition to occur.
Note that although the substance of the two descriptions is the
same, the nonprocedural form hides most of the housekeeping
operations (such as assigning a new value to the state variable).
This is clearly a desirable state of affairs.
Analog Behavioral Modeling Using PSpice 19
Summary
Analog Behavioral Modeling has two immediate, highly
practical uses:
• It can be used to extend the capability of an existing
simulator to model new devices and sources, without
modifying the simulator’s source code.
• It can also be used to design systems at an abstract level,
ensuring that the concepts are correct, before proceeding
with the detailed circuit-level design.
SPICE’s syntax is nonprocedural. This approach has proven to
be convenient and powerful. Presenting Analog Behavioral
Modeling as functional or state-machine forms fits in naturally
with existing SPICE usage and is to be preferred over
procedural, programmatic, extensions.
Acknowledgments
The author would like to thank his colleagues at MicroSim for
their helpful suggestions and creative ideas.
References
[1] PSpice User’s Guide, Appendix B. (See Note below)
[2] S. M. Sze, Physics of Semiconductor Devices, Wiley &
Sons, 1981, ch. 9, p529.
Analog Behavioral Modeling Using PSpice 21
Analyzing Amplifier’s
Settling Time
The Design Center Source newsletter, originally titled
“Using Performance Analysis to Analyze Your Amplifier’s
Settling Time”
Settling time is a key performance parameter for an amplifier.
The standard simulation methodology to test for this parameter
steps the input voltage over the relevant input range and
measures the time taken for the output to settle to some defined
value close to its steady state value. The defined value depends
upon the resolution of the system. For example, a 12 bit system
in a range of ten volts will probably need to settle to within 1.2
mV (1/2 lsb) of its final value.
During the design of such an amplifier, many parameters are
varied to optimize the settling time. It can become extremely
tedious moving along the response curves to find the exact
settling time. Performance Analysis (available in Probe version
5.0 and later) by means of “goal function” definition, can
facilitate this investigation. To demonstrate the implementation
of the relevant goal functions, the settling time of an LF411 in
unity gain configuration will be computed as a function of load
capacitance. The circuit file for the demonstration is shown
below.
settle(1) = x1
{
1|
search backward /End/ level(1.01) !1
;
}
Using this goal function, we can now examine the settling time
versus load capacitance. The curve in Figure 9 shows the trend,
but several inconsistent discontinuities are noticeable. To
appreciate where the discontinuities come from, we must first
visualize the oscillation which intersects the defined level. With
increasing load, this oscillation will increase in amplitude as will
the cycle after it. At some point, however, the succeeding cycle
will grow enough to intersect the defined level, giving a jump of
half the oscillation period.
To offset this effect, we first detect the peaks of the cycles in the
neighborhood of the defined value. We can then fit a polynomial
to these points and use this to predict the settling time. The goal
functions to implement this are shown below as S1, S2, and S3,
which are three components of the Lagrangian polynomial. In
the example shown, the Lagrangian components are evaluated at
a defined level of 1.01, which, when added together, will
produce the settling time curve to 10 mV.
s1(1) =(1.01-y2)*(1.01-y3)*x1/((y1-y2)*(y1-y3))
{
1|
search backward /end/ LEVEL(1.01)
search forward peak !1
search backward peak !2
search backward peak !3
;
}
s2(1) =(1.01-y1)*(1.01-y3)*x2/((y2-y1)*(y2-y3))
{
1|
search backward /end/ LEVEL(1.01)
search forward peak !1
search backward peak !2
search backward peak !3
;
}
s3(1) =(1.01-y1)*(1.01-y2)*x3/((y3-y1)*(y3-y2))
{
1|
search backward /end/ LEVEL(1.01)
search forward peak !1
search backward peak !2
search backward peak !3
;
}
Analyzing Ground
Bounce in High Speed
Designs
The Design Center Source newsletter, January 1994
Introduction
Advances in device technology are progressing at such a rate
that the functionality of integrated circuits (ICs) doubles every
year. As the functional blocks that comprise digital systems
become more complex, so do the printed circuit boards (PCBs)
that make up the systems. The evolution of device technology
has yielded devices with clock rates in the 50 to 100 MHz range
and rise/fall times on the order of 1 to 2 nsec. At these speeds,
digital designers can no longer assume that a design is immune
to parasitic effects. Transmission line effects and package
interconnect parasitics must be taken into account to insure
reliable operation. This article examines how package parasitics
can affect high speed designs. In particular, we will illustrate
how Polaris and PSpice can be used to simulate parasitics and
how existing digital library device models can be modified to
model package parasitics that can predict ground bounce.
input(s) being driven in order for the input to change state. The
output driver therefore becomes a current sink, channeling the
current to the chip ground. The amount of current channeled
through the driver obeys the relation i = C dv/dt. Inside the chip,
the bonding wires that connect the output driver on the chip die
to the package pin are inductively coupled to the chip ground.
As the current is channeled to the chip ground, a voltage is
induced on the chip ground that follows the relationship v = L
di/dt. Therefore, if the rise/fall times are short, the output driver
will be forced to sink a large amount of current in a short time.
This will induce an equally large voltage on the chip ground
causing the ground voltage to bounce. Since the output drivers
use the chip ground as the reference for a logic low, any outputs
that are low at the time will also experience the bounce; the
inputs will be similarly affected. The amount of ground bounce
experienced follows the relation
Example Circuit
Figure 11 shows a schematic diagram of the circuit that we will
use to demonstrate ground bounce analysis. This circuit uses
components from the FAST logic family. In the example circuit,
the device of interest is the 74F543 octal bus transceiver which
is associated with the F543R symbol. The 74F543 output drivers
are capable of sinking large amounts of current (24 mA for the
A-side drivers and 64 mA for the B-side drivers). Switching
large currents is one cause of ground bounce as will be
demonstrated by the simulation.
.ENDS F543R
Summary
Problems in high speed digital circuits due to parasitic effects
are a fact of life for designers. Those digital designers who were
able to enjoy the luxury of being able to ignore parasitic effects
in the past will now have to contend with problems associated
with the analog behavior of digital components as clock speeds
and rise times get ever faster. Through the use of a simple circuit
with relatively conservative timing, we have shown that ground
bounce can present problems for designers. The example used in
this article has a small data bus (8 bits). As next-generation
systems incorporate more and more functionality, data buses are
getting wider as clock speeds increase. Since ground bounce is
a function of the number of simultaneously switching lines, the
problems faced by designers will continue to get worse.
Polaris and PSpice allow you to accurately simulate the
behavior of circuit designs with consideration for parasitics due
to interconnect—Polaris extracts the parasitics and PSpice
simulates circuit behavior with parasitic values fully merged
into the circuit design. In addition, the Model Library is fully
user-accessible allowing custom models exhibiting new
behaviors to be easily derived from existing library models, and
subsequently used in simulations. Thus, compromises to
operational reliability can be detected and corrected before the
board is built, thereby reducing the overall cost of high-speed
digital designs.
Brushless DC Motor Model 39
Brushless DC Motor
Model
Although PSpice is designed as an electronic circuit simulator,
some of our customers use it to simulate mechanical or
electromechanical systems. Analog Behavioral Modeling
makes simulating mechanical systems much simpler. An
interesting example of an electromechanical system which can
benefit from PSpice simulation is a brushless DC motor.
Brushless DC motors are used in computer disk drives and other
applications where precise control of motor operation is
required.
A brushless DC motor is built like a stepping motor. It has a
permanent magnet rotor attached to the motor shaft, and several
electromagnets arranged around the stator. Each of these
electromagnet windings must be driven in sequence to make the
motor shaft turn, a process called commutation. Commutation
must be synchronized with the motor shaft angle to make the
motor turn at the desired speed and direction. Implementing a
commutation strategy and motor control system usually requires
both analog and digital circuit elements. Because the motor is
part of this closed loop control system, it is important to have an
accurate model of its electrical and mechanical behavior.
The equations which we will use to describe the motor’s
behavior come from the book Brushless Motor System Design
and Analysis by Professor Charles K. Taft, Dr. R. G. Gauthier,
S. R. Huard, and Dr. T. J. Harned. It covers brushless motor
operation and commutation strategies in much more detail than
this article, and is highly recommended if you have further
questions. The book may be obtained by contacting Professor
Taft at the Mechanical Engineering Department, University of
New Hampshire, Kingsburg Hall, Durham, New Hampshire
03824. The book costs $100, including postage. The same
author also has Stepping Motor System Design and Analysis
available for $105.
The first step in modeling the motor is to develop an electrical
equivalent to the mechanical system. The basic equation which
describes the mechanical system is:
40
d2θ
T total = J --------2- (1)
dt
where
Ttotal is total torque (including friction) applied to the motor shaft
from all sources (g·cm),
1 dθ
S = ------ ------
2π dt
(3)
where
S is the shaft speed (rev/sec).
Noting that the circuit equation for a capacitor is:
dv
I = C ------
dt
(4)
We can implement equation (2) by modeling torque as a current
and the moment of inertia, 2πJ, as a capacitor. This will give the
shaft speed as the voltage across the capacitor. This is
convenient because we can model any additional mechanical
system moment of inertia as an additional capacitor in parallel
with the first one. Also, we can add various torque and drag
forces as parallel current sources. This makes the model easier
to use in a system.
We can use equation (4) again on equation (3) to give the shaft
angle as the voltage across a capacitor which has a current equal
Brushless DC Motor Model 41
.ends
T detent = D ⋅ sin ( N d ⋅ A ⋅ θ )
(7)
where
D is the magnetic detent torque (g·cm)
.ends
Keeping in mind that the sine terms of equations (8) and (9) are
the same, and adding the other four electrical properties of the
motor windings, we come up with the following model for the
motor:
* The motor with both ends of each coil available.
*
* Phase 3 coil ----------------+---+
* Phase 2 coil --------+---+ | |
* Phase 1 coil +---+ | | | |
* | | | | | |
.subckt bldcmtr p1a p1b p2a p2b p3a p3b shaft_speed shaft_angle
+ params:
+ J= .30 ; moment of inertia of rotor (g*cm*sec*sec)
+ B= .36 ; Damping and eddy current losses
* (linear torque with speed) (g*cm*sec/rad)
+ F= .72 ; Friction/drag losses (constant torque losses)
* (g*cm)
+ D= 2.9 ; Magnetic detent torque (g*cm)
+ A= 2 ; Number of north poles on the rotor
+ P= 3 ; Number of phases (if you change this you need
* to add more windings to the motor subckt.)
+ CL=3mh ; winding inductance (Henrys)
+ CR=6ohm ; winding resistance (Ohms)
+ CC=.001uf ; winding capacitance to ground (Farads)
+ CM=.5 ; adjacent winding mutual coupling factor
+ Cb=.12 ; Back EMF constant (Volt*sec/rev)
+ Ct=300 ; Torque constant (g*cm/amp)
+ twopi = {2 * 3.141596}
*
* The motor winding
*
* This models the electrical properties of the windings,
* and creates the torque "current" which is delivered to
* the mechanical model.
* Mutual inductance is modeled in the motor subcircuit,
* so the inductance must be there also. The inductance
* must be in series with this model.
.subckt motor_winding winding1 winding2 shaft_speed shaft_angle
+ params: N=1 A=2 P=3 CL=3mh CR=6ohm CC=.001uf CM=.5 Cb=.12 Ct=300
+ twopi={2*3.141596}
.ends
46
250A
Phase 2 Torque Coast
Brake
Power On
-150A
I(X1.X2.Gtorque)
4.0V
Phase 2 Back EMF Voltage
-4.0V
V1(X1.X2.Ebackemf)-V2(X1.X2.Ebackemf)
30
Shaft Speed
Shaft Angle
-5
0s 0.5s 1.0s 1.5s 2.0s
V(Shaft_speed) Norm_Angle(V(shaft_Angle))
Time
Introduction
With the great increase in computer speeds, a variety of systems
can be simulated effectively and quickly with using time-
domain random noise inputs. The brute-force method for
creating a random noise input requires writing a small program
to generate a set of random numbers, which can then be
incorporated into a piecewise linear (PWL) source. This
technique may require a considerable amount of time just to
generate a single noise source.
The program described in this article, Pwlnoise.bas, provides a
straightforward means for generating PWL noise sources in
seconds rather than hours.
Create Analog Random Noise Generators for PSpice Simulation 51
A typical path might be: Note especially line 20 of the program. In it you define the path
"c:\microsim\"
for your working directory. When completing this line, put the
path in quotations marks, and don’t forget the final backslash.
When you’re ready to run the program, open the File menu in the
Windows Program Manager, and choose Run. Enter this line:
[path]\gwbasic [path]\pwlnoise
The program will ask you to enter three values:
• TIME STEP in seconds: the time value to be used between
steps in the PWL source. This parameter partially controls
Note Be sure to make a the bandwidth and slew rate of the source. For example, if
note of the FINAL TIME value the time step is decreased, the random noise values change
that you enter. You will need it more rapidly with time, thereby increasing the bandwidth of
later. the resulting noise, and increasing its slew rate.
• FINAL TIME in seconds: the time at which the random
noise generator is to be stopped. Increasing this number
increases the number of steps that are included in the PWL
noise source.
• RMS NOISE in volts(RMS): the RMS value of the noise
voltage to be simulated. This parameter also affects the slew
rate and bandwidth of the resulting noise generator. If the
RMS value is increased for a given time step, the slew rate
Since each prompts names the increases thereby increasing the signal’s bandwidth.
unit involved (seconds for the Once you’ve entered these values, the program will display four
first two and VRMS for the third), computed results:
enter numbers only (without
units). • Points: the number of points that will be included in the
PWL noise source.
For example,
0.0024 is okay, as is 2.4E-3, • Bandwidth: the 3-dB bandwidth of the first spectral lobe
but not 2.4msec or 2.4mV. noise.
• Maximum Slew Rate: the approximate maximum slew rate
that the signal can achieve from one time step to another.
• CFIL: the computed value of the filter capacitor.
Note Be sure to make a When all the necessary computations have been made, the
note of the value displayed for program will remind you to make a note of parameters FINAL
CFIL. You will need it later. TIME, RMS and CFIL, which you will need later.
For details of program operation, see the sidebar.
Create Analog Random Noise Generators for PSpice Simulation 55
Create S-Parameter
Subcircuits for
Microwave and RF
Applications
by John S. Gerig Wideband Associates
The article “Obtain S-Parameter Data from Probe” (April 1994
issue of The Design Center Source), described useful subcircuits
which permit both the transmission (S21 and S12) and the
reflection (S11 and S22) parameters of a given circuit to be
calculated and displayed using Probe. In microwave and RF
design work, a PSpice subcircuit whose S-parameters are
defined as tables is also useful; the data corresponds to that
provided by many manufacturers for microwave transistors and
other microwave devices. [See, for instance, the Hewlett-
Packard Communications Components Designer’s Catalog.]
S-Parameter Subcircuit
The S2P2LIB1Conversion
Program
It is much easier to convert the manufacturer’s
S-parameter data to PSpice-compatible form using a program
that can interpret S2P files. Figure 22 shows the logic to do so;
this program—S2P2LIB1—is written in QuickBasic.
Create S-Parameter Subcircuits for Microwave and RF Applications 61
Schematic Setup:
Editor’s Note: To benefit users running the Design Center
with Schematics, MicroSim added this section to the
author’s original manuscript.)
1 Within the Symbol Editor, create a 10236N symbol similar
to that shown in Figure 25. This symbol will represent the
circuitry shown within the dashed lines of Figure 25.
Create S-Parameter Subcircuits for Microwave and RF Applications 65
Transient Analysis
Considerations
Data for an S-parameter model is usually measured in the
frequency domain, and normally represents only the linear or
small-signal behavior of the device under specified DC
operating conditions. Effects in a nonlinear transistor or diode
are not modeled. The frequency-response table option in Analog
Behavioral Modeling allows transient analysis, but the cautions
discussed in the PSpice user’s guide should be reviewed.
Create Schematic
Symbols for New Vendor
Models
The Design Center Source newsletter, October 1994
If you are a Schematics user, you might find it necessary to
create new symbols to augment those that are available in the
standard Model and Symbol Libraries supplied by MicroSim.
For instance, you may wish to use a new vendor model, and need
a corresponding symbol to represent the part in your schematic.
This application note explains the steps required to add and
configure new vendor model definitions, and to create
corresponding base and AKO symbols for parts when you
already have an existing Model Library file with other
definitions from the same vendor.
Overview
For every new device that you want to add to the Design Center,
you will need to add two and sometimes three distinct items.
These are: a model or subcircuit definition, a symbol, and a
package definition. The model and symbol are required in all
cases, but the package is required only if you will be packaging
your design to go to a PCB layout program.
Model Library
All of the .MODEL and .SUBCKT statements are kept in Model
Library files. By convention, each file has a “.lib” extension. If
you receive new models from a vendor, they may be in a single
file, or in many files that each contain one model or subcircuit.
If they are in a single file, simply rename it to “<anything>.lib.”
If each model is in its own file, then you can copy them all into
Create Schematic Symbols for New Vendor Models 71
Symbol Library
Now you need to add a symbol for each of the models or
subcircuits that you intend to use. Switch to the Symbol Editor
by selecting Edit Library from the File menu. The status bar at
the top of the screen should say <new>:<new>. This means that
you are editing a new Symbol Library file and a new symbol.
• If you want to add symbols to an existing library, select
Open from the File menu. Then navigate to the library file,
and open it.
• If you are starting a new library, select Save As from the File
menu, and enter a name. When asked whether to add the
new library to the list of Schematics’ libraries, click Yes to
make your new library visible to Schematics.
Before we start, a quick overview of the structure of a Symbol
Library file may be helpful. Most Symbol Library files are
composed of base parts and AKO (A Kind Of) parts. The base
part usually contains the graphical information for the symbol as
well as the minimum attributes required to make that symbol
functional. The AKO symbol inherits all of the graphics and
attributes of the base part, but may alter them or add to them.
72
Adding Parts
The quickest way to add a new symbol is to copy an existing one
and customize its attributes. Let’s assume you have a new set of
opamps from a vendor. For this example we will assume that
each device has five interface pins. Since all of the symbols will
look the same, we want a Symbol Library file that has one base
part and multiple AKO parts—one for each device to be used.
have different graphics than the op5, simply add a new base part
and proceed as described above. If you need to add symbols in
subsequent editing sessions, be sure to first open the library file.
That is, after invoking the Symbol Editor, select File/Open and
type in the name of the library file to which you will be adding
the new symbols. The status bar at the top of the screen shows
you which library file you currently have opened.
Creating “Eye” Displays Using Probe 75
The first macro (pi) calculates the value of π. The second macro
(mod) is a floating-point modulo function, implemented using
the tangent and arctangent functions. The third macro
(eye_sweep) implements an “eye sweep” function; the display is
centered at one half the period
(p/2), plus a time delay (d).
To use the macros, simply change the time axis variable from
time to eye_sweep(p, d). In this function, p is the data period of
the system (or a multiple of it), and d is the time interval by
which the start of the display is delayed.
76
The “Eye”
Voltage
Margin
Timing
Margin
Figure 30 shows the eye display of the filter output with two
data periods for the time axis duration, and shows the classic eye
shape. The problem is that half of the simulation data is
displayed, not in the central eye, but in the two half-eyes on
either side. To include all of the simulation data in one eye, we
need to use a single data period for the sweep period. We also
need to offset the display slightly to make sure that the eye is
centered in the smaller display. The results are shown below.
.
Creating Impedances
with Behavioral
Modeling
MicroSim Corporation Newsletter, October 1990
We regularly receive questions on how to create nonlinear
resistors with the Analog Behavioral Modeling feature. The
method for doing this can be illustrated by creating the transfer
function for a linear conductance. A conductance can be thought
of as a voltage-controlled current source: the current between its
nodes is a constant, times the voltage across those same nodes.
For example:
GCOND 7 4 VALUE = {V(7,4)*.001}
is a linear conductance with a value of 1 milli-mho (i.e., a 1 kilo-
ohm resistor). The controlling nodes are the same as the output
nodes. For a nonlinear conductance the appropriate nonlinear
function is used, but the device still has the same controlling and
output nodes:
GSQ 7 4 VALUE = {V(7,4)*V(7,4)*V(7,4)*.001}
GSQ has a small-signal conductance of 3×.001×V(7,4)2. (The
small-signal conductance is the derivative of the transfer
function.)
Any nonlinear resistance can be expressed as a nonlinear
conductance by inverting the transfer function. Sometimes,
however, it is convenient to implement it directly. This can be
done by noting that a resistor is a current-controlled voltage
source. For example,
ERES 7 4a VALUE = {I(VSENSE)*1K}
VSENSE 4a 4
is a linear resistor with a value of 1 kilo-ohm. VSENSE is
needed to measure the current through ERES. A quadratic
resistor is then:
ERES 7 4a VALUE = {PWRS(I(VSENSE),2)*1K}
VSENSE 4a 4
80
Digital Frequency
Comparator
The Design Center Source newsletter, April 1993, originally
titled “Simulate an All-Digital Frequency-Comparator Circuit
Using PSpice”
This article illustrates how a hierarchical all-digital design with
two implementation views, can be defined in Schematics, and
subsequently simulated in PSpice. This discussion is relevant to
version 5.2 and later of the MicroSim software. The example
circuit is a basic frequency-comparator (see Figure 32). All parts
used in the schematic are provided in the standard Symbol and
Model Libraries. One implementation is chosen for PSpice
simulation to demonstrate the circuit’s behavior.
Implementation
The frequency-comparator circuit is designed in Schematics
using hierarchical blocks for the initializer (INIT block), cycle-
detectors (PICD blocks), state-decoder (SDL block), and error-
detector (EDL block). The design has two alternative
implementations: a gate-level implementation using off-the-
shelf 74xx parts (see Figure 36), and a functionally equivalent
implementation using a mixture of 74xx parts and a commonly
available Programmable Array Logic (PAL) device,
PAL20RP4B (see Figure 37). Both implementations use the
digital stimulus include file, “freqchk.stm,” providing
definitions for the INIT, RUN, MODE, REFH, REFH, FTEST,
and SYSCLK input signals (see Figure 21 on page -58).
The design alternatives are implemented as two views of the
SDL block, with the DEFAULT view being the gate-level
implementation, and the PAL-IMPL view being the PAL
implementation. For the PAL-IMPL view, the data required to
program the PAL20RP4B device is supplied in a JEDEC file,
“frqchk.jed,” generated using OrCAD/PLD (see Figure 1 on
page 87).
84
Operation
The three frequency inputs—REFL, REFH, FTEST—each
drive a separate instance of a cycle-detector circuit (PICD
Digital Frequency Comparator 85
Cycle
Cycle
N2
FAST
ERROR S4 S0 N0
S1
OK
N1·N0 N2·N0 N2
S15
N1
FAST S3 S2
N0
N2·N0
S10
N2 STALL
SLOW S5 S6 (N3=1)
N2·N1·N0
N0
SLOW S7 S14
STALL
(N3=1)
S8 MODE=1
S15
SLOW
N1·N0 S11
OK
Figure 38 State transitions during frequency-comparator
operation
The initialization/reset logic (INIT block) performs two
functions. One distributes the effects of the INIT and RUN
inputs, as defined in the stimulus include file, “frqchk.stm” (see
Figure 40). The other uses the DONE signal from the error-
detector to generate a RESET pulse; this has the same effect as
the external RUN pulse—to restore the state machine to its
starting state (0) as well as reset the cycle-detectors, timeout
Digital Frequency Comparator 87
L1280 11 11 11 11 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 *
L1600 11 11 11 11 11 11 10 11 11 11 11 11 11 11 11 11 11 11 11 11 *
L1920 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 01 *
L1960 10 11 01 11 10 11 01 01 11 01 11 01 11 01 11 11 11 11 11 11 *
L2000 01 11 01 11 01 11 01 10 11 10 11 10 11 11 11 11 11 11 11 11 *
L2240 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 01 *
L2280 01 11 01 11 10 11 01 01 11 01 11 01 11 01 11 11 11 11 11 11 *
L2320 01 11 11 10 01 11 01 11 11 11 11 11 11 11 11 11 11 11 11 11 *
L2560 11 11 11 11 *
C4B0E*
CCF0
Filter Models
Implemented with ABM
by Bashir Al-Hashimi, PhD, School of Engineering,
Staffordshire University, Stafford, ST180AD England
Analog behavior modeling (ABM) allows the simulation of
analog circuits using mathematical equations. This article shows
how filter behavioral models are developed and implemented
using the Laplace function of MicroSim PSpice, version 6.2.
Given the filter bandwidth and order, the models simulate
lowpass, highpass, bandpass, and band-reject filters. For ease of
use, the models are developed as parameterized subcircuits.
Simulation examples are included to demonstrate the use of
these models.
Introduction
Filters are often described in terms of a number of parameters
including type, order, and response. There are four filter types:
• Lowpass
• Highpass
• Bandpass
• Band-reject
The order of the filter usually determines the amount of
attenuation the filter provides—the higher the order, the more
the attenuation. There are a number of filtering responses
available. The most commonly used are Butterworth,
Chebyshev, and Bessel. Each response has its advantages and
disadvantages.
The Butterworth response, for example, has a maximally flat
magnitude passband, while the Chebyshev has steeper
attenuation characteristics than the Butterworth. The Bessel has
a linear phase response and therefore an excellent pulse
response. More information on filters is available in the
92
(Vout/Vin)=(1st-orderTF)
*(2nd-orderTF)N
H(s)=x/(s+x) ; x=2πFcα
H(s)=x2/(s2 +(x/Q)s+x2)
; x=2πFcϖ0
.S U B C KT B u tt _ L P 1 2 pa r a m s: F c =1 o r d= 1 ; s u b ci r c ui t d es c r i pt i o n
.P A R A M p i = 3. 1 4 1 59 ; c o n st a n t
.F U N C l p _ 1 (x ) { x/ ( s + x) } ; 1 s t -o r d er l o wp a s s t r a n sf e r
; f u n ct i o n
.F U N C l p _ 2 (x , Q ) { ( x * x) / ( s *s + x / Q* s + x *x ) } ; 2 n d -o r d er l o wp a s s t r a n sf e r
; f u n ct i o n
* a 1 - a4 a n d b 1 - b4 d e te r m i ne w h ic h f il t e r s e c t io n s a r e se l e c te d , gi v e n
* t h e f i l t er o r de r .
*
.P A R A M a 1 = {t a b l e( o r d ,1 , 1 , 2, 0 , 3 ,1 , 4 , 0, 5 , 1 ,6 , 0 , 7, 1 , 8, 0 , 9 ,1 ) }
.P A R A M a 2 = {s t p ( or d - 1 .5 ) } a3 = { s tp ( o r d- 3 . 5 )} a 4 ={ s t p( o r d -5 . 5 ) }
+ a 5 = {s t p ( or d - 7 .5 ) }
.P A R A M b 1 = {l - a l } b 2 = {1 - a 2 } b 3 = {1 - a 3 } b 4 = {1 - a 4 } b 5 ={ 1 - a 5) }
*
* a l p ha , o me g a an d Q v a l u es o f t h e Bu t t e rw o r t h r e sp o n s e f o r e a c h s e c t io n
* a r e l o o k ed u p f r o m t h e s e t a b le s , ba s e d o n t he f il t e r o r d e r. U p t o
* 9 t h -o r d e r ( o r d) f i lt e r is a l lo w e d .
.P A R A M a l p ha _ b = {t a b l e( o r d ,1 , 1 , 2, 0 , 3 ,1 , 4 , 0, 5 , 1 ,6 , 0 ,7 , 1 , 8, 0 , 9 ,1 ) }
.P A R A M o m e ga 1 _ b ={ t a b le ( o r d, 1 , 0 ,2 , 1 , 3, 1 , 4 ,1 , 5 , 1, 6 , 1, 7 , 1 ,8 , 1 , 9, 1 ) }
.P A R A M Q 1 _ b= { t a bl e ( o rd , 1 , 0, 2 , 0 .7 0 7 , 3, 1 , 4 ,1 . 3 0 7, 5 , 1. 6 1 8 ,6 , 1 . 93 2 ,
+ 7 , 2 .2 4 7 , 8, 2 . 5 64 , 9 , 0. 5 3 2 )}
.P A R A M o m e ga 2 _ b {t a b l e( o r d ,3 , 0 , 4, 1 , 5 ,1 , 6 , 1, 7 , 1 ,8 , 1 ,9 , 1 ) )}
.P A R A M Q 2 _ b= { t a bl e ( o rd , 3 , 0, 4 , 0 .5 4 1 , 5, 0 . 6 18 , 6 , 0. 7 0 7, 7 , 0 .8 0 2 ,
+ 8 , 0 .9 0 , 9 ,0 . 6 5 3) }
.P A R A M o m e ga 3 _ b ={ t a b le ( o r d, 5 , 0 ,6 , 1 , 7, 1 , 8 ,1 , 9 , 1) }
.P A R A M Q 3 _ b= { t a bl e ( o rd , 5 , 0, 6 , 0 .5 1 8 , 7, 0 . 5 55 , 8 , 0. 6 0 1, 9 , 1 )}
.P A R A M o m e ga 4 _ b ={ t a b le ( o r d, 7 , 0 ,8 , 1 , 9, 1 ) }
.P A R A M Q 4 _ b= { t a bl e ( o rd , 7 , 0, 8 , 0 .5 0 9 , 9, 2 . 8 79 ) }
*
E 2 0 l a p l ac e { V( 1 ) } ={ ; V C V S w i th l a pl a c e d e s c ri p t i on
+ ( b 1 +a 1 * l p_ 1 ( 2 *p i * a lp h a _ b* F c ) )* ; 1 s t o r d er
+ ( b 2 +a 2 * l p_ 2 ( 2 *p i * o me g a 1 _b * F c ,Q 1 _ b )) * ; 2 n d o r d er
+ ( b 3 +a 3 * l p_ 2 ( 2 *p i * o me g a 2 _b * F c ,Q 2 _ b )) *
+ ( b 4 +a 4 * l p_ 2 ( 2 *p i * o me g a 3 _b * F c ,Q 3 _ b )) *
+ ( b 5 +a 5 * l p_ 2 ( 2 *p i * o me g a 4 _b * F c ,Q 4 _ b )) }
.e n d s B u t t _L P ; e n d o f su b c i rc u i t d e s c ri p t i on
Example 1
To illustrate the use of the models, consider the following
example. Here, the Butterworth lowpass filter model is used to
obtain a family of curves for second- through ninth-order
responses. Assume the filter has a cutoff frequency of 10 kHz.
Using MicroSim Schematics, the circuit of Figure 46 is drawn.
Example 2
To demonstrate the use of the bandpass filter models, consider
simulating a bandpass circuit with the following specifications:
lower –3dB point=1kHz
upper –3dB point=5kHz
30dB minimum at 0.3kHz and 20kHz
Assume a Butterworth response is required. To meet the
specifications, third-order lowpass and highpass filters are
required [2].
The circuit is shown in Figure 50.
Models
Figure 51 is a block diagram representation of how a band-reject
filter can be realized [2].
Example 3
Figure 52 contains a fifth-order, 0.25dB ripple Chebyshev band-
reject filter with a lower –3dB point at 1kHz and the upper –3dB
point at 5kHz.
Library Availability
The symbol and model libraries used in this article are contained
in a self-extracting zip file which can be downloaded from the
MicroSim BBS. To download the file, dial the BBS at (714)
830-1550, and from the main menu select [T]ech Support, then
[6] File Transfer, then [1] Download User Requested Files, and
then download “filters.exe.”
References
[1] Van Valkenburg, M.E., Analog Filter Design, Holt,
Rinehart & Winston, New York, 1982.
[2] Williams, A.B., Electronic Filter Design Handbook,
McGraw-Hill Book Company, USA, 1981.
[3] Al-Hashimi, B.M. The Art of Simulation Using PSpice:
Analog & Digital, CRC Press, USA, 1995.
Frequency-Domain Modeling of Real Inductors 100
Frequency-Domain
Modeling of Real
Inductors
MicroSim Corporation Newsletter, January 1991.
Originally titled SPICE is SPICE...(part 6 in a series)
SPICE is SPICE... right? At least until limits get in your way,
keeping you from creating effective simulations. In this
discussion, let’s look at frequency-domain modeling of real
inductors using the Analog Behavioral Modeling option to
PSpice. Other vendors are crowing that generic SPICE always
had behavioral models and no extensions are needed. They
support this approach with a library of control theory models
and motor/servo equivalents. This example will demonstrate a
sample of the useful capabilities Analog Behavioral Modeling
provides for real electrical circuits.
Wide band inductors combine with capacitances to make
frequency-selective circuits. Ideally, these inductors should
have low winding resistance, low core loss, and low distributed
capacitance. In practice, these ideals are approximated only over
a limited range by real inductors. Various losses limit the quality
(Q) factor of an inductor, which is defined as the ratio of
inductive reactance to series resistance. As the Q factor
increases, frequency-selective circuits can realize sharper cut-
off, more defined resonance, and higher attenuation ratios.
For small signals, ferromagnetic hysteresis loss is low, as the
inductor flux density is low. Also, for a constant-induced
voltage, this loss decreases with increasing frequency. The
remaining losses may be modeled as an effective series
resistance whose value is frequency dependent. The formula for
Q, neglecting hysteresis loss, becomes
ω⋅l
Q = -------------------------------------
R dc + R ac + R d
where “e” represents the eddy current loss, which increases with
the square of frequency, and “c” represents a residual loss that is
proportional to frequency. The factors “µ” and “L” are the
relative permeability of the core material and dc inductance of
the device, respectively.
Dielectric loss resistance is more important at higher
frequencies, and may even be negligible at frequencies
substantially below the self-resonant frequency of the inductor.
This loss is calculated as
Rd = d ⋅ ω 2 ⋅ L 2 ⋅ Cd
lw N1 a ; winding inductance
+ { 1n * nHpt * t*t }
rw a b ; winding resistance
+ { rpt * t }
vc b c dc 0 ; current sense
v1 1 0 ac 1
x1 1 2 L params:
+ t ={ sqrt(mH/mHpKt) * 1000 }
+ nHpt={ mHpKt }
+ rpt ={ mHpKt * rpmH / 1000 }
+ mu=160 c=25u e=17n d=.012 cd=50p
c1 2 0
+ {kcap*5.06605918212n} ; nom. 10kHz resonance
Improve Simulation
Accuracy When Using
Passive Components
The Design Center Source newsletter, April 1994, by
Steven C. Hageman Applied DC
Introduction
Everyone seems to get on the band wagon when it comes to
making better and better IC models. Today opamp models
exhibiting five to ten poles or zeros are common. While these
models add to PSpice simulation accuracies, the importance of
other components should not be overlooked.
In particular, passive components can have as much influence
on simulation accuracy as do IC models. This article surveys the
effect of frequency and temperature on the behavior of selected
common passive components. Suggested techniques for
improving simulation accuracy using these components are also
presented.
Frequency Effects
Resistor models
At first glance, resistors appear to operate in a straightforward
manner. In a DC circuit that does not overheat, they mostly all
work. However, as operating frequency increases, their behavior
can change. Whether the resistor behaves in a resistive,
Improve Simulation Accuracy When Using Passive Components 106
100k
Capacitive
10k
1k
100 Ohms
Inductive
10 Ohms
10p
100p
1000p
0.01u
0.1u
Design Example
For commonly used resistor values of 100 kilohms or less, the
frequency response effects don’t change the circuit’s overall
behavior when the frequency is less than about 1 MHz, or when
the time steps in a transient analysis are greater than 1 usec.
However, outside of these limits, using the frequency-correct
models can significantly enhance accuracy.
Improve Simulation Accuracy When Using Passive Components 110
Conductors
A conductor that looks like a small resistor at DC has an
increasing impedance with frequency that is dependent on the
physical dimensions of the conductor. Its inductance can be
approximated by an inductor of about 20 nH per inch of length
in series with the DC resistance. Thus, a conductor looks
inductive at frequencies as low as
10 kHz up to the length that is about a quarter-wavelength long.
At longer lengths, the conductor undergoes multiple pole and
zero resonances like an antenna. The frequency where a
conductor stops looking inductive and starts to act like an
antenna can be found using the formula,
F = 2850/L
where L is a quarter of the wavelength in inches, and F is in
MHz. Thus, a conductor that is 10 inches long will behave like
an antenna when the frequency is 285 MHz or greater. Most
PCB traces are not long enough to act as antennas, but ribbon
cables can be.
On controlled impedance PCB’s, the traces look like
transmission lines. These can be modeled with the PSpice
transmission line models.*
Even power and ground planes used in PCB design don’t escape
frequency effects. The impedance of a ground plane (or any
111
Inductors
Inductors vary greatly in shape and size depending on the exact
job that they are to perform. Power inductors, like the type used
in switching power supply output filters, are usually large
structures that may self-resonate at frequencies from 500 kHz to
75 MHz. These power inductors are sometimes designed for low
loss so they may have a large Q at resonance (small resistive
term). This is especially true when the core material of the
inductor is ferrite. (MPP and iron powder core materials have
more loss and lower Q values.) The high Q gives rise to a rather
narrow, sharp resonance. Above the resonance frequency, the
inductor’s shunt capacitance dominates. The shunt capacitance
is usually large for a big power inductor because of the
capacitive coupling among the many turns used.
When modeling power inductors, the resonant frequency is
based on the size of the core. Generally, the larger the core, the
lower the self-resonant frequency.
Ferrite beads used for EMI control are at the other end of the
spectrum. Beads are designed for lossy operation and have very
low Q values with relatively low inductance. The self-resonance
peak is low and very broad, extending for several octaves of
frequency. Beads are best modeled as an inductor with a small
shunt resistance on the order of 50 to 100 ohms and a low shunt
capacitance of 1-5 pF or less.
*. Using the Polaris signal integrity analysis tool (an optional inte-
grated feature of the software), PSpice transmission line models
can be automatically derived for traces on a PCB from informa-
tion in the layout database.
Improve Simulation Accuracy When Using Passive Components 112
Temperature Effects
Ambient
Passive component values can be subject to temperature effects
that are dependent upon the circuit’s operational temperature.
To account for these effects when simulating, each relevant
component needs a .MODEL statement specifying how the
particular component value varies with temperature. The built-
in PSpice models for resistors, capacitors, and inductors have
two temperature effect terms—linear and quadratic.* These
terms may be curve fit to a component’s actual temperature
characteristics.
The linear term can be used alone to give a single-slope fit to any
component by specifying the TC1 temperature coefficient in the
PSpice .MODEL statement. For example, a 100 ppm per °C
resistor could be specified as
.MODEL R_100 RES (R=1, TC1=0.0001)
TC1=0.0001 relates to 100 ppm/°C. For a 250 ppm/°C resistor,
TC1 would equal 0.00025. If the slope is negative, a minus sign
must precede the TC1 value.
A single-slope temperature curve is usually sufficient for
resistor and inductor simulation; hence, these components are
typically governed by a first-order term. In practice, they may
wobble around the temperature curve, but this wobble is usually
within 20% of the expected value. However, this may not be
totally accurate over the military temperature range; therefore, it
is important to find out how the parts in question actually
perform when simulating over very large temperature ranges.
Resistors are not the only components with temperature effects;
most capacitors, especially ceramics, have very well-defined
temperature curves depending on the dielectric used in their
construction. However, a single-slope temperature curve is not
sufficient for simulating the most common types of capacitors
used in analog circuits.** The X7R and Z5U dielectric types
have a fairly large upside-down parabolic curve shape. Their
Per Component
Beginning with version 5.3 of PSpice, passive components can
also be characterized for temperature effects that override (1)
the circuit’s operational temperature and (2) the temperature,
TNOM, at which model parameters are assumed to have been
measured. Individual device temperature behaviors can be
customized by specifying either the T_ABS,
T_REL_GLOBAL, or T_REL_LOCAL parameter in a
.MODEL statement. A new measurement temperature can also
be defined by setting the T_MEASURED model parameter.
Suppose that a resistor’s resistance multiplier is unity when
measured at 0°C. To signify this, T_MEASURED can be
specified in the resistor’s corresponding .MODEL statement as
.MODEL RMOD RES(R=1, TC1=0.0001,
T_MEASURED=0)
Including Relays in
PSpice Simulations
The Design Center Source newsletter, January 1993
Some systems require simulating the operation of
electromechanical relays in order to accurately model system
behavior. The model libraries for release 5.2 do not include
relays. Therefore creating an accurate relay model can take
some time. The models discussed here are included in the 5.3
(and later) software release. An April 1990 application note
titled “Modeling an Electromechanical Device” may in some
ways add to the confusion, since it discusses modeling the
mechanical (and electrical) behavior of a relay. In this
application note, we will discuss two approaches to modeling
the relay: the mechanical approach taken in the earlier
application note, and two purely electrical (behavioral) models.
The mechanical model for the relay is described in more detail
in the above mentioned application note. The focus of that
application note is modeling the mechanical part of
electromechanical devices in general, using the relay as an
example. This model constructs an electrical analogy to the
mechanical operation of the relay. To do this, it calculates the
magnetic and mechanical forces acting on the contact arm of the
relay, and simulates the acceleration, velocity, and position of
the arm in response to these forces. The electrical contacts of the
relay are simulated by switches controlled by the position of the
contact arm. There are two problems with this modeling
approach: first it requires information about the physical
construction of the relay (spring force, contact arm moment,
magnetic permeance as a function of contact arm position)
which are not normally available to the user of a relay, and
second, it takes a lot of computer time to simulate the exact
position of the contact arm. Most of this time is wasted if all the
user needs to know is whether the contacts are open or closed.
This type of physical model could be useful for designing a
relay, but it is overkill for simulating its electrical behavior.
If you are interested in a complete physical model for a relay you
should take a look at the RELAY_SPDT_PHY model in
“misc.lib.”
117
resistance
* electrical model of coil
v_winding coila a1 0
r_winding a1 a2 {R_coil}
l_winding a2 coilb {L_coil}
* make a voltage from the current
e_cc cc 0 value = {Limit(I(v_winding),-3*I_pull,3*I_pull)}
r_cc cc 0 1k
* use digital to create a switch with hysteresis
o_mag cc 0 relay_1 DGTLNET=d digio_1
.model relay_1 doutput (
+ s0name="0" s0vlo={-I_pull} s0vhi={I_pull}
+ s1name="1" s1vlo={I_drop} s1vhi={4*I_pull}
+ s2name="1" s2vlo={-4*I_pull} s2vhi={-I_drop}
+ timestep={T_make/1000}
+)
* by using min/max delay we can use a single
* N-device to simulate both the no and nc contacts.
u_dly buf dpwr dgnd d cnt relay_2 digio_1 MNTYMXDLY=4
.model relay_2 ugate (
+ tplhmn={T_break tphlmn={T_break}
+ tplhmx={T_make} tphlmx={T_make}
+)
n_cnt com no nc relay_3 DGTLNET=cnt digio_1
.model relay_3 dinput (
+ s0name="0" s0tsw={T_make/1000} s0rlo={R_open} s0rhi={R_close}
+ s1name="1" s1tsw={T_make/1000} s1rlo={R_close} s1rhi={R_open}
+ s2name="R" s2tsw={T_make/1000} s2rlo={R_open} s2rhi={R_open}
+ s3name="F" s3tsw={T_make/1000} s3rlo={R_open} s3rhi={R_open}
+ s4name="X" s4tsw={T_make/1000} s4rlo={R_open} s4rhi={R_open}
+ s5name="Z" s5tsw={T_make/1000} s5rlo={R_open} s5rhi={R_open}
+)
.model digio_1 uio
.ends
Background
Figure 60 on page -125 shows the basic configuration of an R-
2R current-steering DAC. R-2R ladders are frequently used in
IC applications because only the ratio of component values is
important, and only two resistor values are required. The
currents flowing in the rungs of the ladder reduce by a factor of
2 per stage. Each stage has a switch which directs the current
either to ground or to a virtual earth at the input of an opamp
configured as an
I-to-V converter. Operation of the nth switch causes a change in
total current of 2n times the bit0 current, resulting in the desired
binary weighting of the bit contributions.
125
Setting Up
A number of points need to be addressed before proceeding with
details of the optimization. First, all analysis is done with a DC
sweep. This causes the Vramp device to be swept between 0 and
4095 volts. A simulation using all 4096 data points is too long
for convenience, so most of the work is done using a step of 25
(i.e., the ramp is 0, 25, 50, ...). The results are checked
periodically by performing measurement using a step of 1.
Secondly, the parameters which will be varied by the optimizer
are the ratios of widths of the transistors in the DAC switches. It
is convenient to define a set of parameters each with nominal
value of 1.0 and then set the width of the nth cell to be
2n×parametern. The optimizer supports up to eight independent
parameters. There are, however, eleven independent widths in
this example.
129
Optimization
The purpose (goal) of the optimization in this example is to
minimize the area of silicon occupied by the switches. There are
requirements on the amount of nonlinearity which can be
introduced by altering the ratios of switch sizes. For this
example, an upper bound of 0.2 LSB is acceptable for both INL
and DNL. These are constraints for the optimization.
To optimize the design, Paragon requires definitions of the goal
and constraints, together with the parameters which are to be
varied. The area can be computed directly by Paragon as a
function of the parameter values (a Paragon expression). No
simulations or goal function evaluations are required for this.
INL and DNL for each step of the input ramp are output by the
test schematic directly. A Probe intrinsic goal function is then
used to find the absolute maximum values. For example, for
INL:
MAX(ABS(V(INL))
The target values and ranges for the goal and the constraints are
set to 0,100 (for the goal) and 0.2,0.01 for the constraints. Each
of the x parameters is set up with an initial value of 1.0 and a
permissible range of between 0.1 and 10.0.
Minimize DAC Switch Area with MicroSim’s Analog Optimizer 130
Summary
In an integrated circuit DAC design, silicon area can be traded
off against output nonlinearities. Performing the trade-off
manually is difficult because the relationships are highly
nonlinear and are difficult to establish analytically.
In this particular example, Paragon was used to provide a 40%
reduction in switch area while meeting requirements of 0.2 LSB
on both differential and integral nonlinearity. The approach
described in this article can be easily adapted to other weighting
schemes, voltage-mode DACs, and more.
We would like to thank John Horan of Regional Technical
College in Cork, Ireland for providing the original idea
presented in this article.
131
Z = V source ⁄ I source
Then:
Z = 1⁄K
.SUBCKT BEAD73 1 2
GBEAD 1 2 FREQ {V(1,2)} =
* Freq 1/Z db 1/Z ang
+ (1k, 40.5, -89.9)
+ (10k, 20.6, -89.5)
+ (100k, 0.9, -80.5)
+ (1meg, -20.4, -59.5)
+ (2meg, -23.4, -46.0)
+ (3meg, -24.7, -39.1)
+ (5meg, -25.4, -36.9)
+ (7meg, -26.2, -35.9)
+ (10meg, -27.7, -34.6)
+ (20meg, -30.0, -23.0)
+ (30meg, -30.3, -16.5)
+ (40meg, -30.0, -12.0)
+ (50meg, -29.7, -08.0)
+ (60meg, -29.6, -06.5)
+ (70meg, -29.6, -06.3)
+ (80meg, -29.6, -06.2)
+ (100meg, -29.6, -06.6)
+ (200meg, -29.7, -09.5)
+ (1000meg, -32.0, -26.0)
RBEAD 1 2 200
.ENDS BEAD73
Img
∠1 ⁄ Z = – Arctan ------------
Real
The listing entries are Frequency, 20Log(1/Z), and Angle(1/Z).
Simulation results of the bead’s effectiveness on power supply
coupling between two local Vcc points fed from a main supply
source verified the model’s effectiveness.
In another test, the supply network was subjected to a 10 ns, 100
mA current pulse at one Vcc point. When the simulation was
performed, a time-domain plot showed reduced ringing with the
ferrite beads in the circuit.
Some convergence and time-domain simulation problems were
experienced with different bead models. Resistor RBEAD in the
listing was included to reduce the Q of the bead and supply a real
shunt impedance around the VCCS. RBEAD is determined
empirically with the VCCS frequency table coefficients to
provide a good representation of the bead’s frequency-
dependent behavior.
133
.end
Model Transient Voltage Suppressor Diodes 134
Modeling Goals
In this article, models are developed for the popular 500 watt [1]
and 1500 watt [2] unidirectional devices. The 500 watt model is
reviewed in detail. The 1500 watt model is electrically the same
except for some parameter changes to accurately reflect the
larger device.
The basic goal when modeling the TVS is to represent the mean
behavior of the device with an overall error of less than 15%.
Modeling better than 15% accuracy is not worthwhile. It would
serve to complicate the model, thus slowing down the
simulation. Also, it would tend to give a false sense of security
because the real device parameters vary by better than 20% from
device to device. Thus, it is sufficient to partition the TVS diode
model into three parts (see Figure 64 and Figure 65):
1 forward diode characteristics
2 reverse diode or breakdown characteristics
3 device thermal model
135
Thermal Model
Junction Ambient
Temperature Temperature
Forward Characteristics
A TVS that is biased in the forward direction behaves exactly
like a normal diode. Parts, the PSpice model parameter
extraction program, was used to obtain the proper parameters for
the D_FWD diode (see Figure 64 and the .MODEL statement
for D_FWD_SA in Figure 65).* The forward diode
characteristics do not change appreciably with TVS breakdown
voltage, so one model is used for all devices.
******************************************************************
* SA SERIES TRANSIENT VOLTAGE SUPPRESSOR MODEL
* Model valid for 6.8 to 100 volt breakdown voltages
******************************************************************
* ANODE ANODE input node
* CATHODE CATHODE input node
* J_T Junction temperature output node
* BDV Breakdown voltage in volts
* AMB_T Starting ambient temperature
******************************************************************
.SUBCKT SA ANODE CATHODE J_T PARAMS: BDV=1, AMB_T=27
* * * * ELECTRICAL MODEL * * * *
V_PWR_SEN CATHODE 10 DC 0.0 ;Current sense
RLEAK CATHODE ANODE 100MEG ;Leakage resistor
* FORWARD SECTION
D_FWD 20 10 D_FWD_SA ;Forward diode
E_TC_FWD 20,60 VALUE = {-2.2E-3 * (V(J_T) - AMB_T)} ;Forward diode TC
* REVERSE (BREAKDOWN) SECTION
D_REV 10 30 D_REV_SA ;Reverse (Breakdown) diode
R_REV 30 40 {0.00032*PWR(BDV,1.93)} ;Resistance
* Reverse TC
E_TC_REV 40,50 VALUE = {(0.00016*PWR(BDV,1.48)) * (V(J_T) - AMB_T)}
V_BD_REV 50 60 {BDV - 0.3} ;Reverse voltage
* PACKAGE
L_PKG ANODE 60 5N ;Package inductance
* * * * THERMAL MODEL * * * *
* Power to current converter, 1A = 1W dissipated in device
G_POWER 0,J_T VALUE = {ABS( I(V_PWR_SEN) * V(ANODE,CATHODE))}
V_AMB_T AMB 0 {AMB_T} ;Ambient temp node
* DISTRIBUTED THERMAL MODEL
R_CHIP J_T 1 1.3 ;Diode chip
C_CHIP J_T 1 7.7E-4
R_SOLD 1 2 0.2 ;Solder joints
C_SOLD 1 2 2.5E-5
R_CASE 2 3 17 ;Package
C_CASE 2 3 0.029
R_LEAD 3 AMB 37.5 ;Leads
C_LEAD 3 AMB 0.0267
* * * * DIODE MODELS * * * *
* Forward diode model - includes forward capacitance
.MODEL D_FWD_SA D(T_ABS=27, IS=2.15N, N=1.63, RS=14M
+ IKF=0.782, XTI=3, EG=1.11
+ CJO={1.7E-8*PWR(BDV,-0.99)};Junction capacitance equation
+ M=0.333, VJ=0.75, FC=0.5
+ ISR=100P, NR=2, BV=1000, IBV=100U, TT=100N)
* Reverse diode model
.MODEL D_REV_SA D(T_ABS=27, IS=10N)
.ENDS ;----- END OF SA SUBCIRCUIT MODEL
Reverse Characteristics
The D_REV diode, R_REV, E_TC_REV, and V_BD_REV
make up the reverse or breakdown characteristics of the TVS.
D_REV functions to block forward current from this section and
works in conjunction with V_BD_REV; these two parts set the
basic breakdown voltage.
At higher currents, R_REV and E_TC_REV become
predominant factors in the breakdown voltage. R_REV is the
high current resistance of the device, modeled as a function of
breakdown voltage expressed as
Thermal Model
It is a fairly simple task to model the thermal characteristics of a
device which is in equilibrium. However, when the junction
temperature changes within a one-second time span, modeling
becomes nontrivial. Dynamic heat flow is a three-dimensional
problem that is not directly solvable with SPICE. Instead, the
heat flow paths of the device must be broken apart and modeled
individually as linear RC circuits. Even this approach only
works as long as the rise time in temperature is longer (slower)
than the thermal transient time across the material [3] [4].
To model TVS devices adequately, a four part thermal model is
used as shown in Figure 65. The junction temperature node,
J_T, is fed from the power-to-current converter, G_POWER.
G_POWER is an analog behavioral device that calculates the
instantaneous power that the TVS is dissipating by multiplying
the absolute value of the voltage across the device by its current
(current is sensed by V_PWR_SEN). The units are scaled so that
1 ampere equals 1 watt dissipation. The various thermal
resistances of the TVS are modeled along with their thermal
capacitance values. Each RC pair makes up that section’s
thermal time constant.
Heat flows from the junction to the ambient via the RC paths.
The ambient temperature is represented by a voltage source
called V_AMB.
For slow heating times (> 10 seconds), the thermal time
constants don’t matter; only the resistances matter. When fast
power pulses are absorbed by the TVS, the thermal time
constants have a significant effect on the instantaneous junction
temperature.
The thermal model is coupled to the electrical model via the
voltage at node J_T. The voltage here represents the junction
temperature with a 1 volt = 1°C scale factor. This voltage is used
by the forward and reverse voltage temperature coefficient
generators during simulation.
Model Transient Voltage Suppressor Diodes 140
voltage upwards
of 20 kV possible
voltage upwards
of 1.5 kV possible
Conclusion
The TVS model presented here accurately predicts the most
important device parameters. The resulting models require only
one device parameter to be passed to them; equations relate all
other parameters to the breakdown voltage. The common 500
watt, SA series devices were presented in the Figure 66 circuit
file and described in the text. Figure 72 on page -145 shows the
circuit file for the 1.5KE and 1N62xx series, 1500 watt TVS
devices. The 1.5KE model has the same circuit layout as the SA
series devices; only the circuit parameters have changed as
needed to accurately predict device operation.
145
*************************************************************
* 1.5KE SERIES TRANSIENT VOLTAGE SUPPRESSOR MODEL
* Model valid for 6.8 to 100 volt breakdown voltages
*************************************************************
* ANODE ANODE input node
* CATHODE CATHODE input node
* J_T Junction temperature output node
* BDV Breakdown voltage in volts
* AMB_T Starting ambient temperature
*************************************************************
.SUBCKT KE ANODE CATHODE J_T PARAMS: BDV=1, AMB_T=27
* * * * ELECTRICAL MODEL * * * *
V_PWR_SEN CATHODE 10 DC 0.0 ;Current sense
RLEAK CATHODE ANODE 100MEG ;Leakage resistor
* FORWARD SECTION
D_FWD 20 10 D_FWD_SA ;Forward diode
E_TC_FWD 20,60 VALUE ={-2.2E-3*(V(J_T)-AMB_T)};Forward diode TC
* REVERSE SECTION
D_REV 10 30 D_REV_SA ;Reverse (Breakdown) diode
R_REV 30 40 {0.00014*PWR(BDV,1.7)} ;Resistance
* Reverse TC
E_TC_REV 40,50 VALUE ={(0.00021*PWR(BDV,1.36))*(V(J_T) - AMB_T)}
V_BD_REV 50 60 {BDV - 0.3} ;Reverse voltage
* PACKAGE
L_PKG ANODE 60 7N ;Package inductance
* * * * THERMAL MODEL * * * *
* Power to current converter, 1A=1W dissipated
G_POWER 0,J_T VALUE = {ABS( I(V_PWR_SEN) * V(ANODE,CATHODE))}
V_AMB_T AMB 0 {AMB_T} ;Ambient temp node
* DISTRIBUTED THERMAL MODEL
R_CHIP J_T 1 0.6 ;Diode chip
C_CHIP J_T 1 3.3E-3
R_SOLD 1 2 0.1 ;Solder joints
C_SOLD 1 2 1E-4
R_CASE 2 3 10 ;Package
C_CASE 2 3 0.36
R_LEAD 3 AMB 15.75 ;Leads
C_LEAD 3 AMB 0.127
* * * * DIODE MODELS * * * *
* Forward diode model - includes forward capacitance
.MODEL D_FWD_SA D(T_ABS=27, IS=59.4P , N=1.27, RS=6M, IKF=0.659
+ XTI=3, EG=1.11
+ CJO={7E-8/BDV} ;Junction capacitance equation
+ M=0.333, VJ=0.75, FC=0.5
+ ISR=100P, NR=2, BV=1000, IBV=100U, TT=100N)
* Reverse diode model
.MODEL D_REV_SA D(T_ABS=27, IS=10N)
.ENDS ;----- END OF KE SUBCIRCUIT MODEL
References
500 watt devices including General Semiconductor
Industries™ and Motorola™ SA5 to SA100 devices.
1500 watt devices including General Semiconductor
Industries™ and Motorola™ 1N62XX and 1.5KE6.8 to
1.5KE100 devices.
P. Antognetti, Editor, Power Integrated Circuits, McGraw
Hill Company, New York, NY. 1986, ISBN 0-07-002129-5.
S. Clemente, “Transient Thermal Response of Power
Semiconductors to Short Power Pulses,” IEEE Transactions
on Power Electronics, October, 1993.
O.M. Clark, “A Guide For Transient Suppression Using The
Transzorb™ TVS,” General Semiconductor Industries, Inc.
application note, Tempe, AZ, 1986.
O.M. Clark and T.M. Dalsing, “Optimizing Placement Of
Board Level Transient voltage Suppressors,” EMC-ESD
International Conference Proceedings, Denver, CO, April,
1990.
Biography: Steve Hageman is an analog designer
specializing in power conversion. He owns the consulting
firm, Applied DC, and may be reached by voice/FAX at
(510) 687-0483.
147
Modeling Constant
Power Loads
The Design Center Source newsletter, January 1992
In power systems, it is common to encounter loads which draw
constant power. To model such a load, we can use a voltage-
dependent current source. A first approximation looks like this:
gload n1 n2 value = {pload/v(n1,n2)}
With this formula, the power = v*i = v(n1,n2)*(pload/v(n1,n2))
= pload, as desired.
Unfortunately, this first approximation behaves badly near v =
0. When calculating the bias point for more difficult circuits,
PSpice reduces the power supplies. PSpice relies on the
assumption that, when the supplies are close enough to 0, all
devices in the circuit are turned off. The above formula violates
this assumption. Further, it is not a good model of a real
constant-power load for low voltages.
A real load can only consume constant power over a limited
range of applied voltage. When the voltage drops below this
range, the load’s impedance stops falling. For many loads, a
good model is a series connection of two resistances: the fixed
“minimum” resistance and the dynamic “constant-power”
resistance. We can write
Rtotal = Rmin + Rvar = Rmin + v2/P
i = v/Rtotal = v/(Rmin + v2/P) = 1/(Rmin/v + v/P)
For low v, i = v/Rmin. For high v, i = P/v. The corresponding
PSpice statement is
gload n1 n2 value = {1/(RMIN/v(n1,n2) + v(n1,n2)/PLOAD}
Modeling Lossy
Transmission Lines
The Design Center Source newsletter, January 1992
PSpice adds a lossy line parameter set to the T device to support
modeling lossy transmission lines. You can specify a lossy line
in terms of its electrical length and the resistance, inductance,
capacitance, and conductance distributed along the length. This
allows you to model loss and dispersion in a non-ideal line.
The internal model used in connection with these parameters is
a “distributed” model. That is, the line response is computed
using impulse responses instead of the commonly used ladder
structures associated with lumped models. Though the lumped
ladder model can be simulated in any SPICE simulator, the
distributed approach has several advantages, especially
accuracy.
The lumped model assumes that the line can be represented by
a series of short segments which include a series resistor and
inductor along with a shunt resistor and capacitor. If you string
a large enough number of these segments together, you will
have a discretized model of the distributed nature of the line (see
Figure 73).
100. V(100) is plotted using Probe for each of the three models.
The results are shown in Figure 74.
The lumped model’s CPU time goes up very quickly when you
improve the resolution of the ladder. Doubling the number of
segments from 64 to 128 doubles the transient analysis time and
quadruples the read-in time.
A special case worth noting is the distortionless line, which is
characterized by having R/L equal to G/C. There is no
dispersion when this is true, and PSpice’s internal model doesn’t
need to perform any impulse response calculations. The CPU
time will consequently be about the same as for the ideal case.
Modeling
Potentiometers and
Variable Resistors
MicroSim Corporation Newsletter, October 1990
We have received several inquiries on how to model a
potentiometer. These requests are closely related to other
applications of variable resistors, such as strain gauges. We will
review these as well.
Electrically, a potentiometer consists of two resistors connected
in series. The specification for the potentiometer consists of:
• the total resistance (R), and
• the pot’s “setting” (SET). That is, where the center tap is set.
A convenient way to describe this is to define SET to be 0
when the tap is all the way at the “bottom” and 1 when it is
all the way at the “top.”
The potentiometer can then be implemented by this subcircuit.
The values 1.001 (instead of 1) and .001 (instead of 0) are used
.SUBCKT POT (TOP, BOTTOM, TAP) PARAMS: R=1K SET=.5
RTOP TOP TAP {(1.001-SET)*R}
RBOT TAP BOTTOM {( .001+SET)*R}
.ENDS
Here a 10k pot is used in 6 runs, having the settings 0, .2, .4, .6,
.8, and 1.
In schematics there is a symbol for a potentiometer located in
“breakout.slb”. The example circuit below shows how the pot
may be used. The example shows an adjustable regulator. The
pot R1 is swept to show the adjustment range of the regulator.
.SUBCKT GAUGE (IN+ IN- OUT+ OUT-) PARAMS: R=1K F=0 SENS=1e-3
RUL IN+ OUT+ {R*(1+F*SENS/2)} ; upper left
RUR IN+ OUT- {R*(1-F*SENS/2)} ; upper right
RLL IN- OUT+ {R*(1-F*SENS/2)} ; lower left
RLR IN- OUT- {R*(1+F*SENS/2)} ; lower right
.ENDS
Modeling Quartz
Crystals
The Design Center Source newsletter, October 1987
We have received many questions about modeling quartz
crystals. We recommend the following model for a quartz
crystal:
LCRYSTAL 1 2 12henry
CSERIES 2 3 20Pfarad
RCRYSTAL 3 4 30Kohm
CPARALLEL 1 4 20Pfarad
Modeling Schottky
Diodes
The Design Center Source newsletter, October 1987
Another question that is asked regularly is: how does one set the
forward voltage drop of a diode, especially a Schottky diode?
Sometimes people try to use the model parameter VJ to set the
forward voltage drop. However, VJ only affects the depletion
capacitance, not the DC current.
The correct parameter to change is IS. Referring to the forward
DC current equation of the diode as listed in the MicroSim
PSpice Reference Manual.
I = IS·(eV/N·Vt - 1)
or, solved for V,
V = N·Vt·log(I/IS + 1)
The forward voltage drop, V, depends on the current, I, but only
weakly. V increases by 60 millivolts for each factor of 10 that I
increases. Alternatively, V increases by 60 millivolts for each
factor of 10 that IS decreases. So, the forward voltage drop for
your circuit’s bias conditions can be set by changing IS in the
diode’s .MODEL statement. For Schottky diodes, values of IS
are larger than for diffusion diodes of the same area.
The model parameter N can also be used to adjust the forward
voltage drop, but changing N will make the I-V curve deviate
from the normal slope of a decade per 60 millivolts. We do not
recommend changing N in order to model Schottky diodes.
These comments also apply to the base-emitter junction of the
bipolar transistor. Adjusting IS will change the b-e forward
voltage drop. This is useful when modeling Germanium
transistors, for example. One temptation to resist, however, is to
model a Darlington transistor pair as one device with a very high
beta. The forward b-e voltage drop for the pair would need to be
about 2·0.7 = 1.4 volts. At a nominal forward current of 1
milliampere, this leads to IS = 1mA/2E23 = 5E-27. This value is
so small that on the VAX, which has a limited exponent range,
it can cause numerical problems. Also, for IS as low as 5E-27,
the I-V curve does not have the correct shape at the low end: the
Modeling Schottky Diodes 158
knee is much too sharp. The real device’s forward voltage drop
is the sum of two voltage drops with more rounded knees. All of
this is to say that a Darlington should be modeled by connecting
two transistors, as in the real device.
References
[1] D. A. Hodges and H. G. Jackson, Analysis and Design of
Digital Integrated Circuits, McGraw-Hill.
159
Modeling Voltage-
Controlled Resistors
and Capacitors
MicroSim Corporation Newsletter, January 1991
The MISC.LIB library file contains subcircuit models for
voltage-controlled reactances and admittances. These can be
used to make voltage-controlled resistors and capacitors. The
following two examples illustrate the use of a voltage-controlled
resistor to control the Q of a series RLC filter network, and the
use of a voltage-controlled capacitor to change the frequency of
oscillation of a Wien bridge oscillator.
Note This modeling technique is not applicable to
capacitances whose values change slowly. It
applies to cases where the capacitance changes
very quickly between constant values. The
application note “A Nonlinear Capacitor Model for
Use in PSpice” illustrates a better model for
capacitors whose value depends on their own
terminal voltages.
L1 1 2 10mH
C2 2 3 1uF
* Control Reference Floating Z Subcircuit
X_VCRes vin 0 Rref 3 0 ZX
Rref Rref 0 50ohm
*
.STEP PARAM ControlVoltage 0.5, 2, 0.5
Vcontrol vin 0 DC {ControlVoltage}
Rg1 4 5 10k
Rg2 2 0 9.5k
Rg3 2 5 10k
D1 4 6 D1N750
D2 5 6 D1N750
R1 1 0 10k
R2 3 4 10k
X_VoltConCap1 VcoIn 0 Ref1 1 0 YX
CapRef1 Ref1 0 15nF
X_VoltConCap2 VcoIn 0 Ref2 3 1 YX
CapRef2 Ref2 0 15nF
Vcontrol VcoIn 0
+ PULSE( 1.0V 1.2V, 25ms, 1uS, 1uS, 50ms, 50ms )
.TRAN 500u 50m 0 50u
.IC V([Ref1])=1v
.LIB
.PROBE
Modeling Voltage-
Variable Capacitors
The Design Center Source newsletter, April 1992
Some of our customers have asked how to model a voltage-
variable capacitor. The example circuit file shown on the next
page describes a test circuit that contains a voltage-variable
capacitor. This capacitor is constructed by way of a TABLE
function embedded in the VALUE extension to the G (voltage-
controlled current source) device. This model is a better
representation of a varicap device than the commonly used YX
device
The Probe plot in Figure 82, shows capacitance versus
controlling voltage for a voltage-variable capacitor similar to
1N4155.
A Nonlinear Capacitor
Model for Use in PSpice
Theory
The charge and current fomulas for a linear capacitor are:
Q = C * V (1a)
I = C * dV(t)/dt (1b)
For a nonlinear (voltage-dependent) time-independent capacitor
these formulae become:
Q = ∫ C(V) * dV (2a)
I = C(V) * dV/dt (2b)
This applies to cases where the capacitance has been measured
at different bias voltages.
Some would argue that for a nonlinear capacitor,
Q = C(V) * V (3a)
where V is a function of time. Therefore,
I = dQ/dt = C(V(t)) * dV(t)/dt + dC(V(t))/dt * V(t)(3b)
The Model
The nonlinear capacitor is modeled by a subcircuit in which the
capacitor is replaced by a controlled current source, Gout,
whose current is defined by (2b). In the subcircuit, the time
derivative, dV(t)/dt, is measured by applying a copy of the
voltage across Gout to a known capacitance, Cref, and
monitoring its current. The C(V) function in the subcircuit is
arbitrary.
Example Model
The value of the nonlinear capacitor model in this example has
a second order polynomial dependence on its voltage. This is
equivalent to the standard PSpice capacitor model, whose linear
and quadratic coefficients, VC1 and VC2, can be defined in a
.MODEL statement.
* Polynomial Nonlinear Capacitor Model
.subckt polycap 1 2 params: C0=1u C1=0 C2=0
Ecopy 3 6 1 2 1.0 ; copy V(t)
Vsense 0 6 0V ; Ammeter
Cref 3 0 1.0E-6 ; to get 1E-6*dv/dt
; *1E-6 to avoid ridiculous currents
Gout 1 2 VALUE =
+ {(C0 + C1*V(1,2) + C2*V(1,2)*V(1,2)) * I(Vsense)*1E6 }
* ------------------------------------ -------------
* C(V) dV(t)/d
.ends
*$
.lib my_misc.lib
Vin 1 0 dc 2 ac 1 pwl(0,1V 59s,60V)
X1 1 0 polycap PARAMS:C0=1u C1=0.01u C2=0.0001u
.probe
.end
Note The IC1 and IC2 setpoints (or the .IC statement)
are generally the recommended method for
specifying initial conditions; not the IC= optional
parameter with the Use Init. Conditions option in
the Analysis/Setup/Transient dialog box (or the
UIC option in the .TRAN statement). Setpoints are
the only way to set initial conditions for nonlinear
capacitor models like this one.
Obtain S-Parameter
Data from Probe
The Design Center Source newsletter, April 1994
RF and microwave circuit designers frequently express the input
and output characteristics of circuits in terms of scattering
parameters (s-parameters). By adding two subcircuits, s-
parameter data can be printed to the output file or displayed in
Probe. The method presented here is qualified for two-port
networks, but the concept can be extended for n-port networks.
Theory
S-parameters measure the ratio of the incident and reflected
signal. The incident signals are defined as a1 and a2. The
reflected signals are defined as b1 and b2. The incident and
reflected signals are related to voltages and currents at ports 1
and 2 by
V1 + Z 0 I1
a1 = -------------------------- (1)
2 Z
V1 – Z 0 I1
b1 = ------------------------- (2)
2 Z
V2 + Z 0 I2
a2 = -------------------------- (3)
2 Z
V2 – Z 0 I2
b2 = ------------------------- (4)
2 Z
The scattered waves are related to the incident waves by the
following set of linear equations:
b1 = S 11 a1 + S 12 a2 (5)
b2 = S 21 a1 + S 22 a2 (6)
or, in matrix form as
175
b1 S 11 S 12 a1
= (7)
b2 S 21 S 22 a2
V1 – Z 0 I1 Z – Z0
S 11 = ------ = -------------------------- = ---------------- = 2 ---------------- – 1
b1 Z
a1 V1 + Z 0 I1 Z + Z0 Z + Z0
(8)
this way, the S_TR pin will have a known label (s21 in this case)
when analyzing simulation results within Probe.
Radiation Effect
Modeling
The design of electrical systems for military and space
applications requires a consideration of the effects of transient
and total dose radiation on system performance. Simulation of
radiation effects using PSpice helps to identify critical circuit
components which could cause system failure and gives
guidance for radiation hardening of the system. The following
information is intended to provide a starting point for those
interested in using PSpice for radiation effects analyses.
Dose-Rate Effects
When semiconductor devices such as diodes, transistors, and
integrated circuits are exposed to ionizing radiation, such as
gamma-rays or X-rays, hole-electron pairs are generated within
the semiconductor material. These free carriers result in the
generation of photocurrents as they are swept through the
depletion regions of the p-n junctions of the device or integrated
circuit. The magnitude of these currents can be orders of
magnitude greater than normal signal levels and can result in
temporary or permanent system failure. PSpice can be easily
used to model this type of transient effect.
The magnitudes of the photocurrents are often obtained from
experimental data, but can be obtained from theoretical
expressions if information on the fabrication process is
available. Usually, if an integrated circuit process has been
developed for use in a radiation environment, dosimetry
measurements have been made on each of the junction types (for
example, source, drain and well-to-substrate diffusions in a
CMOS technology). Therefore, the photocurrent data is directly
available. If no experimental data is available, it is possible for
the integrated circuit designer to use a theoretical expression for
photocurrent generation. Wirth and Rogers [1] developed the
following equation for a rectangular pulse of ionizing radiation.
183
D12 10 2 DMOD
FD12 10 2 VPDMOD
D20 7 6 DMOD
FD20 7 6 VPDMOD
Single-Event Upset
Single-Event Upset (SEU) occurs when a high-energy ionizing
particle, such as heavy ions, alpha particles or protons, irradiates
a circuit or passes through an integrated circuit causing a
disruption in the system logic. The most common effects of SEU
are logic upsets in high-density digital circuits particularly
memories and the registers in microprocessors. Exact upset
levels are very difficult to predict because of the complex nature
of the physical mechanism involved. However, simulations can
aid greatly in evaluating design and process changes to increase
the hardness of the circuit to this type of event.
One analysis procedure for SEU is similar to that used for dose-
rate effects discussed earlier. A current generator is inserted in
the circuit description to model the charge collected on an
assumed susceptible node as a result of the particle hit.
Messenger [3] developed the following analytical
approximation for this current
I(t) = Io·sec(theta)·( e-t/α - e-t/β )
where:
Io is approximately the maximum current,
.FUNC VTO_DOSE(DOSE)
+1.65*(1 - 4.18E-6*DOSE + 2.76E-12*DOSE*DOSE)
References
[1] J. L. Wirth, S. C. Rogers, “The Transient Response of
Transistors and Diodes to Ionizing Radiation,” IEEE
Transactions on Nuclear Science, NS-11(5):24-38,
November 1964.
[2] Handbook of Modeling for Circuit Analysis Including
Radiation Effects, Air Force Weapons Laboratory, AFWL-
TR-79-86, Albuquerque, New Mexico, May 1979.
[3] C. G. Messenger, “Collection of Charge on Junction
Nodes from Ion Tracks,” IEEE Transactions on Nuclear
Science, NS-29(6):2024, December 1982.
Signal Integrity of Stub Versus Daisy-Chain Layouts 190
The Example
The schematic in Figure 103 illustrates two alternative design
approaches for a circuit in which one TTL output feeds a total of
five TTL inputs. Three of the driven devices are gates; the other
two are flip-flops. A simple pulse is used as the stimulus.
The first approach shown in the upper part of the schematic will
be laid out with stub connections. The second approach shown
in the lower part of the schematic will be laid out as a daisy
191
Reflections
Reflections arise because the traces, considered as transmission
lines, have a characteristic impedance (Z0). Any mismatch
between the impedance of the device driving the line, the line
itself, and the final termination of the line, will result in
reflections. The magnitude and phase of the reflected signals
depend on the complex impedance presented by the load(s) on
the line.
Stub Case
When the step reaches a T junction, it splits into two. Part of the
energy travels down the stub and is then mostly reflected back
when it encounters the high impedance load at the end of the
stub. This introduces a notch of twice the delay of the stub into
the wave traveling down the main signal path. The wave
reflected from the stub will travel in both directions along the
main signal path. If there is an impedance mismatch between the
driver and the line, some of this energy will be reflected in the
forward direction. With several stubs, very complex waveforms
may be observed.
Daisy-Chain Case
As the step travels down the line, it encounters impedance
changes at device connections, due to the resistive and
capacitive load placed on the line. These changes in impedance
cause some energy to be reflected back along the line. As above,
if there is a mismatch between the driver and the line, some of
this energy will be reflected in the forward direction. The
impedance changes at the connection points are much smaller,
however, than when stubs are used. This means that the
waveform will remain relatively clean as it travels along the
signal path.
Termination
If the line is not terminated at the far end, most of the incident
energy will be reflected back along the line. This will be
scattered by the stubs and loads, and eventually arrive back at
the driver. If there is a significant mismatch between the driver
and the line, then some of this energy will be reflected in the
forward direction, and so on. (Traditionally, a Bergeron diagram
is used to derive the magnitude of the various reflections in a
mismatched system.)
Signal Integrity of Stub Versus Daisy-Chain Layouts 194
L
Z0 = ----
C
Td = L⋅C
Summary
High-speed PC board design requires that transmission line
effects be taken into consideration when delays are comparable
with edge speeds of the logic used in the design.
Board layout strategy can have a pronounced effect on the
integrity of the signals in the physical implementation of a
design. Poor signal integrity compromises noise margins,
resulting in products which may fail intermittently under data-
dependent conditions.
Signal Integrity Analysis (Polaris) allows the effects of board
layout and fabrication to be incorporated into the simulation of
a design. The designer can verify that the design operates as
intended in the presence of these parasitic effects.
Simulating High-Q Circuits Using Open Loop Response 198
Simulating High-Q
Circuits Using Open
Loop Response
Introduction
The length of time it takes to perform a transient simulation on
a high-Q oscillator circuit makes simulation inefficient. The
dominant time constant of the circuit, due to the Q of the crystal,
means that the simulation must run a minimum of Q cycles
before the circuit reacts. And, because you must wait Q cycles,
there is no way to force an oscillator to a steady state condition.
For a crystal with moderately high-Q (20,000), it can take close
to a million cycles before the oscillator reaches a steady state
condition. Besides the long time required for the simulation to
run, the data file created by the simulation will be extremely
large.
But, it is possible to use AC analysis to simulate high-Q circuits.
These results can be used to investigate whether the loop gain
and phase are conducive to producing a stable oscillation.
Theory
This approach to measuring loop gain relies on the voltage and
current feedback theory as described in detail in A Guide to
Circuit Simulation and Analysis Using PSpice, references [1]
and [2]. The circuit is analyzed by injecting a current to measure
the current gain, and a voltage to measure the voltage gain of the
circuit.
Previously, the circuit to be analyzed was treated as a subcircuit,
with the signal path, broken to make measurements, “pulled
out.” The subcircuit was then used twice: once so that a voltage
could be injected, and again so that a current could be injected.
199
I ( V1 )
Ti = --------------
I ( V2 )
V(A)
Tv = -------------
V(B)
To perform the current gain and the voltage gain portions of the
analysis, it is necessary to perform a parametric analysis in
addition to the AC analysis. This can be accomplished by
placing a PARAM symbol on the schematic. In the example
shown in Figure 108, the parameter is named ACVAL, and the
default value is set to 0. The parametric sweep is set to run the
AC analysis with the global parameter ACVAL set to each of the
values defined in the value list. The value list for this analysis
contains two values: 0 and 1.
Simulating High-Q Circuits Using Open Loop Response 200
Once the voltage gain and the current gain are calculated, the
total loop gain can be determined by the following relation:
1 1 1
------------- = --------------- + ----------------
T+1 Ti + 1 Tv + 1
Therefore,
T = ( ( Ti + 1 ) || ( Tv + 1 ) ) – 1
where
1 x⋅y
x || y = ------------ = ------------
1 1 x+y
--- + ---
x y
The symbol for this subcircuit can be a simple box with 2 pins
(Figure 106), one on each side:
The attributes for the symbol are show in Figure 107 below.
Example Circuit
Figure 108 shows a 100 kHz crystal oscillator circuit with a Q
of 20,000. To analyze this circuit, the LOOPGAIN subcircuit is
inserted into the feedback path. The A node is connected to the
output side of the feedback path and the B node is connected
where the feedback is summed into the circuit. If the subcircuit
is inserted backwards, the results will show a loss, or be upside
down. The AC analysis is set up to sweep the circuit from 99.9
kHz to 100.1 kHz using a linear sweep of 100 points.
Simulating High-Q Circuits Using Open Loop Response 202
Results
The results (Figure 109, Figure 110, and Figure 111) for this
oscillator circuit show the peak gain and a 180 degree phase shift
at the resonant frequency of the crystal. The tests show that this
circuit will operate as an oscillator.
References
[1] Paul W. Tuinenga, SPICE: A Guide to Circuit
Simulation and Analysis Using PSpice. Prentice-Hall, 1988,
pages 59-65.
[2] Paul W. Tuinenga, SPICE: A Guide to Circuit
Simulation and Analysis Using PSpice. Second Edition,
Prentice-Hall, 1992, pages 81-88.
Simulating Power Circuits 205
Simulating Power
Circuits
MicroSim Corporation Newsletter, October 1988
U.C. Berkeley developed the SPICE program to simulate
integrated circuits. In fact, the acronym SPICE stands for
Simulation Program with Integrated Circuit Emphasis. Because
of the “integrated circuit emphasis,” the focus was on accurate
simulation of circuits containing many small, fast transistors.
However, the central algorithms are not restricted to such
circuits. They work equally well for discrete components, power
circuits, and microwave designs. But because of the original
emphasis on integrated circuits, the default values of some
overall parameters are not optimal for other classes of circuitry.
We would like to make some comments on power electronics in
particular.
Diode and Transistor Parasitics
The default value for all parasitic resistances and capacitances in
PSpice .MODEL statements is zero. This means that if you
model a diode without specifying the parasitic resistance (RS)
and the zero-bias pn capacitance (CJO), the diode will have no
ohmic resistance and no junction capacitance. Not only is this
unrealistic, but it can lead to numerical problems in some power
circuits.
The problem with having RS equal zero is that the circuit may
have nothing to limit the forward current through a diode. To
take an extreme example, forward-biasing a diode with a 2-volt
source can cause the diode to try to conduct megamperes of
current. The forward current of an ideal diode (RS = 0) varies
exponentially with voltage (please see the diode equations in the
MicroSim PSpice Reference Manual for more details). Without
an ohmic resistance to limit it, the current can easily become
large enough to cause numerical problems.
206
An Example
Consider this schematic diagram:
N 0.7522 NR 2 RS 1.220
Capacitance Problems
A different problem can arise if both CJO and transit time (TT)
equal zero: the diode then has a zero switching time. Without
capacitance to limit the diode’s switching speed, a simulation
involving transient analysis may try to make a transition in zero
Simulating Power Circuits 207
time. This will cause the program to cut back the internal time
step, successively making it smaller and smaller, until the
program finally gives up and reports a transient convergence
problem.
In both cases the conclusion is the same: if you model a diode or
transistor, be sure to include parasitic resistances and
capacitances.
Tolerances
The main error tolerance in PSpice defines the relative accuracy
of voltages and currents (RELTOL), and a has default value of
0.001 or 0.1%. This default is not a source of concern for power
circuits. However, the default values for best accuracy of
voltages (VNTOL) and best accuracy of currents (ABSTOL)
may need to be changed for circuits handling large voltages and
currents.
The default values of VNTOL and ABSTOL are 1 µV and 1 pA
respectively. The double precision arithmetic used by PSpice
has about 16 digits of accuracy. Four of these are lost in the
course of solving the circuit matrix, leaving a dynamic range of
about 12 orders of magnitude.
If your circuit has currents in kiloamperes and an ABSTOL
setting of 1 pA, the current ratio will exceed this range, possibly
causing a convergence problem. We recommend setting
ABSTOL equal to 1 µA in this case. If your currents are in
megamperes, we recommend setting ABSTOL to 1 mA.
In general, we recommend setting VNTOL and ABSTOL about
9 orders of magnitude smaller than the typical voltages and
currents in the circuit. Although the VNTOL default value of 1
µV meets this criterion for most power circuits, it’s better to set
ABSTOL higher than its default value of 1 pA.
208
Solving Differential
Equations with
MicroSim PSpice
by Ian Wilson, Vice President of Engineering, MicroSim
Corporation
The motivation for this newsletter article was a published article
(reference [1]). Thanks to the authors for their interest and for
providing the data needed to produce this article.
Overview
MicroSim PSpice is well known for its ability to solve the
equations which arise in circuit analysis. What is less well
known is that MicroSim PSpice can also be used to solve
problems in other domains which can be expressed as
differential equations. This article presents some examples of
using MicroSim PSpice as an “analog computer” to solve sets of
differential equations describing the kinetics of a chemical
reaction, and shows MicroSim PSpice Optimizer being used to
fit parameters to this system from measured data.
rearranging a little,
Solving Differential Equations with MicroSim PSpice 209
dV –V
-------- = -------
dt τ
where:
τ = RC
V 0 e –t ⁄ τ
dx 1
--------- = – k 1 x 1 (decay)
dt
dx 2
--------- = – k 2 x 2 (decay)
dt
dx 3
--------- = k 31 x 1 + k 32 x 2 (creation)
dt
dx 1
– --------- = ( K 1 Rx 2 + K 2 x 1 ) K 3 Qx 3 + 2K 3 Qx 3 + K 4 Rx 1 x 2
dt
dx 2 2K 3 Qx 3
– --------- = K 1 x 2 K 3 Qx 3 + --------------------- + K 4 x 1 x 2
dt R
dx 3
--------- = K 3 x 3
dt
dx 4
--------- = K 4 x 1 x 2
dt
Summary
MicroSim PSpice can be used to solve single and coupled
ordinary differential equations by setting up feedback loops
around integrator blocks. This is the same technique used by
analog computers to solve differential equations.
MicroSim PSpice Optimizer can be used to fit model parameters
to measured data in this type of system as well as for more
traditional applications such as fitting diode model parameters.
The various files used in the examples shown in this article can
be downloaded from our bulletin board system. To do this,
select [T]ech Support from the main menu, [6] File Transfer, [1]
Download User Requested Files, and select “diffeq.exe” for
download. Our BBS number is (714) 830-1550 (14.4k-1200, N-
8-1).
References
“Estimating Model Parameters with HiQ,” G. Huvard and
E. Eller, Scientific Computing & Automation, February
1995.
Snubbing Resistors 215
Snubbing Resistors
MicroSim Corporation Newsletter, October 1989
In simulating circuits containing inductors, you can run into
spurious ringing between the inductors and parasitic
capacitances elsewhere in the circuit. Consider, for example, the
rectifier bridge circuit shown in Figure 116.
D_D1 3 4 D1N4001
D_D2 3 5 D1N4001
D_D3 4 0 D1N4001
D_D4 5 0 D1N4001
V_V1 1 0
+SIN 0 120 60 0 0 0
R_R2 1 2 .1
C_C1 5 4 10u
K_TX1 L1_TX1 L2_TX1 .99
L1_TX1 2 0 100mH
L2_TX1 3 0 100mH
D_D1 3 4 D1N4001
D_D2 3 5 D1N4001
D_D3 4 0 D1N4001
D_D4 5 0 D1N4001
V_V1 1 0
+SIN 0 120 60 0 0 0
R_R2 1 2 .1
C_C1 5 4 10u
K_TX1 L1_TX1 L2_TX1 .99
L1_TX1 2 0 100mH
L2_TX1 3 0 100mH
R_RSNUB 3 0 62.8
Temperature Effects on
Monte Carlo Analysis
The Design Center Source newsletter, July 1993
The MicroSim PSpice user’s guide states the following:
“The statistical analyses perform multiple runs, as does the
.TEMP command. Conceptually, the .MC [Monte Carlo] or
.WCASE [sensitivity/worst-case] loops are inside the .TEMP
loop. However, since both temperature and tolerances affect the
model parameters, one quickly gets into some rather detailed
questions of how the two interact. Therefore, we recommend not
using .TEMP when using .MC or .WCASE in the same circuit.”
The purpose of this article is to elucidate the interaction of
statistical—Monte Carlo or worst-case—and temperature
analyses. Monte Carlo and temperature analyses are discussed
in the ensuing examples. The same principles apply to the
interaction of worst-case and temperature analyses.
To illustrate how the two interact, consider the circuit file setups
in Figure 120-and Figure 122. Because the MOSFET
parameter, KP, is the only parameter that is affected by both
temperature and Monte Carlo, we will limit this discussion to
how Monte Carlo and temperature affect this parameter.
where
KP' = Monte Carlo adjusted value,
rand = random number, where -1 ≤ rand ≤ 1,
and
DEV = tolerance assigned to parameter.
Temperature Effects on Monte Carlo Analysis 221
KP' is only calculated for the second and third passes. For three
passes with a uniform distribution and a 10% tolerance, rand
assumes the values of -0.8657 for pass 2 and -0.6119 for pass 3.
The results for this simulation are listed in Table 5. These results
were verified using the equation above.
The Monte Carlo run with temperature (Figure 122) illustrates
the effect temperature changes have on the Monte Carlo passes.
At 27°C, the results should match those obtained from the
Monte Carlo run without temperature changes (the previous run
based on Figure 123). At 50°C, 75°C, and 100°C, the nominal
Monte Carlo results should match the results obtained in the run
where only temperature was varied (compare to Table ). The
results of this analysis are summarized in Table . Upon
inspection of the analysis results, it can be seen that the Monte
Carlo adjustment is made first, followed by compensation for
temperature. This may seem odd at first, but when considering
the real device, this makes sense. Consider three MOSFETs that
are of the same type. The transconductance of the three will vary
at the same temperature, but the temperature dependence of the
transconductance is approximately the same for all three
devices.
Table 5 KP Values as Temperature Varies
Temperature
KPTEMP (*10-3)
(°C)
27 2.00000
50 1.79032
75 1.60099
100 1.44282
1 (nominal) 2.00000
2 1.82686
3 1.87762
222
2 1.82686 1.82686
3 1.87762 1.87762
KPMC/TEMP (*10-3) at
Pass KPMC (*10-3)
50°×C
2 1.82686 1.63533
3 1.87762 1.68077
KPMC/TEMP (*10-3) at
Pass KPMC (*10-3)
75°×C
2 1.82686 1.46239
3 1.87762 1.50302
KPMC/TEMP (*10-3)at
Pass KPMC (*10-3)
100°×C
2 1.82686 1.31792
3 1.87762 1.35453
Temperature
Monte Carlo
Temperature
Adjustment
Analysis
Figure 126 (left) Test circuit for the data amplifier and
comparator (U1) portion of an RF MODEM design.
The VSF (voltage-scale-factor) attribute for Vdata is set to 50
uV—the smallest amplitude to which the circuit must respond.
The TSF (time-scale-factor) attribute for Vdata is set to
0.0001—the period (10 kbaud) of the desired random data
stream.
Rlp and Clp form a low pass filter to limit the bandwidth of the
incoming signal and Chp sets the circuits’ low frequency
response. Rleak is included to model Chp’s leakage effects.
Plots of U1’s comparator and amplifier outputs for different
values of Chp are shown in Figure 127. Notice the missing bit
decisions in U1’s comparator output when Chp is too small.
230
Use Constrained
Optimization to Improve
Circuit Performance
Many applications of optimization to electronic design are
naturally expressed as “minimize an objective while meeting a
set of requirements.” For example, the objective might be power
consumption; the requirements might be minimum allowable
gain and 3 dB bandwidth. In order to solve this type of problem,
a constrained optimization algorithm is required. When the
constraints are nonlinear functions of the parameters, the
problem is one of optimization with nonlinear constraints.
Paragon, the most recent addition to MicroSim’s Design Center
family, is designed to tackle this type of problem. It will handle
both constrained and unconstrained problems, with either a
single objective function or the sum of squares of a set of
objective functions being minimized. Special techniques are
required to solve constrained optimization problems.
Attempting to use unconstrained optimizers is inaccurate (the
result may not be the constrained optimum) and inefficient
(many wasted simulations are required to solve unconstrained
subproblems).
“Goal” Specification
“Constraint” Specification
* Value at Given X
AtX(1,where) = y1
{ 1 | sf xvalue(where) !1; }
Summary
Many problems in analog performance optimization naturally
involve nonlinear constraints. Paragon has been developed to
tackle this type of problem, which is difficult for the
unconstrained optimizers typically found in the EDA industry.
Paragon can solve optimization problems efficiently and
accurately, and reveals much useful information about the
tradeoffs present in the design at the optimum point.
240
What To Model?
The most important factors in ferrite bead-based design are:
• Impedance vs. bead size
• Impedance vs. frequency
• Impedance vs. DC current bias
• Impedance vs. number of turns on the bead
By modeling these parameters, a wide range of practical circuits
can be realistically simulated.
Use Ferrite Bead Models to Analyze EMI Suppression 241
Bead #1
Bead #2
Bead #1
Bead #2
frequency
DC bias
number of turns
size
Frequency (Hz)
Figure 135 Ferrite beads come in all shapes and sizes. While
it may seem intuitive that bead #2 has greater inductance than
bead #1, just how much more inductive is it? This question and
many more can be answered by using the PSpice ferrite bead
models .
Use Ferrite Bead Models to Analyze EMI Suppression 243
*. A bead measuring 0.43” x 0.2” x 0.08” (Len, OD, ID) was used
as the standard bead to which all others were scaled.
244
+
-
+ +
- -
Figure 136 The basis for modeling ferrite beads is the “low
Q” parallel R-L-C circuit. A single R-L-C network is modified
by adding the effects of DC bias, size, and number of turns in the
models. This allows one model to be used in any situation.
Use Ferrite Bead Models to Analyze EMI Suppression 245
* * Impedance multiplier * *
EOUT Z1 10 VALUE={V(GEOM)*V(BIAS)*V(ZREF)}
VSENSE 10 Z2 DC 0
GCOPY 0 ZREF VALUE={I(VSENSE)}
.ENDS
the bead, DC bias level, number of turns, and the reference bead
impedance to produce the correct equivalent impedance.
.PARAM TURNS=1
.STEP PARAM TURNS LIST 1,2,3,4
VIN 10 0 AC 1 DC 5
RIN 10 20 0.1
CT 30 40 10U
RT 40 50 0.75
LT 50 0 15N
CC 30 60 0.01U
RC 60 70 0.15
LC 70 0 6N
RLOAD 30 0 5
.END
Bead_73 Sub-Schematic
It can also be seen that increasing the turns on the bead above
two does not significantly increase the filter rejection. This is
due to the effects of the DC bias increasing proportionally to N.
The core can only support so many amp-turns before
saturation—hence, the diminishing returns of attenuation as the
turns are increased above a certain point.
References Cited
Fair-Rite Soft Ferrites, 11th edition catalog, POB J, One
Commercial Row, Wallkill, NY 12589
Hageman, S. “Improve Simulation Accuracy When Using
Passive Components,” The Design Center Source, April
1994, MicroSim Corporation, Irvine, CA.
Acknowledgments: Special thanks go to William Kimmel
of Kimmel Gerke Associates for laying the groundwork for
modeling EMI ferrites in his article, “Wide Frequency
Impedance Modeling of EMI Ferrites,” published in the
IEEE 1994 Symposium on EMC. Mr. Kimmel is a well
known EMI/EMC consultant and lecturer. He may be
reached at 1544 North Pascal, St. Paul, Minnesota, 55108,
(612) 330-3728.
Biography: Steve Hageman is an analog designer
specializing in power conversion. He owns the consulting
firm, Applied DC, and may be reached by voice/FAX at
(510) 687-0483.
252
Important Notes
The “dot” convention for the coupling is related to the direction
in which the inductors are connected. The dot is always next to
the first pin to be netlisted. When the inductor symbol, L, which
is shipped with Schematics is placed without rotation, the
“dotted” pin is the left one. Edit/Rotate (<Ctrl R>) rotates the
inductor +90deg, which makes this pin the one at the bottom,
etc.
Certain rules must be followed when setting the attributes for
coupling symbols and the inductors they affect.
Nonlinear CORE models may be applied to one or more
inductors, so:
1 The L1 attribute must have a value (name); the other Li may
be blank.
2 The MODEL attribute must reference a CORE model.
3 The VALUE attributes of the affected inductor symbol(s)
must be set to the number of windings (turns).
Linear coupling must be applied two or more inductors
(K_Linear only):
1 The L1 and at least one other Li attribute must have values
(names); the rest may be left blank.
2 The MODEL attribute must be left blank.
3 The values assigned to the inductor symbols must be in
Henries.
Using Multipliers for Signal Processing 255
Frequency Doubling
Another application for a multiplier is as a frequency doubler
(see Figure 143). Connecting a sinusoidal source
simultaneously to both inputs of a multiplier will yield a signal
with double the input frequency. The first multiplier, Xmul,
produces a waveform that has one-half the amplitude of the
original input signal with a DC offset of one-half the input
waveform’s peak value. The DC offset is removed with a
voltage source called Voffset. The amplitude of the original
258
.PARAM FundFreq=1
.PARAM VinputPK=1
EMULT1 1 0 VALUE {V(2)*V(2)}
EMULT2 DoubleOut 0 VALUE {V(3)*V(4)}
Vfundamental 2 0 SIN (0 {VinputPk} {FundFreq})
VOffset 4 1 DC {-VinputPK/2} ; remove DC offset
V2Volts 3 0 DC 2 ; restore the amplitude
.tran 1ms 5s
.probe
.END
Using PSpice to
Simulate the Discharge
Behavior of Common
Batteries
By Steven C. Hageman APPLIED DC
Note: An article based on this manuscript appeared in EDN
Magazine, October 28, 1993
As the use of battery-operated electronic devices become more
widespread, so too does the need for simulation models used to
analyze the operating characteristics of batteries. The most
common batteries in use today are: non-rechargeable Alkaline
cells, rechargeable Nickel-Cadmium (NICD) cells, Nickel-
Metal-Hydride (NIMH) cells, and sealed Lead-Acid cells.* This
article presents PSpice behavioral models for simulating the
four battery types mentioned above.
Battery Variables
All of the battery types modeled here share some common
characteristics and deviations from ideal during discharge.
• The capacity of any group of cells may vary from +/- 20%
up to +/- 50% when shelf time, number of recharge cycles,
and manufacturing variances are taken into account. For this
reason, parameters that change less than 15% are not
considered in these models.
• The capacity of a cell decays with time after a complete
charge. For Alkaline cells, this decay takes years to affect
the usable capacity. For NICD and Lead-Acid batteries, the
decay is 10 to 30% per month. This effect may be simulated
by specifying a reduced state of charge at the start.
Behavioral Modeling
Figure 145 shows the results of discharging seven identically
rated NICD cells to see how well their capacity track. These
cells were in weekly use for 1 to 2 years and exhibit a 2:1 spread
in measured capacity. Alkaline and Lead-Acid batteries have
similar variations even between new cells.
This indicates that there is little practical value in overly
accurate models. Therefore, only those battery characteristics
that present a 10 to 15% or greater change during discharge are
modeled.
1.4
CELL VOLTAGE (VOLTS)
1.3
1.2
1.1
1.0
0.9
0.8
0.7
0 10 20 30 40 50 60
where:
E_Cell signifies the PSpice call to a VCVS named E_Cell
(0,1.5) (0.5,1.3) (1.0,0.0) are the table pairs that are output to +OUT
and -OUT based on the value of V(x). If V(x) is 0, signifying 0%
discharge, then E_Cell will have a value of 1.5 Volts (table pair 1).
If the cell is 50% discharged then the second table pair will be used
and so on. For in-between discharge values, PSpice uses linear
interpolation between the table pairs.
The table entries indicate the capacity unavailable from the cell
at high discharge rates. The table entry shows that at a discharge
rate of 0, the cell loses 0% of its capacity (first entry). If the
discharge rate is 1.5 times the rated capacity of the cell (1.5 C),
the cell loses 50% of its capacity (second entry in the table).
In Figure 146, the State-Of-Charge (SOC) node is the
subtraction of the voltage on the capacitor C_CellCapacity and
E_Lost_Rate. The SOC node represents the capacity in the cell
for a given discharge rate during the simulation. G_Discharge
discharges C_CellCapacity at the cell rate. The voltage on node
50 relates to the capacity remaining in the cell if the discharge
rate is low enough to actually run the cell dry. At low discharge
rates, these two nodes are the same; at high discharge rates, node
SOC is at a lower potential than node 50. If, at the end of a high
discharge rate the cell reverts to a low discharge, nearly the
entire rated capacity can be recovered from the cell. At the high
discharge rate, approximately 60% of the cell’s rated capacity
can be used.
All that needs to be done now is to link the state of charge with
the cell voltage to get an output. The state of charge is 1 Volt for
100%, while the cell voltage table is just the opposite. To make
266
STATE_OF_CHARGE
E_Lost_Rate
50
Cell_V
SOC
RATE
Invert
R2 60
E_Invert R4
E_Rate C1
V_Sense E_Battery
20 10
R_Cell
-OUTPUT +OUTPUT
STATE_OF_CHARGE
E_LostRate 50
SOC
LowRate
E_LowRate R3
70 V_Ambient R_Thermal CELL_TEMP
80
Invert
E_Temp_Rise C2
E_Invert R4
RATE
V_Sense E_Temp E_Cell
30 20 10
R2 60
R_Cell
-OUTPUT +OUTPUT
E_Rate C1
N 0.9 0.8 — — —
AA 2.5 0.3 — — —
C 7.5 0.2 — — —
D 16.4 0.07 — — —
Nickel-Metal-Hydride Cells
Typical subcircuit call for a single NIMH AA cell:
X1 +node -node SOC RATE NIMH PARAMS: CAPACITY=1.1,
RESISTANCE=0.03
AA 1.1 0.03 — — —
6V- 10 0.015 — — 3
10 A-hr
12 V - 1.3 0.12 — — 6
1.3 A-hr
12 V - 4.0 0.05 — — 6
4.0 A-hr
12 V - 6.5 0.04 — — 6
6.5 A-hr
12 V - 10 0.03 — — 6
10 A-hr
Temperature Effects
During a fast discharge, the cell temperature of a NICD can
change by 25°C or more. The effect of cell temperature on
voltage is accounted for in the NICD model by changing the cell
voltage based on the calculated temperature. The other models
do not incorporate temperature effects directly into the
simulation.
The major temperature influence on the cell is capacity. This
may be accounted for by adjusting this parameter at the start of
a simulation. The following equations give the new capacity for
each cell type at any discharge temperature from 0 to 60°C
based on the initial capacity at 25°C.
• Alkaline Cells:
NewCapacity = OldCapacity * (0.85 + 8.64E-
3 * T - 1.05E-4 * T2)
• Nickel-Cadmium Cells:
If T > 25°C
NewCapacity=OldCapacity
If T < 25°C
NewCapacity=OldCapacity*(0.815+7.5E-3*T)
• Nickel-Metal-Hydride Cells:
NewCapacity=OldCapacity*(0.913+1.1E-2*T-3.0E-4*T2)
• Lead-Acid Cells:
NewCapacity=OldCapacity*(0.84 + 7.96E-3*T-6.07E-5*T2)
.END
The .IC statement sets the initial conditions, and must be set for
every subcircuit used. V(X1.50) sets the initial charge on node
50 of the X1 subcircuit. This is the voltage on the battery Amp-
hour capacity model which simulates the initial state of charge.
Setting this node to 1 Volt equals an initial state of charge of
100%. Likewise, 0.8 Volts would represent an 80% initial state
of charge.
The next initial condition ( V(X1.60)=0) sets the voltage on the
delayed lost rate calculator to zero. This allows the voltage on
capacitor C1 (internal to the subcircuit) to start at 0 Volts as it
would if the discharge current was zero before the simulation
started. Another way to achieve this result is to switch on the
discharge currents just after the simulation starts. This
automatically sets the delayed lost rate voltage to zero at the start
of the simulation.
Using PSpice to Simulate the Discharge Behavior of Common Batteries 275
Figure 148 The 2 Ohm discharge test results using the NICD
simulation model closely match discharge data for an actual AA
cell
current levels then left to rest. When the models are used at low
discharge rates to low terminal voltages however, they do not
show this voltage recovery. The battery chemistry tries to make
a voltage potential difference even if only a few molecules of
unused material remain. In this state of discharge, the internal
resistance of the cell can be an order of magnitude, or more, than
its initial value. If any load is reconnected, the terminal voltage
will quickly collapse again to zero.
The models were designed to be used with the standard cutoff
voltages as specified by the battery makers. For NICD batteries,
this is 0.8 to 1.1 Volts per cell. For Alkaline cells, the cutoff is
0.8 to 1.2 Volts per cell. For Lead-Acid cells, the cutoff voltage
is typically 1.5 to 1.7 Volts per cell. Usage beyond these limits
should be studied carefully because they were not specifically
examined in the modeling process.
These models were not designed to be connected in parallel.
This is not acceptable in consumer design anyway, because
there is no way to guard against the end user putting an Alkaline
cell in parallel with a NICD or Carbon cell. If these different
types of cells are connected together, the charge most likely
won’t equalize. This results in overcharging and leakage of the
weak cell, thus causing damage.
Using PSpice to Simulate the Discharge Behavior of Common Batteries 277
Simulation Speed
The goal of simulation is to obtain results faster than can be
achieved with the hardware, or to measure behaviors which
cannot easily be accessed in the hardware. The following notes
should help when making speed/accuracy trade-offs.
• Don’t go overboard on the models that you attach to these
batteries during a simulation. Simulate the power drain from
your circuit, not the transistor-level circuit itself. These
models have been tried and verified with many different
discharge regimens, and are believed to be accurate enough
to allow finding maximum or minimum battery life. The
trends these models simulate are believed to be basically
accurate, even though the absolute capacity simulated may
be 20% or so off.
• Don’t simulate pulsed current loads with cycle times less
than 5 seconds or so. Using short cycle time pulsed currents
may make the simulation run slower than real time. To
speed up the simulation with fast pulsed loads, use the RMS
average of the pulsed current. This will provide you with a
ballpark answer.
• Use a minimum of semiconductor models hooked up to
these models. Semiconductors contain many internal
nonlinear equations that must be solved for each time point,
thus slowing simulation time.
• To prevent convergence problems, ABSTOL and VNTOL
should be set to values about nine orders of magnitude less
than the maximum currents and voltages in your circuit.
• RELTOL may be relaxed to 1% from its 0.1% default value
to speed up the simulation.
• If you experience convergence problems, use the .IC
directive to set the initial voltages on critical nodes in your
circuit.
278
* * CELL RESISTANCE * *
R_Cell 20 30 { RESISTANCE }
* * CELL VOLTAGE TEMPERATURE COEFFICIENT * *
E_Temp 10 20 TABLE { V(CELL_TEMP) } = (0,-0.025) (25,0) (60,-0.100)
* * CELL OUTPUT CURRENT SENSE * *
V_Sense -OUTPUT 30 0
* * CELL OUTPUT VOLTAGE VS STATE OF CHARGE * *
E_Invert Invert 0 TABLE { V(SOC) } = (0,1) (1,0)
R4 Invert 0 1G
E_Cell +OUTPUT 10 TABLE { V(Invert) } =
+ (0.0000000000E+00 1.3148600000E+00) (1.7391197842E-03 1.3114600000E+00)
+ (8.6956352158E-03 1.3008400000E+00) (1.7391252284E-02 1.2910200000E+00)
+ (3.1304265000E-02 1.2794000000E+00) (4.8695517284E-02 1.2685600000E+00)
+ (6.4347649784E-02 1.2608600000E+00) (9.2173675215E-02 1.2504800000E+00)
+ (1.3739093478E-01 1.2401000000E+00) (2.9217314000E-01 1.2300000000E+00)
+ (4.9738998228E-01 1.2199000000E+00) (6.0347665207E-01 1.2099000000E+00)
+ (7.3738938358E-01 1.1909200000E+00) (7.8782396620E-01 1.1801600000E+00)
+ (8.2086740543E-01 1.1705000000E+00) (8.4695429293E-01 1.1602800000E+00)
+ (8.6608462870E-01 1.1501000000E+00) (8.7999764142E-01 1.1403000000E+00)
+ (8.9043241457E-01 1.1309800000E+00) (8.9912806793E-01 1.1212400000E+00)
+ (9.0782372129E-01 1.1090600000E+00) (9.1304106250E-01 1.1001000000E+00)
+ (9.1825840370E-01 1.0899000000E+00) (9.2347583564E-01 1.0784600000E+00)
+ (9.2695405706E-01 1.0705000000E+00) (9.3217141642E-01 1.0586000000E+00)
+ (9.3564971043E-01 1.0508000000E+00) (9.3912795000E-01 1.0430000000E+00)
+ (9.4434529120E-01 1.0303200000E+00) (9.4782360336E-01 1.0207400000E+00)
+ (9.5130184293E-01 1.0102600000E+00) (9.5304094457E-01 1.0046200000E+00)
+ (9.5478006435E-01 9.9866000000E-01) (9.5651918413E-01 9.9248000000E-01)
+ (9.5825830392E-01 9.8596000000E-01) (9.5999749629E-01 9.7910000000E-01)
+ (9.6173659793E-01 9.7178000000E-01) (9.6347571771E-01 9.6386000000E-01)
+ (9.6521483750E-01 9.5520000000E-01) (9.6695395728E-01 9.4556000000E-01)
+ (9.6869307707E-01 9.3460000000E-01) (9.7043217870E-01 9.2192000000E-01)
+ (9.7217137108E-01 9.0686000000E-01) (9.7391049086E-01 8.8908000000E-01)
+ (9.7564961064E-01 8.6722000000E-01) (9.7738873043E-01 8.3990000000E-01)
+ (9.7912783206E-01 8.0636000000E-01) (9.8086695185E-01 7.6520000000E-01)
+ (9.8260607163E-01 7.1436000000E-01) (9.8434519142E-01 6.6000000000E-01)
+ (9.8608438379E-01 6.0778000000E-01) (9.8782348543E-01 5.5698000000E-01)
+ (9.8956260521E-01 5.0776000000E-01) (9.9130172500E-01 4.5810000000E-01)
+ (9.9304084478E-01 4.0860000000E-01) (9.9477996457E-01 3.5850000000E-01)
+ (9.9651906620E-01 3.0526000000E-01) (9.9825825858E-01 2.4604600000E-01)
+ (9.9999737836E-01 1.8616600000E-01) (1.0000000000E+00 0.0000000000E+00)
.ENDS
* * CELL RESISTANCE * *
R_Cell 20 30 { RESISTANCE }
* * CELL OUTPUT CURRENT SENSE * *
V_Sense -OUTPUT 30 0
* * CELL OUTPUT VOLTAGE VS STATE OF CHARGE * *
E_Invert Invert 0 TABLE { V(SOC) } = (0,1) (1,0)
R4 Invert 0 1G
E_Cell +OUTPUT 20 TABLE { V(Invert) } =
+(0.0000E+00 1.3346E+00) (7.0989E-03 1.3244E+00) (1.6327E-02 1.3144E+00)
+(2.9283E-02 1.3042E+00) (4.2593E-02 1.2942E+00) (6.8859E-02 1.2841E+00)
+(1.3008E-01 1.2733E+00) (4.3605E-01 1.2633E+00) (5.1165E-01 1.2532E+00)
+(5.8033E-01 1.2432E+00) (6.4635E-01 1.2331E+00) (7.0190E-01 1.2231E+00)
+(7.5834E-01 1.2130E+00) (8.0324E-01 1.2030E+00) (8.3075E-01 1.1929E+00)
+(8.5116E-01 1.1828E+00) (8.6820E-01 1.1727E+00) (8.8310E-01 1.1627E+00)
+(8.9641E-01 1.1527E+00) (9.0848E-01 1.1425E+00) (9.1860E-01 1.1324E+00)
+(9.2730E-01 1.1223E+00) (9.3475E-01 1.1122E+00) (9.4167E-01 1.1021E+00)
+(9.4841E-01 1.0919E+00) (9.5480E-01 1.0817E+00) (9.6013E-01 1.0716E+00)
+(9.6439E-01 1.0615E+00) (9.6776E-01 1.0515E+00) (9.7060E-01 1.0407E+00)
+(9.7291E-01 1.0299E+00) (9.7486E-01 1.0190E+00) (9.7663E-01 1.0080E+00)
+(9.7823E-01 9.9782E-01) (9.8001E-01 9.8706E-01) (9.8196E-01 9.7630E-01)
+(9.8391E-01 9.6612E-01) (9.8586E-01 9.5606E-01) (9.8799E-01 9.4542E-01)
+(9.9012E-01 9.3524E-01) (9.9225E-01 9.2518E-01) (9.9420E-01 9.1498E-01)
+(9.9580E-01 9.0400E-01) (9.9687E-01 8.9186E-01) (9.9740E-01 8.7990E-01)
+(9.9775E-01 8.6280E-01) (9.9793E-01 8.4818E-01) (9.9811E-01 8.2718E-01)
+(9.9828E-01 7.9518E-01) (9.9846E-01 7.4066E-01) (9.9864E-01 6.4712E-01)
+(9.9882E-01 5.1380E-01) (9.9899E-01 3.3476E-01) (1.0000E+00 0.0000E+00)
.ENDS
References
[1] Hageman, S.C. “PC-based power supply tester slashes
setup time to minutes,” Personal Engineering &
Instrumentation News, December 1990, Pages 65-66.
MicroSim, Circuit Analysis Reference Manual, Version 5.3,
1993, MicroSim Corporation, Irvine, CA.
DURACELL, Alkaline Dioxide Batteries, DURACELL
INC., Bethel, CT.
SANYO, Various literature on Nickel-Cadmium batteries,
Sanyo Electric Inc., Little Ferry, NJ.
Panasonic, Sealed Lead-Acid Batteries - Technical
Handbook, Panasonic Industrial Co. Secaucus, NJ.
Panasonic, Batteries, Panasonic Industrial Co. Secaucus,
NJ.
GATES, Rechargeable Batteries - Applications Handbook,
1992, ISBN 0-7506-9228-6, Butterworth-Heinemann,
Stoneham, MA
General Electric, Nickel-Cadmium Battery Application
Engineering Handbook, 1975, General Electric Company.
(The GATES book above contains most if not all of the
information from this discontinued publication)
Power-Sonic, Battery Selector Guide, Power-Sonic Corp.,
Redwood City, CA.
What Will Digital Worst-Case Timing Simulation Do For You? 287
TPLHMN=5
DATA D Q
TPLHMX=10
t Latch
TPLHMN=5
CLOCK C
TPLHMX=10
v
t+d
v+d
DATA TPLHMN=5
D Q
TPLHMX=10
t Latch
CLOCK
TPLHMN=5
v C
TPLHMX=10
t + 10
v+5
DATA TPLHMN=5
D Q
TPLHMX=10
t Latch
CLOCK
v TPLHMN=5
C
TPLHMX=10
t+5 t + 10
v+5 v + 10
Worst-Case Analysis in
PSpice
The Design Center Source newsletter, October 1993
Introduction
This article discusses the analog worst-case analysis feature of
PSpice. Operation of this feature, underlying assumptions on
which it is based, and any limitations are discussed. Simple
examples are provided to illustrate the operation of this feature.
It is hoped that the information provided here will give you a
better understanding of this feature, helping you to apply it
properly and with realistic expectations.
The examples are presented in circuit file syntax where the
PSpice command, .WCASE (or .WC), is used to specify a worst-
case analysis. For users of the MicroSim package with
Schematic Capture, this type of analysis is set up using the Monte
Carlo/Worst Case selection in the Analysis/Setup dialog. Please
refer to the Circuit Analysis Reference Manual for detailed
descriptions of worst-case analysis setup parameters that apply
to your application system.
Analysis Description
Worst-case analysis is used to find the worst probable output of
a circuit or system, given the restricted variance of its
parameters. For instance, if the values of R1, R2, and R3 can
vary by +10%, then the worst-case analysis will attempt to find
the combination of possible resistor values which result in the
worst simulated output. As with any other analysis, there are
three important parts: inputs, procedure, and outputs.
292
Inputs
Besides the circuit description, two forms of information are
required from the user: (a) parameter tolerances, and (b) a
definition of what worst means. PSpice allows tolerances to be
set on any number of the parameters that characterize a model.
Models can be defined for nearly all primitive analog circuit
components—resistors, capacitors, inductors, semiconductor
devices, etc. PSpice reads the standard model parameter
tolerance syntax specified in the .MODEL statement. For each
model parameter, PSpice uses the nominal, minimum, and
maximum probable values, and the DEV and/or LOT specifiers;
the probability distribution type (e.g., UNIFORM or GAUSS) is
ignored.
The criterion for determining the worst values for the relevant
model parameters is defined in the .WC statement as a function
of any standard output variable in a specified range of the sweep.
In a given range, the measurement must be reduced to a single
value by one of these five collating functions:
• MAX
Maximum output variable value
• MIN
Minimum output variable value
• YMAX
Output variable value at the point where it differs the most
with the nominal run
• RISE_EDGE(value)
Sweep value where the output variable value crosses above
a given threshold value
• FALL_EDGE(value)
Sweep value where the output variable value crosses below
a given threshold value
Worst is user-defined as the highest (HI) or lowest (LO) possible
collating function relative to the nominal run.
Worst-Case Analysis in PSpice 293
Procedure
To establish the initial value of the collating function, worst-
case analysis begins with a nominal run with all model
parameters at their nominal values. Next, multiple sensitivity
analyses determine the individual effect of each model
parameter on the collating function. This is accomplished by
varying model parameters, one at a time, in consecutive
simulations. The direction (better or worse) in which the
collating function changes with a small increase in each model
parameter is recorded. Finally, for the worst-case run, each
parameter value is taken as far from its nominal as allowed by
its tolerance, in the direction which should cause the collating
function to be its worst (given by the HI or LO specification).
This procedure saves time by performing the minimum number
of simulations required to make an educated guess at the
parameter values which produce the worst results. It also has
some limitations, which will be discussed in the following
sections.
294
Outputs
A summary of the sensitivity analysis is printed in the PSpice
output file (“.out”). This summary shows the percent change in
the collating function corresponding to a small change in each
model parameter. If a .PROBE statement is included in the
circuit file, then the results of the nominal and worst-case runs
are saved for viewing with the Probe graphical waveform
analyzer.
.lib
* Run with either the .STEP or the .WC, but not both.
* This circuit file is currently set up to run the .STEP
* (.WC is commented out)
YatX(1, X_value)=y1
{
1|sfxv(X_value)!1;
}
Vin 1 0 10V
Rs 1 2 1K
Rwc1 2 3 Rmod 100
Rwc2 3 0 Rmod 100
.MODEL Rmod RES(R=1 LOT 10% DEV 5%)
.DC Vin LIST 10
.WC DC V(3) MAX VARY BOTH LIST
OUTPUT ALL
.ENDS
Gaussian Distributions
Parameters using Gaussian distributions are changed by 3σ
(three times sigma) for the worst-case analysis.
RELTOL
During the sensitivity analysis, each parameter is varied
(multiplied) by 1+RELTOL where RELTOL is specified in a
.OPTIONS statement, or defaults to 0.001.
Sensitivity Analysis
The sensitivity analysis results are printed in the output file
(“.out”). For each varied parameter, the percent change in the
collating function and the sweep variable value at which the
collating function was measured are given. The parameters are
listed in worst output order; i.e., the collating function was its
worst when the first parameter printed in the list was varied.
When the YMAX collating function is used, the output file will
also list mean deviation and sigma values. These are based on
the changes in the output variable from nominal at every sweep
point in every sensitivity run.
Manual Optimization
Worst-case analysis can be used to perform manual optimization
with PSpice. The monotonicity condition is usually met if the
parameters have a very limited range. Performing worst-case
analysis with tight tolerances on the parameters yields
sensitivity and worst-case results (in the output file) which can
be used to decide how the parameters should be varied to
achieve the desired response. You can then make adjustments to
the nominal values in the circuit file, and perform the worst-case
analysis again for a new set of gradients. Parametric sweeps
(.STEP), like the one performed in the circuit file shown in
Figure 162, can be used to augment this procedure.
302
Voltage-Controlled
Oscillators
The Design Center Source newsletter, July 1990
In this discussion, let’s take a look at modeling Voltage
Controlled Oscillators (VCOs), and see how several different
VCOs can be modeled using PSpice. Most of the examples use
PSpice’s Analog Behavioral Modeling capabilities.
where k1 is in Hertz/volt.
Voltage-Controlled Oscillators 305
+ Vo
-KVf Σ –1 –1
------- KVf -------
+ τs τs
Vf Vd
K2Ve
X2 X2
+ +
Σ
Ve +
Σ
V -
a
* Filanovksy VCO
* initial conditions
.ic v(vd) = 0.1, v(vo) = 0
* analysis controls
.tran 10u 20m
Parameter values of 0.1 for k, and 10 u for cv, give a VCO with
frequency of 1.5 kHz per volt at vf and amplitude of 3.2 v peak
at va = 1 v.
Reference
[1] I. M. Filanovsky, “Sinusoidal VCO with Control of
Frequency and Amplitude,” Proceedings of the 32nd
Symposium on Circuits and Systems, IEEE, Vol I, 446-449
(1989).