Hi,
PSpice library has only a few components. Is there a way to obtain a bigger library with other common simulator components such as voltage controlled switch?
Thank you
Hi,
PSpice library has only a few components. Is there a way to obtain a bigger library with other common simulator components such as voltage controlled switch?
Thank you
I had develop a ngspice.lib for symbol, and parrallel with ngspice.cir file to expose addition spice model…
I hope it help you as it help me… This should work for all KiCad version from 4.0 to 5.0.
You need to add spice directive to include the ngpsice.cir file in your schematic.
ngspice.cir (1.6 KB)
ngspice.lib (10.7 KB)
I didn’t succeeded yet. It seems that there is no way to use kicad simulations without diving into ngspice manual first.
Thank you for your help.
This is the general problem for simulation, the well known simulators like LTSpice are closed source.
Many device models are encrypted or at least have opensource unfriendly copyright.
I think adding some hidden fields in the pspice symbol may reduce amount of time you have to go back to ngspice manual. I use the value to add the ngspice syntax like into the symbol to help me remember it. But still, after 1.5 year not using ngspice, then comeback to use it for project - I had total lost how did I do it. So lucky I have some note in README of my project, and re-learn with ngpsice manual. So yes, it is a problem, but I think it help me understand in detail again - sometime very convenient tool (like Visual Studio) make us lose the inside out of understand thing – you known.
I installed the “ngspice.lib” file. Now, I have a “ngspice” directory with components.
But I don’t know what to do with the “ngspice.cir” file. What do you mean by:
You need to add spice directive to include the ngpsice.cir file in your schematic.
I have a text “.TRAN 0.0001 0.2 0” in my schematic. Is this enough? And where to click to import the ngspice.cir file? I imported the .lib file with the Symbol Library Editor (File -> Add Library).
Edit: I got it. I used the “Edit spice model” button and selected the .cir file (selection was possible after I selected “All files (*)” on the dropdown menu). Is this the correct way? And I need to do this for every symbol in the schematic.
Also, how to use the “TOGGLE” and “SWITCH” components - how to change their position? Can I program them to change their position at specified time after the beginning of the simulation?
I not familiar with 5.x version. However, you can just add spice directive ".include “…/ngspice.cir” as a text object in your schematic would be enough (to avoid add into every symbols).
You need to apply voltage on the control signal to make it switch. The voltage can be pulse, or pice-wise type of source to make it on/ off at particular time. Or if you need a feedback circuit, you can use voltage-to-voltage control source symbol/model. or opamp…
I want to simulate user’s interaction.
With Qucs it’s more simple, I can specify the times when the button/switch is changing it’s state:
But with KiCad I need to learn and write spice code, it’s not very user-friendly.
Ngspice has been added to Kicad quite recently. Obviously there is work to do. As with any open source project how much of that work is forthcoming is based on a lot of things.
In my professional work, interactive simulation have no use for me. It may be help full for learning how circuit work only. It like step-by-step debugging in coding also have similar taste for me. I afraid, to have ngspice interactive simulator support, would required ngspice design change for supporting it before KiCad can do it. So good luck with this path, I will be your cheerleader
There would be no need to redesign ngspice.
The ngspice shared library offers access to every step and parameter before, during and after the simulation. You may run single time steps, stop the simulation based on time progress or based on simulation results, change device parameters, resume simulation, change the circuit, reload it and simulate it again. All circuit and simulation data are available through the interface, all (interactive) commands are available as well. So its just the imagination (and time available) necessary for advancing the KiCad-ngspice interface.
Val wants a time controlled push-button.
An ngspice example subcircuit is attached.
What else is needed: create a symbol, allow the subcircuit parameters t1, t2, and on as text next to the symbol, invoke the subcircuit, find a place to publish the switch model.tswitch.cir (1.4 KB)
The official lib now has much better symbols found in the Simulation_SPICE library. However this lib has been added after the v5.0 release so you might need to manually add it to the library table using the library manager or you can also reset it to default (by deleting your personal global lib table and restarting kicad)
See Library management in KiCad version 5 to learn how to add libs and the reset to default section for an easy option to get the simulation lib in
Henlo,
I know this topic is more than 2 years old… Still i hope that u can re-share your ngspice library because its not working anymore
Thanks in advance.
I believe that library was eventually turned into this (but I could be wrong):
https://kicad.github.io/symbols/Simulation_SPICE