Errors message when I click on simulation

@Piotr,
Thank you Piotr, but I’m not sure to understand what do Kicad Users use for their simulations ?

Why you assume KiCad users need simulate anything. Electronic circuits works as you design them and in most cases you need not to check anything.
I was using Protel since 1997 and KiCad since 2017 and didn’t simulated any of the designed circuits.
In 90s I have got PSpice simulator (demo, limited to 30 nets) and in 2002…2008 used it only to simulate supply filters (defining capacitors and chokes with their parasitic components) mainly to see how they behave at 10MHz…1GHz. In 2017 I moved from 32 bit WinXP to 64 bit Win7 PC and my PSpice stop working what I even didn’t noticed. At the end of last year I have done some spice experiments with KiCad, but just to see. A few months ago I had first need. I wanted to see how burst disturbance influence my inputs. So I made separate KiCad configuration where I have no libraries I typically use and made there some libraries with elements with their parazitics. Two library sets have nothing in common. Libraries for PCB have no spice models at all. Libraries for spice have no footprints at all. To use Spice I rename kicad directories at Users\AppData\Roaming to work in different environment. That way I’m sure that at spice schematic I will not use symbol having no spice model and at PCB schematic I will not use symbol having no footprint (all my symbols have footprint assigned and I never change it).

Hello Piotr,
Many thank’s for informations.
My circuit is an audio amp powered by +/- 2 300Vdc that’s 4 600 Vdc rail to rail.
It’s very easy to kill a diyer with this mass destruction weapon. So I don’t want to test it on the bench without first doing some simulations to validate the conception.

I also need to :

  • Control the rise time of the power supply to avoid killing the power mosfets at start on and shut down => calibrate the softstart/softstop.
  • Implement and simulate the security against shorts circuits at the outputs.
  • Control the slew rate of the optocouplers.
    That sort of things.

When I have 24V at PCB I assume I have high voltage :slight_smile:

Your post is tldr, so I’ll just say whether KiCAD users need to or not, it would be nice to have a way that is as at least as reliable and full-featured as the rest of KiCAD, no? For what it’s worth, I find mostly that the difficult part is finding open source component models that work in ngspice. I’ve been tinkering on a multi-amp 10s of kilohertz linear current source and found the availability of mosfet and mosfet gate driver models very lacking.

PSPICE compatible models should do (unfortunately not always for gate drivers which may need some editing). LTSPICE VDMOS models for power MOSFETs will do. You might have a look at Spice models and model parameters for ngspice circuit simulator or scan my examples at Simulation examples for KiCad/Eeschema/ngspice and More simulation examples for KiCad/Eeschema/ngspice for models I have been using.

Unfortunately i don’t think you will see a day when simulation models are easy to come by anytime soon. Because the KiCAD library needs to have a specific license for all its components. Simulation models also need to be tested and verified, so the logical source should be the component vendor.

But the vendor may have license agreements that stops them from being distributed. Also i dont think vendors are specifically interested in all aspects of simulation so even if you get the model form the vendor does not mean it simulates the behavior you want it to simulate.

So how would we even begin to distribute models and who would do and verify them? What would be the testing criteria?

I didn’t said that Spice in KiCad need not be as good as possible (as everything). I just said that not all KiCad users need spice. If it is less or more than 50% of users - I don’t know.

I don’t think more than 1% of KiCad users are doing something like you.

This is an often repeated argument and too often abused as a stop gap answer.
Holger already posted a link to Spice models and model parameters for ngspice circuit simulator and in for example MicroCap-LIBRARY.7z/m_opamp.lib there is a license statement with:

  • Motorola Operational Amplifier Macromodel Library
  • Rev 1.1
  • Macromodels, simulation models, or other models provided by
  • Motorola, directly or indirectly, are not warranted by
  • Motorola as fully representing all of the specifications and
  • operating characteristics of the semiconductor product to
  • which the model relates. Moreover, these models are
  • furnished on an “as is” basis without support or warranty of
  • any kind, either expressed or implied, regarding the use
  • thereof and Motorola specifically disclaims all implied
  • warranties of merchantability and fitness of the models for
  • any purpose. Motorola does not assume any liability arising
  • out of the application or use of the models including
  • infringement of patents and copyrights nor does Motorola
  • convey any license under its patents and copyrights or the
  • rights of others. Motorola reserves the right to make
  • changes without notice to any model.

