01_IntroDCAnalysis

download 01_IntroDCAnalysis

of 9

Transcript of 01_IntroDCAnalysis

  • 8/2/2019 01_IntroDCAnalysis

    1/9

    An Introduction to DC Analysis

    With LTspice IV

    University of Evansville

    July 27, 2009

    LTspice IV is a high-performance, general-purpose circuit simulation program. It was developed by Linear Technology for

    simulation of their switch mode power supplies. LTspice IV may be downloaded for free from http://www.linear.com.(The direct link to the program is http://ltspice.linear.com/software/LTspiceIV.exe). LTspice IV uses LTspice as its circuit

    simulation engine. LTspice is one of many modern derivatives of the SPICE (Simulation Program with Integrated Circuit

    Emphasis) program originally developed at UC Berkeley in the 1970s.

    In addition to LTspice IV, this tutorial assumes that you have installed the University of Evansville Simulation Library for

    LTspice IV. This library extends LTspice IV by adding symbols and models that make it easier for students with no

    previous SPICE experience to get started with LTspice IV.

    Getting Started

    The initial LTspice IV window is shown in Figure 1. There are menu and tool bars at the top of the window and an

    information bar at the bottom. After starting LTspice IV you should first create a new schematic. Until a new schematic is

    opened, very few of the icons in the tool bar are active. Once a schematic is opened, most of the icons become immediatelyavailable. (Your window should show more action icons than the window shown here. The window snapshot in Figure 1

    is of a reduced-size window.) Table 1 shows the most commonly used tool bar icons and gives a brief description of each.

    Figure 1: Initial Screen

    To open a new schematic, either click on the new schematic icon or select theNew Schematic entry from theFile menu.

    Figure 2 shows a schematic window with a background grid. The grid makes setting up schematics and aligning

    components easier and its use is recommended. Notice that most of the action icons are now active. A brief description of

    an icon will appear when the mouse cursor hovers over it. Table 1 lists the most commonly used action icons

    If the grid is not on when a new schematic is opened, this option has not been selected in the Control Panel. To bring upthe Control Panel, click the button with a hammer on it or select Tools and then Control Panel. With the Control Panel

    window opened, select theDrafting Options tab. Then check the box next to Show schematic grid points and click OK to

    have grid points on every new schematic. You can also show the grid by either selecting the Show Gridentry in the View

    menu or pressing CTRL+G on the keyboard.

    You may find the default grid spacing to be too large (schematic components will also appear to be large). Click on the

    Zoom Outicon to reduce the grid spacing.

    1 of 9

    New schematic icon

  • 8/2/2019 01_IntroDCAnalysis

    2/9

    The standard LTspice IV components can be chosen from theEditmenu, from the tool bar or from the Select Component

    Symboldialog window. The UE LTspice IV components can only be selected through the Select Component Symbol

    dialog. To access this dialog, choose the Componentitem in theEditmenu, click on the Componenticon in the tool bar

    (the AND gate), or just press function key F2. The window shown in Figure 3 should appear. Component symbols are

    organized in directories. The first directory visible in the selection area of the window should be the 0_UofEvansville

    directory. (Directories and components are in alphabetical order. A zero (0) is used as a prefix to make the UofEvansville

    component directory appear first.) Double-click on the 0_UofEvansville directory, you should then see subdirectories inthe UE library be listed in the dialog. Double click on the 00_components directory. After single-clicking on the

    resistor_ue item (symbols in the UE library have a _ue suffix so that they can be distinguished from the standardLTspice IV components) the dialog window should appear as shown in Figure 4. Components in the UE library are

    organized in directories. The basic components (resistors, capacitors, and inductors) are in the 00_components directory.

    Sources (voltage and current) in the main 01_sources directory.

    Icon Description Icon Description

    New Schematic Place Labeled Node

    Display the Control Panel Display Component Selection Dialog

    Zoom In Move Component(s)

    Zoom Out Drag Component(s)

    Start Simulation Rotate Component

    Delete Component(s) Mirror Image Component

    Duplicate Component(s) Place Text (Comment) on Schematic

    Draw Wires Place Spice Directive on Schematic

    Place Ground

    Table 1: LTspice IV Action Icons

    Figure 2: New Schematic Window with Grid

    2 of 9

    Action iconsDrop-down menus

  • 8/2/2019 01_IntroDCAnalysis

    3/9

    Click on the OK button to close the dialog. The resistor can now be placed on the schematic. When the cursor is moved

    into the schematic window, a ghost image of the resistor is shown. This image can be rotated by clicking the rotate action

    button, by selecting Rotate from the Edit menu or just by pressing CTRL+R. A mirror image can be obtained similarly (use

    CTRL+E). Click the left mouse button to add the resistor to the schematic. The UE component symbols contain a small

    triangle near one terminal (end) of the symbol that helps to determine the positive direction of current assumed by LTspice

    IV. LTspice IV assumes current is flowing into the terminal near the triangle, through the device, and then out the other

    terminal. You will usually want to orient the component (by rotations and mirror image operations) so that the positivecurrent direction assumed by LTspice IV matches that of a desired current in the circuit you are simulating. You can

    continue to place other resistors on the schematic by moving the cursor to the desired position and clicking the left mousebutton. You can exit component placement mode by right clicking the mouse or pressing theEscape (Esc) key.

    Figure 3: Component Selection Dialog Window

    Many schematic entry or drawing programs allow you to select a component by left clicking when the cursor is over the

    component. The component can then be moved to a different location. LTspice IV does not work that way. You must

    explicitly go intoMove Mode by clicking on the move icon or selectingMove from theEditmenu. You can then left-click

    on a component to select it for moving or drag out a box around several components to move them as a group. You can

    exitMove Mode by right clicking the mouse or pressing theEscape (Esc) key.

    The UE resistor has a default value of 1k. You can change the resistor value by right-clicking on the resistor symbol. A

    dialog window will appear that will allow you to enter a new value of resistance. You can also right-click on the value text(the 1k) to change the value.

    Numbers can be expressed in scientific notation or engineering suffix notation. The numbers 1000, 1e3 and 1K are

    equivalent. The suffixes shown in Table 2 are understood by LTspice IV. Suffixes are not case sensitive, so 1m and 1M

    are equivalent (and equal to 0.001). A very common mistake is to use 1M when a resistance of 1 MegaOhms is desired, but

    the notation is incorrect and actually represents 1 milliOhm. The correct notation is 1Meg. Any unrecognizedletters

    appearing after a number or suffix are ignored, so you can use 10V, 10Volts, 2mH, 5uF, etc as values. One error related to

    3 of 9

  • 8/2/2019 01_IntroDCAnalysis

    4/9

    suffix notation occurs occasionally when using capacitors. Using the notation 1F or 1Farad to represent a 1 Farad capacitor

    (a very large value of capacitance) is incorrect. This is not interpreted by LTspice IV as 1 Farad, but rather as 1 femtoFarad

    (1 x 10-15 Farads). Normally I encourage students to always specify units, but due to the femto/Farad problem (and also due

    to the fact that there is no symbol that can be used for resistance) I do not recommend that you use them with the basic

    LTspice IV schematic components (resistors, capacitors, and inductors). One last note of caution, do not use spaces

    anywhere in the value text or an error will occur during simulation.

    Figure 4: UE Library Directory Listing

    Suffix Multiplier

    T 1e12

    G 1e9

    Meg 1e6

    K 1e3

    Mil 25.4e-6

    M 1e-3

    u(or ) 1e-6n 1e-9

    p 1e-12

    f 1e-15

    Table 2: LTspice IV Multipliers

    All LTspice IV components have names. By default, resistor names begin with the letter R and are followed by a

    number. You can change the name by right-clicking on the name text. LTspice IV resistors may have any name, but

    4 of 9

  • 8/2/2019 01_IntroDCAnalysis

    5/9

    convention (and good practice) dictates that the name start with the letter R. No two resistors should have the same name

    or you will receive an error during simulation.

    Other components (capacitors, inductors, voltage and current sources, etc) are handled similarly.

    The components are connected by drawing wires. You can enterDraw Wire Mode through theEditmenu, by clicking on

    the wire icon or by pressing F3. A left mouse click will start a wire segment. A second left click will mark the end of onesegment and the beginning of a new one. Right click on the schematic or press Escape to exit wire drawing mode. To

    make a connection to an existing wire, just left click on it.

    Schematic Entry

    Now that you are familiar with the basics of schematic entry, enter the DC circuit shown in Figure 5 as an LTspice IV

    schematic. This is a relatively simple circuit and is typical of those encountered in the early portion of an introductory

    circuits analysis course. We are asked to find voltages VX and VY and current IY.

    +10 V 2 mA

    1 k

    2 k

    + VX

    +V

    Y

    IY

    Figure 5: Example Circuit

    The corresponding LTspice IV schematic is shown in Figure 6. Although none of the components in the original diagram

    have names, names are required for all LTspice IV components. The V1 voltage source and the I1 current source havebeen rotated to match the voltage polarity and current direction of the sources in Figure 5. R2 has been rotated so that the

    positive current direction assumed by LTspice IV (indicated by the small triangle) matches the direction of current IY. All

    components have had their values changed to match the values in Figure 5.

    LTspice IV uses nodal analysis to calculate the voltages at all nodes in the circuit relative to a reference ground node.

    The ground node has been placed at the bottom of the circuit in the LTspice IV schematic. Since the original circuit did not

    identify any node as a reference or ground node we are free to place the ground node anywhere in the LTspice IV

    schematic. (Voltages measured relative to a ground node do depend on the location of the ground node, but voltagesmeasured between nodes, like Vx and VY, do not.) If you do not include a ground node in the LTspice IV schematic you

    will receive an error when you perform a simulation.

    The other two nodes in the schematic have been labeled A and B. (Use theLabel Neticon or press F4 to open a dialog that

    allows you to enter a node label.) LTspice IV will automatically provide labels for all nodes. Names for LTspice IV

    automatically labeled nodes are of the form N001, N002, N003, etc. You can find the name of any node by moving the

    cursor over a wire connected to the node of interest. The node name will be displayed on the left side of the information

    bar at the very bottom of the LTspice IV window. This is illustrated in Figure 6. If you look closely you can see thecursor over a wire connected to node B. In the information bar at the bottom of the window the text This is node B.

    appears. I find it convenient (and recommend) to use my own labels for all nodes of interest. By the way, the ground nodehas a label associated with it too, it is node 0.

    Running a Simulation

    Either click on the Start Simulation icon or selectRun from the Simulation menu to obtain simulation results. The dialog

    window shown in Figure 7 should then appear. (The figure shows what the window looks like after theDC op pnttab has

    been selected.) LTspice IV can perform many different types of simulation. This problem requires just a simple DC

    5 of 9

  • 8/2/2019 01_IntroDCAnalysis

    6/9

    simulation. In LTspice IV terminology this is known as aDC Operating Pointanalysis, so select theDC op pnttab and

    click the OK button.

    Figure 6: Initial Schematic

    Figure 7: LTspice IV Simulation Command Window

    6 of 9

  • 8/2/2019 01_IntroDCAnalysis

    7/9

    After clicking on the OK button you will be taken back to the schematic so that the simulation command can be placed

    directly on the schematic. After placing the simulation command on the schematic, the simulation will commence. The

    window shown in Figure 8 should appear almost immediately.

    Figure 8: Simulation Results

    Comparing Figures 5 and 6 indicates that IY is equal to I(R2) or 4 mA. VY is equal to V(B) or 8 V. VX is equal to the

    voltage from V(A) to V(B) or VX = V(A) V(B) = 2 V. (Note: LTspice IV assumes that the positive direction for current

    through a voltage source is into the positive (+) terminal, through the source, and then out the negative () terminal. The 2mA result for I(V1) shown in Figure 8 means that a +2 mA current is actually flowing in the opposite direction.)

    After closing the simulation results window and returning to the schematic window you can move the cursor over any

    component and the current through that component and the power dissipated by the component will be shown in the

    information bar at the bottom of the window. This is illustrated in Figure 9 where the cursor is hovering over R2. The text

    in the information bar indicates a 4 mA current through R2 and that 32 mW of power is being dissipated in R2. You can

    move the cursor over a node to display the node voltage in the information bar.

    Figure 9: Component Information

    7 of 9

  • 8/2/2019 01_IntroDCAnalysis

    8/9

    DC Simulations With Dependent Sources

    The circuit shown in Figure 10 has one independent voltage source and two dependent sources. The dependent source on

    the left is a current source whose current depends upon the value of voltage across the 1 k resistor. This is called a

    voltage-dependent current source (or an I of V source). The dependent source on the right is a voltage source whose

    voltage depends on the current through the 2 k resistor. This source is known as a current-dependent voltage source (or a

    V of I source).

    +

    +

    10 V v / 500 1000 i

    1 k 3 k

    2 k

    + v

    i

    Figure 10: Example Circuit with Dependent Sources

    The corresponding LTspice IV schematic is shown in Figure 11. The i_of_v_2 and v_of_i_1 dependent sources from the

    UE LTspice library are used. When using dependent sources you must not only take care to get the source voltage polarity

    (or source current direction) correct, the voltage polarity (or current direction) of the voltage (current) being sampled must

    also be correct. Right click on the dependent source to set the gain used by the dependent source. Dependent sources are

    implemented as subcircuits in the UE library. This means that the gain value must be passed as a parameter to thesubcircuit. This requires that the gain value be entered in the form Ag=1/500 or Ar=1000. You can not enter just 1/500 or

    1000 or you will receive an error when you run the simulation. Note that R2 has been oriented so that its current direction

    agrees with the direction of i in Figure 10.

    The simulation results are show in Figure 12. Comparing to the original circuit we see that v = V(A) V(B) = -20V and i =

    I(R2) = 15 mA. ADC Operating Pointanalysis will calculate all node voltages. It should then be possible to determine all

    other voltages and currents in the circuit. (You may have noticed that the voltage for node n001 is displayed in the

    simulation results. Where did that node come from? The current sensing sources (the i_of_i and v_of_i sources) introducea new node in the schematic. In this case the new node is between resistor R2 and the current sensing wire in the U2

    source. This is an extraneous node and has no effect on the simulation results. The voltage at this node will always be the

    same as the voltage at the node on the other end of the current sensing wire.)

    Tips and Warnings

    1. You can cut-and-paste a LTspice IV schematic into a word processor quite easily. Just press CTRL-C when the

    schematic window is active to copy the schematic to the Windows clipboard. You can then paste the schematic

    into a word processor document. You may want to turn off the grid (from the View menu or just press CTRL-G to

    toggle it on and off) and set the schematic background to white (Control Panel, then theDraftingOptions tab, and

    then the Color Scheme button). Alternatively, you can copy the entire LTspice IV window to the clipboard by

    pressing ALT-PRTSC when the window is active. (This works for most windows applications by the way.)

    2. If you give two or more nodes the same label, the nodes will act as if they are wired together. This feature is often

    used to make complicated schematics look much neater, but it can also be a confusing source of errors for

    beginning users of LTspice IV. Do not give nodes the same labels (unless you really know what you are doing)!

    This error often arises when you duplicate a circuit (or portion of a circuit) that contains labeled nodes. LTspice

    IV will automatically renumber the components (so that no two components have the same name), but it will not

    change node labels. Nodes with the same label (even if they are in two separate circuits with no visible

    connections) will act as if they are connected.

    8 of 9

  • 8/2/2019 01_IntroDCAnalysis

    9/9

    Figure 11: Dependent Sources Schematic

    Figure 12: Dependent Sources Output

    9 of 9