Create custom symbol in user-defined library from Q-NJFET-DGS and save as LSK170.
New symbol is first to be added to schematic.
We have a spice model file called LSK170.lib, containing models derived from an LTSpice installation.
The spice file has three ‘.model’ definitions for LSK170A, LSK170B and LSK170C.
Edit symbol with E and hit the ‘Simulation Model…’ button.
Select radio button for SPICE model from file. Browse to file with folder button, the three models appear in the dropdown and I select LSK170B then click OK, and then OK out of the symbol editor.
If I then attempt to edit the symbol again, KiCad crashes immediately. If I save the schematic and exit out gracefully, restart KiCad and edit the symbol, my Spice file setting has not been saved, it’s completely blank again. The same happens if I try to associate the Spice model with the corresponding symbol in the library, it simply crashes out or fails to save the spice model.
I tried a different file path for the spice file that wasn’t on iCloud drive and didn’t contain spaces, but that made no difference.
Frustrated that I cannot seem to make this work at all, I had hoped to be able to dispense with LTSpice and spare myself from having to manually copy the schematic to KiCad after modelling.
EDIT - this also happens on a Macbook Pro running Ventura with the same files.
The SPICE model file may be corrupted or incompatible with KiCad. You could try creating a new SPICE model file for the LSK170B model and see if that resolves the issue.
so there was no SUBCKT included, only the .model that I picked out of one of the LTSpice files. I’ve never been able to quite fathom out the myriad model data structure standards in LTSpice and how they relate to the drop down menus etc - I could not find a SUBCKT for LSK170 defined anywhere yet somehow it still works, it must handle it internally somehow whereas KiCad doesn’t. LTSpice had a big file under a ‘cmp’ folder called Standard.jft where I got the model defs from.
At least if KiCad is consistent about what is needed in a model file, I know where I stand!
Sadly that didn’t help - it still crashed out even when I removed that parameter. There may be another ‘non-standard’ parameter there.
I ended up down the rabbit hole this afternoon educating myself about ‘models’ and ‘subcircuits’ - models being the original parameters for the fixed number of spice elements such as resistors, transistors that spice used to be limited to - and as such it sounds like I should be using the Built In element feature, manually setting what parameters I can using the dialog rather than trying to feed it a .model definition?
It’s not clear from the KiCad documentation whether .model defs are supported outside of the ‘built in’ option - maybe they are and I need to identify and remove what parameters are not being recognised. Some experimentation is in order.
Yes, I just tried it again reducing it down to one parameter (Beta) which surely should be known to ngspice for a jfet. Same result, it didn’t save and crashed out.