LTspice: Association of 3'rd party models with existing symbols?

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Kind friends:

While I'm familiar with the 'common' method of 3'rd party component addition (i.e. model importation and automatic symbol generation) -- said auto-generated symbols, in addition to sorely wanting in the ways of 'atheistic appeal', are (with few and 'accidental' exceptions) with non-standard application to the modeled component type --- Nor am I a graphic artist with hours to 'burn' drafting an appropriate symbol...:rolleyes:

Hence my question:

How might one associate existing symbol files with imported component models (.sub, etc...) to, in effect, add appropriately symbolized components to Spice's library ?

As a practical example:

I wish to 'add' the TL072 to LTspice XVII's library via importation of "TL072.sub" (attached to this post) BUT associate same with "opamp2.asy" (likewise attached to this post) such that a working model of the TL072, symbolized by LTspice's 'Opamp2' is available in the components library (e.g. "Opamps", "Auto Generated", etc...)

HOW?:confused:

(For whatever it's worth -- I comprehend the structure of sub-circuit models including the necessity of compliance with lead-numbering/ordering conventions as regards symbol association...)

Please be advised that I've veritably 'Googled' this matter to death'!:rolleyes: -- The results invariably leading to one of two unsatisfactory 'extremes' -- To wit: Meandering, uninformative YouTube videos offered, I can but imagine, by and for the benefit of the illiterate ---TO--- genuinely well presented lectures or documents but comprehensible only to 'students' already conversant with spice...

Many sincere thanks for any assistance, insight or constructive commentary!

Very best regards
HP:)

PS
About the attachments

"TL072.sub"
An acceptable - albeit a tad crude - model of a single unit of the TL072 dual operational amplifier.

opamp2.asy
LTspice's generic 'Opamp block+rail connections' symbol.
 

Attachments

ElectricSpidey

Joined Dec 2, 2017
2,754
Two ways, but I’m not positive about them.

Place a directive in the sim “.lib TL072.sub”
Open the symbol file save it with another name, then open the properties and associate it with the sub file.

Please don't kill me if I'm wrong.

EDIT:
Oh yea, I forgot…to use the Spice directive you must change the name of the Op-Amp to LT072 (its name in the sub file)

Bordodynov reminded me with his post.
 
Last edited:

Bordodynov

Joined May 20, 2015
3,174
It's simple with this operating amplifier. Put the Opamp2 symbol in the circuit diagram. Use the mouse to open the symbol and enter the name (the one after ".subckt") in the name field. And you can not go in, but click on the name opamp2 and replace it with the name of your model. The model file should be in the same place as the schema (in the same folder). In the scheme field, type (using the letter S) :
.lib File_name_with_model. Name with extension! There are many other ways, but that's enough to start with.
 

crutschow

Joined Mar 14, 2008
34,201
Here's what I've done, (if you want it to show as part of the standard Opamps library parts list).
Open any op amp symbol file with the same number of pins as your model.
Edit the Attributes to include the name of the new .sub/.lib file, as well as the Value names (in your case TL042.sub and TL042).
Change the description as desired.
Right-click on the symbol pins and check to make sure the pin order in the symbol matches the pin order in the model.
(Note that the pin order number may not be the same as the model node number. The pin order is always left to right in the model, irrespective of the actual model node numbers.
For example the model nodes may be listed as "3 9 8 5" in the .subckt first line, which would correspond to symbol pin numbers "1 2 3 4".)
Save As your new symbol name (TL042.asy).
Then it should show up in your Opamps library after shutting down and reopening LTspice.

upload_2019-9-11_9-9-56.png

upload_2019-9-11_9-0-41.png upload_2019-9-11_9-9-13.png

upload_2019-9-11_11-8-57.png
 
Last edited:

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Many thanks for the replies and assistance!:)

@crutschow
I'm attempting your suggestion first for its direct, intuitive, and, hence, 'Spice-newbie-friendly' nature!:cool:

All went well until I attempted a 'test-run' of the added device (via a 'bare-bones' follower arrangement) -- Please see the error message in the screen capture below --- Thus it seems my difficulty is upshot of a 'path problem'? -- Please advise as to the correct folder location of the ".sub" file at attribution and/or simulation time... Otherwise please 'introduce' me to the errors of my ways:oops:

Best regards -- and again many thanks all around!:)

PS
Please don't kill me if I'm wrong.
Although I may 'look the part'o_O -- and quite despite @Aleph(0)'s drollery - I assure you I've nothing to do with La Cosa Nostra , nor its ilk! -- Heck! I don't even like garlic!:eek::D

SpiceTroubles.png
 

crutschow

Joined Mar 14, 2008
34,201
The .sub file should be put in the lib\sub folder.
Is that where you have it?

If so, then post a screen-grab of the Symbol Attribute Editor window for the TL072.
I've frequently seen that error due to a typo in that listing.

Edit: Oops, I see it might be my typo.
I said to name it TL042 when it should be TL072. :oops:
 
Last edited:

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Edit: Oops, I see it might be my typo.
I said to name it TL042 when it should be TL072. :oops:
No problems! -- I saw through that:)

The .sub file should be put in the lib\sub folder.
Is that where you have it?
Correct...

If so, then post a screen-grab of the Symbol Attribute Editor window for the TL072.
Please note:
-I verified that '0' in TL072 is correctly entered as the 'zero character' in all cases...

-I specified the full path to the .sub file (in the 'Spice Model' field) such that no ambiguity might exist.
-The 'PIN/Port' analysis correctly 'jibes' with TL072.sub
(Post continued below image)
TL072_Attrib.png

Here's 'proof' that the '.sub' was, in fact, saved to the correct folder:
(Post continued below image)
VerifiedOnFile.png

And again, the error report -- This time explicitly referencing the TL072.sub file's location yet denying its presence:confused:
(Post continued below image)
ErrorAgain.png


Many, many thanks for your patience and continued assistance! Please know that such is much appreciated!:)

Best regards
HP
 

tsan

Joined Sep 6, 2014
138
Here's 'proof' that the '.sub' was, in fact, saved to the correct folder:
I think, that LTSpice XVII started to use folders on the user\Documents\... for model files. For example in this instruction

https://uspas.fnal.gov/materials/17NIU/LTspiceXVII Installation.pdf

"The Working Directory LTspice also creates a copy of the above two subdirectories in the user space C:\Users\username\My Documents\LTspiceXVII. This latter location is where LTspice looks for the files it will use in building the schematics and simulations"
 

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Hello @tsan --- Thanks for your reply!:)

I think, that LTSpice XVII started to use folders on the user\Documents\...
But then LTspice seems to have 'taken care of that' automatically -- and, sadly (if predictably), to no avail!:confused:

SubLocs.png

Best regards and, again, thanks for your input!:)
HP
 

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Thanks, Guys! --- Will check it out when I get a chance (this afternoon/evening)!:)

FWIW it seems my difficulties in this matter owe to my ignorance as regards proper use of the ".inc" and/or ".lib" directives?...:oops:

Back atcha latter on!:cool: -- Many, many thanks!:)
HP
 

djsfantasi

Joined Apr 11, 2010
9,155
Did you download any of these files directly? I.e. not as part of a .zip file?

If you right click on the file in question, do you see a warning re: the file was downloaded from a non-trusted site? (Or something similar).

Recent Windows releases require manual acknowledgement of downloaded files before they can be opened in an application. They will appear in folder listings however.

If the .sub file is locked, LTSpice won’t be able to open it, resulting in the behavior you see.
 

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Also, have you tried just having TL072.sub in the symbol file SpiceModel line without the path.
Yes indeed -- I attempted specification of the full path only after the filename alone didn't work (for me)...

Did you download any of these files directly? I.e. not as part of a .zip file?

If you right click on the file in question, do you see a warning re: the file was downloaded from a non-trusted site? (Or something similar).

Recent Windows releases require manual acknowledgement of downloaded files before they can be opened in an application. They will appear in folder listings however.

