0% found this document useful (0 votes)
8 views

analog-behavioral-modeling-using-pspice

This document discusses the use of PSpice for analog behavioral modeling, highlighting the need for extensions to model new devices and complex systems effectively. It covers various methods for extending simulator capabilities, including polynomial controlled sources, code modification, and macromodeling, while providing examples of behavioral modeling applications. The paper also addresses the challenges of modeling state behavior in devices with abrupt transitions and the advantages of using behavioral models for efficient simulation.

Uploaded by

Khwaishi Thakore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

analog-behavioral-modeling-using-pspice

This document discusses the use of PSpice for analog behavioral modeling, highlighting the need for extensions to model new devices and complex systems effectively. It covers various methods for extending simulator capabilities, including polynomial controlled sources, code modification, and macromodeling, while providing examples of behavioral modeling applications. The paper also addresses the challenges of modeling state behavior in devices with abrupt transitions and the advantages of using behavioral models for efficient simulation.

Uploaded by

Khwaishi Thakore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ANALOG BEHAVIORAL MODELING USING PSPICE

Ian M. Wilson
MicroSim Corporation
20 Fairbanks
Irvine, CA 92718

Abstract-Modeling new device types requires more than the


polynomial sources provided by SPICE. PSplce extensions allow
arbitrary equations and/or table lookup. These extensions are also continues to operate correctly. Additionally, detailed understanding
useful for black-box system level modeling. Examples are presented of the SPICE implementation is required. This is likely to be a
of both types of behavioral modeling. feasible approach only in academic environments or device
foundries.
Introduction
Once a simulator has been modified, it is (self-evidently)
Behavioral Modeling is the process of developing a model non-standard. This is a potential problem if the simulation ever has
for a device or system component from the viewpoint of externally to be run on another simulator. Additionally, each time a new
observed behavior rather than from a microscopic description. version of the (unmodified) simulator becomes available, the porting
and validation effort will have to be repeated.
Two important applications of Behavioral Modeling in the
domain of analog simulation are: modeling new device types; and Macromodels
black-box modeling of complex systems.
A device can be modeled by constructing a macromodel
This paper discusses extensions made to PSpice to support using existing primitives. This approach works well for composite
these applications and presents detailed examples of each. devices such as optocouplers. There is typically a one-to-one
correspondence between components of the composite device and
Extending Simulators those of the macromodel, although some functions may be
abstracted using controlled voltage or current sources.
Analog simulators generally contain built-in models for a
limited number of devices. Simulating a circuit containing a device The approach does not work so well when the device
not contained in the intrinsic set requires extending the simulator in characteristics are given in equation form or as a set of measured
some way. There are three ways to extend SPICE and related values. In these cases it may be necessary to resort to techniques
simulators: use a polynomial controlled source, modify the simulator such as synthesizing a log function by converting voltage to current,
code to add a new model, or build a macromodel. PSpice Behavioral passing this through an ideal diode and sensing the voltage across
Modeling provides an alternative way to extend simulator capability. the diode. Macromodels built using these techniques soon become
complex, difficult to maintain, and can be slow and inaccurate.
SPICE Polvnomial Controlled Sources
Functional Amroach
SPICE includes controlled voltage and current sources (E,F,G
and H devices). These have a POLY variant that define the output The capabilities of a simulator can be extended by including
as a polynomial function of one or more input voltages or currents. the ability to evaluate expressions which are functions of circuit
Each polynomial term is weighted by a coefficient. variables (voltages, currents, simulation time). The microgrammar
that defines the language may include constructs such as assignment
This approach can be used to represent simple ideal devices and explicit control statements ("procedural"); or it may exclude
such as multipliers, squarers, etc. In "opamp"-type feedback loops it these ("nonprocedural").
can be used to implement buffers, square root devices and so on.
Modeling more complex devices usually requires a combination of The functional approach works well when device
curve-fitting and macromodeling techniques. characteristics are known in equation form, and the device is state-
free. It is not so useful when only a physical model of device
Polynomial approximations work best when the function behavior is available or when the device has several internal states.
modeled satisfies the following criteria: it must be smooth (the
function and its derivatives must be continuous); and it must go to A significant advantage over code modification is that no
plus or minus infinity with the independent variable(s). Functions changes have to be made when new versions of the simulator are
that do not behave in this fashion may be approximated over a released. A disadvantage is that there is no standardization across
restricted range of values. It may be impossible to get a usable the various simulators offering a behavioral modeling capability.
model of a function whose inputs span a large range and where the
output must be accurately specified in a small region. PSplce expressions are nonprocedural. This means that there
are no assignments and no if-then-else type constructs. The issue of
Code Modification procedural versus nonprocedural is called religion in software
jargon. SPICE syntax is nonprocedurak the input netlist contains
Any simulator can be extended to include new types of facts about device node connections and parameter values. PSplce
device by writing code similar to that already in place for the basic extensions follow this precedent, for consistency and to meet the
SPICE set. A few vendors provide a mechanism for users to do requirements of the user base, who are primarily non-programmers.
this. Languages are typically Fortran or C.
A summary of PSplce extensions, together with some simple
There are significant problems with this approach. The examples, is given below.
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
using Polvnomialg: Ref. [ I ] provides a set of coefficients for
Time domain: a 12th-order (!) polynomial of one dimension giving current as a
function of voltage between the anode and cathode of the device:
- arbitrary expressions, can include constants, parameters,
node voltages & currents, TIME, math functions including log, exp, Ctd a k POLI(1) a k
and trig + -3.95510116e-17

