Installing and using LTspice IV (now including LTXVII), From beginner to advanced

Mooly,

Perhaps I did not understand something right, or LTspice has been changed so aditional spice models cannot be added anymore...

I tried 3 methods:
- include file
- spice directive
- added to the standard.bjt library.

In neither of the three methods I'm able to select the model I've added (2N2955). It is not in the list (standard.bjt), nor can I manually change the reference to the transistor. My LTspice version is 4.21q.

HELP, please!!!
Could it be that a 2N2955 is a PNP, not a NPN as defined in your model?
Therefore if you try to change by right click Q1 (D45H11) which is a PNP symbol, only PNP transistors will be in the list.
;)
 
Last edited:
Could it be that a 2N2955 is a PNP, not a NPN as defined in your model?
Therefore if you try to change by right click Q1 (D45H11) which is a PNP symbol, only PNP transistors will be in the list.
;)
2N2955 is indeed PNP. I tried to find it as a PNP in vain... after this episode I found out that the 2N2955 is in the standard library file, but faulty noted as a NPN with lacking Vceo and Ic parameters. resp. 60(V) and 15000m (A) which I changed in the library and now it works perfectly...
 
I checked with LT about the contents of standard.bjt. according to them the 2n2955 is not in the lib (must have put it there myself :confused: )

They also told me that models added to standard.bjt (or any other library) are not overwritten by updates. Updates are only added to the libraries...

So, if one never shares his designs, adding to the library files is safe.
 
I had my changes to the standard libs lost during updates and stopped using this method. Looking at my files it seems I stopped in 2006 and starting using the .include method. While LTSpice may have changed it's behaviour since then, I suggest you keep some backups of your models.

Jim
 
. . . They also told me that models added to standard.bjt (or any other library) are not overwritten by updates. Updates are only added to the libraries...
This statement does not completely agree with behavior I observed in the past. (I investigated this with actual test cases about a year ago.)

The statement is true if you are talking about adding models which are not defined in the "stock" libraries supplied directly by Linear Technology in the LTSpice download. Add as many model definitions as you like - the update process will not change or delete them.

But if you try to replace one of the models in the "stock" libraries, it will be overwritten and revert back to the model supplied by Linear Technology at the next update.

For example, suppose I find a model for, say, a 2N3904 which is "better" than the LT-supplied model for a 2N3904. I can edit the "standard.bjt" file and replace the LT-supplied model definition with the parameters for this "improved" model, and all of my simulations will use the "improved" model. But when I update LTSpice, my "improved" model WILL be overwritten by the model defined in the "standard.bjt" file supplied in the LTSpice download. If I want to keep the "improved" model I must name it something other than "2N3904" - such as "2N3904_Improved", or "2N3904_Bob_Cordell".

If * * I * * ran this zoo . . . the component libraries in the "cmp" folder (i.e., "standard.bjt", "standard.jft", "standard.cap", etc) could be extended and enhanced using the existing filename extension scheme. So in addition to the "standard.bjt", etc, files, the "cmp" folder might have a set of files called, for example, "user.bjt", "user.jft", "user.cap", etc, to hold my personal device models; another set of files (in the "cmp" directory) might be called "Fairchild.bjt", "Fairchild.jft", "Fairchild.dio", for device models from that particular manufacturer; another set of files (in the "cmp" directory) might be called "Worst_case.bjt", "Worst_case.jft", "Worst_case.dio", for models reflecting devices at the low end of the datasheet performance; etc. Under this scheme the "Pick a New . . . " dialog windows would give you a choice of which library file to select a model from.

And while I was at it . . . I'd include a selection in the "File" or "Tools" drop-down menus allowing the user to "Export Model Data". This feature would create a file containing all of the model definitions used by the simulation file. (It may be helpful to retain the same base filename - i.e., if the circuit file was called "My_Circuit.asc", the exported model file might be called "My_Circuit.lib".) Then, when you shared a simulation, you would pass along the file of exported models as well as the circuit file.

Dale
 
Last edited:
Administrator
Joined 2007
Paid Member
Useful info and experiences there Dale, thanks for the insight.

And I think having a zillion devices to choose from when you right click a device could be messy to navigate through (if you add them to the libraries). You would need a list of what you actually put in there so you could just type the device number onto the part rather than having to search I think.
 
And I think having a zillion devices to choose from when you right click a device could be messy to navigate through (if you add them to the libraries) . . . .
No "could be" about it - my "standard.bjt" library is unwieldy. That's why I wish we could extend the "standard.*" library structure in some organized manner. The ability to right-click, then select a device is much easier than going into the component's "Properties" table (<ctrl><rt-click>) and entering the path to some model file or library file.

The "standard.*" libraries DO recognize comments delimited by the " ; " character. This lets you store at least a little information about a particular model. For example, one of the lines in my "standard.bjt" is:
.MODEL 2N3906C PNP(IS=10e-15 BF=180 VAF=40 IKF=0.6 ISE=30e-15 NE=1.5 NF=1 RB=33 RC=1 RE=0.1 CJE=12e-12 MJE=0.7 VJE=1.0 CJC=12e-12 MJC=0.7 VJC=1.0 FC=0.5 TF=550e-12 XTF=20000 VTF=10 ITF=3.5 TR=10e-9 BR=4 IKR=11 EG=1.1 XTB=1.5 XTI=3 NC=15.5 ISC=0.5e-15 VAR=100 NK=1.0 mfg=Bob_Cordell_Model Vceo=40 Icrating=0.20 ) ; TO-92 Ft 250 MHz min (Model created February 24, 2011 copyright Cordell Audio)
Note the added information about package, cutoff frequency, and source for the model. Those comments are displayed (in a green colored font) if you open the "standard.bjt" file in LTSpice, but if you want to search for a particular piece of information you must open the file in an external text editor - and you can't sort on the added info.

