Xcircuit and Spice. February 26, 2007

Similar documents
NGSPICE- Usage and Examples

Lab #2 First Order RC Circuits Week of 27 January 2015

Engineering 3821 Fall Pspice TUTORIAL 1. Prepared by: J. Tobin (Class of 2005) B. Jeyasurya E. Gill

SIMULATIONS WITH THE BUCK-BOOST TOPOLOGY EE562: POWER ELECTRONICS I COLORADO STATE UNIVERSITY. Modified February 2006

Since transmission lines can be modeled using PSpice, you can do your analysis by downloading the student version of this excellent program.

SIMULATION OF A SERIES RESONANT CIRCUIT ECE562: Power Electronics I COLORADO STATE UNIVERSITY. Modified in Fall 2011

Real Analog - Circuits 1 Chapter 11: Lab Projects

ECE 201 LAB 6 INTRODUCTION TO SPICE/PSPICE

Introduction to LT Spice IV with Examples

Class #7: Experiment L & C Circuits: Filters and Energy Revisited

LTSpice Basic Tutorial

An Introductory Guide to Circuit Simulation using NI Multisim 12

ELEC3106 Electronics. Lab 4: EMI simulations with SPICE. Objective. Material. Simulations

ET 304A Laboratory Tutorial-Circuitmaker For Transient and Frequency Analysis

Class #8: Experiment Diodes Part I

Figure E2-1 The complete circuit showing the oscilloscope and Bode plotter.

Welcome to your second Electronics Laboratory Session. In this session you will learn about how to use resistors, capacitors and inductors to make

Waveform Generators and Oscilloscopes. Lab 6

Using LTSPICE to Analyze Circuits

EXPERIMENT 9 Problem Solving: First-order Transient Circuits

LAB II. INTRODUCTION TO LAB EQUIPMENT

LAB 1: Familiarity with Laboratory Equipment (_/10)

Experiment 8: An AC Circuit

PSPICE T UTORIAL P ART I: INTRODUCTION AND DC ANALYSIS. for the Orcad PSpice Release 9.2 Lite Edition

EE 105 MICROELECTRONIC DEVICES & CIRCUITS FALL 2018 C. Nguyen. Laboratory 2: Characterization of the 741 Op Amp Preliminary Exercises

LT Spice Getting Started Very Quickly. First Get the Latest Software!

Chapter 12: Electronic Circuit Simulation and Layout Software

SIMULATIONS WITH THE BOOST TOPOLOGY EE562: POWER ELECTRONICS I COLORADO STATE UNIVERSITY. Modified February 2006

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Inductors

Experiment P45: LRC Circuit (Power Amplifier, Voltage Sensor)

RELEASE NOTES SIMETRIX 6.2 O VERVIEW WHAT S NEW GUI DVM SIMETRIX SIMULATOR SIMPLIS SIMULATOR SCRIPT LANGUAGE MODEL LIBRARY

SIMULATION WITH THE BOOST TOPOLOGY ECE562: Power Electronics I COLORADO STATE UNIVERSITY. Modified in Fall 2011

Introduction to PSpice

Introduction to SwitcherCAD

Class #16: Experiment Matlab and Data Analysis

EE 210 Lab Exercise #3 Introduction to PSPICE

Lab 2: Common Emitter Design: Part 2

RLC Frequency Response

Laboratory 3 (drawn from lab text by Alciatore)

Experiment Guide: RC/RLC Filters and LabVIEW

Goals. Introduction. To understand the use of root mean square (rms) voltages and currents.

Series and Parallel Resonant Circuits

EXPERIMENT NUMBER 10 TRANSIENT ANALYSIS USING PSPICE

EECS40 RLC Lab guide

Lab 2: Linear and Nonlinear Circuit Elements and Networks

SIMULATIONS OF LCC RESONANT CIRCUIT POWER ELECTRONICS COLORADO STATE UNIVERSITY. Modified in Spring 2006

Lab Reference Manual. ECEN 326 Electronic Circuits. Texas A&M University Department of Electrical and Computer Engineering

EK307 Active Filters and Steady State Frequency Response

Figure AC circuit to be analyzed.

Lecture 16 Date: Frequency Response (Contd.)

