LTSpice Tutorial – modifying the model

Now that we’ve got a working model, let’s begin making changes.

First, let’s look at changing component values for resistors / capacitors / etc. Easy enough, just right mouse the component and you’ll get the properties window.

LTSpice, changing a component's properties

LTSpice, changing a component’s properties

Here you can manually type specific parameters such as the capacitor value and ESR or you can select from a preexisting database of specific components with the “Select Capacitor” or “Select Resistor” button. Initially you probably want to simply select preexisting components that are close to the real components you expect to use.

However, as you get closer to your final design, for critical components you’ll want to enter the specific values for the exact component you’re going to use. Get that information (if you can) from the datasheet such as this example from a specific capacitor vendor/model data sheet. For the output capacitor on the switcher, the ESR of the capacitor(s) is a critical value so pull that from the datasheet for the caps you intend to use.

LTSpice capacitor datasheet example

LTSpice capacitor datasheet example

Changing parameters for more complex components like Diodes / FETs / Transistors is both a bit more and a bit less complicated. Start the same, with a right-mouse on the component. However here, you generally don’t have the option to manually key in component values. All you can do is click the button that says “Select Diode” / “Select FET”, etc because everything is completely model driven.

So likely you’ll want to keep the Mouser / Digikey websites handy and you scroll through the list of LTSpice components. Just make sure you select LTSpice components that you can actually readily purchase. It’s a great disappointment to select some specific component, building a fully functional model, only to find out that there’s no place to purchase the critical components. So choose wisely.

The question then is what do you do when LTSpice doesn’t come with a model for what you need? For example, in my case I just could not find an output diode to my liking. The solution in this case was to find a component that I could also track down a model for.

One way is to add an LTSpice model is using as a text file. Then you use the LTSpice include directive to include the text file into your simulation like the below. The include directive is nothing special, simply place a piece of text that starts with .include followed by the name of the text file containing your model.

LTSpice - Include an external model

LTSpice – Include an external model

A model file should look something like this:

LTSpice - a new diode model

LTSpice – a new diode model

This file is actually using a diode model “D” already in LTSpice, but passing specific parameters to the model and calling it a new device “DMOD”.

Once you’ve got the test file included, simply place a similar component (a diode in this case) and Control-Right click the component to pull up the Component Attribute Editor.

LTSpice - Component attribute editor dialog

LTSpice – Component attribute editor dialog

Change the Value parameter to match the model name (DMOD in this case) which you included in your text file and run your simulation.

There are several places to look for LTSpice models for components. First, there’s an LTSpice google group. Look there, you might find someone who’s already created a model for your particular component. Second, search the component vendors web site. For example, International Rectifier has a large list of LTSpice compatible models under the Spice Model Library link.

Now you should be able to tweak your LTSpice simulation and run the simulation viewing the results using the LTSpice various reporting utilities.

The final question is, tuning the model to cover all operations conditions. In the case of this Switching Power supply, I needed to look at the way the power supply responded to varying load conditions from no load, to full load.

So that’s our next and final section, tweaking the model by varying parameters.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>