SPICE Modeling of Resistor Circuits

SPICE Modeling of Resistor Circuits

Modular Electronics Learning (ModEL) project * SPICE ckt v1 1 0 dc 12 v2 2 1 dc 15 r1 2 3 4700 r2 3 0 7100 .dc v1 12 12 1 .print dc v(2,3) .print dc i(v2) .end V = I R SPICE Modeling of Resistor Circuits c 2016-2020 by Tony R. Kuphaldt – under the terms and conditions of the Creative Commons Attribution 4.0 International Public License Last update = 3 September 2020 This is a copyrighted work, but licensed under the Creative Commons Attribution 4.0 International Public License. A copy of this license is found in the last Appendix of this document. Alternatively, you may visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons: 171 Second Street, Suite 300, San Francisco, California, 94105, USA. The terms and conditions of this license allow for free copying, distribution, and/or modification of all licensed works by the general public. ii Contents 1 Introduction 3 2 Using SPICE 5 2.1 Summary of steps ...................................... 7 2.2 Demonstration on Microsoft Windows .......................... 8 2.3 Demonstration on Linux or CygWin ........................... 13 2.4 Demonstration of NGSPICE interactive mode ...................... 17 2.5 Idiosyncrasies of SPICE .................................. 23 2.5.1 Beginning and ending cards ............................ 23 2.5.2 Node zero ...................................... 24 2.5.3 Current measurement ............................... 24 2.5.4 Open and short circuits .............................. 24 2.5.5 Multiple sources .................................. 25 2.5.6 Multiple inductors/capacitors ........................... 25 3 SPICE component descriptions 27 3.1 Independent voltage sources ................................ 28 3.1.1 Example: DC source ................................ 28 3.1.2 Example: “Dummy” source ............................ 28 3.1.3 Example: AC source ................................ 29 3.1.4 Example: Sinusoidal source ............................ 31 3.1.5 Example: Pulse source ............................... 32 3.2 Independent current sources ................................ 33 3.2.1 Example: DC source ................................ 33 3.2.2 Example: AC source ................................ 33 3.3 Resistors ........................................... 34 3.3.1 Example ....................................... 34 3.4 Capacitors .......................................... 35 3.4.1 Example: Capacitor with initial charge ..................... 35 3.4.2 Example: Uncharged capacitor .......................... 35 3.5 Inductors .......................................... 36 3.5.1 Example: Inductor with initial charge ...................... 36 3.5.2 Example: Uncharged inductor ........................... 36 3.6 Transformers ........................................ 37 iii iv CONTENTS 3.6.1 Example: 2:1 ratio step-down transformer .................... 37 3.7 Transmission lines ..................................... 38 3.8 Linear dependent sources ................................. 39 3.8.1 Example: voltage-controlled voltage source ................... 40 3.8.2 Example: voltage-controlled current source ................... 40 3.9 Nonlinear dependent sources ............................... 41 3.9.1 Example: multiplier ................................ 41 3.10 Diodes ............................................ 42 3.10.1 Example: Generic diode .............................. 42 3.10.2 Example: 1N4001 ................................. 43 3.11 Bipolar Junction Transistors (BJTs) ........................... 44 3.11.1 Example: Generic NPN transistor ........................ 45 3.11.2 Example: 2N2907 ................................. 45 3.12 Junction Field-Effect Transistors (JFETs) ........................ 46 3.12.1 Example: Generic N-channel JFET ........................ 47 3.13 Metal-Oxide Field-Effect Transistors (MOSFETs) .................... 48 3.13.1 Example: Generic N-channel depletion-type MOSFET ............. 49 3.13.2 Example: Generic N-channel enhancement-type MOSFET ........... 49 3.13.3 Example: Generic P-channel depletion-type MOSFET ............. 50 3.13.4 Example: Generic P-channel enhancement-type MOSFET ........... 50 3.14 Subcircuits ......................................... 51 3.14.1 Example: resistor subnetwork ........................... 52 3.14.2 Example: solar cell array ............................. 53 4 SPICE analysis descriptions 55 4.1 DC voltage/current“sweep” analysis ........................... 56 4.1.1 Example: sweep of voltage source ......................... 56 4.1.2 Example: sweep of voltage and current sources ................. 56 4.2 AC frequency “sweep” analysis .............................. 57 4.2.1 Example: linear frequency sweep ......................... 57 4.2.2 Example: decade logarithmic frequency sweep .................. 57 4.2.3 Example: octave logarithmic frequency sweep .................. 57 4.3 Transient analysis ..................................... 58 4.3.1 Example: using initial conditions, beginning at time t = 0 ........... 58 4.3.2 Example: using initial conditions, beginning at non-zero time ......... 58 4.4 Fourier analysis ....................................... 59 4.4.1 Example: analysis of 60 Hz waveform ...................... 59 4.5 Display option: print .................................... 60 4.5.1 Example: printing a DC analysis ......................... 60 4.5.2 Example: printing an AC analysis ........................ 60 4.6 Display option: plot .................................... 61 4.6.1 Example: plotting a DC analysis ......................... 61 4.6.2 Example: plotting an AC analysis ........................ 61 4.6.3 Example: plotting a transient analysis ...................... 62 4.6.4 Example: plotting parametric functions ..................... 62 4.7 Display option: width ................................... 63 CONTENTS v 4.7.1 Example ....................................... 63 5 Primitive circuit examples 65 5.1 DC voltage source with .op analysis ........................... 66 5.2 DC voltage source with single-point .dc sweep analysis ................. 70 5.3 DC current source with single-point .dc sweep analysis ................. 73 5.4 DC voltage source with multi-point .dc sweep analysis ................. 74 5.5 AC voltage source with single-point .ac sweep analysis ................. 77 5.6 AC voltage source with multi-point .ac sweep analysis ................. 78 5.7 Additive AC voltage sources with single-point .ac sweep analysis ........... 82 5.8 Transient analysis of discharging RC circuit ....................... 84 5.9 Transient analysis of a steady sinusoidal voltage source ................. 89 5.10 Transient analysis of a sinusoidal capacitive circuit ................... 92 5.11 Transient analysis of a damped, offset sinusoidal voltage source ............ 95 5.12 Additive AC voltage sources with transient analysis .................. 98 5.13 Solar cell array simulation ................................. 100 5.14 Solar panel array simulation ................................ 102 6 Gallery 107 6.1 Using gallery examples for practice ............................ 108 6.2 Series resistor circuits ................................... 109 6.2.1 One DC current source, three resistors ...................... 110 6.2.2 One DC voltage source, three resistors ...................... 111 6.2.3 One DC voltage source, four resistors ...................... 112 6.2.4 One DC current source, five resistors ....................... 113 6.2.5 One DC voltage source, ten resistors ....................... 114 6.2.6 Three DC voltage sources, four resistors ..................... 116 6.3 Parallel resistor circuits .................................. 117 6.3.1 One DC voltage source, three resistors ...................... 118 6.3.2 One DC current source, three resistors ...................... 119 6.3.3 One DC voltage source, four resistors ...................... 120 6.3.4 One DC current source, five resistors ....................... 122 6.3.5 Three DC current sources, two resistors ..................... 124 6.4 Series-parallel resistor circuits ............................... 125 6.4.1 One DC voltage source, six resistors ....................... 126 6.4.2 One DC current source, six resistors ....................... 128 6.5 Simple multi-source resistor circuits ........................... 130 6.5.1 One voltage, one current .............................. 131 6.5.2 Two currents, one voltage ............................. 132 6.5.3 Two voltages, one current ............................. 133 6.5.4 Two currents, two voltages ............................ 134 A Problem-Solving Strategies 135 B Instructional philosophy 137 CONTENTS 1 C Tools used 143 D Creative Commons License 147 E References 155 F Version history 157 Index 157 2 CONTENTS Chapter 1 Introduction SPICE is a general-purpose computer simulator for electronic circuits, with several “freeware” versions available for academic use. Although its text-based user interface may seem clumsy and archaic at first, it is quite powerful, and also neatly side-steps the many problems students tend to experience with graphic-entry (“WYSIWYG”)1 circuit simulators. Circuits are described to SPICE in the form of a netlist, which is a text-based code listing of each component within the circuit, the “nodes” connecting them to each other, and the types of analyses requested of SPICE to perform on that circuit. A simple three-resistor DC circuit is shown in schematic form below, along with the netlist you would write and input to SPICE instructing it to analyze this

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    164 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us