Helpfull tip: Import new model for LTSpice

Discussion in 'Electronics Resources' started by FuzzballJack, Apr 22, 2014.

  1. FuzzballJack

    Thread Starter New Member

    Apr 12, 2014
    13
    3
    As a beginner in LTSpiceVI I have had a lot of problems implementing a new model into the simulator.
    I will be going over the cause of my problem in this thread. This is only for inexperienced LTSpice users. I hope to help fellow LTSpice starters so they don't struggle with the same problem I had.

    ~~~~~~~

    So you just installed LTSpice, ready to begin cranking out some simulations but can't find the model for a component? Let's say you need a UA741 General purpose Op-amp.

    You go on-line and find the model for it. It is usually some text file with a whole bunch of code (gibberish for newb spicers).

    For example LM741: jeastham.blogspot.be/2009/10/adding-lm741-op-amp-model-to-ltspice.html

    Then you slam that puppy into spice like it is shown on the forum you got the code from. Finally sit back and press that "run simulation"-button like a boss and get startled by a strange error.

    Code ( (Unknown Language)):
    1. Unknown subcircuit called in: ...
    ~~~~~~~

    This has been a pain for me from the start. Ever since I started using LTSpice I have had this problem and not a single forum that could point me in the right direction.
    But now I found what the problem is!

    All the steps you need to complete:

    1. Find the model code online for the item you want to model.
    2. Save the code in the folder LTspiceIV\lib\sub as a .lib file
    3. Include the lib directive in your drawing (press the .op button in Spice) through ".lib <lib-name-you-saved>"
    4. Add a comparable component's footprint in your drawing
    5. Change the value of the component to the name of the component you just added
    Now, step 5 is where I have made some errors.
    Remember the .lib file you added to the spice lib folder? Open it with notepad. Search for a line that starts with

    Code ( (Unknown Language)):
    1. ..SUBCKT
    and ends with some numbers. The value between the ..SUBCKT and the numbers is the value for your component you want.

    To conclude:

    • The filename of the .lib file is the one you need to import in the drawing
    • The partname you find inside the file is the name you need for the part value.

    For example:

    • I needed to import ".lib LM741.lib" because my file was named "LM741.lib"
    • And I needed to rename the value of the component to "XUA741" because the partname inside the file was "XUA741"

    Or you can name the 2 exactly the same if you are smart to make things easier.
    Hope I helped! ;)

    Fuzz.
     
    djsfantasi likes this.
Loading...