I ran into a problem with ngspice when trying to simulate a circuit which includes a THS4551 from TI.
I obtained the PSpice model for the TI amplifier from the TI website [1].
I am currently using Kicad 5.1.6 with a self compiled version of ngspice-32 on Debian.
In order to make the PSpice model of the TI amplifier work, I set up my ~/.spiceinit
as follows:
* user provided init file
set ngbehavior=ps
This made most of the initial errors in my ngspice simulation disappear.
But now I have a problem with a very specific part of the THS4551 PSPice model:
.SUBCKT 08_OP_AMP_COMPLETE_W2_THS4551 1 2 3 4
VW_W2 1 2 DC 0V
.MODEL _W2 ISWITCH ROFF=10MEG RON=1 IOFF=5U ION=7U
.ENDS 08_OP_AMP_COMPLETE_W2_THS4551
There are two parts which use an ISWITCH
model as pasted above. ISWITCH
is a purely PSpice model and does not directly exist in ngspice.
I would have assumed, that the PSpice compatibility mode of ngspice would translate this to an equivalent ngspice model, but this does not seem to be the case.
The ngspice-32 manual [2] in section 16.14.3.2 shows, how the related VSWITCH
model is translated from PSpice to ngspice:
The VSwitch
S1 2 3 11 0 SW .MODEL SW VSWITCH(VON=5V VOFF=0V RON=0.1 ROFF=100K)
may become
a1 %v(11) %gd(2 3) sw .MODEL SW aswitch(cntl_off=0.0 cntl_on=5.0 r_off=1e5+ r_on=0.1 log=TRUE)
but for the ISWITCH
no such substitution is documented.
I tried to implement a similar substitution for the case of the ISWITCH
model, as follows:
.SUBCKT 08_OP_AMP_COMPLETE_W2_THS4551 1 2 3 4
a_W2 %id(1 2) %gd(3 4) _W2
.MODEL _W2 aswitch(r_off=10MEG r_on=1 cntl_off=5U cntl_on=7U)
.ENDS 08_OP_AMP_COMPLETE_W2_THS4551
by making use of a aswitch
ngspice model. But I am not sure if this is correct, and my circuit does not seem to simulate properly.
Does anybody have any experience, in how to model a ISWITCH
PSpice mode in ngspice?
[1] https://www.ti.com/lit/tsm/sboma28
[2] http://ngspice.sourceforge.net/docs/ngspice-manual.pdf
Ps: This is a pure ngspice issue, so if somebody knows a good ngspice forum where to post this question, please let me know