Simulate LM358 Spice model import


#1

Hi, I need some help simulating an circuit with the LM358 Opamp. I want to see if there is an instable oscillation problem.
I found two Spice models of the device an I decided to go with the more complex one from TI:
I downloaded the SICE model file from here:
http://www.ti.com/product/LM358/toolssoftware

My Kicad version:

Version Information:
Version: (5.0.1-dev-159-g699429199), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.62.0 OpenSSL/1.0.2p zlib/1.2.11
Platform: Linux 4.14.52-gentoo x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.65.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 7.3.0 with C++ ABI 1011

ngspice -v
ngspice compiled from ngspice revision 30

My simple circuit:

I modified the shipped LM358 symbol from kicad to have the VCC(4,V+) and VEE(5,V-) because the default was missing both. Then I entered the alternate node sequence to match “.subckt LMX58_LM2904 IN+ IN- VCC VEE OUT” from the lib file.

If I then press “simulate” I get a whole lot of errors:

Circuit: KiCad schematic
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
PTerror: syntax error
Warning: Model issue on line 0 :
.model xu1:r_noiseless res(t_abs=-273.15) ...
unrecognized parameter (t_abs) - ignored
Error on line 0 :
b.xu1.xu3.be1 xu1.xu3.e1_int1 0 v= if ( v(xu1.24,xu1.mid) < v(xu1.vee_b,xu1.mid) -   3.0000000000e-01 , v(xu1.vcc_b,xu1.mid) , v(xu1.24,xu1.mid) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xu3.be2 xu1.xu3.e2_int1 0 v= if ( v(xu1.25,xu1.mid) < v(xu1.vee_b,xu1.mid) -   3.0000000000e-01 , v(xu1.vcc_b,xu1.mid) , v(xu1.25,xu1.mid) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xu1.bgcr xu1.xu1.gcr_int1 0 v= if ( ( abs ( v(xu1.xu1.zc,xu1.mid) ) <=   9.0000000000e-01 ) ,   0.0000000000e+00 ,   1.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xiqpos.bg1 xu1.xiqpos.g1_int1 0 v= if ( ( v(xu1.vimon,xu1.mid) <=   0.0000000000e+00 ) ,   0.0000000000e+00 , (    1.00000000000000002e-03  ) * v(xu1.vimon,xu1.mid) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xiqneg.bg1 xu1.xiqneg.g1_int1 0 v= if ( ( v(xu1.mid,xu1.vimon) <=   0.0000000000e+00 ) ,   0.0000000000e+00 , (    1.00000000000000002e-03  ) * v(xu1.mid,xu1.vimon) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xcl_amp.bgvo+ xu1.xcl_amp.gvo+_int1 0 v= if ( v(xu1.vimon,xu1.mid) > v(xu1.51,xu1.mid) , ( ( v(xu1.vimon,xu1.mid) - v(xu1.51,xu1.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xcl_amp.bgvo- xu1.xcl_amp.gvo-_int1 0 v= if ( v(xu1.vimon,xu1.mid) < v(xu1.52,xu1.mid) , ( ( v(xu1.52,xu1.mid) - v(xu1.vimon,xu1.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
s.xu1.sor_swp xu1.clamp xu1.55 xu1.clamp xu1.55 xu1:s_vswitch_1 
Unable to find definition of model xu1:s_vswitch_1 - default assumed
Error on line 0 :
s.xu1.sor_swn xu1.56 xu1.clamp xu1.56 xu1.clamp xu1:s_vswitch_2 
Unable to find definition of model xu1:s_vswitch_2 - default assumed
Error on line 0 :
b.xu1.xgr_amp.bgvo+ xu1.xgr_amp.gvo+_int1 0 v= if ( v(xu1.59,xu1.mid) > v(xu1.57,xu1.mid) , ( ( v(xu1.59,xu1.mid) - v(xu1.57,xu1.mid) ) * (    1.00000000000000000e+01  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xgr_amp.bgvo- xu1.xgr_amp.gvo-_int1 0 v= if ( v(xu1.59,xu1.mid) < v(xu1.58,xu1.mid) , ( ( v(xu1.58,xu1.mid) - v(xu1.59,xu1.mid) ) * (    1.00000000000000000e+01  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xclaw_amp.bgvo+ xu1.xclaw_amp.gvo+_int1 0 v= if ( v(xu1.vout_s,xu1.mid) > v(xu1.vcc_clp,xu1.mid) , ( ( v(xu1.vout_s,xu1.mid) - v(xu1.vcc_clp,xu1.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xclaw_amp.bgvo- xu1.xclaw_amp.gvo-_int1 0 v= if ( v(xu1.vout_s,xu1.mid) < v(xu1.vee_clp,xu1.mid) , ( ( v(xu1.vee_clp,xu1.mid) - v(xu1.vout_s,xu1.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu1.xol_sense.bgsw+ xu1.xol_sense.gsw+_int1 0 v= if ( ( v(xu1.40,xu1.mid) >   1.0000000000e-02 | v(xu1.38,xu1.mid) >   1.0000000000e-02 ) ,   1.0000000000e+00 ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
s.xu1.s1 xu1.28 xu1.29 xu1.sw_ol xu1.mid xu1:s_vswitch_3 
Unable to find definition of model xu1:s_vswitch_3 - default assumed
Error on line 0 :
s.xu1.s7 nc_02 net-_q1-pad1_ nc_02 net-_q1-pad1_ xu1:s_vswitch_4 
Unable to find definition of model xu1:s_vswitch_4 - default assumed
Error on line 0 :
s.xu1.s6 net-_q1-pad1_ nc_01 net-_q1-pad1_ nc_01 xu1:s_vswitch_5 
Unable to find definition of model xu1:s_vswitch_5 - default assumed
Warning: Model issue on line 0 :
.model xu1:s_vswitch_1 vswitch (ron=10m roff=1t von=10m voff=0) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu1:s_vswitch_2 vswitch (ron=10m roff=1t von=10m voff=0) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu1:s_vswitch_3 vswitch (ron=1m roff=1t von=500m voff=100m) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu1:s_vswitch_4 vswitch (ron=50 roff=1t von=500m voff=450m) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu1:s_vswitch_5 vswitch (ron=50 roff=1t von=500m voff=450m) ...
Unknown model type vswitch - ignored
Error on line 24 :
.trans 1 2 0
unimplemented control card - error 
Error on line 25 :
.trans 1 2 0
unimplemented control card - error 
Doing analysis at TEMP = 27,000000 and TNOM = 27,000000
doAnalyses: parameter value out of range or the wrong type
run simulation(s) aborted
Warning - approaching max data size: current size =  794,461 MB, limit =  224,953 MB

Where to start? I guess I need to transform the if statements to c style format “a ? b : c” … But if I succeed is it possible at all to get this file to work with kicad?


#2

You need to set the PSPICE compatibility flag,

set ngbehavior=ps

see http://ngspice.sourceforge.net/ngspice-eeschema.html


#3

that helped, thanks!


#4

Damn, I cheered to soon…
I simplified my circuit,
Bildschirmfoto_2019-01-02_10-49-01
to get rid of any other error source but now I get this error:

Circuit: KiCad schematic
Reducing trtol to 1 for xspice 'A' devices
Doing analysis at TEMP = 27,000000 and TNOM = 27,000000
Note: Starting dynamic gmin stepping
Trying gmin =   1,0000E-03 Note: One successful gmin step
Trying gmin =   1,0000E-04 Note: One successful gmin step
Trying gmin =   1,0000E-05 Note: One successful gmin step
Trying gmin =   1,0000E-06 Note: One successful gmin step
Trying gmin =   1,0000E-07 Note: One successful gmin step
Trying gmin =   3,1623E-08 Note: One successful gmin step
Trying gmin =   5,6234E-09 Note: One successful gmin step
Trying gmin =   5,6234E-10 Note: One successful gmin step
Trying gmin =   5,6234E-11 Note: One successful gmin step
Trying gmin =   5,6234E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   3,6517E-12 Note: One successful gmin step
Trying gmin =   1,9110E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,6253E-12 Note: One successful gmin step
Trying gmin =   1,2749E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,1998E-12 Note: One successful gmin step
Trying gmin =   1,0953E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,0707E-12 Note: One successful gmin step
Trying gmin =   1,0347E-12 Warning: Further gmin increment
Trying gmin =   1,0616E-12 Note: One successful gmin step
Trying gmin =   1,0481E-12 Note: One successful gmin step
Trying gmin =   1,0281E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,0210E-12 Note: One successful gmin step
Trying gmin =   1,0105E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,0078E-12 Note: One successful gmin step
Trying gmin =   1,0039E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,0029E-12 Note: One successful gmin step
Trying gmin =   1,0015E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,0011E-12 Note: One successful gmin step
Trying gmin =   1,0005E-12 Note: One successful gmin step
Trying gmin =   1,0000E-12 Warning: Further gmin increment
Trying gmin =   1,0004E-12 Note: One successful gmin step
Trying gmin =   1,0002E-12 Warning: Further gmin increment
Trying gmin =   1,0004E-12 Warning: Further gmin increment
Trying gmin =   1,0004E-12 Warning: Last gmin step failed
Warning: Dynamic gmin stepping failed
Note: Starting source stepping
Supplies reduced to   0,0000% 
Trying gmin =   1,0000E-02 Warning: gmin step failed
Warning: source stepping failed
Transient solution failed -
Last Node Voltages
------------------
Node                                   Last Voltage        Previous Iter
----                                   ------------        -------------
xu1.esdn                               -1,88782e-07         -1,88782e-07
xu1.mid                                 1,04683e-07          1,04683e-07
xu1.37                                  4,46122e-09          4,46122e-09
xu1.57                                  1,03647e-07          1,03647e-07
xu1.58                                  1,03647e-07          1,03647e-07
xu1.51                                  1,03647e-07          1,03647e-07
xu1.52                                  1,03647e-07          1,03647e-07
xu1.45                                   -0,0187566           -0,0187566
xu1.vclp                                 -0,0189442           -0,0189442
xu1.56                                   -0,0183888           -0,0183888
xu1.44                                   -0,0185746           -0,0185746
xu1.43                                   -0,0187566           -0,0187566
xu1.55                                   -0,0247824           -0,0246861 *
xu1.42                                   -0,0250328           -0,0249354 *
xu1.33                                 -5,23338e-05         -5,23338e-05
net-_r2-pad1_                          -5,28625e-05         -5,28625e-05
xu1.79                                 -2,28614e-05         -2,28614e-05
xu1.vee_b                                -2,309e-05           -2,309e-05
xu1.80                                   0,00106991           0,00106991
xu1.vcc_b                                0,00108061           0,00108061
net-_bt1-pad1_                                    0                    0
xu1.86                                  4,41705e-09          4,41705e-09
xu1.22                                   1,2698e-09           1,2698e-09
xu1.23                                 -2,26983e-05         -2,26983e-05
xu1.26                                  1,34015e-09          1,34015e-09
xu1.xu3.e1_int1                        -1,03329e-07         -1,03329e-07
xu1.24                                  3,20257e-10          3,20257e-10
xu1.27                                 -1,84034e-07         -1,84034e-07
xu1.xu3.e2_int1                        -2,90557e-07         -2,90557e-07
xu1.25                                  -1,8878e-07          -1,8878e-07
xu1.xu1.vref                            1,03647e-07          1,03647e-07
xu1.xu1.vshf                           -2,84529e-06         -2,84529e-06
xu1.vimon                              -2,87478e-06         -2,87478e-06
xu1.xu1.zc                                -0,980296            -0,980296
xu1.xu1.gzc_int1                          -0,990099            -0,990099
xu1.crs                                    0,980296             0,980296
xu1.xu1.gcr_int1                           0,990099             0,990099
xu1.28                                     -3,40496             -3,40496
xu1.29                                   -0,0326457           -0,0326457
xu1.30                                    -0,138973            -0,138973
xu1.31                                 -3,37856e-05         -3,37856e-05
xu1.32                                    -0,132889            -0,132889
xu1.xu2.g1_int1                           -0,134219            -0,134219
xu1.cl_clamp                             -0,0382673           -0,0382673
xu1.34                                   6,7074e-12          6,60677e-12
xu1.35                                  6,70807e-08          6,60743e-08
xu1.clamp                                 0,0140883            0,0138769 *
xu1.xu5.g1_int1                         -8,3835e-11          -8,3835e-11
xu1.36                                  1,85534e-09          1,85534e-09
xu1.38                                  -0,00313833          -0,00308964 *
xu1.39                                  -0,00627665          -0,00617928 *
xu1.40                                  -9,0982e-05          -9,0982e-05
xu1.41                                 -0,000181964         -0,000181964
xu1.xi_nn.7                                       0                    0
xu1.xi_nn.8                                       0                    0
xu1.xi_nn.3                                       0                    0
xu1.xi_nn.6                                       0                    0
xu1.xi_nn.4                                       0                    0
xu1.xi_nn.5                                       0                    0
xu1.xi_np.7                                       0                    0
xu1.xi_np.8                                       0                    0
xu1.xi_np.3                                       0                    0
xu1.xi_np.6                                       0                    0
xu1.xi_np.4                                       0                    0
xu1.xi_np.5                                       0                    0
xu1.xe_n.7                                        0                    0
xu1.xe_n.8                                        0                    0
xu1.xe_n.3                                        0                    0
xu1.xe_n.6                                        0                    0
xu1.xe_n.4                                        0                    0
xu1.xe_n.5                                        0                    0
xu1.esdp                                4,41661e-09          4,41661e-09
xu1.vsense                              0,000670874          0,000660809 *
xu1.xvccs_lim_1.g1_int1                 1,84506e-11          1,84506e-11
xu1.46                                  2,31698e-09          2,31698e-09
xu1.47                                  9,61398e-09          9,61398e-09
xu1.48                                  0,000107084          0,000107084
xu1.49                                  2,21977e-09          2,21977e-09
xu1.50                                  3,56242e-08          3,56242e-08
xu1.xiqpos.g1_int1                                0                    0
xu1.xiqneg.g1_int1                      2,94997e-09          2,94997e-09
xu1.53                                   1,0263e-07           1,0263e-07
xu1.xcl_amp.gvo+_int1                             0                    0
xu1.54                                  2,99375e-06          2,99375e-06
xu1.xcl_amp.gvo-_int1                   2,94894e-06          2,94894e-06
xu1.60                                   0,00651111           0,00641341 *
xu1.xgr_amp.gvo+_int1                    0,00664123           0,00654157 *
xu1.59                                  0,000670867          0,000660802 *
xu1.61                                   1,0263e-07           1,0263e-07
xu1.xgr_amp.gvo-_int1                             0                    0
xu1.62                                   0,00651104           0,00641334 *
xu1.63                                  1,02629e-07          1,02629e-07
xu1.xgr_src.g1_int1                      0,00644648           0,00634974 *
xu1.64                                  1,02629e-07          1,02629e-07
xu1.65                                  2,99372e-06          2,99372e-06
xu1.xcl_src.g1_int1                    -2,86246e-06         -2,86246e-06
xu1.66                                   -0,0551115           -0,0551115
xu1.xclawp.g1_int1                       0,00115842           0,00115842
xu1.67                                    0,0011776            0,0011776
xu1.xclawn.g1_int1                      2,47525e-05          2,47525e-05
xu1.68                                   -0,0551109           -0,0551109
xu1.69                                   0,00117758           0,00117758
xu1.vcc_clp                             -0,00501008          -0,00501008
xu1.vee_clp                             0,000107053          0,000107053
xu1.70                                   0,00483791           0,00483791
xu1.xclaw_amp.gvo+_int1                  0,00493457           0,00493457
xu1.vout_s                             -2,61695e-05         -2,61695e-05
xu1.71                                   0,00012942           0,00012942
xu1.xclaw_amp.gvo-_int1                 0,000131904          0,000131904
xu1.72                                   0,00483787           0,00483787
xu1.73                                  0,000129419          0,000129419
xu1.claw_clamp                            -0,423803            -0,423803
xu1.xclaw_src.g1_int1                    0,00466183           0,00466183
xu1.sw_ol                                5,1568e-08           5,1568e-08
xu1.74                                  1,03136e-07          1,03136e-07
xu1.xol_sense.gsw+_int1                           0                    0
xu1.75                                 -5,74957e-06         -5,74957e-06
xu1.76                                 -5,23391e-05         -5,23391e-05
xu1.77                                   -0,0378884           -0,0378884
xu1.78                                  2,31701e-09          2,31701e-09
xu1.xvcm_clamp.g1_int1                  -1,0232e-07          -1,0232e-07
xu1.81                                   1,0573e-07           1,0573e-07
xu1.82                                 -2,30897e-05         -2,30897e-05
xu1.83                                    0,0010806            0,0010806
xu1.84                                 -4,82135e-09         -4,82135e-09
xu1.85                                 -4,82139e-09         -4,82139e-09
net-_r1-pad1_                          -1,88819e-07         -1,88819e-07
net-_r3-pad2_                           4,41612e-09          4,41612e-09
b.xu1.xvcm_clamp.bg1#branch                       0                    0
b.xu1.xol_sense.bgsw+#branch                      0                    0
b.xu1.xclaw_src.bg1#branch                        0                    0
b.xu1.xclaw_amp.bgvo-#branch                      0                    0
b.xu1.xclaw_amp.bgvo+#branch                      0                    0
b.xu1.xclawn.bg1#branch                           0                    0
b.xu1.xclawp.bg1#branch                           0                    0
b.xu1.xcl_src.bg1#branch                          0                    0
b.xu1.xgr_src.bg1#branch                          0                    0
b.xu1.xgr_amp.bgvo-#branch                        0                    0
b.xu1.xgr_amp.bgvo+#branch                        0                    0
b.xu1.xcl_amp.bgvo-#branch                        0                    0
b.xu1.xcl_amp.bgvo+#branch                        0                    0
b.xu1.xiqneg.bg1#branch                           0                    0
b.xu1.xiqpos.bg1#branch                           0                    0
b.xu1.xvccs_lim_1.bg1#branch                      0                    0
b.xu1.xu5.bg1#branch                              0                    0
b.xu1.xu2.bg1#branch                              0                    0
b.xu1.xu1.bgcr#branch                             0                    0
b.xu1.xu1.bgzc#branch                             0                    0
b.xu1.xu3.be2#branch                              0                    0
b.xu1.xu3.be1#branch                              0                    0
h.xu1.h1#branch                         2,84632e-08          2,84632e-08
v.xu1.v4#branch                        -5,91174e-09         -5,91174e-09
h.xu1.h3#branch                         3,10725e-05          3,05905e-05 *
v.xu1.v12#branch                        -0,00633952          -0,00624118 *
h.xu1.h2#branch                         9,00812e-07          9,00812e-07
v.xu1.v11#branch                        0,000183888          0,000183888
e.xu1.e1#branch                           0,0416768            0,0416791
e.xu1.e4#branch                         0,000187566          0,000187566
e.xu1.e5#branch                         2,59104e-07          2,59104e-07
e.xu1.xe_n.e3#branch                   -9,32341e-11         -9,32341e-11
e.xu1.xe_n.e2#branch                              0                    0
e.xu1.xe_n.e1#branch                              0                    0
e.xu1.xi_np.e2#branch                             0                    0
e.xu1.xi_np.e1#branch                             0                    0
e.xu1.xi_nn.e2#branch                             0                    0
e.xu1.xi_nn.e1#branch                             0                    0
e.xu1.xu1.eshf#branch                             0                    0
e.xu1.xu3.e2#branch                               0                    0
e.xu1.xu3.e1#branch                               0                    0
vbt1#branch                             4,85822e-13          4,85822e-13
v.xu1.xu1.v1#branch                               0                    0
v.xu1.v_os#branch                       9,23018e-11          9,23018e-11
v.xu1.vcm_max#branch                   -1,05921e-15         -1,05921e-15
v.xu1.vcm_min#branch                    2,27387e-17          2,27387e-17
v.xu1.v_orp#branch                                0                    0
v.xu1.v_orn#branch                                0                    0
v.xu1.v_iscn#branch                      1,0262e-21           1,0262e-21
v.xu1.v_iscp#branch                      1,0262e-21           1,0262e-21
v.xu1.v_grn#branch                       1,0262e-21           1,0262e-21
v.xu1.v_grp#branch                       1,0262e-21           1,0262e-21
doAnalyses: Too many iterations without convergence
run simulation(s) aborted
Warning - approaching max data size: current size =  634,281 MB, limit =  598,992 MB

#5

ngspice fails to catch the dc operating point before starting the transient simulation.

The OpAmp tries to zero the voltage difference between its input nodes 3 and 2 by a suitable output voltage at node 1. With the circuit and the resistor parameters chosen, the diference would be zero if the output was 6V, the power supply voltage. The LM358 bipolar OpAmp, however, can never output a voltage up to its supply rail. Thus the output is saturated somewhere below the supply, Then the difference between nodes 3 and 2 is not 0. Depending on the model, this may be not a good starting point for iterating the operating point.

Try increasing R3, just to find a starting point. And perhaps make the circuit symmetric by adding a negative supply to pin 5.


#6

May be the GND is not been treat as ngspice GND. You may try to replace the GND by connect them to a net named “0” (Zero). It may help, because ngspice to not understand net named “GND” as the global zero volt reference.


#8

Can you paste your SPICE netlist so we can take a look?

For dealing with convergence problems from manufacturer supplied models, you might need to utilize the .ic or .nodeset commands. Adding uic to the .tran command might work too in specific scenarios. All this nonsense is covered on page 253 of the ngspice manual: http://ngspice.sourceforge.net/docs/ngspice-30-manual.pdf

If you keep running into problems, and you just need a basic analysis of your circuit, you might be able to get away with just using a simpler model. Below is a basic single pole opamp subcircuit. It doesn’t consider the rails, so any type of input or output saturation won’t be simulated. Just change the value of GBWP in the .subckt line with the gain-bandwidth product from the datasheet of your opamp. For even better modelling you can change Rin, Rout, and Aol (open-loop gain) with values found or derived from the datasheet too. You can copy this text into a .lib file and use it in your schematic with the proper SPICE node sequence set (2,3,1 for your LM358).

* single pole opamp model
* 1 = inverting input
* 2 = non-inverting input
* 3 = output
.subckt opamp 1 2 3 params: Rin=1g, Rout=1m, Aol=1g, GBWP=100meg
R1 2 1 {Rin}
G1 0 3 2 1 {Aol}
R2 3 0 {Rout}
C3 3 0 {Aol/(2*3.1415926536*GBWP)}
.ends opamp

#9

I build a circuit (different) with the same model and it gives similar error messages (however, the simulation works and the result make sense):

Circuit: KiCad schematic
Error on line 0 :
a.xu3.asor_swp %vd xu3.clamp xu3.55 %gd xu3.clamp xu3.55 xu3:as_vswitch_1
MIF-ERROR - unable to find definition of model xu3:as_vswitch_1
Error on line 0 :
a.xu3.asor_swn %vd xu3.56 xu3.clamp %gd xu3.56 xu3.clamp xu3:as_vswitch_2
MIF-ERROR - unable to find definition of model xu3:as_vswitch_2
Error on line 0 :
a.xu3.as1 %vd xu3.sw_ol xu3.mid %gd xu3.28 xu3.29 xu3:as_vswitch_3
MIF-ERROR - unable to find definition of model xu3:as_vswitch_3
Error on line 0 :
a.xu3.as7 %vd 0 output_3 %gd 0 output_3 xu3:as_vswitch_4
MIF-ERROR - unable to find definition of model xu3:as_vswitch_4
Error on line 0 :
a.xu3.as6 %vd output_3 +5v %gd output_3 +5v xu3:as_vswitch_5
MIF-ERROR - unable to find definition of model xu3:as_vswitch_5
Warning: Model issue on line 0 :
.model xu3:as_vswitch_1 aswitch(r_on=10m r_off=1t cntl_on=10m cntl_off=0 ...
Unknown model type aswitch - ignored
Warning: Model issue on line 0 :
.model xu3:as_vswitch_2 aswitch(r_on=10m r_off=1t cntl_on=10m cntl_off=0 ...
Unknown model type aswitch - ignored
Warning: Model issue on line 0 :
.model xu3:as_vswitch_3 aswitch(r_on=1m r_off=1t cntl_on=500m cntl_off=1 ...
Unknown model type aswitch - ignored
Warning: Model issue on line 0 :
.model xu3:as_vswitch_4 aswitch(r_on=50 r_off=1t cntl_on=500m cntl_off=4 ...
Unknown model type aswitch - ignored
Warning: Model issue on line 0 :
.model xu3:as_vswitch_5 aswitch(r_on=50 r_off=1t cntl_on=500m cntl_off=4 ...
Unknown model type aswitch - ignored
Background thread stopped with timeout = 0
Reducing trtol to 1 for xspice 'A' devices
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: v2: no DC value, transient time 0 value used
Warning: v1: no DC value, transient time 0 value used

image

test-lm2.bak1.tar.gz (8.1 KB)

I am using ngSpice 30 built myself.

If I remove the file ~/.spiceinit the simulation does not work at all:

Circuit: KiCad schematic
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
Error: no such function 'if'
PTerror: syntax error
Warning: Model issue on line 0 :
.model xu3:r_noiseless res(t_abs=-273.15) ...
unrecognized parameter (t_abs) - ignored
Error on line 0 :
b.xu3.xu3.be1 xu3.xu3.e1_int1 0 v= if ( v(xu3.24,xu3.mid) < v(xu3.vee_b,xu3.mid) -   3.0000000000e-01 , v(xu3.vcc_b,xu3.mid) , v(xu3.24,xu3.mid) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xu3.be2 xu3.xu3.e2_int1 0 v= if ( v(xu3.25,xu3.mid) < v(xu3.vee_b,xu3.mid) -   3.0000000000e-01 , v(xu3.vcc_b,xu3.mid) , v(xu3.25,xu3.mid) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xu1.bgcr xu3.xu1.gcr_int1 0 v= if ( ( abs ( v(xu3.xu1.zc,xu3.mid) ) <=   9.0000000000e-01 ) ,   0.0000000000e+00 ,   1.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xiqpos.bg1 xu3.xiqpos.g1_int1 0 v= if ( ( v(xu3.vimon,xu3.mid) <=   0.0000000000e+00 ) ,   0.0000000000e+00 , (    1.00000000000000002e-03  ) * v(xu3.vimon,xu3.mid) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xiqneg.bg1 xu3.xiqneg.g1_int1 0 v= if ( ( v(xu3.mid,xu3.vimon) <=   0.0000000000e+00 ) ,   0.0000000000e+00 , (    1.00000000000000002e-03  ) * v(xu3.mid,xu3.vimon) )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xcl_amp.bgvo+ xu3.xcl_amp.gvo+_int1 0 v= if ( v(xu3.vimon,xu3.mid) > v(xu3.51,xu3.mid) , ( ( v(xu3.vimon,xu3.mid) - v(xu3.51,xu3.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xcl_amp.bgvo- xu3.xcl_amp.gvo-_int1 0 v= if ( v(xu3.vimon,xu3.mid) < v(xu3.52,xu3.mid) , ( ( v(xu3.52,xu3.mid) - v(xu3.vimon,xu3.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
s.xu3.sor_swp xu3.clamp xu3.55 xu3.clamp xu3.55 xu3:s_vswitch_1 
Unable to find definition of model xu3:s_vswitch_1 - default assumed
Error on line 0 :
s.xu3.sor_swn xu3.56 xu3.clamp xu3.56 xu3.clamp xu3:s_vswitch_2 
Unable to find definition of model xu3:s_vswitch_2 - default assumed
Error on line 0 :
b.xu3.xgr_amp.bgvo+ xu3.xgr_amp.gvo+_int1 0 v= if ( v(xu3.59,xu3.mid) > v(xu3.57,xu3.mid) , ( ( v(xu3.59,xu3.mid) - v(xu3.57,xu3.mid) ) * (    1.00000000000000000e+01  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xgr_amp.bgvo- xu3.xgr_amp.gvo-_int1 0 v= if ( v(xu3.59,xu3.mid) < v(xu3.58,xu3.mid) , ( ( v(xu3.58,xu3.mid) - v(xu3.59,xu3.mid) ) * (    1.00000000000000000e+01  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xclaw_amp.bgvo+ xu3.xclaw_amp.gvo+_int1 0 v= if ( v(xu3.vout_s,xu3.mid) > v(xu3.vcc_clp,xu3.mid) , ( ( v(xu3.vout_s,xu3.mid) - v(xu3.vcc_clp,xu3.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xclaw_amp.bgvo- xu3.xclaw_amp.gvo-_int1 0 v= if ( v(xu3.vout_s,xu3.mid) < v(xu3.vee_clp,xu3.mid) , ( ( v(xu3.vee_clp,xu3.mid) - v(xu3.vout_s,xu3.mid) ) * (    1.00000000000000000e+00  ) ) ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
b.xu3.xol_sense.bgsw+ xu3.xol_sense.gsw+_int1 0 v= if ( ( v(xu3.40,xu3.mid) >   1.0000000000e-02 | v(xu3.38,xu3.mid) >   1.0000000000e-02 ) ,   1.0000000000e+00 ,   0.0000000000e+00 )
parameter value out of range or the wrong type
Error on line 0 :
s.xu3.s1 xu3.28 xu3.29 xu3.sw_ol xu3.mid xu3:s_vswitch_3 
Unable to find definition of model xu3:s_vswitch_3 - default assumed
Error on line 0 :
s.xu3.s7 0 output_3 0 output_3 xu3:s_vswitch_4 
Unable to find definition of model xu3:s_vswitch_4 - default assumed
Error on line 0 :
s.xu3.s6 output_3 +5v output_3 +5v xu3:s_vswitch_5 
Unable to find definition of model xu3:s_vswitch_5 - default assumed
Warning: Model issue on line 0 :
.model xu3:s_vswitch_1 vswitch (ron=10m roff=1t von=10m voff=0) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu3:s_vswitch_2 vswitch (ron=10m roff=1t von=10m voff=0) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu3:s_vswitch_3 vswitch (ron=1m roff=1t von=500m voff=100m) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu3:s_vswitch_4 vswitch (ron=50 roff=1t von=500m voff=450m) ...
Unknown model type vswitch - ignored
Warning: Model issue on line 0 :
.model xu3:s_vswitch_5 vswitch (ron=50 roff=1t von=500m voff=450m) ...
Unknown model type vswitch - ignored
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
doAnalyses: parameter value out of range or the wrong type
run simulation(s) aborted

#10

Base on the log message, and the output I think you did not use the simple model from @Ste.

Can you do eeschema -> Tools -> Generated Netlist File… -> Spice (Tab) -> Generate Netlist (Button) … Then show the content of that netlist file here may be.


#11

Using that simple model would not work well in this case since he is using the amplifier in open-loop as a comparator. Rail saturation is vital for that mode of operation.

I ran @Val 's simulation, and I get a completely different result. First, here is the netlist as requested:

.title KiCad schematic
.include "LMx58_LM2904-ti.lib"
.include "led.lib"
V1 +5V 0 pulse(0 5 0 1m 1m 10000)
V2 +5V_pulses 0 pulse(0 5 100m 200m 150m 200m 800m)
XU3 +5V_pulses Net-_R11-Pad2_ +5V 0 Output_3 LMX58_LM2904
R11 +5V Net-_R11-Pad2_ 100k
R12 Net-_R11-Pad2_ 0 100k
R13 +5V Net-_D5-Pad2_ 620
D5 Net-_D5-Pad2_ Output_3 LED_RED
.TRAN 0.0001 1 0
.end

It looks like his system is unable to properly parse these 5 model lines from the .lib file, while my system has no issue doing it:

.MODEL S_VSWITCH_1 VSWITCH (RON=10M ROFF=1T VON=10M VOFF=0)
.MODEL S_VSWITCH_2 VSWITCH (RON=10M ROFF=1T VON=10M VOFF=0)
.MODEL S_VSWITCH_3 VSWITCH (RON=1M ROFF=1T VON=500M VOFF=100M)
.MODEL S_VSWITCH_4 VSWITCH (RON=50 ROFF=1T VON=500M VOFF=450M)
.MODEL S_VSWITCH_5 VSWITCH (RON=50 ROFF=1T VON=500M VOFF=450M)

I wonder if this has anything to do with his system being a Linux system??? I noticed that the .lib file from TI has Windows EOL characters instead of UNIX. That could be one source of the issue. It also might be worth removing the space between the VSWITCH and open parentheses in case that may be causing an issue too.

So the strange thing here is that his simulation which is missing these switch models is able to converge. My simulation which has no issue parsing these lines cannot converge, much like in @pauledd 's circuit. I also ran this LM358 model in LTspice and it has a difficult time converging there too. I have to use the “Alternate” (high precision) matrix solver to get it to work, and it still takes a long time even just to get the operating point.

I think this brings up a great rule of thumb for anybody new to the area of SPICE simulation:

Use the simplest model that gets the job done.

The more complicated the model, the more likely you’ll run into issues in getting it simulate effectively. This TI supplied model is extremely complex, with all sorts of behavioral voltage controlled current & voltage sources. These are known to cause convergence issues. I remember working on a universal opamp SPICE model a few years ago which included rail saturation, but I never finished it. It might be worth going back to since it would be helpful in these situations. Just plug in a few values from the datasheet, and you got a pretty decent model for most situations.


#12

The ngspice error message above the image:

Below the image:

Comparing the two error messages: Is this the same lib file? In the first message ngspice is looking for (and not finding) an aswitch. There is no aswitch in ngspice, PSPICE. Did you edit the lib file replacing vswitch by aswitch? This cannot work. The second message is obvious, because the PSPICE compatibility flag has not been set.

Sorry, I have been wrong, please see next post.


#13

There is an aswitch in ngspice. It is part of the XSPICE analog/digital enhancement. You will need to enable XSPICE in your compilation setup to get access to these models. If you already have done so, the error messages seem to indicate that the code model installation is not correct.


#14

I am using ngSpice 30 built myself.

Looks like the xspice is enabled.

I just checked the log files from building the package:

valentin@computer:~/src/kicad-ngspice-build$ grep xspice ngspice-kicad_0.2-30_amd64.build | head 
dh_auto_configure override_dh_auto_configure -- --datarootdir=/usr/share/ngspice-kicad --includedir=/usr/share/ngspice-kicad/ngspice/include --with-ngshared --enable-xspice --enable-cider --enable-openmp --with-tcl=/usr/lib
	./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=\${prefix}/lib/x86_64-linux-gnu --libexecdir=\${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --datarootdir=/usr/share/ngspice-kicad --includedir=/usr/share/ngspice-kicad/ngspice/include --with-ngshared --enable-xspice --enable-cider --enable-openmp --with-tcl=/usr/lib
config.status: creating src/xspice/Makefile
config.status: creating src/xspice/cm/Makefile
config.status: creating src/xspice/cmpp/Makefile
config.status: creating src/xspice/icm/makedefs
config.status: creating src/xspice/icm/GNUmakefile
config.status: creating src/xspice/mif/Makefile
config.status: creating src/xspice/evt/Makefile
config.status: creating src/xspice/enh/Makefile
valentin@computer:~/src/kicad-ngspice-build$

I noticed that some files are missing.

Here are the files from my package (built using the scripts from the original, I just updated the source code of ngSpice):

valentin@computer:~$ dpkg-query -L  libngspice-kicad
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
/usr/lib/x86_64-linux-gnu/libngspice.la
/usr/share
/usr/share/doc
/usr/share/doc/libngspice-kicad
/usr/share/doc/libngspice-kicad/copyright
/usr/share/doc/libngspice-kicad/README.tcl.gz
/usr/share/doc/libngspice-kicad/changelog.Debian.gz
/usr/share/doc/libngspice-kicad/README.adms
/usr/share/ngspice-kicad
/usr/share/ngspice-kicad/ngspice
/usr/share/ngspice-kicad/ngspice/include
/usr/share/ngspice-kicad/ngspice/include/ngspice
/usr/share/ngspice-kicad/ngspice/include/ngspice/sen2defs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/tfdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/bool.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/matldefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/dstring.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/wstdio.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/carddefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ipcproto.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/trandefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/fftext.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/memory.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cmproto.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/outpdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/noisedef.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/mifproto.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/multi_line.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cmtypes.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ipctiein.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/dopdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/tskdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/graph.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/dvec.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/devdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/numglobs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/fteinput.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/FastNorm3.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/stringskip.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/onedev.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/profile.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/enhtypes.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/swec.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/const.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/compatmode.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/miftypes.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cidersupt.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/mif.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ftedev.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/trcvdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/pnode.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/sensgen.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/1-f-code.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/evtudn.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/numgen.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/meshdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/methdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/randnumb.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/missing_math.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/wallace.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/fteext.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/fteinp.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/enh.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/numenum.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/jobdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cmconstants.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/sim.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/opdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/tclspice.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/acdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/inpmacs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/inpdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/spmatrix.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/defines.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/stringutil.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/evtshared.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/iferrmsg.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/onemesh.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/domndefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/sharedspice.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/mifcmdat.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/plot.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/macros.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ngspice.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/optdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/typedefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cktdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/material.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/gendefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/pzdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/hash.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/evttypes.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/complex.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/mobdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/inpptree.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/numcards.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/elctdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/suffix.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/meshext.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ciderinp.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/mifdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/config.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cm.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ftedebug.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ftedefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cluster.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/twomesh.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/evtproto.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/wordlist.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/optndefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/bdrydefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/dllitf.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/smpdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/sensdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cpdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cpstd.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/gendev.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/dgen.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/grid.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/contdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/twodev.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/mifparse.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/numconst.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ipc.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/hlpdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/fteparse.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/modldefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/distodef.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/cpextern.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ftedbgra.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/lsort.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/evt.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/fteoptdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/ifsim.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/pssdefs.h
/usr/share/ngspice-kicad/ngspice/include/ngspice/sperror.h
/usr/share/ngspice-kicad/ngspice/dlmain.c
/usr/share/ngspice-kicad/ngspice/scripts
/usr/share/ngspice-kicad/ngspice/scripts/setplot
/usr/share/ngspice-kicad/ngspice/scripts/spinit
/usr/share/ngspice-kicad/ngspice/scripts/devaxis
/usr/share/ngspice-kicad/ngspice/scripts/devload
/usr/share/ngspice-kicad/ngspice/scripts/spectrum
/usr/share/ngspice-kicad/ngspice/scripts/ciderinit
/usr/lib/x86_64-linux-gnu/libngspice.so
/usr/lib/x86_64-linux-gnu/libngspice.so.0
valentin@computer:~$ 

These files are missing:

./lib/ngspice/table.cm
./lib/ngspice/digital.cm
./lib/ngspice/xtraevt.cm
./lib/ngspice/xtradev.cm
./lib/ngspice/analog.cm
./lib/ngspice/spice2poly.cm

When I install from source at /usr/local (with ./configure … ; make ; make install) they appear on /usr/local.

Why they don’t appear in the package? But in the package building instructions? Do they appear in the old version of the package?

No, they don’t appear in the original package from the repository:

valentin@computer:/var$ dpkg-deb -c  ./cache/apt/archives/libngspice-kicad_0.1-2~201710281402+2e5be8d~ubuntu16.04.1_amd64.deb 
drwxr-xr-x root/root         0 2017-10-28 17:10 ./
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/ngspice-kicad/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/
-rw-r--r-- root/root      5271 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/spectrum
-rw-r--r-- root/root       860 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/spinit
-rw-r--r-- root/root      1278 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/devaxis
-rw-r--r-- root/root       355 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/devload
-rw-r--r-- root/root      1015 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/setplot
-rw-r--r-- root/root       490 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/scripts/ciderinit
-rw-r--r-- root/root     12552 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/dlmain.c
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/
-rw-r--r-- root/root     10946 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/spmatrix.h
-rw-r--r-- root/root     14822 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/evt.h
-rw-r--r-- root/root      1242 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/numglobs.h
-rw-r--r-- root/root     11271 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/mifcmdat.h
-rw-r--r-- root/root       554 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/stringskip.h
-rw-r--r-- root/root      1109 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/methdefs.h
-rw-r--r-- root/root      1547 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/optndefs.h
-rw-r--r-- root/root       290 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/compatmode.h
-rw-r--r-- root/root      2914 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cidersupt.h
-rw-r--r-- root/root      1542 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/profile.h
-rw-r--r-- root/root      1577 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/sperror.h
-rw-r--r-- root/root     13197 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/fteext.h
-rw-r--r-- root/root      1982 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/dstring.h
-rw-r--r-- root/root      2645 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/tskdefs.h
-rw-r--r-- root/root       209 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/bool.h
-rw-r--r-- root/root      2684 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ipcproto.h
-rw-r--r-- root/root      2769 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ipc.h
-rw-r--r-- root/root      4727 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/optdefs.h
-rw-r--r-- root/root      1249 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/domndefs.h
-rw-r--r-- root/root      2945 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/macros.h
-rw-r--r-- root/root       702 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/fteoptdefs.h
-rw-r--r-- root/root      5058 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/onemesh.h
-rw-r--r-- root/root      8662 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/devdefs.h
-rw-r--r-- root/root      3880 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/dllitf.h
-rw-r--r-- root/root      1575 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/numgen.h
-rw-r--r-- root/root      1297 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/numcards.h
-rw-r--r-- root/root       650 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/wallace.h
-rw-r--r-- root/root      1455 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/modldefs.h
-rw-r--r-- root/root      2047 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/dopdefs.h
-rw-r--r-- root/root      1062 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/fteinput.h
-rw-r--r-- root/root      3210 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/onedev.h
-rw-r--r-- root/root       726 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/contdefs.h
-rw-r--r-- root/root      1679 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/smpdefs.h
-rw-r--r-- root/root       657 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cluster.h
-rw-r--r-- root/root      4486 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/evtudn.h
-rw-r--r-- root/root      2614 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/mifproto.h
-rw-r--r-- root/root      4621 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/mifparse.h
-rw-r--r-- root/root       467 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/opdefs.h
-rw-r--r-- root/root      2559 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/evtproto.h
-rw-r--r-- root/root      1988 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/inpmacs.h
-rw-r--r-- root/root      2446 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/sen2defs.h
-rw-r--r-- root/root       708 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/meshext.h
-rw-r--r-- root/root       877 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/missing_math.h
-rw-r--r-- root/root      1193 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/evttypes.h
-rw-r--r-- root/root      2607 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/fteparse.h
-rw-r--r-- root/root     16104 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/config.h
-rw-r--r-- root/root      2557 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ipctiein.h
-rw-r--r-- root/root      2822 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ftedefs.h
-rw-r--r-- root/root      2001 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/sensdefs.h
-rw-r--r-- root/root     11946 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/swec.h
-rw-r--r-- root/root      4498 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cpextern.h
-rw-r--r-- root/root     18152 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ifsim.h
-rw-r--r-- root/root      2052 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/memory.h
-rw-r--r-- root/root      1340 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/wordlist.h
-rw-r--r-- root/root       942 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/typedefs.h
-rw-r--r-- root/root      2703 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/material.h
-rw-r--r-- root/root      1890 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ftedebug.h
-rw-r--r-- root/root      4518 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/twodev.h
-rw-r--r-- root/root     19095 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cktdefs.h
-rw-r--r-- root/root        16 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/suffix.h
-rw-r--r-- root/root       519 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/jobdefs.h
-rw-r--r-- root/root       818 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/tfdefs.h
-rw-r--r-- root/root      1572 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/gendefs.h
-rw-r--r-- root/root      5405 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/noisedef.h
-rw-r--r-- root/root      2375 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/matldefs.h
-rw-r--r-- root/root      4386 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/miftypes.h
-rw-r--r-- root/root       432 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/sim.h
-rw-r--r-- root/root      1300 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cmtypes.h
-rw-r--r-- root/root       928 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cmconstants.h
-rw-r--r-- root/root       812 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cpstd.h
-rw-r--r-- root/root      2956 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/defines.h
-rw-r--r-- root/root      7994 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/twomesh.h
-rw-r--r-- root/root       651 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/fteinp.h
-rw-r--r-- root/root      7185 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/numconst.h
-rw-r--r-- root/root     17388 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/hash.h
-rw-r--r-- root/root      4877 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/inpptree.h
-rw-r--r-- root/root      1969 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/numenum.h
-rw-r--r-- root/root     18317 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/complex.h
-rw-r--r-- root/root       674 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/carddefs.h
-rw-r--r-- root/root      1051 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/pzdefs.h
-rw-r--r-- root/root      2890 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/dvec.h
-rw-r--r-- root/root      1008 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/multi_line.h
-rw-r--r-- root/root       413 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/grid.h
-rw-r--r-- root/root      2485 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/1-f-code.h
-rw-r--r-- root/root       972 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/acdefs.h
-rw-r--r-- root/root      4771 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/gendev.h
-rw-r--r-- root/root       720 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/enhtypes.h
-rw-r--r-- root/root      1065 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/plot.h
-rw-r--r-- root/root       565 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/sensgen.h
-rw-r--r-- root/root      1030 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/meshdefs.h
-rw-r--r-- root/root      5018 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/fftext.h
-rw-r--r-- root/root      7130 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ngspice.h
-rw-r--r-- root/root      1075 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/tclspice.h
-rw-r--r-- root/root     11922 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/sharedspice.h
-rw-r--r-- root/root      3632 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/graph.h
-rw-r--r-- root/root      2467 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cpdefs.h
-rw-r--r-- root/root      2715 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/iferrmsg.h
-rw-r--r-- root/root      2938 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/lsort.h
-rw-r--r-- root/root      3395 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/wstdio.h
-rw-r--r-- root/root      6533 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/distodef.h
-rw-r--r-- root/root      2561 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/outpdefs.h
-rw-r--r-- root/root      2662 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/enh.h
-rw-r--r-- root/root       650 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/const.h
-rw-r--r-- root/root      3206 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cmproto.h
-rw-r--r-- root/root       759 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/pssdefs.h
-rw-r--r-- root/root      1554 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/mobdefs.h
-rw-r--r-- root/root       513 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/pnode.h
-rw-r--r-- root/root       676 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/trandefs.h
-rw-r--r-- root/root      2228 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ftedev.h
-rw-r--r-- root/root      1382 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ciderinp.h
-rw-r--r-- root/root      3326 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/hlpdefs.h
-rw-r--r-- root/root      1127 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/FastNorm3.h
-rw-r--r-- root/root      1519 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/bdrydefs.h
-rw-r--r-- root/root      4188 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/inpdefs.h
-rw-r--r-- root/root       557 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/dgen.h
-rw-r--r-- root/root       362 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/ftedbgra.h
-rw-r--r-- root/root      3589 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/mifdefs.h
-rw-r--r-- root/root      1765 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/trcvdefs.h
-rw-r--r-- root/root      2279 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/mif.h
-rw-r--r-- root/root      2039 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/cm.h
-rw-r--r-- root/root       438 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/randnumb.h
-rw-r--r-- root/root      1131 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/elctdefs.h
-rw-r--r-- root/root      1356 2017-10-28 17:10 ./usr/share/ngspice-kicad/ngspice/include/ngspice/stringutil.h
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/doc/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/share/doc/libngspice-kicad/
-rw-r--r-- root/root      6479 2017-10-28 17:02 ./usr/share/doc/libngspice-kicad/README.adms.gz
-rw-r--r-- root/root         0 2017-10-28 17:01 ./usr/share/doc/libngspice-kicad/copyright
-rw-r--r-- root/root       321 2017-10-28 17:02 ./usr/share/doc/libngspice-kicad/changelog.Debian.gz
-rw-r--r-- root/root      2017 2017-10-28 17:02 ./usr/share/doc/libngspice-kicad/README.tcl.gz
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/lib/
drwxr-xr-x root/root         0 2017-10-28 17:10 ./usr/lib/x86_64-linux-gnu/
-rw-r--r-- root/root   7089240 2017-10-28 17:10 ./usr/lib/x86_64-linux-gnu/libngspice.so.0.0.0
-rw-r--r-- root/root       981 2017-10-28 17:10 ./usr/lib/x86_64-linux-gnu/libngspice.la
lrwxrwxrwx root/root         0 2017-10-28 17:10 ./usr/lib/x86_64-linux-gnu/libngspice.so.0 -> libngspice.so.0.0.0
lrwxrwxrwx root/root         0 2017-10-28 17:10 ./usr/lib/x86_64-linux-gnu/libngspice.so -> libngspice.so.0.0.0
valentin@computer:/var$

#15

So the configure step includes XSPICE.

Finally the code models are made and stored in library files analog.cm, digital.cm etc. KiCad does not use a spinit file (ngspice initialization file with ‘codemodel path/analog.cm’ commands) but searches itself for the code models in a dedicated directory. I am not on Linux, so I do not know this directory. Maybe a colleague here on the forum might help to identify the correct codemodel path for your system.


#16

But these .cm files are missing even from the original package from the repository (libngspice-kicad_0.1-2~201710281402+2e5be8d~ubuntu16.04.1_amd64.deb).

Maybe a bug in the building instructions of the package libngspice-kicad?

Looks like the files are compiled, but not included in the package:

valentin@computer:~/src$ find -name digital.cm
./kicad-ngspice-build/ngspice-kicad-0.2.30/ngspice/src/xspice/icm/digital/digital.cm
./kicad-ngspice-build/ngspice-kicad-0.2.30/debian/tmp/usr/lib/x86_64-linux-gnu/ngspice/digital.cm
./ngspice-30/release/src/xspice/icm/digital/digital.cm
valentin@computer:~/src$

If I understand correctly (I am not familiar with the Debian package system) my guess is that the bug is in this file:

valentin@computer:~/src/kicad-ngspice-build/ngspice-kicad-0.2.30/debian$ cat libngspice-kicad.install 
usr/lib/*/libngspice*
usr/share/ngspice-kicad/*
valentin@computer:~/src/kicad-ngspice-build/ngspice-kicad-0.2.30/debian$ 

This line should be added:

usr/lib/ngspice/*

However, I am not sure what will happen when the user installs the ngspice package. There is a risk that the ngspice package will overwrite the same files.

Just checked it - yes, it will create a package conflict.

valentin@computer:/var/cache/apt/archives$ dpkg-deb -c ngspice_26-1build1_amd64.deb  | grep usr/lib
drwxr-xr-x root/root         0 2016-02-07 13:08 ./usr/lib/
drwxr-xr-x root/root         0 2016-02-07 13:08 ./usr/lib/ngspice/
-rwxr-xr-x root/root    157736 2016-02-07 13:08 ./usr/lib/ngspice/digital.cm
-rwxr-xr-x root/root     19368 2016-02-07 13:08 ./usr/lib/ngspice/spice2poly.cm
-rwxr-xr-x root/root    123496 2016-02-07 13:08 ./usr/lib/ngspice/analog.cm
-rwxr-xr-x root/root     54320 2016-02-07 13:08 ./usr/lib/ngspice/xtradev.cm
-rwxr-xr-x root/root     27968 2016-02-07 13:08 ./usr/lib/ngspice/xtraevt.cm
valentin@computer:/var/cache/apt/archives$ 

The old version of ngSpice (if installed) will overwrite the files in the /usr/lib/ngspice/ directory.

The solution is to rename the lib/ngspice/ directory in the source code. This will prevent the creating of a conflicting package.

Another guess: maybe --datarootdir=/usr/share/ngspice-kicad is not enough, also --datadir=/usr/share/ngspice-kicad should be included. Because I just read the Makefile and it does not make sense:

datadir = ${datarootdir}
datarootdir = ${prefix}/share

or

datadir = ${datarootdir}
datarootdir = /usr/share/ngspice-kicad

This does not make sense. The first line should be after the last.

Or maybe it will work, I am not familiar with how make is working. But it’s logical that lines are interpreted from the top to bottom. And at the first line ${datarootdir} is not defined (maybe it’s default).


#18

The newest version of ngspice (when built with configure --with-ngshared) is making a binary called cmpp. Is this program needed for KiCad? Do I need to include it in the libngspice-kicad package?


#19

cmpp is required during making the XSPICE code models. When they are compiled and available, and a user should not make and add his own code models, then cmpp is not needed anymore.


#20

I assume that KiCad will not call the cmpp binary, the cmpp will be called by the user. So, there is no need cmpp to be included in the libngspice-kicad package, the user can install the ngspice package if he want to use cmpp.