This section explains the basics to adding a third-party model to LTspice XVII.
Basically there are two types of third party SPICE models, those described with a .MODEL statement and those defined with a .SUBCKT.
Models given as .MODEL statements are for intrinsic SPICE devices like diodes and transistors. The .MODEL statement gives the parameters for the specific component. The behavior of the device is already known by SPICE, only the parameters need to be given to finish specifying the component's electrical characteristics.
On the other hand, models given by .SUBCKT statements define the modeled component by a collection of circuitry of intrinsic SPICE devices. For example, the SPICE model of an opamp would be given as a subcircuit.
The way how to include the model in LTspice depends on whether the model is given as a .MODEL statement or a .SUBCKT.
Example for an NPN transistor defined with a .MODEL statement:
1. Add an instance of the symbol NPN to your schematic.
2. Edit the value "NPN" to be "BC547C" to coincide with the name used in the target .MODEL statement.
3. Now either
3a) Add the .MODEL BC547C... statement as a SPICE directive on your schematic.
3b) If you have a file bipol.lib containing your .MODEL BC547C... (other models may be too in this file), then add the SPICE directive ".INCLUDE bipol.lib" on your schematic. Note that "bipol.lib" must be the complete name with any file extensions and that Windows Explorer defaults to not showing the file extension. So you if you have a file called "bipol.lib.txt", which you can edit/view in notepad, and Windows Explorer shows you the file exits as "bipol.lib" The SPICE directive to include this file is ".inc bipol.lib.txt" If you used, ".inc bipol.lib" you will get an error message that that file can't be found.
3c) You can alternatively add the .MODEL BC547C... statement to the file typically installed as C:\Program Files\LTC\LTspiceIV\lib\cmp\standard.bjt. If you do that you will automatically see the model as a choice was editing the NPN transistor. If you edit this standard.bjt file outside of LTspice, you will have to restart LTspice for it to notice that the file has changed.
Example for a 5-pin opamp. This will be defined with a .SUBCKT statement:
1. Add an instance of symbol opamp2 to your schematic.
2. Edit the value "opamp2" to "TL072" on the schematic to coincide with the name of the .SUBCKT.
3a) Paste the ".SUBCKT TL072 ..... .ENDS" definition as one multi-line SPICE directive to your schematic.
3b) If you have a file called "TI.lib" containing the definition of subcircuit TL072(It will look like a line that starts out as ".SUBCKT TL072...") add the SPICE directive ".INCLUDE TI.lib" to the schematic.
It is possible to create a new symbol and program it to automatically include the necessary model for the simulation whenever it is used on a schematic. See help section Schematic Capture=>Creating New Symbols.
It is possible to create an automatically generated symbol that netlists correctly against an arbitrary third party model and have it programed so that it includes the necessary model for the simulation whenever it appears on a schematic. See help section Schematic Capture=>Creating New Symbols. For most users, this is the only method you should consider for adding new models defined as subcircuits since all the details are handeled for you.
Example for a 3-pin NPN transistor but defined with a .SUBCKT statement:
1. Add an instance of symbol NPN to your schematic.
2. Move the cursor over the body of the newly-placed NPN symbol instance. Press <Ctrl>RightMouseButton. A dialog box will appear. Change Prefix: QN to Prefix: X. This causes this instance of the symbol to netlist as a subcircuit instead of an intrinsic bipolar transistor.
3. Edit the value "NPN" to be "BFG135" to coincide with the name given on the .SUBCKT line.
4. Then either
4a) Add the .SUBCKT BFG135 lines to your schematic
4b) If you have a file Phil.lib containing your .SUBCKT BFG135 .... (others may be too in this file) then you have to add a SPICE directive .INCLUDE Phil.lib
One aspect of adding a .SUBCKT model to LTspice is that you need have the symbol used to call the subcircuit and the model agree on the same pin/port netlist order. The above examples assume the 3rd party model you're adding follows popular pin order conventions.
Further related information is in the help sections Schematic Capture and LTspice. The basic idea is that the schematic capture program generates a netlist that the simulator, LTspice reads. Any aspect of importing 3rd party models can be resolved by understanding SPICE netlist syntax and how the schematic capture program generates that syntax. There are also tutorials prepared on this topic archived at the independent users' group at http://groups.yahoo.com/group/LTspice.