Bugs, I think (6.0.3), Schematic

Please also share your models for the diodes, zeners, and triacs.

Here you go:
1N4007.mod (176 Bytes)
BZX84C27.mod (559 Bytes)
DB3.mod (782 Bytes)
10ATRIAC.lib (542 Bytes)
Resistors and capacitors are from the default pspice library.

Cheers.

Thank you.
Good bug reports and repeatable examples really help the developers fix and improve KiCad

Your example file (not annotated, incomplete, floating nodes) does not crash ngspice-36.

After some tweaking:
Move ground to top to get voltage across R3,
Add .options abstol=10u (increase voltage tolerance, useful when simulating off-line circuits),
Provide enough time resolution by .tran 10u 150m,
Use the diac model from STM https://www.st.com/en/thyristors-scr-and-ac-switches/db3.html#11 (after fixing it) ,
Setting the appropriate ā€˜alternate node sequenceā€™ for the TRIAC,
I have got the following (v(/out):


The project is now
ML9104.7z (9.5 KB)

2 Likes

A small update to the above posted project is necessary: The load resistor R3 cannot have a value of 40 Ohms. In that case the power dissipation in the TRIAC would be around 300 W, which is impossible to handle. When increasing it to 150 Ohms, around 36 W is dissipated, with adequate cooling (1 K/W) this would yield a temperature rise of around 70 K.

To measure the power, I have added a .control section

.options abstol=10u
.tran 10u 150m
.control
set controlswait
let powtr = (V("/out") - v("/phase"))*@R3[i]
let powr3 = V("/out")*@R3[i]
meas tran triacp rms powtr from=0 to=150m
meas tran r3p rms powr3 from=0 to=150m
.endc

to the Eeschema window.

Sorry for not understanding here, but how do you get the 300W power dissipation in the triac?
If I have seen the numbers correctly, the power source is AC 230V RMS and the load 40+1 ohms in series, which would give approximately 5,6A. I would expect something like 10-15W power dissipation in the triac (estimate), but I havenā€™t ran the simulationā€¦

This is the voltage across the TRIAC and the current, simulated using the suggested model of the 2N5568 (red: voltage, blue: current) with a 40 Ohms load:


There is a considerable voltage drop across the TRIAC.

Looking at the data sheet (old stuff indeed), they claim less than 1.7 V drop at 14 A peak, for a short 2 ms pulse. You are right, there seems to be a discrepancy between model and data sheet.

1: that makes no sense to me, but will of course help seeing the Triac voltage better.
2: What does ā€œnot annotatedā€ mean? Youā€™re right that itā€™s two separate circuits at this point, the left part simulated fine. The right side is the problem.
3: never heard of ā€œ.option abstol=10uā€ and what it does, but Iā€™ll research.
4: will try, Iā€™d have thought that 100u would be enough.
5: actually, I have the least problems with the DIAC, but thanks for the link. Iā€™ll include it in my custom library. What needs to be fixed BTW?
6: I have ā€œalternate nodeā€ set to 2 3 1 which should be correct.

Thatā€™s just plain wrong. A Triac is either on or off. If itā€™s off, power loss is zero, except for a very small leakage current.
If itā€™s on, the power loss is the forward voltage drop times current. Typically ~1.5 V, giving around 8 W. Itā€™ll need a heat sink, I agree on that, but just a small one.

It looks like there is some series resistive component in the model which is off by two orders of magnitude or soā€¦

Iā€™ve now run the simulation again (transient, 100u, 200m).
This gives similar results to the run from @holger, except that my Triac model seems to be crap. Itā€™s obviously not a 4-quadrant Triac.
I downloaded the ST Triac library again: https://www.st.com/resource/en/spice_model/standard_snubberless_triacs_pspice.zip and extracted the .lib part.

I then inserted the BTB16-600C as part with associated SPICE library, and this time paid special attention to the ā€œalternate nodeā€ pin sequence (Iā€™d missed that in the first runs).

Yeeaahh!. It works.

It seems that a wrong pin sequence (or ā€œalternate nodeā€ if you like) will bring ngspice down, and KiCAD with it.

Thank You for all your help, and I hope that this can be a help for the developers.

FYI, LTspice runs on Linux quite well using Wine (a FOSS windows emulation library). See https://www.winehq.org/

Thanks, Iā€™m aware of that and tried it previously. But Iā€™m not happy with the Wine environment and the security holes it punches in my system, so I removed it again.
Iā€™m hoping for ngspice-36 being packaged for Linux. Compiling it myself would be over-estimating my own capabilities.

Youā€™re absolutely right! I only noticed that today when running a simulation, where the voltage over the 40-ohm load resistor dropped by around 30 V.
The supplier models are unreliable, and ngspice as well.
This is no way to work. Iā€™m back to paper and my trusty HP-15C. Sigh.

OK, hereā€™s a ā€œKiCAD-killerā€ project. Running a simulation (transient, 100u, 200m) will kill KiCAD immediately:
Softstart2.kicad_prl (1.1 KB)
Softstart.kicad_pro (5.6 KB)
Softstart2.kicad_sch (36.4 KB)
Softstart2-cache.lib (776 Bytes)

Iā€™m aware that two components are unconnected. So? That warrants a warning (or perhaps an error). But should that really kill an application?

Deleting the two unconnected parts solves the problem and allows a correct simulation. And itā€™s 100% reproducible.
Adding the two parts using ā€œDuplicateā€ will provoke the crash every time.

1 Like

No, it does not crash KiCad, it just tells me

Error: Could not find include file /home/macro/.local/share/kicad/models/basic_models/diodes/1N4007.mod
Error: there aren't any circuits loaded.

KiCad 6.0.4, ngspice-36

Well, then I can just wait for ngspice-36 to be avalable for Ubuntu.
Thanks anyway.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.