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?