ME 365 EXPERIMENT 1 FAMILIARIZATION WITH COMMONLY USED INSTRUMENTATION

Lab 13 AC Circuit Measurements

Lab 3: Very Brief Introduction to Micro-Cap SPICE

LLS - Introduction to Equipment

SIMULATION WITH THE CUK TOPOLOGY ECE562: Power Electronics I COLORADO STATE UNIVERSITY. Modified in Fall 2011

Introduction to R Software Prof. Shalabh Department of Mathematics and Statistics Indian Institute of Technology, Kanpur

Lab 3: AC Low pass filters (version 1.3)

LABORATORY 4. Palomar College ENGR210 Spring 2017 ASSIGNED: 3/21/17

8A. ANALYSIS OF COMPLEX SOUNDS. Amplitude, loudness, and decibels

The oscilloscope and RC filters

1. Hand Calculations (in a manner suitable for submission) For the circuit in Fig. 1 with f = 7.2 khz and a source vin () t 1.

Activity P52: LRC Circuit (Voltage Sensor)

LAB I. INTRODUCTION TO LAB EQUIPMENT

AC Circuits INTRODUCTION DISCUSSION OF PRINCIPLES. Resistance in an AC Circuit

Introduction to basic laboratory instruments

DC and AC Circuits. Objective. Theory. 1. Direct Current (DC) R-C Circuit

Time-Varying Signals

Experiment 2: Transients and Oscillations in RLC Circuits

Lab E5: Filters and Complex Impedance

EECS 216 Winter 2008 Lab 2: FM Detector Part II: In-Lab & Post-Lab Assignment

LAB I. INTRODUCTION TO LAB EQUIPMENT

FACULTY OF ENGINEERING LAB SHEET

Introduction to Pspice

LABORATORY 3: Transient circuits, RC, RL step responses, 2 nd Order Circuits

EECS 312: Digital Integrated Circuits Lab Project 1 Introduction to Schematic Capture and Analog Circuit Simulation

Example Application C H A P T E R 4. Contents

ENGR4300 Test 3A Fall 2002

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Circuits & Electronics Spring 2005

MultiSim and Analog Discovery 2 Manual

Physics 481 Experiment 1

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Physics 8.02 Spring Experiment 11: Driven RLC Circuit

FREQUENCY RESPONSE OF R, L AND C ELEMENTS

CHAPTER 6: ALTERNATING CURRENT

Lab 2: Diode Characteristics and Diode Circuits

EK307 Passive Filters and Steady State Frequency Response

Laboratory 5: RC Circuits and Filtering

ECE212H1F University of Toronto 2017 EXPERIMENT #4 FIRST AND SECOND ORDER CIRCUITS ECE212H1F

LRC Circuit PHYS 296 Your name Lab section

Lab 6: MOSFET AMPLIFIER

Experiment 1: Instrument Familiarization (8/28/06)

OrCAD PSpice - Tutorial. TA: 黃玉龍

Laboratory Exercise 6 THE OSCILLOSCOPE

Week 8 AM Modulation and the AM Receiver

LAB 8: Activity P52: LRC Circuit

Lab 4: Analysis of the Stereo Amplifier

Step Response of RC Circuits

Chapter 6 Title Blocks

Name: First-Order Response: RC Networks Objective: To gain experience with first-order response of RC circuits

Electronics and Instrumentation ENGR-4300 Spring 2004 Section Experiment 5 Introduction to AC Steady State

Chapter 33. Alternating Current Circuits

Transcription:

Xcircuit and Spice February 26, 2007 This week we are going to start with a new tool, namely Spice. Spice is a circuit simulator. The variant of spice we will use here is called Spice-Opus, and is a combined digital and analog circuit simulator. It is not as convenient as some other spice variants, which allow you to create and analyse circuits using purely graphical operations. In this version of spice, we must create programs called netlists using which we describe both the circuit to be analysed and the type of analysis we wish to do on it. 1 Invoking Spice At a command prompt, type % spice3 & This will start spice (version 3) and will open up an X-Windows command terminal at which you can give spice commands. The & tells Linux that you want spice to run in the background. You need a spice program to use spice. So create the following file using your favourite editor: * A Simple RLC network, at resonance * The first line of a spice netlist describes the file. * Always start start a netlist with a comment. v0 1 0 0 ac sin (0.5 0.1 0.158meghz) * we have asked for a voltage source between * nodes 0 and 1. The source has a 0.5V offset and a 0.1V * AC source oscillating at 158 KHz. r1 1 2 1k l1 2 3 1u c1 3 0 1u * These lines place a resistor of 1Ω, a capacitor of * 1µF and an inductor of 1µH between nodes 1 and 2, * 2 and 3, and 3 and 0 respectively..end * This ends the netlist 1

