Adapting Manufacturer PSPICE models for use in Dual Opamps

Hello Holger,

thank you very much for your guidance on how to adapt manufacturer PSPICE models for dual opamp use in the tutorial.

Is there a “generic way” to get dual spice models for eg OPA 1612, 1656 or 1641?

I could make it work with the TL072 , following your description.
I could make it work as well with OPA1656 and TL072 as Spice Model.
But so far , I could not make the OPA1656 Spice Model work with OPA1656

I tried to adapt your TL072-dual.lib for eg OPA1656 (see attachment),
but was not successful. Maybe a syntax error in the dual.lib script or an incompatibility in the manufacturers .lib file?

OPA1656-dual.lib was selected as Spice Model for all three components A,B,C.
Netlist below.
Your advice is much appreciated.

Best Regards;
Frank

.title KiCad schematic

.include “C:\Users\LX521\OneDrive\Pictures\Documents\KiCad\lib\myLib\OPA1656\OPA1656_PSpice\opa1656-dual.lib”

V1 Net- C1-Pad2 GND dc 0 ac 1 sin(0 3 1k)

V2 15+ GND dc 15

V3 GND 15- dc 15

C2 Net- C2-Pad1 Net- C1-Pad1 330n

C1 Net- C1-Pad1 Net- C1-Pad2 330n

C3 Net- C3-Pad1 Net- C3-Pad2 330n

C4 Net- C4-Pad1 Net- C3-Pad2 330n

R6 Net- C4-Pad1 Net- R5-Pad1 2780

R3 Net- C2-Pad1 Net- R2-Pad1 2780

R2 Net- R2-Pad1 GND 2780

R1 Net- C3-Pad1 Net- C1-Pad1 2780

R4 Net- R4-Pad1 Net- C3-Pad2 2780

R5 Net- R5-Pad1 GND 2780

XU1 Net- C3-Pad1 Net- C3-Pad1 Net- C2-Pad1 15- Net- C4-Pad1 Net- R4-Pad1 Net- R4-Pad1 15+ opa1656

.save @v1[i]

.save @v2[i]

.save @v3[i]

.save @c2[i]

.save @c1[i]

.save @c3[i]

.save @c4[i]

.save @r6[i]

.save @r3[i]

.save @r2[i]

.save @r1[i]

.save @r4[i]

.save @r5[i]

.save V(15+)

.save V(15-)

.save V(Net- C1-Pad1 )

.save V(Net- C1-Pad2 )

.save V(Net- C2-Pad1 )

.save V(Net- C3-Pad1 )

.save V(Net- C3-Pad2 )

.save V(Net- C4-Pad1 )

.save V(Net- R2-Pad1 )

.save V(Net- R4-Pad1 )

.save V(Net- R5-Pad1 )

.ac dec 100 1 10k

.end

AC sim error Message

Circuit: KiCad schematic

Original line no.: 0, new internal line no.: 894:

Mismatch: 1 formal but 0 actual params.

gmin=$;

Original line no.: 0, new internal line no.: 894:

Syntax error: letter [$]

Original line no.: 0, new internal line no.: 894:

Expression err: $

Original line no.: 0, new internal line no.: 894:

Formula() error.

gmin=$;

Original line no.: 0, new internal line no.: 895:

Mismatch: 1 formal but 0 actual params.

gmin=$;

Original line no.: 0, new internal line no.: 895:

Syntax error: letter [$]

Original line no.: 0, new internal line no.: 895:

Expression err: $

Original line no.: 0, new internal line no.: 895:

Formula() error.

gmin=$;

Copies=415 Evals=1474 Placeholders=82 Symbols=113 Errors=8

Numparam expansion errors: Problem with input file.

Error: ngspice.dll cannot recover and awaits to be detached

Note: can’t find init file.

** ngspice-33 shared library

** Creation Date: Fri Nov 13 16:44:58 UTC 2020

Error: there aren’t any circuits loaded.

You are including the dual.lib. That is o.k…
Then you are calling the dual opamp as

XU1 Net- C3-Pad1 Net- C3-Pad1 Net- C2-Pad1 15- Net- C4-Pad1 Net- R4-Pad1 Net- R4-Pad1 15+ opa1656

This is probably not o.k. because the subcircuit name in the original TI model file is
.subckt OPA1656 IN+ IN- VCC VEE OUT
so this is the OPA1656. Inside of your opa1656-dual.lib (you have not attached nor shown) you have to select a different name for the subcircuit.

Why not simply take the TL072 example from in detail? Replace TL072 by OPA1656. The subcircuit in opa1656-dual.lib then would be called OPA1656c. Or call it opa1656dual. The call to this subcircuit in your netlist then would be

XU1 1 2 3 4 5 6 7 8 OPA1656dual

maybe with other node names.

1 Like

Sorry, this is my draft of a opa1656-dual.lib

  • A dual opamp ngspice model
  • file name: OPA1656-dual.lib
    .subckt opa1656 1out 1in- 1in+ vcc- 2in+ 2in- 2out vcc+
    .include opa1656.lib
    XU1A 1in+ 1in- vcc+ vcc- 1out opa1656
    XU1B 2in+ 2in- vcc+ vcc- 2out opa1656
    .ends

