Too many parameters for subcircuit type:

Trying to do a simulation and I’m getting the error:

Circuit: KiCad schematic
Too many parameters for subcircuit type “tlv8544” (instance: xxu1)
Background thread stopped with timeout = 0
Error: there aren’t any circuits loaded.

I’m not sure what that means. Does it mean the model I downloaded from TI isn’t compatible or have I set something up wrong. It won’t let me attach the project to show you what I’m doing. So I don’t know how to describe it more clearly. Any ideas from the error message?

You need to look into the model file of tlv8544 and see how many parameter expected, and make sure KiCad map it correct way (by look into the pspice net list generated by kicad).

I’m not sure how to read the library file. It looks like this is the pertinent line in the netlist:

XU1 Net-R2-Pad2 Net-R2-Pad1 Net-R1-Pad2 +BATT Net-R5-Pad2 Net-R7-Pad1 Net-R7-Pad2 Net-R8-Pad2 Net-R8-Pad1 Net-R6-Pad2 0 Net-R3-Pad2 Net-R4-Pad1 Net-R4-Pad2 TLV8544

And this is the first line in the library file:
.subckt TLV8544 VEE VCC VINM VINP VOUT
XI0 VEE VCC VINM VINP VOUT PD VFA_HT5
VPD VCC PD 0
.ends

The netlist shows connections to all 14 pins in pin number order. The library model shows 5 ports for one opAmp two inputs, the output, power, & gnd. There are 4 opamps in the package.

I simplified the schematic down to one opamp using the symbol from the pspice library and it simulated fine. Then I went into it’s settings and pointed it to the model and it started giving another error:

Circuit: KiCad schematic
Original line no.: 0, new internal line no.: 245:
Undefined number [if]
Original line no.: 0, new internal line no.: 245:
Expression err: if(choice==1,1,0)
Original line no.: 0, new internal line no.: 245:
Formula() error.
choice=2;ibias=100f;ioffset=100f;ta=27;ibiasdrift=0;ioffsetdrift=0;ibiasp=150f;ibiasm=50f;choice1= if(choice==1,1,0);choice2= if(choice==2,1,0);ib= choice1ibias+choice2(ibiasp+ibiasm)/2 ;io= choice1ioffset+choice2abs(ibiasp-ibiasm);
Original line no.: 0, new internal line no.: 422:
Undefined number [temp]
Original line no.: 0, new internal line no.: 422:
Cannot compute substitute
Original line no.: 0, new internal line no.: 426:
Undefined number [temp]
Original line no.: 0, new internal line no.: 426:
Cannot compute substitute
Original line no.: 0, new internal line no.: 293:
Undefined number [if]
Original line no.: 0, new internal line no.: 293:
Expression err: if(choice==1,1,0)
Original line no.: 0, new internal line no.: 293:
Formula() error.
choice=1;gm=1.60e-01;sbf=1;itailmax_x1=1.8;itailmax_y1=11.1e-3;itailmax_x2=3.3;itailmax_y2=11.1e-3;itailmin_x1=1.8;itailmin_y1=14.2e-3;itailmin_x2=3.3;itailmin_y2=14.2e-3;choice1= if(choice==1,1,0);choice2= if(choice==2,1,0);choice3= if(choice==3,1,0);choice11= if(choice==11,1,0);itailmax_slope=(itailmax_y2-itailmax_y1)/(itailmax_x2-itailmax_x1);itailmin_slope=(itailmin_y2-itailmin_y1)/(itailmin_x2-itailmin_x1);itailmax_intcp= itailmax_y1-itailmax_slopeitailmax_x1 ;itailmin_intcp= itailmin_y1-itailmin_slopeitailmin_x1 ;
Original line no.: 0, new internal line no.: 395:
Undefined number [itailmax_slope]
Original line no.: 0, new internal line no.: 395:
Cannot compute substitute
Original line no.: 0, new internal line no.: 399:
Undefined number [itailmin_slope]
Original line no.: 0, new internal line no.: 399:
Cannot compute substitute
Original line no.: 0, new internal line no.: 403:
Undefined number [choice1]
Original line no.: 0, new internal line no.: 403:
Cannot compute substitute
Original line no.: 0, new internal line no.: 593:
Undefined number [temp]
Original line no.: 0, new internal line no.: 593:
Cannot compute substitute
Copies=345 Evals=955 Placeholders=106 Symbols=203 Errors=18
Numparam expansion errors: Problem with input file.
Error: ngspice.dll cannot recover and awaits to be detached
Note: can’t find init file.


** ngspice-29 shared library
** Creation Date: Sat Oct 27 14:16:51 UTC 2018


Error: there aren’t any circuits loaded.

I’m not sure what to make of this one either.
There are the right number of parameters now but they aren’t in the same order I don’t know if they are supposed to be.

XU1 Net-R1-Pad2 Net-R2-Pad1 Net-R2-Pad2 +BATT 0 TLV8544
.subckt TLV8544 VEE VCC VINM VINP VOUT