Looks like they are mostly concerned with waving away any sort of liability then protecting copyright claims. I also interpret the “as is” part as “free to use” / “public domain”. But my head always starts spinning from legalese. It’s an interesting library for beginners because it has a lot of “old fashioned” opamps such as TL081 and LM358.

The license above is still a bit vague, but I have also seen spice libraries that have an explicit public domain license. I think the main obstacle is that there is simply no attention at all to an implementation for KiCad in this direction.

Some Ideas towards an implementation:

  1. A change on the licensing page of KiCad itself, with a statement that spice models are released with whatever license they already have in their files.
  2. For a few models (NE555, opamps and such) they could be added to Simulation_SPICE library, but that would only work for a handful of (common) models.
  3. For a more universal implementation, I think a flag inside the library system is preferred. It could filter for symbols with available spice models. Maybe have a direct link to show the library text (inclusive it’s license).
  4. Several of KiCad’s standard library symbols could have very simple spice models. For example, a fuse could have a simple resistance (under assumption the current is “low”). Resistors and capacitors could have some “sensible defaults” for parasitic values. This is not with the intention to be very accurate (for seasoned spice users), but to give beginners an easier start.
  5. Symbols like connectors and net ties can have the Exclude from simulation attribute set. (I’m thinking about making a feature request for this).

What if for parts that do have a more vague license you would link to the model?

I would also waive the liability. A simulation model can only do so much and was designed for some usecase, not all corner cases.

Anyway form a legal standpoint thats much like all rights reserved as it does not mention copying and distributing.

This might have implications for Open Source *nix distributions. The licenses should be verified to be compatible with the guidelines of the distro, and if it’s not, the file can’t be distributed in the official repository. If some library files wouldn’t be distributed in some distro, that would cause problems for the end users: some would have a file and some wouldn’t. Imagine the mess in this forum if some symbols or footprints were missing from some users’ installations!

As for an example, this Motorola license doesn’t meet Open Source or Free Software requirements (if the quoted text is all there is). “All [possible legal] rights reserved unless otherwise stated” is the default starting point for licencing, everything which gives more rights to recipients/users must be explicitly stated. That specific “license” is just denying any responsibility of the copyright owner (legally or not), it doesn’t give any rights to users which aren’t already legal rights without a license.

This is a more general problem in our field: 3D models are usually distributed by the part manufacturers but they don’t give any rights to re-distribute the models, not even as-is, unmodified and mentioning the original source.

IANAL either, but lawyers do give me pain in that general direction…

Another one from the *basic_models.7z file, the Lm358.

  • Legal Notice: This material is intended for free software support.
  • The file may be copied, and distributed; however, reselling the
  • material is illegal

It seems very permissive, but also vague.

That is one I had not considered. IANAL at all and only thought about KiCad’s own license.

That would be a big mess. Nobody can keep an overview of that, so that’s not a usable option.

When I first started with Linux several distributions had multimedia codecs as a separate package and they were not installed by default because of legalese. Maybe similar can be done for KiCad. Have a spice library that is verified legal and another one that may be unclear, but it’s left to user discrepancy whether he installs it or not. Many Linux distributions have a provision for non-free stuff. It’s often video and WiFi that have problems in this direction. Debian is quite strict in this regard because it’s a root distribution of many other distributions, and Debian has a specific non-free.

It’s a lot of trouble for some text files. It’s not software, it’s not even a software library but just some tables in a text file. .

Related: I find that often the encrypted/encoded (?) spice models for PSPICE or LTSPICE, such as the one below, don’t run in ngspice even with “PSPICE and LTPSICE” compatibility mode (when lanched in KiCAD, I haven’t tried external ngspice yet). Is this expected behavior?

NCS2005 PSPICE MODEL.LIB (18.6 KB)

Indeed.
The whole idea of encrypted model is to thwart attempts to read it. There are even countries who have made laws against breaking encryption.

Hello,
I finally found the solution by removing the LT3032 and his model with “varistors” (well done and thank you Holger, you were right) and replacing it with a TPS7A3901 whose model is well accepted.

No more problems with it, but, because there is always a but, Kicad gives me know a problem with the model of zeners I use which he had neglected to mention before. A bottomless pit…

Note: Compatibility modes selected: ps lt a
ERROR: mal formed B line: bzx55c6v2
Error: ngspice.dll cannot recover and awaits to be detached

Nah, not bottomless. you are making progress.
Replacing the model of a zener with something that does work can’t be too difficult. There are a bunch of libraries on the ngSpice website and there probably are a bunch of zeners that work with ngSpice among them.

Thank you,
Guessing you’re right… I’ll follow your advice

Have an idea of what is the “mal formed B line” in the model I use, below ?

********************************
* Copyright:                   *
* Vishay Intertechnology, Inc. *
********************************
BZX55C6V2				

* Technology:        DISCRETE DEVICE				
* Device:            Zener Diode BZX 55C 6V2				
* Type:              Typical (nom)				
* Model established: 12.11.1996, by S.Reuter, TM1iC63-HN				
* Wafer:				
* Remarks:           Macro model				
* Revision:				
* Simulator:         PSPICE				

.SUBCKT BZX6V2 a c				

 DF a c DFOR				
 DR c a DREV				
 DB b a DBRE				
 EB c b POLY(1) d 0 4.6 1				
 IB 0 d 1m				
 RB 0 d 1k TC=4m				

.MODEL DFOR D				
 + IS =  32p  RS =    0  N  =  1.6  CJO= 128p				
 + VJ = 685m  M  = 342m  FC = 700m  XTI=    3				
 + EG =1.186				

.MODEL DREV D				
 + IS = 100f  N  =   12  XTI=    3  EG =1.186				

.MODEL DBRE D				
 + IS =  10f  N  =    1  XTI=    0  EG =1.186				
				
.ENDS BZX6V2
********************************
* Copyright:                   *
* Vishay Intertechnology, Inc. *
********************************
BZX55C6V2				<----------------------------------------- ???

* Technology:        DISCRETE DEVICE				

Just take the error message serious. What is this line? In a netlist a line starting with a B is assumed to be a B source. But what you have is the device name, probably by mistake added to the model, but not a B source (ngspice manual chapter 5). So remove this line.

Malformed B line is a quite cryptic error message. If the message made it clear it was interpreting that line as being a “B source” then it’s a lot easier to diagnose.

And what about line numbers? It’s common to add line numbers in error messages, does ngSpice not do that, or is this a configuration option?

Hello,
Thank you. It’s better.
NGspice is now just warning me and don’t want to be detached. Warnings concern :
IC 7, D15, D16, D18, D17, Q1, Q10, Q9, Q10, Q3, Q4, Q5, Q6, Q7, Q8, Q12, Q13, Q14, Q2, D19, D20, D14, D13, D8, D7, D11, D12, D10, D9, D6, D5

IC7 is the TPS7A3901 that was OK before correcting the model of BZX55C6V2…
D5 to D12 are 1N4004
D13 to D20 are BY4
Q1 to Q14 are IXTH1N200P3HV Littlefuse mosfets

For example I check the line .IC V(NR/SS )=0 in the model of IC7 (TPS7A3901)
Kicad change it in .ic v(xic7.nr/ss )=0.
For me NR/SS is node3. What does “non-existent node” mean ? I don’t know.

Note: Compatibility modes selected: ps lt a
Circuit: KiCad schematic
Warning : IC on non-existent node - xic7.nr/ss, ignored
Please check line .ic v(xic7.nr/ss )=0
Warning: Model issue on line:
.model xd15:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd16:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd18:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd17:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xq1:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq9:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq10:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.0 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq11:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.0 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq3:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq4:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq5:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq6:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq7:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq8:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq13:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.0 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq12:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.0 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq14:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.0 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xq2:mm111 nmos level=3 l=2.0000e-6 w=1.2000 kp=1.0258e-6 rs=10.00 …
unrecognized parameter (rds) - ignored
unrecognized parameter (rg) - ignored
unrecognized parameter (rb) - ignored
Warning: Model issue on line:
.model xd19:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd20:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd14:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd13:rectifier d(is= 5.000000000000000e-08 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd8:rectifier d(is= 1.250000000000000e-07 bv= 4.2000000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd7:rectifier d(is= 1.250000000000000e-07 bv= 4.2000000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd11:rectifier d(is= 1.250000000000000e-07 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd12:rectifier d(is= 1.250000000000000e-07 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd10:rectifier d(is= 1.250000000000000e-07 bv= 4.200000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd9:rectifier d(is= 1.250000000000000e-07 bv= 4.2000000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd6:rectifier d(is= 1.250000000000000e-07 bv= 4.2000000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored
Warning: Model issue on line:
.model xd5:rectifier d(is= 1.250000000000000e-07 bv= 4.2000000 …
unrecognized parameter (vpk) - ignored
unrecognized parameter (iave) - ignored
unrecognized parameter (vp) - ignored