Help adding part to LTspice library.

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
Hopeing some of you Spice experts can help a total newbie to LTSpice :)

I'm stuck on how to import models into the library despite reading the help files, and searching these forums and googling.

Here's what I am trying to do if this is possible. I want to import the Spice models that Bob Cordell has on his audio site such that those parts are available to use on any simulation.

So I have tried to add them to the library by adding just one device to the appropriate file but find I can not then save the file, I get in loop.

I am following this method (section H),
LTspice Tutorial

by going to the library and adding a new .model line.

Nothing I try lets me save the file. Whether that is an operating system specific issue I don't know. I'm running Vista.
(Even I just alter a single character in a library file as a test it (Vista ?) stops me closing the altered document)


How do I do this ?

Is there a different or better way.

And please don't assume any knowledge whatsoever on my part on this.

:)
 

Attachments

  • Capture.JPG
    Capture.JPG
    42.9 KB · Views: 720

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
Might be getting somewhere... been 2 days on this !

I've changed permisions for the library folders and can now save to them. Yay :)

The transistors I added to the "mosfet" file now show correctly but all the data on the initial selection is showing zero... which seems to be because that data isn't included in the original file I pasted in.

The libraries and importing models is thus far the most difficult aspect up to now for me...
 

Attachments

  • Capture2.JPG
    Capture2.JPG
    94.9 KB · Views: 695

klewis

Member
2007-09-05 10:51 pm
Might be getting somewhere... been 2 days on this !

I've changed permisions for the library folders and can now save to them. Yay :)

The transistors I added to the "mosfet" file now show correctly but all the data on the initial selection is showing zero... which seems to be because that data isn't included in the original file I pasted in.

The libraries and importing models is thus far the most difficult aspect up to now for me...

Hi mooly,
Have you tried to use the models you put in the library? I seem to remember that they will work even though the atributes don't show up. You can also open one of the standard models using the open with notepad comand while in windows explorer to look at the syntax and compare it to Bob's models.
Ken
 

jcx

Member
2003-02-17 7:38 pm
..
you should be able to just put Bob's file in the same directory as your .asc, add an .include statement:

.include Cordell Models.txt

even more primitive is to just put the device models in your schematic - but most portable


modifying the Ltspice model folders isn't recommended - you will have problems sharing your asc with anyone else
or on another installation of LTspice
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
Thanks Ken, yes, the models all seem to work OK. I might try as you suggest and alter and add to the form of one of them to get the details to show. If I just try one I can always undo it easily if anything goes amiss

I know I'm going to have many more questions as I get more into it all. In fact I have two now (on FFT run) but I'll see if I can figure it out a little first :)
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
Hi jcx,
honestly, until I added the models to the library I was getting nowhere.

This probably sounds really dumb but even with all the resources on the web I find a lot of the basic knowledge is assumed. Like saying "add the model to the .asc file". When you first open Spice (as in first ever time seeing it :)) I didn't know what a .asc file was or where it lived :)

What you describe makes a lot more sense now than it did 72 hours ago.

See what you mean about the models added to the library only being local to my PC so if I posted or emailed a circuit it would be no good to anyone else.
 

wintermute

Administrator
Paid Member
2003-08-03 11:43 am
Sydney
Hi Mooly I was doing the same (adding to my library files) but portability is definitely an issue. I now have an extras.sub file which I include. Any new models that I might need go in there. you can also save any asy files in the current directory (sometimes a new component needs an asy file to go with it.

Then if you want to share your creation, just zip up the entire folder (remove any .raw or .fft files first) and bobs your uncle :)

Windows7 is particularly insidious with LTSpice and saving stuff in the program files directory, it says it saved it, but it saves a copy somewhere else, but you can't see it. drove me around the bend for a while!!

Tony.
 

jcx

Member
2003-02-17 7:38 pm
..
I have a folder in my user Documents folder for sims - navigate to your Documents folder and "save as" the 1st time you save a new schematic in Ltspice, then everything lives "in the open" on Vista, you can add any "extras" .sym, .sub files there too
 
I usually do as jcx suggested, just put the models into a text file in the same directory as your schematic is saved in, then add a "spice directive" (keyboard shortcut 's') with ".include yourfile.txt" no quotes. Then you can simply add that component. Press 'F2' (add component), select your file that you .included as above ("Top Directory" dropbox), and you can pick any component in your files.

When/if you distribute your schematic, you can just include your extra component files also.

If you add components to the standard libraries, you will likely lose them when LTSpice periodicially updates itself.
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
Thanks folks.
Such a lot to try, and such a lot to get my head around. It's starting to make a bit more sense as I go on.

The examples on Bob Cordells site (that go with his book) I see include the same .txt file of his own models.

So I'll give that all a try quite soon.
 

wintermute

Administrator
Paid Member
2003-08-03 11:43 am
Sydney
I haven't had a chance to read my cordel book yet. I had a quick look at the spice chapter last night, very interesting :) I couldn't see any mention of Bob's site though in skimming through it. Is it mentioned over in the thread on the book?

I'm having fun with my active crossover at the moment. I was sure I had it so that the distortion on the high pass was only going up a little bit at higher frequencies such as 20K but now it is giving me an order of magnitude higher, banging my head trying to work out what I changed to cause it.

Tony.
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
Hi Tony,
It must be somewhere because that is how I found it (I think lol).

It's here,
CordellAudio.com - Home

Think I have finally figured adding models to the circuit using all the info everyone has given... thanks again folks.

It's the little things that aren't obvious. Various texts mention adding a BC847 (or whatever) and I'm thinking WHY ??? Nowhere does it say right click the new device type on the circuit and THEN type the number of your new model that is in the list. I thought I could see them all and pick them from a list :)

Think I have finally figured this bit of the puzzle.
 

wintermute

Administrator
Paid Member
2003-08-03 11:43 am
Sydney
Thanks Mooly I'll have to check it out. good models are hard to come by. The chapter on spice models looks very helpful too! wish I'd looked at it sooner :) I'm going to have to see what you mean about right clicking as well, I've had some trouble getting stuff into my sims if it isn't in the standard libraries, I normally browse to the directory and open it from there.

Tony.
 

wintermute

Administrator
Paid Member
2003-08-03 11:43 am
Sydney
I think the latest (or some previous) update to ltspice broke mine :xeye: I just got the LSK389C model from bob's site and tried to add it and my add component has the folder navigation button greyed out. I can't select anything other than directories I had previously navigated to... weird. I had to open the asc in notepad and change the 2sk170 to lsk389c to get it into my schematic...

I think there is something wrong with my sims. I'm simulating a very simple DCB1 at the moment and get high distortion at 10Khz 0.002% at 1Khz it is much lower, around 0.0003% Nelsons AP results for the original B1 were dead flat across the audio band so something is amiss. I'll have to dig up the model of the original B1 and see what that comes out at.

Tony.
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
After having had a major play around for the last few days I've saved my work and rolled back (using Acronis True Image) to just before I started altering things in the program files.

Going to do as was suggested and keep all my work in the normal "docs" folders etc.

Lol, I'm the last person to ask on all this.
"I just got the LSK389C model from bob's site and tried to add it and my add component has the folder navigation button greyed out.

I'm going to try now and use the include statement to use Bobs models on my sim (which I seemed to get the hang of yesterday eventually)... and then I have more questions :)
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
That's gone surprisingly well.

Something I have noticed and how Vista specific all this is I don't know.

Anyhow, I had the desktop shortcut to run LTSpice in "admin" mode because not doing so causes proplems with syncing and updating. As per Bobs recommendation I set .raw files to be automatically deleted. No problem there, however when saving and running sims from "docs" folder rather than within the program files, LTSpice opens without admin priviledges...something to be aware of. Also the setting for deleting .raw files has to be entered again for this "non admin" mode of opening LTSpice.
 
That's gone surprisingly well.

Something I have noticed and how Vista specific all this is I don't know.

Anyhow, I had the desktop shortcut to run LTSpice in "admin" mode because not doing so causes proplems with syncing and updating. As per Bobs recommendation I set .raw files to be automatically deleted. No problem there, however when saving and running sims from "docs" folder rather than within the program files, LTSpice opens without admin priviledges...something to be aware of. Also the setting for deleting .raw files has to be entered again for this "non admin" mode of opening LTSpice.

You only changed the shortcut to open LTSpice with admin privileges. Find the actual .exe file in Program Files (scad3.exe), and change it to open as admin. I have the same problem on Win7.