Guide On Creating A .lib or .mod SPICE Model For MOSFET

I need a SPICE model for:

https://www.digikey.com/en/products/detail/infineon-technologies/IRF9Z24NPBF/811747

None of the models I can find are .lib or .mod, which seem to be the only types that KiCAD can recognize. I tried .spi, but I receive a “too many parameters error”.

At this point, I think I need to create them myself in the appropriate file type. I can’t find a speck of info on how to do this for MOSFET nor anything on the syntax and required information for a .lib or .mod. I am happy to learn, but I need to start somewhere.

Can anyone help?

What do you want to express by this statement?

KiCad/ngspice either may use model parameter sets, e.g. models starting with a .model token. Or it accepts subcircuit models, e.g. models included in .subckt … .ends statements.

Whar else do you need?

The file name, expecially the file endings, like .lib, .spi, .mod, .md … are in no way connected to the contents of the file. There may be some preferences, but it does not matter for the model usage. So you will have to look into the file: Do I have a subcircuit model (which is typical for power devices), or a model parameter set starting with .model, and then you have to attach the model to your symbol accordingly.

What does a model (parameter) extraction require: You will need to study the intrinsics of a MOSFET, get to know what each parameter does contribute to the model. Then you will need to obtain suitable (measurement, data sheet) device I(V) and C(V) data. Then you will need to select a model type. Then you need to extract (optimize) the model parameters with a suitable software.

May I suggest that it is easier to switch-on Google and search for a spice model for IRF9Z24N ?

If you have finally found a model, you hen should give a step-by-step description of what you did to make use of the model and, if not successful, describe the error messages. Just stating “I receive a “too many parameters error”” is by far not enough information if you really want us to help.

On that digikey page, there is an:

image

which points to:
https://www.irf.com/product-info/models/saber/irf9z24n.sin

which contains:

template irf9z24n d g s
#*************************************
#      Model Generated by MODPEX     *
#Copyright(c) Symmetry Design Systems*
#         All Rights Reserved        *
#    UNPUBLISHED LICENSED SOFTWARE   *
#   Contains Proprietary Information *
#      Which is The Property of      *
#     SYMMETRY OR ITS LICENSORS      *
#Commercial Use or Resale Restricted *
#   by Symmetry License Agreement    *
#*************************************
# Model generated on Jul 30, 98
# MODEL FORMAT: Saber
# Symmetry POWER MOS Model (Version 1.0)
# External Node Designations
# Node d -> Drain
# Node g -> Gate
# Node s -> Source
electrical d,g,s
{
# BODY_BEGIN
# Default values used in MM:
# The voltage-dependent capacitances are
# not included. Other default values are:
#   LD=0 CBD=0 CBS=0 CGBO=0
spm..model mm=(type=_p,
level=1,is=1e-32,rd=1e-6,
vto=-3.54232,lambda=0.0070899,kp=2.98476,rs=0.105745,
cgso=2.66875e-06,cgdo=1.00695e-11)
spd..model md=(is=1.76033e-10,rs=0.01676,n=1.31971,bv=55,
ibv=0.00025,eg=1,xti=1,tt=0,
cjo=2.63435e-10,vj=2.86622,m=0.553382,FC=0.5)
# Default values used in MD1:
#   RS=0 EG=1.11 XTI=3.0 TT=0
#   BV=infinite IBV=1mA
spd..model md1=(is=1e-32,n=50,
cjo=5.09585e-10,vj=0.5,m=0.437452,fc=1e-08)
# Default values used in MD2:
#   EG=1.11 XTI=3.0 TT=0 CJO=0
#   BV=infinite IBV=1mA
spd..model md2=(is=1e-10,n=0.4,rs=3e-06)
# Default values used in MD3:
#   EG=1.11 XTI=3.0 TT=0 CJO=0
#   RS=0 BV=infinite IBV=1mA
spd..model md3=(is=1e-10,n=0.4)
spm.M1 n9 n7 s s =model=mm,l=100u,w=100u
spd.d1 d s =model=md
spr.rds s d =1e+06
spr.rd n9 d =0.0001
spr.rg g n7 =11.7257
spd.d2 n5 n4 =model=md1
spd.d3 n5 0 =model=md2
spr.rl n5 n10 =1
spf.fi2 n7 n9 i(spv.vfi2) =-1
spv.vfi2 n4 0 =0
spe.ev16 n10 0 n9 n7 =1
spc.cap n11 n10 =7.35707e-10
spf.fi1 n7 n9 i(spv.vfi1) =-1
spv.vfi1 n11 n6 =0
spr.rcap n6 n10 =1
spd.d4 n6 0 =model=md3
}

I don’t know whether that’s compatible with (or easily translatable to) KiCad / ngSpice.

