Maker Pro
Maker Pro

Perplexed by LTSpice symbol creation

C

Chris Carlen

Jan 1, 1970
0
Greetings:

I have succeeded in making symbols in LTSpice, but am presently puzzled
by this:

In the manual it says: "There is a symbol attribute, ModelFile, that
may be specified. ... If the prefix attribute is 'X' and there is a
symbol attribute SpiceModel defined that is subcircuit defined in the
model file, then a drop list of all subcircuits names will be available
when an instance of the symbol is edited on the schematic."


I can't get the drop down list aspect of this to work. I have a symbol
nmos-irf.asy defined, with prefix attribute X, ModelFile attribute set
to the name of a text file containing several IRF subcircuits, including
IRF540, IRF540N, and IRFI540N, and the SpiceModel attribute set to irf540.

An instance of the nmos-irf symbol on a new schematic, when
rightclicked, gives the usual component attribute editor, but there
seems to be no way to get any drop down lists of the other models in the
subcircuit library.

What am I missing here?


Thanks.


Good day!



--
_______________________________________________________________________
Christopher R. Carlen
Principal Laser/Optical Technologist
Sandia National Laboratories CA USA
[email protected] -- NOTE: Remove "BOGUS" from email address to reply.
 
M

Mike Engelhardt

Jan 1, 1970
0
Chris,
I have succeeded in making symbols in LTSpice, but am presently
puzzled by this:

In the manual it says: "There is a symbol attribute, ModelFile, that
may be specified. ... If the prefix attribute is 'X' and there is a
symbol attribute SpiceModel defined that is subcircuit defined in the
model file, then a drop list of all subcircuits names will be available
when an instance of the symbol is edited on the schematic."

I can't get the drop down list aspect of this to work. I have a symbol
nmos-irf.asy defined, with prefix attribute X, ModelFile attribute set
to the name of a text file containing several IRF subcircuits, including
IRF540, IRF540N, and IRFI540N, and the SpiceModel attribute set to irf540.

An instance of the nmos-irf symbol on a new schematic, when
rightclicked, gives the usual component attribute editor, but there
seems to be no way to get any drop down lists of the other models in the
subcircuit library.

What am I missing here?

The help cites a working example of this that you can look at. Perhaps
you edited the symbol outside of LTspice and it still using an internally
cached version of the symbol or it can't file specified by the ModelFile
attribute. If you think you've found a bug, please send to the address
on the help=>About dialog box.

--Mike
 
C

Chris Carlen

Jan 1, 1970
0
Mike said:
Chris,




The help cites a working example of this that you can look at. Perhaps
you edited the symbol outside of LTspice and it still using an internally
cached version of the symbol or it can't file specified by the ModelFile
attribute. If you think you've found a bug, please send to the address
on the help=>About dialog box.


Thanks for the reply, Mike.

Actually, the help refers to the 1-pole and 2-pole opamp macromodels as
examples, even though they aren't very good examples because each symbol
associates with a .sub file with only one model in it. Thus the drop
down list feature isn't demonstrated by this example.

Nonetheless, in an effort to troubleshoot this problem, I hacked the
1-pole.sub and 2-pole.sub files into one file called n-pole.sub. Then I
modified the 1-pole.asy to point to the n-pole.sub file, and saved it as
n-pole.asy.

Sure enough, the drop down list works! I can choose between 1-pole and
2-pole opamp macromodels for the single n-pole symbol.

But still, I couldn't get my IRF model file to work. The netlist
correctly showed the file being included with a .lib statement.

But no drop down list. I modified the .ends statements to include the
model names instead of just plain .ends. Still no results.

Then for some odd reason, after about the 4th time of checking my symbol
attributes, netlists, etc. and closing and opening the program LTSpice
to make sure it loaded fresh copies of things, it worked!

Mike, the program does always re-check the symbol and .sub files each
time you open the program right? If so, then I really don't know why it
didn't work, and then suddenly did. I hate when computers do this. I
hate non-reproducable problems. I will see if the problem crops up
again if I try the whole cycle again.

Good day!



--
_______________________________________________________________________
Christopher R. Carlen
Principal Laser/Optical Technologist
Sandia National Laboratories CA USA
[email protected] -- NOTE: Remove "BOGUS" from email address to reply.
 
M

Mike Engelhardt

Jan 1, 1970
0
Chris,
Actually, the help refers to the 1-pole and 2-pole opamp macromodels
as examples, even though they aren't very good examples...

That's true, there's only one item in the drop list, so it's pretty boring.
It's a feature that's there for people to add 3rd party models, but isn't
really needed for the models that come with.
...Mike, the program does always re-check the symbol and .sub files each
time you open the program right? If so, then I really don't know why it
didn't work, and then suddenly did. I hate when computers do this. I
hate non-reproducable problems. I will see if the problem crops up
again if I try the whole cycle again.

I don't know what to say. LTspice can be pretty clever about caching
files that it reads, but it gets a fresh lobotomy each time to start
the program. Don't forget you have to flush files in other editors to
disk if you're using other editors. If you edit all files within a
single invocation of LTspice, it should never get confused. Feel free
to submit detailed bug reports to the address in the help=>About box
with all required files to duplicate the problem if you find behavior
that deviates from what I just described.

--Mike
 
C

Chris Carlen

Jan 1, 1970
0
Mike said:
I don't know what to say. LTspice can be pretty clever about caching
files that it reads, but it gets a fresh lobotomy each time to start
the program. Don't forget you have to flush files in other editors to
disk if you're using other editors. If you edit all files within a
single invocation of LTspice, it should never get confused. Feel free
to submit detailed bug reports to the address in the help=>About box
with all required files to duplicate the problem if you find behavior
that deviates from what I just described.

--Mike


Maybe I just didn't know enough to click the SpiceModel field to make
the drop down appear, until I had figured it out with the op-amps.

Good day!


--
_______________________________________________________________________
Christopher R. Carlen
Principal Laser/Optical Technologist
Sandia National Laboratories CA USA
[email protected] -- NOTE: Remove "BOGUS" from email address to reply.
 
H

Helmut Sennewald

Jan 1, 1970
0
Hello Christopher,
here is an example with four IRF-Mosfets to choose.


Chris, I know you don't need it so precisely, but there are many other
LTSPICE users not so familiar with models.


1. Put the circuit file(.asc) in your working directory. Put the library
file(.lib) in the same directory as the circuit file(.asc).
I am shure it's also ok to have it in the SWCADIII\lib\sub directory if no
path extension is given to the file name.

2. Save the symbol file(.asy) into any directory you want. I always prefer
a subdirectory of the SWCADIII\lib\sym directory.

3. Restart LTSPICE!

4. Open(load) the attached test circuit file(.asc).

5. Move the cursor over the Mosfet and then "right click mouse".
You dont't see any models to choose. The field for that is empty and
gray.

6. "left click mouse" on the line SpiceModel.
Now the selection box(line) shows the actual model and you can choose
irf510, irf520, irf530 and irf540 with the library below. Just add
the models you want to have to this library file.

7. Have fun with it.


Changing the symbol to your needs.
----------------------------------
Open the symbol "irf-xnmos.asy" and then
Edit->Attributes->Edit Attributes

Prefix X
SpiceModel IRF510
Value
Value2
SpiceLine
SpiceLIne2
Description N-Channel MOSFET transistor
Modelfile irf510203040.lib

It is very important that the value in "SpiceModel" is the name of a
subcircuit
in the Modelfile! If this isn't the case, the selection feature will not
work!
In our case IRF510 must be in the model file. Instead of IRF510 we could
use IRF520, irf530 or irf540 also.


Best Regards
Helmut

PS: LTSPICE users's group http://groups.yahoo.com/group/LTspice/




The symbol attributes for the "select-box"-feature.


The symbol file "irf-xnmos.asy"

Version 4
SymbolType CELL
LINE Normal 48 48 48 96
LINE Normal 16 80 48 80
LINE Normal 40 48 48 48
LINE Normal 16 48 40 44
LINE Normal 16 48 40 52
LINE Normal 40 44 40 52
LINE Normal 16 8 16 24
LINE Normal 16 40 16 56
LINE Normal 16 72 16 88
LINE Normal 0 80 8 80
LINE Normal 8 16 8 80
LINE Normal 48 16 16 16
LINE Normal 48 0 48 16
WINDOW 0 65 24 Left 0
WINDOW 38 65 72 Left 0
SYMATTR SpiceModel IRF510
SYMATTR Prefix X
SYMATTR Description N-Channel MOSFET transistor subcircuit
SYMATTR ModelFile irf510203040.lib
PIN 48 0 NONE 0
PINATTR PinName D
PINATTR SpiceOrder 1
PIN 0 80 NONE 0
PINATTR PinName G
PINATTR SpiceOrder 2
PIN 48 96 NONE 0
PINATTR PinName S
PINATTR SpiceOrder 3





The test circuit file "Test_selection.asc":

Version 4
SHEET 1 880 680
WIRE 128 -80 128 48
WIRE 128 48 -96 48
WIRE 80 -96 -96 -96
WIRE -96 -96 -96 -64
WIRE -96 16 -96 48
WIRE -96 48 -96 80
WIRE -96 -320 -96 -288
WIRE -96 -208 -96 -176
WIRE -96 -320 128 -320
WIRE 128 -320 128 -176
FLAG -96 80 0
FLAG -96 -176 0
SYMBOL x_models\\irf-xnmos 80 -176 R0
SYMATTR InstName U1
SYMATTR SpiceModel irf540
SYMBOL voltage -96 -80 R0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL voltage -96 -304 R0
SYMATTR InstName V2
SYMATTR Value 5
TEXT -106 -392 Left 0 !.dc V1 0 5 0.01






The library file "irf10203040.lib"


..SUBCKT irf510 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 Apr 24, 96
* 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 NMOS LEVEL=1 IS=1e-32
+VTO=3.82703 LAMBDA=0 KP=2.48457
+CGSO=1.72132e-06 CGDO=5.99235e-11
RS 8 3 0.276929
D1 3 1 MD
..MODEL MD D IS=6.52734e-11 RS=0.0458243 N=1.2565 BV=100
+IBV=0.00025 EG=1.2 XTI=1 TT=0
+CJO=2.98645e-10 VJ=0.774158 M=0.422859 FC=0.5
RDS 3 1 4e+06
RD 9 1 0.0673242
RG 2 7 13.1694
D2 4 5 MD1
* Default values used in MD1:
* RS=0 EG=1.11 XTI=3.0 TT=0
* BV=infinite IBV=1mA
..MODEL MD1 D IS=1e-32 N=50
+CJO=1.85121e-10 VJ=0.500044 M=0.651006 FC=1e-08
D3 0 5 MD2
* Default values used in MD2:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* BV=infinite IBV=1mA
..MODEL MD2 D IS=1e-10 N=0.4 RS=3e-06
RL 5 10 1
FI2 7 9 VFI2 -1
VFI2 4 0 0
EV16 10 0 9 7 1
CAP 11 10 3.40332e-10
FI1 7 9 VFI1 -1
VFI1 11 6 0
RCAP 6 10 1
D4 0 6 MD3
* Default values used in MD3:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* RS=0 BV=infinite IBV=1mA
..MODEL MD3 D IS=1e-10 N=0.4
..ENDS

