Hi
when using this sub-circuit file:
.SUBCKT MIN3TEST in out PARAMS: my_ref = 0
.FUNC LIMEXP(X) {if(X >= 0,if(X > 100,(X-99)*exp(100) ,exp(X)) ,if(abs(X) > 100,1/((abs(X)-99)*exp(100)) ,1/exp(abs(X))))}
.PARAM x10 = 5e-12
.FUNC f10x(x) {x10*exp(x/x10 - 1)}
.FUNC pos2(x) {if(x >= x10,x,f10x(x))}
.FUNC min2(x,hmax) {hmax - pos2(hmax-x)}
.param x1 = 1e11
.param x2 = 1e-4
.param x3 = 100e-4
.param q = 1.602e-19
.param a = {q*x1}
.param b = {x3/x2}
.func N1(x) {a*(limexp(min2(x*1e-4/x3 -1,my_ref)*b) - exp(-b))}
EOUT out 0 VALUE = {N1(V(in))}
EOUT out 0 VALUE = {a(limexp(min2(V(in)*1e-4/x3 -1,my_ref)*b) - exp(-b))}
ROUT out 0 100meg
.ENDS
inside a circuit application:
- Test Case for user function min2(x)
V1 IN 0 PULSE 0 100 1µ 1µ 1µ 1µ
R1 result 0 100Meg
X1 IN result MIN3TEST
.tran 0 4µ 0 10n
.plot V(result)
.lib mintest.lib
.end
then Qspice stalls without an error message.
using line
EOUT out 0 VALUE = {a*(limexp(min2(V(in)*1e-4/x3 -1,my_ref)*b) - exp(-b))}
instead of
EOUT out 0 VALUE = {N1(V(in))}
then QSPICE runs properly. Also when changing the redefined function min2(x) to the conventional min
function than QSPICE works also without problem.
It seems, in the special case calling the N2 function with min2 in a controlled source, some
internal error occurs which causes no error- and no warning messages but it stops QSPICE.