how does Kicad simulation compare to LTspice? - Page 1
Forum section: electronics / general

author: vixo
author_rank: Regular Contributor
timestamp: July 09, 2021, 10:09:41 am
content: I'm just starting out simulating with Kicad and I am wondering whether my time is better spent simulating in LTspice? What are the performance differences between the two? I want to simulate audio frequency circuits with a lot of filtering and potentiometer controls. I haven't got any experience with using simulators and I don't know their limitations (I always assumed they'd be useless after using a bad one years ago and never going back to it)I use Kicad for layout so it would be the easiest thing to use it for the simulation aswell.your thoughts?

author: firewalker
author_rank: Super Contributor
timestamp: July 09, 2021, 10:16:18 am
content: LTspice is the industry standard. It is around for decades with a well established reputation and a huge base of models and documentation. I would stick with it.Available for Windows, MAC and GNU/Linux (via WINE).Alexander.

author: PKTKS
author_rank: Super Contributor
timestamp: July 09, 2021, 02:48:16 pm
content: I have an alternate vision of this...dealing with SPICE since early 80s...I must say that SPICE is de facto the standard.LTSPICE is BIASED to their own proprietary and encrypted models.Unless your are really in need of using some os these...you will be far more provided with PSPICE models (de facto standard)NGSPICE (in which KiCAD is based) is a re-write of SPICEsuited to modern usage. (while SPICE was intended to mainframes)LTSPICE is totally BIASED to their products.Their models are encryptedPaul

author: esepecesito
author_rank: Regular Contributor
timestamp: July 09, 2021, 03:21:01 pm
content: I've been working with variations of PSPICE for 1/4 of a century, and from time to time comes something new...As stated above, SPICE is Standard. And for good reason:1) Any decent simulation will do more or less internally the same (solve differential equations with newton method)2) The transistors models for SPICE have been updated (for a long time they were not updated anymore, but just because there is no need)Note SPICE --the core program-- is a command line utility, that can be downloaded from the California University. Then all SPICEs, commercial and not, are largely based on that original. All commercial versions have fancy interfaces to draw the circuit, because writing it in a text file is not very intuitive. Having said that, a lot to times I had to write the files: I wanted to do variations on simulations, so I wrote programs that would adapt the circuit description file and run the simulation in background. There are other reasons why it is good to understand the text files.I've professionally used many SPICEs, a lot were F'ing expensive, REALLY expensive from very known brands. As we compared very complex simulations, the results of LTSPICE and the other 3 very expensive were same or better in LTSPICE.LTSPICE may have encrypted models, like ALL OTHERS, but you can use any model downloaded from internet. BTW I never failed in finding a model online for (LT)SPICE, for other tools (e.g. modelica), sometimes there is nothing, sometime you have to pay.Other good thing of (LT)SPICE, is that because it just solves differential equations, you can model anything you can write a constan coefficient differential equation for. For example I've modeled motors, like BLDC and DC motors, and complex mechanical mechanisms attached to them, because I had the equations.

author: TimFox
author_rank: Super Contributor
timestamp: July 09, 2021, 03:37:50 pm
content: Spice comes from the University of California, Berkeley and the original version is often called Berkeley Spice. I believe that it is in the public domain.There are many commercial versions which use Spice at the core.PSpice is very popular, and the first version I used required used a 5-1/4" disc with a hole drilled through it as a security object, later replaced by a dongle (IIRC).The free version of PSpice supports only a limited number of nodes, but enough for many student purposes. The full version must be paid for. It includes proprietary features that increase its usability, and some of its functional models differ from that used in original Spice.I have had problems with some component models written for PSpice that don't work properly in Berkeley Spice.LTSpice is free since it was used to sell components from Linear Technologies. There are other similar versions.The Spice version I use is AimSpicehttp://www.aimspice.com/from Norway, since my personal preference (rare nowadays) is line-oriented files, rather than circuit capture. It is reasonably priced, and includes a useful post-processor

author: esepecesito
author_rank: Regular Contributor
timestamp: July 09, 2021, 04:45:15 pm
content: Here you can find the "original" spice. Note isnot public domain, is copyrighted, but the license is VERY permissive:https://ptolemy.berkeley.edu/projects/embedded/pubs/downloads/spice/index.htm