Multiple circuits inside of one package is not yet supported by eeschema (see http://ngspice.sourceforge.net/ngspice-eeschema.html#digi, last paragraph). A bug report has been filed (https://bugs.launchpad.net/kicad/+bug/1781290).

For the error messages with a single OpAmp: Did you follow the procedure enabling PSPICE compatibility as described in http://ngspice.sourceforge.net/ngspice-eeschema.html#setting ?

Base from @holger, and your net list output it make sense. So I can think of 2 issues here:

  1. KiCad combines all net connected nets to multiple symbols that have the same Reference value (I mean U1A and U1B are the same, and U1A and U2A are difference).
  2. Symbol you are using are expected a full 4 OpAmps model. And it do not follow “common” standard way of OpAmp net order of industry.

To work around, I think you can do:

  • MethodA:

    1. Use 1 exact OpAmp Unit (Use All A, or all B) from the same symbol for each OpAmp with deference References (U1A, U2A, U3A, U4A…)
    2. You can modify the model line .subckt to re-arrange VEE VCC VIMM VINP VOUT orders to match the OpAmp unit from the symbol that you had choice.
  • MethodB:

    1. You add a model something like:
    .subckt My4OpAmp Net1 Net2 VEE .... VCC .... Net14 
    X1 VEE VCC Net? Net? Net? TLV8544
    X2 VEE VCC Net? Net? Net? TLV8544
    X3 VEE VCC Net? Net? Net? TLV8544
    X4 VEE VCC Net? Net? Net? TLV8544
    .ends
    
    1. Then you make all your opamp symbol value to “My4OpAmp”
  • MethodC:

with my single op amp test I modified the parameter order to match the netlist. But no change in the results.
messages like “Undefined number [if]” make me think there’s something in the model that the simulator just doesn’t understand.

I have gotten the DLL as described in http://ngspice.sourceforge.net/ngspice-eeschema.html#setting I’m not sure how to tell if it’s taken effect though.

I’ve resigned myself to the fact that I probably won’t get this model working and moved on to trying to simulate a different part of the circuit.

You have missed to set the PSPICE compatibility flag set ngbehavior=ps in spice.rc or .spiceinit.

Unfortunately, when you have done so, another error message pops up, that is due to a ngspice bug. It surfaces up when device name and parameter name are the same in the library. You can apply a preliminary fix by editing the TLV8544.LIB (downloaded from the TI web pages):

lines 58 to 71 become:

.subckt VINRANGE3 SIGNAL1 SIGNAL2 VCC VEE VINM VINP PARAMS: SignalGain=1 VIL=100e-3 VIH=100e-3
XIDVIL NET13 NET074 DiodeIdeal
XIDVIH NET076 NET13 DiodeIdeal
FVIL2 SIGNAL2 VEE VILL   {SignalGain} 
FVIL1 SIGNAL1 VEE VILL   {SignalGain} 
FVIH1 VCC SIGNAL1 VIHH   {SignalGain} 
FVIH2 VCC SIGNAL2 VIHH   {SignalGain} 
E1 NET8 0 VINM 0 1
E0 NET6 0 VINP 0 1
VILL NET074 VEE {VIL} 
VIHH VCC NET076 {VIH} 
R7 NET8 NET13  1
R6 NET6 NET13  1
.ends VINRANGE3

lines 61-64, 67, 68 have a change from VIL to VILL and VIH to VIHH.

Actually I do have the spice.rc file with the compatibility flag. and it’s in the directory that USERPROFILE points to…

Then you should not have the

error.

What is your directory path for spice.rc?

Do you add the TLV8544.lib with an .include statement? That is necessary for set ngbehavior=ps to become effective.

The include statement is there:

.title KiCad schematic
.include “C:\Martins Google Drive\current project workareas\Upwork\Brendan Duggan\Spice\snom614a\TLV8544.LIB”
V3V1 +BATT 0 dc 3 ac 0
V1 in 0 dc 2.5 ac 3m sin(2.5 .3 5)
R1 in Net-R1-Pad2 1k
R2 Net-R2-Pad1 Net-R2-Pad2 1k
XU1 Net-R1-Pad2 Net-R2-Pad1 Net-R2-Pad2 +BATT 0 TLV8544
.end

environment variable is:
USERPROFILE=C:\Users\marti

spice.rc file is there:

image

  • user provided init file
    set ngbehavior=ps

I’m stumped.

Had you try to run ngspice independently from KiCad? I had a lot of success to have KiCad generate the right pspice net list file. Then load that from ngspice tool console independently. Also if you start ngpsice with current directory where spinit files is. You would be better off to have it work (I think). I use to copy this spinit file from ngspice installed folder into to my KiCad project folder, where the generated net list would be created. This way, may help you figure out what the problems, then may be you can figure out why it not work from KiCad simulation.

1 Like

Some time the tool also looking at HOME environment too if it exist. So check if that point to the same place as USEPROFILE of it exist.