From the LTSPice IV manual:
X. Subcircuit
Syntax: Xxxx n1 n2 n3... <subckt name>
[<parameter>=<expression>]
Subcircuits allow circuitry to be defined and stored in a
library for later retrieval by name. Below is an example of
defining and calling a voltage divider and invoking it in a
circuit.
* calling a subcircuit
*
* This is the circuit
X1 in out 0 divider top=9K bot=1K
V1 in 0 pulse(0 1 0 .5m .5m 0 1m)
* This is the subcircuit
.subckt divider A B C
R1 A B {top}
R2 B C {bot}
.ends divider
.tran 3m
.end
Notice that params:
never appears in the LTSpice syntax for a subcircuit call.
I am guessing that including this token in your X card has confused LTSpice about how the subcircuit should be called.
If I simply save that PSpice file to a ntk3139p.lib
file and import it in LTspice, it all works fine:
The Rds(on) looks in line with the datasheet for that part.
What you need to keep in mind is to change the PMOS statement line to X (because it's a subcircuit) and match the name to the subckt name declared in that lib. Ctrl-click to access the advanced properties page for the FET:
This is actually explained in detail at http://www.linear.com/solutions/1083
And if you actually want to import that model into LTspice so that you don't have to use an .include
statement, what you need to do is
- Copy the aforementioned
ntk3139p.lib
into LTspiceIV\lib\sub
; this directory can [and does] contain both .lib
and .sub
files.
- Create a
ntk3139p.asy
in LTspiceIV\lib\sym
(or in one of its subfolders, in which case the component will show up in the corresponing category in the F2
select component dialog). This .asy
file is initially a copy of pmos.asy
that comes with LTspice in this case. Now you need to edit this ntk3139p.asy
file either in a text editor or using LTspice itself (via Edit->Attributes
or Ctrl+A
) so that it reads:
Now you can add the new component, but since we're using X as type it automatically get labelled as an IC (U
) rather than MOSFET as before. But we don't need an .inc
line anymore for the simulation to work:
Honestly this procedure is usually not worth the hassle for me... and if you reinstall LTspice or load your schematic on a different machine, you have to do it all over again, never mind that it becomes less clear in the schematic what components you need[ed] extra libraries for. Furthermore, you can no longer change the MOSFET by right-clicking on it an picking a new model. If you try that with your custom asy
file, you get:
Which for me is the most annoying part. So I don't recommend doing this import procedure for MOSFETS; I think it's only worth the hassle for ICs.
I honestly don't know exactly what the .sub
files are restricted to contain in LTspice, but the ones that come with the program are all binary files containing LT's proprietary models, some of which also make use of LT's extensions like steady and so forth. I don't think the .sub
binary format that LTspice uses is publicly documented anywhere.
Best Answer
Some PSpice models won't import into LTSpice, and those that do aren't always accurate. Before going through the hassle of finding out you should look for equivalents that might already be in LTSpice.
You can ignore package type, and often the same part is made by several manufacturers who use their own prefixes.
MMBT2907 is the same as 2N2907.
OPA192 is a precision rail-to-rail CMOS op amp with Gain Bandwidth Product of 10MHz. Depending on the circuit you are attempting to simulate, a variety of Linear technology op amps may be near enough to equivalent. LTSpice is provided for free because they want you to use their parts, so why not take a look at them?
Remember that models are just that - they don't mimic all the characteristics of the physical part. But for many simulations they don't have to. Therefore you can often get away with using a different part without invalidating the results, so long as the essential parameters are close enough.