If the .sub file is locked, LTSpice won’t be able to open it, resulting in the behavior you see.
Indeed -- I 'unlocked' the file immediately following download (prior to my initial examination of same via a text editor)...

On a (somewhat) related 'note', I make a point of running LTspice: "As Administrator".

FWIW the OS installed on this device is 'Windows 7 Ultimate' (x64).

You shouldn't need a path as long as the file is in one of the search paths set in control panel.
Indeed -- I begin to think my inept 'dabbling' has left this LTspice installation's paths (and, perhaps, other settings) in a state of intractable disarray:(:oops: -- So... It seems that my best 'next move' is a clean re-install of LTspiceXVII such that we may begin with a 'known state', as it were...:cool:

As an aside, I find it odd (and, perhaps, 'diagnostic'?) that the 'automatic' method of adding components/sub-circuits works flawlessly:confused: -- But then I simply cannot abide those generic 'wrappers'!:eek:

In the meantime (i.e. pending my re-installation of LTspice this weekend) please continue/feel free to post any suggestions and/or ideas here --- Talk atcha y'all next week!:cool:

With profound gratitude
HP:)
 

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Talk atcha y'all next week!:cool:
About that:oops: -- Seems I'm the 'impatient type' (who would have thought simulators could be addictive?);):)

So... Following a (clean, clean, clean!) uninstall/reinstall of LTspiceXVII followed by placement of the TL072.sub file in both LTspice's library and user directories, I find that @tsan's approach works like the proverbial 'charm' (as may be seen below):cool:

All of which leaves but a brace of questions:

1) Why doesn't the 'standard approach' work in this case? (I might assume such owes to disparity between LTspice versions? Still... I shouldn't think V17 would be a downgrade from V4!:eek::confused:)

2) How might I add this working TL072 to the component menu (e.g. the OpAmp library) such that it is a 'selectable' device?


Any ideas --even 'wild guesses'-- will be greatly appreciated!:cool:

Very best regards - and, as always, many sincere thanks!
HP:)


TL072_TestFixture.png
 

crutschow

Joined Mar 14, 2008
34,201
Any ideas --even 'wild guesses'-- will be greatly appreciated!
Okay, I installed the TL072 in my LTspice XVII and did find why you are likely having a problem, as I initially had the same problem.
(My previous instructions only worked with the LTspice IV version.)
The .asy and .sub files need to be in the folder it's looking in.
In my case, as shown below, it's looking under my Documents folder (sym and sub folders).
Where is yours looking?

As you can see, after I put them in my Documents folder, it now finds the .sub file and simulates properly.

Sorry for the confusion. :oops:

upload_2019-9-13_13-57-52.png

upload_2019-9-13_13-54-55.png
 

Thread Starter

Hypatia's Protege

Joined Mar 1, 2015
3,228
Okay, I installed the TL072 in my LTspice XVII and did find why you are likely having a problem, as I initially had the same problem.
(My previous instructions only worked with the LTspice IV version.)
The .asy and .sub files need to be in the folder it's looking in.
In my case, as shown below, it's looking under my Documents folder (sym and sub folders).
Where is yours looking?

As you can see, after I put them in my Documents folder, it now finds the .sub file and simulates properly.

Sorry for the confusion. :oops:

View attachment 186119

View attachment 186118
I dunno -- It seems I'm 'LTspice cursed':(

I've tried it on 'fresh installs' on two devices now -- and with the selfsame result...

Please note that, at this point, 'path issues' seem rather unlikely inasmuch as the default save location (Re: TL072.asy) was to the appropriate sub-directory of 'My Documents' (as shown below).
FWIW I placed TL072.sub in the appropriate directory (likewise shown below) prior to 'adding' said new component...

Sorry for the confusion. :oops:
On the contrary! Thank you! For your continued patience and assistance! -- Please accept my apologies! -- Clearly - I'm guilty of some oversight 'too obvious to be obvious', as it were:oops::confused:

Very best regards
HP

LTspiceFail.png
 
Top