(Note that this model is named "2N3906C", to avoid being overwritten by:
.model 2N3906 PNP(IS=1E-14 VAF=100 BF=200 IKF=0.4 XTB=1.5 BR=4 CJC=4.5E-12 CJE=10E-12 RB=20 RC=0.1 RE=0.1 TR=250E-9 TF=350E-12 ITF=1 VTF=2 XTF=3 Vceo=40 Icrating=200m mfg=Philips)
on the next LTSpice update.)

Dale
 
Last edited:
Administrator
Joined 2007
Paid Member
That's more valuable info Dale, thanks.

As with everything LT related, it really helps to see it all with worked examples, and you showing that model and how to use the " ; " helps make it much clearer. I assume the spaces are vital... and seeing it makes all the difference compared to someone just saying use the ; to add stuff.
 
great thread Mooly, thank you very much!

three questions if you don't mind,

1) i downloaded the free version of LTspice, version 4.20i, it doesn't seem to have the hierarchical schematic function enabled. is that the way the free version is? any way of going around that limitation?

2) say i'd like to run

.op
.tran
.ac
.noise

runs on the same circuit from time to time, is there an easy way of switching between them, without editing these LTspice directives themselves?

3) the trick on attaching voltage labels by clicking the net in question after a .op run is really neat, thank you for that tip! is there a way of doing the same on current, for example labeling some Ic's and Ib's?

tks a lot for helping!
 
Last edited:
. . . I assume the spaces are vital...
No, I don't think the spaces have any effect. If I recall correctly, the original (circa 1972) SPICE program ignored < space > and < tab > characters, and LTSpice has preserved that behavior.

I think I read someplace that you and I went to different schools together, so you certainly remember how programmers would use <space> and <tab> characters - sometimes rather creatively - to improve the human-readability of program listings. That's why I embedded the ";" character between some spaces: it helps me find the information when I visually scan a text-editor display of the file.

Dale
 
Ex-Moderator
Joined 2011
Can't you setup libraries for your favorite parts by grouping them together yourself? And only use the stock libraries for the generic parts? These personal libraries do not get erased during the update either (I could be wrong on this, as I have not used LTSpice for years). Intact Audio (via Stephie Bench) has a tutorial on setting up pull-down parts menu and I recall they worked pretty well.
 
Last edited:
Administrator
Joined 2007
Paid Member
great thread Mooly, thank you very much!

Thanks :)


three questions if you don't mind,

1) i downloaded the free version of LTspice, version 4.20i, it doesn't seem to have the hierarchical schematic function enabled. is that the way the free version is? any way of going around that limitation?

If I'm honest I'm not really sure what you mean by that. I can google it and find the terms related to LT but not sure how it all applies... sorry.

2) say i'd like to run

.op
.tran
.ac
.noise

runs on the same circuit from time to time, is there an easy way of switching between them, without editing these LTspice directives themselves?

You have to set all the directives up first (as a one off on the simulation). Then its just a case of right clicking and selecting the edit simulation option and picking the test you want to run. So its only a couple of clicks to change and run any of the options.

3) the trick on attaching voltage labels by clicking the net in question after a .op run is really neat, thank you for that tip! is there a way of doing the same on current, for example labeling some Ic's and Ib's?

Not that I know of. I even had a look see but couldn't find anything on it.

Worth knowing though is that you can attach voltages dirsectly from a transient analysis run. Having run the sim just right click an empty space on the circuit and navigate to <view> and select <place .op Data Label> which allows you to place a voltage on the diagram.

But currents... I don't think so. The best you can do is just write them down and add them as a text comment on the diagram... of course they are fixed and non dynamic then.
 
But currents... I don't think so. The best you can do is just write them down and add them as a text comment on the diagram... of course they are fixed and non dynamic then.

Like this? Right-click the label and edit the item to show, in this case I(Probe1).
 

Attachments

  • LTSpce Probe SubMenu.PNG
    LTSpce Probe SubMenu.PNG
    59.6 KB · Views: 708
Administrator
Joined 2007
Paid Member
Brilliant, thank you :)

What FdW is saying is this...

1/ Attach your voltage to the point you actually want to monitor a current. Just as we have already covered before.



2/ Now right click the attached voltage label and enter I(x) where x is the component reference the current would relate to. Here we are changing the voltage on R24 to a current in that line.



3/ When attached, the currents are displayed and these do indeed change dynamically as you alter values and rerun the simulation.



That's great. Thanks again.
 
...
If I'm honest I'm not really sure what you mean by that. I can google it and find the terms related to LT but not sure how it all applies... sorry.

thank you very much for all the great help Mooly!

when some part of a circuit is repetitive and you'd like to make a block out of the repetitive part, and whenever you need it, you'd just place that block once, twice... in this circuit, or in that circuit... as necessary.

i'm seeing some of the related commands being grayed out, for example my version wouldn't let me name a block when i try create one. i also don't have any idea on how to place one. i'm not sure how LTspice works in this regard at all, just imagining things.

thank you for the step by step instruction on dynamic current labeling as well!
only that if i want a voltage label as well, i'd need to add another voltage label. but hey it works, no complaint, great help!
 
Last edited: