MOSFET Spice model import error

Hello all,
I’m trying to import the Spice model for an FQP27P06 MOSFET, but it fails to load due to the phrase: “…FQP27P06.lib:8:51: expected”. I’ve attached a screenshot and also the model file. Might “8:51” refer to a line number in the file containing the error, or possibly an error code?

I would appreciate anyone’s help very much!

FQP27P06.txt (1.5 KB)

It refers to line 8 character 51. The kicad parser has trouble with the formula there. I think you can fix that by factoring out the formula and replacing the curly braces. I had to do something like that before so kicad would swallow the model:

.SUBCKT FQP27P06 20 10 30
Rg 10 1  1.58
M1 2 1 3 3 DMOS  L=1u  W=1u
.MODEL DMOS PMOS(VTO=(0.002976*TEMP-3.1744) KP=(-0.0068*TEMP+10.4)
+ THETA=0.0576  VMAX=3.0E5  ETA=0.004  LEVEL=3)
Cgs 1 3 990p
Rd 20 4 0.018  TC=0.0055
Dds 4 3 DDS
.MODEL DDS D(BV=(0.05849*TEMP+58.5374)  M=0.44   CJO=1380p   VJ=0.76)
...

Please double check what I calculated there, this is very rough. If you don’t care about the temperature, you can also set that to a fixed temperature and just calculate the values for VTO and KP and BV. Maybe someone who understands more about the model can give you some more insides. I believe this might be entirely a KiCad problem and not have anything to do with ngspice. KiCad parses the model on its side when assigning a model. Maybe I will try tomorrow if ngspice would handle this model without modification, but it is getting kind of late here …

Nested curly braces are rejected by KiCad/Eeschema. ngspice should have no problems with these. Some time ago I have made an update to ngspice to replace the inner curly braces by round brackets (automatically during parsing the model file).

I checked this with ngspice earlier and ngspice handles the model gracefully (if pspice compatibility is set with set ngbehavior=ltps ). I am kind of wondering why KiCad needs to parse the spice model to the extend that it does.