Well, the way to to it has been described in [NgSPICE] Linkwitz-Riley 24 dB Simulation Error and http://ngspice.sourceforge.net/ngspice-eeschema.html#multi

One could give an even more detailed step-by-step advice (you may do it here when you have things up and running).

The fact here is that you have to combine the simulation requirements and the layout requirements. The layout dictates a dedicated pin numbering of your dual or quad op amp. If you don’t care for layout, you may simply choose 4 different op amps, each calling the TI model directly. But with considering layout, you will have to develop the intermediate subcircuit.

1 Like

The subcircuit should be called differently:

.subckt opa1656dual 1out 1in- 1in+ vcc- 2in+ 2in- 2out vcc+
.include opa1656.lib
XU1A 1in+ 1in- vcc+ vcc- 1out opa1656
XU1B 2in+ 2in- vcc+ vcc- 2out opa1656
.ends

It probably does not work because your intermediate subcircuit has the same name as the original subcircuit in the TI lib file.

1 Like

Thanks for the advice, Holger, there is a simulation, now!

Renamed as opa1656c-dual.lib and adapted
vcc+ to vcc and
vcc- to vee

  • A dual opamp ngspice model
  • file name: OPA1656c-dual.lib
    .subckt opa1656c 1out 1in- 1in+ vcc 2in+ 2in- 2out vee
    .include opa1656.lib
    XU1A 1in+ 1in- vcc vee 1out opa1656
    XU1B 2in+ 2in- vcc vee 2out opa1656
    .endsLR24HP  FILTER NGSPICE

I probably have another mistake in the simulation setup, as
-450dBV seems strange and the text box below the simulation is quite “full”

Circuit: KiCad schematic
Reducing trtol to 1 for xspice ‘A’ devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Note: Starting true gmin stepping
Trying gmin = 1.0000E-03 Warning: Further gmin increment
Trying gmin = 5.6234E-03 Warning: Further gmin increment
Trying gmin = 8.6596E-03 Warning: Further gmin increment
Trying gmin = 9.6466E-03 Warning: Further gmin increment
Trying gmin = 9.9105E-03 Warning: Further gmin increment
Trying gmin = 9.9775E-03 Warning: Further gmin increment
Trying gmin = 9.9944E-03 Warning: Further gmin increment
Trying gmin = 9.9986E-03 Warning: Further gmin increment
Trying gmin = 9.9996E-03 Warning: Last gmin step failed
Warning: True gmin stepping failed
Note: Starting dynamic gmin stepping
Trying gmin = 1.0000E-03 Note: One successful gmin step
Trying gmin = 3.1623E-04 Warning: Further gmin increment
Trying gmin = 7.4989E-04 Warning: Further gmin increment
Trying gmin = 9.3057E-04 Note: One successful gmin step
Trying gmin = 8.3536E-04 Note: One successful gmin step
Trying gmin = 7.1050E-04 Warning: Further gmin increment
Trying gmin = 8.0223E-04 Warning: Further gmin increment
Trying gmin = 8.2695E-04 Note: One successful gmin step
Trying gmin = 8.1450E-04 Note: One successful gmin step
Trying gmin = 7.9616E-04 Warning: Further gmin increment
Trying gmin = 8.0987E-04 Note: One successful gmin step
Trying gmin = 8.0299E-04 Warning: Further gmin increment
Trying gmin = 8.0815E-04 Note: One successful gmin step
Trying gmin = 8.0556E-04 Warning: Further gmin increment
Trying gmin = 8.0750E-04 Note: One successful gmin step
Trying gmin = 8.0653E-04 Note: One successful gmin step
Trying gmin = 8.0508E-04 Note: One successful gmin step
Trying gmin = 8.0291E-04 Note: One successful gmin step
Trying gmin = 7.9966E-04 Note: One successful gmin step
Trying gmin = 7.9481E-04 Note: One successful gmin step
Trying gmin = 7.8760E-04 Note: One successful gmin step
Trying gmin = 7.7690E-04 Note: One successful gmin step
Trying gmin = 7.6113E-04 Note: One successful gmin step
Trying gmin = 7.3807E-04 Note: One successful gmin step
Trying gmin = 7.0477E-04 Note: One successful gmin step
Trying gmin = 6.5763E-04 Note: One successful gmin step
Trying gmin = 5.9276E-04 Note: One successful gmin step
Trying gmin = 5.0726E-04 Note: One successful gmin step
Trying gmin = 4.0156E-04 Note: One successful gmin step
Trying gmin = 2.8283E-04 Note: One successful gmin step
Trying gmin = 2.3737E-04 Note: One successful gmin step
Trying gmin = 1.8250E-04 Note: One successful gmin step
Trying gmin = 1.2303E-04 Note: One successful gmin step
Trying gmin = 6.8100E-05 Note: One successful gmin step
Trying gmin = 5.0665E-05 Note: One successful gmin step
Trying gmin = 3.2513E-05 Note: One successful gmin step
Trying gmin = 1.6714E-05 Note: One successful gmin step
Trying gmin = 6.1605E-06 Note: One successful gmin step
Trying gmin = 1.3785E-06 Note: One successful gmin step
Trying gmin = 1.4592E-07 Note: One successful gmin step
Trying gmin = 1.4592E-08 Note: One successful gmin step
Trying gmin = 1.4592E-09 Note: One successful gmin step
Trying gmin = 1.4592E-10 Note: One successful gmin step
Trying gmin = 1.4592E-11 Note: One successful gmin step
Trying gmin = 1.4592E-12 Note: One successful gmin step
Trying gmin = 1.0000E-12 Note: One successful gmin step
Note: Dynamic gmin stepping completed
Reference value : 1.00000e+00
No. of Data Rows : 445

