Total noob to simulation (KiCAD/ngspice) - Page 1
Forum section: electronics / general

author: Benta
author_rank: Super Contributor
timestamp: March 15, 2022, 09:08:56 pm
content: As the title says.[I'm not certain that this is the right section. @moderator: feel free to move it to "Beginners".]I'm running KiCAD 6.0 with ngspice 31 installed. OS: Lubuntu 20.04 LTS.My circuit is not complex, but difficult to analyze, which is why I want to run a simulation. And I'm a virgin here.I've drawn the circuit in KiCAD as usual with no problems.After that, I replaced the passives (R and C) with parts from the 'pspice" library in KiCAD. The diodes I edited to have the spice type "Diode".For the Zeners, DIAC and TRIAC I uploaded the relevant libraries from the manufacturers.Last, I added a spice VSOURCE.And now I don't know how to move on. Trying a simulation just brings cryptic error messages.It seems I'm overlooking something obvious, but the web tutorials are very little help.Can someone point me in the right direction?Thanks in advance.

author: twospoons
author_rank: Frequent Contributor
timestamp: March 15, 2022, 10:00:17 pm
content: Please post the error messages.

author: Benta
author_rank: Super Contributor
timestamp: March 16, 2022, 09:19:03 pm
content: It's a bit difficult, as they change all the time(dkdzvtf24b is the model of the 24 V Zeners).Here's the latest:

author: twospoons
author_rank: Frequent Contributor
timestamp: March 20, 2022, 04:11:25 am
content: It looks like ngspice doesn't understand the new models you've added. There are different model complexity levels in use in the SPICE world, I don't know which ngspice is compatible with, sorry.If you can find some generic models in Kicad for the parts giving you trouble and compare to the manufacturers models, its sometimes possible to work out where the incompatibilities are. I've had to do this myself on occaision.Can I suggest trying another simulator with those models, maybe LTSpice, or the demo version of Simetrix (my personal favourite). Both are quite mature and should be capable of handling most models.

author: Benta
author_rank: Super Contributor
timestamp: March 22, 2022, 11:48:34 pm
content: Thank You for the reply.It indeed seems that some supplier libraries are too large or too complex for ngspice.However, I've finally managed building a simulation schematic that throws no errors. A BIG day for me!My big problem now is how to drive this circuit in the simulation.I want to apply 230 VAC to it to see the transient response, switching it on at any time during the 50 Hz cycle. I've read the SPICE manual beginning to end, and searched the web (probably with the wrong search terms) but found nothing.Any ideas here?Thanks.

author: twospoons
author_rank: Frequent Contributor
timestamp: March 23, 2022, 02:55:41 am
content: Two ways I can think of: if there is a "voltage controlled switch" device available you could add that in line with your sinewave source and control it with a second voltage source - single step with delay.Or I would have thought you can specify the phase of your sine source, which would set the voltage at T=0 to something other than zero, depending on the phase value.

author: Benta
author_rank: Super Contributor
timestamp: March 23, 2022, 11:20:58 pm
content: Finally got it up and running, Thank You.The solution was running a transient simulation and changing the phase on the sin source.