In-Line Equations Describe Circuits in a Snapshot

April 1, 2002
Analog behavioral modelling allows designers to implement their own devices when only first order effects are necessary.

Analog behavioral modelling (ABM) allows designers to implement their own devices when only first order effects are necessary. In-line equation syntax differs from editor to editor. IsSpice4 uses the original Berkeley B elements, while PSpice has modified the standard E/G sources to either generate voltage or current. Although the style is different, the results are similar. To use these equations without falling into “syntax error” traps, a brief review is necessary. Let's begin with simple multiplications:

IsSpice4: B1 1 0 V=V(2,3)×4; multiply voltage of V(2,3) by 4 and deliver voltage

B1 1 0 I=I(V1)×5; the current flowing through V1 is multiplied by 5

PSpice: E1 1 0 Value={ V(2,3)×4}

G1 1 0 Value={ I(V1)×5 }

More complicated equations involving mathematical functions can be written here like a simple 100 kHz oscillator where the keyword time represents the simulation internal timer:

IsSpice4: B1 1 0 V=2×sin (time×100k×6.28)

PSpice: E1 1 0 value={2×sin (time×100k×6.28)}

Use if-then-else expressions as the real basis when you write your own models including logical operations:

IsSpice4: B1 1 0 V=V(plus)> V(minus)? 10 : 100m; the simplest comparator

PSpice: E1 1 0 Value={if (V(plus) >V(minus), 10, 100m)}

You read this as: if V(plus) is greater than V(minus), then V(1,0) =10V else V(1,0)=100mV. Those perfect generators toggle in a zero time span. It's good practice to slow down their output by inserting an RC network (e.g. 10Ω/100pF) before connecting them to other elements.

More complicated expressions are possible, nesting two expressions into one line — e.g. for a limiter that clamps a voltage between 5V and 100mV:

IsSpice4: B1 1 0 V=V(3)>5 ? 5 : V(3)<100m ? 100m : V(3)

PSpice: E1 1 0 Value={if (V(3)> 5, 5, if (V(3)<100m, 100m, V(3)))}

PSpice: E1 1 0 Value={limit (V(3), 5,100m)}

You read this as: If V(3) is greater than 5V, then V(1,0)=5V else if V(3) is less than 100mV, then V(1,0) =100mV else V(1,0)=V(3).

If IsSpice4 needs no parentheses, PSpice does and the parser will notify you if you position them improperly.

IsSpice4: B1 69 14 V=V(27,14)> V(18,14)/2 ? V(18,14) : V(26,14)>0.44 ?
+ V(18,14) :
(V(13,14)+V(26,14)+V(12,14)) > V(31,14) ? V(18,14) : 0
PSpice: E1 69 14 Value={if (V(27,14) > V(18,14)/2, V(18,14), if ( V(26,14) > 0.44, + V(18,14), if ((V(13,14)+V(26,14)+V(12,14)) > V(31,14), V(18,14), 0 ) ) )}

IsSpice4 accepts parameter passing for SPICE primitives like E or G; however, PSpice doesn't. Thus, you must adapt them with a VALUE keyword:

IsSpice: E1 1 2 3 4 { gain }
G1 1 2 3 4 { gm }

Pspice: E1 1 2 Value ={V(3,4) × gain}
G1 1 2 Value={ V(3,4)×gm }

To illustrate in-line equations, use the input-to-output transfer ratio of a BOOST converter operating in continuous conduction mode (CCM), which is affected by some ohmic losses. The traditional equation states:

Where:
D'=1 — D
Rlf=inductor series resistance
Rload the converter load.

An interesting exercise is to sweep the duty-cycle D for different ratios

Fig. 1 shows how to implement this equation via a simple in-line equation, whereas the duty-cycle is obtained using the current simulator time in seconds and bounded below 1 for a 100µs run. When sweeping the ratio parameter, the Fig. 2 family of curves shows the standard BOOST behavior, where latch-up takes place sooner for lossy inductors.

For more information on this article, CIRCLE 339 on Reader Service Card

About the Author

Christophe Basso

Christophe Basso is a Technical Fellow at ON Semiconductor in Toulouse, France, where he leads an application team dedicated to developing new offline PWM controller specifications. He has originated numerous integrated circuits among which the NCP120X series has set new standards for low standby power converters.

Further to his 2008 book “Switch-Mode Power Supplies: SPICE Simulations and Practical Designs”, published by McGraw-Hill, he released in 2012 a new title with Artech House, “Designing Control Loops for Linear and Switching Power Supplies: a Tutorial Guide”. His new book is dedicated to Fast Analytical Techniques and was recently published by Wiley in the IEEE-press imprint under the title “Linear Circuit Transfer Function: An Introduction to Fast Analytical Techniques”.Christophe has over 20 years of power supply industry experience. He holds 17 patents on power conversion and often publishes papers in conferences and trade magazines including How2Power and PET. Prior to joining ON Semiconductor in 1999, Christophe was an application engineer at Motorola Semiconductor in Toulouse. Before 1997, he worked as a power supply designer at the European Synchrotron Radiation Facility in Grenoble, France, for 10 years. He holds a BSEE equivalent from the Montpellier University (France) and a MSEE from the Institut National Polytechnique of Toulouse (France). He is an IEEE Senior Member.

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!