Error circuit not found

I am trying to figure out the simulation tool to test some circuits. I have something working but when I try to add an opamp it all goes to hell.

This thingy goes well

But when I try to add an opamp and a 5VDC source

This happens to me.

Background thread stopped with timeout = 0
Warning: there is no circuit loaded.
Command 'remcirc' is ignored.
Note: Compatibility modes selected: ps lt a
Warning: No .subckt line found during evaluating command .probe (...)!
failing instance: xu1
Warning: No .subckt line found during evaluating command .probe (...)!
failing instance: xu1
Warning: No .subckt line found during evaluating command .probe (...)!
failing instance: xu1
Warning: No .subckt line found during evaluating command .probe (...)!
failing instance: xu1
Warning: No .subckt line found during evaluating command .probe (...)!
failing instance: xu1
Circuit: KiCad schematic
Error: unknown subckt: xu1 probe_int_net-_u1-+__xu1_1 probe_int_0_xu1_2 probe_int_/measurepoint_xu1_3 probe_int_net-_b1-n+__xu1_4 probe_int_0_xu1_5 opamp
Error: there aren't any circuits loaded.

I tried restarting Kicad, no luck. If I delete the Opamp it starts to work again.

Am I doing something wrong or am I looking at a bug/feature of some sort?

Regards :coffee:

Bas

Application: KiCad x64 on x64

Version: 7.0.7, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.1
	libcurl/7.88.1-DEV Schannel zlib/1.2.13

Platform: Windows 10 (build 19045), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Aug 14 2023 02:42:39
	wxWidgets: 3.2.2 (wchar_t,wx containers)
	Boost: 1.81.0
	OCC: 7.7.1
	Curl: 7.88.1-DEV
	ngspice: 40
	Compiler: Visual C++ 1936 without C++ ABI

Build settings:
	KICAD_SPICE=ON

Are you aware of the thread below? It has a bunch of working examples for ngSpice i KiCad.

This is an interesting case. We all might learn from it.

  1. KiCad/ngspice does not provide any model for operational amplifiers. Even if you have chosen the generic symbol for the OpAmp from the Simulation_Spice library, there is no model connected to it. The spice simulation requires a model for each element. Simple ones, e.g. R, L, and C are provided by spice, more complex ones (e.g. OpAmps) have to be provided by the user.

  2. The error message is somewhat strange to any user and not that helpful: what is the command .probe … ?

So what to do for the user:
Grab a model for a (generic) OpAmp and attach it to the symbol. Where to get it? See for example https://ngspice.sourceforge.io/model-parameters/basic_models.7z , where there is a generic_opamp.lib. How to attach it: See KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation (still written for KiCad 6, main difference is how to define the pin sequence symbol vs. model).

What to do by KiCad Eeschema devs:
Don’t allow starting a simulation, where there is a subcircuit (the OpAmp) defined, but no model is given.
Don’t pretend that there is a model (raw spice element) already available and attached.

What to do by the ngspice devs (it’s me):
Improve the error message (the .probe command is not the essential point, but the missing subcircuit is to be blamed) and then stop because a simulation without a model is not possible.

2 Likes

Thank you holger,

I am somewhat further but not yet there.

I did this:
afbeelding

I am not sure if I need to change pins as mentioned on your webpage. I also don’t have pins higher than 5.
afbeelding

That pulse voltage source toggles every 500ms between 0V and 5V

Now I got me this log. There is one error and several warnings