author: JohnG
author_rank: Frequent Contributor
timestamp: July 09, 2021, 06:26:09 pm
content: Based on experience, LTSpice is fast, versatile, has good convergence, and will run models from many different flavors of Spice, including PSpice. You can also run it from the command line and this opens up a lot of possibilities.The downside is that it is not open source, and if you work in the semiconductor industry, you are not allowed to use it unless AD grants you permission. This was a problem for my current employer, so I looked into KiCAD and NGSpice. The combination was serviceable, but far more cumbersome to use than LTSpice, and the reliability of convergence not as good. In the end, we got permission from AD to use LTspice.That being said, the KiCad/NGspice combo worked. It was just not as productive for us. KiCad seems to be rapidly improving these days, as does NGSpice, and I revisit these things every couple of years. I hope they give this combo a little more love, because it has great potential. After all, what AD giveth, AD can taketh away. I have been badly burned on disappearing software before, both paid and free (MathCaD, anyone?).Cheers,John

author: TimFox
author_rank: Super Contributor
timestamp: July 09, 2021, 06:30:58 pm
content: These questions are important for non-linear circuits, including semiconductors, which need the ".TRAN" and ".DC" Spice analyses and good functional models for the semiconductor.For passive linear circuits, with only R, L, C, etc., the Spice analysis uses ".AC", which is the same algebra you would use to work it out on paper, and should be close to perfect.When using ".TRAN", you should pay attention to the various Spice analysis parameters such as ".RELTOL" that affect the numerical integration. Seehttps://kenkundert.com/docs/eda+t93-preso.pdffor a long discussion.

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 10, 2021, 05:01:22 pm
content: Ngspice is great, and KiCad's GUi over it is pretty decent now. That said, Ngspice has always been definitely slower than LTSpice for me.I've also been using the latest MicroCap 12 software since it was released for free. I like it. Too bad it has become abandonware.

author: TimFox
author_rank: Super Contributor
timestamp: July 10, 2021, 05:20:03 pm
content: Quote from: esepecesito on July 09, 2021, 04:45:15 pmExtremely permissive: you can use it for any purpose, you only need to include the copyright notice for the University of California, and to include the University's disclaimer of liability for use of the software.

author: esepecesito
author_rank: Regular Contributor
timestamp: July 10, 2021, 05:46:57 pm
content: Quote from: TimFox on July 10, 2021, 05:20:03 pmYes. Sorry, forgot to write "sorry to be pedantic"But really, if you mess with it where I work, you would have a big big problem.

author: TimFox
author_rank: Super Contributor
timestamp: July 10, 2021, 07:21:14 pm
content: What is the problem at your place of work?Others have mentioned using free KiCad at the workplace, and some have reported resistance from management.

author: esepecesito
author_rank: Regular Contributor
timestamp: July 10, 2021, 08:18:07 pm
content: I mean the license. If it is not public domain, you cannot use it. Nonsense... but... yeah... German lawers...I used free spice to do some things, and baned... another comes with same thing but using another above mentioned, very expensive, but with all papers for the lawyers... is ok.For example we cannot used Emacs, Octave. We have to use the payed versions of M$ Visual Studio and Matlab. BSD or MIT license are not good enough because "we are liable if something happens". Not my words!!! Not my words!I gave up fighting against that way of thinking. Is not my company, not my money.Oh. I forgot: LTSpice, can be used, but only for "prototype" whatever that means... Officially you have to simulate with other expensive tools (some of them will explode your machine 5 of 10 times -- not telling names, you can be sued for ANYTHING here)

