How to add a model to LTspice (SwitcherCad)
This assumes you want to add a new model for a new device similar to
one in
the existing library.
Here are three different methods.
Method 1: Modify Libraries
This method makes sense if you are working on your own computer, where
you can update your own libraries and use them again.
- Look under
C:\Program Files\LTC\LTspiceIV
(or
C:\Program Files\LTC\SwCADIII
)
- Go to the directory lib\cmp
- Look at the list of standard devices to figure out which kind you
want, such as:
- standard.bjt
- standard.dio
- standard.jft
- ...etc...
Each line in each of these files has a model for one device.
- Add a line with the .model
line for your device to the end of the appropriate file using a text
editor.
Note you may have to adapt the model line to match
the pattern in the file. It should be pretty easy to figure
out.
Now when you open LTSpice, you should be able to pick the device you've
added as though it was one of the existing models.
Method 2: Using an external library file
This will work well if you are using a computer where you can't edit
the built-in library files, or where edits will not be saved, but where
you may have several models in one file which you would like to be able
to use in the future.
- Save the file which contains the model you want to use in a
directory where you have write access. (For example, I use
c:\windows\temp.)
- Insert a SPICE directive from the edit menu,
by using the
icon, or by typing 'S'.
In the text box, type
.lib path to your library file
so, for example
.lib c:\windows\temp\myfile.sp3
- Change the name of the component in your schematic to match the
exact name of the model in the library file.
Now when you simulate, your new device model should be used.
Note: you can use the .include
directive instead of the .lib directive if you
wish.
Method 3: Inserting the model directly into the
drawing
This will work well if you are using a computer where you can't edit
the built-in library files, or where edits will not be saved, and that
there is only a single model you want to use.
- Open file which contains the model you want to use, and
copy the model into the clipboard.
- Insert a SPICE directive from the edit menu, by using the
icon, or by typing 'S'.
In the text box, paste the model from the clipboard.
- Change the name of the component in your schematic to match the
exact name of the model in the model line.
Now when you simulate, your new device model should be used.
Note: Because you now have the model saved as
part of your schematic, this is completely portable between computers.