kicad-spice-library / kicad-spice-library Goto Github PK
View Code? Open in Web Editor NEWCentralized repo to store KiCad/Spice modules for simulations
License: GNU General Public License v3.0
Centralized repo to store KiCad/Spice modules for simulations
License: GNU General Public License v3.0
Trying to start a simulation using the Transistor/FET/MOS.lib library results in a crash (even after fixing the first line by changing '#' into '*')
In order to determine the cause, I decided to try to load the library using ngspice.
The behaviour is more or less the same.
File "test.cir":
.title KiCad schematic
.include "..\KiCad-Spice-Library\Models\Transistor\FET\MOS.lib"
Testing file "test.cir":
c:\Spice64\bin\ngspice_con.exe test.cir
I performed a "manual binary search" by deleting lines until the library load worked and up to the moment where the load failed.
I then got the following message in the ngspice console (not the KiCAD version):
Warning: Syntax check for VDMOS instances is limited to 256 .model cards
Circuit: KiCad schematic
This is coherent with the fact that I had to truncate the MOS.lib
file to 263 lines.
I suggest to split the file into smaller parts.
More generally, all libraries could be checked by trying to load them using ngspice and verify that the ngspice execution does not exit prematurely.
It would be nice to be able to search the models inside Escheema and assign them directly onto the corresponding symbol. Right now it doesn't seems to be feasible without trying to contribute directly to the Kicad project. I read that in a future release, Escheema, will have the capability to run python-scripts or more complex plugins, probably we need to wait in order to develop such a feature.
Using the mosfets in this library don't seem to produce desirable results when using them against the Kicad mosfet symbol. Maybe the pins are somehow mismapped?
Hi! I was looking for a Spice library project especially suited for KiCad. Are you still maintaining this project? If so.. have you seen this page http://ltwiki.org/index.php?title=Components_Library_and_Circuits ? There are a lot of ready available models that could be easily include in your project. Let me know if your are going to continue with this lib!
The LM358/NS subcircuit model in this repository (Models/Operational%20Amplifier/Lm358.mod) sometimes exhibits negative power consumption and may actually end up seemingly powering connected circuits as an artifact of this bug. IN particular, this happens when the power supply is 5V (+/- 2.5V) or less (as allowed by the data sheet).
This can be shown by putting the model in a basic opamp example circuit and running a simulation with low power supply (I happened to do my tests in the popular LTSpice freeware instead of whatever is installed with KiCad, but others should be able to check that this also happens with the KiCad bundled spice).
The alternative subcircuit model published by SGS Thompson (ST) has a very similar bug, generating even more fictional power.
The alternative model file published by NS/Ti as "snom268b" is even messier, not even being a single subcircuit .
It would be good if the repository maintainers would add a warning in the top comments of the LM358 model file, and leave this bug open as something that others can solve by uploading a better LM358 model.
Hi,
I stumbled upon this project in search for a specific model. I tried using the check_supported script, but it did not work for me
~/git/KiCad-Spice-Library/Scripts $ python check_supported.py
Write 'exit' when you want to stop
Write here the part you are looking for: lnd150
Traceback (most recent call last):
File "/home/joost/git/KiCad-Spice-Library/Scripts/check_supported.py", line 68, in <module>
search(to_search)
File "/home/joost/git/KiCad-Spice-Library/Scripts/check_supported.py", line 38, in search
print_match(module)
File "/home/joost/git/KiCad-Spice-Library/Scripts/check_supported.py", line 16, in print_match
path = ', '.join(p[p.index(folder_name)+len(folder_name):] for p in supported[part])
File "/home/joost/git/KiCad-Spice-Library/Scripts/check_supported.py", line 16, in <genexpr>
path = ', '.join(p[p.index(folder_name)+len(folder_name):] for p in supported[part])
ValueError: substring not found
I looked in to this and found out this was due to some path differences. Instead of just finding the part I need I procrastinated and tried to clean-up a bit of these scripts. I'll publish a pull request with my work
$ python3 ./Scripts/extractModels.pl
File "/home/user/Dev/KiCad-Spice-Library/./Scripts/extractModels.pl", line 62
$modelName=~s/([$"])/\\$1/g;
^
SyntaxError: unterminated string literal (detected at line 62)
So regarding your statement "In this folder there are all the modules and libraries, I tried to organize them with a minimum of logic but better approaches then mine are really welcome"
Right now, you probably took models and libraries from a lot of different sources and put them together in this repo.
That is a good first step but to me everything feels a bit unorganized /hard to use.
(already better than Kicad by default though since that has only basic models)
I would like to give the following suggestion:
Maybe a nice topic to have some brainstorm on...
.SUBCKT TL074c 1out 1in- 1in+ vcc+ 2in+ 2in- 2out 3out 3in- 3in+ vcc- 4in+ 4in- 4out
.include TL074.301
XU1A 1in+ 1in- vcc+ vcc- 1out TL074
XU1B 2in+ 2in- vcc+ vcc- 2out TL074
XU1C 3in+ 3in- vcc+ vcc- 3out TL074
XU1D 4in+ 4in- vcc+ vcc- 4out TL074
.ends
Because I see you only provide the opamp but not the whole chip
Application: KiCad x64 on x64
Version: 7.0.1, release build
Libraries:
wxWidgets 3.2.2
FreeType 2.12.1
HarfBuzz 5.0.1
FontConfig 2.14.1
libcurl/7.83.1-DEV Schannel zlib/1.2.13
Platform: Windows 11 (build 22621), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Mar 11 2023 03:41:46
wxWidgets: 3.2.2 (wchar_t,wx containers)
Boost: 1.80.0
OCC: 7.6.2
Curl: 7.83.1-DEV
ngspice: 39
Compiler: Visual C++ 1934 without C++ ABI
Build settings:
KICAD_SPICE=ON
In Kicad7 I am trying to add a diode model (bat54a) to my symbol.
When opening DIODE2.lib I get the error:
Could not find model '1N4007'to copy for "A Kind Of" model 'D1N4007'
The lib won't open.
Moving 1N4007 before D1N4007 helped for me.
It would be nice to have the following lookup working, independent of case:
$ ./Scripts/check_supported.py 2N3906
Searching for 2N3906
2N3906 not found!
$ ./Scripts/check_supported.py 2n3906
Searching for 2n3906
2n3906 found in
- Transistor/BJT/BJT.lib
The python dependencies needed to run the scripts are not specified in the README.
Hola, soy nuevo en kicad, podrian explicarme como añadir la libreria de elementos spice en kicad version 5.1.9
Muchas gracias por su trabajo
Simulation under KiCAD fails like this:
Error: Mismatch of .subckt ... .ends statements!
This will cause subsequent errors.
Error: ngspice.dll cannot recover and awaits to be detached
The reason is something like this (.ENDS without .SUBCKT):
*
*BLABLA MODEL
*
.MODEL BLABLA NMOS (LEVEL=3 RS=0.36 NSUB=1.0E15
+DELTA=0.1 KAPPA=0.0506 TPG=1 CGDO=6.343E-10
+RD=0.43 VTO=1.600 VMAX=1.0E7 ETA=0.0223089
+NFS=6.6E10 TOX=1.0E-7 LD=1.698E-9 UO=862.425
+XJ=6.4666E-7 THETA=1.0E-5 CGSO=9.09E-9 L=2.5E-6
+W=5.0E-3)
.ENDS
Changing to
The reason is something like this (.ENDS without .SUBCKT):
*
*BLABLA MODEL
*
.MODEL BLABLA NMOS (LEVEL=3 RS=0.36 NSUB=1.0E15
+DELTA=0.1 KAPPA=0.0506 TPG=1 CGDO=6.343E-10
+RD=0.43 VTO=1.600 VMAX=1.0E7 ETA=0.0223089
+NFS=6.6E10 TOX=1.0E-7 LD=1.698E-9 UO=862.425
+XJ=6.4666E-7 THETA=1.0E-5 CGSO=9.09E-9 L=2.5E-6
+W=5.0E-3)
* .ENDS
Fixes the issue.
in some files, for example "Models/Digital 20Logic/74HC.LIB" there are references to non-existing files like:
.model ls_shift4 d_state(state_file=shift4.txt
.model ls_count16 d_state(state_file=count16.txt reset_delay=26n)
anyone knows where I could find those files?
I wanted to use the NE555 model from this repo but it doesn't seem to be working:
$ ./extractModels.pl 'NE555#/uncategorized/Bordodynovs Electronics Lib/sub/NE555.sub'
*
* NE555 - Extracted from '/uncategorized/Bordodynovs Electronics Lib/sub/NE555.sub'
*
.subckt NE555 1 2 3 4 5 6 7 8
A1 N001 2 1 1 1 1 N003 1 SCHMITT Vt=0 Vh=1m
R1 N001 1 5K
R2 5 N001 5K
R3 8 5 5K
S1 1 7 N007 1 D
A2 N011 N003 1 1 1 1 N008 1 SRFLOP Trise=100n tripdt=10n
A3 6 5 1 1 1 1 N012 1 SCHMITT Vt=0 Vh=1m
S2 8 3 N009 1 O
S3 3 1 1 N009 O
A6 1 N006 1 N008 1 1 N007 1 OR Ref=.5 Vlow=-1 Trise=100n
R7 8 1 4K
R9 2 1 1G
R10 6 1 1G
A4 1 N008 1 N006 1 N009 1 1 OR ref=.5 Vlow=-1 Trise=100n
A5 4 1 1 1 1 N006 1 1 SCHMITT Vt=.7 Vh=1m
D1 4 1 DR
A7 1 N006 1 N012 1 1 N011 1 OR
D2 8 4 400uA
.model DR D(Ron=150K Roff=1T Vfwd=1.6)
.model O SW(Ron=6 Roff=1Meg Vt=0 Vh=-.8)
.model D SW(Ron=6 Roff=.75G Vt=.5 Vh=-.4)
.model 400uA D(Ron=1K Ilimit=400u epsilon=.5)
.ends NE555
When I try to simulate it (astable mode), I get the following error:
Note: Compatibility modes selected: ps lt a
warning, can't find model 'or' from line
a7 1 n006 1 n012 1 1 n011 1 or
warning, can't find model 'c' from line
c2 net-_u1-thr_ gnd c
Circuit: KiCad schematic
Error on line:
a.xu1.a1 xu1.n001 net-_u1-thr_ 0 0 0 0 xu1.n003 0 xu1.schmitt xu1.vt 0 xu1.vh 1m
MIF-ERROR - unable to find definition of model 1m
Sorry if too nooby or naive but really need clarification
Whatever files/dir. to copy and into where in the Kicad default paths in order the Tool->Simulator works seamlessly
Thanks for this project, I think it could be better.
I got an error like:
[Ken@kenpc Scripts]$ python check_supported.py
Write 'exit' when you want to stop
Write here the part you are looking for: 555
555 not found, maybe you meant one of these: 555_pwr, atod_555, atod_555_nx, bb555/sie, bb555_in, bcr555/sie, bcr555_in, cd4555b, din555, do555, do555_nx, dtoa_555, fmmt555, fmmt555_zx, fxt555, fxt555_zx, io_555, irf7555_ir, j555, lm555, pmbt5550, pmbt5551, pmst5550, pmst5551, q2n5550, q2n5551, s0555r, tlc555_ti, ts555h, ts555h_st, ts555l, ts555l_st, ts555m, ts555m_st, ua555, ztx555, ztx555_zx
Would you like to do another search? lm555
Traceback (most recent call last):
File "check_supported.py", line 68, in
search(to_search)
File "check_supported.py", line 38, in search
print_match(module)
File "check_supported.py", line 16, in print_match
path = ', '.join(p[p.index(folder_name)+len(folder_name):] for p in supported[part])
File "check_supported.py", line 16, in
path = ', '.join(p[p.index(folder_name)+len(folder_name):] for p in supported[part])
ValueError: substring not found
OS: manjaro xfce 64bit
[Ken@kenpc Scripts]$ python -V
Python 3.7.3
For example some .lib
are Spice files and some Kicad files. Thus, I added naively some Spice files as a Kicad library...
I suggest adding few lines on the README, cleanup the file extensions and move Kicad file in a separate directory.
Some subcirquits in https://github.com/kicad-spice-library/KiCad-Spice-Library/blob/master/Models/Diode/zener.lib library have missing .ENDS
cards and DR
models.
For example these ones:
DI_BZX84C3V6T
DI_BZX84C3V6TS
DI_BZX84C3V6W
DI_BZX84C3V9S
DI_BZX84C3V9T
DI_BZX84C3V9TS
DI_BZX84C3V9W
Some PSICE models includes the mfg keyword to include information about the manufacturer. It would be nice to include this information when a model is searched using the check_supported.py script.
I can't find how to integrate the library into KICAD
windows 10 x64
In #16 I explained that the MOS.lib library has too many models, which prevents simulation (actually: KiCAD crashes).
I also had a conflict with the 2N7000 model because it appears in Supertex.lib that I loaded fror the VP2106 MOSFET as well as in MOS.lib .
However, one is a "NMOS" model and the otehr one is a "VDMOS" model - each model requiring a different number of nodes (the first model has bulk, the second one doesn't).
So I decided to create a library local to the project (spice.lib
) where I added a copy of the model.
The benefits are:
So there would be some use for a script that would extract selected models from the libraries to extract them into a single project spice library file.
Anyway, extracting the model manually is fine for me as well: I do not make that many analogue simulations... .
In at least zener.lib
the copyright notices from https://www.diodes.com/assets/Spice-Models/Discrete-Prodcut-Groups/Zener-Diodes.txt (probably the original source of the file) have been removed.
They should be readded from the original file.
The license of this project might also have to be updated to match the restrictions under which the model providers released the models originally.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.