首页 Module 21 - Circuit Simulation

Module 21 - Circuit Simulation

举报
开通vip

Module 21 - Circuit Simulation Module 21: Circuit Simulation Module 21: Circuit Simulation 21.1 Circuit Simulation........................................................................... 21-1 21.1.1 Model Type...

Module 21 - Circuit Simulation
Module 21: Circuit Simulation Module 21: Circuit Simulation 21.1 Circuit Simulation........................................................................... 21-1 21.1.1 Model Types.................................................................................................21-1 21.1.2 Exercise/Demo .............................................................................................21-2 21.1.3 Adding the voltage sources..........................................................................21-5 21.1.4 Setting up the analyses ................................................................................21-7 21.1.5 Setting up a Transient/Fourier analysis........................................................21-8 21.1.6 Setting up an AC Small Signal analysis .......................................................21-9 21.1.7 Running the simulation...............................................................................21-10 21.1.8 Running a Parameter Sweep Analysis.......................................................21-12 21.1.9 Using Advanced Options............................................................................21-14 21.1.10 Using a SPICE netlist for simulation ..........................................................21-15 Software, documentation and related materials: Copyright © 2008 Altium Limited. All rights reserved. You are permitted to print this document provided that (1) the use of such is for personal use only and will not be copied or posted on any network computer or broadcast in any media, and (2) no modifications of the document is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic, including translation into another language, except for brief excerpts in published reviews, is prohibited without the express written permission of Altium Limited. Unauthorized duplication of this work may also be prohibited by local statute. Violators may be subject to both criminal and civil penalties, including fines and/or imprisonment. Altium, Altium Designer, Board Insight, Design Explorer, DXP, LiveDesign, NanoBoard, NanoTalk, P-CAD, SimCode, Situs, TASKING, and Topological Autorouting and their respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. Module Seq = 21 Module 21: Circuit Simulation 21 - 1 21.1 Circuit Simulation The Altium Designer-based Circuit Simulator is a true mixed-signal simulator, meaning that it can analyze circuits that include both analog and digital devices. The Simulator uses an enhanced version of the event-driven XSpice, developed by the Georgia Tech Research Institute (GTRI), which itself is based on Berkeley's SPICE3 code. It is fully SPICE3f5 compatible, as well as providing support for a range of PSpice® device models. 21.1.1 Model Types The models supported by the Simulator can be effectively grouped into the following categories. 21.1.1.1 SPICE3f5 analog models These are predefined analog device models that are built-in to SPICE. They cover the various common analog component types, such as resistors, capacitors and inductors, as well as voltage and current sources, transmission lines and switches. The five most common semiconductor devices are also modeled - diodes, BJTs, JFETs, MESFETs and MOSFETs. A large number of model files (*.mdl) are also included, that define the behavior of specific instances of these devices. 21.1.1.2 PSPICE analog models These are predefined analog device models that are built-in to PSpice. To support these models, changes have been made to the general form for the corresponding SPICE3f5 device and/or additional parameter support has been added for use in a linked model file. Note: These models are not listed separately in this reference. PSpice support information is included as part of the information for the relevant SPICE3f5 device model. 21.1.1.3 XSPICE analog models These are predefined analog device code models that are built-in to XSpice. Code models allow the specification of complex, non-ideal device characteristics, without the need to develop long- winded sub-circuit definitions that can adversely affect Simulator speed performance. The supplied models cover special functions such as gain, hysteresis, voltage and current limiting and definitions of sdomain transfer functions. The SPICE prefix for these models is A. 21.1.1.4 Sub-Circuit models These are models for more complex devices, such as operational amplifiers, timers, crystals, etc, that have been described using the hierarchical sub-circuit syntax. A sub-circuit consists of SPICE elements that are defined and referenced in a fashion similar to device models. There is no limit on the size or complexity of sub-circuits and sub-circuits can call other subcircuits. Each sub-circuit is defined in a sub-circuit file (*.ckt). The SPICE prefix for theses models is X. Module 21: Circuit Simulation 21 - 2 21.1.1.5 Digital models These are digital device models that have been created using the Digital SimCode™ language. This is a special descriptive language that allows digital devices to be simulated using an extended version of the event-driven XSpice. It is a form of the standard XSpice code model. Source SimCode model definitions are stored in an ASCII text file (*.txt). Compiled SimCode models are stored in a compiled model file (*.scb). Multiple device models can be placed in the same file, with each reference by means of a special "func=" parameter. The SPICE prefix for theses models is A. Digital SimCode is a proprietary language - devices created with it are not compatible with other simulators, nor are digital components created for other simulators compatible with the Altium Designer-based mixed-signal Simulator. 21.1.2 Exercise/Demo 1. Select File » New » PCB Project from the menus. 2. Rename the new project file (with a .PrjPCB extension) by selecting File » Save Project As. Navigate to a location where you would like to store the project on your hard disk, type the name Filter.PrjPCB in the File Name field and click on Save. 3. Select File » New » Schematic. A blank schematic sheet named sheet1.SchDoc displays in the design window of the Schematic Editor and the schematic sheet is now listed under Source Documents beneath the project name in the Projects panel. 4. Rename the new schematic file by selecting File » Save As. 5. Now we can create the Filter circuit shown below in figure 86. Before we can run a simulation, the schematic must contain components with SIM models attached, voltage sources to power the filter, an excitation source, a ground reference for the simulations and some net labels on the points of the circuit where we wish to view waveforms. Note: This project is available in the Altium Designer circuit simulation examples. Module 21: Circuit Simulation 21 - 3 Figure 1. Circuit to simulate Note: The Altium simulator supports Spice 3F5 models and PSPICE models. SPICE models used for circuit simulation (.ckt and .mdl files) are located within the integrated libraries in the C:\Program Files\Altium Designer Summer 08\Library folder. You must use the correct file extension for each model type. Tip: A circuit for simulation must always have a path to ground. If it doesn’t you’ll receive iteration limit reached error. To fix this provide a path to ground or modified the advanced options value for RSHUNT to a figure of around 2-4Meg. Remember that the simulator assumes Capacitors are perfect, i.e. no leakage. 6. Click on the Search button in the Libraries panel. 7. To search for all LF411 type components, in all supplied libraries, enter LF411 in the upper part of the Libraries Search dialog. Set the Scope to Libraries on Path, and set the Path to C:\Program Files\Altium Designer Summer 08\Library, with the Include Subdirectories option enabled. Note that this will find all LF411 type components, you can check if the chosen component includes a Spice model by selecting it in the Libraries panel, and noting if there is a simulation model detailed in the Model Name region of the panel. Note: to search for only components that include a simulation model, you would have used the search string (Name like '*LF411*') and HasModel('SIM','*',true) 8. You may want to use a simulation model in your design other than the one already supplied with the component in its integrated library. If you download a model file from a manufacturer’s website, it is recommended that you copy it into your design’s project folder. For the sake of this example, we will remove and re-add the SPICE model, LF411C.ckt. 9. Copy LF411C.ckt and paste this file into the folder where your project files reside using windows Explorer. If you have created the circuit from scratch, there is a copy of the model file in C:\Program Files\Altium Designer Summer 08\Examples\Circuit Simulation\Filter. 10. Add the model file to the project by selecting the project name (Filter.PrjPCB) in the Projects panel, right-click and select Add Existing to Project. Choose the model file and click Open. Module 21: Circuit Simulation 21 - 4 11. Double-click on the op amp to open its Component Properties dialog. Delete the existing SIM model in the Models section by selecting it and clicking on Remove and confirming the deletion. 12. Click on Add in the Models section to display the Add New Model dialog. 13. Select Simulation from the Model Type drop-down list and click OK. The SIM Model- General/Generic Editor dialog displays. 14. Select Spice Subcircuit from the Model Sub-Kind list, the Spice Prefix will automatically set to X. Note that the dialog name has changed to reflect the Model Sub-Kind. 15. Click the Browse button to open the Browse Libraries dialog. Because you have added the model file to the project it will automatically be available, select the LF411C.ckt model from the list and click OK to close the dialog. Note: The Model Name detailed in the Model Kind tab is not the name of the file, it is actually matched against the name found in the .SUBCKT statement in the model file. CKT files can contain multiple .SUBCKT sections so be careful the correct name is specified. 16. The final step is to configure the pin mapping from the model to the schematic symbol (generic numbering is used in Spice model files, not physical pin numbers). Click on the Port Map tab of the SIM Model-General / Spice Subcircuit dialog to show the current mapping, and the Model File tab to show the generic numbers used in the .SUBCKT statement in the model file. Figure 2. Port Map information for sub-circuit simulation model 17. Modify the Model Pin mapping by selecting the matching pins from the Model Pin drop-down lists, as shown in Figure 2. Close the dialogs when finished. Module 21: Circuit Simulation 21 - 5 21.1.3 Adding the voltage sources We can add the voltage sources needed to power the design when simulating. 1. We will place the VDD power source first. Search for the component VSRC in the Libraries panel and then add the simulation sources.IntLib library to the Available Libraries list. Note that there are other simulation libraries available in the \Project Files\Altium2004\Library\Simulation folder. 2. As you place the power source, press TAB to edit its properties. Click on the SIM model VSRC in the Models list in the Component Properties dialog and click on Edit. In the Sim Model-Voltage Source/DC Source dialog, check the Model Kind is set to Voltage Source and the Model Sub-Kind to DC Source. 3. Click on the Parameters tab to set up the voltage value required. Type 5V in the Value field and tick its Component Parameter box. This will automatically create the parameter ‘Value’ for you in the Component Properties dialog. Leave the other fields set to zero. Figure 3. Parameter information for the simulation source model 4. Now place the VSS power source, remembering to set the model file parameter Value to –5V. 5. Finally add the Sinusoidal (excitation) Voltage Source, VSIN, also available from the Simulation Sources. IntLib. Press TAB to edit its properties before placing and change the Module 21: Circuit Simulation 21 - 6 frequency from 1 KHz to 50 KHz for this example. In the Component Properties dialog, clock on the SIM model VSIN in the models list and click on Edit. 6. Click on the Parameters tab to set up the voltage value required. Type in the parameter values as shown in the Sim Model-Voltage Source / Sinusoidal dialog. 7. Save your schematic. Note: Using values like 4k7 for a resistor or 5v5 does not work in Altium Designer. The values must be 4.7k and 5.5v respectively to function correctly. Module 21: Circuit Simulation 21 - 7 21.1.4 Setting up the analyses Altium Designer allows you to run an array of circuit simulations directly from a schematic. In this example, we will simulate the output waveforms produced by our Filter circuit. The simulation can be set up and run using the Simulate menu command or by clicking on the appropriate button on the Mixed Sim toolbar. 1. With Filter.SchDoc open in the Schematic Editor, select Design » Simulate » Mix Sim to display the General Setup page of the Analyses Setup dialog. 2. First, we will set up the nodes in the circuit that we want to observe. In the Collect Data For field, select Node Voltage, Supply Current, Device Current and Power from the list. This option defines what type of data you want calculated during the simulation run, i.e. it saves data for the voltage at each node, the current in each supply and the current and power in each device, Set the SimView Setup to Show Active Signals. 3. In the Available Signals field, double-click on the IN and OUT signal names. As you double- click on each one, it will move to the Active Signals field. 4. Each individual analysis type is configured on a separate page of the Analyses Setup dialog. Click on the analysis name to activate the corresponding setup page. Module 21: Circuit Simulation 21 - 8 21.1.5 Setting up a Transient/Fourier analysis A Transient/Fourier analysis generates output like that normally shown on an oscilloscope, computing the transient output variables (voltage, current or power) as a function of time over the user-specified time interval. An Operating Point analysis is automatically performed prior to a Transient analysis to determine the DC bias of the circuit. To view six cycles of the 50 KHz excitation voltage, we’ll need to set up to view a 60u portion of the waveform. 1. Make sure the Transient/Fourier checkbox is enabled (ticked) in the Analyses Setup dialog for this analysis. 2. Check that the Use Transient Defaults option is disabled, so that the Transient Analysis parameters can be modified. 3. To specify a 60u simulation window, set the Transient Stop Time field to 60u. 4. Now set the Transient Step Time field to 100n, indicating that the simulation should calculate a point every 100ns. 5. During simulation, the actual time step is varied automatically to achieve convergence and the required accuracy. The Maximum Step field limits the variation of the timestep size, so set the Transient Max Step Time to 200n. Module 21: Circuit Simulation 21 - 9 21.1.6 Setting up an AC Small Signal analysis An AC analysis generates output that shows the frequency response of the circuit, calculating the small-signal AC output variables as a function of frequency. The desired output of an AC small- signal analysis is usually a transfer function, e.g. voltage gain. The schematic must contain at least one AC source with a value entered for the AC Magnitude parameter in its SIM model. We have already set up the parameters of our sinusoidal excitation source (VSIN) to contain the AC Magnitude value, frequency and amplitude. 1. Make sure the AC Small Signal Analysis checkbox is enabled in the Analyses Setup dialog. 2. Enter the parameter values as shown above. 3. When this analysis is run, an Operating Point analysis is run first to determine the DC bias of the circuit. The signal source is then replaced with a fixed amplitude sine wave generator and the circuit is analyzed over the specified frequency range, stepping in increments defined by the values in the Test Points and Sweep Type fields. Module 21: Circuit Simulation 21 - 10 21.1.7 Running the simulation You are now ready to run the enabled analyses. Note that you can also run a simulation without entering the Analyses Setup dialog every time by clicking on the Run Simulation button on the Mixed Sim toolbar. 1. Click the OK button at the bottom of the Analyses Setup dialog to run the simulation. 2. If there are no errors in the circuit, a SPICE netlist (*.nsx) is created and passed to the simulator. Note that the netlist will be regenerated each time a simulation is run. 3. The simulation begins and a simulation data file (*.sdf) will open. The results of each analysis are shown as a separate chart in the SimData Editor’s Waveform Analysis window. The Operating Point analysis is performed first to determine the DC bias of the circuit. 4. When the simulation is finished, you should see outputs waveform. 21.1.7.1 Creating a Bode plot A Bode plot consists of two curves- the log of gain and phase-as functions of the log of frequency. The gain is decibels (dB) and the phase are plotted linearly along the y axis on a chart that has several cycles of a log scale on the x axis. Each cycle represents a factor of ten in frequency. We can create a Bode plot using the waveform functions available in the Edit Waveform dialog. 1. In the AC Analysis tab of the Waveform Analyzer window, we will display dB(in), dB(out), PHASE(in) and PHASE(out). 2. In the Waveform Analyzer window, click on net in. Right-click on the selected net and select Edit Wave (or select Wave » Edit Wave). The Edit Waveform dialog displays. The selected wave appears in the Expression field. 3. Select the function from the Complex Functions list, i.e. Magnitude (dB). Click on Create to see the waveform dB(net_name) on the plot. 4. To create dB(out), right-click on the plot and select Add Wave to Plot. The Add Wave to Plot dialog displays which works in the same way as the Edit Waveform dialog. 5. Repeat step 4 to create PHASE(in) and PHASE(out) on the second plot by selecting the Phase(Deg) complex function in the Add Wave to Plot dialog. Module 21: Circuit Simulation 21 - 11 6. These waveforms could be displayed on different Y axes, if required, by selecting Add to new Y axis in the Edit Waveform dialog. Note that if you remove the new Y axis, all waves that are plotted to this axis are removed as well as any measurement cursors attached to these waves. There is no Undo functionality. If you added a new Y axis, it would appear as shown below. 21.1.7.2 Using the measurement cursors Now we can determine the 3dB point using the measurement cursors. 1. Click on the net name DB(out) to select the wave in the Waveform Analyzer window. 2. Right-click and select Cursor A. Position cursor A in the low pass section by dragging the marker. 3. Right-click and select Cursor B. Position cursor B at a point such that B-A=
本文档为【Module 21 - Circuit Simulation】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_033190
暂无简介~
格式:pdf
大小:701KB
软件:PDF阅读器
页数:0
分类:互联网
上传时间:2011-07-12
浏览量:32