Microsim Pspice & Basics: User'S Guide
Microsim Pspice & Basics: User'S Guide
Users Guide
Version 7.1, October, 1996. Copyright 1996, MicroSim Corporation. All rights reserved. Printed in the United States of America.
MicroSim Trademarks
Referenced herein are the registered trademarks used by MicroSim Corporation to identify its products. MicroSim is the exclusive owner of: MicroSim, PSpice, PLogic, PLSyn and Polaris. Trademarks of MicroSim include: DesignLab and Setting the Standard for Desktop EDA. Additional marks of MicroSim include: StmEd, Stimulus Editor, Probe, Parts, Monte Carlo, Analog Behavioral Modeling, Device Equations, Digital Simulation, Digital Files, Filter Designer, Schematics, MicroSim PCBoards, PSpice Optimizer, and variations thereon (collectively the Trademarks) are used in connection with computer programs. MicroSim owns various trademark registrations for these marks in the United States and other countries.
Copyright Notice
Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a data base or retrieval system, without the prior written permission of MicroSim Corporation. As described in the license agreement, you are permitted to run one copy of the MicroSim software on one computer at a time. Unauthorized duplication of the software or documentation is prohibited by law.
Technical Support
Internet Phone FAX AUTOFAX [email protected] (714) 837-0790 (714) 455-0554 (714) 454-3296
Sales Department
Internet Phone [email protected] 800-245-3022
Contents
xiv Contents
Contents xv
xvi Contents Entering data sheet information . . . . . . . . Completing the model definition . . . . . . . Subcircuits . . . . . . . . . . . . . . . . . . . . . . . Using the Model Editor (Text Editor) . . . . . . . . . Implementation of Model Editing . . . . . . . . . Editing Model Definitions in the Schematic Editor Editing Model Definitions in the Symbol Editor . Model Editor Dialog Box . . . . . . . . . . . . . Model Editing Example . . . . . . . . . . . . . . Breakout Parts . . . . . . . . . . . . . . . . . . . Resistors, capacitors, and inductors . . . . . . Using the KBREAK symbol . . . . . . . . . Transformers . . . . . . . . . . . . . . . . . . Ideal switches . . . . . . . . . . . . . . . . . Semiconductor Parts . . . . . . . . . . . . . . . . Intrinsically modeled semiconductors . . . . . Configuring the Library . . . . . . . . . . . . . . . . Global and local model files . . . . . . . . . . Search order . . . . . . . . . . . . . . . . . . Library directory paths . . . . . . . . . . . . Schematics and simulator interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15 5-19 5-20 5-21 5-21 5-22 5-23 5-23 5-24 5-26 5-26 5-27 5-29 5-30 5-31 5-31 5-36 5-36 5-38 5-39 5-40
Contents
xvii . 6-30 . 6-30 . 6-31 . 6-33 . 6-35 . 6-35 . 6-37 . 6-41 . 6-41 . 6-42 . 6-42 . 6-43 . 6-44 . 6-45 . 6-46 . 6-47 . 6-48 . 6-51 . 6-53
Modeling Mathematical or Instantaneous Relationships . EVALUE and GVALUE parts . . . . . . . . . . . . EMULT, GMULT, ESUM, and GSUM . . . . . . . Lookup Tables (ETABLE and GTABLE) . . . . . . . . Frequency-Domain Device Models . . . . . . . . . . . . Laplace Transforms (LAPLACE) . . . . . . . . . . . . . Frequency Response Tables (EFREQ and GFREQ) . . . Cautions and Recommendations for Simulation and Analysis Instantaneous Device Modeling . . . . . . . . . . . . . . Frequency-Domain Parts . . . . . . . . . . . . . . . . . Laplace Transforms . . . . . . . . . . . . . . . . . . . . Non-causality and Laplace transforms . . . . . . . . Chebyshev filters . . . . . . . . . . . . . . . . . . . Frequency tables . . . . . . . . . . . . . . . . . . . Trading Off Computer Resources For Accuracy . . . . . Basic Controlled Sources . . . . . . . . . . . . . . . . . . . Basic SPICE Polynomial Expressions (POLY) . . . . . . Implementation Examples . . . . . . . . . . . . . . . . . Creating custom ABM parts . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
xviii Contents
Chapter 8 DC Analyses
Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DC Sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimum Requirements to Run a DC Sweep Analysis . . . . . . . . Overview of DC Sweep . . . . . . . . . . . . . . . . . . . . . . . . Nested DC Sweeps . . . . . . . . . . . . . . . . . . . . . . . . . . . Curve Families for DC Sweeps . . . . . . . . . . . . . . . . . . . . Bias Point Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimum Requirements to Run a Bias Point Detail Analysis . . . . . Overview of Bias Point Detail . . . . . . . . . . . . . . . . . . . . . Small-Signal DC Transfer . . . . . . . . . . . . . . . . . . . . . . . . . Minimum Requirements to Run a Small-Signal DC Transfer Analysis Overview of Small-Signal DC Transfer . . . . . . . . . . . . . . . . DC Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimum Requirements to Run a DC Sensitivity Analysis . . . . . . Overview of DC Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 8-2 8-2 8-3 8-4 8-5 8-7 8-7 8-7 8-8 8-8 8-9 8-10 8-10 8-10
Contents xix
Editing a Stimulus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To edit an existing stimulus . . . . . . . . . . . . . . . . . . . . . . To edit a PWL stimulus . . . . . . . . . . . . . . . . . . . . . . . . To select a time and value scale factor for PWL stimuli . . . . . . . Deleting and Removing Traces . . . . . . . . . . . . . . . . . . . . . . Manual Stimulus Configuration . . . . . . . . . . . . . . . . . . . . . . To manually configure a stimulus . . . . . . . . . . . . . . . . . . Using the VSTIM and ISTIM Sources . . . . . . . . . . . . . . . . . . To use the VSTIM or ISTIM source to define the transient stimulus behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . Transient (Time) Response . . . . . . . . . . . . . . . . . . . . . . . . . . Internal Time Steps in Transient Analyses . . . . . . . . . . . . . . . . . . Switching Circuits in Transient Analyses . . . . . . . . . . . . . . . . . . . Plotting Hysteresis Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . Fourier Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10-10 10-10 10-10 10-10 10-11 10-11 10-11 10-13 10-13 10-14 10-15 10-16 10-16 10-18
xx Contents Monte Carlo Analysis . . . . . . . . . . . . . . . . . . . . . Tutorial: Monte Carlo Analysis of a Pressure Sensor . . . Drawing the schematic . . . . . . . . . . . . . . . . Setting up the parameters . . . . . . . . . . . . . . . Varying the resistors . . . . . . . . . . . . . . . . . . Saving the schematic . . . . . . . . . . . . . . . . . Modifying the models for Monte Carlo . . . . . . . . Setting up the analyses . . . . . . . . . . . . . . . . Running the analysis and viewing the results . . . . . Monte Carlo Histograms . . . . . . . . . . . . . . . . . . Chebyshev filter example . . . . . . . . . . . . . . . Creating models for Monte Carlo analysis . . . . . . Setting up the analysis . . . . . . . . . . . . . . . . . Creating histograms . . . . . . . . . . . . . . . . . . Worst-Case Analysis . . . . . . . . . . . . . . . . . . . . . . Overview of Worst-Case Analysis . . . . . . . . . . . . . Inputs . . . . . . . . . . . . . . . . . . . . . . . . . Procedure . . . . . . . . . . . . . . . . . . . . . . . Outputs . . . . . . . . . . . . . . . . . . . . . . . . An important condition for correct worst-case analysis Worst-Case Analysis Example . . . . . . . . . . . . . . . Hints and Other Useful Information . . . . . . . . . . . . VARY BOTH, VARY DEV, and VARY LOT . . . . Gaussian distributions . . . . . . . . . . . . . . . . . YMAX collating function . . . . . . . . . . . . . . . RELTOL . . . . . . . . . . . . . . . . . . . . . . . . Sensitivity analysis . . . . . . . . . . . . . . . . . . Manual optimization . . . . . . . . . . . . . . . . . . Monte Carlo analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7 12-10 12-10 12-11 12-11 12-12 12-12 12-15 12-15 12-16 12-16 12-16 12-17 12-17 12-21 12-21 12-21 12-22 12-22 12-23 12-24 12-28 12-28 12-29 12-29 12-29 12-29 12-30 12-30
Contents xxi
Other Ways to Run Probe . . . . . . . . . . . . . Mid-analysis snoop . . . . . . . . . . . . . Starting Probe during a simulation . . . . . . Interacting with Probe while in monitor mode Configuring update intervals . . . . . . . . . Schematic Markers . . . . . . . . . . . . . . . . Probe Example . . . . . . . . . . . . . . . . . . . . . User-Interface Features . . . . . . . . . . . . . . . . Zoom Regions . . . . . . . . . . . . . . . . . . . Scrolling Traces . . . . . . . . . . . . . . . . . . Modifying Traces and Labels . . . . . . . . . . . Moving Traces and Labels . . . . . . . . . . . . Tabulating Trace Data Values . . . . . . . . . . . Cursors . . . . . . . . . . . . . . . . . . . . . . Probe Trace Expressions . . . . . . . . . . . . . . . . Basic Output Variable Form . . . . . . . . . . . Output Variable Form for Device Terminals . . . Trace Expressions . . . . . . . . . . . . . . . . . Limiting File Size Using Markers . . . . . . . . . . . Probe Data File Output Control . . . . . . . . . . Avoiding File Size Limits . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. 13-7 . 13-7 . 13-8 . 13-9 . 13-9 13-10 13-12 13-15 13-15 13-16 13-16 13-17 13-18 13-19 13-22 13-22 13-23 13-25 13-28 13-28 13-28
Index
Figures
Figure 1-1 Figure 2-1 Figure 2-2 Figure 2-3 Figure 2-4 Figure 2-5 Figure 2-6 Figure 2-7 Figure 2-8 Figure 2-9 Figure 2-10 Figure 2-11 Figure 2-12 Figure 2-13 Figure 2-14 Figure 2-15 Figure 2-16 Figure 2-17 Figure 2-18 Figure 2-19 Figure 2-20 Figure 2-21 Figure 2-22 Figure 2-23 Figure 3-1 Figure 4-1 Figure 5-1 Figure 5-2 Figure 5-3 Figure 5-4 Figure 5-5
Circuit Analysis File Interactions . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Diode Clipper Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Connection Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 PSpice Simulation Status Window . . . . . . . . . . . . . . . . . . . . . . . 2-6 Simulation Output File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 DC Sweep Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Probe Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Voltage at In and Mid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 Trace Legend with Cursors Activated . . . . . . . . . . . . . . . . . . . . . . 2-11 Trace Legend with V(Mid) Symbol Outlined . . . . . . . . . . . . . . . . . . 2-12 Voltage Difference at V(In) = 4 Volts . . . . . . . . . . . . . . . . . . . . . . 2-13 Diode Clipper Circuit with a Voltage Stimulus . . . . . . . . . . . . . . . . . 2-14 Stimulus Editor Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 Transient Analysis Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 Sinusoidal Input and Clipped Output Waveforms . . . . . . . . . . . . . . . . 2-17 Clipper Circuit with AC Stimulus . . . . . . . . . . . . . . . . . . . . . . . . 2-18 AC Sweep and Noise Analysis Dialog Box . . . . . . . . . . . . . . . . . . . 2-19 dB Magnitude Curves for Gain at Mid and Out . . . . . . . . . . . . . . . . 2-20 Bode Plot of Clippers Frequency Response . . . . . . . . . . . . . . . . . . 2-21 Clipper Circuit with Global Parameter Rval . . . . . . . . . . . . . . . . . . 2-22 Parametric Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 Small Signal Response as R1 is Varied from 100 to 10 k . . . . . . . . . . 225 Comparison of Small Signal Frequency Response at 100 and 10 k Input Resistance 2-27 Performance Analysis Plots of Bandwidth and Gain vs. Rval . . . . . . . . . 2-29 Lossy Line Comprised of Lumped Line Segments . . . . . . . . . . . . . . . 3-6 Rules for Pin Callout in Subcircuit Templates . . . . . . . . . . . . . . . . . 4-11 Relationship of Parts Utility with Schematics and PSpice . . . . . . . . . . . 5-4 Process and Data Flow for the Parts Utility . . . . . . . . . . . . . . . . . . . 5-6 Parts Utility Window with Data for a Bipolar Transistor . . . . . . . . . . . . 5-11 Schematic for a Half-Wave Rectifier . . . . . . . . . . . . . . . . . . . . . . 5-13 Dbreak-X Instance Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
xxiv
Figures
Figure 5-6 Figure 5-7 Figure 5-8 Figure 5-9 Figure 5-10 Figure 6-1 Figure 6-2 Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-6 Figure 6-7 Figure 6-8 Figure 6-9 Figure 6-10 Figure 6-11 Figure 6-12 Figure 6-13 Figure 6-14 Figure 6-15 Figure 6-16 Figure 6-17 Figure 6-18 Figure 6-19 Figure 6-20 Figure 7-1 Figure 8-1 Figure 8-2 Figure 8-3 Figure 8-4 Figure 8-5 Figure 9-1 Figure 9-2 Figure 10-1 Figure 10-2 Figure 10-3 Figure 10-4 Figure 10-5 Figure 10-6 Figure 11-1
Diode Model Characteristics and Parameter Values for the Dbreak-X Instance Model 5-15 Assorted Device Characteristic Curves for a Diode . . . . . . . . . . . . . . 5-18 Forward Current Device Curve at Two Temperatures . . . . . . . . . . . . . 5-18 Model Editor Dialog Box for Q2N2222 with a DEV Tolerance Set on Rb . . 5-25 KBREAK Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-27 LOPASS Filter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 HIPASS Filter Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12 BANDPASS Filter Example Part . . . . . . . . . . . . . . . . . . . . . . . 6-13 BANDREJ Filter Part Example . . . . . . . . . . . . . . . . . . . . . . . . 6-13 FTABLE Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16 LAPLACE Part Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19 Lossy Integrator Example: Viewing Gain and Phase Characteristics with Probe . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19 LAPLACE Part Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19 ABM Expression Part Example 1 . . . . . . . . . . . . . . . . . . . . . . . 6-23 ABM Expression Part Example 2 . . . . . . . . . . . . . . . . . . . . . . . 6-23 ABM Expression Part Example 3 . . . . . . . . . . . . . . . . . . . . . . . 6-24 ABM Expression Part Example 4 . . . . . . . . . . . . . . . . . . . . . . . 6-24 Triode Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25 Triode Subcircuit Producing a Family of I-V Curves . . . . . . . . . . . . . 6-27 EVALUE Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 GVALUE Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 EMULT Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32 GMULT Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32 EFREQ Part Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39 Voltage Multiplier Circuit (Mixer) . . . . . . . . . . . . . . . . . . . . . . . 6-41 PSpice Status Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 DC Sweep Setup Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Example Schematic example.sch . . . . . . . . . . . . . . . . . . . . . . . . 8-3 Curve Family Example Schematic . . . . . . . . . . . . . . . . . . . . . . . . 8-5 Device Curve Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 Operating Point Determination for Each Member of the Curve Family . . . . . 8-6 AC Sweep Setup Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Example Schematic example.sch . . . . . . . . . . . . . . . . . . . . . . . . 9-3 Relationship of Stimulus Editor with Schematics and PSpice . . . . . . . . . 10-4 Transient Analysis Setup for example.sch . . . . . . . . . . . . . . . . . . . 10-14 Example Schematic example.sch . . . . . . . . . . . . . . . . . . . . . . . 10-14 ECL Compatible Schmitt Trigger . . . . . . . . . . . . . . . . . . . . . . . 10-16 Netlist for Schmitt Trigger Circuit . . . . . . . . . . . . . . . . . . . . . . . 10-17 Hysteresis Curve Example: Schmitt Trigger . . . . . . . . . . . . . . . . . . 10-18 Passive Filter Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
Figures
xxv
Figure 11-2 Figure 11-3 Figure 11-4 Figure 11-5 Figure 11-6 Figure 11-7 Figure 12-1 Figure 12-2 Figure 12-3 Figure 12-4 Figure 12-5 Figure 12-6 Figure 12-7 Figure 12-8 Figure 12-9 Figure 12-10 Figure 12-11 Figure 12-12 Figure 12-13 Figure 12-14 Figure 12-15 Figure 12-16 Figure 12-17 Figure 12-18 Figure 12-19 Figure 12-20 Figure 13-1 Figure 13-2 Figure 13-3 Figure 13-4 Figure 13-5 Figure 13-6 Figure 13-7 Figure 14-1 Figure 14-2 Figure A-1
Current of L1 when R1 is 1.5 Ohms . . . . . . . . . . . . . . . . . . . . . . . 11-5 Rise Time and Overshoot vs. Damping Resistance . . . . . . . . . . . . . . . 11-6 Inductor Waveform Data Viewed with Derived Rise Time and Overshoot Data 11-7 RLC Filter Example Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8 Probe Plot of Capacitance vs. Bias Voltage . . . . . . . . . . . . . . . . . . 11-10 Example Schematic example.sch . . . . . . . . . . . . . . . . . . . . . . . 11-12 Example Schematic example.sch . . . . . . . . . . . . . . . . . . . . . . . . 12-6 Monte Carlo Analysis Setup for example.sch . . . . . . . . . . . . . . . . . . 12-7 Summary of Monte Carlo Runs for example.sch . . . . . . . . . . . . . . . . 12-8 Parameter Values for Monte Carlo Pass 3 . . . . . . . . . . . . . . . . . . . . 12-9 Pressure Sensor Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10 Model Definition for RMonte1 . . . . . . . . . . . . . . . . . . . . . . . . 12-13 Pressure Sensor Circuit with RTherm Model Definition Edited . . . . . . . 12-14 DC Analysis Setup Example . . . . . . . . . . . . . . . . . . . . . . . . . 12-15 Monte Carlo Analysis Setup Example . . . . . . . . . . . . . . . . . . . . . 12-15 Chebyshev Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17 Monte Carlo Analysis Setup Example . . . . . . . . . . . . . . . . . . . . . 12-17 1 dB Bandwidth Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19 Center Frequency Histogram . . . . . . . . . . . . . . . . . . . . . . . . . 12-20 Simple Biased BJT Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . 12-24 YatX Goal Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-25 Amplifier Netlist and Circuit File . . . . . . . . . . . . . . . . . . . . . . . 12-26 Correct Worst-Case Results . . . . . . . . . . . . . . . . . . . . . . . . . . 12-27 Incorrect Worst-Case Results . . . . . . . . . . . . . . . . . . . . . . . . . 12-27 Schematic Demonstrating Use of VARY BOTH . . . . . . . . . . . . . . . 12-28 Circuit File Demonstrating Use of VARY BOTH . . . . . . . . . . . . . . 12-28 Probe Window with Two Plot Windows . . . . . . . . . . . . . . . . . . . . 13-3 Example Schematic example.sch . . . . . . . . . . . . . . . . . . . . . . . 13-12 Probe Main Window with Loaded example.dat and Open Plot Menu . . . . 13-13 Output from Transient Analysis: Voltage at OUT2 . . . . . . . . . . . . . . 13-14 Zoom Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15 Probe Screen with Cursors Positioned on the Trough and Peak of the V(1) Waveform 13-20 Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-21 Viewpoint Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 Printpoint Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3 Setpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4
Tables
Table 1-1 Table 1-2 Table 1-3 Table 2-1 Table 3-1 Table 3-2 Table 3-3 Table 3-4 Table 3-5 Table 3-6 Table 3-7 Table 3-8 Table 5-1 Table 5-2 Table 5-3 Table 5-4 Table 5-5 Table 5-6 Table 5-7 Table 5-8 Table 5-9 Table 6-1 Table 6-2 Table 6-3 Table 6-4 Table 6-5 Table 6-6 Table 7-1 Table 7-2 Table 7-3 Table 7-4 Table 7-5
PSpice Standard Analysis Types . . . . . . . . . PSpice Simple Multi-Run Analysis Types . . . . PSpice Statistical Analysis Types . . . . . . . . . Association of Probe Cursors with Mouse Buttons Resistor, Capacitor, and Inductor Attributes . . . Transformers . . . . . . . . . . . . . . . . . . . . Transmission Lines . . . . . . . . . . . . . . . . Coupled Transmission Lines . . . . . . . . . . . Operators in Expressions . . . . . . . . . . . . . Functions in Arithmetic Expressions . . . . . . . System Variables . . . . . . . . . . . . . . . . . Analog Power Supplies . . . . . . . . . . . . . . Device Models Supported in the Parts Utility . . . Sample Diode Data Sheet Values . . . . . . . . . Resistors, Capacitors, and Inductors . . . . . . . . KBREAK Symbol . . . . . . . . . . . . . . . . . Transformers . . . . . . . . . . . . . . . . . . . . Ideal Switch Parts in breakout.slb . . . . . . . . . Intrinsically Modeled Semiconductor Parts . . . . Semiconductor Model Types . . . . . . . . . . . Semiconductor Part Attributes . . . . . . . . . . . Control System Parts . . . . . . . . . . . . . . . ABM Math Function Parts . . . . . . . . . . . . . ABM Expression Parts . . . . . . . . . . . . . . PSpice-Equivalent Parts . . . . . . . . . . . . . . Basic Controlled Sources in analog.slb . . . . . . Basic Controlled Source Attributes . . . . . . . . Classes of PSpice Analyses . . . . . . . . . . . . Execution Order for Standard Analyses . . . . . . PSpice Output Variable Formats . . . . . . . . . Element Definitions for 2-Terminal Devices . . . Element Definitions for 3- or 4-Terminal Devices
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 1-6 . 1-7 . 1-8 . 2-11 . 3-2 . 3-4 . 3-5 . 3-7 . 3-10 . 3-11 . 3-13 . 3-13 . 5-8 . 5-16 . 5-26 . 5-27 . 5-29 . 5-30 . 5-32 . 5-32 . 5-34 . 6-7 . 6-21 . 6-22 . 6-28 . 6-48 . 6-49 . 7-2 . 7-4 . 7-7 . 7-8 . 7-9
xxviii
Tables
Table 7-6 Table 7-7 Table 8-1 Table 8-2 Table 10-1 Table 11-1 Table 12-1 Table 13-1 Table 13-2 Table 13-3 Table 13-4 Table 13-5 Table 13-6 Table 13-7 Table 14-1
Element Definitions for Transmission Line Devices . . Element Definitions for AC Analysis Specific Elements DC Sweep Circuit Design Requirements . . . . . . . . Curve Family Example Setup . . . . . . . . . . . . . . Stimulus Parts Classified by Transient Specification . . Parametric Analysis Circuit Design Requirements . . . Collating Functions Used in Statistical Analyses . . . . Schematic Markers . . . . . . . . . . . . . . . . . . . . Mouse Commands for Cursor Control . . . . . . . . . . Keyboard Commands for Cursor Control . . . . . . . . Probe Output Variable Formats . . . . . . . . . . . . . Examples of Probe Output Variable Formats . . . . . . Probes Arithmetic Functions . . . . . . . . . . . . . . Output Units Recognized by Probe . . . . . . . . . . . Printpoint Symbols . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. 7-9 7-10 . 8-2 . 8-5 10-3 11-2 12-4 13-10 13-19 13-20 13-23 13-24 13-25 13-26 14-3
Welcome to MicroSim
Welcome to the MicroSim family of products. Whichever programs you have purchased, we are confident that you will find that they meet your circuit design needs. They provide an easy-to-use, integrated environment for creating, simulating and analyzing your circuit designs from start to finish.
iv
Typographical Conventions
Before using PSpice, it is important to understand the terms and typographical conventions used in this documentation. This guide generally follows the conventions used in the MicroSoft Windows Users Guide. Procedures for performing an operation are generally numbered with the following typographical conventions.
Notation
ALL CAPS C+ r monospace font
Examples
ANALOG.SLB or CLIPPER.SCH Press C+ r Type VAC...
Description
Library files and file names. A specific key or key stroke on the keyboard. Commands/text entered from the keyboard.
vi
Mouse Conventions
If you have a multiple-button mouse, the left mouse button is the primary mouse button, unless you have configured it differently. Point means to position the mouse pointer until the tip of the pointer rests on whatever you want to point to on the screen. Click means to press and then immediately release the mouse button without moving the mouse. Right-click means to press the right mouse button and then immediately release the mouse button without moving the mouse. Drag means to point and then hold down the mouse button as you move the mouse.
Related Documentation
vii
Related Documentation
The documentation for all MicroSim products is available in both hard-copy and on-line.
Manual Name*
MicroSim Schematics Users Guide MicroSim PCBoards Users Guide MicroSim PCBoards Autorouter Users Guide MicroSim PSpice A/D & Basics+ Users Guide
Description
Provides information about how to use MicroSim Schematics, which is a schematic capture front-end program with a direct interface to other MicroSim programs and options. Provides information about MicroSim PCBoards, which is a PCB layout editor that allows you to specify printed circuit board structure, as well as the components, metal and graphics required for fabrication. Provides information on the integrated interface to Cooper & Chyan Technologys (CCT) SPECCTRA autorouter in MicroSim PCBoards. Describes the capabilities of PSpice A/D, Probe, Stimulus Editor, and Parts utility. It provides examples for demonstrating the process of specifying simulation parameters, analyzing simulation data results, editing device stimuli, and creating models. Provides reference material for PSpice A/D. Also included: detailed descriptions of the simulation controls and analysis specifications, start-up option definitions, and a list of device types in the analog and digital model libraries. User interface commands are provided to instruct you on each of the screen commands. Provides a variety of articles that show you how a particular task can be accomplished using MicroSims products, and examples that demonstrate a new or different approach to solving an engineering problem. Provides information for using the PSpice Optimizer for analog performance optimization. Provides information for using programmable logic synthesis. Provides information about the implementation of a PLD design targeted for using one or more of AMDs devices. Provides information about designing electronic frequency selective filters. Provides a complete list of the analog and digital parts in the model and symbol libraries.
MicroSim Application Notes ** MicroSim PSpice Optimizer Users Guide MicroSim PLSyn Programmable Logic Synthesis MicroSim/AMD PLD Design System Users Guide MicroSim Filter Designer Users Guide Library Reference Manual**
*. On-line documentation is available only to those users who install MicroSim products by CD-ROM. **. This manual is provided in on-line format only.
viii
On-Line Help
Pressing 1 or selecting Contents from the Help menu brings up an extensive on-line help system. The on-line help includes:
Step-by-step instructions on how to use PSpice features. Reference information about PSpice. Technical Support information.
If you are not familiar with Windows (3.1, NT or 95) Help System, select How to Use Help from the Help menu.
ix
Feature Notable PSpice analysis and simulation features DC sweep, AC sweep, transient analysis noise, Fourier, temperature analysis parametric analysis Monte Carlo, sensitivity/worst-case analysis analog behavioral modeling (ABM) Stimulus Editor Parts utility performance analysis (goal functions) save/load bias point Notable PSpice devices and library models GaAsFETs: Curtice, Statz, TriQuint, Parker-Skellern MOSFETs: SPICE3 (1-3) with charge conservation, BSIM1, BSIM3 (version 2) IGBTs JFETs, BJTs
PSpice
resistor, capacitor, and inductor .MODEL support yes ideal, non-ideal lossy transmission lines coupled transmission lines nonlinear magnetics voltage- and current-controlled switches analog model library Purchase options MicroSim PCBoards MicroSim PSpice Optimizer Device Equations network licensing yes yes yes yes all yes yes yes 8500+
yes no no no
xi
PSpice
yes
no **
*. PSpice Basics package includes all libraries except SCRs, thyristors, PWMs, magnetic cores, and transmission lines. **. Unlimited circuit size means you can have as many components in your design as can be accommodated by your computers memoryrule-of-thumb is one Mb of RAM for every 400 transistors or 4,000 gates in the circuit. The PSpice Basics package is limited by the total device count: 100 large devices (all transistors and ABM devices) or 500 small devices
Schematic capture limited to one schematic page (A-size) Maximum of 25 symbols can be placed on a schematic Maximum of nine symbol libraries can be configured Maximum of 20 symbols in a user-created symbol library Circuit simulation limited to circuits with up to 64 nodes, 10 transistors, two operational amplifiers, or a combination thereof, and 10 ideal transmission lines with not more than four non-ideal lines (lossy lines using RLGC parameters) and four coupled lines Device characterization limited to diodes Sample library includes 22 analog parts
Part One
Simulation Primer
Part One provides basic information about circuit simulation and includes examples of common analyses. Chapter 1,Simulation Overview, provides an overview of the circuit simulation process and describes standard simulation analysis types. Chapter 2,Simulation Examples, includes examples of common analyses which provide an introduction to the methods and tools for entering circuit designs, running simulations with PSpice, and analyzing simulation results using Probe.
Simulation Overview
1
Chapter Overview
This chapter provides an overview of the circuit simulation process and describes standard simulation analysis types. Creating and Analyzing Circuits on page 1-2 describes the process of circuit simulation. The simulation process consists of creating and preparing a circuit for simulation, simulating a circuit with PSpice, and displaying simulation results. Analysis Types on page 1-6 describes the analysis types for PSpice.
1-2
Simulation Overview
The circuit schematic is created and prepared for simulation using MicroSim Schematics. Circuit simulation and analysis are performed by PSpice. Probe is used to display simulation results.
stimulus f global models
input waveforms
2 3
model definitions
MicroSim PSpice
simulation audit
output fil
MicroSim Probe
1-3
Circuit file set Model files Stimulus files Custom include files
Primary circuit file, which contains analysis commands, simulation control commands, and references to the netlist, alias, model, and other files required by the circuit to be simulated. Netlist file, which describes the components and connections of the circuit. Alias file, which maps the Schematics part and pin names to the simulator device and node names.
The filename of the primary circuit file is schematic.cir, where schematic is the name of the schematic. The filename of the netlist file is
Model files
Model files contain the electrical definition of the components of a schematic. Each model is comprised of an individual device or a subcircuit. Device models describe a primitive part by a set of parameters. Subcircuits are functional groupings of components to which elements in external circuits can be connected.
The most commonly used models are available in the MicroSim model library. If needed, however, you can create models. See Chapter 5 Creating Models for more
Stimulus files
Stimulus files are user-defined files containing analog stimulus waveform specifications. These can be automatically created using the Stimulus Editor utility or created manually. The creation of these files is transparent when specifying VSTIM, ISTIM, or DIGSTIM stimulus part instances in your schematic.
See The Stimulus Editor Utility on page 10-5 for a description of how to use the Stimulus Editor.
1-4
Simulation Overview
Simulation and analysis are performed by PSpice. The simulator interprets the information in the Schematics files for the circuit, runs the simulation, and produces the Probe data file and simulation output file. To simulate a circuit, the wire connections to the pins of parts shown in a schematic are transformed into electrical node connections to device terminals that are understood by the simulator. PSpice is a analog electrical circuit simulator that can calculate the behavior of analog circuits with speed and accuracy. PSpice simulates analog circuits and calculates voltages and currents of the devices and nodes. PSpice uses the files generated by Schematics to run the simulation, and produces a Probe data file and simulation output file.
1-5
program, Probe. As the simulation proceeds, the simulator updates the Probe data file with simulation results. Probe reads the data stored in the Probe data file and displays waveforms reflecting circuit response at marked nets, pins, and devices in your schematic or for output variables specified in Probe. The results can be further manipulated through expressions and search functions, and families of curves can be displayed on a single plot. Analyzing data in Probe can help you to determine the validity of your design. Both your schematic and simulation setup parameters can be refined based upon earlier results, thus creating an iterative process of running simulations and Probe analyses.
1-6
Simulation Overview
Analysis Types
PSpice circuit analyses can be classified as follows:
See Chapter 2,Simulation Examples, for introductory examples of how to run each type of analysis. See Part Three, Setting Up and Running Analyses, for a more detailed description of how to run each type of analysis.
Standard analyses
PSpice standard analyses include the following: Table 1-1 PSpice Standard Analysis Types
DC sweep Voltages and currents of the circuits steadystate response are calculated where a source, model parameter, or temperature is swept over a range of values. Additional bias point data is calculated and reported (bias point is computed automatically by PSpice). Calculates the DC sensitivity of a node or components voltage as a function of bias point. Calculates small-signal DC gain, input resistance, and output resistance as a function of bias point. Calculates the small-signal response of the circuit, linearized around the bias point, to a combination of inputs. One or more sources are swept over a range of frequencies. The voltages and currents of the circuit are calculated, including magnitude and phase. This can be used to obtain Bode plots.
DC sensitivity
Analysis Types
1-7
Table 1-1
Noise analysis
Temperature
1-8
Simulation Overview
Statistical analyses
Two PSpice analyses are provided that allow device and lot tolerances to be applied to device models, resulting in multiple runs of the specified DC sweep, AC sweep, or transient analysis. The statistical analyses provided are: Table 1-3 PSpice Statistical Analysis Types
Monte Carlo Computes circuit response to changes in component values by randomly varying all device model parameters for which a tolerance has been specified. Computes circuit response to changes in component values by varying one device model parameter (where a tolerance is specified) at a time on a device by device basis, culminating in a single run where all model parameters for all devices are set to their worst-case values.
Sensitivity/ worst-case
Simulation Examples
2
Chapter Overview
The examples in this chapter provide an introduction to the methods and tools for entering circuit designs, running simulations with PSpice, and analyzing simulation results using Probe. All analyses are performed on the same example circuit. This allows for a clearer illustration of analysis setup, simulation, and result analysis procedures for each analysis type. This chapter includes the following sections: Example Circuit Design Entry on page 2-2 Bias Point Analysis on page 2-6 DC Sweep Analysis on page 2-9 Transient Analysis on page 2-14 AC Sweep Analysis on page 2-18 Parametric Analysis on page 2-22 Probe Performance Analysis on page 2-28
2-2
Simulation Examples
New icon:
1 2
Select Get New Part from the Draw menu to display the Part Browser dialog box. Type VDC in the Part Name text box. Click on Place & Close. Move the cursor to position the source at the desired location on the schematic page.
If you have enough room on your screen, click on Place to leave the Part Browser dialog box open.
3 4
2-3
5 6 7
Click to place the first source. Move the cursor and click again to place the second source. Right-click to end placement mode.
To move the text associated with the diodes (or any other object)
1 2 Click once on the text to select it. Drag the text to the desired location.
Select Redraw from the View menu or press C+l to redraw the circuit as necessary.
2-4
Simulation Examples
1 2
Select Wire from the Draw menu to enter wiring mode. The cursor changes to a pencil. Click on the connection point (the very end) of the pin on the bubble at the input of the circuit. Click on the nearest connection point of the input resistor R1. Connect the other end of R1 to the output capacitor. Connect the diodes to each other and to the wire between them: a b Click on the connection point of the anode for the lower diode. Move the cursor straight up and click on the wire between the diodes. The wire terminates and the junction of the wire segments is made visible. Click again on the junction to continue wiring Click on the end of the upper diodes cathode pin.
You can right-click at any time to stop the wiring mode. The cursor changes to the default arrow. If necessary, double-right click or press s to resume wiring mode. The cursor changes back to a pencil. Clicking on any valid connection point terminates a wire. A valid connection point is shown as an x (see Figure 2-2).
3 4 5
Continue connecting components until the circuit is wired as shown in Figure 2-1 on page 2-2.
2 Press X.
2-5
3 Click on OK.
2-6
Simulation Examples
After creating the schematic clipper.sch, you can run PSpice by selecting Simulate from the Analysis menu. PSpice performs the simulation and generates the output file (clipper.out). While PSpice is running, the progress of the simulation is displayed in the PSpice simulation status window (see Figure 2-3).
2-7
Figure 2-4 Simulation Output File Since the diodes are both reverse biased (off), and the input source Vin is 0V (a short circuit to ground), the bias point is dependent only on the values of VCC, R1, R2, and R3.
where:
R1 R3 Req = ----------------------R1 + Req
Correct, expected bias point analysis results provide assurance of proper circuit connectivity.
2-8
Simulation Examples
Note that the current through VIN is negative. By convention, PSpice measures the current through a two terminal device into the first terminal and out of the second terminal. For voltage sources, current is measured from the positive terminal to the negative terminal; this is opposite to the positive current flow convention and results in a negative value.
Voltage Viewpoint
The VIEWPOINT symbol was initially a blank line. When the simulation is finished and bias point voltages are available, the viewpoint reflects the voltage at the net to which it was connected (in this case, the voltage at the node Mid is 0.9434).
DC Sweep Analysis
2-9
DC Sweep Analysis
You can visually verify the DC response of the clipper by performing a DC sweep of the input voltage source and displaying the waveform results in Probe. This example sets up DC sweep analysis parameters to sweep Vin from -10 to 15 volts in 1 volt increments.
Note
The default settings for the DC Sweep dialog box are Voltage Source as the swept variable type and Linear as the sweep type. To select a different swept variable type or sweep type, click on the appropriate radio button.
Figure 2-5 DC Sweep Dialog
Box
4 5 6 7
Click on OK to exit the DC Sweep dialog box. If needed, click on the DC Sweep check box in the Analysis Setup dialog box so that it is checked on (enabled). Click on Close to exit the Analysis Setup dialog box. Click on the Save icon. You can also save the circuit under a different name. To save the circuit as clipperd.sch, for example, select Save As from the File menu in the schematic editor and enter clipperd as the file name.
Save icon:
To run the analysis as specified, select Simulate from the Analysis menu.
Shortcut: Click on !.
or press
2-10
Simulation Examples
If Probe is set up to automatically run upon successful completion of a simulation (the default setting), then the Probe window is displayed when the simulation is finished. The Probe window displays a plot screen like the one shown in Figure 2-6.
2 3 4 5
In Schematics, select Mark Voltage/Level from the Markers menu. Click to place the first marker on net In. Click to place the second marker on net Mid. Right-click to end marker mode. Waveform traces are displayed as shown in Figure 2-7.
Labels are included in Figure 2-7 for informational purposes only. Refer to the Schematics Users Guide for a description of how to add labels.
trace legend
This example uses the cursors feature to view the numeric values for two traces and the difference between them by placing a cursor on each trace.
2-12
Simulation Examples
In the trace legend, the symbol for V(In) is outlined in the crosshair pattern for each cursor, resulting in a dashed line as shown in Figure 2-8. 3 Place the first cursor on the V(In) waveform: a Click on the portion of the V(In) trace in the proximity of 4 volts on the X axis. The cursor cross-hair is displayed, and the current X and Y values for the first cursor are displayed in the Probe Cursor window. To fine-tune the cursor location to 4 volts on the X axis, drag the cross-hairs until the corresponding entry in the Probe Cursor window is approximately 4.0 for the X axis value of the A1 cursor. You can also press r and l for tighter control. Associate the second cursor with the Mid waveform by right-clicking on the trace legend symbol for V(Mid) (on the diamond). The crosshair pattern for the second cursor outlines the V(Mid) trace symbol as shown in Figure 2-9. Right-click on the portion on the V(Mid) trace that is in the proximity of 4 volts on the X axis. The X and Y values for cursor 2 are displayed in the Probe Cursor window along with the difference between the two cursors X and Y values. To fine-tune the location of the second cursor to 4 volts on the X axis, drag the cross-hairs until the corresponding entry in the Probe Cursor window is approximately 4.0 for the X axis value of the C2 cursor. You can also press V+r and V+l for tighter control.
Your ability to get as close to 4.0 as possible depends on screen resolution and window size.
There are other ways to display the difference between two voltages at a trace: By plotting V(In)-V(Mid) in Probe By selecting Mark Voltage Differential from the Markers menu in Schematics
Figure 2-10 shows the Probe window when both cursors are placed.
Figure 2-10 Voltage Difference at V(In) = 4 Volts At this point, the schematic has been saved. If needed, you can close Schematics and Probe and begin the remaining analysis exercises later using the saved schematic.
2-14
Simulation Examples
Transient Analysis
This example shows how to run a transient analysis on the clipper circuit. This requires adding a time-domain voltage stimulus as shown in Figure 2-11.
In Schematics, select Clear All from the Markers menu. Select the ground symbol beneath the VIN source. Select Cut from the Edit menu. Scroll down or select Out from the View menu (or click on the Zoom Out icon). Place a VSTIM symbol as shown in Figure 2-11. Select Paste from the Edit menu. Place the ground symbols as shown in Figure 2-10. Select Fit from the View menu. Select Save As from the File menu, and save the file as
clippert.sch.
2 3 4 5 6 7 8 9
4 Click on OK.
Transient Analysis
2-15
11 When prompted to name the stimulus, type SINE and click on OK. 12 In the New Stimulus dialog box of the Stimulus Editor, click on SIN, and click on OK. 13 In the Stimulus Attributes dialog box, set the first three parameters as follows: Offset Voltage = 0 Amplitude = 10 Frequency = 1kHz 14 Click on Apply to view the waveform. The Stimulus Editor window should look like Figure 2-12.
Figure 2-12 Stimulus Editor Window 15 Click on OK. 16 Click on the Save icon or press V+@ to save the stimulus information. 17 Select Exit from the File menu.
Save icon:
2-16
Simulation Examples
In Schematics, click on the Analysis Setup icon or select Setup from the Analysis menu to display the Analysis Setup dialog box. Click on Transient to display the Transient Analysis dialog box. Set up the Transient dialog box as shown in Figure 2-13. Click on OK. If needed, click on Transient check box in the Analysis Setup dialog box so that it is checked on (enabled). If needed, disable DC sweep from the previous example by clicking on the DC Sweep check box so that it is not checked. DC Sweep is disabled here so that you can see the results of a transient analysis run by itself. PSpice can run multiple analyses during simulation, and you could run both DC sweep and transient analyses.
2 3 4 5 6
7
Save icon: Simulate icon:
Click on Close to exit the Analysis Setup dialog box. Click on the Save icon. Click on the Simulate icon or press ! to start the simulation.
8 9
PSpice uses its own internal time steps for computation. The internal time step is adjusted according to the requirements of the transient analysis as it proceeds. Data is saved to the Probe data file for each internal time step. Note
The internal time step is different from the Print Step value. Print Step controls how often optional text format data is written to the simulation output file (.OUT).
Transient Analysis
2-17
To display the output variable list with aliases and display desired traces in Probe
1 2 3 4 Select Add from the Trace menu. (You can also click on the Add Trace icon or press I.) Select V(Out) and V(In) by clicking on them in the trace list. Click on OK. The traces are displayed. Place the symbols shown in the trace legend on the traces themselves as shown in Figure 2-14: a b c 5 Select Options from the Tools menu. Click on Always in the Use Symbols portion of the dialog box. Click on OK.
This portion of the example describes how to view the input sine wave and the clipped wave at Out. The output variable list is used as an alternative to markers to select the traces to be displayed.
Save icon:
2-18
Simulation Examples
AC Sweep Analysis
The AC sweep analysis in PSpice is a linear (or small signal) frequency domain analysis which can be used to observe the frequency response of any circuit at its bias point.
Double-click on the displayed (AC) value of the new Vin. In the Set Attr Value dialog box, set the value to 1V.
Note
PSpice is not case sensitive, so both M and m can be used as milli, and MEG, Meg, and meg can all be used for mega.
4 5 6 7 8 9
Click on OK to close the AC Sweep dialog box. Click on Close to close the Analysis Setup dialog box. Select Mark Advanced from the Markers menu. Double-click on vdb. Place one Vdb marker on the output node, and place another on the Mid node. Select Save As from the File menu, and save the schematic as clippera.sch.
Simulate icon:
10 Click on the Simulate icon or press ! to start the simulation. Since the transient analysis was not deactivated, PSpice performs both the transient and AC analyses.
2-20
Simulation Examples
Note
Depending upon where the vphase marker was placed, the trace name may be different, such as VP(Cout:2), VP(R4:1), or VP(R4:2).
7 8 9
Select Cut from the Edit menu. Select Add Y Axis from the Plot menu. Select Paste from the Edit menu. The Bode plot is displayed as shown in Figure 2-18.
or press or press
2-22
Simulation Examples
Parametric Analysis
This example shows the effect of varying input resistance on the bandwidth and gain of the clipper circuit. This is done by:
Changing the value of R1 to the expression {Rval} Adding a PARAM symbol to declare the parameter Rval Specifying a parametric analysis to step the value of R1 via Rval
Figure 2-19 Clipper Circuit with Global Parameter Rval The example results in 21 analysis runs, each with a different value of R1. Once the analysis is complete, you can analyze curve families for the analysis runs in Probe.
Parametric Analysis
2-23
2-24
Simulation Examples
To set up and run a parametric analysis to step the value of R1 via Rval
Analysis Setup icon:
1 2 3 4 5 6 7
Click on the Analysis Setup icon or select Setup from the Analysis menu to display the Analysis Setup dialog box. Click on Parametric. Set up the Parametric dialog box as shown in Figure 2-20. Click on OK. If needed, click on the Parametric check box in the Analysis Setup dialog box so that it is checked on (enabled). Click on the Transient check box so that it is not checked. Click on Close to close the Analysis Setup dialog box. Select Save As from the File menu, and save the schematic as clipperp.sch. Delete the VP marker. (For this example, we are only interested in the magnitude of the response.)
8 9
Parametric Analysis
2-25
To see more information about the section which produced a specific trace, double-click on the corresponding symbol in the legend below the X axis.
Figure 2-21 Small Signal Response as R1 is Varied from 100 to 10 k 2 To remove the traces shown, click on the trace name to select it and then press X.
You can also remove the traces by deleting the VDB marker in Schematics.
2-26
Simulation Examples
Note
The difference in gain is apparent, you can also plot the difference of the waveforms for runs 21 and 1 and then use the search commands feature to find certain characteristics of the difference.
3 4
Shortcut: Click on I. or press
Delete the two traces. Plot the new trace by specifying a waveform expression: a b Select Add from the Trace menu. Type the following waveform expression in the Trace Command text box:
Vdb(Out)@1-Vdb(OUT)@21
c 5
Shortcut: Click on Shortcut: Click on Shortcut: Click on . . .
Click on OK.
Use the search commands feature to find the value of the difference trace at its maximum and at a specific frequency: a b c d Select Cursor from the Tools menu, and then select Display. Select Cursor from the Tools menu, and then select Max. Select Cursor from the Tools menu, and then select Search Commands. Enter the following search command:
search forward x value (100)
This command instructs Probe to search for the point on the trace where the X axis value is 100.
e f
Figure 2-22 shows the Probe window when the cursors are placed. Note that the Y value for cursor 2 shown in the cursor box at the lower right is about 17.87. This indicates that when R1 is set to 10 k, the small signal attenuation of the circuit at 100Hz is 17.87dB greater than when R1 is 100. 6 Deactivate the cursors and delete the trace to prepare for the next exercise.
Parametric Analysis
2-27
Figure 2-22 Comparison of Small Signal Frequency Response at 100 and 10 k Input Resistance
2-28
Simulation Examples
2 3 4
5 6 7
Change the X-axis to log scale. a b c Select X Axis Settings from the Plot menu. Select Log in the Scale list box. Click on OK.
Shortcut: Double-click on the X axis.
The Trace list includes goal functions only in performance analysis mode when the X-axis variable is the swept parameter.
Figure 2-23 shows the final performance analysis plot of 3dB bandwidth and gain in dB vs. the swept input resistance value.
Figure 2-23 Performance Analysis Plots of Bandwidth and Gain vs. Rval For more information about performance analysis, see Example: RLC Filter on page 11-3.
Part Two
Design Entry
Part Two provides information about entering circuit designs in MicroSim Schematics. Chapter 3,Preparing a Schematic for Simulation, provides information to help you enter circuit designs that simulate properly. Chapter 4,Creating Symbols, provides information about creating symbols. Symbols are the graphical representation of circuit components. Chapter 5,Creating Models, provides information about creating models. Models define the electrical behavior of schematic components for purposes of simulation. Chapter 6,Analog Behavioral Modeling, describes how to use Analog Behavioral Modeling (ABM) feature provided in PSpice.
3
Chapter Overview
This chapter provides information to help you enter circuit designs that simulate properly. Passive Parts on page 3-2 describes setup information for a variety of analog parts. For a listing of standard library components, refer to the on-line Library Reference Manual. Parameters and Expressions on page 3-9 describes how to use parameters and expressions in place of literal values. Analog Power Supplies on page 3-13 describes setup information for DC sources.
The information in this chapter supplements the information in the Schematics Users Guide. The Schematics Users Guide describes how to use Schematics to create circuit schematics, and this chapter includes additional information to help you set up components to ensure proper simulation of the schematic.
3-2
Passive Parts
This section describes setup information for a variety of analog parts. For a listing of standard library components, refer to the on-line Library Reference Manual.
C_VAR
VALUE SET
analog.slb analog_p.slb
VALUE IC
analog.slb analog_p.slb
R_VAR
*. The Symbol Library file ANALOG_P.SLB contains R, L, C, R_VAR, and C_VAR symbols with visible pin numbers. To use the symbols in this file instead of those in ANALOG.SLB, use Editor Configuration on the Options menu to add ANALOG_P.SLB to the list of configured Symbol Library files before the ANALOG.SLB file entry. Refer to the Schematics Users Guide for a description of how to use Editor Configuration.
Passive Parts
3-3
For the standard R, C, and L parts, the effective value of the part is set directly by the VALUE attribute. For the variable resistors and capacitors, R_VAR and C_VAR, the effective value is the product of the base value (VALUE) and multiplier (SET). In general, resistors, capacitors, and inductors should have positive component values (VALUE attribute). In all cases, components must not be given a value of zero. However, there are cases when negative component values are desired. This occurs most often in filter designs that analyze an RLC circuit equivalent to a real circuit. When transforming from the real to the RLC equivalent, it is possible to end up with negative component values. PSpice allows negative component values for bias point, DC sweep, AC, and noise analyses. In the case of resistors, the noise contribution from negative component values come from the absolute value of the component (components are not allowed to generate negative noise). A transient analysis may fail for a circuit with negative components. The negative components, especially negative-valued capacitors and inductors, may create instabilities in time which the analysis cannot handle.
3-4
Transformers
Table 3-2 lists attributes that can be set per instance of a linear transformer part. For additional information:
See Transformers on page 5-29. See Using the Inductor Coupling Symbols in the Application Notes Manual for a description of techniques for creating additional transformer configurations. See Using the KBREAK symbol in a schematic on page 5-27 for information about using nonlinear magnetic cores with transformers.
Table 3-2
Part Type
Transformers
Symbol Name XFRM_LINEAR Symbol Library File analog.slb Attribute L1_VALUE L2_VALUE COUPLING Description winding inductances in Henries coefficient of mutual coupling (must lie between 0 and 1) inductor reference designator
K_LINEAR
analog.slb
Ln
Passive Parts
3-5
Transmission Lines
Ideal and lossy transmission lines
Table 3-3 lists the attributes that can be set per instance of an ideal (T) or lossy (TLOSSY) transmission line. The parts contained in the tline.slb symbol file contain a variety of transmission line types. Their part attributes vary. Table 3-3
Part Type transmission line (PSpice T device)
Transmission Lines
Symbol Name T Symbol Library File analog.slb Attribu te Z0 TD F NL TLOSSY* analog.slb LEN R L G C Description characteristic impedance transmission delay frequency for NL number of wavelengths or wave number electrical length per unit length resistance per unit length inductance per unit length conductance per unit length capacitance
PSpice uses a distributed model to represent the properties of a lossy transmission line. That is, the line resistance, inductance, conductance, and capacitance are all continuously apportioned along the lines length. A common approach to simulating lossy lines is to model these characteristics using discreet passive elements to represent small sections of the line. This is the lumped model approach, and it involves connecting a set of many small subcircuits in series as shown in Figure 3-1. This method requires that enough lumps exist to adequately represent the distributed characteristic of the line. This often results in the need for a large netlist and correspondingly long simulation time. The method also
3-6
produces spurious oscillations near the natural frequencies of the lumped elements.
Figure 3-1 Lossy Line Comprised of Lumped Line Segments The distributed model used in PSpice frees you from having to determine how many lumps are sufficient, and eliminates the spurious oscillations. It also allows lossy lines to be simulated with the same accuracy in a fraction of the time required by the lumped approach. In addition, you can make R and G general Laplace expressions. This allows frequency dependent effects to be modeled, such as skin effect and dielectric loss.
Passive Parts
3-7
Table 3-4
Part Type
tline.slb
LEN R L G C LM CM
KCOUPLE2
tline.slb
T1 T2 LM CM
T1 T2 T3 LMij CMij
*. T2COUPLEDX is functionally identical to T2COUPLED. However, the T2COUPLEDX implementation uses the expansion of the subcircuit referenced by T2COUPLED.
3-8
ideal lines low-loss lossy lines systems of homogeneous, equally spaced high-loss lines
For more information about the K device, refer to the PSpice Reference Manual.
Simulation considerations
When simulating, transmission lines with short delays can create performance bottlenecks by setting the time step ceiling to a very small value. If one transmission line is setting the time step ceiling frequently, PSpice reports the three lines with the shortest time step. The percentage attenuation, step ceiling, and step ceiling as percentage of transmission line delay are displayed in the PSpice status window. If your simulation is running reasonably fast, you can ignore this information and let the simulation proceed. If the simulation is slowed significantly, you may want to abort the simulation and modify your design. If the line is lossy and showing negligible attenuation, model the line as ideal instead.
3-9
Note The system variables in Table 3-7 on page 3-13 have reserved parameter names. User-defined parameters should not use these parameter names.
By using parameters, multiple devices can respond to a change in that parameter. For instance, if a second independent source, VEE, also has its value set to {VSUPPLY} as well, then both sources can be changed to 14 volts by simply reassigning the VALUE1 attribute of the PARAM pseudocomponent to 14V.
3-10
Expressions
Additional flexibility can be provided by using parameters in expressions. See Parameters on page 3-9 for more information about parameters.
In many applications, it is helpful to have more flexibility in setting up values by using expressions in place of literal values. For example, an independent source, VEE, could have its VALUE attribute defined as:
VALUE = {-10*FACTOR}
where FACTOR is assigned the value of 1.2 using a PARAM pseudocomponent. The value for VEE resolves to (-10 * 1.2) or -12.0 volts. Expressions can contain the standard operators listed in Table 3-5, the functions in Table 3-6, and the system variables listed in Table 3-7. The simulator accepts expressions of any length, but MicroSim Schematics imposes some length limits. Part attribute definitions, for example, are limited to 1,024 characters in Schematics. In such cases, it is appropriate to define custom functions for expressions, thus decreasing length and improving readability. The simulator evaluates expressions upon reading in the entire circuit file set. Parameter values that change as an analysis proceeds (a DC sweep or parametric analysis, for example) cause the simulator to reevaluate the expression at that time. Table 3-5 Operators in Expressions
Type arithmetic Operato rs + * / ** Meaning addition (or string concatenation) subtraction multiplication division exponentiation
3-11
Table 3-5
Type
Table 3-6
Function ABS(x) SQRT(x) EXP(x) LOG(x) LOG10(x) PWR(x,y) PWRS(x,y) SIN(x) ASIN(x) SINH(x) COS(x) ACOS(x) COSH(x) TAN(x) ATAN(x) ARCTAN(x) ATAN2(y,x) TANH(x)
sin(x) sin-1 (x) sinh (x) cos (x) cos-1 (x) cosh (x) tan (x) tan
-1 (x)
x in radians result in radians x in radians x in radians result in radians x in radians x in radians result in radians
3-12
time derivative of x applicable to transient analysis only time integral of x y value as a function of x minimum of x and y maximum of x and y min if x < min max if x > max else x +1 if x > 0 0 if x = 0 -1 if x < 0 1 if x > 0 0 otherwise used to suppress a value until a given amount of time has passed; for example, {v(1)*STP(TIME-10ns) gives a value of 0.0 until 10 nsec has elapsed, then gives v(1) t is a relational expression using the relational operators shown in applicable to transient analysis only xn,yn point pairs are plotted and connected by straight lines
SGN(x)
STP(x)
IF(t,x,y)
x if t is true y otherwise
Table 3-5
3-13
Table 3-7
Variab le TIME
System Variables
Applicability Time values resulting from a transient analysis. If no transient analysis is run, this variable is undefined. TIME can only be used in analog behavioral modeling expressions.
Creating Symbols
4
Chapter Overview
This chapter provides information about creating symbols. Symbols are the graphical representation of circuit components. When you create a new symbol in the symbol editor, you need to define the graphics and pins of the symbol and the symbol attributes. You also must define a device model or subcircuit if the symbol will be simulated and a package definition if it will be used with a board layout package. Creating a New Symbol on page 4-2 describes how to create a symbol and define graphics and attributes for the symbol. Linking a Symbol to a Model or Subcircuit Definition on page 4-12 describes how to link a symbol to the model or subcircuit which defines the simulation behavior of the part. Adding New Symbols from a Vendor on page 4-14 describes how to set up symbols created by a vendor.
4-2
Creating Symbols
Creating the symbol Defining symbol graphics Defining attributes for the symbol
Creating a Symbol
There are two ways to create a new symbol:
The symbol library contains graphical descriptions of all devices found in the model library.
Copy an existing symbol from the symbol library and modify it as needed Create a new symbol from scratch
If there is an existing symbol similar to the one you want to create, it is normally quicker and easier to create the new symbol by copying and modifying the existing symbol. It is recommended that you create a separate symbol library file for new symbols rather than modify any of the original symbol library files.
Select Edit Library from the File menu to access the symbol editor. The currently selected symbol library is indicated in the title bar of the symbol editor window. If you want the new symbol to be in an existing user library: a b Select Open from the File menu. Select the library file to open and click on OK.
In the symbol editor, select Copy from the Part Menu and click on the Select Lib button.
In the Open dialog box, click on the symbol library file which contains the symbol you wish to copy, then click on OK. At the Copy Part dialog box, scroll through the part list in the lower right corner and click on the symbol you want to copy. Make sure that you copy a base part rather than an AKO part. When you click on the desired part, the part name appears in both the Existing Part Name and New Part Name fields. Modify the New Part Name field as desired, then click on OK. The symbol is displayed. Select Attributes from the Part menu. Click on the PART attribute so that it is selected. In the VALUE text box, type the name to display on the symbol. If the symbol has a MODEL attribute, click on it and set the value to the exact name of the model (.MODEL or .SUBCKT name). Make sure attributes have been changed. Select Save As from the File menu (for a new file) or Save (if you opened an existing file in step 2).
An AKO part cannot exist in a symbol library file without the base part that it references. If you want to copy an AKO part, first copy the base, then the AKO. Be sure to configure the model library using Library and Include Files on the Analysis menu in Schematics.
Select New from the Part menu to define the part name, description, and other information for the symbol. Click on OK when finished.
4-4
Creating Symbols
Origin
The origin is used when placing a part and is the center point used when rotating a part. The symbol origin is defined using Origin on the Graphics menu in the symbol editor. By convention, the origin of each symbol in the symbol library is placed at the hot-spot of the upper leftmost pin on the device. The hot-spot is the point of connection to a wire or to another pin. The origin is maintained as a point of reference on the schematic. If you change the origin of a symbol, thus changing the location of the symbol graphics and pins, relative to that point, then the symbol graphics and pins are relocated accordingly when a schematic is edited.
Bounding box
The bounding box determines the selection area for a part. When you click on a part in MicroSim Schematics, the area in which you can click and have that part be selected is defined by the bounding box of the symbol. The symbol bounding box is defined using Bbox on the Graphics menu in the symbol editor. By convention, the bounding box contains the complete symbol (graphics and pins). You will get a warning if you try to save a symbol which has any pins outside the bounding box. All visible pins must be contained within the bounding box in order to make proper connections. The bounding box should be no larger than necessary. If a parts bounding box is larger than necessary, then part selection in the schematic editor can be difficult for parts placed close together.
The bounding box should only contain the symbol graphics and visible pins.
Grid spacing
The grid spacing in the symbol editor can be changed when higher resolution is desired for creating graphics in a tighter grid. Grid spacing is defined using Display Options on the Options menu in the symbol editor. The default grid spacing is set at 0.1", and the minimum grid spacing is 0.01". If you change the grid spacing, be sure to set the grid spacing back to the default before placing pins. Pins must be placed on the grid at 0.1" intervals from the origin of the symbol and at least 0.1" from any adjacent pins. Pins that are not at 0.1" intervals from the origin are considered offgrid, and a warning is displayed if you try to save a symbol with one or more pins off-grid.
4-6
Creating Symbols
This section describes the following attributes: MODEL, below SIMULATION ONLY, below TEMPLATE on page 4-7
MODEL
This attribute indicates the name of the model referenced for simulation. The MODEL name should match the name of the .MODEL or .SUBCKT definition of the simulation model as it appears in the PSpice model library file (.lib). For example, your design could include a 2N2222 bipolar transistor with a .MODEL name of Q2N2222. The MODEL attribute on the symbol for that part should be Q2N2222. This MODEL attribute can then be referenced in the TEMPLATE attribute. In the schematic editor Edit Attributes dialog box, the MODEL attribute is marked with an asterisk and cannot be changed. You can change the MODEL attribute the following ways:
Use Model on the Edit menu item in the schematic editor to either change the model reference or to create an instance model. To edit the underlying model definition of a part, use Model on the Edit menu in the symbol editor.
SIMULATION ONLY
If present, this attribute indicates that the part only has meaning for simulation. The SIMULATION ONLY attribute identifies parts such as voltage and current sources, breakout devices (found in breakout.slb), and special symbols (found in special.slb).
TEMPLATE
This attribute defines how to create a netlist entry for PSpice. The pin names specified in the TEMPLATE attribute must match the pin names on the symbol. The number and order of the pins listed in the TEMPLATE attribute must match those appropriate for the associated .MODEL/.SUBCKT definition referenced for simulation. In the schematic editor Edit Attributes dialog box, the TEMPLATE attribute is marked with an asterisk and cannot be changed. To change the TEMPLATE attribute, use Model on the Edit menu in the symbol editor. The TEMPLATE contains regular characters that are copied to the netlist, and special items such as attributes, that are translated before being copied to the netlist. The translation process is repeated until there are no more attributes left in the template. Regular characters include alphanumerics, $ and _, white space, and some punctuation marks. An identifier is taken to mean an alphabetic character followed by zero or more alphanumeric characters, $ or _. Attribute names are denoted by an identifier preceded by one of the following special characters:
@ ? ~ # &
Connectors For board layout purposes, connectors are treated as parts (and may be packaged, in the case of a multi-pin connector). For simulation purposes, connectors do not play any part other than to provide one or more pins where Probe markers might be placed. Connectors are indicated by having a PKGREF attribute but no TEMPLATE attribute. If you create a connector symbol, be sure to delete the automatically provided TEMPLATE attribute from the attribute list in the symbol editor.
replaced by the value of <id>. Error if no <id> attribute or if no value assigned. replaced by the value of <id> if <id> defined. replaced by text between s...s if <id> defined. replaced by text between s...s if <id> undefined. like ? but delete rest of template if <id> undefined.
4-8
Creating Symbols
In the above, s can be any non-regular character. These conditional attribute constructs can be nested by using different separator characters. The ^ character is also special. It is replaced by the complete hierarchical path to the device being netlisted. The sequence \n is replaced by a new line. This allows a multiline netlist entry to be generated from a one-line template. Pin names are indicated by a % character followed by one or more regular characters. A pin name in the template is replaced by the name of the node connected to that pin. The pin name is everything after the % to a separator (white space or comma). Some characters in pin names are translated to avoid problems with Probe: < > = \XXX\ is replaced by l (L) is replaced by g is replaced by e is replaced by XXXbar
To enter a % character into the netlist output, enter %% in the template. Any devices generated from a netlist template must start with a letter acceptable to PSpice for that particular kind of device (such as Q for a bipolar transistor). To ensure this, templates for devices in the Symbol Library start with a prefix letter, followed by the hierarchical path, and then the reference designator (REFDES) attribute. For example:
R^@REFDES
We strongly recommend that users adopt this scheme when generating their own netlist templates.
A device with REFDES = R23 and VALUE = 1k connected to nodes abc and def would generate:
R_R23 abc def 1k
A device with REFDES = V6 connected to nodes vp and vm, with DC set to 5v and AC undefined would generate:
V_V6 vp vm DC=5v
A device U33 connected to nodes 101 and 102, and with G set to 1024 would generate:
X_U33 101 102 Z PARAMS: G=1024
4-10
Creating Symbols
The number and sequence of pins named in a subcircuits template must agree with the definition of the subcircuit itself. To see how this works, consider the following first line of a (hypothetical) subcircuit definition:
.SUBCKT GIMMICK 10 3 27 2
The four numbers following the name GIMMICK are node numbers. These nodesand only theseare to be brought out as pins. Thus, this subcircuit has four pins, corresponding to the four nodes shown. Now suppose that the symbol definition shows four pins: IN+ OUT+ OUTIN-
The number of pins on the symbol equals the number of nodes in the subcircuit definition (namely, four). Now suppose that the correspondence between pin names and nodes is to be as follows:
Node Number 10 3 27 2
X^@REFDES %IN+ %IN- %OUT+ %OUT- @MODEL Every term beginning with a % sign refers to a pin. In fact, each pin entry consists of the pins name preceded by the % sign. Note that the template contains the correct number of pins (four), as well as the correct sequence of pin names.
must equal
must equal
must match
must match
* Unmodeled pins may appear on a symbol (like the two voltage offset pins on a 741 opamp symbol). Such pins are not netlisted, and do not appear on the template. Figure 4-1 Rules for Pin Callout in Subcircuit Templates
4-12
Creating Symbols
When the electrical behavior of a part is described by a model, the associated model is identified by the MODEL attribute for the part symbol. To tell PSpice where to find the model library file containing the definition of the simulation model referenced, use Library and Include Files on the Analysis menu in the schematic editor. In the Library and Include Files dialog box, the files listed must be in a directory on the library search path or be specified with a complete path. You can display or modify the library search path using Editor Configuration on the Options menu in the schematic editor.
When the electrical behavior of a part is described by a subcircuit, the associated subcircuit is identified by the MODEL attribute for the part symbol. In the standard symbol and model libraries, the symbol name and corresponding subcircuit name are identical. This
4-13
convention should be followed when creating user-defined parts with subcircuit definitions. If the subcircuit has variable input parameters using the PARAMS: construct, the part symbol must have corresponding attributes which can be optionally set on a part instance basis. For example, the LM7805C subcircuit definition in the model library has two variable parameters: Av_feedback and Value as defined in the following .SUBCKT statement:
.SUBCKT LM7805C Input Output Ground x1 Input Output Ground x_LM78XX PARAMS: + Av_feedback=1665, R1_Value=1020
These part symbols also have a TEMPLATE attribute, which defines how Schematics should translate the attributes of a given part instance into an X (subcircuit) device declaration written to the netlist. A LM7805C TEMPLATE is defined in a single line of text as:
TEMPLATE=X^@REFDES %IN %OUT %COMMON @MODEL
X^@REFDES instructs Schematics to substitute the hierarchical (if applicable) reference designator for this part instance prefixed with the letter X, thus producing a simulatorcompatible subcircuit device. Template items preceded by a % character produce simulator compatible node names. The required connecting terminals must be listed in the order specified in the subcircuit definition. In this example, %IN, %OUT, and %COMMON reflect the exact order of the terminals in the LM7805C .SUBCKT definition. @MODEL is substituted with the subcircuit name LM7805C. When creating a subcircuit definition for a new part (rather than modifying an existing part symbol or part instance), you need to create a new part symbol (and possibly a package definition), being sure to define all of the appropriate attributes.
4-14
Creating Symbols
The model and symbol are required in all cases, but the package is required only if you are packaging your design to go to a PCB layout program.
Model Library
All .MODEL and .SUBCKT statements are kept in the model library. By convention, this file has a .lib extension. If you receive new models from a vendor, they may be in a single file or in many files that each contain one model or subcircuit. If they are in a single file, simply rename it so that it has a .lib extension. If each model is in its own file, then you can copy them all into a single file using the DOS copy command. For example, if the model files all have a .mod extension, enter the following DOS command:
copy *.mod mylib.lib
This command copies all of the models into the file called mylib.lib. Note
Make sure none of the new model or file names duplicate those already in the MicroSim package.
4-15
Now you need to tell the simulator that this file exists: 1 2 3 In Schematics select Library & Include Files from the Analysis menu. Type in the name of your file including the extension in the File Name text box. If you want the models to be global (available for any schematic), select Add Library*. If you want them to be local (only for the current design), select Add Library.
Symbol Library
Now you need to add a symbol for each of the models or subcircuits that you intend to use. Switch to the symbol editor by selecting Edit Library from the File menu. The title bar at the top of the window should say <new>:<new>. This means that you are editing a new symbol library file and are editing a new symbol. A quick overview of the structure of a typical symbol library may be helpful. Most symbol libraries are composed of base parts and AKO (a kind of) parts. The base part usually contains the graphical information for the symbol as well as the minimum attributes required to make that symbol functional. The AKO symbol inherits all of the graphics and attributes of the base part but can alter them or add to them. One other important point: an AKO symbol can only reference base parts contained in its own library. The quickest way to add a new symbol is to copy an existing one and customize its attributes. Lets assume you have a new set of opamps from a vendor. For this example, we assume that each device has five interface pins. Since all of the symbols will look the same, we want a symbol library that has one base part and an AKO part for each device to be used.
4-16
Creating Symbols
3 4 5
Scroll through the list nearly to the bottom (base parts are always at the bottom of the library). Select a base part (op5, for example). The base part name appears in both the New Part Name and Existing Part Name text boxes. Enter the name of the new model or subcircuit in the New Part Name text box. Click on OK. The symbol for the part is displayed.
c d 7
Select Attributes from the Part menu and do the following: a b c Type PART in the Name text box. Type the name of the model or subcircuit in the Value text box. Click on Save Attr. Type MODEL in the Name text box. (The name of the model or subcircuit should still be displayed in the Value text box.) Click on Save Attr.
The TEMPLATE attribute must be defined in accordance with the model or subcircuit definition. See TEMPLATE on page 4-7
4-17
8 9
Select Save As from the File menu (or select Save if an existing library was opened in step 2). Type the name of the new file without the .slb extension. Make sure that the new symbol and file names do not duplicate existing file names.
10 When you are asked whether to add this file to the list of Schematics configured libraries, select Yes. This makes the symbol library available to Schematics.
Copying and Modifying a Symbol for Multiple Vendor Models Using AKO Symbols
Adding a base part
1 2 Select Edit Library from the File menu to start the symbol editor. If the new symbol is to be placed in an existing library, select Open from the File menu to open the destination library. (Skip this step if the symbol is to be placed in a new symbol library.) Select Copy from the Part menu. Click on the Select Lib button. Scroll through the list of .slb files, select opamp.slb, and click on OK. A list of symbols is displayed in the parts window. Notice that most of the symbols have an AKO reference after them. To copy a base part: a b Scroll through the list nearly to the bottom (base parts are always at the bottom of the library). Select a base part (op5, for example). The base part name appears in both the New Part Name and Existing Part Name text boxes.
There are two types of parts in a symbol library: a base part and an AKO part. Only base parts (those without the AKO reference after the part name) can be copied.
3 4 5
4-18
Creating Symbols
c d 7 8
Enter the name of the new model or subcircuit in the New Part Name text box. Click on OK. The symbol for the part is displayed.
Select Save As from the File menu (or select Save if an existing library was opened in step TBD2). Type the name of the new file without the .slb extension. Make sure that the new symbol and file names do not duplicate existing file names. When you are asked whether to add this file to the list of Schematics' configured libraries, select Yes. This makes the symbol library available to Schematics.
Your new library now has one base part. Next we will add the first AKO part (the first symbol that can be used for simulation). Assume that the first opamp that you want to add is called LM557. 1 2 3 4 5 6 Select New from the Part menu. Enter a description for the part. This can be anything meaningful to you (inverting OPAMP, for example). Enter the name of the part. This usually matches the name of the model (LM557, for example). Enter OP5 for the AKO name. Click on OK. The status bar at the top of the screen lists the symbol being edited as LM557. Select Attributes from the Part menu. In the Attributes dialog box, there are four attributes listed for the symbols: REFDES, TEMPLATE, PART, and MODEL. REFDES equals U? by default, which denotes that it is referencing an IC definition. For most cases you do not need to edit TEMPLATE. Both PART and MODEL are blank. Click on PART. The word PART appears in the NAME text box. Enter the name of the symbol (LM557) in the VALUE text box.
7 8
4-19
10 Repeat the previous two steps for the MODEL attribute. MODEL must match exactly the name of the part as defined in the .SUBCKT definition found in your .lib file. (Case is not important.) 11 Click on OK. 12 Select Save from the File menu. You now have one base part and one AKO symbol in your library. At this point, you could return to Schematics and call up the LM557 symbol, place it in your drawing, and simulate with it. Repeat the procedure for each AKO part that you want to add. If other new devices have different graphics than the op5, add a new base part and proceed as above. If you need to add symbols over the course of several editing sessions, you need to add one step: after switching to the symbol editor, select Open from the File menu and open the file to which you will be adding new symbols. The status bar at the top of the screen shows which library you are working in at any given time.
Creating Models
5
Chapter Overview
This chapter provides information about creating models. Models define the electrical behavior of schematic components for purposes of simulation. This chapter includes the following sections: Model Overview on page 5-2 Using the Parts Utility on page 5-4 Subcircuits on page 5-20 Using the Model Editor (Text Editor) on page 5-21 Configuring the Library on page 5-36
For a listing of standard library components, refer to the on-line Library Reference Manual.
5-2
Creating Models
Model Overview
See MODEL on page 4-6 for a description of the MODEL attribute.
Models define the electrical behavior of parts or subcircuits for simulation. A model is linked to a specific part or subcircuit by the MODEL attribute defined for the symbol used by the part/ subcircuit. The model library shipped with your MicroSim software installation contains descriptions of the electrical behavior for many stock parts using the device model (.MODEL) and subcircuit (.SUBCKT/.ENDS) constructs. Model definitions describe circuit behavior by a set of variable model parameters which fine-tune the output of the model. The model construct is used for analog devices that are supported by intrinsic simulator device models. Subcircuit definitions describe the electrical behavior of a part using circuitry. The subcircuit construct supports variable input parameters to fine-tune output. Subcircuits are used to describe analog devices.
Model Overview
5-3
Creating and customizing device definitions requires knowledge of the model and subcircuit syntax recognized by the simulator, as well as various techniques to facilitate their creation and modification.
See Supported Device Types on page 5-8 for a description of models supported by the Parts utility.
5-4
Creating Models
5-5
operate. Though the Parts utility works with measurements taken from a specific device, it is sufficient to use typical values from the data sheet for most of your simulation work. You may also want to create best/worst case models for checking your design. For a given device type, the Parts utility displays the data sheet specifications, estimated model parameters, and graphs of the device characteristics. Usually, you will enter or modify data sheet information for each device characteristic. The Parts utility then estimates the model parameters and generates a graph displaying device characteristic behavior. Alternatively, you can edit model parameters directly to investigate their effect on a device characteristic (see Figure 5-2).
device data from data sheets
Each curve in the Parts utility is defined only by the parameters being adjusted. For the diode, the forward current curve displayed in the Parts utility only shows the part of the current equation which is associated with the forward characteristic parameters (such as IS, N, Rs). However, PSpice uses the full equation for the diode model, which includes a term involving the reverse characteristic parameters (such as ISR, NR), which could have a significant effect at low current. This means that the curve displayed in the Parts utility is not exactly as what is displayed in Probe after a simulation. Models should always be tested and verified using PSpice and finetuned if necessary.
parts estimation
model parameters
user data-entry
Figure 5-1 Process and Data Flow for the Parts Utility
5-6
Creating Models
To start the Parts utility from the symbol editor: 1 2 Select Model from the Edit menu. Click on Edit Model (Parts).
Once it is started, the Parts utility creates instance models or base models, respectively. Models are saved to model files and automatically configured for use with Schematics.
5-7
Note The model parameter defaults used by the Parts utility are different than those used by the base models intrinsic to PSpice.
Device Type diode bipolar transistor IGBT JFET power MOSFET operational amplifier voltage comparator nonlinear magnetic core voltage regulator voltage reference
5-8
Creating Models
5-9
Note
If you have defined device models with the same names as those in other configured model files and you want to use the new definitions during simulation instead, care must be taken when positioning the file names in the configuration list. If the new files and the existing files are configured with the same scope (either all local or all global), be sure to position the new files before the existing files. Note that PSpice searches locally configured files before the global files. So, if your new model files are configured locally, and the duplicate definitions exist in globally configured files (such as the central model library), your new definitions are still used by PSpice. See Search order on page 5-38 for a complete discussion on search order.
Schematics searches the list of configured model files for a match. If a match is found, the model file containing the instance model is opened. If no match is found, it is assumed to be a new device model which is by default saved to <schematic name>.lib, and the Parts utility is initialized with a copy of the base model. From the symbol editor: a Edit or create a symbol with the following attributes defined: PART Symbol name; it is good practice to have the symbol name match the MODEL name.
5-10
Creating Models
MODEL b c 2
Select Model from the Edit menu. Click on Edit Model (Parts).
The main Parts utility window is displayed with a list of the device characteristics and a list of all model parameters. If desired, performance curves can be viewed by selecting a device characteristic then selecting Display from the Plot menu (see Figure 5-3). To enter device data from the data sheet for any or all of the device characteristics, in any order: a b c d e Select the device characteristic in the Model Spec list box. Select Spec from the Edit menu. Fill in the Edit Model Spec dialog controls and click on Add. Click on OK to exit the dialog box. Repeat steps a-d for as many characteristics as need specification.
Figure 5-2 Parts Utility Window with Data for a Bipolar Transistor
3 4 5 6 7
Extract all model parameters for the current specification using Parameters on the Extract menu. Repeat steps 2-3 until the model meets target behaviors. Save the model by selecting Save from the Part menu. Update the model file by selecting Save Library from the File menu. End the Parts utility session by selecting Exit from the File menu.
Although you can configure models manually as described in this section, it is recommended to use automatic configuration as described in Automatic Model Configuration on page 5-10 instead.
If you opened an existing model file to which model definitions were appended, then this step can be skipped.
Configure Parts output files into your schematic: a b c Select Library and Include Files from the Analysis menu. Enter the file name as <model file name>.lib (mycir.lib, for example). If the model definitions are for local use in the current schematic, click on the Add Library (or Add Include) button. For global configuration, use Add Library* (or Add Include*) instead. Click on OK.
d 2
Either part instances or symbols can be modified to reference the new model. To change model references locally for a part instance: a b c Select one or more part instances. Select Model from the Edit menu. Click on Change Model Reference and type in the appropriate model name.
5-12
Creating Models
Enter the symbol editor by selecting Edit Library from the File menu. Create or change a symbol definition, making sure to define the following attributes: Symbol name; it is good practice to have the symbol name match the MODEL name. Model name as defined in the Parts utility .
PART
MODEL
The Parts utility is available to facilitate the characterization of new semiconductor devices by simply entering data sheet values for the required stock parts. This utility runs stand-alone, producing complete device model (.MODEL) and subcircuit (.SUBCKT/.ENDS) definitions written to existing or new files which, by default, have the .lib extension
Start Schematics. From within the schematic editor, draw the simple half-wave rectifier shown in Figure 5-4.
Place one each of the following symbols using Get New Part from the Draw menu (reference designator shown in parentheses):
Dbreak (D1 diode) C (C2 capacitor) R (R2 resistor) VSIN (V2 sine wave source) AGND (0 analog ground).
3 4
Connect the symbols as shown in Figure 5-4 using Wire from the Draw menu or by pressing C+W. Save the schematic drawing by selecting Save As from the File menu. Type rectfr at the prompt. The schematic is saved to rectfr.sch.
Note
For simulation, V1 requires a DC, AC, and/or transient specification by appropriately defining its attributes. The Attributes dialog box can be displayed by double-clicking on the V1 symbol. Since we will not be running a simulation in this tutorial, this step is skipped.
The parts window is displayed. Notice also that the D1 instance in the schematic references a unique instance model name, Dbreak-X. Figure 5-4 Dbreak-X Instance
Model
5-14
Creating Models
Figure 5-5 Diode Model Characteristics and Parameter Values for the Dbreak-X Instance Model Each model characteristic listed in the Model Spec list can be modified with new values from the data sheets. This information is then fit into new model parameter values. Data sheet information is updated by selecting a model characteristic from the Model Spec list, and entering the values in the displayed edit dialog. There are two types of edit dialogs requiring either device curve data (point pairs) or single-valued data. For the diode, Forward Current, Junction Capacitance, and Reverse Leakage expect device curve data. Reverse Breakdown and Reverse Recovery require single-valued data. Table 5-2 lists the data sheet information we would like to have incorporated into the Dbreak-X model.
Table 5-2
Model Characteristic Forward Current Junction Capacitance Reverse Leakage Reverse Breakdown Reverse Recovery
2 3 4
To change the values for Junction Capacitance and Reverse Leakage, use the same technique as for Forward Current to invoke the dialog, enter the device curve data, and exit. To change the Reverse Breakdown characteristic: 1 Double-click on the Reverse Breakdown entry in the Model Spec box. The Edit Model Spec-Reverse Breakdown dialog box is displayed. This dialog accepts single-valued data. Type 7.5 in the Vz text box. Press F to move to the Iz text box (or click in the Iz text box), and type 20m. Note that the Parts utility accepts the same scale factors normally accepted by PSpice. Press F to move to the Zz text box (or click in the Zz text box), and type 5. Click on OK to end this dialog.
2 3
4 5
5-16
Creating Models
5-18
Creating Models
Using Save on the Part menu and Save on the File menu ensure that the model instance name and model file name remain the same as those created by Schematics. This automatically configures the new model definition into our schematic without further intervention. If we had chosen to change the model instance name using Save As on the Part menu, then we would need to manually change the model reference for the D1 symbol by selecting Model from the Edit menu and clicking on Change Model Reference. If we had created a new model file using Save As on the File menu, we would need to configure the new model file using Library and Include Files on the Analysis menu.
Subcircuits
5-19
Subcircuits
Create Subcircuit on the Tools menu in the schematic editor creates a subcircuit definition for the current level of hierarchy in your schematic, including all lower levels. This is written to a file named <schematic name>.sub. Any named interface ports at the current level of hierarchy are mapped into the terminal nodes in the .SUBCKT statement.
2 3 4 5
5-20
Creating Models
5-21
5-22
Creating Models
<blank | 1 | 2 | ... >. If an instance model/subcircuit already exists, it is displayed in the edit dialog.
5-23
Subcircuit definitions are brought into the text-edit work area in the same format as read from the model file. All of the comments immediately before or after the model or subcircuit definition are included for editing. Note that this will sometimes mean that comments intended for the previous or next model definition will be included in the edit dialog.
5-24
Creating Models
Figure 5-8 Model Editor Dialog Box for Q2N2222 with a DEV Tolerance Set on Rb Now you can select Setup from the Analysis menu to set up the parameters as required for a Monte Carlo or worst-case analysis. You are then ready to select Simulate from the Analysis menu to run the simulations. If you want to change the model reference for this part back to Q2N2222, you can select the part in the schematic editor, select Model from the Edit menu, click on Change Model Reference, and type in the original model name.
5-26
Creating Models
Breakout Parts
For non-stock passive and semiconductor devices, Schematics provides a set of breakout parts designed for customizing model parameters for simulation. These are useful for setting up Monte Carlo and worst-case analyses with device and/or lot tolerances specified for individual model parameters.
Another approach is to use the model editor to derive an instance model and customize this. For example, you could add device and/or lot tolerances to model parameters.
Basic breakout part names consist of the intrinsic PSpice device letter from the set [BCDJKLMQRSTWZ] plus the suffix BREAK. By default, the model name is the same as the part name and references the appropriate device model with all parameters set at their default. For instance, the DBREAK part references the DBREAK model which is derived from the intrinsic PSpice D model (.MODEL DBREAK D).
For breakout parts RBREAK, CBREAK, and LBREAK, the effective value is computed from a formula that is a function of the specified VALUE attribute.
Table 5-3
Part Type
Description
capacitance initial voltage across the capacitor during bias point calculation CAP model name inductance initial current through the inductor during bias point calculation IND model name resistance RES model name
LBREAK
breakout.slb
VALUE IC MODEL
RBREAK
breakout.slb
VALUE MODEL
5-27
KBREAK Symbol
Symbol Name KBREAK Symbol Library File breakout.slb Attribute COUPLING Li Description coupling factor inductor reference designator
Effect linear coupling between inductors. Reference a CORE model in a configured model library file. Define a user-defined CORE model with custom model parameter values.
The dot convention for the coupling is related to the direction in which the inductors are connected. The dot is always next to the first pin to be netlisted. For example, when the inductor symbol, L, is placed without rotation, the dotted pin is the left one. Rotate on the Edit menu (C+r), rotates the inductor +90, making this pin the one at the bottom.
2 3
5-28
Creating Models
designator names for the coupled inductors as values for Li (i=1,2,...,6). Nonlinear coupling is not included in PSpice Basics 4 For nonlinear coupling: L1 must have a value; the rest may be left blank. For linear coupling: L1 and at least one other Li must have values; the rest may be left blank. Change the coupling symbols MODEL attribute reference: a b c d click on the symbols box with the enclosed K. Select Model from the Edit menu. Click on Change Model Reference in the Edit Model dialog box. Change the name as required in the Model Name text box. These rules apply: For nonlinear coupling: The model must reference a CORE model such as those contained in magnetic.lib or other user-defined models. For linear coupling: The model reference must be blank. 5 6 Set the value of the COUPLING attribute to the value of the coupling factor, K. Set the value (VALUE attribute) for each of the coupled inductors (L symbol instances). These rules apply: For nonlinear coupling: VALUE is set to the number of windings. For linear coupling: VALUE must be in Henries.
5-29
Transformers
Table 5-5 lists attributes that can be set per instance of a nonlinear transformer part. Also see Transformers on page 3-4. Table 5-5
Part Type transformer (PSpice K and L devices)
Transformers
Symbol Name XFRM_ NONLINEA R Symbol Library File breakout.slb Attribute
L1_TURNS L2_TURNS COUPLING
Description
number of turns on each winding coefficient of mutual coupling (must lie between 0 and 1) nonlinear CORE model n me
MODEL
To use XFRM_NONLINEAR, the MODEL attribute must be set appropriately. However, the MODEL attribute of a given instance can be modified to reference a CORE model provided in the magnetic.lib model library file or in a user-defined model file.
See Using the Inductor Coupling Symbols in the Application Notes Manual for a description of techniques for creating additional transformer configurations.
5-30
Creating Models
Ideal switches
Table 5-6 summarizes the available switch part types provided in the breakout.slb symbol library. The switches may be voltage or current-controlled. To create a time-controlled switch, simply connect the switch control pins to a voltage source with the appropriate voltage vs. time values (transient specification). Table 5-6 Ideal Switch Parts in breakout.slb
Part Type Voltage-Controlled Switch (PSpice S device) Current-Controlled Switch (PSpice W device) Symbol Name SBREAK Model Type VSWITCH
WBREAK
ISWITCH
The VSWITCH and ISWITCH models define the on/off resistance and the on/off control voltage or current thresholds. These switches have a finite on resistance and off resistance, and change smoothly between the two as their control voltage (or current) changes. This behavior is important, allowing PSpice to find a continuous set of solutions to the circuit being simulated. In practice, the on resistance may be made very small compared to the other circuit impedances, and the off resistance may be made very large compared to the other circuit impedances. As with current-controlled sources (F, FPOLY, H, and HPOLY), WBREAK contains a current-sensing voltage source. When netlisted, WBREAK generates two device declarations to the circuit file set:
one for the controlled switch one for the independent current-sensing voltage source
If you choose to create a new symbol for a current-controlled switch (with, for example, different on/off resistance and current threshold settings in the ISWITCH model), the TEMPLATE attribute must account for the additional current-sensing voltage source.
5-31
Semiconductor Parts
Semiconductor parts can be divided into two classifications. One class is described by model definitions derived from intrinsic PSpice device model types: diodes, bipolar transistors, junction field effect transistors (JFETs), metal-oxide-silicon field effect transistors (MOSFETs), gallium arsenide field effect transistors (GaAsFETs), and insulated gate bipolar transistors (IGBT). The other class is described by subcircuit definitions: opamps, silicon controlled rectifiers (SCRs), triacs, unijunction transistors (UJTs), and more.
5-32
Creating Models
PNP
D, X
breakout.slb
breakout.slb
PMOS
GaAsFET
5-33
Table 5-8
Device Type Diode JFET
MOSFET
NMOS, Level 1 NMOS, Level 2 NMOS, Level 3 NMOS, Level 4 NMOS, Level 6 PMOS, Level 1 PMOS, Level 2 PMOS, Level 3 PMOS, Level 4 PMOS, Level 6
Bipolar Transistor
IGBT
NIGBT
5-34
Creating Models
area scaling factor NJF or PJF model name area scaling factor NPN, PNP, or LNP model name
QBREAKL QBREAKN QBREAKN3 QBREAKN4 QBREAKP QBREAKP3 QBREAKP4 DBREAK3 MBREAKN MBREAKN3 MBREAKN4 MBREAKP MBREAKP3 MBREAKP4
D model name channel length channel width drain diffusion area source diffusion area drain diffusion perimeter source diffusion perimeter relative drain resistivity (in squares) relative source resistivity (in squares) relative gate resistivity (in squares) relative substrate resistivity (in squares) device multiplier (simulating parallel devices) NMOS or PMOS model name
5-35
Table 5-9
Symbol Name ZBREAKN
5-35
5-36
Creating Models
index to access only the model and/or subcircuit definitions relevant to the simulation. Model files configured into the Include File list box are explicitly written to the circuit file set and read by the simulator in their entirety. The Add Library* button is used to incorporate new model files into the model library (with global status). For instance, to make the device definitions contained in the user-defined model file mymodels.lib available to the simulator at all times, this file name must be added to the list of globally accessible model files. This requires typing its name in the File Name text box and clicking on Add Library*. After doing this, a new global entry will appear in the library files list as mymodels.lib*. Note that this technique avoids any additions to the nom.lib file. Additional model files can be added, old files deleted, global/ local status modified, or the library/include status modified through this same dialog. The Delete button deletes the selected file from its list box. The Change button copies the selected file from the list box up to the edit control and deletes it from the list, allowing you to modify it. The Browse button brings up a dialog allowing you to browse the directory structure and select a file name. To set up model files for local use with the current schematic, you can use the Add Library button (no asterisk). Suppose your current schematic is called mydesign, and mymodels.lib contains device models specifically for mydesign. Mymodels.lib should be added to the library list using Add Library. This produces the mymodels.lib entry in the library files list without an asterisk, indicating local file status. When simulating mydesign, the simulator searches this model file before those with global status.
5-37
Note
Care should be taken when configuring model files with the Add Include* (global) and Add Include (local) buttons in this dialog box. This method can have disadvantages when the model file is large. Rather than selecting only the model and subcircuit definitions needed, the simulator will load the entire file into memory. However, when developing device models and/or subcircuits, it can be useful to initially treat the model file as an include file. This avoids the rebuilding of index files every time the model file changes. Then, once the model definitions are stable, the model file can be reconfigured as a library file. The simulator will build the associated index file once. Henceforth, the simulator will read in only those definitions required for the simulation.
Search order
The simulator always searches local model files before global model files in the model library. However, within each class of local or global files, the order in which they are specified in the Library Files list box dictates the order in which the simulator will search the files to resolve references. Optimizing the search order can significantly reduce search time. Where device names are alike across model files, search order will determine which of the devices is selected for simulation. The simulator always uses the first instance. In the Library and Include Files dialog box (accessed from the Analysis menu), new files are always added after the currently selected item in the Library Files list box. To add a file name in a certain position in the list, select the file name in the list above where you want the new file name to placed, then select the Add_Library* (global) or Add_Library (local) command as required. If you have configured your model files by listing multiple .lib commands within a single file (like mymodels.lib), and search order is critical, then you will need to manually edit the file contents with your platforms text editor. In the standard model library, only diodes.lib and ediodes.lib (European manufactured diodes) have identically named device
5-38
Creating Models
definitions. If your schematic uses a device out of one of these files, you must insure that the model file containing the definition of choice is listed first. If your system is configured to use nom.lib for the model library, and the file order is not in accordance with your circuit requirements, then you will have to edit this file.
To ensure that model files added to the model library will be located, it is necessary to do one of the following:
Place the model files in the standard library directory (that is, where the standard symbol and model files are stored) Update the library path definition to include any new directories Use the full path name when adding the model file to the Library Files list box in the Library and Include Files dialog box described above
5-39
We recommend that model files belonging to the model library (global status) reside in a centralized location. If this location includes more than one directory, the directory paths can be listed in the Library Path text box. Entries must be separated by semicolons. For example, while the standard model files shipped with the MicroSim simulation software might reside in C:\MSIM\LIB, a second directory, for example C:\MYLIBS, might contain all of your custom model files. To ensure that the simulator searches both C:\MSIM\LIB and C:\MYLIBS for model files, type the new directory path name in the Library Path text box of the Editor Configuration dialog box (accessed from the Options menu) and click on OK.
6
Chapter Overview
This chapter describes how to use Analog Behavioral Modeling (ABM) feature provided in PSpice. This chapter includes the following sections: Overview of Analog Behavioral Modeling on page 6-2 The abm.slb Symbol Library File on page 6-3 Placing and Specifying ABM Parts on page 6-4 ABM Part Templates on page 6-6 Control System Parts on page 6-7 PSpice-Equivalent Parts on page 6-28 Cautions and Recommendations for Simulation and Analysis on page 6-41 Basic Controlled Sources on page 6-47
6-2
6-4
If you used an expression such as V(2), then the referenced net (2 in this case) is interpreted as the name of a local or global net. A local net is a labeled wire or bus segment in a hierarchical schematic, or a labeled offpage connector. A global net is a labeled wire or bus segment at the top level, or a global connector. MicroSim Schematics recognizes these constructs in ABM expressions:
V(<net name>) V(<net name>,<net name>) I(<vdevice>)
When one of these is recognized, Schematics searches for <net name> or <vdevice> in the net name space or the device name space, respectively. Names are searched for first at the hierarchical level of the part being netlisted. If not found there, then the set of global names is searched. If the fragment is not found, then a warning is issued but Schematics still outputs the
6-5
resulting netlist. When a match is found, the original fragment is replaced by the fully qualified name of the net or device. For example, suppose we have a hierarchical part U1. Inside the schematic representing U1 we have an ABM expression including the term V(Reference). If Reference is the name of a local net, then the fragment written to the netlist will be translated to V(U1_Reference). If Reference is the name of a global net, the corresponding netlist fragment will be V(Reference). Names of voltage sources are treated similarly. For example, an expression including the term I(Vsense) will be output as I(V_U1_Vsense) if the voltage source exists locally, and as I(V_Vsense) if the voltage source exists at the top level.
6-6
The fragment E^@REFDES is standard. The E specifies a PSpice controlled voltage source (E device); %in and %out are the input and output pins, respectively; VALUE is the keyword specifying the type of ABM device; and the expression inside the curly braces defines the logarithm of the input voltage. Several ABM symbols produce more than one primitive PSpice device per symbol instance. In this case, the TEMPLATE attribute may be quite complicated. An example is the DIFFER (differentiator) symbol. This is implemented as a capacitor in series with a current sensor together with an E device which outputs a voltage proportional to the current through the capacitor. The template has several unusual features: it gives rise to three primitives in the PSpice netlist, and it creates a local node for the connection of the capacitor and its current-sensing V device.
For clarity, the template is shown on three lines although the actual template is a single line. C^@REFDES %in $$U^@REFDES 1\n V^@REFDES $$U^@REFDES 0 0v\n E^@REFDES %out 0 VALUE {@GAIN * I(V^@REFDES)}
The fragments C^@REFDES, V^@REFDES, and E^@REFDES create a uniquely named capacitor, current sensing V device, and E device, respectively. The fragment $$U^@REFDES creates a name suitable for use as a local node. The E device generates an output proportional to the current through the local V device.
6-7
Limiters
Chebyshev Filters
6-8
EXP EXP
6-9
Basic Components
The basic components provide fundamental functions and in many cases, do not require specifying attribute values. These parts are described below.
CONST
VALUE is a constant value The CONST part outputs the voltage specified by the VALUE attribute. This part provides no inputs and one output.
SUM
The SUM part evaluates the voltages of the two input sources, adds the two inputs together, then outputs the sum. This part provides two inputs and one output.
MULT
The MULT part evaluates the voltages of the two input sources, multiplies the two together, then outputs the product. This part provides two inputs and one output.
GAIN
GAIN is a constant gain value The GAIN part multiplies the input by the constant specified by the GAIN attribute, then outputs the result. This part provides one input and one output.
DIFF
The DIFF part evaluates the voltage difference between two inputs, then outputs the result. This part provides two inputs and one output.
6-10
Limiters
The Limiters can be used to restrict an output to values between a set of specified ranges. These parts are described below.
LIMIT
HI LO is a value representing the upper limit is a value representing the lower limit
The LIMIT part constrains the output voltage to a value between an upper limit (set with the HI attribute) and a lower limit (set with the LO attribute). This part takes one input and provides one output.
GLIMIT
HI LO GAIN is a value representing the upper limit is a value representing the lower limit is a constant gain value
The GLIMIT part functions as a one-line opamp. The gain is applied to the input voltage, then the output is constrained to the limits set by the LO and HI attributes. This part takes one input and provides one output.
SOFTLIMIT
HI LO GAIN A, B, V, TANH is a value representing the upper limit is a value representing the lower limit is a constant gain value are internal variables used to define the limiting function
The SOFTLIMIT part provides a limiting function much like the LIMIT device, except that it uses a continuous curve limiting function, rather than a discontinuous limiting function. This part takes one input and provides one output.
6-11
Chebyshev Filters
The Chebyshev filters allow filtering of the signal based on a set of frequency characteristics. The output of a Chebyshev filter depends upon the analysis being done. For DC and bias point, the output is simply the DC response of the filter. For AC analysis, the output for each frequency is the filter response at that frequency. For transient analysis, the output is then the convolution of the past values of the input with the impulse response of the filter. These rules follow the standard method of using Fourier transforms. Note
We recommend looking at one or more of the references cited in
PSpice computes the impulse response of each Chebyshev filter used in a transient analysis during circuit read-in. This may require considerable computing time. A message is displayed on your screen indicating that the computation is in progress. To obtain a listing of the filter Laplace coefficients for each stage, select Setup from the Analysis menu, click on Options, and turn on LIST in the Options dialog box.
Note
LOPASS
FS FP RIPPLE STOP is the stop band frequency is the pass band frequency is the pass band ripple in dB is the stop band attenuation in dB
The LOPASS part is characterized by two cutoff frequencies that delineate the boundaries of the filter pass band and stop band. The attenuation values, RIPPLE and STOP, define the maximum allowable attenuation in the pass band, and the minimum required attenuation in the stop band, respectively. The LOPASS part provides one input and one output. Figure 6-1 shows an example of a LOPASS filter device. The filter provides a pass band cutoff of 800 Hz and a stop band cutoff of 1.2 kHz. The pass band ripple is 0.1 dB and the
6-12
minimum stop band attenuation is 50 dB. Assuming that the input to the filter is the voltage at net 10 and output is a voltage between nets 5 and 0, this will produce a PSpice netlist declaration like this:
ELOWPASS 5 0 CHEBYSHEV {V(10)} = LP 800 1.2K .1dB 50dB
HIPASS
FS FP RIPPLE STOP is the stop band frequency is the pass band frequency is the pass band ripple in dB is the stop band attenuation in dB
The HIPASS part is characterized by two cutoff frequencies that delineate the boundaries of the filter pass band and stop band. The attenuation values, RIPPLE and STOP, define the maximum allowable attenuation in the pass band, and the minimum required attenuation in the stop band, respectively. The HIPASS part provides one input and one output. Figure 6-2 shows an example of a HIPASS filter device. This is a high pass filter with the pass band above 1.2 kHz and the stop band below 800 Hz. Again, the pass band ripple is 0.1 dB and the minimum stop band attenuation is 50 dB. This will produce a PSpice netlist declaration like this:
EHIGHPASS 5 0 CHEBYSHEV {V(10)} = HP 1.2K 800 .1dB 50dB
BANDPASS
RIPPLE STOP F0, F1, F2, F3 is the pass band ripple in dB is the stop band attenuation in dB are the cutoff frequencies
The BANDPASS part is characterized by four cutoff frequencies. The attenuation values, RIPPLE and STOP, define the maximum allowable attenuation in the pass band, and the minimum required attenuation in the stop band, respectively. The BANDPASS part provides one input and one output.
6-13
Figure 6-3 shows an example of a BANDPASS filter device. This is a band pass filter with the pass band between 1.2 kHz and 2 kHz, and stop bands below 800 Hz and above 3 kHz. The pass band ripple is 0.1 dB and the minimum stop band attenuation is 50 dB. This will produce a PSpice netlist declaration like this:
EBANDPASS 5 0 CHEBYSHEV {V(10)} = BP 800 1.2K 2K 3K .1dB 50dB
BANDREJ
RIPPLE STOP F0, F1, F2, F3 is the pass band ripple in dB is the stop band attenuation in dB are the cutoff frequencies
The BANDREJ part is characterized by four cutoff frequencies. The attenuation values, RIPPLE and STOP, define the maximum allowable attenuation in the pass band, and the minimum required attenuation in the stop band, respectively. The BANDREJ part provides one input and one output. Figure 6-4 shows an example of a BANDREJ filter device. This is a band reject (or notch) filter with the stop band between 1.2 kHz and 2 kHz, and pass bands below 800 Hz and above 3 kHz. The pass band ripple is 0.1 dB and the minimum stop band attenuation is 50 dB. This will produce a PSpice netlist declaration like this:
ENOTCH 5 0 CHEBYSHEV {V(10)} = BR 1.2K 800 3K 2K .1dB 50dB
6-14
INTEG
IC GAIN is the initial condition of the integrator output is the value of the gain
The INTEG part implements a simple integrator. A current source/capacitor implementation is used to provide support for setting the initial condition.
DIFFER
GAIN is the value of the gain The DIFFER part implements a simple differentiator. A voltage source/capacitor implementation is used. The DIFFER part provides one input and one output.
TABLE
If more than five values are required, the symbol can be customized through the symbol editor. Insert additional row variables into the template using the same form as the first five, and add ROWn attributes as needed to the list of attributes.
ROWn
is an (input, output) pair; by default, up to five triplets are allowed where n=1, 2, 3, 4, or 5
The TABLE part allows the response to be defined by a table of one to five values. Each row contains an input and a corresponding output value. Linear interpolation is performed between entries. For values outside the tables range, the devices output is a constant with a value equal to the entry with the smallest (or largest) input. This characteristic can be used to impose an upper and lower limit on the output. The TABLE part provides one input and one output.
6-15
FTABLE
ROWn is either an (input frequency, magnitude, phase) triplet, or an (input frequency, real part, imaginary part) triplet describing a complex value; by default, up to five triplets are allowed where n=1, 2, 3, 4, or 5 group delay increment; defaults to 0 if left blank defines the table type; if left blank, the frequency table is interpreted in the (input frequency, magnitude, phase) format; if defined with any value (such as YES), the table is interpreted in the (input frequency, real part, imaginary part) format units for magnitude where the value can be DB (decibels) or MAG (raw magnitude); defaults to DB if left blank units for phase where the value can be DEG (degrees) or RAD (radians); defaults to DEG if left blank If more than five values are required, the symbol can be customized through the symbol editor. Insert additional row variables into the template using the same form as the first five, and add ROWn attributes as needed to the list of attributes.
DELAY R_I
MAGUNITS
PHASEUNITS
The FTABLE part is described by a table of frequency responses in either the magnitude/phase domain (R_I= ) or complex number domain (R_I=YES). The entire table is read in and converted to magnitude in dB and phase in degrees. Interpolation is performed between entries. Magnitude is interpolated logarithmically; phase is interpolated linearly. For frequencies outside the tables range, 0 (zero) magnitude is used. This characteristic can be used to impose an upper and lower limit on the output. The DELAY attribute increases the group delay of the frequency table by the specified amount. The delay term is particularly useful when a frequency table device generates a non-causality warning message during a transient analysis. The warning message issues a delay value that can be assigned to the symbols DELAY attribute for subsequent runs, without otherwise altering the table. The output of the part depends on the analysis being done. For DC and bias point, the output is the zero frequency magnitude times the input voltage. For AC analysis, the input voltage is linearized around the bias point (similar to EVALUE and
6-16
GVALUE parts, Modeling Mathematical or Instantaneous Relationships on page 6-30). The output for each frequency is then the input times the gain, times the value of the table at that frequency. For transient analysis, the voltage is evaluated at each time point. The output is then the convolution of the past values with the impulse response of the frequency response. These rules follow the standard method of using Fourier transforms. We recommend looking at one or more of the references cited in Frequency-Domain Device Models on page 6-35 for more information. Note
The tables frequencies must be in order from lowest to highest. The TABLE part provides one input and one output.
Example
A device, ELOFILT, is used as a frequency filter. The input to the frequency response is the voltage at net 10. The output is a voltage across nets 5 and 0. The table describes a low pass filter with a response of 1 (0 dB) for frequencies below 5 kilohertz and a response of 0.001 (-60 dB) for frequencies above 6 kilohertz. The phase lags linearly with frequency. This is the same as a constant time delay. The delay is necessary so that the impulse response is causal. That is, so that the impulse response does not have any significant components before time zero. The FTABLE part in Figure 6-5 could be used. This part is characterized by the following attributes:
ROW1 = 0Hz ROW2 = 5kHz ROW3 = 6kHz DELAY = R_I = MAGUNITS = PHASEUNITS = 0 0 -60 0 -5760 -6912
Since R_I, MAGUNITS, and PHASEUNITS are undefined, each table entry is interpreted as containing frequency, magnitude value in dB, and phase values in degrees. Delay defaults to 0. This produces a PSpice netlist declaration like this:
6-17
Since constant group delay is calculated from the values for a given table entry as: group delay = phase / 360 / frequency An equivalent FTABLE instance could be defined using the DELAY attribute. For this example, the group delay is 3.2 msec (6912 / 360 / 6k = 5760 / 360 / 6k = 3.2m). Equivalent attribute assignments are:
ROW1 = 0Hz ROW2 = 5kHz ROW3 = 6kHz DELAY = 3.2ms R_I = MAGUNITS = PHASEUNITS = 0 0 -60 0 0 0
6-18
LAPLACE
NUM
DENOM is the numerator of the Laplace expression is the denominator of the Laplace expression
The LAPLACE part uses a Laplace transform description. The input to the transform is a voltage. The numerator and denominator of the Laplace transform function are specified as attributes for the symbol. Note
Voltages, currents, and TIME may not appear in a Laplace transform specification.
The output of the part depends on the type of analysis being done. For DC and bias point, the output is the zero frequency gain times the value of the input. The zero frequency gain is the value of the Laplace transform with s=0. For AC analysis, the output is then the input times the gain times the value of the Laplace transform. The value of the Laplace transform at a frequency is calculated by substituting j for s, where is 2frequency. For transient analysis, the output is the convolution of the input waveform with the impulse response of the transform. These rules follow the standard method of using Laplace transforms.
Example 1
The input to the Laplace transform is the voltage at net 10. The output is a voltage and is applied between nets 5 and 0. For DC, the output is simply equal to the input, since the gain at s = 0 is 1. The transform, 1/(1+.001s), describes a simple, lossy integrator with a time constant of 1 millisecond. This can be implemented with an RC pair that has a time constant of 1 millisecond. For AC analysis, the gain is found by substituting j for s. This gives a flat response out to a corner frequency of 1000/(2) = 159 hertz and a roll-off of 6 dB per octave after 159 Hz. There is also a phase shift centered around 159 Hz. In other words, the
6-19
gain has both a real and an imaginary component. For transient analysis, the output is the convolution of the input waveform with the impulse response of 1/(1+.001s). The impulse response is a decaying exponential with a time constant of 1 millisecond. This means that the output is the lossy integral of the input, where the loss has a time constant of 1 millisecond. The LAPLACE part shown in Figure 6-6 could be used for this purpose. The transfer function is the Laplace transform (1/[1+.001*s]). This LAPLACE part is characterized by the following attributes:
NUM = 1 DENOM = 1 + .001*s
Figure 6-7 Lossy Integrator Example: Viewing Gain and Phase Characteristics with Probe This produces a PSpice netlist declaration like this:
ERC 5 0 LAPLACE {V(10)} = {1/(1+.001*s)}
Example 2
The input is V(10). The output is a current applied between nets 5 and 0. The Laplace transform describes a lossy transmission Figure 6-8 LAPLACE Part
E l
6-20
line. R, L, and C are the resistance, inductance, and capacitance of the line per unit length. If R is small, the characteristic impedance of such a line is Z = ((R + jL)/(jC))1/2, the delay per unit length is (L C)1/2, and the loss in dB per unit length is 23R/Z. This could be represented by the device in Figure 6-8. The parameters R, L, and C can be defined in a .PARAM statement contained in a model file. (Refer to the PSpice Reference Manual for more information about using .PARAM statements.) More useful, however, is for R, L, and C to be arguments passed into a subcircuit. This part has the following characteristics:
NUM = EXP(-SQRT(C*s*(R+L*s))) DENOM = 1
The Laplace transform parts are, however, an inefficient way, in both computer time and memory, to implement a delay. For ideal delays we recommend using the transmission line part instead.
6-21
Math Functions
The ABM math function parts are shown in Table 6-2. For each device, the corresponding template is shown, indicating the order in which the inputs are processed, if applicable. Table 6-2
Device ABS SQRT PWR PWRS LOG LOG10 EXP
Math function parts are based on the PSpice E device type. Each provides one or more inputs, and a mathematical function which is applied to the input. The result is output on the output net.
6-22
where n = 1, 2, 3, or 4. During netlist generation, the complete expression is formed by concatenating the building block expressions in numeric order, thus defining the transfer function. Hence, the first expression fragment should be assigned to the EXP1 attribute, the second fragment to EXP2, and so on. Expression attributes can be defined using a combination of arithmetic operators and input designators. You may use any of the standard PSpice arithmetic operators (see Table 3-5 on page 3-10) within an expression statement. You may also use the EXPn attributes as variables to represent nets or constants. Table 6-3 ABM Expression Parts
Device ABM ABM1 ABM2 ABM3 ABM/I ABM1/I ABM2/I ABM3/I Inputs none 1 2 3 none 1 2 3 Output V V V V I I I I
6-23
Example 1
Suppose you want to set an output voltage on net 4 to 5 volts times the square root of the voltage between nets 3 and 2. You could use an ABM2 part (which takes two inputs and provides a voltage output) to define a part like the one shown in Figure 6-9. In this example of an ABM device, the output voltage is set to 5 volts times the square root of the voltage between net 3 and net 2. The attribute settings for this part are as follows:
EXP1 = 5V * EXP2 = SQRT(V(%IN2,%IN1))
Example 2
GPSK is an oscillator for a PSK (Phase Shift Keyed) modulator. Current is pumped from net 11 through the source to net 6. Its value is a sine wave with an amplitude of 15 mA and a frequency of 10 kHz. The voltage at net 3 can shift the phase of GPSK by 1 radian/volt. Note the use of the TIME parameter in the EXP2 expression. This is the PSpice internal sweep variable used in transient analyses. For any analysis other than transient, TIME = 0. This could be represented with an ABM1/I part (single input, current output) like the one shown in Figure 6-10. This part is characterized by the following attributes:
EXP1 = 15ma * SIN( EXP2 = 6.28*10kHz*TIME EXP3 = + V(%IN))
6-24
Example 3
A device, EPWR, computes the instantaneous power by multiplying the voltage across nets 5 and 4 by the current through VSENSE. Sources are controlled by expressions which may contain voltages or currents or both. The ABM2 part (two inputs, current output) in Figure 6-11 could represent this. This part is characterized by the following attributes:
EXP1 = V(%IN2,%IN1) * EXP2 = I(VSENSE)
Example 4
The output of a component, GRATIO, is a current whose value (in amps) is equal to the ratio of the voltages at nets 13 and 2. If V(2) = 0, the output depends upon V(13) as follows: if V(13) = 0, output = 0 if V(13) > 0, output = MAXREAL if V(13) < 0, output = -MAXREAL where MAXREAL is a PSpice internal constant representing a very large number (on the order of 1e30). In general, the result of evaluating an expression is limited to MAXREAL. This is modeled with an ABM2/I (two input, current output) part like this one in Figure 6-12. This part is characterized by the following attributes:
EXP1 = V(%IN2)/V(%IN1)
Note that output of GRATIO can be used as part of the controlling function. This produces a PSpice netlist declaration like this:
GRATIO 2 3 VALUE = {V(13)/V(2)}
Note
Letting a current approach 1e30 will almost certainly cause convergence problems. To avoid this, use the limit function on the ratio to keep the current within reasonable limits.
6-25
Figure 6-13 Triode Circuit Assumptions: In its main operating region, the triodes current is proportional to the 3/2 power of a linear combination of the grid and anode voltages: ianode = k0*(vg + k1*va)1.5 For a typical triode, k0 = 200e-6 and k1 = 0.12. Looking at the upper left-hand portion of the schematic, notice the a general-purpose ABM part used to take the input voltages from anode, grid, and cathode. Assume the following associations:
V(anode) is associated with V(%IN1) V(grid) is associated with V(%IN2) V(cathode) is associated with V(%IN3)
The expression attribute EXP1 then represents V(grid, cathode) and the expression attribute EXP2 represents 0.12[V(anode, cathode)]. When the template substitution is performed, the resulting VALUE is equivalent to the following: V = V(grid, cathode) + 0.12*V(anode, cathode) The part would be defined with the following characteristics:
6-26
This works for the main operating region but does not model the case in which the current stays 0 when combined grid and anode voltages go negative. We can accommodate that situation as follows by adding the LIMIT part with the following characteristics:
HI = 1E3 LO = 0
This part instance, LIMIT1, converts all negative values of vg+.12*va to 0 and leaves all positive values (up to 1 kV) alone. For a more realistic model, we could have used TABLE to correctly model how the tube turns off at 0 or at small negative grid voltages. We also need to make sure that the current becomes zero when the anode alone goes negative. To do this, we can use a DIFF device, (immediately below the ABM3 device) to monitor the difference between V(anode) and V(cathode), and output the difference to the TABLE part. The table translates all values at or below zero to zero, and all values greater than or equal to 30 to one. All values between 0 and 30 are linearly interpolated. The attributes for the TABLE part are as follows:
ROW1 = 00 ROW2 = 301
The TABLE part is a simple one, and ensures that only a zero value is output to the multiplier for negative anode voltages. The output from the TABLE part and the LIMIT part are combined at the MULT multiplier part. The output of the MULT part is the product of the two input voltages. This value is then raised to the 3/2 or 1.5 power using the PWR part. The exponential attribute of the PWR part is defined as follows:
EXP = 1.5
The last major component is an ABM expression component to take an input voltage and convert it into a current. The relevant ABM1/I part attribute looks like this:
EXP1 = 200E-6 * V(%IN)
A final step in the model is to add device parasitics. For example, a resistor can be used to give a finite output
6-27
impedance. Capacitances between the grid, cathode, and anode are also needed. The lower part of the schematic in Figure 6-13 shows a possible method for incorporating these effects. To complete the example, one could add a circuit which produces the family of I-V curves (shown in Figure 6-14).
6-28
PSpice-Equivalent Parts
PSpice-equivalent parts respond to a differential input and have double-ended output. These parts reflect the structure of PSpice E and G devices, thus having two pins for each controlling input and the output in the symbol. Table 6-4 summarizes the PSpice-equivalent parts available in the symbol library. Table 6-4 PSpice-Equivalent Parts
Category Mathematical Expression Symbol EVALUE GVALUE ESUM GSUM EMULT GMULT Table Look-Up ETABLE GTABLE Frequency Table Look-Up Laplace Transform There are no equivalent F or H part types in the symbol library since PSpice F and H devices do not support the ABM extensions. EFREQ GFREQ ELAPLACE GLAPLACE general purpose general purpose general purpose EXPR TABLE EXPR TABLE EXPR XFORM special purpose (none) Description general purpose Attribut es EXPR
PSpice-equivalent ABM parts can be classified as either E part types or G part types. The E part type provides a voltage output, and the G part type provides a current output. The parts transfer function can contain any mixture of voltages and currents as inputs. Hence, there is no longer a division between voltage-controlled and current-controlled parts. Rather the part type is dictated only by the output requirements. If a voltage output is required, use an E part type. If a current output is necessary, use a G part type. Each E or G part type in the abm.slb symbol file is defined by a template that provides the specifics of the transfer function.
PSpice-Equivalent Parts
6-29
Other attributes in the model definition can be edited to customize the transfer function. By default, the template cannot be modified directly using Attributes on the Edit menu in Schematics. Rather, the values for other attributes (such as the expressions used in the template) are usually edited, then these values are substituted into the template. However, the symbol editor can be used to modify the template or designate the template as modifiable from within Schematics. This way, custom symbols can be created for special-purpose application.
where <name> <connecting nodes> <ABM keyword> is the device name appended to the E or G device type character specifies the <(+ node name, - node name)> pair between which the device is connected specifies the form of the transfer function to be used, as one of:
VALUE TABLE LAPLACE FREQ CHEBYSHEV arithmetic expression lookup table Laplace transform frequency response table Chebyshev filter characteristics
6-30
<ABM function>
specifies the transfer function as a formula or lookup table as required by the specified <ABM keyword>
For AC analysis, a nonlinear device is first linearized around the bias point, and then the linear equivalent is used.
PSpice-Equivalent Parts
6-31
The EVALUE and GVALUE symbols are defined, in part, by the following attributes (default values are shown): EVALUE EXPR GVALUE EXPR V(%IN+, %IN-) V(%IN+, %IN-)
Sources are controlled by expressions which may contain voltages, currents, or both. The following examples illustrate customized EVALUE and GVALUE parts.
Example 1
In the example of an EVALUE device shown in Figure 6-15, the output voltage is set to 5 volts times the square root of the voltage between pins %IN+ and %IN-. The attribute settings for this device are as follows:
EXPR = 5v * SQRT(V(%IN+,%IN-))
Example 2
Consider the device in Figure 6-16. This device could be used as an oscillator for a PSK (Phase Shift Keyed) modulator. A current through a source is a sine wave with an amplitude of 15 mA and a frequency of 10 kHz. The voltage at the input pin can shift the phase by 1 radian/volt. Note the use of the TIME parameter in this expression. This is the PSpice internal sweep variable used in transient analyses. For any analysis other than transient, TIME = 0. The relevant attribute settings for this device are shown below:
EXPR = 15ma*SIN(6.28*10kHz*TIME+V(%IN+,%IN-))
6-32
Example 1
Consider the device in Figure 6-17. This device computes the instantaneous power by multiplying the voltage across pins %IN+ and %IN- by the current through VSENSE. This devices behavior is built-in to the TEMPLATE attribute as follows:
TEMPLATE=E^@REFDES %OUT+ %OUT- VALUE {V(%IN1+,%IN1-) *V(%IN2+,%IN2-)}
You can use the symbol editor to change the characteristics of the template to accommodate additional mathematical functions, or to change the nature of the transfer function itself. For example, you may want to create a voltage divider, rather than a multiplier. This is illustrated in the following example.
Example 2
Consider the device in Figure 6-18.
Figure 6-18 GMULT Part Example With this device, the output is a current is equal to the ratio of the voltages at input pins 1 and input pins 2. If V(%IN2+, %IN2) = 0, the output depends upon V(%IN1+, %IN1-) as follows: if V(%IN1+, %IN1-) = 0, output = 0 if V(%IN1+, %IN1-) > 0, output = MAXREAL if V(%IN1+, %IN1-) < 0, output = -MAXREAL where MAXREAL is a PSpice internal constant representing a very large number (on the order of 1e30). In general, the result of evaluating an expression is limited to MAXREAL. Note that the output of the symbol can also be used as part of the controlling function. To create this device, you would first make a new symbol, GDIV, based on the GMULT part. Edit the GDIV template to divide the two input values rather than multiply them.
PSpice-Equivalent Parts
6-33
First, EXPR is evaluated, and that value is used to look up an entry in the table. EXPR is a function of the input (current or voltage) and follows the same rules as for VALUE expressions. The table consists of pairs of values, the first of which is an input, and the second of which is the corresponding output. Linear interpolation is performed between entries. For values of EXPR outside the tables range, the devices output is a constant with a value equal to the entry with the smallest (or largest) input. This characteristic can be used to impose an upper and lower limit on the output. An example of a table declaration (using the TABLE attribute) would be the following:
6-34
PSpice-Equivalent Parts
6-35
3 J. A. Aseltine, Transform
Method in Linear System Analysis, McGraw-Hill (1958)
4 G. R. Cooper and C. D.
McGillen, Methods of Signal and System Analysis, Holt, Rinehart, and Winston (1967)
The LAPLACE parts use a Laplace transform description. The input to the transform is the value of EXPR, where EXPR follows the same rules as for VALUE expressions (see EVALUE and GVALUE parts on page 6-30). XFORM is an expression in the Laplace variable, s. It follows the rules for standard expressions as described for VALUE expressions with the addition of the s variable. The output of the device depends on the type of analysis being done. For DC and bias point, the output is simply the zero
6-36
frequency gain times the value of EXPR. The zero frequency gain is the value of XFORM with s = 0. For AC analysis, EXPR is linearized around the bias point (similar to the VALUE parts). The output is then the input times the gain of EXPR times the value of XFORM. The value of XFORM at a frequency is calculated by substituting jw for s, where w is 2pfrequency. For transient analysis, the value of EXPR is evaluated at each time point. The output is then the convolution of the past values of EXPR with the impulse response of XFORM. These rules follow the standard method of using Laplace transforms. We recommend looking at one or more of the references cited in Frequency-Domain Device Models on page 6-35 for more information.
Example
The input to the Laplace transform is the voltage across the input pins, or V(%IN+, %IN-). The EXPR attribute may be edited to include constants or functions, as with other parts. The transform, 1/(1+.001s), describes a simple, lossy integrator with a time constant of 1 millisecond. This can be implemented with an RC pair that has a time constant of 1 millisecond. Using the symbol editor, you would define the XFORM and EXPR attributes as follows:
XFORM = 1/(1+.001*s) EXPR = V(%IN+, %IN-)
After netlist substitution of the template, the resulting transfer function would become:
V(%OUT+, %OUT-) = LAPLACE {V(%IN+, %IN-)}= (1/1+.001*s))
The output is a voltage and is applied between pins %OUT+ and %OUT-. For DC, the output is simply equal to the input, since the gain at s = 0 is 1.
PSpice-Equivalent Parts
6-37
For AC analysis, the gain is found by substituting j for s. This gives a flat response out to a corner frequency of 1000/(2) = 159 Hz and a roll-off of 6 dB per octave after 159 Hz. There is also a phase shift centered around 159 Hz. In other words, the gain has both a real and an imaginary component. The gain and phase characteristic is the same as that shown for the equivalent control system part example using the LAPLACE part (see Figure 6-7 on page 6-19). For transient analysis, the output is the convolution of the input waveform with the impulse response of 1/(1+.001s). The impulse response is a decaying exponential with a time constant of 1 millisecond. This means that the output is the lossy integral of the input, where the loss has a time constant of 1 millisecond. This will produce a PSpice netlist declaration similar to:
ERC 5 0 LAPLACE {V(10)} = {1/(1+.001*s)}
6-38
EFREQ and GFREQ attributes are defined as follows: EXPR TABLE is the value used for table lookup; defaults to V(%IN+, %IN-) if left blank. is a series of either (input frequency, magnitude, phase) triplets, or (input frequency, real part, imaginary part) triplets describing a complex value; defaults to (0,0,0) (1Meg,-10,90) if left blank. group delay increment; defaults to 0 if left blank. defines the table type; if left blank, the frequency table is interpreted in the (input frequency, magnitude, phase) format; if defined with any value (such as YES), the table is interpreted in the (input frequency, real part, imaginary part) format. units for magnitude where the value can be DB (decibels) or MAG (raw magnitude); defaults to DB if left blank. units for phase where the value can be DEG (degrees) or RAD (radians); defaults to DEG if left blank.
DELAY R_I
MAGUNITS
PHASEUNITS
The DELAY attribute increases the group delay of the frequency table by the specified amount. The delay term is particularly useful when an EFREQ or GFREQ device generates a non-causality warning message during a transient analysis. The warning message issues a delay value that can be assigned to the symbols DELAY attribute for subsequent runs, without otherwise altering the table. The output of the device depends on the analysis being done. For DC and bias point, the output is simply the zero frequency magnitude times the value of EXPR. For AC analysis, EXPR is linearized around the bias point (similar to EVALUE and GVALUE parts). The output for each frequency is then the input times the gain of EXPR times the value of the table at that frequency. For transient analysis, the value of EXPR is evaluated at each time point.
PSpice-Equivalent Parts
6-39
The output is then the convolution of the past values of EXPR with the impulse response of the frequency response. These rules follow the standard method of using Fourier transforms. We recommend looking at one or more of the references cited in Frequency-Domain Device Models on page 6-35 for more information. Note
Figure 6-19 shows an EFREQ device used as a low pass filter. The input to the frequency response is the voltage across the input pins. The table describes a low pass filter with a response of 1 (0 dB) for frequencies below 5 kilohertz and a response of .001 (-60 dB) for frequencies above 6 kilohertz. The output is a voltage across the output pins. This part is defined by the following attributes:
TABLE = (0, 0, 0) (5kHz, 0, -5760) (6kHz, -60, -6912) DELAY = R_I = MAGUNITS = PHASEUNITS =
Since R_I, MAGUNITS, and PHASEUNITS are undefined, each table entry is interpreted as containing frequency, magnitude value in dB, and phase values in degrees. Delay defaults to 0. The phase lags linearly with frequency meaning that this table exhibits a constant time (group) delay. The delay is necessary so that the impulse response is causal. That is, so that the impulse response does not have any significant components before time zero. The constant group delay is calculated from the values for a given table entry as follows: group delay = phase / 360 / frequency For this example, the group delay is 3.2 msec (6912 / 360 / 6k = 5760 / 360 / 6k = 3.2m). An alternative specification for this table could be:
6-40
6-41
where the output on net 3 is V(1)*V(2). During AC analysis, V(3) = 0 due to the 0 volts bias point voltage on nets 1, 2, and 3. The small-signal equivalent therefore has 0 gain (the derivative of V(1)*V(2) with respect to both V(1) and V(2) is 0 when V(1)=V(2)=0). So, the output of the mixer during AC analysis will be 0 regardless of the AC values of V(1) and V(2). Another way of looking at this is that a mixer is a nonlinear device and AC analysis is a linear analysis. The output of the mixer has 0 amplitude at the fundamental. (Output is nonzero at DC and twice the input frequency, but these are not included in a linear analysis.) If you need to analyze nonlinear functions, such as a mixer, use transient analysis. Transient analysis solves the full, nonlinear circuit equations. It also allows you to use input waveforms with different frequencies (for example, VIN1 could be 90 MHz and VIN2 could be 89.8 MHz). AC analysis does not have this flexibility, but in return it uses much less computer time. Figure 6-20 Voltage Multiplier
Circuit (Mixer)
6-42
Frequency-Domain Parts
Some caution is in order when moving between frequency and time domains. This section discusses several points that are involved in the implementation of frequency-domain parts. These discussions all involve the transient analysis, since both the DC and AC analyses are straightforward. The first point is that there are limits on the maximum values and on the resolution of both time and frequency. These are related: the frequency resolution is the inverse of the maximum time and vice versa. The maximum time is the length of the transient analysis, TSTOP. Therefore, the frequency resolution is 1/TSTOP.
Laplace Transforms
For Laplace transforms, PSpice starts off with initial bounds on the frequency resolution and the maximum frequency determined by the transient analysis parameters as follows. The frequency resolution is initially set below the theoretical limit to (.25/TSTOP) and is then made as large as possible without inducing sampling errors. The maximum frequency has an initial upper bound of (1/(RELTOL*TMAX)), where TMAX is the transient analysis Step Ceiling value, and RELTOL is the relative accuracy of all calculated voltages and currents. If a Step Ceiling value is not specified, PSpice uses the Transient Analysis Print Step, TSTEP, instead. Note
TSTOP, TMAX, and TSTEP values are configured using Transient on the Setup menu. The RELTOL attribute is set using Options on the Setup menu.
PSpice then attempts to reduce the maximum frequency by searching for the frequency at which the response has fallen to RELTOL times the maximum response. For instance, for the transform: 1/(1+s) the maximum response, 1.0, is at s = j = 0 (DC). The cutoff frequency used when RELTOL=.001, is approximately 1000/
6-43
(2) = 159 Hz. At 159 Hz, the response is down to .001 (down by 60 db). Since some transforms do not have such a limit, there is also a limit of 10/RELTOL times the frequency resolution, or 10/(RELTOLTSTOP). For example, consider the transform: e-0.001s This is an ideal delay of 1 millisecond and has no frequency cutoff. If TSTOP = 10 milliseconds and RELTOL=.001, then PSpice imposes a frequency cutoff of 10 MHz. Since the time resolution is the inverse of the maximum frequency, this is equivalent to saying that the delay cannot resolve changes in the input at a rate faster than .1 microseconds. In general, the time resolution will be limited to RELTOLTSTOP/10. A final computational consideration for Laplace parts is that the impulse response is determined by means of an FFT on the Laplace expression. The FFT is limited to 8192 points to keep it tractable, and this places an additional limit on the maximum frequency, which may not be greater than 8192 times the frequency resolution. If your circuit contains many Laplace parts which can be combined into a more complex single device, it is generally preferable to do this. This saves computation and memory since there are fewer impulse responses. It also reduces the number of opportunities for numerical artifacts that might reduce the accuracy of your transient analyses. Laplace transforms can contain poles in the left half-plane. Such poles will cause an impulse response that increases with time instead of decaying. Since the transient analysis is always for a finite time span, PSpice does not have a problem calculating the transient (or DC) response. However, you need to be aware that such poles will make the actual device oscillate.
6-44
A good example of this is the expression {S}, which corresponds to differentiation in the time domain. The impulse response for {S} is an impulse pair separated by an infinitesimal distance in time. The impulses have opposite signs, and are situated one in the infinitesimal past, the other in the infinitesimal future. In other words, convolution with this corresponds to applying a finite-divided difference in the time domain. The problem with this for PSpice is that the simulator only has the present and past values of the simulated input, so it can only apply half of the impulse pair during convolution. This will obviously not result in time-domain differentiation. PSpice can detect, but not fix this condition, and issues a non-causality warning message when it occurs. The message tells what percentage of the impulse response is non-causal, and how much delay would need to be added to slide the non-causal part into a causal region. {S} is theoretically 50% non-causal. Noncausality on the order of 1% or less is usually not critical to the simulation results. One more point about {S}. You can delay it to keep it causal, but keep in mind that the separation between the impulses is infinitesimal. This means that a very small time step is needed. For this reason, it is usually better to use a macromodel to implement differentiation. Here are some useful guidelines:
In the case of a Laplace device (ELAPLACE), multiply the Laplace expression by e to the (-s <the suggested delay>). In the case of a frequency table (EFREQ or GFREQ), do either of the following:
Specify the table with DELAY=<the suggested delay>. Compute the delay by adding a phase shift.
Chebyshev filters
All of the considerations given above for Laplace parts also apply to Chebyshev filter parts. However, PSpice also attempts to deal directly with inaccuracies due to sampling by applying Nyquist criteria based on the highest filter cutoff frequency. This is done by checking the value of TMAX. If TMAX is not
6-45
specified it is assigned a value, or if it is specified, it may be reduced. For low pass and band pass filters, TMAX is set to (0.5/FS), where FS is the stop band cutoff in the case of a low pass filter, or the upper stop band cutoff in the case of a band pass filter. For high pass and band reject filters, there is no clear way to apply the Nyquist criterion directly, so an additional factor of two is thrown in as a safety margin. Thus, TMAX is set to (0.25/ FP), where FP is the pass band cutoff for the high pass case or the upper pass band cutoff for the band reject case. It may be necessary to set TMAX to something smaller if the filter input has significant frequency content above these limits.
Frequency tables
For frequency response tables, the maximum frequency is twice the highest value. It will be reduced to 10/(RELTOLTSTOP) or 8192 times the frequency resolution if either value is smaller. The frequency resolution for frequency response tables is taken to be either the smallest frequency increment in the table or the fastest rate of phase change, whichever is least. PSpice then checks to see if it can be loosened without inducing sampling errors.
6-46
Do not set RELTOL to a value above 0.01. This can seriously compromise the accuracy of your simulation.
many transfer functions are not well represented by polynomials the syntax for specifying the polynomial is quite difficult to use there is no way to specify frequency-dependent behavior you cannot parameterize the coefficients on a POLY statement
The ABM parts eliminate these restrictions. Table 6-5 summarizes the linear controlled source types provided in the standard symbol library. Table 6-6 lists their attributes.
6-48
where <controlled source> <connecting nodes> <dimension> is <[E][F][G][H]device name>, meaning the device type is one of E, F, G, or H specifies <(+node_name, -node_name)> pair between which the device is connected is the dimension <value> of the polynomial describing the controlling function specifies <(+node_name, -node_name)>* pairs used as input to the voltage controlled source (device types E and G), or <V device name>* for the current controlled source (device types F and H), and where the number of controlling inputs for either case equals <dimension>
<controlling input>
<coefficients >
If the source is one-dimensional (there is only one controlling source), POLY(1) is required unless the linear form is used. If the source is multidimensional (there is more than one controlling source), the dimension needs to be included in the keyword, for instance POLY(2). Table 6-6 Basic Controlled Source Attributes
Attribut e GAIN Description gain gain transconductance transresistance COEFF polynomial coefficient
PSpice has a built-in capability allowing controlled sources to be defined with a polynomial transfer function of any degree and any dimension. Polynomials have associated coefficients for each term. Consider a voltage-controlled source with voltages V1, V2, ... Vn. The coefficients are associated with the polynomial according to this convention: Vout = P0 + P1V1 + P2V2 + PnVn + Pn+1V1V1 + Pn+2V1V2 + Pn+nV1Vn + P2n+1V2V2 + P2n+2V2V3 + P2n+n-1V2Vn + . . . Pn!/(2(n-2)!)+2nVnVn + Pn!/(2(n-2)!)+2n+1V12V1 + Pn!/(2(n-2)!)+2n+2V12V2 + . . .
6-50
The above is written for a voltage-controlled voltage source, but the form is similar for the other sources. The POLY part types shown in Table 6-5 are defined with a dimension of one, meaning there is only one controlling source. However, similar parts can be defined of any degree and dimension by creating part symbols with appropriate coefficient and TEMPLATE attributes, and the appropriate number of input pins. The current-controlled parts (F, FPOLY, H, and HPOLY), contain a current-sensing voltage source. When netlisted, they generate two device declarations to the circuit file set: one for the controlled source and one for the independent currentsensing voltage source. When defining a current-controlled source symbol of higher dimension, the TEMPLATE attribute must account for the same number of current-sensing voltage sources (equal to the dimension value). For example, a two dimensional currentcontrolled voltage source is described by the following polynomial equation: Vout = C0 + C1I1 + C2I2 + C11I12 + C12I1I2 + C22I22 To create the two dimensional HPOLY2 symbol, these attributes must be defined: COEFF0 = 1 COEFF1 = 1 COEFF2 = 1 COEFF11 = 1 COEFF12 = 1 COEFF22 = 1 COEFFS = @COEFF0 @COEFF1 @COEFF2 @COEFF11 @COEFF12 @COEFF22 TEMPLATE = H^@REFDES %5 %6 POLY(2) VH1^@REFDES VH2^@REFDES \n+ @COEFFS \nVH1^@REFDES %1 %2 0V \nVH2^@REFDES %3 %4 0V The TEMPLATE definition is actually contained on a single line. The VH1 and VH2 fragments after the \n characters represent the device declarations for the two current-sensing voltage sources required by this part. Also, the symbol graphics must have the appropriate number of pins. When placing an
instance of HPOLY2 in your schematic, the COEFFn attributes must be appropriately set.
Implementation Examples
Following are some examples of traditional SPICE POLY constructs and equivalent ABM parts which could be used instead.
This could be represented with a single ABM expression device configured with the following expression attributes:
EXP1 EXP2 EXP3 EXP4 = = = = V(1,0) + V(2,0) + V(3,0) + V(4,0)
Following template substitution for the ABM device, the output becomes:
V(OUT) = { V(1,0) + V(2,0) + V(3,0) + V(4,0) }
6-52
This could be represented with a single MULT device, which is described in Basic Components on page 6-9. For additional examples of a voltage multiplier device, see Basic Components on page 6-9 and EMULT, GMULT, ESUM, and GSUM on page 6-31.
This could be represented by a single instance of the MULT part, with both inputs from the same net. This results in the following: Vout = (Vin)2
See Creating a New Symbol on page 4-2 for a description of how to create a custom symbol.
directly in the TEMPLATE definition by defining the parts EXPR and related attributes (if any)
Refer to the PSpice Reference Manual for more information about E and G devices.
Familiarity with the PSpice syntax for declaring E and G devices will help you form a suitable TEMPLATE definition.
Part Three
Setting Up and Running Analyses
Part Three describes how to set up and run analyses and provides setup information specific to each analysis type. Chapter 7,Setting Up Analyses and Starting Simulation, provides an overview of setting up analyses and starting simulation which applies to any analysis type. Chapter 8,DC Analyses, describes how to set up DC analyses, including DC sweep, bias point detail, small-signal DC transfer, and DC sensitivity. Chapter 9,AC Sweep Analysis, describes how to set up AC sweep and noise analyses. Chapter 10,Transient Analysis, describes how to set up a transient analysis. This chapter includes a variety of topics related to transient analysis, including using the Stimulus Editor. Chapter 11,Parametric and Temperature Analysis, describes how to set up parametric, temperature, and performance analyses. Chapter 12,Monte Carlo and Sensitivity/Worst-Case Analyses, describes how to set up Monte Carlo and sensitivity/worst-case analyses.
7
Chapter Overview
This chapter provides an overview of setting up analyses and starting simulation which applies to any analysis type. The other chapters in Part Three, Setting Up and Running Analyses provide specific analysis setup information for each analysis type. This chapter includes the following sections: Analysis Types on page 7-2 Setting Up Analyses on page 7-3 Starting Simulation on page 7-11
7-2
Analysis Types
Table 7-1 provides a summary of the available PSpice analyses and the corresponding dialog box (accessed using Setup on the Analysis menu) where the analysis parameters are specified. Table 7-1 Classes of PSpice Analyses
Analysis Standard analyses DC sweep DC sweep source parameter temperature bias point small-signal DC transfer DC sensitivity frequency response noise (requires a frequency response analysis) transient response bias point detail transfer function sensitivity AC sweep AC sweep transient transient frequency frequency time time Analysis Setup Dialog Box Swept Variable
Note Parametric analysis is not supported by PSpice Basics. Note Monte Carlo and sensitivity/ worst-case analyses are not supported by PSpice Basics.
Fourier (requires transient response analysis) Simple multi-run analyses parametric temperature Statistical analyses Monte Carlo Sensitivity/worst-case
parametric temperature
See Part Four, Viewing Results, for information about using Probe.
The Probe waveform analyzer is used to display and graphically analyze the results of PSpice simulations for swept analyses. Supplementary analysis information is generated to the simulation output file in the form of lists and tables.
Setting Up Analyses
7-3
Setting Up Analyses
To set up one or more analyses
1 Select Analysis from the Setup menu in the schematic editor.
Shortcut: Click on .
Specific information for setting up each type of analysis is discussed in the following chapters.
2 3 4
At the Analysis Setup dialog box, click on an analysis button. If a setup options dialog box is displayed for the selected analysis type, complete the dialog box as needed. If needed, click on the check box next to the button for the analysis type so that the analysis is enabled (check box is checked on). Set up any other analyses you want to perform for the circuit.
See Output Variables on page 7-4 for a description of the output variables that can be entered in the setup options dialog box displayed for an analysis type.
7-4
Output Variables
Certain analyses (such as noise, Monte Carlo, sensitivity/worstcase, DC sensitivity, Fourier, and small-signal DC transfer function) require you to specify output variables for voltages and currents at specific points on the schematic. Depending upon the analysis type, you may need to specify the following:
voltage on a net, a pin, or at a terminal of a semiconductor device current through a part or into a terminal of a semiconductor device a device name
If output variables or other information are required, a dialog box is displayed when you click on the button for the analysis type in the Analysis Setup dialog box.
Setting Up Analyses
7-5
Voltage
Specify voltage in the following format: v[modifiers](<out id>[,<out id>]) where <out id > is: <net id> or <pin id> <net id> is a fully qualified net name (2) (3) (1)
<pin id> is <fully qualified device name>:<pin name> (4) A fully qualified net name (as referred to in line 3 above) is formed by prefixing the visible net name (from a label applied to one of the segments of a wire or bus, or an offpage port connected to the net) with the full hierarchical path, separated by periods. At the top level of hierarchy, this is just the visible name. A fully qualified device name (from line 4 above) is distinguished by specifying the full hierarchical path followed by the devices reference designator, separated by period characters. For example, a resistor with reference designator R34 inside part Y1 placed on a top-level page is referred to as Y1.R34 when used in an output variable. A <pin id> (from line 4) is uniquely distinguished by specifying the full part name (as described above) followed by a colon, and the pin name. For example, the pins on a capacitor with reference designator C31 placed on a top-level page and pin names 1 and 2 would be identified as C31:1 and C31:2, respectively.
Current
Specify current in the following format: i[modifiers](<out device>[:modifiers]) where <out device> is a fully qualified device name.
7-6
Modifiers
The basic syntax for output variables can be modified to indicate terminals of semiconductors and/or AC specifications. The modifiers come before <out id> or <out device>. Or, when specifying terminals (such as source or drain), the modifier is the pin name contained in <out id>, or is appended to <out device> separated by a colon. Modifiers can be specified as follows:
where terminal specifies one or two terminals for devices with more than two terminals, such as D (drain), G (gate), S (source) specifies the quantity to be reported for an AC analysis, such as M (magnitude), P (phase), G (group delay) specifies either the <net id> or <pin id> (<fully qualified device name>:<pin name>) specifies the <fully qualified device name>
AC suffix
These building blocks can be used for specifying output variables as shown in Table 7-3 (which summarizes the accepted output variable formats) and Tables 7-4 through 7-7 (which list valid elements for two-terminal, three or fourterminal, transmission line devices, and AC specifications).
Setting Up Analyses
7-7
Table 7-3
Format V[ac](< + V[ac](< V[ac](< V[ac](< >) or
out id >)
voltage at out
id
+out id >,< - out id >) 2-terminal device out id >) 3 or 4-terminal device out id or 4-terminal out device or 4-terminal out
ids
Voltage at a 2-terminal device out id Voltage at non-grounded terminal x of a 3 or 4-
V<x>[ac](< 3 >)
terminal device
Voltage across terminals
transmission line out id >) or transmission line out or 4-terminal out device 3 or 4-terminal out device line out device
I<x>[ac](< >)
out device
Voltage or current source name
7-8
Device Type
capacitor
Setting Up Analyses
7-9
Table 7-5
Device Type
<pin id >
GaAs MESFET
V(B11:D) ID(B11)
Junction FET
VG(JFET) I(JFET:G)
MOSFET
VDG(M1) ID(M1)
bipolar transistor Q
V(Q1:B) I(Q1:C)
IGBT
V(Z1:C) I(Z1:C)
Device Type
<z>
transmission line
A (Port A) B (Port B)
7-10
The INOISE, ONOISE, DB(INOISE), and DB(ONOISE) output variables are predefined for use with noise (AC sweep) analysis.
Starting Simulation
7-11
Starting Simulation
Once you have used MicroSim Schematics to enter your circuit design and set up the analyses to be performed, you can start simulation from Schematics by selecting Simulate from the Analysis menu. When you enter and set up your circuit this way, the files needed for simulation are automatically created by Schematics and the simulator is started from Schematics. There may be situations, however, when you want to run PSpice outside of Schematics. You may want to simulate a circuit that wasnt created in Schematics, for example, or you may want to run simulations of multiple circuits in batch mode. This section includes the following: Starting Simulation from Schematics, below Starting Simulation Outside of Schematics on page 7-12 Setting Up Batch Simulations on page 7-12 The Simulation Status Window on page 7-14
Select Simulate from the Analysis menu Press ! Click on the Simulate icon
Simulate icon:
7-12
Double-click on the circuit file name in the list box. Enter the name of the circuit file to be simulated in the File Name text box.
Starting Simulation
7-13
Method 1
1 2 3 Click on the PSpice icon in the MicroSim program group. Select Properties from the File menu. Include the following switch in the command line:
/wNO_NOTIFY
This turns off the message that pops up each time a simulation is completed. 4 5 Select Open from the File menu from the PSpice status window. Do one of the following:
Type each file name in the File Name text box separated by a space. Use the combination keystrokes and mouse clicks in the list box as follows: C+click to select file names one at a time, and V+click to select groups of files.
Method 2
1 2 3 Click on the PSpice icon in the MicroSim program group. Select Properties from the File menu. Include the following switch in the command line:
/wNO_NOTIFY
This turns off the message that pops up each time a simulation is completed. 4 Update the command line in one of the following ways:
Include a list of circuit file names separated by spaces. Read a file of run time properties (using the @<file name> syntax) which contains a list of circuit file names.
7-14
Circuit file names may be fully qualified or contain the wild card characters * and ?.
Figure 7-1 PSpice Status Window The status window includes the following:
Title bar This area at the top of the window identifies the name of the circuit file currently under simulation, and the name of the simulation output file where audit trail information will be written. Menus The menus accessed from the menu bar include items to control the simulator and customize the window display characteristics. These are especially useful when invoking PSpice directly. Simulation progress display The lower portion of the window displays the progress of each simulation as it proceeds.
DC Analyses
8
Chapter Overview
This chapter describes how to set up DC analyses and includes the following sections: DC Sweep on page 8-2 Bias Point Detail on page 8-7 Small-Signal DC Transfer on page 8-8 DC Sensitivity on page 8-10
8-2
DC Analyses
DC Sweep
Minimum Requirements to Run a DC Sweep Analysis
Minimum circuit design requirements
Table 8-1 DC Sweep Circuit Design Requirements
Swept Variable Type voltage source temperature current source model parameter global parameter Requirement voltage source with a DC specification (VDC, for example) none current source with a DC specification (IDC, for example) PSpice model (.MODEL) global parameter defined with a parameter block (.PARAM)
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box.
In the Analysis Setup dialog box, click on the DC Sweep button. Complete the DC Sweep dialog box as needed. If needed, click on the DC Sweep check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
Note
Do not specify a DC sweep and a parametric analysis for the same variable.
DC Sweep
8-3
Overview of DC Sweep
The DC sweep analysis causes a DC sweep to be performed on the circuit. DC sweep allows you to sweep a source (voltage or current), a global parameter, a model parameter, or the temperature through a range of values. The bias point of the circuit is calculated for each value of the sweep. This is useful for finding the transfer function of an amplifier, the high and low thresholds of a logic gate, and so on. For the DC sweep analysis specified in Figure 8-1, the voltage source V1 is swept from -0.125 volts to 0.125 volts by steps of 0.005. This means that the output has (0.125 + 0.125)/0.005 +1 = 51 lines. A source with a DC specification (such as VDC or IDC) must be used if the swept variable is to be a voltage type or current source. To set the DC attribute, select Attributes from the Edit menu. The default DC value of V1 is overridden during the DC sweep analysis and is made to be the swept value. All of the other sources retain their values. After running the analysis, the simulation output file (example.out for the example.sch circuit in Figure 8-2) contains a table of voltages relating V1, node OUT1, and node OUT2.
The example circuit example.sch is provided with the MicroSim software installation.
8-4
DC Analyses
To calculate the DC response of an analog circuit, PSpice removes time from the circuit. This is done by treating all capacitors as open circuits, all inductors as shorts, and using only the DC values of voltage and current sources. In order to solve the circuit equations, PSpice uses an iterative algorithm using continuous equations.
Nested DC Sweeps
A second sweep variable can be selected once a primary sweep value has been specified in the DC Sweep dialog box. When you specify a secondary sweep variable, it forms the outer loop for the analysis. That is, for every increment of the second sweep variable, the first sweep variable is stepped through its entire range of values.
DC Sweep
8-5
When the DC sweep analysis is run, add a current marker at the drain pin of M1 and display the simulation result in Probe. The result will look like Figure 8-4. We can add the load line for a resistor by adding a trace which computes the load line from the sweep voltage. Assume that the X axis variable is the sweep voltage V_VD, which runs from 0 to 5 volts. The expression which will add a trace that is the load line for a 50 kohm resistor is:
(5V-V_VD)/50K
V_VD is the hierarchical name for VD created by netlisting the schematic. This is the name used by Probe.
This can be useful for determining the bias point for each member of a curve family as shown in Figure 8-5.
8-6
DC Analyses
Figure 8-5 Operating Point Determination for Each Member of the Curve Family
8-7
Click on the Bias Point Detail check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box.
A list of all analog node voltages The currents of all voltage sources and their total power A list of the small-signal parameters for all devices
If Bias Point Detail is enabled, you can suppress the reporting of the bias point analog: 1 Select Setup from the Analysis menu.
8-8
DC Analyses
2 3
In the Analysis Setup dialog box, click on Options. In the Yes/No options for the Options dialog box, set NOBIAS to Y (for yes).
Small-Signal DC Transfer
Minimum Requirements to Run a Small-Signal DC Transfer Analysis
Minimum circuit design requirements
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box.
In the Analysis Setup dialog box, click on the Transfer Function button. In the Transfer Function dialog box, specify the name of the input source desired. See Output Variables on page 7-4 for a description of output variable formats. If needed, click on the Transfer Function check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
Small-Signal DC Transfer
8-9
8-10
DC Analyses
DC Sensitivity
Minimum Requirements to Run a DC Sensitivity Analysis
Minimum circuit design requirements
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box. See Output Variables on page 7-4 for a description of output variables.
None.
In the Analysis Setup dialog box, click on the Sensitivity button. In the Sensitivity Analysis dialog box, enter the output variable desired. If needed, click on the Sensitivity check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
Overview of DC Sensitivity
DC sensitivity analysis calculates and reports the sensitivity of one node voltage to each device parameter for the following device types:
resistors independent voltage and current sources voltage and current-controlled switches diodes bipolar transistors
The sensitivity is calculated by linearizing all devices around the bias point.
AC Sweep Analysis
9
Chapter Overview
This chapter describes how to set up an AC sweep analysis and includes the following sections: Overview of AC Sweep Analysis on page 9-2 Nonlinear Components in an AC Sweep Analysis on page 9-4 Noise Analysis on page 9-5
9-2
AC Sweep Analysis
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box.
In the Analysis Setup dialog box, click on the AC Sweep button. Complete the AC Sweep and Noise Analysis dialog box as needed. If needed, click on the AC Sweep check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
Overview of AC Sweep
Figure 9-1 AC Sweep Setup
Example
The frequency response analysis calculates the small-signal response of the circuit, linearized around the bias point, to a combination of inputs. Nonlinear devices, such as voltage-controlled or currentcontrolled switches, behave in a similar manner. That is, they are linearized about their bias point value and then a linear (small-signal) analysis is performed. In the case of the nonlinear controlled switches, the switch acts as a resistor based upon the controlling input value at the bias point.
9-3
For the AC sweep analysis specified in Figure 9-1, the frequency is swept from 100 kHz to 10 GHz by decades, with 10 points per decade. Unlike DC sweep, the AC sweep analysis does not specify an input source. Instead, each independent source contains its own AC specification for magnitude and phase. In the example circuit in Figure 9-2, V1 has the AC attribute equal to 1 volt and a relative phase of 0 degrees by default. During the AC sweep analysis, the contributions from all sources are propagated throughout the circuit and summed at all the nodes. V1 is the only input to an amplifier, so it is the only source to have a nonzero AC value.
The example circuit example.sch is provided with the MicroSim software installation.
9-4
AC Sweep Analysis
You would generally use a number of simplifying approximations. For example, a bipolar transistor in commonemitter mode would be replaced by a constant transconductance (collector current proportional to base-emitter voltage), plus a number of constant impedances. PSpice performs exactly the same sequence of operations. It determines partial derivatives for nonlinear devices at the bias point, and these are then used for small-signal analysis. Other nonlinear devices are treated in exactly the same way. For example, suppose we have a behavioral modeling block that multiplies V(1) by V(2). Multiplication is a nonlinear operation, so AC sweep analysis requires that this block be replaced by its linear equivalent. Unless the bias point is known, however, the linear equivalent cannot be determined. Suppose a 2 volt DC source is connected between node 1 and ground (with suitable dummy resistors). Then, at the bias point for the circuit, V(1) = 0 volts and V(2) = 2 volts. You can now replace the multiplier block with an equivalent block that has a fixed gain of 2 so that the output is 2*V(1) + 0*V(2). AC sweep analysis correctly shows the transfer function of the circuit as having a gain of 2. Consider another example. Suppose the 2 volt DC source in the above example is replaced with an AC source with amplitude 1. When the bias point is computed, there are no DC sources in the circuit, so all nodes are at 0 volts at the bias point. Now the linear equivalent of the multiplier block is a block with gain 0, which means that there is no output voltage at the fundamental
Noise Analysis
9-5
frequency. This is exactly how a double-balanced mixer behaves (in practice, just a multiplier). Of course, a doublebalanced mixer produces outputs at DC and at twice the input frequency, but these terms cannot be seen with a linear, smallsignal analysis.
Noise Analysis
Noise analysis is an AC sweep option that is run when the Noise Analysis check box is checked on in the AC Sweep and Noise Analysis dialog box. Noise analysis calculates noise contributions from each resistor and semiconductor device and performs an RMS sum at a specified output node. This calculation is done for all the frequencies specified for the AC sweep analysis. Output voltage requires that you enter an output variable. I/ V Source specifies the name of an independent voltage or current source at which to calculate the equivalent input noise. For example, if you enter V1 as the I/V Source, V1 is the place at which an equivalent input noise is calculated. Interval specifies the print interval. For every nth frequency where n is the print interval, a detailed table is printed showing the individual contributions of all the circuits noise generators to the total noise. If no value is specified, then no detailed table is printed. For example, assume that you want to run a noise analysis on the circuit shown in Figure 9-2 on page 9-3. You would enable noise analysis by checking the Noise Analysis check box, then you might enter the following values in the AC Sweep and Noise Analysis dialog box: Output Voltage I/V Source Interval
V(OUT2) V1 30
This sets node OUT2 as the output node and V1 as the input (or source). This does not mean that V1 is the noise source. Rather, V1 is the place at which an equivalent input noise is calculated.
9-6
AC Sweep Analysis
The noises are summed at node OUT2. This result is then divided by the gain from V1 to node OUT2 to get the amount of noise which, if injected at V1 into a noiseless circuit, would cause the previously calculated amount of noise at node OUT2. The interval value of 30 results in a detailed table of values for every 30th frequency. There are two types of reports from the noise analysis: detailed tables and summary tables. The detailed tables are specified by the interval value in the Noise Analysis section of the dialog box. In the preceding example, the value of 30 specifies that for every 30th frequency of the AC analysis, a detailed table is to be reported. These tables are labeled NOISE ANALYSIS in the simulation output file. The second type of output reported are summary outputs showing the RMS summed noise at node OUT2(ONOISE) and the equivalent input noise at V1(INOISE).
Transient Analysis
10
Chapter Overview
This chapter describes how to set up a transient analysis and includes the following sections: Overview of Transient Analysis on page 10-2 Stimulus Generation on page 10-3 Transient (Time) Response on page 10-14 Internal Time Steps in Transient Analyses on page 10-15 Switching Circuits in Transient Analyses on page 10-16 Plotting Hysteresis Curves on page 10-16 Fourier Components on page 10-18
10-2
Transient Analysis
An independent source with a transient specification (see Table 10-1) An initial condition on a reactive element A controlled source that is a function of time
In the Analysis Setup dialog box, click on the Transient button. Complete the Transient dialog box as needed. If needed, click on the Transient check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
Stimulus Generation
10-3
Stimulus Generation
Overview of Stimulus Generation
Parts which generate stimuli for your circuit can be divided into two categories:
stimulus parts whose transient behavior is characterized graphically using the Stimulus Editor stimulus parts whose transient (if applicable) behavior is characterized by manually defining their attributes within MicroSim Schematics
See The Stimulus Editor Utility on page 10-5 for a description of how to use the Stimulus Editor.
Their symbols are summarized in Table 10-1. Table 10-1 Stimulus Parts Classified by Transient Specification
Category graphically characterized Symbol Name VSTIM ISTIM characterized by attribute VSRC VEXP VPULSE VPWL VPWL_ENH VPWL_FILE VSFFM VSIN ISRC IEXP IPULSE IPWL IPWL_ENH IPWL_FILE ISFFM ISIN Description voltage source current source voltage sources
current sources
10-4
Transient Analysis
All of these parts are used by placing instances in your schematic and defining their attributes using Attributes on the Edit menu. Each attribute-characterized stimulus has a distinct set of attributes depending upon the kind of transient behavior it represents. For VPWL_FILE, IPWL_FILE, and FSTIM, a separate file contains the stimulus specification. As an alternative, the Stimulus Editor utility automates the process of defining the transient behavior of stimulus devices. The Stimulus Editor allows you to create analog stimuli which generate sine wave, repeating pulse, exponential pulse, singlefrequency FM, and piecewise linear waveforms. This applies to both part instances placed in your schematic as well as new stimulus symbols that you might create.
MicroSim Schematics MicroSim Stimulus Editor input waveforms MicroSim PSpice
stimulus files
Figure 10-1 Relationship of Stimulus Editor with Schematics and PSpice The stimulus specification created using the Stimulus Editor is saved to a file, automatically configured into the schematic, and associated with the corresponding VSTIM, ISTIM, or DIGSTIM part instance or symbol definition.
Stimulus Files
The Stimulus Editor produces a file containing the stimuli with their transient specification. These stimuli are defined as simulator device declarations using the V (voltage source) and I (current source) forms. Since the Stimulus Editor produces these statements automatically, you will never have to be concerned with their syntax. However, if you are interested in a detailed description of their syntax, see the descriptions of V and I devices in the PSpice Reference Manual.
MicroSim software versions without the Stimulus Editor must use the characterized-byattribute sources listed in Table 10-1 on page 10-3.
10-6
Transient Analysis
box and then clicking on the Add Stimulus (local configuration) or Add Stimulus* (global configuration) button. All other commands work as described for model and include files in Global and local model files on page 5-36.
Double-click on a stimulus instance. Select one or more stimulus instances in the schematic and select Stimulus from the Edit menu. Select Edit Stimulus from the Analysis menu.
When you first start the Stimulus Editor, you may need to adjust the scale settings to fit the trace you are going to add. You can use Axis Settings on the Plot menu or the corresponding toolbar button to change the displayed data, the extent of the scrolling region, and the minimum resolution for each of the axes. Displayed Data Range parameters determine what portion of the stimulus data set will be presented on the screen. Extent of Scrolling Region parameters set the absolute limits on the viewable range. Minimum Resolution parameters determine the smallest usable increment (example: if it is set to 1 msec, then you cannot add a data point at 1.5 msec).
Defining Stimuli
1 2 3 Place stimulus part instances from the symbols VSTIM and ISTIM. Start the Stimulus Editor as described in Starting the Stimulus Editor on page 10-6. From within the Stimulus Editor: a Edit the transient specification:
As indicated by the dialog boxes and prompts, or by: Direct manipulation of the input waveform display for analog piecewise linear stimuli. Save the edits by selecting Save from the File menu.
3 4 5
10 Select Save from the File menu. If you make a mistake or want to make any changes, reshape the trace by dragging any of the handles to a new location. The dragged handle cannot pass any other defined data point.
10-8
Transient Analysis
To delete a point, click on its handle and press X. To add additional points, either select Add Point from the Edit menu, press A+A, or click on the Add Point toolbar button. At this point you can return to Schematics, edit the current stimulus, or go on to create another.
This example creates a 10 K sin wave with the amplitude parameterized so that it can be swept during a simulation.
Define the other stimulus properties: a b Enter 0 for Offset Value. Enter {AMP} for Amplitude. The curly braces are required. They indicate that the expression needs to be evaluated at simulation time. Enter 10k for Frequency and click on OK. Select Save from the File menu.
c d 7
Within Schematics, place and define the PARAM symbol: a Select Get New Part from the Draw menu.
b c d e 8
Either browse special.slb for the PARAM symbol or type in the name. Place the symbol on your schematic and double-click on it to edit the attributes. Set the value of the NAME1 attribute to AMP (no curly braces) Set the value of the VALUE1 attribute to 1.
Set up the parametric sweep and other analyses: a b c d e f Select Setup from the Analysis menu, and click on the Parametric button. Select Global Parameter in the Swept Var. Type frame. Select Linear in the Sweep type frame. Enter AMP in the Name text box. Specify values for the Start Value, End Value, and Increment text boxes. You can now set up your usual Transient, AC, or DC analysis and run the simulation.
STIMULUS 2
Select Stimulus from the Edit menu. Schematics searches the configured list of global stimulus files. If you are creating a new stimulus symbol and the stimulus is not found, you are prompted for the name of the stimulus file in which the new definition should be saved.
10-10
Transient Analysis
From within the Stimulus Editor, edit the transient specification as indicated by the dialogs and prompts, or by direct manipulation of the input waveform display for analog piecewise linear stimuli. Select Save from the File menu.
Editing a Stimulus
To edit an existing stimulus
1 2 Start the Stimulus Editor and select Get from the Stimulus menu. Double-click on the trace name. This opens the Stimulus Attributes dialog box where you can modify the attributes of the stimulus directly and immediately see the effect of the changes.
PWL stimuli are a little different since they are a series of time/ value pairs.
10-11
b c
10-12
Transient Analysis
In the schematic editor, configure the Stimulus Editors output file into your schematic: a b c Select Library and Include Files from the Analysis menu. Enter the file name specified in step 2. If the stimulus specifications are for local use in the current schematic, click on the Add Stimulus (or Add Include) button. For global use by a symbol in the Symbol Library or by any schematic, use Add Stimulus* (or Add Include*) instead. Click on OK.
d 5
Modify either the stimulus instances in the schematic or symbols in the symbol library to reference the new stimulus specification. Associate the transient stimulus specification to a stimulus instance: a b c d e Place a stimulus part in your schematic from the symbol set: VSTIM, ISTIM, and DIGSTIM. Click on the VSTIM, ISTIM, or DIGSTIM instance. Select Attributes from the Edit menu. Click on the STIMULUS= attribute, type in the name of the stimulus, and click on Save Attr. Complete specification of any VSTIM or ISTIM instances by selecting Attributes from the Edit menu and editing their DC and AC attributes. Click on the DC= attribute, type its value in the Value text box, and click on Save Attr. Click on the AC= attribute, type its value in the Value text box, and click on Save Attr. Click on OK to return to the schematic.
To change stimulus references globally for a symbol: a Select Edit Library from the File menu to start the symbol editor.
10-13
Create or change a symbol definition, making sure to define the following attributes: PART Symbol name. It is good practice to have the symbol name match the STIMULUS name. Stimulus name as defined in the Stimulus Editor.
See Chapter 4,Creating Symbols, for a description of how to create and edit symbols.
STIMULUS
To use the VSTIM or ISTIM source to define the transient stimulus behavior
1 2 Place the VSTIM or ISTIM source symbol in your schematic. Double-click on the source instance to start the Stimulus Editor. When you are asked whether you want to edit the named stimulus, click on OK. Fill in the transient specification according to the dialogs and prompts. Piecewise linear stimuli can be specified by direct manipulation of the input waveform display.
See Stimulus Generation on page 10-3 for a description of the Stimulus Editor.
10-14
Transient Analysis
V1s value varies as a 5 MHz sine wave with an offset voltage of 0 volts and a peak amplitude of 0.1 volts.
The example circuit example.sch is provided with the MicroSim software installation.
Figure 10-3 Example Schematic example.sch The transient analysis does its own calculation of a bias point to start with, using the same technique as described for DC sweep. This is necessary because the initial values of the sources can be different from their DC values. If you want to report the smallsignal parameters for the transient bias point, you should use the
10-15
Transient command and enable Detailed Bias Point. Otherwise, if all you want is the result of the transient run itself, you should only enable the Transient command. In the simulation output file example.out, the bias-point report for the transient bias point is labeled INITIAL TRANSIENT SOLUTION.
10-16
Transient Analysis
One method of avoiding this problem is to transform the switching circuit into an equivalent circuit without switching. The equivalent circuit represents a sort of quasi steady-state of the actual circuit and can correctly model the actual circuits response as long as the inputs do not change too fast.
10-17
Figure 10-5 Netlist for Schmitt Trigger Circuit The QSTD model is defined as: .MODEL QSTD NPN( is=1e-16 bf=50 br=0.1 rb=50 rc=10 tf=.12ns tr=5ns + cje=.4pF pe=.8 me=.4 cjc=.5pF pc=.8 mc=.333 ccs=1pF va=50) Instead of using the DC sweep to look at the hysteresis, we use the transient analysis, (Print Step = .01ms and Final Time = 2ms) sweeping VIN from -1.8 volts to -1.0 volts and back down to -1.8 volts, very slowly. This has two advantages:
it avoids convergence problems it covers both the upward and downward transitions in one analysis
After the simulation, when we are in Probe, the X axis variable is initially set to be Time. By selecting X Axis Settings from the Plot menu and clicking on the Axis Variable button, we can set the X axis variable to be V(1). Then we can use Add on the Trace menu to display V(7), and change the X axis to a user defined data range from -1.8V to -1.0V (X Axis Settings on the Plot menu). This plots the output of the Schmitt trigger against its input, which is what we want. The result looks similar to Figure 10-6.
10-18
Transient Analysis
Fourier Components
The Fourier analysis is enabled through the transient analysis setup dialog box. Fourier analysis calculates the DC and Fourier components of the result of a transient analysis. By default, the 1st through 9th components are computed, however, more can be specified. You must do a transient analysis in order to do a Fourier analysis. The sampling interval used during the Fourier transform is equal to the print step specified for the transient analysis. When selecting Fourier to run a harmonic decomposition analysis on a transient waveform, only a portion of the waveform is used. Using Probe, a Fast Fourier Transform (FFT) of the complete waveform can be calculated and its spectrum displayed. In the example Fourier analysis specification shown in Figure 10-2 on page 10-14, the voltage waveform at node OUT2 from the transient analysis is to be used and the fundamental frequency is to be 1 megahertz for the harmonic decomposition.
Fourier Components
10-19
The period of fundamental frequency is 1 microsecond (inverse of the fundamental frequency). Only the last 1 microsecond of the transient analysis is used, and that portion is assumed to repeat indefinitely. Since V1s sine wave does indeed repeat every 1 microsecond, this is sufficient. In general, however, you must make sure that the fundamental Fourier period fits the waveform in the transient analysis.
11
Chapter Overview
This chapter describes how to set up parametric and temperature analyses. Parametric and temperature are both simple multi-run analysis types. This chapter includes the following sections: Parametric Analysis on page 11-2 Temperature Analysis on page 11-11
11-2
Parametric Analysis
Minimum Requirements to Run a Parametric Analysis
Minimum circuit design requirements
Set up the circuit according to the swept variable type as listed in Table 11-1. Set up a DC sweep, AC sweep, or transient analysis.
In the Analysis Setup dialog box, click on the Parametric button. Complete the Parametric dialog box as needed. If needed, click on the Parametric check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
Note
Do not specify a DC sweep and a parametric analysis for the same variable.
Parametric Analysis
11-3
11-4
This series of PSpice runs varies the value of resistor R1 from 0.5 to 1.5 ohms in 0.1 ohm steps. Since the time-constant of the circuit is about one second, we perform a transient analysis of approximately 20 seconds. Create the circuit in MicroSim Schematics by placing a piecewise linear independent current source (IPWL from source.slb). Set the current source attributes as follows:
AC T1 I1 T2 I2 T3 I3 = = = = = = = 1a 0s 0a 10ms 0a 10.1ms 1a
Place an instance of a resistor and set its VALUE attribute to the expression, {R}. To define R as a global parameter, place a PARAM pseudocomponent defining its NAME1 attribute to R and VALUE1 attribute to 0.5. Place an inductor and set its value to 1H, place a capacitor and set its value to 1, and place an analog ground symbol (AGND from port.slb). Wire the schematic symbols together as shown in Figure 11-1.
Shortcut: Click on !
or press
After setting up the analyses, start the simulation by selecting Simulate from the Analysis menu.
Parametric Analysis
11-5
To access the Add Traces dialog box, select Traces from the Add menu in Probe.
Troubleshooting tip More than one PSpice run or data section is required for performance analysis because one data value is derived for each waveform in a related set of waveforms. A trace of the derived values cannot be displayed if there is only one run or data section because at least two data points are required to produce a trace. However, you can use Eval Goal Functions on the Trace menu in Probe to evaluate a goal function on a single waveform, thus producing a single data point result. The genrise and overshoot goal functions are contained in the file msim.prb in the MSIM directory.
Figure 11-2 Current of L1 when R1 is 1.5 Ohms To run performance analysis: 1 2 Select X Axis Setting from the Plot menu in Probe. Click on the Performance Analysis check box so that it is checked on (enabled), then click on OK.
Probe resets the X axis variable for the graph to be the parameter that changed between PSpice runs. In the example, this is the R parameter. To see the rise time for the current through the inductor L1, select the Add from the Trace menu and then enter:
genrise( I(L1) )
11-6
In Figure 11-3, we can see how the rise time decreases as the damping resistance increases for the filter. Another Y axis can be added to the plot for the overshoot of the current through L1 by selecting Add Y Axis from the Plot menu. The Y axis is immediately added. We now select Add from the Trace menu and enter:
overshoot( I(L1) )
Figure 11-3 shows how the overshoot increases with increasing resistance.
Figure 11-3 Rise Time and Overshoot vs. Damping Resistance Now we can use the multiple X axes feature to view the original waveform family for inductor L1 current along with the derived rise time and overshoot data. We must first add a new plot by selecting Add Plot from the Plot menu. To set this plots X axis to a unique scale, select Unsync Plot from the Plot menu. Youll notice that the new plots X axis is now labeled with range and variable information. However, it is still set for Performance Analysis (with resistance R as the X axis label). We can toggle off the Performance Analysis feature by selecting X Axis Settings from the Plot menu and disabling the Performance Analysis check box. This affects only the current plot. (The plot marked with SEL>> is the current plot.) Now we can add the trace for I(L1) as weve done before (Add on the Trace menu), changing the Y axis range to 0A - 1.5A (Y
Parametric Analysis
11-7
Axis Settings on the Plot menu), and the X axis range to 0s - 20s (X Axis Settings on the Plot menu). This produces the display shown in Figure 11-4.
Figure 11-4 Inductor Waveform Data Viewed with Derived Rise Time and Overshoot Data
11-8
Place a Cbreak symbol. Select it so that it is highlighted. Select Model from the Edit menu. Select Edit Instance Model Text. Enter the following:
.model Cnln CAP(C=1 VC1=-0.01 VC2=0.05)
Set up the circuit for a parametric AC analysis (sweep Vbias), and run PSpice. Include only the frequency of interest in the AC sweep.
Parametric Analysis
11-9
Where CvF is a macro which measures the effective capacitance in a complex conductance. Macros are defined using Macro on the Trace menu. The CvF macro should be defined as:
CvF(G)= IMG(G)/(2*3.1416*Frequency)
Note that -I(Vin)/V(1) is the complex admittance of the R-C branch; the minus sign is required for correct polarity.
In the X value text box, type 10K. Click on Next>. The wizard displays the gain trace for the first run to text the goal function (YatX). Click on Finish. The resultant Probe plot is shown in Figure 11-6.
11-10
Temperature Analysis
11-11
Temperature Analysis
Minimum Requirements to Run a Temperature Analysis
Minimum circuit design requirements
None.
In the Analysis Setup dialog box, click on the Temperature button. Specify the temperature or list of temperatures in the Temperature Analysis dialog box. If needed, click on the Temperature check box in the Analysis Setup dialog box so that it is checked on (enabled). Start the simulation as described in Starting Simulation on page 7-11.
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box.
11-12
are recomputed based upon the CRES model which has parameters TC1 and TC2 reflecting linear and quadratic temperature dependencies. Likewise, the Q3 and Q4 device values are recomputed using the Q2N2222 model which also has temperature-dependent parameters. In the simulation output file, these recomputed device values are reported in the section labeled TEMPERATURE ADJUSTED VALUES.
The example circuit example.sch is provided with the MicroSim software installation.
12
Chapter Overview
This chapter describes how to set up Monte Carlo and sensitivity/worst-case analyses and includes the following sections: Statistical Analyses on page 12-2 Monte Carlo Analysis on page 12-7 Worst-Case Analysis on page 12-21
This entire chapter describes features which are not included in PSpice Basics.
12-2
Statistical Analyses
Monte Carlo and sensitivity/worst-case are statistical analyses. This section describes information common to both types of analyses. See Monte Carlo Analysis on page 12-7 for information specific to Monte Carlo analyses, and see Worst-Case Analysis on page 12-21 for information specific to sensitivity/worst-case analyses.
The Monte Carlo and worst-case analyses vary the lot or device tolerances of devices between multiple runs of an analysis (DC, AC, or transient). Before running the analysis, you must set up the model and/or lot tolerances of the model parameter to be investigated. A Monte Carlo analysis causes a Monte Carlo (statistical) analysis of the circuit to be performed. A worst-case analysis causes a sensitivity and worst-case analysis of the circuit to be performed. Sensitivity/worst-case analyses are different from Monte Carlo analysis in that they compute the parameters using the sensitivity data rather than random numbers. You can run either a Monte Carlo or a worst-case analysis, but you cannot run both at the same time. Multiple runs of the selected analysis are done while parameters are varied. You can select only one analysis type (AC, DC, or transient) per run. The analysis selected is repeated in subsequent passes of the analysis.
Statistical Analyses
12-3
Model parameter values used for each run (that is, the values with tolerances applied). Waveforms from each run, as a function of specifying data collection, or by specifying output variables in the analysis set up. A summary of all the runs using a collating function.
For information about performance analysis, see
Output is saved to the Probe data file for use by the Probe graphical waveform analyzer. For Monte Carlo analyses, Probe offers a special facility through the performance analysis feature to produce histograms of derived data.
12-4
Waveform Reports
For Monte Carlo analyses, there are four variations of the output which can be specified in the Output section of the Monte Carlo or Worst Case dialog. These options are: All
In excess of about 10 runs, the Probe display tends to become more of a band than a set of individual waveforms. This can be useful for seeing the typical spread for a particular output variable. As the number of runs becomes larger, the spread more closely approximates the actual worst-case limits for the circuit.
Forces all output to be generated (including nominal run). Generates output only during the first n runs. Generates output for every nth run. Does specified analysis and generates outputs only for the listed runs. Up to 25 values can be specified in the list.
The * indicates that you can specify runs in the Value text box. Values for the output variables specified in the selected analyses are saved to the simulation output file and Probe data file. Note that even a modest number of runs can produce large output files.
Collating Functions
You may want to compress the results of Monte Carlo and worst-case analyses further. Using the collating function specified in the Function section of the Monte Carlo or Worst Case dialog box, each run can be represented by a single number. A table of deviations per run is reported in the simulation output file. Collating functions are listed in Table 12-1. Table 12-1 Collating Functions Used in Statistical Analyses
Function YMAX MAX Description Find the greatest difference in each waveform from the nominal Find the maximum value of each waveform
Statistical Analyses
12-5
Table 12-1
Function MIN RISE_EDGE FALL_EDGE
12-6
The statistical analyses perform multiple runs, as does the temperature analysis. Conceptually, the Monte Carlo and worstcase loops are inside the temperature loop. However, since both temperature and tolerances affect the model parameters, one quickly gets into detailed questions about how the two interact. Therefore, we recommend not enabling temperature analysis when using the Monte Carlo or worst-case analyses. Also, it will not work to sweep the temperature in a DC sweep analysis while performing one of these statistical analyses, or to put tolerances on temperature coefficients. You will notice in example.sch how the temperature value is fixed at 35 C.
The example circuit example.sch is provided with the MicroSim software installation.
12-7
By default, MicroSim Schematics saves the definition to the model file example.lib and automatically configures the file for local use with the current schematic. 3 Click on the resistor instance. Select Model from the Edit menu, then select Change Model Reference to change the model reference to CRES. Set up a new Monte Carlo analysis as shown in Figure 12-2. The analysis specification instructs PSpice to do one nominal run and four Monte Carlo runs, saving the DC analysis output from those five runs.
TC1 is the linear temperature coefficient. TC2 is the quadratic temperature coefficient.
12-8
PSpice starts as usual by running all of the analyses enabled in the Analysis Setup dialog with all parameters set to their nominal values. However, with Monte Carlo enabled, the DC sweep analysis results are saved for later reference and comparison. After the nominal analyses are finished, more of the specified analysis runs are performed (DC sweep in this example). Subsequent runs use the same analysis specification as the nominal with one major exception. Instead of using the nominal parameter values, the tolerances are applied to set new parameter values and thus, new component values. The summary report generated in this example specifies that the waveform generated from V(OUT1, OUT2) should be the subject of the collating function YMAX. In each of the last four runs, the new V(OUT1, OUT2) waveform is compared to the nominal V(OUT1, OUT2) waveform for the first run, calculating the maximum deviation in the Y direction (YMAX collating function). The deviations are printed in order of size along with their run number (see Figure 12-3).
With the List option enabled, a report is also generated showing the parameter value used for each device in each run. In this case (see Figure 12-4), run 3 exhibits the highest deviation.
12-9
Figure 12-4 Parameter Values for Monte Carlo Pass 3 There is a trade-off in choosing the number of Monte Carlo runs. More runs provide better statistics, but take proportionally more computer time. The amount of computer time scales directly with the number of runs: 20 transient analyses take 20 times as long as one transient analysis. During Monte Carlo runs, the PSpice status display includes a line showing the run number and the total number of runs to be done. This gives an idea of how far the program has progressed.
Probe offers a facility to generate histograms of data derived from Monte Carlo waveform families through the performance analysis feature. For information about performance analysis, see
12-10
12-11
To set the value of the DC attribute on the V1 source, doubleclick on the V1 source, then double-click on the DC= line in the Edit Attributes dialog, type 1.35v in the Value text box, and click on the Save Attr button (or press J) to accept the changes. To make the value of the DC attribute (example: 1.35v) visible on the schematic, click on the Change Display button, and select the Value radio button in the Display box. Click on OK to accept the change. Click on OK to end the dialog and return to the schematic. The Meter source has no DC value since it is used only to measure current. The analog ground symbol is placed by using Get New Part on the Draw menu to place the AGND symbol.
Shortcut: Click on C G
or press
12-12
Note
You can also select more than one resistor at a time using a selection box and/or pressing V+click to add more selections to the group of selected items. Remember that you can move the attributes by clicking once to select it, then holding the mouse button down and dragging it to the desired location; release the mouse button to place.
See Using the Model Editor (Text Editor) on page 5-21 for information about the model editor.
12-13
The third selection, Edit Instance Model (Parts), allows us to edit the model definition for that symbol instance using the Parts utility. Now click on the Edit Instance Model (Text) button. The message Searching libraries, please wait... appears in the status line at the bottom of the Schematics window. By default, the new name of the instance model is <old model name>-X (example: Rbreak-X); we can change this to whatever we like. Lets change it to RMonte1. Move the cursor to the beginning of Rbreak-X on the .model Rbreak-X RES line, press V+C+r to select Rbreak-X, and type RMonte1 in its place. To add both a 2% device tolerance and a 10% lot tolerance to the resistance multiplier of this model, add R=1 DEV=2% LOT=10% on the line following the .MODEL statement. Your model editing box should look something like Figure 12-6.
Figure 12-6 Model Definition for RMonte1 Click on OK to accept the changes. When we have finished editing this instance model (RMonte1), click on OK. The .MODEL definition of the RMonte1 is saved (by default) to the <schematic name>.lib model file psensor.lib in this case. This file is automatically added to the set of model files associated with (local to) this schematic. If we specified a model name which was contained in a library/ include file not already configured (via Library and Include Files on the Analysis menu), we would have to explicitly
12-14
configure it in order to be able to use the model during simulation (see Configuring the Library on page 5-36). Now that RMonte1 is already defined, and saved to psensor.lib, we can reference this new model definition, by name, for R2 and R4. Select each of these symbols, one at a time, select Model from the Edit menu, and click on the Change Model Reference button. Type RMonte1 in the text box provided. For resistor R3, we would like to assign a 5% DEV tolerance and no LOT tolerance. For this, we will need a new instance model. Select Model from the Edit menu, and click on the Edit Instance Model (Text) button. Enter RTherm as the name of the instance model. Type R=1 DEV=5% on the line following the .model RTherm RES line, and click on OK to accept the changes. Your schematic should look like Figure 12-7.
Figure 12-7 Pressure Sensor Circuit with RTherm Model Definition Edited
12-15
12-16
12-17
Creating histograms
Because the data file can become quite large when running a Monte Carlo analysis and because we are only interested in the output of the filter, we will place a voltage marker at the output of the filter. The steps necessary to collect data for the marked node only are enumerated below. 1 2 3 4 Select Probe Setup from the Analysis menu. Mark the Automatically Run Probe after Simulation check box. Select At Markers Only in the Data Collection box. Click on OK.
Shortcut: Click on ! or press
To run the simulation, select Simulate from the Analysis menu. After the simulation is complete, a Probe window is displayed.
12-18
Since we performed a Monte Carlo analysis, we are asked to select the runs for which we wish to display the data. Click on All and then on OK to view all sections. The steps to display a histogram are enumerated below. 1
For information about performance analysis, see
Select X Axis Settings from the Plot menu. Check the Performance Analysis check box in the Processing Options box and click on OK.
The display changes to the histogram display where the Y axis is the percent of samples. To display a histogram of the distribution of the 1 dB bandwidth for our filter: 1 2 3 4 Select Add from the Trace menu. Click on the Bandwidth(1, db_level) goal function. Click on V(OUT). In the Trace Command text box, place the cursor after the V in Bandwidth(V(OUT) , ) and type DB. The text box should now read as Bandwidth(VDB(OUT) , ). Place the cursor after the comma and type 1 for the 1 dB level. The text box should now read as
Bandwidth(VDB(OUT) , 1).
You can also display this histogram by using the performance analysis wizard to display Bandwidth (VDB(OUT) , 1).
To change the number of histogram divisions, select Options from the Tools menu and replace 10 with 20 in the Number of Histogram Divisions text box. Click on Save and then OK. The histogram of the 1 dB bandwidth is as shown in Figure 12-12.
12-19
Figure 12-12 1 dB Bandwidth Histogram The statistics for the histogram are displayed along the bottom of the display by default. They can be turned off by selecting Options from the Tools menu, clicking on the Display Statistics check box to remove the X, and clicking on Save and OK. The statistics show the number of Monte Carlo runs, the number of divisions or vertical bars that make up the histogram, mean, sigma, minimum, maximum, 10th percentile, median, and 90th percentile. Ten percent of the goa1 function values are less than or equal to the 10th percentile number, and 90% of the goal function values are greater than or equal to that number. If there is more than one goal function value that satisfies this criteria, then the 10th percentile is the midpoint of the interval between the goal function values that satisfy the criteria. Similarly, the median and 90th percentile numbers represent goal function values such that 50% and 90% (respectively) of the goal function values are less than or equal to those numbers. Sigma is the standard deviation of the goal function values. We can also show the distribution of the center frequency of our filter. The steps to display the center frequency are enumerated below. 1 2 Select Add from the Trace menu. Select the CenterFreq(1, db_level) goal function by clicking on it.
12-20
3 4
Select V(OUT) by clicking on it. In the Trace Command text box, place the cursor after the V in CenterFreq(V(OUT) , ) and type DB. The text box should now read as follows:
CenterFreq(VDB(OUT) , )
Place the cursor after the comma and type in 1 for the 1 dB level. The text box should now read as follows:
CenterFreq(VDB(OUT) , 1)
The new histogram replaces the previous histogram. To display both histograms at once, use Add Plot on the Plot menu before selecting Add from the Trace menu. The histogram of the center frequency is as shown in Figure 12-13.
Worst-Case Analysis
12-21
Worst-Case Analysis
This section discusses the analog worst-case analysis feature of PSpice. It is hoped that the information provided here will help you to apply it properly and with realistic expectations.
Inputs
Besides the circuit description, two forms of information are required from the user:
PSpice allows tolerances to be set on any number of the parameters that characterize a model. Models can be defined for nearly all primitive analog circuit components, such as resistors, capacitors, inductors, and semiconductor devices. PSpice reads the standard model parameter tolerance syntax specified in the .MODEL statement. For each model parameter, PSpice uses the nominal, minimum, and maximum probable values, and the DEV and/or LOT specifiers; the probability distribution type (such as UNIFORM or GAUSS) is ignored. The criterion for determining the worst values for the relevant model parameters is defined in the .WC statement as a function of any standard output variable in a specified range of the sweep. In a given range, the measurement must be reduced to a single value by one of these five collating functions:
12-22
Analog behavioral models can be used to measure waveform characteristics other than those detected by the available collating functions, such as rise time or slope. Analog behavioral models can also be used to incorporate several voltages and currents into one output variable to which a collating function may be applied. See Chapter 6,Analog Behavioral Modeling, for more information.
Maximum output variable value Minimum output variable value Output variable value at the point where it differs the most with the nominal run Sweep value where the output variable value crosses above a given threshold value Sweep value where the output variable value crosses below a given threshold value
Worst is user-defined as the highest (HI) or lowest (LO) possible collating function relative to the nominal run.
Procedure
To establish the initial value of the collating function, worstcase analysis begins with a nominal run with all model parameters at their nominal values. Next, multiple sensitivity analyses determine the individual effect of each model parameter on the collating function. This is accomplished by varying model parameters, one at a time, in consecutive simulations. The direction (better or worse) in which the collating function changes with a small increase in each model parameter is recorded. Finally, for the worst-case run, each parameter value is taken as far from its nominal as allowed by its tolerance, in the direction which should cause the collating function to be its worst (given by the HI or LO specification). This procedure saves time by performing the minimum number of simulations required to make an educated guess at the parameter values which produce the worst results. It also has some limitations, which will be discussed in the following sections.
Outputs
A summary of the sensitivity analysis is printed in the PSpice output file (.out). This summary shows the percent change in the collating function corresponding to a small change in each
Worst-Case Analysis
12-23
model parameter. If a .PROBE statement is included in the circuit file, then the results of the nominal and worst-case runs are saved for viewing with Probe.
12-24
Figure 12-14 Simple Biased BJT Amplifier Figure 12-16 is the circuit file used to run either a parametric analysis (.STEP, shown enabled in the circuit file) that sets the value of resistor Rb2 by stepping model parameter R through values spanning the specified DEV tolerance range, or a worstcase analysis (shown disabled in the circuit file) that allows PSpice to determine the worst-case value for parameter R based upon a sensitivity analysis. PSpice allows only one of these analyses to be run in any given simulation. Note that the AC and worst-case analysis specifications (.AC and .WC statements) are written so that the worst-case analysis tries to minimize Vm([OUT]) at 100 kHz. The netlist and circuit file in Figure 12-16 is set up to run either a parametric (.STEP) or worst-case (.WC) analysis of the specified AC analysis. These simulations demonstrate the
Worst-Case Analysis
12-25
conditions under which worst-case analysis works well and those that can produce misleading results when output is not monotonic with a variable parameter (see Figure 12-17 and Figure 12-18). For demonstration, the parametric analysis is run first, generating the curve shown in Figure 12-17 and Figure 12-18. This curve, derived using the YatX goal function shown in Figure 12-15, illustrates the non-monotonic dependence of gain on Rb2. To do this yourself, place the goal function definition in a probe.gf file in the circuit directory. Then run Probe, load all of the AC sweeps, set up the X axis for performance analysis, and add the following trace:
YatX(Vm([OUT]),100k)
Next, the parametric analysis is commented out and the worstcase analysis is enabled. Two runs are made using the two versions of the Rbmod .MODEL statement shown in the circuit file. The model parameter, R, is a multiplier which is used to scale the nominal value of any resistor referencing the Rbmod model (Rb2 in this case). The first .MODEL statement leaves the nominal value of Rb2 at 720 ohms. The sensitivity analysis increments R by a small amount and checks its effect on Vm([OUT]). This slight increase in R causes an increase in the base bias voltage of the BJT, and increases the amplifiers gain, Vm([OUT]). The worstcase analysis correctly sets R to its minimum value for the lowest possible Vm([OUT]) (see Figure 12-17). The second .MODEL statement scales the nominal value of Rb2 by 1.1 to approximately 800 ohms. The gain still increases with a small increase in R, but a larger increase in R increases the base voltage so much that it drives the BJT into saturation and nearly eliminates the gain. The worst-case analysis is fooled by the sensitivity analysis into assuming that Rb2 must be minimized to degrade the gain, but maximizing Rb2 is much worse (see Figure 12-18). Note that even an optimizer, which checks the local gradients to determine how the parameters should be varied, is fooled by this circuit. Consider a slightly different scenario: Rb2 is set to 720 ohms so that maximizing it is not enough to saturate the BJT, but Rb1 is variable also. The true worst case occurs when Rb2 is
12-26
Figure 12-16 Amplifier Netlist and Circuit File maximized and Rb1 is minimized. Checking their individual effects is not sufficient, even if the circuit were simulated four times with each resistor in turn set to its extreme values.
Worst-Case Analysis
12-27
Output is monotonic within the tolerance range. Sensitivity analysis correctly points to the minimum value.
Output is non-monotonic within the tolerance range, thus producing incorrect worst-case results.
12-28
LIST
OUTPUT ALL
Figure 12-20 Circuit File Demonstrating Use of VARY BOTH In this case, V(3) is maximized if:
Rwc1 and Rwc2 are both increased by 10% per the LOT tolerance specification, and then Rwc1 is decreased by 5% and Rwc2 is increased by 5% per the DEV tolerance specification.
The final values for Rwc1 and Rwc2 should be 105 and 115, respectively. However, because Rwc1 and Rwc2 are varied together during the sensitivity analysis, it is assumed that both must be increased to their maximum for a maximum V(3). Therefore, both are increased by 15%. Here again, the purpose of the technique is to reduce the number of simulations. For a more accurate worst-case analysis, you should first perform a worst-case analysis with VARY LOT,
Worst-Case Analysis
12-29
manually adjust the nominal model parameter values according to the results, then perform another analysis with VARY DEV specified.
Gaussian distributions
Parameters using Gaussian distributions are changed by 3 (three times sigma) for the worst-case analysis.
RELTOL
During the sensitivity analysis, each parameter is varied (multiplied) by 1+RELTOL where RELTOL is specified in a .OPTIONS statement, or defaults to 0.001.
Sensitivity analysis
The sensitivity analysis results are printed in the output file (.out). For each varied parameter, the percent change in the collating function and the sweep variable value at which the collating function was measured are given. The parameters are listed in worst output order; for example, the collating function was its worst when the first parameter printed in the list was varied. When the YMAX collating function is used, the output file also lists mean deviation and sigma values. These are based on the changes in the output variable from nominal at every sweep point in every sensitivity run.
12-30
Manual optimization
Worst-case analysis can be used to perform manual optimization with PSpice. The monotonicity condition is usually met if the parameters have a very limited range. Performing worst-case analysis with tight tolerances on the parameters yields sensitivity and worst-case results (in the output file) which can be used to decide how the parameters should be varied to achieve the desired response. You can then make adjustments to the nominal values in the circuit file, and perform the worst-case analysis again for a new set of gradients. Parametric sweeps (.STEP), like the one performed in the circuit file shown in Figure 12-16, can be used to augment this procedure.
This performs only two simulations: the nominal and the worst Monte Carlo run. The parameter values used during the worst run are written to the output file, and the results of both simulations are saved.
Worst-Case Analysis
12-31
Using Monte Carlo analysis with YMAX is a good way to obtain a conservative guess at the maximum possible deviation from nominal, since worst-case analysis usually cannot provide this information.
Part Four
Viewing Results
Part Four describes how to use Probe to view simulation results. Chapter 13,Waveform Analysis, describes how to use Probe to perform waveform analysis of simulation results. Chapter 14,Output Options, describes output options that can be used to control the simulation output.
Waveform Analysis
13
Chapter Overview
This chapter describes how to use Probe to perform waveform analysis of simulation results. This chapter includes the following: Overview of Probe on page 13-2 What You Need to Know to Run Probe on page 13-5 Probe Example on page 13-12 User-Interface Features on page 13-15 Probe Trace Expressions on page 13-22 Limiting File Size Using Markers on page 13-28
13-2
Waveform Analysis
Overview of Probe
MicroSim Probe is the waveform analyzer for PSpice simulations. Probe allows you to visually analyze and interactively manipulate the waveform data produced by circuit simulation. Using high-resolution graphics, Probe allows you to view the results of a simulation both on the screen and on hard copy. In effect, Probe is a software oscilloscope. Running PSpice corresponds to building or changing a breadboard, and running Probe corresponds to looking at the breadboard with an oscilloscope. Probe displays simple voltages and currents and also displays complex arithmetic expressions involving voltages and currents. Probe can also display the Fourier transform of these expressions. PSpice generates two forms of output: the simulation output file and the Probe data file. The calculations and results reported in the simulation output file act as an audit trail of the simulation. However, the graphical analysis of information stored in the Probe data file using the Probe program is the most informative and flexible method for evaluating simulation results.
Overview of Probe
13-3
window A
window B (active)
Figure 13-1 Probe Window with Two Plot Windows One or more Probe data files can be opened in a plot window. After the first file is loaded, other files can be loaded into the same plot window using Append on the File menu.
13-4
Waveform Analysis
Any number of plot windows can be opened. Each plot window is an independent window. The same Probe data file can be displayed in more than one plot window. Only one plot window is active at any given time, identified by a highlighted title bar. Menu, keyboard, and cursor operations affect only the active plot window. Another plot window can be made active by clicking anywhere within the window.
13-5
c 2
Select Simulate from the Analysis menu to start the simulation. Probe starts automatically and displays one window in monitor mode. In Probe, select the waveforms to be monitored using Add on the Trace menu or by placing markers.
13-6
Waveform Analysis
During a multiple run simulation (such as Monte Carlo, parametric or temperature), only the data for the first run is displayed. To view the curves for several runs: a b c Select Close from the File menu to close the data file, then select Open from the File menu to reload it. Specify the data sections (runs) to load. Select the traces to monitor. Waveforms for all loaded sections are displayed.
Setup Requirements
For information about customizing Probe colors in msim.ini, see Appendix A in the Schematics Users Guide.
The configuration file msim.ini contains settings which control the way Probe is run on your system. Foreground, background, and trace colors for display and hard copy can be configured for Probe by editing the file msim.ini. files, command files, and switches can be specified in the Run Probe Command text box of the Options/Editor Configuration/App Settings dialog box. The command line entered here is saved to msim.ini. Probe recognizes these options when you start it automatically after simulation or when you start it from Schematics by selecting Run Probe from the Analysis menu or by pressing @.
.prb
13-7
Manual Startup
The command for running Probe at the Windows Properties command line is: probe <options>* <data file> where options are the command line options for running Probe with a command file (C switch), log file (L switch), etc., where switches are preceded with / or -. is the name of the Probe data file generated by the simulator.
data file
To resume a simulation
1 2 Exit Probe. In the Simulation Status window, select Pause Simulation from the File menu.
13-8
Waveform Analysis
When started this way, the Probe window monitors the waveforms for as long as the data section is being written. Once complete, the window reverts to manual mode.
13-9
fast Fourier transforms, activated by selecting X Axis Settings from the Plot menu and clicking on the Fourier check box Performance Analysis, activated by selecting X Axis Settings from the Plot menu and clicking on the Performance Analysis check box new X axis variable, activated by selecting X Axis Settings from the Plot menu, clicking on Axis Variable, specifying a new X axis variable goal function evaluation, activated by selecting Eval Goal Function from the Trace menu loading a previously completed data section
13-10
Waveform Analysis
Schematic Markers
Markers can be placed on your schematic to identify the points where you want to see the waveform results displayed in Probe. Placement can occur before or after simulation takes place. When placed before simulation, they can be used to limit results written to the Probe data file and/or automatically display those traces in Probe. Once Probe is running, placement of any additional markers on the schematic results in the automatic display of traces in the currently active plot window. Table 13-1 summarizes the available marker types and how to select them for placement. The markers for dB, phase, group delay, real, and imaginary waveform characteristics can be used instead of the built-in Probe functions provided in output variable expressions (see Table 13-6 on page 13-25). Table 13-1 Schematic Markers
Waveform voltage voltage differential current dB phase group delay real imaginary Markers Menu Selection Mark Voltage/Level Mark Voltage Differential Mark Current Into Pin Mark Advanced Mark Advanced Mark Advanced Mark Advanced Mark Advanced Symbol Selection (not required) (not required) (not required) VDB (voltage) IDB (current) VPHASE (voltage) IPHASE (current) VGROUPDELAY (voltage) IGROUPDELAY (current) VREAL (voltage) IREAL (current) VIMAGINARY (voltage) IIMAGINARY (voltage)
The Markers menu provides additional selections for controlling display of marked results in Probe, both after simulation and after initial marker placement:
13-11
Show All
causes all traces corresponding to markers placed on any page or level of the schematic to be displayed in Probe selectively displays existing markers (highlight markers of interest and select Show Selected) removes all markers from the schematic and all corresponding traces in the Probe display
13-12
Waveform Analysis
Probe Example
In this section, basic techniques for operating Probe are demonstrated using the circuit example.sch.
The example circuit example.sch is provided with the MicroSim software installation.
Figure 13-2 Example Schematic example.sch When shipped, example.sch is set up with multiple analyses enabled. For purposes of this demonstration, we can disable the AC sweep, DC sweep, Monte Carlo/worst-case, and smallsignal transfer function analyses by selecting Setup from the Analysis menu in Schematics and toggling the check box next to the appropriate analysis. The specification for each of these disabled analyses remains intact. We can run them in the future by simply toggling the check box back to the enabled state. We will run with the Bias Point Detail, Temperature, and Transient analyses enabled. The temperature analysis is set to 35 degrees. The transient analysis is specified with: Print Step Final Time Enable Fourier Center Frequency Output Vars 20ns 1000ns checked on 5Meg V(OUT2)
The simulation is started by selecting Simulate from the Analysis menu in Schematics. By default, Probe is set to automatically run. In this example, we will not be specifying goal functions or macros so that we can keep the default
Automatically Run Probe After Simulation option enabled in the Probe Setup dialog. PSpice generates a binary Probe data file containing the results of the simulation. The Probe screen is displayed with the data file example.dat already loaded as shown in Figure 13-3.
Figure 13-3 Probe Main Window with Loaded example.dat and Open Plot Menu The name of the data file example.dat is indicated in the title bar. All Probe commands are activated through the menu items. Notice that the Transient menu item on the Plot menu is checked, indicating that the data currently loaded are the transient analysis results. A menu does not always allow selection of all of its commands, as indicated by the grayed-out entries. The availability of commands depends on what activities are currently legal. Having selected an analysis, voltages and currents across devices or at nets can be displayed in the Probe plot using either the schematic marker method or by explicitly specifying Probe output variables (as will be demonstrated in this example). Probe output variables are specified in Probe by selecting Add from the Trace menu. A list of valid output variables is
13-14
Waveform Analysis
automatically displayed when Add is selected. A screen similar to Figure 13-4 is displayed.
User-Interface Features
13-15
User-Interface Features
Probe offers a number of direct manipulation techniques to facilitate analysis of the waveform data as well as shortcuts. These techniques are described in this section.
Zoom Regions
Probe provides a direct manipulation method for marking the zoom region of the plot. After placing the first bar, and with the mouse button still depressed, the second bar can be dragged left or right to demarcate the region of zoom. By subsequently selecting Area from the View menu, Probe changes the plot to display only the region of interest as marked by the zoom bars. It is also possible to directly select a zoom region by dragging the mouse in the plot to produce a zoom box as shown in Figure 13-5. As with the case above, Area on the View menu
zoom box
Accelerator keys Many of the menu functions in Probe have matching keystrokes which can be used instead. For instance, having placed a zoom box in the plot, we could have typed C+A instead of selecting Area from the View menu.
Figure 13-5 Zoom Box redisplays the traces, showing only the region within the zoom box.
13-16
Waveform Analysis
Scrolling Traces
By default, when a plot is zoomed, standard scroll bars will appear to the left and/or bottom of the plot area. These can be used to pan through the data. Scroll bar behavior can also be configured by selecting Options from the Tools menu and checking the appropriate Scrollbars box as follows: Auto Scroll bars appear when a plot is zoomed or additional traces are displayed in the plot but are not visible (default). Scroll bars are never displayed. This mode provides maximum plot size and is useful on VGA and lesser resolution displays. Scroll bars are displayed at all times, but are disabled if the applicable axis is full scale.
Never
Always
For instance, to modify the expression for any given trace, the trace name must be selected by clicking on it (indicated by a color change) and then selecting Modify Object from the Edit menu. Text and ellipse labels may be similarly selected and modified. In the case of ellipse labels, the inclination angle may be modified.
User-Interface Features
13-17
To add traces to the end of the currently displayed set, select Paste from the Edit menu. To add traces before a currently displayed trace, select the trace and then select Paste from the Edit menu.
If the new plot window is reading the same Probe data file, the copied or moved traces are identical to the original selection set. If the new plot window is reading a different Probe data file, the copied traces are displayed in the context of the waveform expression as applied to the new data. For example, suppose two data files, mysim.dat and yoursim.dat each contain a V(2) waveform. Suppose also that two plot windows are currently displayed where window A is loaded with mysim.dat, and window B is loaded with yoursim.dat. When V(2) is copied from window A to window B, the trace looks different since it is derived from yoursim.dat instead of mysim.dat.
13-18
Waveform Analysis
To store the data points as an ASCII file, paste the data from the Clipboard into a text editor of your choice. This method guards against spurious clipboard file data appearing at the beginning of the file when saving the data directly from the Clipboard Viewer program.
User-Interface Features
13-19
Cursors
When one or more traces are displayed, Probe provides cursors which can be used to display the exact coordinates of two points on the same trace, or points on two different traces. In addition, differences are shown between the corresponding coordinate values for the two cursors. Cursors are enabled by selecting Cursor from the Tools menu and then selecting Display. Both cursors are initially placed on the trace listed first in the trace legend. The corresponding trace symbol is outlined in a dashed line. On the Cursor submenu under the Tools menu, there are specific cursor placement commands: Peak, Trough, Slope, Min, Max, Point, and Search Commands. The mouse and keyboard can also be used to move cursors to a chosen position on the trace. Table 13-2 lists the cursor control commands for the mouse. Keyboard commands are listed in Table 13-3. Table 13-2
Category cursor assignment
cursor movement
13-20
Waveform Analysis
Figure 13-6 Probe Screen with Cursors Positioned on the Trough and Peak of the V(1) Waveform Cursor 1 has been positioned on the minimum value of the V(1) waveform using the Trough option from the Cursor command in the Tools menu. Cursor 2 been positioned on the maximum
User-Interface Features
13-21
value of the same waveform using Peak option. In the Probe Cursor box, cursor1 and cursor 2 coordinates are displayed (A1 and A2, respectively) with their difference shown at the bottom (dif). The mouse buttons are also used to associate each cursor with a different trace by clicking appropriately (see Table 13-2 on page 13-19) on the trace symbol in the legend. These are outlined in the pattern corresponding to the associated cursors crosshair pattern. Given the example in Figure 13-6, rightclicking on the V(2) symbol will associate cursor two with the V(2) waveform. The legend now appears as shown in Figure 13-7.
cursor 1
cursor 2
Figure 13-7 Legend The Probe Cursor box also updates the A2 coordinates to reflect the X and Y values corresponding to the V(2) waveform. For a family of curves (such as from a nested DC sweep), you can use the mouse or the arrow keys to move the cursor to one of the other curves in the family. Click on the desired curve.
13-22
Waveform Analysis
This form is representative of those available for specifying PSpice analyses. <output>[AC suffix](<name>[,name]) where: <output> [AC suffix]* is the type of output quantity: V for voltage or I for current. specifies the quantity to be reported for an AC analysis, such as M (magnitude), P (phase), G (group delay). specifies either the out id or (+ out id, - out id) pair for which the voltage is to be reported, or the out device for which a current is reported, where:
<name> [,<name>]
out id specifies either the net id or pin id (<fully qualified device name>:<pin name>) out device specifies the fully qualified device name
13-23
[AC suffix]*
<name> [,<name>])
Table 13-4 summarizes the allowed formats and Table 13-5 provides examples of equivalent output variables. Note that some of the output variable formats are unique to Probe. Table 13-4
Format V[ac](< + out id >, < - out id >) V<pin name>[ac](< 2-terminal device
out ids
Voltage at pin name of a 2-terminal device
>)
3 or 4-terminal device
V< z >[ac](< transmission line device >) Voltage at one end z of a transmission line
device
13-24
Waveform Analysis
>)
I< x >[ac](< 3 or 4-terminal device >)
3 or 4-terminal device
I< z >[ac](< transmission line device >) < DC sweep variable > FREQUENCY TIME V(ONOISE) V(INOISE) Current through one end
13-25
Trace Expressions
Arithmetic expressions of output variables use the same operators as those used in PSpice (via Schematic symbol attribute definitions). Expressions may also include intrinsic functions. The intrinsic functions available in Probe similar to those available in PSpice, but with some differences, as shown in Table 13-6. A complete list of PSpice arithmetic functions can be found in Table 3-6 on page 3-11. Table 13-6
Probe Function ABS(x) SGN(x) SQRT(x) EXP(x) LOG(x) LOG10(x) M(x) P(x) R(x) IMG(x) G(x) PWR(x,y) SIN(x) COS(x) TAN(x) ATAN(x) ARCTAN(x) d(x) s(x) AVG(x) derivative of x with respect to the X axis variable integral of x over the range of the X axis variable running average of x over the range of the X axis variable NO NO NO
ln(x) log(x)
magnitude of x phase of x {in degrees} real part of x imaginary part of x group delay of x {in seconds} |x|y
13-26
Waveform Analysis
Note
For AC analysis, Probe uses complex arithmetic to evaluate expressions. If the result of the expression is complex, then its magnitude is displayed.
Explicit numeric values are input in the same form as the simulator (via Schematics symbol attributes), except that the suffixes M and MEG are replaced with m (milli, 1E-3) and M (mega, 1E+6), respectively. Also, MIL and mil are not supported. With the exception of the m and M scale suffixes, Probe is not case sensitive, therefore upper/lower case characters are equivalent (V(5) and v(5), for example). Unit suffixes are only used to label the axis; they never affect the numerical results. Therefore, it is always safe to leave off a unit suffix. The quantities 2e-3, 2mV, and 0.002V all have the same numerical value. For plotting purposes, Probe notes that the second and third forms are in volts, whereas the first is dimensionless. The units which Probe recognizes are shown in Table 13-7. Table 13-7 Output Units Recognized by Probe
Symbol V A W Unit Volt Amps Watt
13-27
Table 13-7
Symbol d s H
Probe also knows that W=VA, V=W/A, and A=W/V. So, if you add a trace which is
V(5)*ID(M13)
the axis values will be labeled with W For a demonstration of trace presentation, see Probe Example on page 13-12.
13-28
Waveform Analysis
Saving Results in ASCII Format The default Probe data file format is binary. However, the Probe data file may be saved in the Common Simulation Data Format (CSDF) instead, by selecting Probe Setup from the Analysis menu and clicking in the Text Data File Format check box. This causes simulation results to be written to the Probe data file in ASCII format following the CSDF convention.
13-29
The other reason for the large size of the Probe data file is that long runs, especially transient ones, involve storing many data points. For transient runs, you can suppress a part of the run by setting the No Print Delay value in the transient analysis specification. For example, setting No Print Delay to 0.9 ms tells the simulator to start output at 0.9 ms instead of time 0. Note that this does not affect the transient calculations themselves; these always start at time 0. It only suppresses the output.
Output Options
14
Chapter Overview
This chapter describes output options that can be used to control the simulation output. This chapter includes the following sections: Viewpoints on page 14-2 Printpoints on page 14-3
14-2
Output Options
Viewpoints
Pseudocomponents that display simulation results on the schematic are called viewpoints. These apply to the analog portion of your circuit. Bias voltages and currents are supported.
Figure 14-1 Viewpoint Example IPROBE allows you to display the bias point current. This essentially places a zero-valued voltage source on the schematic. Place the IPROBE symbol on the net, and the bias point current is displayed. VIEWPOINT allows you to display the bias point voltage of a net within the MicroSim Schematics window. Place the VIEWPOINT symbol on the net, and the bias point is displayed. WATCH1 allows you to specify up to three output variables to be viewed in the PSpice window as DC, AC, and/or transient analyses proceed. All output variables are acceptable except group delay. Specify the type of analysis by editing the Value text box of the ANALYSIS attribute. Set the upper and lower limit values by editing the LO and HI attributes.
Printpoints
14-3
Printpoints
Pseudocomponents that write results to the simulation output file are called printpoints. Printpoints generate tabulated tables or line printer plots. Printpoint symbols and types are shown in Figure 14-2. Table 14-1 describes each of the printpoint symbols.
Printpoint Symbols
Description plot showing current through a cut in the net; this symbol must be inserted into the circuit in series (like a current meter) table showing current through a cut in the net; this symbol must be inserted into the circuit in series (like a current meter) plot showing voltages on the net to which the symbol terminal has been connected plot showing voltage differentials between the two nets to which the symbol terminal have been connected table showing voltages at the net to which the symbol terminal has been connected table showing voltage differentials between the two nets to which the symbol terminals have been connected VPRINT1 supersedes the old PRINT1 pseudocomponent.
IPRINT
VPLOT1 VPLOT2
VPRINT1 VPRINT2
Except for the PRINTDGTLCHG symbol, you can specify one or more analysis types for which the information should be reported as follows: 1 Double-click on the symbol.
14-4
Output Options
Double-click on the analysis type attribute of interest. Set its Value text box to any non-blank value, such as Y, YES, or 1. Set any additional analysis types. If AC is set, then one or more output formats may also be set: MAG (magnitude), PHASE, REAL, IMAG (imaginary), or DB.
If no analysis types are selected, transient results is reported by default. If AC is selected but no output formats are selected, MAG (magnitude) is used.
A
Appendix Overview
This appendix includes the following sections: Save and Load Bias Point on page A-2 Setpoints on page A-4 Setting Initial Conditions on page A-6
A- 2
If the circuit uses high gain components, or if the circuits behavior is nonlinear around the bias point, this feature is not useful.
transient DC AC
1 2
Click on Load Bias Point in the Analysis Setup dialog box. Complete the Save Bias Point dialog box as described in the Schematic Editor Reference chapter of the Schematics Users Guide. Click on OK when finished. The check box next to Save Bias Point should be checked on. If not, click on the check box to enable it.
A-3
A- 4
Setpoints
Pseudocomponents that specify initial conditions are called setpoints. These apply to the analog portion of your circuit.
Figure A-1 Setpoints The example is Figure A-1 includes the following: IC1 a one-pin symbol that allows you to set the initial condition on a net for both smallsignal and transient bias points a two-pin symbol that allows you to set initial condition between two nets
IC2
Using IC symbols sets the initial conditions for the bias point only. It does not affect the DC sweep. If the circuit contains both an IC symbol and a NODESET symbol for the same net, the NODESET symbol is ignored. To specify the initial condition, edit the value of the VALUE attribute to the desired initial condition. PSpice attaches a voltage source with a 0.0002 ohm series resistance to each net to which an IC symbol is connected. The voltages are clamped this way for the entire bias point calculation. NODESET1 is a one-pin symbol which helps calculate the bias point by providing a initial guess for some net. NODESET2 is a two-pin symbol which helps calculate the bias point between two nets. Some or all of the circuits nets may be given an initial guess. NODESET symbols are effective for the bias point (both small-signal and transient bias points) and for the first step of the DC sweep. It has no effect during the rest of the DC sweep or during the transient analysis itself. Unlike the IC pseudocomponents, NODESET provides only an initial guess for some net voltages. It does not clamp those nodes to the specified voltages. However, by providing an initial guess, NODESET symbols may be used to break the tie (in a flip-flop, for instance) and make it come up in a desired state. To
Setpoints
A-5
guess at the bias point, enter the initial guess in the Value text box for the VALUE attribute. PSpice attaches a voltage source with a 0.0002 ohm series resistance to each net to which an IC symbol is connected. These pseudocomponents are netlisted as PSpice .IC and .NODESET commands. Refer to these commands in the PSpice Reference Manual for more information. Setpoints can be created for inductor currents and capacitor voltages using the IC attribute described in Setting Initial Conditions on page A-6.
A- 6
Skipping the bias point calculation can make the transient analysis subject to convergence problems.
See Setpoints on page A-4 for more information about IC1 and IC2.
Applying an IC attribute for a capacitor has the same effect as applying one of the pseudocomponents IC1 or IC2 across its nodes. PSpice attaches a voltage source with a 0.002 ohm series resistance in parallel with the capacitor. The IC attribute allows the user to associate the initial condition with a device, while the IC1 and IC2 pseudocomponents allow the association to be with a node or node pair. In the case of initial currents through inductors, the association is only with a device, and so there are no corresponding pseudocomponents. The internal implementation is analogous to the capacitor. PSpice attaches a current source with a 1 Gohm parallel resistance in series with the inductor. If you want IC attributes to be ignored when Skip Initial Transient Solution is not enabled in the Transient Analysis Setup dialog box:
See Setting Up Analyses on page 7-3 for a description of the Analysis Setup dialog box.
1 2
Click on Options for the Setup Analysis dialog box. Set NOICTRANSLATE to Y.
Index
A
ABM ABM part templates, 6-6 abm.slb, 6-3 basic controlled sources, 6-47 cautions and recommendations for simulation, 6-41 compared to polynomials, 6-47 control system parts, 6-7 custom parts, 6-53 frequency domain device models, 6-35 frequency domain parts, 6-35, 6-42 instantaneous models, 6-30, 6-41 overview, 6-2 placing and specifying ABM parts, 6-4 polynomial transfer function, 6-49 PSpice A/D-equivalent parts, 6-28, 6-29 signal names, 6-1 simulation accuracy, 6-46 syntax, 6-29 triode modeling example, 6-25 AC sweep analysis, 1-6, 7-2, 9-1 displaying results in Probe, 2-20 example, 2-18 noise analysis, 1-7, 7-2, 9-5 nonlinear components, 9-4
overview, 9-2 setting up, 2-18 adding a stimulus, 2-14 analog behavioral modeling, see ABM analog parts see also digital parts basic components (ABM), 6-7, 6-9 basic controlled sources (ABM), 6-47 bipolar transistors, 5-8, 5-32, 5-33, 7-9 breakout parts, 5-26 capacitors, 3-2, 5-26, 7-8 Chebyshev filters, 6-7, 6-11, 6-44, 12-16 diodes, 5-8, 5-32, 5-33, 7-8 expression parts (ABM), 6-8, 6-22 frequency table parts (ABM), 6-28, 6-37, 6-45 GaAsFET, 5-32, 7-9 ideal switches, 5-30 IGBT, 5-8, 5-32, 5-33, 7-9 inductor coupling (KBREAK), 5-27 inductors, 3-2, 5-26, 7-8 integrators and differentiators (ABM), 6-7, 6-14 ISTIM (analog stimulus), 10-13 JFET, 5-8, 5-32, 5-33, 7-9 Laplace transform (ABM), 6-8, 6-18, 6-28, 6-
35, 6-42
limiters (ABM), 6-7, 6-10
Index-2
math functions (ABM), 6-8, 6-21 mathematical expressions (ABM), 6-28 MOSFET, 5-8, 5-32, 5-33, 7-9 nonlinear magnetic core, 5-8 opamp, 5-8 passive, 3-2 power supplies, 3-13 PSpice A/D-equivalent parts (ABM), 6-28 resistors, 3-2, 5-26, 7-8 semiconductor parts, 5-31 table look-up (ABM), 6-7, 6-14, 6-28, 6-33 transformers, 3-4, 5-29 transmission lines, 3-5, 7-9 voltage comparator, 5-8 voltage reference, 5-8 voltage regulator, 5-8 VSTIM (analog stimulus), 10-13 analog simulation Probe waveform display, 13-12, 13-25 analyses AC sweep, 1-6, 2-18, 7-2, 9-1 analysis setup, 7-3 analysis types, 1-6, 7-2 bias point, 2-6 bias point detail, 1-6, 7-2, 8-7 DC sensitivity, 1-6, 7-2, 8-10 DC sweep, 1-6, 2-9, 7-2, 8-2 execution order, 7-4 Fourier, 1-7, 7-2 frequency response, 1-6, 7-2 Monte Carlo, 1-8, 7-2, 12-7 noise, 1-7, 7-2, 9-5 parametric, 1-7, 2-22, 7-2, 11-2 performance analysis, 2-28 sensitivity/worst-case, 1-8, 7-2, 12-21 small-signal DC transfer, 1-6, 7-2, 8-8 temperature, 1-7, 7-2, 11-11 transient, 1-7, 2-14, 7-2 attributes, 4-6 breakout parts, 5-26
C
capacitors, 3-2, 5-26, 7-8 Chebyshev filters, 6-7, 6-11, 6-44, 12-16 circuit file (.cir), simulating multiple circuits, 7-12 circuit file set, 1-3 comparator, 5-8 connectors, 4-7 control system parts (ABM), 6-7 controlled sources, 6-28, 6-47 copying symbols, 4-2 creating and analyzing circuits, 1-2 current source, controlled, 6-28, 6-47 cursors, Probe, 13-19
D
DC analyses displaying results in Probe, 2-10 see also DC sweep analysis, bias point detail analysis, small-signal DC transfer, DC sensitivity DC sensitivity analysis, 1-6, 7-2, 8-10 DC sweep analysis, 1-6, 7-2, 8-2 curve families, 8-5 example, 2-9 nested, 8-4 overview, 8-3 setting up, 2-9 differentiators (ABM), 6-7, 6-14 digital parts see also analog parts diodes, 5-8, 5-32, 5-33, 7-8
E
example circuit design entry, 2-2 examples and tutorials AC sweep analysis, 2-18 bias point analysis, 2-6 DC sweep analysis, 2-9 example circuit design entry, 2-2 frequency response vs. arbitrary parameter, 11-8 model editor, 5-24 modeling a triode (ABM), 6-25 Monte Carlo analysis, 12-10
B
basic components (ABM), 6-7, 6-9 basic controlled sources (ABM), 6-47 bias point analysis example, 2-6 bias point detail analysis, 1-6, 7-2, 8-7 bias point, save/restore, A-2 bipolar transistors, 5-8, 5-32, 5-33, 7-9 Bode plot, 1-6, 2-20
Index-3
parametric analysis, 2-22 performance analysis, 2-28, 11-3 transient analysis, 2-14 using Probe (analog waveform analysis), 13-12 using the Parts utility, 5-13 worst-case analysis, 12-24 expression parts (ABM), 6-8, 6-22 expressions, 3-10 see also parameters ABM, 6-28 functions, 3-11 Probe, 13-25 system variables, 3-13 IPROBE (view bias point current symbol), 14-2
J
JFET, 5-8, 5-32, 5-33, 7-9
K
KBREAK (inductor coupling), 5-27
L
Laplace transform parts (ABM), 6-8, 6-18, 6-28, 6-
F
Fourier analysis, 1-7, 7-2 FREQUENCY output variable, 13-24 frequency response analysis, see AC sweep analysis frequency response vs. arbitrary parameter, 11-8 frequency table parts (ABM), 6-28, 6-37, 6-45 functions (Probe), 13-25 functions (PSpice A/D), 3-11
M
magnetic core, nonlinear, 5-8 markers, 2-10, 13-28 for limiting Probe data file size, 13-28 for Probe trace display, 13-10 waveform characteristics, 13-10 math function parts (ABM), 6-8, 6-21 mathematical expressions (ABM), 6-28 mid-analysis snoop, 13-7 mixed analog/digital circuits Probe waveform display, 13-25 MODEL attribute, 4-6, 4-12, 5-2 model editor dialog box, 5-23 editing global models, 5-23 editing local models, 5-22 example, 5-24 using, 5-21 vs. Parts utility, 5-3 model files, 1-3 configuring, 5-9, 5-36 directory paths, 5-39 global, 5-36 local, 5-36 Parts utility, 5-9 search order, 5-38 models configuration with Parts utility, 5-10, 5-12 global vs. local, 5-2 model editor, 5-21 overview, 5-2
G
GaAsFET, 5-32, 7-9 goal functions, 11-5 in performance analysis, 11-5 single data point, 11-5
H
histograms, 12-16 hysteresis curves, 10-16
I
IC (attribute), A-6 IGBT, 5-8, 5-32, 5-33, 7-9 include files, 1-4 configuring, 5-36 directory paths, 5-39 model definitions, 5-38 search order, 5-38 inductors, 3-2, 5-26, 7-8 initial conditions, A-2, A-6 integrators (ABM), 6-7, 6-14
Index-4
subcircuits, 5-20 D (diode), 5-32, 5-33 GASFET (GaAsFET), 5-32 IGBT, 5-32 ISWITCH (current-controlled switch), 5-30 LPNP (bipolar transistor), 5-32, 5-33 NIGBT (N-channel IGBT), 5-33 NJF (JFET), 5-32, 5-33 NMOS (MOSFET), 5-32, 5-33 NPN (bipolar transistor), 5-32, 5-33 PJF (JFET), 5-32, 5-33 PMOS (MOSFET), 5-32, 5-33 PNP (bipolar transistor), 5-32, 5-33 VSWITCH (voltage-controlled switch), 5-30 X (diode), 5-32 Monte Carlo analysis, 1-8, 7-2, 12-7 collating functions, 12-4 histograms, 12-16 model parameter values reports, 12-3 output control, 12-3 tutorial, 12-10 using the model editor, 5-24 waveform reports, 12-4 with temperature analysis, 12-6 MOSFET, 5-8, 5-32, 5-33, 7-9 multiple Y axes, Probe, 11-6
P
PARAM, 2-23 parameters, 3-9 see also expressions parametric analysis, 1-7, 7-2, 11-2 analyzing waveform families in Probe, 2-25 example, 2-22 frequency response vs. arbitrary parameter, 11-8 performance analysis, 11-3 setting up, 2-23 temperature analysis, 1-7, 7-2, 11-11 Parts utility automatic model configuration, 5-10 creating model and subcircuit definitions by characterization, 5-13 manual model configuration, 5-12 model files, 5-9 overview, 5-4 starting, 5-7 supported devices, 5-8 tutorial, 5-13 vs. model editor, 5-3 parts, see analog parts, digital parts passive parts, 3-2 performance analysis, 11-3 example, 2-28 goal functions, 11-5 PLogic see also PSpice A/D, simulation interaction with Schematics files, 5-40 overview, 1-4 simulation status window, 7-14 starting, 7-11 polynomial parts, compared to ABM, 6-47 polynomial transfer function (for ABM controlled sources), 6-49 power supplies analog, 3-13 preparing a schematic for simulation, 3-1 printpoints, 14-3 Probe, 13-2 accelerator keys, 13-15 adding traces, 2-10 arithmetic expressions, 13-25 color configuration, 13-6 cursors, 13-19 data file (.dat), 13-28 displaying results, 2-10, 2-20 displaying traces, 2-10
N
NOICTRANSLATE (simulation option), A-6 noise analysis, 1-7, 7-2, 9-5 non-causality, 6-43 nonlinear components (AC sweep), 9-4 nonlinear magnetic core, 5-8
O
opamp, 5-8 operators in expressions, 3-10 options RELTOL, 6-46 output file (.out), 1-5, 2-7 printpoints, 14-3 output variables Probe, 13-22 Probe arithmetic expressions, 13-25 Probe functions, 13-25 PSpice A/D, 7-4
Index-5
expressions, 13-25 functions, 13-25 hysteresis curves, 10-16 limiting data file size, 13-28 mid-analysis snoop, 13-7 multiple Y axes, 11-6 output variables, 13-22 performance analysis, 2-28, 11-3 placing a cursor on a trace, 2-11 plot update methods, 13-16 plot windows, 13-3 printing plot windows, 13-4 scrolling, 13-16 startup, 13-5, 13-7 trace data tables, 13-18 traces, 13-28 traces, displaying, 13-15 traces, using output variables, 13-22 using markers, 13-10 waveform families, 2-25, 8-5 zoom regions, 13-15 pseudocomponents ICn, A-4 IPLOT, 14-3 IPRINT, 14-3 IPROBE, 14-2 NODESETn, A-4 PARAM, 2-23 VIEWPOINT, 2-8, 14-2 VPLOTn, 14-3 VPRINTn, 14-3 WATCH1, 14-2 PSpice A/D see also simulation expressions, 3-10 functions, 3-11 interaction with Schematics files, 5-40 output file (.out), 1-5, 2-7 output variables, 7-4 overview, 1-4 Probe data file (.dat), 1-4 PSpice A/D-equivalent parts, 6-28, 6-29 simulation status window, 7-14 starting, 7-11 resistors, 3-2, 5-26, 7-8
S
schematic, preparing for simulation, 3-1 scrolling, Probe, 13-16 semiconductor parts, 5-31 sensitivity analysis, see worst-case analysis setpoints, A-4 simulation analysis execution order, 7-4 analysis setup, 7-3 analysis types, 1-6, 7-2 batch jobs, 7-12 bias point, A-2 initial conditions, A-2, A-6 mid-analysis snoop, 13-7 output file (.out), 1-5, 2-7 overview, 1-1 preparing a schematic for, 3-1 printpoints, 14-3 Probe data file, 13-28 results, 1-4 run-time monitoring, 14-2 starting, 7-11 status window, 7-14 SIMULATION ONLY attribute, 4-6 small-signal DC transfer analysis, 1-6, 7-2, 8-8 Stimulus Editor, 1-3, 2-14, 10-5 creating new stimulus symbols, 10-9 defining stimuli, 10-6 editing a stimulus, 10-10 manual stimulus configuration, 10-11 starting, 10-6 stimulus files, 10-5 stimulus files, 1-3 stimulus generation, 10-3 manually configuring, 10-11 stimulus, adding, 2-14 subcircuits, 5-20 editing, 5-21 naming conventions, 4-12 relating to a symbol, 4-12 switches, ideal, 5-30 symbols attributes, 4-6 copying, 4-2 creating, 4-1 creating new stimulus symbols, 10-9
R
regulator, 5-8 RELTOL (simulation option), 6-46
Index-6
graphics, 4-4 relating subcircuits to, 4-12 ABMn and ABMn/I (ABM), 6-8, 6-22 ABS (ABM), 6-8, 6-21 ARCTAN (ABM), 6-8, 6-21 ATAN (ABM), 6-8, 6-21 BANDPASS (ABM), 6-7, 6-12 BANDREJ (ABM), 6-7, 6-13 BBREAK (GaAsFET), 5-32, 5-34 C (capacitor), 3-2 C_VAR (capacitor), 3-2 CBREAK (capacitor), 5-26 CONST (ABM), 6-7, 6-9 COS (ABM), 6-8, 6-21 DBREAKx (diodes), 5-32, 5-34 DIFF (ABM), 6-7, 6-9 DIFFER (ABM), 6-7, 6-14 E (ABM controlled analog source), 6-48, 6-49 EFREQ (ABM), 6-28, 6-37 ELAPLACE (ABM), 6-28, 6-35 EMULT (ABM), 6-28, 6-31 EPOLY (ABM controlled analog source), 6-48, 6IPRINT (current table), 14-3 ISRC (power supply), 3-13 ISTIM (analog stimulus), 10-13 JBREAKx (JFET), 5-32, 5-34 K_LINEAR (transformer), 3-4 KBREAK (inductor coupling), 5-27 KCOUPLEn (transmission line coupling matrix), 3-
7
L (inductor), 3-2 LAPLACE (ABM), 6-8, 6-18 LBREAK (inductor), 5-26 LIMIT (ABM), 6-7, 6-10 LOG (ABM), 6-8, 6-21 LOG10 (ABM), 6-8, 6-21 LOPASS (ABM), 6-7, 6-11 MBREAKx (MOSFET), 5-32, 5-34 MULT (ABM), 6-7, 6-9 NODESETn (initial bias point), A-4 PWR (ABM), 6-8, 6-21 PWRS (ABM), 6-8, 6-21 QBREAKx (bipolar transistor), 5-32, 5-34 R (resistor), 3-2 R_VAR (resistor), 3-2 RBREAK (resistor), 5-26 SBREAK (voltage-controlled switch), 5-30 SIN (ABM), 6-8, 6-21 SOFTLIM (ABM), 6-7, 6-10 SQRT (ABM), 6-8, 6-21 SUM (ABM), 6-7, 6-9 T (transmission line), 3-5 TABLE (ABM), 6-7, 6-14 TAN (ABM), 6-8, 6-21 TLOSSY (transmission line), 3-5 TnCOUPLED (transmission line), 3-7 TnCOUPLEDX (transmission line), 3-7 VDC (power supply), 3-13 VIEWPOINT (view bias point voltage), 2-5, 2-8,
49
ESUM (ABM), 6-28, 6-31 ETABLE (ABM), 6-28, 6-33 EVALUE (ABM), 6-28, 6-30, 6-31 EXP (ABM), 6-8, 6-21 F (ABM controlled analog source), 6-48, 6-49 FPOLY (ABM controlled analog source), 6-48, 6-
49
FTABLE (ABM), 6-7, 6-15 G (ABM controlled analog source), 6-48, 6-49 GAIN (ABM), 6-7, 6-9 GFREQ (ABM), 6-28, 6-37 GLAPLACE (ABM), 6-28, 6-35 GLIMIT (ABM), 6-7, 6-10 GMULT (ABM), 6-28, 6-31 GPOLY (ABM controlled analog source), 6-48, 6-
14-2
VPLOTn (voltage plot), 14-3 VPRINTn (voltage table), 14-3 VSRC (power supply), 3-13 VSTIM (analog stimulus), 10-13 WBREAK (current-controlled switch), 5-30 XFRM_LINEAR (transformer), 3-4 XFRM_NONLINEAR (nonlinear transformer), 5-
49
GSUM (ABM), 6-28, 6-31 GTABLE (ABM), 6-28, 6-33 GVALUE (ABM), 6-28, 6-30, 6-31 H (ABM controlled analog source), 6-48, 6-49 HIPASS (ABM), 6-7, 6-12 HPOLY (ABM controlled analog source), 6-48, 6-
49
ICn (initial condition), A-4 IDC (power supply), 3-13 INTEG (ABM), 6-7, 6-14 IPLOT (current plot), 14-3
29
ZBREAKN (IGBT), 5-32, 5-35 system variables in expressions, 3-13
Index-7
T
table look-up parts (ABM), 6-7, 6-14, 6-28, 6-33 temperature analysis, 1-7, 7-2, 11-11 with statistical analyses, 12-6 TEMPLATE attribute, 4-7 TIME (Probe output variable), 13-24 traces adding, 2-10 direct manipulation, 13-15 displaying, 2-10, 2-17 markers, 13-28 output variables, 13-22 placing a cursor on, 2-11 transformers, 3-4, 5-29 transient analysis, 1-7, 7-2 example, 2-14 Fourier analysis, 1-7, 7-2 hysteresis curves, 10-16 internal time steps, 10-15 overview, 10-2 setting up, 2-16 Stimulus Editor, 10-5 stimulus generation, 10-3 switching circuits, 10-16 transient response, 10-14 transmission lines coupled, 3-6, 3-8 ideal, 3-5 lossy, 3-5 simulating, 3-8 triode, 6-25 tutorials, see examples and tutorials
worst-case analysis, 1-8, 7-2, 12-21 collating functions, 12-4 example, 12-24 hints, 12-28 model parameter values reports, 12-3 output control, 12-3 overview, 12-21 waveform reports, 12-4 with temperature analysis, 12-6
Z
zoom regions, Probe, 13-15
V
variables in expressions, 3-13 viewpoints, 14-2 voltage comparator, 5-8 voltage reference, 5-8 voltage regulator, 5-8 voltage source, controlled, 6-28, 6-47 VSTIM symbol, 2-14
W
WATCH1 (view output variable symbol), 14-2 waveform analysis, see Probe waveform families, displaying in Probe, 2-25