Problem with a puzzling error in a subcircuit file

For the life of me I cannot figure out why this subcircuit file does not work. I tried many combinations of curly braces and no braces, The behavioral current source, B2, will not allow parameters for the first and third arguments of the “limit(x,y,z)” function.

The error message is
Unresolved parameter: “vl” (vl is one of the parameters equal to the constant “-12V”)
Fatal error: Missing expression in B-source B2•X1

The symbol with the subcircut is the only thing on the schematic.

.subckt diffamp 1 2 3 Rout=50 VV=100m Vh=12 Vl=-12 Aol=100K GBW=10Meg
Ri 2 1 1Meg
B1 4 0 I={VV}tanh(V(2,1)/{VV}){Aol}
CP1 4 0 {Aol/GBW/2/PI}
RP1 4 0 1
B2 3 0 I=limit({Vl}, V(4,0), {Vh})/{Rout}
CP2 3 0 1p
Ro 3 0 {Rout}
.ends diffamp

If all the items for the B2 source besides V(4,0) are literal constants, then everything is fine.
I don’t know if this is a bug or a misunderstanding, but it sure seems like there must be some way to make it happy,

BRUCE108

Hi Bruce,

The model has some syntax errors. For example regarding

B1 4 0 I={VV}tanh(V(2,1)/{VV}){Aol}

maybe this is meant:

B1 4 0 I={VV}tanh(V(2,1)/{VV}){Aol}

–Mike

I did quite a bit of messing with it, trying to make it work and it turns out I did correct that error. Here is the original which won’t wor because Rpar, Cpar and ic don’t work in QSPICE.
Original from the legacy system
.subckt diffamp 1 2 3 VV=100m Vh=12 Vl=-12 Aol=100K GBW=10Meg Rout=50
.param c=Aol/GBW/6.28318530717959
b1 0 4 i={VV}*tanh(v(2,1)/{VV})*Aol Rpar=1 Cpar={c} ic=0
b2 0 3 i=limit({Vl},v(4),{Vh})/{Rout} Rpar={Rout} cpar=1p ic=0
.ends diffamp

My modifications, with the parameters, mentioned in the comment, attached to the symbol in QSPICE
*

  • Differential Amplifier ported from a legacy system
  • Uses explicit parallel capacitance and resistance
  • VV=100m Vh=12 Vl=-12 Aol=100K GBW=10Meg Rout=50

.subckt diffamp 1 2 3
Ri 2 1 1Meg
B1 4 0 I={VV}tanh(V(2,1)/{VV}){Aol}
CP1 4 0 {Aol/GBW/2/PI}
RP1 4 0 1
B2 3 0 I=limit({Vl}, V(4,0), {Vh})/{Rout}
CP2 3 0 1p
Ro 3 0 {Rout}
.ends diffamp

The error output is as follows
Ignoring shorted resistor: “RI•X2”
Unresolved parameter: “vl”
Fatal error: Missing expression in B-source B2•X2

It is the unresolved parameter “vl” that is most resistant to a solution.

Thanks for all your help.

BRUCE108

Ignore what you see above – the cut and paste is not working and asterisks are being dropped
BRUCE108

I think I know what the problem is. The file I created had UTF-8 as the character type. I can well imagine that would mess things up for both this web application and QTSPICE. Let me try to fix that kerfuffle and I’ll get back to you.

BRUCE108

HI Mike,
There is no happiness to report. Here is the original which works in the legacy system as expected.
.subckt diffamp 1 2 3 VV=100m Vh=12 Vl=-12 Aol=100K GBW=10Meg Rout=50
.param c=Aol/GBW/6.28318530717959
b1 0 4 i={VV}*tanh(v(2,1)/{VV})*Aol Rpar=1 Cpar={c} ic=0
b2 0 3 i=limit({Vl},v(4),{Vh})/{Rout} Rpar={Rout} cpar=1p ic=0
.ends diffamp

This was the modification that I made because QSPICE does not appear to support to support Rpar, Cpar, and ic.

  • Differential Amplifier ported from a legacy system
  • Uses explicit parallel capacitance and reisistance
  • VV=100m Vh=12 Vl=-12 Aol=100K GBW=10Meg Rout=50

.subckt diffamp 1 2 3
Ri 2 1 1Meg
B1 4 0 I={VV}tanh(V(2,1)/{VV}){Aol}
CP1 4 0 {Aol/GBW/2/PI}
RP1 4 0 1
B2 3 0 I=limit({Vl}, V(4,0), {Vh})/{Rout}
CP2 3 0 1p
Ro 3 0 {Rout}
.ends diffamp

I’m still getting the following error(s)
Ignoring shorted resistor: “RI•X2”
Unresolved parameter: “vl”
Fatal error: Missing expression in B-source B2•X2

BRUCE108

The system here is still dropping * characters or turning them into bullets.

BRUCE108

The problem is fixed in the most recent update installed this morning.

Thanks,
BRUCE108