Save this file as tut4.cir. It describes the circuit in the following figure: 1.0Ω 1.0uH.1V p-p.5v offset 0.158 meghz 1.0uF In the spice window, type source tut4.cir This reads in tut4.cir into spice. We now wish to see how the circuit behaves when the frequency is varied. The command for that is ac dec N startf endf where dec N stands for get N points per decade, and startf and endf are the starting and ending frequencies. For example, type ac dec 10 1khz 100meghz If you wish to see the values of the voltages across the resistor, type print v(1)-v(2) This will print out five columns. The first column is the row number, the second and third are the real and imaginary parts of the complex frequency, and the fourth and fifth columns are the real and imaginary parts of v 1 v 2. What we really want to do is to plot the result. We are driving the circuit at different frequencies and expect the voltage across the resistor to show a resonant peak at 10 6/ 2π = 159155 Hz. Type plot v(1)-v(2) This will bring up a plot of the voltage across series L and C. If you wish to change aspects of the plot, click the other mouse button on the plot to get a menu. The type of the plot can be changed, you can zoom in and out, and you can print your plot. Printing includes print to file which means that the plot is saved to a postscript file. If you wish to have a pdf file instead 2

ps2pdf graph.ps where graph.ps should be replaced by whatever name you gave when saving the plot. The plot showed the peak as desired. Which means that most of the voltage fell across the resistor and the series L and C combination had zero impedence at that frequency. Now let us see what happens if we suddenly start the circuit with a switch - this is called transient analysis. Type tran.1u 20u The tran command runs the simulation from the starting time (first argument) till the ending time (second argument) in steps specified by the third argument. Now plot the voltage across the LC. Type plot v(2) A new window pops up showing how the voltage initially swings back and forth and then settles to a voltage of 0.5 V. 2 Rules for describing Elements 2.1 Resistors, Capacitors and Inductors Each element takes the form: Name i j value where Name is the name we give the element, i and j are the nodes between which the element has been connected and value is the numerical value for the element. Note the following: 1. The first letter of any element name indicates to spice the nature of that element. So names starting with R should be used to define resistors, names starting with C should be used to define capacitors and names starting with L should be used to define inductors. 2. i and j are names. Any name is acceptible, but node 0 is special. That node is defined to be ground. So to get useful voltages, you must have a ground node. 3. The value is a number without a unit. The unit is inferred from the element name. This value can be specified in scientific notation, and the following acronyms are allowed (all examples for resistor values): 1k 1KΩ 1m 10 3 Ω 1u 10 6 Ω 1n 10 9 Ω 1p 10 12 Ω 1meg 10 6 Ω 1g 10 9 Ω 3

3 Xcircuit Creating a spice netlist is laborious. So there are many tools that combine a GUI for drawing the circuit with spice to solve for the circuit behaviour. These all cost money, however. What is free though, are tools that only create netlists, so that you can combine them with spice to achieve the same thing. The best such tool is xcircuit, a professional quality schematic tool. This tool is used by professionals in the field to create publication quality circuit diagrams. By the way, it also creates spice netlists. 3.1 Using Xcircuit At a shell prompt type spice assign1 This will start up xcircuit with an empty sheet called assign1. We want to create a rectifier circuit driven by a sinusoidal voltage source: 1. Type l to bring up the first symbol library. Select ground by pressing c (for copy) while the cursor is over the symbol. The library will vanish and the drawing sheet will reappear. Move the symbol to where you want it and click to paste it. Click the other button to end the copy. 2. Type l to bring up the symbol library. Now we want the second page. Type l again. Select a sinusoidal voltage source by pressing c with the cursor on it. Paste as before. 3. Repeat this process with a diode. We would like the diode to be horizontal. Press r (for rotate right) repeatedly till the diode points in the desired direction. Paste as before. 4. Repeat with a resistor and a capacitor, oriented appropriately. Except for the ground symbol, all these symbols come from the second page. 5. At this point you should have the desired symbols in their proper positions and orientations, but with blank space between them. Now draw wires. Wires are drawn by simply clicking the mouse button anywhere and then moving to another point. A polygon is drawn, whose vertices are defined by successive mouse clicks. Finish the polygon by clicking with the third button (on two button mice, this means clicking both buttons together). 6. We now have a circuit with the correct types of elements, but with the wrong element values. We now need to change the voltage source to be a 1 Volt source at 10 KHz, the resistor to be 10KΩ and the capacitor to be 1µF. To do this, we need to edit the individual elements. (a) Edit the element. For this, click on the blue down arrow on the right, standing for push (edit object) and then click on the AC source. The source appears enlarged, and more importantly with the code that goes with it. 4