Note: Compatibility modes selected: ps lt a
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 Warning: Further gmin increment
Trying gmin =   5.6234E-03 Note: One successful gmin step
Trying gmin =   3.1623E-03 Note: One successful gmin step
Trying gmin =   1.3335E-03 Warning: Further gmin increment
Trying gmin =   2.5483E-03 Warning: Further gmin increment
Trying gmin =   2.9961E-03 Note: One successful gmin step
Trying gmin =   2.8387E-03 Note: One successful gmin step
Trying gmin =   2.6180E-03 Warning: Further gmin increment
Trying gmin =   2.7819E-03 Note: One successful gmin step
Trying gmin =   2.6987E-03 Warning: Further gmin increment
Trying gmin =   2.7608E-03 Note: One successful gmin step
Trying gmin =   2.7296E-03 Note: One successful gmin step
Trying gmin =   2.6834E-03 Warning: Further gmin increment
Trying gmin =   2.7180E-03 Note: One successful gmin step
Trying gmin =   2.7006E-03 Note: One successful gmin step
Trying gmin =   2.6748E-03 Note: One successful gmin step
Trying gmin =   2.6365E-03 Note: One successful gmin step
Trying gmin =   2.5802E-03 Note: One successful gmin step
Trying gmin =   2.4979E-03 Note: One successful gmin step
Trying gmin =   2.3793E-03 Note: One successful gmin step
Trying gmin =   2.2119E-03 Note: One successful gmin step
Trying gmin =   1.9827E-03 Note: One successful gmin step
Trying gmin =   1.6826E-03 Note: One successful gmin step
Trying gmin =   1.4280E-03 Note: One successful gmin step
Trying gmin =   1.2118E-03 Note: One successful gmin step
Trying gmin =   1.0284E-03 Warning: Further gmin increment
Trying gmin =   1.1631E-03 Warning: Further gmin increment
Trying gmin =   1.1995E-03 Warning: Further gmin increment
Trying gmin =   1.2087E-03 Warning: Further gmin increment
Trying gmin =   1.2111E-03 Warning: Further gmin increment
Trying gmin =   1.2116E-03 Warning: Further gmin increment
Trying gmin =   1.2118E-03 Warning: Last gmin step failed
Warning: Dynamic gmin stepping failed
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 source stepping
Supplies reduced to   0.0000% Note: One successful source step
Supplies reduced to   0.1000% Note: One successful source step
Supplies reduced to   0.2000% Note: One successful source step
Supplies reduced to   0.3500% Note: One successful source step
Supplies reduced to   0.5750% Note: One successful source step
Supplies reduced to   0.9125% Note: One successful source step
Supplies reduced to   1.4188% Note: One successful source step
Supplies reduced to   2.1781% Note: One successful source step
Supplies reduced to   2.5578% Note: One successful source step
Supplies reduced to   3.1273% Note: One successful source step
Supplies reduced to   3.9816% Note: One successful source step
Supplies reduced to   5.2631% Note: One successful source step
Supplies reduced to   7.1853% Note: One successful source step
Supplies reduced to  10.0685% Note: One successful source step
Supplies reduced to  11.5101% Note: One successful source step
Supplies reduced to  12.9518% Note: One successful source step
Supplies reduced to  15.1142% Note: One successful source step
Supplies reduced to  18.3579% Supplies reduced to  15.1142% Note: One successful source step
Supplies reduced to  15.6007% Supplies reduced to  15.1142% Warning: source stepping failed
Note: Transient op started
Error: Transient op failed, timestep too small
Transient solution failed -
Last Node Voltages
------------------
Node                                   Last Voltage        Previous Iter
----                                   ------------        -------------
net-_c1-pad1_                                     0                    0
probe_int_net-_d1-k__c1                     16528.3              16528.3
net-_d1-k_                                  16528.3              16528.3
probe_int_net-_d1-k__r2                     16528.3              16528.3
probe_int_net-_c1-pad1__r1                        0                    0
probe_int_net-_d1-k__d1                     16528.3              16528.3
net-_b1-n+_                                       5                    5
net-_u1-+_                                  994.602              994.602
probe_int_net-_d1-k__r3                     16528.3              16528.3
/measurepoint                              0.233748             0.233748
probe_int_net-_u1-+__r4                     994.602              994.602
xu1.esdn                                  -0.111412            -0.111412
xu1.mid                                     11570.2              11570.2
xu1.30                                        994.6                994.6
xu1.45                                      11626.2              11626.2
xu1.46                                      11515.2              11515.2
xu1.39                                      11606.8              11606.8
xu1.40                                      11541.3              11541.3
xu1.38                                  1.96753e+06          1.96753e+06
xu1.vclp                                1.96755e+06          1.96755e+06
xu1.44                                  1.96753e+06          1.96753e+06
xu1.37                                  1.96753e+06          1.96753e+06
xu1.36                                  1.96756e+06          1.96756e+06
xu1.43                                  1.96842e+06          1.96842e+06
xu1.35                                  1.96842e+06          1.96842e+06
xu1.27                                            0                    0
probe_int_0_xu1_5                                 0                    0
xu1.67                                      4.91157              4.91157
xu1.vee_b                                   5.01157              5.01157
xu1.68                                     -3.25181             -3.25181
xu1.vcc_b                                   0.24819              0.24819
probe_int_/measurepoint_xu1_3              0.233748             0.233748
probe_int_net-_b1-n+__xu1_4                       5                    5
xu1.75                                      994.601              994.601
xu1.esdp                                      994.6                994.6
xu1.19                                      10733.1              10733.1
xu1.xu4.4                                   11547.1              11547.1
xu1.xu4.5                                   11537.9              11537.9
xu1.xu4.6                                   11537.9              11537.9
xu1.xu4.7                                   11547.3              11547.3
xu1.20                                      11570.6              11570.6
xu1.xu3.4                                   10026.8              10026.8
xu1.21                                       5577.7               5577.7
xu1.xu2.4                                   8173.49              8173.49
xu1.clamp                               1.96843e+06          1.96843e+06
xu1.xu1.xvccs_lim_2_a0.g1_int1              -0.6168              -0.6168
xu1.xu1.4_a0                                11256.3              11256.3
xu1.xu1.xvccs_lim_1_a0.g1_int1         -0.000313896         -0.000313896
xu1.22                                    -0.111412            -0.111412
xu1.23                                     -3.25037             -3.25037
xu1.vsense                              1.96843e+06          1.96843e+06
xu1.xu1.out2                            1.96912e+06          1.96912e+06
xu1.xu1.4_a3                            1.25249e+09          1.25249e+09
xu1.xu1.out3                            1.96841e+06          1.96841e+06
xu1.xu1.out4                            1.96843e+06          1.96843e+06
xu1.xu1.out5                            1.96845e+06          1.96845e+06
xu1.xu1.out6                            1.96847e+06          1.96847e+06
xu1.xu1.out7                            1.96848e+06          1.96848e+06
xu1.xu1.out8                            1.96849e+06          1.96849e+06
xu1.claw_clamp                          1.96964e+06          1.96964e+06
xu1.cl_clamp                            1.96729e+06          1.96729e+06
xu1.24                                   1.7445e+08           1.7445e+08
xu1.xu1.outz1                           7.60845e+09          7.60845e+09
xu1.26                                  9.09453e+07          9.09453e+07
xu1.xu1.outz2                           6.39305e+08          6.39305e+08
xu1.xu1.net2                            6.39377e+08          6.39377e+08
xu1.xu1.5_2                             2.17123e+08          2.17123e+08
xu1.xu1.2_3                             1.17162e+06          1.17162e+06
xu1.xu1.5_3                                  500031               500031
xu1.xu1.xvcvs_lim_1.g1_int1             1.16012e+06          1.16012e+06
xu1.31                                      12435.5              12435.5
xu1.32                                      12435.2              12435.2
xu1.33                                      11570.2              11570.2
xu1.34                                      11570.2              11570.2
xu1.xi_nn.3                                       0                    0
xu1.xi_nn.5                                       0                    0
xu1.xi_np.3                                       0                    0
xu1.xi_np.5                                       0                    0
xu1.xe_n.7                                 0.833786             0.833786
xu1.xe_n.8                                 0.833786             0.833786
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.xiqpos.g1_int1                           19.985               19.985
xu1.vimon                                   31555.2              31555.2
xu1.xiqneg.g1_int1                                0                    0
xu1.41                                      31518.6              31518.6
xu1.xcl_amp.gvo+_int1                       19948.4              19948.4
xu1.42                                      11570.2              11570.2
xu1.xcl_amp.gvo-_int1                             0                    0
xu1.48                                  1.95796e+07          1.95796e+07
xu1.xgr_amp.gvo+_int1                   1.95681e+07          1.95681e+07
xu1.47                                  1.96843e+06          1.96843e+06
xu1.49                                      11570.2              11570.2
xu1.xgr_amp.gvo-_int1                             0                    0
xu1.50                                  1.95796e+07          1.95796e+07
xu1.51                                      11570.2              11570.2
xu1.xgr_src.g1_int1                          12.336               12.336
xu1.52                                      31518.6              31518.6
xu1.53                                      11570.2              11570.2
xu1.xcl_src.g1_int1                           2.352                2.352
xu1.54                                    -0.185149            -0.185149
xu1.xclawp.g1_int1                        0.0018692            0.0018692
xu1.xclawp.g1_int2                            19985                19985
xu1.55                                      5.22343              5.22343
xu1.xclawn.g1_int1                       0.00021186           0.00021186
xu1.xclawn.g1_int2                           -19985               -19985
xu1.56                                    -0.185147            -0.185147
xu1.57                                      5.22343              5.22343
xu1.vcc_clp                               -0.185135            -0.185135
xu1.vee_clp                                 5.22344              5.22344
xu1.58                                      11570.4              11570.4
xu1.xclaw_amp.gvo+_int1                    0.185135             0.185135
xu1.vout_s                             -8.87485e-09         -8.87485e-09
xu1.59                                      11575.5              11575.5
xu1.xclaw_amp.gvo-_int1                     5.22344              5.22344
xu1.60                                      11570.4              11570.4
xu1.61                                      11575.5              11575.5
xu1.xclaw_src.g1_int1                        -1.155               -1.155
xu1.sw_ol                                   11571.2              11571.2
xu1.62                                      11571.2              11571.2
xu1.xol_sense.gsw+_int1                           1                    1
xu1.63                                      92794.7              92794.7
xu1.64                                            0                    0
xu1.65                                  1.96729e+06          1.96729e+06
xu1.66                                     -3.25037             -3.25037
xu1.xvcm_clamp.g1_int1                     -11573.5             -11573.5
xu1.69                                     -5835.42             -5835.42
xu1.70                                      11570.2              11570.2
xu1.71                                      5.01158              5.01158
xu1.72                                     0.248203             0.248203
xu1.73                                      157.439              157.439
xu1.74                                      157.439              157.439
probe_int_0_xu1_2                                 0                    0
probe_int_net-_u1-+__xu1_1                  994.602              994.602
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.xu1.xvcvs_lim_1.bg1#branch                    0                    0
b.xu1.xu1.xvccs_lim_1_a0.bg1#branch                    0                    0
b.xu1.xu1.xvccs_lim_2_a0.bg1#branch                    0                    0
h.xu1.h1#branch                            -612.396             -612.396
v.xu1.v4#branch                             81.2245              81.2245
h.xu1.h3#branch                          0.00345201           0.00345201
v.xu1.v12#branch                            864.949              864.949
h.xu1.h2#branch                        -1.15752e-08         -1.15752e-08
v.xu1.v11#branch                        -1.0695e-06          -1.0695e-06
e.xu1.e1#branch                            -68.9497             -68.9497
e.xu1.e4#branch                             2.54727              2.54727
e.xu1.e5#branch                         1.14815e-08          1.14815e-08
e.xu1.xe_n.e3#branch                   -5.53512e-09         -5.53512e-09
e.xu1.xe_n.e2#branch                              0                    0
e.xu1.xe_n.e1#branch                              0                    0
e.xu1.xi_np.e1#branch                             0                    0
e.xu1.xi_nn.e1#branch                             0                    0
xu1:out#branch                             -81.3245             -81.3245
xu1:vee#branch                             0.200428             0.200428
xu1:vcc#branch                            0.0994368            0.0994368
xu1:in-#branch                              11.1412              11.1412
xu1:in+#branch                             0.211237             0.211237
v.xu1.v_os#branch                       5.53712e-09          5.53712e-09
v.xu1.vcm_max#branch                    1.15735e-08          1.15735e-08
v.xu1.vcm_min#branch                    1.15653e-08          1.15653e-08
v.xu1.v_orp#branch                                0                    0
v.xu1.v_orn#branch                                0                    0
v.xu1.v_iscn#branch                       2.898e-11            2.898e-11
v.xu1.v_iscp#branch                    -3.65994e-11         -3.65994e-11
v.xu1.v_grn#branch                          5.5e-11              5.5e-11
v.xu1.v_grp#branch                         -5.6e-11             -5.6e-11
r4#branch                                -0.0994368           -0.0994368
r3#branch                                 -0.310674            -0.310674
vb1#branch                                -0.200428            -0.200428
d1#branch                               4.99484e-06          4.99484e-06
r1#branch                                         0                    0
v1#branch                                  -0.42086             -0.42086
r2#branch                                 -0.110189            -0.110189
c1#branch                                   0.42086              0.42086
a.xu1.xclawn.ag1#branch_1_0                       0                    0
a.xu1.xclawp.ag1#branch_1_0                       0                    0
No. of Data Rows : 0
doAnalyses: TRAN:  Timestep too small; initial timepoint: cause unrecorded.
run simulation(s) aborted

