In-line Equations With PSpice

1,439 views
Skip to first unread message

modelreque...@gmail.com

unread,
Aug 18, 2007, 7:14:14 AM8/18/07
to SPICEsim! Designs Ltd.
In-line equations are really useful features as soon as you want to
use Analog Behavioral Modeling (ABM) techniques. That is to say,
describe a node value through an equation. However, depending on the
editor, equations can become difficult to write especially if you
start to mix them within one expression. Let's start smoothly with a
single voltage / current expression:

IsSpice4:
B1 1 0 V = V(2,3) * 4 ; multiply voltage of 2,3 by four and delivers
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 }

Now, If-then-Else expressions where a node is affected with a level
depending on a logical expression:

IsSpice4: B1 1 0 V = V(3) > 5 ? 10 : 100m
PSpice: E1 1 0 Value = { IF ( V(3) > 5, 10, 100m ) }

You read this by: IF V(3) is greater than 10V THEN V(1,0) = 10V ELSE
V(1,0) = 100mV. It is recommended to not pass the units in these ABM
expressions.

More complicated expressions, nesting two expressions into a single
line, e.g. for a limiter which 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) ) ) }

You read this by: 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)

Okay, let's go to more complicated expressions where you will see that
IsSpice4 handles the equations in a real easy way...

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 ) ) ) }

Also, if IsSpice4 accepts parameter passing for SPICE primitives like
E (voltage-controlled voltage source) or G (voltage-controlled current
sources), PSpice does not and you need to 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 }

Reply all
Reply to author
Forward
0 new messages