E l 1 0 VALUE Csin(twopi fc * TIME))


.... etc ....
- table lookups; value of a controlling expression is linearly + +1.68527934e+05
interpolated in a table
The coefficients were obtained by taking a set of ( x , y )
values from a manufacturer's data sheet and using a curve-fitting
E2 2 0 TABLE (1.0 + v(4)) (0 0) (0.1 0.2) (0.2 0.25)
program to perform a linear regression on the coefficient values.
Freauencv domain: The resulting static current/voltage characteristic is shown in Figure
1.
-Laplace expressions, including constants, parameters, and
using Behavioral Modelin% Current flow in a tunnel diode
math functions in S including log, exp, and trig
is due to three distinct effects [2]: thermal current (analogous to a
conventional diode), tunnel current (due to direct tunneling) and
E3 3 0 LAPLACE C V ( ~ ) + V ( ~ ) ) C1/(1 + tl'S)) excess current (due to indirect tunneling). Writing these three terms
in PSpice's extended syntax:
- table lookups; magnitude and phase are linearly
interpolated in a table Gtheml a k VALUE <Ip*exp(-V~/Vt)*(exp(v(a,k)lvt)-o)
Gtvnel a k VALUE ~Ip*(v(a,k)/Vp)*exp(l-v(a,k)~p)~
E4 4 0 FREO ( ~ ( 7 ) ) (0 0 0) (5k 0 -5760) (6k -60 -6912) Gexcess a k VALUE CIv exp(v(a,k) - Vv))

Device Modeling where V t i s 2 h a t 300K.

Modelinn a Tunnel Diode The resulting current/voltage characteristic is shown in


Figure 1.
The tunnel diode has frequently been used as an example of
SPICE device modeling using polynomials. The static Parameterization
current/voltage characteristic of the device contains a region of
negative dynamic resistance. The transitions from positive to Consider modeling devices with parameters different from
negative resistance and back again are smobth - there are no the example set used above, for example to produce a library of
discontinuities in slope and the device does not exhibit hysteresis. devices for general use. The polynomial approach would require a
The device is only operated in the vicinity of the negative resistance set of coefficients for each distinct device. This becomes
region; typically a span of one or two volts. impractical for anything more than a handful of devices. It may be
possible to define a "generic" tunnel diode device and map inputs
These attributes make the device eminently suitable for and outputs appropriately, but it is not intuitively obvious what
polynomial representation (it is no coincidence that this device has mapping to use.
been used for illustration so often in the past).
The functional approach is much better suited to setting up
Main characteristics of a tunnel diode current/voltage curve libraries of devices owing to the presence of parameters in the
are peak voltage and current ( V p J p ) , valley voltage and current equations. To model a device with a different value for V p , for
(VvJv) and projected peak voltage ( V p p ) . Specific device example, only that parameter's value needs to be updated. Note also
parameters for this example: that in the basic equations above, the temperature dependence is
included (Vt). A subcircuit definition can be used to package the
Vp = 50mv; Ip = 4.2ma; Vv = 370mv; 1, = 37011% V = tunnel diode model and its parameters:
PP
525mv
.SUBCKT TO a k P A W S : Vp5RnV Ip5m Vv=O.Jv f r 0 . h VpcFSOh
Gtheml a k ....
Gt-1 a k ....
texcess a k ....
.ENOS