No, a saber model is not compatible to KiCad/ngspice.

Saber is a proprietary simulation tool, and the model shown is written in MAST, which is Saber’s proprietary hardware description language.

Spice is also a form of hardware description language, and by far the most common one. Most Spice languages are pretty similar, but there may be minor differences. Some of those differences are in the Spice netlist syntax, and some are stuff like filename extensions. Models are often in the form of subcircuits, and the file extension can be all sorts of things depending on the flavor of Spice. They are usually straight-up text netlists, though sometimes they are encrypted. A .lib file usually contains a collection of subcircuits, and is made accessible using a .include statement within the main netlist.

I have a suggestion that may provide clues to my age, but still think is worthwhile. Try to do a couple simple spice circuits with at least one part using a .model statement (internal spice component model) and at least one part using a subcircuit, and do this strictly as a text file. Once you do this, much about Spice will become more clear, and will go a long ways towards being able to troubleshoot simulations and understand what every Spice GUI front-end needs to do. I think that Ngspice is a good vehicle for this, but you can run such files from within LTspice as well.

Hope this is useful.

John

1 Like

This is the first Google offering from the Infineon site:

.SUBCKT irf9z24n 1 2 3
**************************************
*      Model Generated by MODPEX     *
*Copyright(c) Symmetry Design Systems*
*         All Rights Reserved        *
*    UNPUBLISHED LICENSED SOFTWARE   *
*   Contains Proprietary Information *
*      Which is The Property of      *
*     SYMMETRY OR ITS LICENSORS      *
*Commercial Use or Resale Restricted *
*   by Symmetry License Agreement    *
**************************************
* Model generated on Mar  7, 97
* MODEL FORMAT: SPICE3
* Symmetry POWER MOS Model (Version 1.0)
* External Node Designations
* Node 1 -> Drain
* Node 2 -> Gate
* Node 3 -> Source
M1 9 7 8 8 MM L=100u W=100u
* Default values used in MM:
* The voltage-dependent capacitances are
* not included. Other default values are:
*   RS=0 RD=0 LD=0 CBD=0 CBS=0 CGBO=0
.MODEL MM PMOS LEVEL=1 IS=1e-32

Edit: Paulvdh.
@jmk: I put triple backticks around you model, so the forum software does not *&^%$#@! the text.
You can also use the Preformatted Text button:
image

Those formats all look fairly readable. It looks like that if you’ve got some experience with those models, hand editing from a saber model to a .model or .subcircuit would not be very difficult. Maybe there already are scripts to do this?

All results from a search give me unusable model files. The error is always “too many parameters”.

The steps were:

Open Symbol Properties > Spice Model > Select File > select the model file > Ok > run simulation which results in the “too many parameters” error.

This is different than the .spi I found on Infineon’s site: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwi58du5gZj9AhX0ITQIHegVAaUQFnoECBQQAQ&url=http%3A%2F%2Fwww.infineon.com%2Fdgdl%2Firf9z24n.spi%3FfileId%3D5546d462533600a401535711b2883927&usg=AOvVaw2GiR-F0BdB6iXYlmtH4XgM

It also gives this error:

Circuit: *
Warning: No job (tran, ac, op etc.) defined:
run simulation not started

There is exactly one authoritative model, its from the Infineon web site at https://www.infineon.com/dgdl/irf9z24n.spi?fileId=5546d462533600a401535711b2883927 . If you look at its contents, you see it starting with the line
.SUBCKT irf9z24n 1 2 3
So it is obvious that it is a subcircuit model.

Somewhere down the lines you find the information on the node sequence: drain, gate, source. So you will need a power MOS (PMOS) symbol with three nodes.

So as a next step may I suggest that you create a very simple circuit with such a power PMOS, attach the model and run a simulation. If that fails, you may post the project (with this simple circuit) here, and I can have a look.

1 Like

The “too many parameters” error has been thrashed here before, and stems from your 4-pin MOSFET symbol vs. a 3-pin Spice model. Get that right first.

It seems that was the problem. I should have noticed this. Thanks.

The MMOSFET in my circuit has a 3-pin model, but the symbol is 4 pins with Source and B shorted, and it works. Weird. I assumed this would be the case for the PMOSFET.

I just did a very simple simulation with the Infineon Spice model (.spi) and it runs beautifully.
I simply used a standard PMOS symbol from the “Device” library.
“Alternate node sequence” is set to 2 1 3.



I hope you’re aware that your model is for a PMOS, right?

BTW: go to the manufacturers for models, not Alibaba or Digikey or China-Super-Semiconductors or whoever.

2 Likes

Not weird. I suspect you shorted it in your circuit, which is not the same as doing it in the library. Shorting it in the library would leave you with 3 pins, so it would work.