author: TimFox
author_rank: Super Contributor
timestamp: July 10, 2021, 08:28:36 pm
content: At my former employer in the US, management only worried about our using pirated versions of commercial software.Installing our equipment in other countries (neither US nor Germany), we often encountered our clients using pirated software (especially Windows) and had to be careful to avoid corruption of our proprietary software installed on their OS.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 11, 2021, 08:33:09 pm
content: As said before. ngSpice (which is what is used in KiCad) is a pretty decent simulator, and the integration with KiCad also works quite well.It is a plus that you can use one schematic both for simulation, and for designing the PCB, but there usually are significant differences. For example, for simulation, you use a few ideal voltage sources (batteries), while on the PCB you may have an SMPS circuit, and you don't want to simulate that at all.I've used KiCad for some simple projects for quite a long time (7+ years), but have never done much with any kind of spice (Well, I read Dune).There are a lot of models that do not work in ngSpice. Some do not work because of some kind of encryption. Other models rely on extensions which are only available in some specific simulator.There are hardly any spice models installed by default with KiCad / ngSpice. Apart from the reasons already mentioned. Many spice models are copyrighted. For KiCad itself, this means that any spice model that does not have an explicit license that state that it is free to distribute and use, can not be distributed together with KiCad itself.A handful of months ago there was a complete re-design of all Icons used in KiCad, and the main reason was that the origin of a part of these icons was not known, and apparently some had at one time been copied from some other project with no paper trail (Think of generic icons for "file open", "file save", "copy" , "Paste", etc. KiCad-nightly V5.99 now has this completely new icon set, and a common style throughout the whole project.So if you want to use KiCad with ngSpice, you have to cobble together your own set of spice models for now, and you also have to match the spice symbols with the schematic symbols. Pin numbering of opamps for example can be different between the schematic (which uses real pin numbers) and and the spice models. Take any quad opamp. It's 4 times the same spice model, but 4 different sets of pin numbers in KiCad, or you can't use the same schematic for the PCB.Many spice models can be found on the 'web, apparently there is (was?) a Yahoo group related to ngSpice models, but I never used it.Finding the models, and mapping them to KiCad schematic symbols is quite an extra burden if you're new with simulation. Your first simulation is almost guaranteed to **NOT** work, and then you have to go figure out where the problem is.As I said before, I have not done much with spice, but the KiCad forum is frequently visited by some people who are knowledgeable in this area, and questions about ngSpice in KiCad are answered adequately over there.https://forum.kicad.info/

author: bson
author_rank: Unknown
timestamp: July 12, 2021, 11:09:31 am
content: ngspice is more capable than LTspice, and I'd recommend learning it. The manual is quite readable.The main shortcoming is the KiCad UI, which limits what can be done. For example, in ngspice you can have a .control block that loops and spreads out component values, and generates a plot for each random spread - this is how you do Monte-Carlo analysis. The plots generated this way can't be displayed through the KiCad UI (although the shared library version of ngspice used will generate them, KiCad just doesn't know how to retrieve and render them) - but can be through gnuplot or pretty much any other plotting utility. (LTspice can't do anything like this.) So KiCad is fine for basic plots, THD, etc, and then for component tolerance sensitivity just run that offline using the command line version of ngspice directly. You can also have a custom ngspice control script run from KiCad that doesn't generate anything and just writes plots loaded by gnuplot on the side.Most downloadable pspice models from TI and others will work correctly directly in ngspice by enabling the compatibility mode. The ones that don't work often have obvious and easily corrected incompatibilities like the name of a property or how parameters are mapped. Again, armed with the manual look over a problematic model/subcircuit and fix it. I've done that many times, gets you up to speed with the tool and how it works, and after the first few problem models it usually takes like ten minutes to fix it. Unless there's some truly obscure feature used, but that's pretty rare and tends to be very old models.

author: 2N3055
author_rank: Super Contributor
timestamp: July 12, 2021, 11:57:47 am
content: Quote from: bson on July 12, 2021, 11:09:31 amWell it's not really true that LTSpice cannot do Monte Carlo worst case analysys...http://k6jca.blogspot.com/2012/07/monte-carlo-and-worst-case-circuit.html

author: esepecesito
author_rank: Regular Contributor
timestamp: July 12, 2021, 02:53:38 pm
content: Quote from: 2N3055 on July 12, 2021, 11:57:47 amI did it MC with LTspice. First you can do parameter variation (ok, not statistic, but helps) if you want to do statistic, I did that by doing a simple script that would change the values randomly, execute the simulation (backgorund--without GUI) and put the results in a CSV.The question is always: what do you have more of: money or time?With some Infineon transistors models I had convergence issues with other Spice's that I did not have with LTSPICE... so sometimes is still a good solution. You need more creativity using the tools, but you can get it.

author: 2N3055
author_rank: Super Contributor
timestamp: July 12, 2021, 03:37:31 pm
content: Quote from: esepecesito on July 12, 2021, 02:53:38 pmThere is Monte Carlo (mc) directive for parameters that does proper M.C. statistical variation. M.C. is not global mode, but applied to specific value of specific component.It is not fastest to setup, but works, and you have very granular control.If you want sophisticated M.C check out Microcap 12..

author: nctnico
author_rank: Super Contributor
timestamp: July 12, 2021, 03:44:39 pm
content: Quote from: 2N3055 on July 12, 2021, 03:37:31 pmI agree. I have switched to Microcap 12 as well. Still learning the ins & outs though.

author: JohnG
author_rank: Frequent Contributor
timestamp: July 13, 2021, 05:57:34 pm
content: I have evaluated a number of free Spice tools, primarily for detailed simulation of switch-mode power converters. What I mean by detailed is the use of Spice to model both switching transitions with a lot of parastics, power transistors with highly non-linear capacitances, tiny parasitic inductances, etc. It's tough on a lot of simulators due to many vendors dubious ways of making non-linear caps in their models, and the need to have time constants that are orders of magnitude different in the same circuit.LTspice and NGspice top the list. We chose LTspice for the following reasons:*Best convergence and speed with the circuits and models we use.*Usable (if somewhat clunky) GUI: this is required to get younger engineers started quickly, and for quick analyses. Schematics are pretty much necessary for collaboration and discussion, which we do a lot of amongst ourselves and with customers.*Runs many third-party models with little or no change.*Handles long simulations with large output files usably quickly and without frequent crashing.*Appears to be around for a while*Ability to run more sophisticated analyses using Octave or Python as a scripting engine. You can do optimization and MC and it works.NGspice looks really promising, but it balked on some of the models we use, whereas LTspice converged properly to the best of our knowledge. And, the KiCAD GUI for NGspice is not there yet, and to be fair, it is not the main focus of KiCAD. But, what I really like about NGSpice:*Runs many third-party models with little or no change.*Open source*Keeps getting better and more powerful*Pretty good convergence (but not as good as LTspice)*Handles long simulations with large output files usably quickly and without frequent crashing.*Appears to be around for a while*Ability to run more sophisticated analyses using Octave or Python as a scripting engine. You can do optimization and MC and it works.I really wanted to like Microcap 12. It looks like the complete package, with extensive models, fantastic analytical tools, etc. But, in the end, we did not go with it for the following reasons:*Not under development, and may quit running under some future OS. If it ever goes open source so that this situation is changed, I might look at it again. I've multiple times in my career had software tools that became unusable for one reason or another, with no hope of recovering the work lost. It really sucks when that happens.*GUI so cluttered that I cannot find anything easily. I think you can simplify it via the preferences, but I don't want to invest time in something that's not supported.*It crashed a lot on me running long simulations.Just my $0.02,John

author: PKTKS
author_rank: Super Contributor
timestamp: July 16, 2021, 10:05:59 am
content: One more vote to ucapalas in urge need of maintainers..Paul

author: hvogt
author_rank: Contributor
timestamp: February 01, 2022, 02:12:18 pm
content: You may use KiCad/Eeschema for schematic entry, use the internal ngspice and then again Eeschema for plotting. Unfortunately the Eeschema/ngspice interface is currently still rather limited. However, lots of planning is going on to improve it.ngspice has its own scripting language (or control language, formerly know as nutmeg, but vastly improved and enhanced).You now may use Eeschema again for entering the circuit, but run the simulation in plain ngspice, using its control language. Now all ngspice options are available. Writing result data to a file or plotting is also done by ngspice (internal graphics, Postscript, SVG, or Gnuplot, all with UNICODE support). For a simple example please see the Eeschema/ngspice tutorial athttp://ngspice.sourceforge.net/ngspice-eeschema.html#external.Indeed models are not distributed with Eeschema/ngspice, but many are available athttp://ngspice.sourceforge.net/modelparams.htmland its associated links.

author: hvogt
author_rank: Contributor
timestamp: March 18, 2022, 10:24:08 am
content: There are several examples for simulating audio circuits available here:https://forum.kicad.info/t/simulation-examples-for-kicad-eeschema-ngspice/34443.Schematic entry has been done by KiCad/Eeschema 6.0.2, simulation by (integrated and/or external) ngspice-36.