It says so little to me :smiling_face_with_tear:. I increased the timestep from 1ms to 100ms… because… wel that last error but no change.

Than I set the initial time stamp to 0 (though I don’t get why that would be needed) and than the error changes to:
doAnalyses: TRAN: Timestep too small; initial timepoint: trouble with node "/measurepoint"

Regards,

Bas

It looks like the pin mapping from the schematic symbol to the spice model is wrong. Apparently the output of the opamp is connected to Vcc.

1 Like

In addition: a B source as power supply is wrong. You should grab a VDC from Simulation_SPICE.

Next: Start with a simple inverting amplifier. If that is o.k., then move on adding other items (diodes, capacitors etc.).

Ok so pin order was indeed not correct. Now to tinker around in me circuit

:+1:t2:

This stuff is complicated…

I have this circuit and the voltage sources work but this opamp…it just wont ‘go’ and I don’t understand why.

Green = output. Blue = IN+ and red = IN - . I double checked alternative pin numbering

General idea was that without feedback the output goes to 5V~ish when Blue > Red…

EDIT:
I missed the remark about the VDC symbol. I have changed that now. It does not make a difference in behaviour

Bas

I used a different model, and now the thing does work!!. generic_opamp.lib
Before I was using OPA1641.lib

afbeelding

Okay, now I can go play.

Once again y’all have my thanks :+1:t2: