I am trying to simulate an AC RLC circuit to play with frequencies : I have found a youtube example for LTSPICE but I am unable to do the same with ngspice/kicad, in particular showing the resonance frequency. I can do a transient simulation but it fails with AC.
Next problem:
You are powering your circuit with the ideal voltage source V1. This source has an internal resistance of 0. So what ever your circuit is, V1 will enforce its voltage onto your circuit. To see the effect of the resonant circuit, you will need a voltage divider, e.g. a resistor in series with V1.
In addition: a transient simulation starts with searching for the dc operating point. This is done by opening all capacitors and short-circuiting all inductors, and then look for currents flowing and the resulting voltages. Only after that transient simulation starts. In your case the indctor shortens V1, which is not allowed (short circuit on a voltage source with internal resistance 0 will yield a current towards infinity).
LTSPICE probably uses an RSER for the inductor.
You may place a series resistance to the inductor (or use the series resistance of V1 from above).
Thank you holger : I am a total noob, taking advantage of learning thanks to ngspice and kicad. I’ve now got something and will now try to get to the final result
If in your first scheme you change voltage source to current source you will see what you expected.
Small correction.
I started to learn KiCad Spice a week ago and a week was enough for me to forget that in Simulation_SPICE library the ISIN source doesn’t work for ac simulation. There is lack of ac=1 in its parameters. The text: “dc=0 ampl=1 f=1k” should be “dc=0 ampl=1 f=1k ac=1”.
I just didn’t remembered that I corrected it and my ISIN simply works
And here is my first simulation where I just couldn’t see what I expected until I found that ISIN symbol has bug in it:
Many years ago I found the Murata program that generated real capacitor parameters and since then I use them in my simulations. I used PSpice from 90s but it is ‘gone’ together with Windows XP so when needed to simulate something I decided to check KiCad.
I see you are 1E9 times faster than me
I’d ask you to check the other Spice problem and may be make MR from it. Now I am writing from memory so not 100% sure.
I got NPN model and I couldn’t assign it to npn transistor symbol. Not by copying parameters to text symbol parameters (didn’t checked, but it may work), but by inserting a model into *.lib file and selecting that file and then that model.
I got message about unhandled excpetion.
I found that a source of problem is first (IS) parameter specification. In original file it was IS=10.2f.
I suppose that from following models:
.MODEL TEST1 NPN (IS=10.2f)
.MODEL TEST2 NPN (IS=10.2E-15)
.MODEL TEST1 NPN (IS=1.02E-14)
only the last one will not generate that error.
It is surprising as other parameters in model use m, n, p specifiers and if you replace the text describing the model with IS specified in f it probably will work.
10.2E-15 is also surprising. Later in the same model there is CJE=26.8p and it is no problem that there are 2 digits before dot.
You have to have different library. I have library installed together with KiCad 7.0.9 at Windows. And in Simulation_SPICE VSIN has ac=1 originally set.
If you have more than one VDC or IDC, and both have ac=1, then the simulation results may become ugly, perhaps unwanted, as you have the linear superposition of two or more sources at each output.
Yeah, only the SIN sources have an ac amplitude given by default. I think most people would usually only use one sine source, as opposed to many DC sources, so it makes sense for the sine sources to have an ac amplitude. But making symbols work out of the box for most cases isn’t a substitute for needing to understand how SPICE works.