usage:

X1 4 5 TO P A W S : Vp;55m ; override 5Rnv d r f w l t

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.
polynomial
0 functional

Figure 1. Tunnel Diode Characteristics.


System Modeling Behavioral Model: Each of the three main components of the
PLL can be expressed succinctly in PSpice's extended Behavioral
Behavioral Modelina as Abstraction Modeling syntax.
In the early stages of system design, the emphasis is on The Phase Detector is a multiplier with the output range
high-level issues rather than on low-level details. Behavioral models constrained to [-1,+1]. This is written as a TABLE device, with the
allow systems to be simulated with reduced complexity and with controlling expression being the product of the input voltages and a
improved computational efficiency. 2-element lookup table being used to limit the output:
A simple example is using a controlled source as a gain Epd 3 0 TABLE Cv(l)*v(Z)) ( - 1 - l ) ( + l +1)
block rather than using a complete operational amplifier model:
The VCO is described as a sinusoidal function of time with
Eanp 1 0 TABLE Cle6*(V(pOS,neg))) (-15 -15) (+15 +15) an additional term controlling the phase:
PSplce extensions allow black-box simulation of many high- Evco 5 0 VALUE Csin(2*pi*fc*TIHE + ~(4)))
level circuit elements. The use of arbitrary expressions, lookup
tables and Laplace formulations are powerful tools. The Loop Filter is conveniently described by giving its
Laplace Transform, using s-domain notation. For example, for a
Modelina a Phase-Locked L o w one-pole filter with phase lead correction:
Elpf 7 0 LAPLACE Cv(6)) Cl+t2*s/l+tl*s>
To contrast the high-level and low-level modeling
approaches, consider a simple phase-locked loop (Figure 2). Phase A complete phase-locked loop description consists of these
locked loops contain three major components: a voltage-controlled three "devices", an integrator and a few dummy loads.
oscillator (VCO); a Phase Detector which compares the output of the
VCO with the input (target) signal to derive an error signal; and a Circuit Level ModeI: A model of the same PLL was
Loop Filter. The inverted output of the Loop Filter becomes the developed using bipolar transistor circuits.
controlling voltage for the VCO, thus forming a negative feedback
control loop. The VCO was an astable multivibrator with the charging
current proportional to the VCO control voltage. The multiplier was
a double-balanced modulator using 6 BJTs. The Loop Filter
consisted of two resistors and a capacitor.

A complete description consists of these circuit fragments,


Phase together with power supplies, bias resistors, bypass capacitors, etc.
Detector
Comoarina the two ADoroaches: Table I contrasts the two
out approaches to modeling the PLL.
Filter 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.
Figure 2. Phase Locked Loop.

Mathematical Descriotion: The general time-domain equation


Model: I Behav. 1 Circuit I
for a phase-locked loop can be written as:

eoI = I: -@o(t)l 8 f ( t ) Sim. Time


The input signal yi and the VCO output signal yo are given by:

yi(t) = A sincut + @ ~ ~ ( t ) l
y,(t) = B sincut + @,(t)l , Table 1. Comparison of Modeling Approaches.
The symbol 9 represents convolution, and f(t) is the impulse run times measured on a Sun 4/110.
response of the filter.

This nonlinear differential equation is not solvable in the


general case. Approximate solutions may be found when the
equation is linearized. The typical case where the loop filter is a
simple RC network when linearized gives rise to a second-order
linear differential equation.

983
Future Challenges Manaeine Convereence and Time-SteD COntrol.