I presume this has to do with the older thread about “Linkwitz-Riley 24 dB filters”?
If that’s the case, you have a different problem with the circuit, which is a 4th order (two 2nd order stages) active high pass filter using a Sallen-Key topology.

This is very problematic (non-functioning, actually), as the op-amps have no DC reference in that configuration (in low-pass they do).
You either need to:
1: add DC biasing of some sort.
2: change topology to, eg, MFB filters.

I can easily imagine that this is one of the reasons for simulation fails.

Ehhhh…what? The whole point of high-pass is to block the DC. DC biasing only makes sense if the opamps are operating single-supply. The author’s first post shows a netlist with a dual ±15V supply powering the opamps.

Hi,

GND reference added. Now 100k to GND after the 2nd opamp stage.
Further more , I added feedback resistors/voltage divider in the feedback loop of both opamp stages.

OPA1656 test circuit.pdf (35.9 KB)

With AC simulation and probes
at the source
after the first capacitor
after the first opamp
after the second opamp
the curves look very largely attenuated, like a not working opamp (no power supply?)

OPA1656 test circuit

Sorry for the dumb questions , but I m totally new to NGspice , so there is a good chance, that I did some substantial errors in setup!!
However ERC reports no faults.

Hope these points do not cause problems:
PWR flags to +15V, -15V and GND
No extra spice GND , just the usual KiCad GND symbol
Manufacturer simulation file “opa1656.lib” announces the pins as


.subckt OPA1656 IN+ IN- VCC VEE OUT


Are there dual .lib show syntax problems, so the opamp is maybe not powered by vcc and vee?

** A dual opamp ngspice model*
** file name: OPA1656c-dual.lib*
.subckt opa1656c 1out 1in- 1in+ vcc 2in+ 2in- 2out vee
.include opa1656.lib
XU1A 1in+ 1in- vcc vee 1out opa1656
XU1B 2in+ 2in- vcc vee 2out opa1656
.ends

Do I have to take care of capital letters in syntax writing?

Thanks for your suggestions,
Frank

When inserting the well working TL072 model into the very same circuit, the simulation looks as expected.

TL072 in the circuit

Seems, that there is something wrong with my implementation of the opa1656-dual.lib ?

…having inserted TL072 in this well simulating test circuit.

Now, I loaded the very same spice model
opa1656-dual.lib into the TL072 symbol.

Simulation is fine.
So the opa1656-dual.lib itself seem to be able to simulate.

There seems to be an issue of “cooperation” between the spice opa1656-dual.lib and the EEschema model of opa1656??

I said “DC bias”, not “DC offset”. In a Sallen-Key implementation of a high pass filter, the op amp has no DC reference at all, inputs and outputs are floating in free space.

to solve this, a bias reistor needs to be added to the non-inverting input to set the DC level. Whether that’s ground or another voltage is unimportant as long as it’s within the operating range of the amp.

@fbee: you need bias resistors at both amps.

You mean these? These were here the whole time and are part of the topology.

@fbee Can you ZIP your entire KiCad project and upload it here so I can take a look? Please try to include all your .LIB files if they are not all in the same project folder.

I mean the schematic in the thread which formed that basis of the current discussion:
It’s referred to by Holger further up (the 24-dB Linkwitz-Riley link). The bias resistors are not present there.
We seem to have some crossed wires with regards to which schematic is in focus :slight_smile:

I still don’t understand. That schematic also has the same resistors to GND. Duplicated below:

The circuit with TL072 (dual) : Simulates the highpass function OK

and

the same circuit with OPA1656ID: issue in simulation
due to some error in my OPA1656 model (EEmodel or Spice model or both)

HiPass2 SK.zip (12.7 KB) TL072.zip (8.8 KB) OPA1656ID.zip (8.3 KB)

Error in your circuit: misplaced wire near U?A.

Needs annotation: U1A etc.

Ah , yes
HiPass2 SK #2.zip (13.6 KB)

Actually, there’s lots of convoluted schematic drawing quirks. Try my version of your project. It’s much more simplified, streamlined, and all the SPICE libraries are using relative paths.
HiPass2_ste.zip (10.4 KB)