..SUBCKT irf520 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 Apr 24, 96
* 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 NMOS LEVEL=1 IS=1e-32
+VTO=3.61397 LAMBDA=0.00572642 KP=3.9143
+CGSO=3.28344e-06 CGDO=1.0112e-11
RS 8 3 0.171045
D1 3 1 MD
..MODEL MD D IS=7.10668e-11 RS=0.0302634 N=1.21428 BV=100
+IBV=0.00025 EG=1 XTI=2.99378 TT=2.27818e-09
+CJO=5.01988e-10 VJ=0.565258 M=0.378444 FC=0.5
RDS 3 1 4e+06
RD 9 1 0.01473
RG 2 7 1.34402
D2 4 5 MD1
* Default values used in MD1:
* RS=0 EG=1.11 XTI=3.0 TT=0
* BV=infinite IBV=1mA
..MODEL MD1 D IS=1e-32 N=50
+CJO=4.14565e-10 VJ=0.5 M=0.640575 FC=1e-08
D3 0 5 MD2
* Default values used in MD2:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* BV=infinite IBV=1mA
..MODEL MD2 D IS=1e-10 N=0.4 RS=3e-06
RL 5 10 1
FI2 7 9 VFI2 -1
VFI2 4 0 0
EV16 10 0 9 7 1
CAP 11 10 6.23795e-10
FI1 7 9 VFI1 -1
VFI1 11 6 0
RCAP 6 10 1
D4 0 6 MD3
* Default values used in MD3:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* RS=0 BV=infinite IBV=1mA
..MODEL MD3 D IS=1e-10 N=0.4
..ENDS

..SUBCKT irf530 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 Apr 24, 96
* 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 NMOS LEVEL=1 IS=1e-32
+VTO=3.87932 LAMBDA=0.00393789 KP=7.05019
+CGSO=6.11314e-06 CGDO=1e-11
RS 8 3 0.073836
D1 3 1 MD
..MODEL MD D IS=9.70956e-10 RS=0.0137423 N=1.31938 BV=300
+IBV=0.00025 EG=1 XTI=4 TT=1e-07
+CJO=1.03141e-09 VJ=1.46661 M=0.501224 FC=0.5
RDS 3 1 4e+06
RD 9 1 0.0001
RG 2 7 9.77071
D2 4 5 MD1
* Default values used in MD1:
* RS=0 EG=1.11 XTI=3.0 TT=0
* BV=infinite IBV=1mA
..MODEL MD1 D IS=1e-32 N=50
+CJO=7.50724e-10 VJ=0.801667 M=0.67327 FC=1e-08
D3 0 5 MD2
* Default values used in MD2:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* BV=infinite IBV=1mA
..MODEL MD2 D IS=1e-10 N=0.401518 RS=3e-06
RL 5 10 1
FI2 7 9 VFI2 -1
VFI2 4 0 0
EV16 10 0 9 7 1
CAP 11 10 7.50724e-10
FI1 7 9 VFI1 -1
VFI1 11 6 0
RCAP 6 10 1
D4 0 6 MD3
* Default values used in MD3:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* RS=0 BV=infinite IBV=1mA
..MODEL MD3 D IS=1e-10 N=0.401518
..ENDS

..SUBCKT irf540 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 Apr 24, 96
* 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 NMOS LEVEL=1 IS=1e-32
+VTO=3.56362 LAMBDA=0.00291031 KP=25.0081
+CGSO=1.60584e-05 CGDO=4.25919e-07
RS 8 3 0.0317085
D1 3 1 MD
..MODEL MD D IS=1.02194e-10 RS=0.00968022 N=1.21527 BV=100
+IBV=0.00025 EG=1.2 XTI=3.03885 TT=1e-07
+CJO=1.81859e-09 VJ=1.1279 M=0.449161 FC=0.5
RDS 3 1 4e+06
RD 9 1 0.0135649
RG 2 7 5.11362
D2 4 5 MD1
* Default values used in MD1:
* RS=0 EG=1.11 XTI=3.0 TT=0
* BV=infinite IBV=1mA
..MODEL MD1 D IS=1e-32 N=50
+CJO=2.49697e-09 VJ=0.5 M=0.9 FC=1e-08
D3 0 5 MD2
* Default values used in MD2:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* BV=infinite IBV=1mA
..MODEL MD2 D IS=1e-10 N=0.4 RS=3e-06
RL 5 10 1
FI2 7 9 VFI2 -1
VFI2 4 0 0
EV16 10 0 9 7 1
CAP 11 10 2.49697e-09
FI1 7 9 VFI1 -1
VFI1 11 6 0
RCAP 6 10 1
D4 0 6 MD3
* Default values used in MD3:
* EG=1.11 XTI=3.0 TT=0 CJO=0
* RS=0 BV=infinite IBV=1mA
..MODEL MD3 D IS=1e-10 N=0.4
..ENDS
 
Top