Modeling State Behavior Behavioral models are not restricted to well-behaved devices
like the tunnel diode. Devices with abrupt behavior can be readily
Many real devices exhibit two or more stable states. modeled using the TABLE forms and the logarithmic and
Transitions between these states occur under well-defined exponential functions. Convergence control to ensure that the
circumstances. For example, consider a spark gap. This has two simulator. takes small enough steps may be necessary in these
persistent states. An arc may be present, in which case the device is models. For TABLE devices this can be implemented by setting the
in its ON (low resistance) state. Or there may be no arc, in which internal non-convergence indicator if an attempt is made to skip
case the device is in its OFF state. A combination of applied voltage from a section of the TABLE device to another section that is not
and dV/dt causes the device to transition from its OFF to its ON an immediate neighbor.
state, via a transitory "arc forming" phase. If the arc current falls
below a holding value, the device turns OFF, via an "arc For other forms the proposed output at a given time step
extinguishing" phase. could be compared with the previous output and absolute and/or
relative delta criteria applied. If the test failed, the time step would
The question arises, how to model this kind of device with be reduced. The criteria could be specified per device, with global
SPICE-based simulators. Macromodels are difficult to construct. default values.
Representing the state variable requires some component with
memory. Possibilities include hysteresis blocks and digital primitives Controlling the time step may be necessary not only for
(if a mixed-mode simulator is available). Neither of these offers an convergence, but also from sampling considerations. Interpolation
easy or elegant solution. schemes are used for graphical display of the simulation results. The
time step must be constrained so that voltage/current changes are
Let us consider how procedural and non-procedural within the scope of the interpolator.
Behavioral Modeling approaches might look. The procedural
approach would assign device state to some variable local to a It is not possible to deduce the frequency domain behavior
device instance (eg. STATE). of devices specified by arbitrary expressions. There is a risk of
aliasing occuring if the initial and subsequent choices of timestep
Code such as the following might then express the state produce "reasonable" (but subsampled) values of a periodic function.
transition from state 0 (OFF) to state 1 (ARC-FORMING): For example, suppose there is a IMHz source in the circuit and the
if(STATE == 0 PL f(V, Vdot) > WON) C
initial time step is chosen as lops. If each subsequent time step is
Tsrc = time; --raenkr when also IOpS, the apparent value of the source will be 0.
STATE = 1; --m State
> In practice, this kind of subsampling will be readily noticed.
It can be avoided by manually setting the step ceiling.
and to represent the device's I/V characteristic:
if(STATE == 1) C Summary
Iwt = V i n / (RON + (ROFF-RON).
(1 - (time ~ Tarc)/Ta()) Analog Behavioral Modeling has two immediate, highly
)
practical, uses:
An attractive nonprocedural alternative would be to define a
state machine for the device. Each state is associated with a It can be used to extend the capability of an existing
functional form giving the device's behavior in that state. A set of simulator to model new devices and sources, without modifying the
conditions allow the state transitions to be specified. Here are simulator's source code.
fragments of what such a device representation might look like:
It can also be used to design systems at an abstract level,
Eesa 5 0 STATE ( 4 ) ensuring that the concepts are correct, before proceeding with the
+ Cv(in) / (RON + (ROFF-RON). (l-(timr- TEYTRY)/TON))) detailed circuit-level design.
+ 0.1: Cf(V,Vdot) > VTON)

The second line gives the State 1 behavior of the device. The SPICE'S syntax is non-procedural. This approach has proven
third line gives a transition (0->I) and a condition to be met for to be convenient and powerful. Presenting Analog Behavioral
this transition to occur. Modeling as functional or state-machine forms fits in naturally with
existing SPICE usage and is to be preferred over procedural,
Note that although the substance of the two descriptions is programmatic, extensions.
the same, the nonprocedural form hides most of the housekeeping
operations (such as assigning a new value to the state variable). This Acknowledeements
is clearly a desirable state of affairs.
The author would like to thank his colleagues at MicroSim
for their helpful suggestions and creative ideas.
References

[I] PDice User's Manual, Appendix B.


[2] S. M. Sze, phvsics of Semiconductor Devices. Wiley & Sons,
1981, ch. 9, p 529.

984

You might also like