(b) Move the cursor over the spice text and press e. Press e. The text is now available to edit. (c) Use the left and right arrows to move the cursor till it reaches the 5 (look at the bottom edit field rather than the string on the screen). Delete it and replace with 2. Similarly replace the 1 by 10. The string should read: spice:v%i %ps.p %ps.m 0 ac sin(0 2 10k) Press RETURN to complete the edit. (d) Similarly edit and modify the resistor and capacitor values. 7. xcircuit assigns arbitrary node names to the various interconnects in your circuit, which is inconvenient. So, let us add our own names to the nodes we care about. (a) Move the cursor over the corner above the voltage source and press T. Type in and then press 7 on the numeric keypad. The various directions on the numeric keypad control the justification of the text. We want the text to the top and to the left of the corner, so we press 7. Press <ENTER>. (b) Repeat for the node between the diode and the 10KΩ and call it d. Use 2 on the numeric keypad to place the text below the node. (c) Repeat for the node above the capacitor and call it out. Use 9 on the numeric keypad this time. 8. Save the sheet by writing the xcircuit ps file (in the File menu). 9. Exit xcircuit. As soon as you exit xcircuit, spice will pop up along with a pretty picture of your circuit (curtesy xcircuit - remember that it is a professional circuit drawing tool). 3.2 Using the Xcircuit Netlist The netlist created by Xcircuit is deficient in some ways. Some of the items need further definition. To solve this problem, the following command is automatically run when you exit form xcircuit spc2cir assign1 This takes assign1.spc and converts it into a more acceptible file assign1.cir (acceptible, that is, to spice). spice starts up and lists the circuit for your reference. In addition it also shows you the xcircuit diagram to help you understand the netlist. 5

4 Problems for the Lab Class The following problems have to be carried out during this class: 1. Create the RLC circuit of the first scilab session using the xcircuit - spice approach. Determine the frequency response between 500 and 1500 k-rad/sec. Vary R to different values by using alter r1=value and repeat the ac analysis. Note that ac analysis creates a vector called frequency. When plotting, you can plot against omega by using: let omega=2*3.14159*frequency plot v(out) vs omega 2. Create the following circuit and analyse it: in 1.0kΩ d out 2V p-p 1V offset 10kHz 100.0 megω 1.0uF The purpose of the 100MΩ resistor is to allow the node d to have a connection to ground when the diode is off. Unless it is present, spice will object with singular matrix or other equally cryptic message. Do a transient analysis upto 10msec in steps of 10µsec. Plot the voltages at nodes in, d and out. Zoom into the plot using z and look at the detailed response. The diode is a nonlinear element. A 10 KHz sinusoidal source generates harmonics in the output when a diode is present. Look at the fourier series of the output waveform using the fourier command: fourier 10k v(out) The.ps and the.cir files should be submitted as part of your lab. The.cir file should contain the analysis commands inside a.control block, for example:.control ac lin 500k 1500k omega=2*3.14159*frequency plot v(out) vs omega.endc 6

It is worth noting that an easy way to go back and forth between spice3 and the script is to execute edit in the spice window. That brings up xedit with the script. Everytime you save in xedit, you can run the script in spice by entering source FILENAME. Anything between.control and.endc is executed by spice on startup. Put all your assignment commands there. Once everything is working, submit it (or show it to the TAs). 7