# LTSPICE Undefined Subcircuit Error

#### Seang

Joined May 21, 2020
14
I'm using a spice model for the transistor component "ATF-34xxx", which can be accessed here:

http://www.hp.woodshot.com/hprfhelp/design/SPICE/fets.htm#ATF34

I created a new symbol with the code from the above page and get this error... does anyone know what is wrong? I'm not adept with spice so I really don't know what can be wrong... thanks in advance!

#### Attachments

• 2 KB Views: 2
• 2 KB Views: 4
• 37.4 KB Views: 12

#### Papabravo

Joined Feb 24, 2006
15,518
Inside the definition for the symbol there is the name of a file with the root "batf34143" with some extension. It is looking in the default directories and cannot find this file.

#### Seang

Joined May 21, 2020
14
Inside the definition for the symbol there is the name of a file with the root "batf34143" with some extension. It is looking in the default directories and cannot find this file.
What can I do to allow it to find this file? I named the file "batf34143", but does that mean it cannot find it for some reason?

#### Papabravo

Joined Feb 24, 2006
15,518
What can I do to allow it to find this file? I named the file "batf34143", but does that mean it cannot find it for some reason?
LTspice has directories that it searches in addition to the directory that the .asc file is located in. Under Tools>Control Panel you can add additional paths. Print out the .asy file for the symbol to see if there is an explicit path in there.

You can also paste the subcircuit into the .asc file

Last edited:

#### Seang

Joined May 21, 2020
14
LTspice has directories that it searches in addition to the directory that the .asc file is located in. Under Tools>Control Panel you can add additional paths. Print out the .asy file for the symbol to see if there is an explicit path in there.
I see... if I import the following code into ltspice:

and create a new symbol from it, and import the symbol into the schematic, does it still have to reference the root file? Is there a mistake in this process? Thanks for the help.

#### Papabravo

Joined Feb 24, 2006
15,518
I see... if I import the following code into ltspice:
View attachment 207879
and create a new symbol from it, and import the symbol into the schematic, does it still have to reference the root file? Is there a mistake in this process? Thanks for the help.
I think so. Normally the symbol would reference a file name such as the following
Code:
Version 4
SymbolType CELL
LINE Normal -32 32 32 64
LINE Normal -32 96 32 64
LINE Normal -32 32 -32 96
LINE Normal -28 48 -20 48
LINE Normal -28 80 -20 80
LINE Normal -24 84 -24 76
LINE Normal 0 32 0 48
LINE Normal 0 96 0 80
LINE Normal 4 44 12 44
LINE Normal 8 40 8 48
LINE Normal 4 84 12 84
WINDOW 0 16 32 Left 2
WINDOW 3 16 96 Left 2
SYMATTR Value LMC6484A
SYMATTR Prefix X
SYMATTR Description CMOS Opamp
SYMATTR SpiceModel LMC6484A.MOD
SYMATTR Value2 LMC6484A/NS
PIN -32 80 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 1
PIN -32 48 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN 0 32 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 3
PIN 0 96 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4
PIN 32 64 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5
Notice the line beginning with SYMATTR that gives the name of the file

The XDIE primitive is the line with the problem. It is looking for a file named BATF34143

#### Seang

Joined May 21, 2020
14
Got you... I imported the .mod file into the LTSpice directory and the new error is "Could not open library file:" and then points back to the folder in which the .mod file used to be before I moved it... does this mean that LTSpice knows where to find the file? If so, then is the code the problem?

#### Papabravo

Joined Feb 24, 2006
15,518
Got you... I imported the .mod file into the LTSpice directory and the new error is "Could not open library file:" and then points back to the folder in which the .mod file used to be before I moved it... does this mean that LTSpice knows where to find the file? If so, then is the code the problem?
Are you using a windows machine?

#### Seang

Joined May 21, 2020
14
Are you using a windows machine?
Yep, by the way thanks for your insight thus far!

#### Bordodynov

Joined May 20, 2015
2,803
My model collection has this transistor. Moreover, I had a copy of this transistor and I made a model specification.
http://bordodynov.ltwiki.org/

#### Papabravo

Joined Feb 24, 2006
15,518
On a new schematic, when you go to place a component, you get a sub window titled: "Select Component Symbol"
Right under that title bar is a drop down labeled "Top Directory"
On my machine the path is: C:\Users\$AccountName$\Documents\LTspiceXVII\lib\sym
The actual files for components are in: C:\Users\$AccountName$\Documents\LTspiceXVII\lib\cmp
The actual files for subcircuits are in C:\Users\$AccountName$\Documents\LTspiceXVII\lib\sub

You can add to the list of paths to search by going to Tools>Control Panel>Sym & Lib Search Paths

#### Seang

Joined May 21, 2020
14
My model collection has this transistor. Moreover, I had a copy of this transistor and I made a model specification.
http://bordodynov.ltwiki.org/
View attachment 207938
I see, thanks for your reply... I downloaded your collection, and I can't find the exact folder you reference in the above folder. I have attached a picture of the subfolders within the ZZZ folder and I cannot find RF. Do you know where I have gone wrong?

#### Bordodynov

Joined May 20, 2015
2,803
I don't know what you did (you may have a very old version). I checked the lib.zip file that I recently reloaded and there was the RF folder.
And here's what I have on my computer:

#### Seang

Joined May 21, 2020
14
I don't know what you did (you may have a very old version). I checked the lib.zip file that I recently reloaded and there was the RF folder.
And here's what I have on my computer:
View attachment 207942
I messed around with the directories and I believe I got it to work... and I import the transistor into my workspace, but now since I changed the libraries I had to reconstruct the circuit, and it won't let me add elements like resistors, capacitors, etc. I believe the switching of the lib & examples folders that tinkered with the software, is there another way to input these elements from the components list from your library?

I also tried to bring my original lib & examples folders back and taking the transistor element I want from your library and putting it into the original "sym" folder inside library and import the transistor like that, but when I try to run the simulation it gives me the error "Could not open Lib file: "Sborka.lib"".

The second attempt seems much less likely to work, but in regards to the first, how can I go about adding components like resistors and capacitors with your collection? Thanks.

#### Bordodynov

Joined May 20, 2015
2,803
My web page says where my library is put. It is put all at once and do not have to uproot individual models. But if you don't want it, it's your decision and suffer.

#### Seang

Joined May 21, 2020
14
My web page says where my library is put. It is put all at once and do not have to uproot individual models. But if you don't want it, it's your decision and suffer.
How can I get access to components like resistors and capacitors with your library? The normal buttons to add them doesn't work, are they in specific folders of your collection?

#### Bordodynov

Joined May 20, 2015
2,803
My library is a supplement to branded libraries and there was no need to add resistors and capacitors. Although there is a folder with parasitic resistors in it. And you will notice the menu at the top. There are resistors, capacitors and inductors. And there's also keyboard shortcuts.

#### Seang

Joined May 21, 2020
14
My library is a supplement to branded libraries and there was no need to add resistors and capacitors. Although there is a folder with parasitic resistors in it. And you will notice the menu at the top. There are resistors, capacitors and inductors. And there's also keyboard shortcuts.
Since I could not find where the voltage sources are I used the ammeter component and gave it the corresponding specifications. I've rebuilt the circuit using the parasitic components acting as resistors and capacitors as you mentioned (attached photo) and get no results when running simulation.

with regards to why the simulation isn't running properly, at first glance, what raises red flags about my process to you?

#### Attachments

• 12 KB Views: 11

#### test4

Joined Mar 14, 2019
7

Last edited: