Author Topic: Total noob to simulation (KiCAD/ngspice)  (Read 1743 times)

0 Members and 1 Guest are viewing this topic.

Offline BentaTopic starter

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Total noob to simulation (KiCAD/ngspice)
« on: March 15, 2022, 09:08:56 pm »
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.

 

Offline twospoons

  • Regular Contributor
  • *
  • Posts: 228
  • Country: nz
Re: Total noob to simulation (KiCAD/ngspice)
« Reply #1 on: March 15, 2022, 10:00:17 pm »
Please post the error messages.
 

Offline BentaTopic starter

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: Total noob to simulation (KiCAD/ngspice)
« Reply #2 on: March 16, 2022, 09:19:03 pm »
It's a bit difficult, as they change all the time :(
(dkdzvtf24b is the model of the 24 V Zeners).
Here's the latest:
 

Offline twospoons

  • Regular Contributor
  • *
  • Posts: 228
  • Country: nz
Re: Total noob to simulation (KiCAD/ngspice)
« Reply #3 on: March 20, 2022, 04:11:25 am »
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.
 

Offline BentaTopic starter

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: Total noob to simulation (KiCAD/ngspice)
« Reply #4 on: March 22, 2022, 11:48:34 pm »
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.
 

Offline twospoons

  • Regular Contributor
  • *
  • Posts: 228
  • Country: nz
Re: Total noob to simulation (KiCAD/ngspice)
« Reply #5 on: March 23, 2022, 02:55:41 am »
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.
 

Offline BentaTopic starter

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: Total noob to simulation (KiCAD/ngspice)
« Reply #6 on: March 23, 2022, 11:20:58 pm »
Finally got it up and running, Thank You.
The solution was running a transient simulation and changing the phase on the sin source.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf