Sie sind auf Seite 1von 512

Authors:

Dr. rer. nat. Jochen Broz


Dipl.-Math. Alexander Dreyer
Dipl.-Ing. Thomas Halfmann
Dr.-Ing. Eckhard Hennig
Dr.-Ing. Manfred Thole
Dr. rer. nat. Tim Wichmann

Copyright  2000–2005 by Fraunhofer-Institut für Techno- und Wirtschaftsmathematik (ITWM)


Fraunhofer-Platz 1, D-67663 Kaiserslautern, Germany
Fax: +49-631-31600-1099
Email: analog.insydes@itwm.fhg.de
WWW: http://www.analog-insydes.de

This document is furnished by Fraunhofer ITWM to licensed users of Analog Insydes for information purposes only. All information in this
document is subject to change without notice. This document is provided as is without any express or implied warranties.

No part of this document may be reproduced or redistributed, on any media or by any means, without prior written permission of Fraunhofer
ITWM.

This document was typeset using the WRILaTeX Document System provided under license by Wolfram Research, Inc.

The sparse matrix routines used in the Analog Insydes MathLink applications are copyright  1985, 86, 87, 88 by Kenneth S. Kundert and
the University of California.

Analog Insydes and the Analog Insydes logo are trademarks of Fraunhofer ITWM.
Mathematica and MathLink are registered trademarks of Wolfram Research, Inc.
All other product names are trademarks of their respective owners.
Table of Contents
Part 1. A Short Introduction
1.1 Welcome to Analog Insydes.........................................................................................................................6
How to Read this Book Feature List

1.2 Getting Started............................................................................................................................................8


Command Overview The First Step An Example Application The Online Help System The Analog Insydes
Palette

1.3 What’s New?.............................................................................................................................................25


New in Version 2.1 New in Version 2: An Overview New in Version 2: A More Detailed Description
Compatibility

Part 2. Tutorial
2.1 Preface......................................................................................................................................................34
How to Read this Tutorial Loading Analog Insydes

2.2 Netlists.......................................................................................................................................................35
The Netlist Format Circuit Elements A Brief Preview on Circuit Analysis More about Netlists

2.3 Circuits and Subcircuits..............................................................................................................................48


Circuits, Netlists, and Subcircuits Defining Subcircuits and Device Models Referencing Subcircuits Subcircuit
Expansion Subcircuit Parameters The Scope Argument The Translation Argument

2.4 Setting up and Solving Circuit Equations....................................................................................................72


Naming Conventions Circuit Equations Circuit Equation Formulations Additional Options for
CircuitEquations

2.5 Graphics....................................................................................................................................................83
Bode Plots Nyquist Plots Nichol Plots Root Locus Plots Transient Waveforms

2.6 Modeling and Analysis of Nonlinear Circuits.............................................................................................92


Behavioral Models Defining Behavioral Models Referencing Behavioral Models Nonlinear Circuit Equations
Multi-Dimensional Models Nonlinear DC Circuit Analysis References

2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits...............................................................................106


Transient Circuit Analysis Analysis of a Differential Amplifier Flow of Transient Circuit Analysis NDAESolve
Options Transient Analysis with Initial Conditions TransientPlot Options

2.8 Linear Symbolic Approximation................................................................................................................130


Introduction to Symbolic Approximation Solution-Based Symbolic Approximation Equation-Based Symbolic
Approximation Combining SBG and SAG Options for ApproximateMatrixEquation

2.9 Frequency-Domain Analysis of Linear Circuits..........................................................................................145


Transistor Models Transfer Functions Device Mismatch Input and Output Impedances Two-Port Parameters
Advanced Transistor Modeling AC Analysis of the CMOS Amplifier

2.10 Nonlinear Symbolic Approximation..........................................................................................................167


Introduction to Nonlinear Approximation Analyzing a Square Root Function Block
2

Part 3. Reference Manual


3.1 Netlist Format..........................................................................................................................................180
Netlist Circuit Netlist Entries Netlist Entry Options ElementTypes Value Specifications for Independent
Sources Time and Frequency Model References Model and Subcircuit ModelParameters GlobalParameters

3.2 Subcircuit and Device Model Definition....................................................................................................192


Model Subcircuit

3.3 Model Library Management.....................................................................................................................213


ListLibrary FindModel FindModelParameters GlobalSubcircuits GlobalModelParameters LoadModel
LoadModelParameters RemoveSubcircuit RemoveModelParameters

3.4 Expanding Subcircuits and Device Models................................................................................................223


ExpandSubcircuits

3.5 Setting Up and Solving Circuit Equations.................................................................................................229


CircuitEquations ACEquations DCEquations Solve

3.6 Circuit and DAEObject Manipulation........................................................................................................257


AddElements DeleteElements GetElements RenameNodes GetEquations GetMatrix GetVariables GetRHS
GetParameters GetDAEOptions SetDAEOptions GetDesignPoint ApplyDesignPoint UpdateDesignPoint
MatchSymbols ShortenSymbols Statistics

3.7 Numerical Analyses.................................................................................................................................282


Analog Insydes Numerical Data Format Parameter Sweeps ACAnalysis NoiseAnalysis NDAESolve

3.8 Pole/Zero Analysis..................................................................................................................................306


GeneralizedEigensystem GeneralizedEigenvalues PolesAndZerosByQZ PolesByQZ ZerosByQZ
RootLocusByQZ LREigenpair ApproximateDeterminant

3.9 Graphics Functions...................................................................................................................................332


BodePlot FourierPlot NicholPlot NyquistPlot RootLocusPlot TransientPlot

3.10 Interfaces.................................................................................................................................................366
ReadNetlist Simulator-Specific Remarks on ReadNetlist ReadSimulationData WriteSimulationData
WriteModel

3.11 Linear Simplification Techniques...............................................................................................................387


ComplexityEstimate ApproximateTransferFunction ApproximateMatrixEquation CompressMatrixEquation

3.12 Nonlinear Simplification Techniques..........................................................................................................403


NonlinearSetup CompressNonlinearEquations CancelTerms SimplifySamplePoints NonlinearSettings
ShowLevel ShowCancellations

3.13 Miscellaneous Functions...........................................................................................................................420


ConvertDataTo2D DXFGraphics MathLink Module MSBG MathLink Module QZ

3.14 Global Options........................................................................................................................................427


Options[AnalogInsydes] InstanceNameSeparator LibraryPath ModelLibrary Protocol Simulator
UseExternals Option Inheritance

3.15 The Analog Insydes Environment..............................................................................................................434


The Initialization Procedure ReleaseInfo ReleaseNumber License Version Info
Table of Contents 3

Part 4. Appendix
4.1 Stimuli Sources........................................................................................................................................440
AMWave ExpWave PulseWave PWLWave SFFMWave SinWave

4.2 Netlist Elements........................................................................................................................................448


Resistor Conductance Admittance Impedance Capacitor Inductor OpenCircuit ShortCircuit
CurrentSource VoltageSource CCCSource CCVSource VCCSource VCVSource OpAmp OTAmp
Nullator Norator Fixator SignalSource Amplifier Integrator Differentiator TransmissionLine
TransferFunction

4.3 Model Library..........................................................................................................................................462


Diode Bipolar Junction Transistor MOS Field-Effect Transistor Junction Field-Effect Transistor

Credits..............................................................................................................................................................500
Index................................................................................................................................................................501
A Short Introduction

1.1 Welcome to Analog Insydes . . . . . . . . . . . . . . . . . 6

1.2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . 8

1.3 What’s New? . . . . . . . . . . . . . . . . . . . . . . . . . 25


6 1. A Short Introduction

1.1 Welcome to Analog Insydes


Welcome to Analog Insydes, a Mathematica toolbox for symbolic modeling, analysis, and design of
analog electronic circuits. With Analog Insydes you can model and analyze linear and nonlinear
circuits, manipulate analysis results mathematically, produce graphical visualizations of circuit
characteristics, exchange data with commercial circuit simulators, and document your solutions
all in one integrated environment.
You will always get the latest information concerning Analog Insydes at our home page
http://www.analog−insydes.de
There you will also find a collection of demo notebooks, which show the application of Analog
Insydes on different tasks from the field of electrical engineering.
If you have questions concerning Analog Insydes, please send an email to:
analog.insydes@itwm.fhg.de

If you want to register to the Analog Insydes newsletter, please write an email to the above mentioned
email address with subject line "Newsletter " and body text "subscribe ". You can find the list of
previous newsletters at:
http://www.analog−insydes.de/newsletter.html

1.1.1 How to Read this Book


This book is divided into four parts: an introduction (Part 1), a tutorial (Part 2), a reference manual
(Part 3), and an appendix (Part 4).
The introduction part gives an overview of Analog Insydes’ functionality, highlights the new features
of version 2, and shows the application of Analog Insydes on an practical example. We recommend
to read this part, especially Section 1.2.1 and Section 1.2.3, before working with Analog Insydes.
The tutorial part explains dedicated topics of Analog Insydes in detail. Although entitled Tutorial, it
is not meant to be read completely before working with Analog Insydes. Rather, each chapter can
be read separately as soon as you need a closer look at special topics.
The reference part explains each Analog Insydes command, shows its argument list, describes the
available options, and shows the application on small examples. If you need information on a certain
command, the reference manual is the preferred source.
The appendix part explains all stimuli sources defined in Analog Insydes, shows all available netlist
elements, and finally describes the content of the predefined symbolic device model library.

1.1.2 Feature List


The list below shows a summary of Analog Insydes’ main program features.
1.1 Welcome to Analog Insydes 7

Netlist-based input of electronic circuits and control systems


Available linear circuit elements: resistor, impedance, conductance, admittance, capacitor, inductor,
independent current and voltage source, all four types of controlled sources (VCVS, CCVS, VCCS,
CCCS), operational amplifier (OP), operational transconductance amplifier (OTA), nullator, norator,
fixator
Available control network elements: proportional amplifier, differentiator, integrator, ideal trans-
mission line, generic transfer function, signal source
Hierarchical netlist entry and device modeling by means of subcircuits and behavioral model
definitions
User-extendible device model library which includes bipolar (full Gummel-Poon small-signal and
large-signal) and MOS (full Level 1-3 and BSIM3v3 small-signal, Level 1 large-signal) transistor
models
Automatic setup of symbolic or mixed symbolic/numeric circuit equations by modified nodal
(MNA), sparse tableau (STA), and extended sparse tableau analysis (ESTA) from netlists for linear
and nonlinear circuits
Automatic equation setup for AC, DC, transient, and noise analysis
Symbolic calculation of transfer functions, input impedances, two-port parameters, etc.
Design formula extraction by approximation of linear symbolic circuit equations and transfer
functions
Simplification techniques for the approximation of nonlinear circuit descriptions
Support for automated generation of behavioral models for nonlinear circuits
Numerical AC, noise, and pole/zero analysis
Numerical DC, DC-transfer, and transient analysis of nonlinear circuits
Solution of circuit equations not only for currents and voltages but also for design parameters
Graphics functions for Bode, Nyquist, Nichol, Fourier, and root locus plots, transient waveforms,
DC-transfer, and parametric analyses
Netlist import for Eldo, PSpice, Saber, and Spectre (via Analog Artist) netlist files, including
small-signal, operating-point, and model-card parameters
Import filter for Eldo, PSpice, Saber, and Spectre simulation data
Export filter of Analog Insydes simulation data for PSpice and Saber
Export filter for Saber MAST model templates
Import filter for circuit schematics and other line graphics from DXF files
8 1. A Short Introduction

1.2 Getting Started


If this is your first contact with Analog Insydes, this chapter will help you to get familiar with
the system. To get an overview of the functionality of Analog Insydes, the first section provides
a list of the most important commands (Section 1.2.1). Next, it is described how to load Analog
Insydes into the Mathematica kernel (Section 1.2.2), and an example application shows one possible
way to use Analog Insydes for solving a specific analysis task (Section 1.2.3). If you have never seen
Analog Insydes before, reading this example will give you a first impression of the system. Finally,
Section 1.2.4 explains how to access the Analog Insydes online help system.

1.2.1 Command Overview


The most important Analog Insydes commands are listed in this section. For each command,
references are given where to find more information. A link to the reference manual (Part 3 of this
book) is given first, followed by links to related topics described in the tutorial (Part 2 of this book).

Interfaces
Analog Insydes provides import and export filters to Eldo, PSpice, Saber, and Spectre. (Chapter 3.10):
ReadNetlist (Section 3.10.1, Section 2.9.2) translates external netlist files (including model cards,
small-signal data, and operating-point information) into the Analog Insydes netlist language.
ReadSimulationData (Section 3.10.3, Section 2.10.2) allows for importing and transforming
numerical simulation data into Mathematica InterpolatingFunction objects.
WriteSimulationData (Section 3.10.4) exports numerical data calculated with Analog Insydes for
further postprocessing in external waveform viewers.
WriteModel (Section 3.10.5) generates behavioral model descriptions of symbolic (approximated)
equation systems.

Netlists, Circuits, and Models


In Analog Insydes, analog circuits are expressed in terms of Netlist, Circuit, and Model objects:
Netlist (Section 3.1.1, Chapter 2.2) is the basic data structure which contains the elements of a
flat netlist.
Circuit (Section 3.1.2, Chapter 2.3, Section 2.3.1) is a data structure which combines netlists,
models, model parameters, and global parameters.
Model (Section 3.2.1, Section 2.3.2, Section 2.6.2) is a data structure which defines netlist-based or
equations-based models or subcircuits.
AddElements (Section 3.6.1, Section 2.9.4),
DeleteElements (Section 3.6.2, Section 2.9.4), GetElements (Section 3.6.3), and RenameNodes
1.2 Getting Started 9

(Section 3.6.4) allow for adding, deleting, or extracting netlist entries and changing node names,
respectively, in a comfortable way.
Statistics (Section 3.6.17) prints information on the contents of a Netlist or Circuit object.
Analog Insydes provides a predefined symbolic device model library (Chapter 4.3), which can be
extended by the user. Several commands allow for accessing the model data base (Chapter 3.3):
LoadModel (Section 3.3.6) loads a specific model from a given model library.
FindModel (Section 3.3.2) searches the default model library for a given name/selector pair.
GlobalSubcircuits (Section 3.3.4, Section 2.3.6) prints the name/selector pairs of all global
models currently loaded.
ListLibrary (Section 3.3.1) prints the contents of a specific model library.

Equations
Starting from Circuit or Netlist objects, circuit equations can be set up automatically in different
formulations and analysis modes. They are stored (together with additional information) in a
DAEObject.
CircuitEquations (Section 3.5.1, Chapter 2.4, Section 2.4.2, Section 2.6.4) sets up circuit equations
from a Circuit or Netlist object and returns a DAEObject.
Solve (Section 3.5.4, Section 2.4.2) can be used to symbolically solve the equations stored in a
DAEObject.
GetEquations (Section 3.6.5, Section 2.10.2), GetVariables (Section 3.6.7, Section 2.10.2),
GetDesignPoint (Section 3.6.12, Section 2.9.6), and GetParameters (Section 3.6.9, Section 2.10.2)
give easy access to the data stored in a DAEObject.
ApplyDesignPoint (Section 3.6.13), UpdateDesignPoint (Section 3.6.14, Section 2.10.2), and
MatchSymbols (Section 3.6.15, Section 2.9.3) allow for modifying the contents of a DAEObject.
GetDAEOptions (Section 3.6.10) and
SetDAEOptions (Section 3.6.11) allow for accessing or modifying the options stored in a DAEObject.
Statistics (Section 3.6.17, Section 2.9.7) prints information on the complexity of a DAEObject.

Numerical Analyses
The standard numerical circuit analyses can be carried out by the following commands (Chapter 3.7):
NDAESolve (Section 3.7.5, Chapter 2.7) is used to solve nonlinear differential-algebraic equation
systems. It calculates the DC (Section 2.6.6), DC-transfer (Section 2.7.2), and transient solution
(Section 2.7.1), also parametric (Section 2.7.2).
ACAnalysis (Section 3.7.3, Section 2.9.7) computes the small-signal solution of a linear equation
system.
10 1. A Short Introduction

NoiseAnalysis (Section 3.7.4) computes the output noise and the equivalent input noise of a
linear equation system.

Poles and Zeros


Besides the standard numerical analyses, Analog Insydes provides functions for numerically computing
poles and zeros as well as root loci of linear systems (Chapter 3.8):
PolesAndZerosByQZ (Section 3.8.3), PolesByQZ (Section 3.8.4), and ZerosByQZ (Section 3.8.5)
numerically compute poles and zeros of a linear system using the QZ algorithm.
RootLocusByQZ (Section 3.8.6) computes the root locus of a linear system.

Graphical Postprocessing
Analog Insydes provides special graphics functions for the most important electrical engineering
plots:
BodePlot (Section 3.9.1, Section 2.5.1)
FourierPlot (Section 3.9.2)
NicholPlot (Section 3.9.3, Section 2.5.3)
NyquistPlot (Section 3.9.4, Section 2.5.2)
RootLocusPlot (Section 3.9.5, Section 2.5.4)
TransientPlot (Section 3.9.6, Section 2.7.1, Section 2.7.6)

Symbolic Approximation
One of the most important features of Analog Insydes is its capability to reduce the complexity of
symbolic equations and expressions with automatic error control. For linear circuits, Analog Insydes
provides SBG and SAG methods (Chapter 2.8):
ApproximateTransferFunction (Section 3.11.2, Chapter 2.8, Section 2.8.2) approximates a symbolic
transfer function by removing insignificant terms.
ApproximateMatrixEquation (Section 3.11.3, Chapter 2.8, Section 2.8.3) approximates a symbolic
matrix equation with respect to a certain output variable.
ApproximateDeterminant (Section 3.8.8) approximates a symbolic matrix equation with respect
to a certain pole.
As of Analog Insydes version 2 there are also simplification routines for nonlinear equations
(Chapter 3.12):
CompressNonlinearEquations (Section 3.12.2, Section 2.10.2) algebraically simplifies nonlinear
equations by eliminating irrelevant variables.
1.2 Getting Started 11

CancelTerms (Section 3.12.3, Section 2.10.2) approximates a symbolic nonlinear equation system
with respect to a certain output variable. The command
NonlinearSetup (Section 3.12.1, Section 2.10.2) prepares the application of CancelTerms .

Miscellaneous
DXFGraphics (Section 3.13.2) translates DXF files into Mathematica graphics objects. It can be used
to display circuit schematics in a Mathematica notebook for documentation purposes.
Options[Analog Insydes] (Chapter 3.14) returns the list of global Analog Insydes options. See
Section 3.14.8 for a description of the option inheritance mechanism in Analog Insydes.
Info[AnalogInsydes] (Section 3.15.6) prints the exact location of your Analog Insydes installation
and lists all loaded init files. For a description of init file loading see Section 3.15.1. For further
information on the Analog Insydes environment see Chapter 3.15.

1.2.2 The First Step


To work with Analog Insydes start Mathematica and open a new notebook window. Then load
Analog Insydes by evaluating the command
<<AnalogInsydes‘

in the first command line (please do not forget to type the quote character "‘").
The above command reads in the Analog Insydes context and sets up autoload declarations for all
other Analog Insydes packages. If you have not launched a Mathematica kernel yet, you will have to
wait a few extra seconds until the kernel is loaded.
If Mathematica complains that it cannot find the master package check your context search path by
inspecting the value of the Mathematica variable $Path. The directory in which the Analog Insydes
subdirectory resides should be on this list. If this is not the case then add the package path to $Path
by typing AppendTo[$Path, pathspec] and try loading Analog Insydes again. Another common error
is to type the wrong quote character, thus be sure to use "‘".
If you are already familiar with Analog Insydes 1 you probably want to test the new version before
reading the manual. Almost all commands of version 1 are also available in version 2 and version 2.1,
but please note that the function patterns may have changed (see Section 1.3.4 for more details). If
you are not familiar with Analog Insydes, please at least go through the example in Section 1.2.3
before using Analog Insydes. This section will give you a first impression how to work with Analog
Insydes.
Additionally, we recommend to take a look at the demo notebooks which are available for download
at
http://www.analog−insydes.de/demos2.html
There you will find a number of different problems and tasks from the field of electrical engineering
and how to solve them using Analog Insydes 2.1.
12 1. A Short Introduction

Once you have loaded Analog Insydes into the Mathematica kernel you can obtain detailed information
concerning your local Analog Insydes installation by means of the following commands:

ReleaseInfo[AnalogInsydes] prints information about your Analog Insydes license type


ReleaseNumber[AnalogInsydes] returns the release number of your Analog Insydes
installation
License[AnalogInsydes] returns your Analog Insydes license number
Version[AnalogInsydes] prints a detailed description of your Analog Insydes
version
Info[AnalogInsydes] prints the location of your Analog Insydes installation and
the list of loaded init files

Obtaining Analog Insydes release information.

If you encounter any bug in Analog Insydes, please send a bug report to:
analog.insydes@itwm.fhg.de

When reporting problems, please proceed as follows: Evaluate all commands in a Mathematica
notebook until your problem occurs and describe it as detailed as possible. Whenever possible,
print Netlist and Circuit objects as well as DAEObjects in InputForm . Afterwards, please add
the information concerning your Analog Insydes installation by evaluating each of the following
commands in separate cells of the Mathematica notebook and attach this notebook to your problem
report:
$VersionId
$Path
$LicenseID
ReleaseInfo[AnalogInsydes]
Version[AnalogInsydes]
License[AnalogInsydes]
Info[AnalogInsydes]
Please be sure to evaluate the commands after your problem occurs, because otherwise some
modules might not be loaded during the evaluation of Version[AnalogInsydes] . If possible, attach
additional data such as netlist or data files to the email as well.

1.2.3 An Example Application


This example describes the standard way how to use Analog Insydes. It can easily be adapted to
different analysis tasks and applications. The usage of many different commands, from netlist import
to linear simplification techniques, is explained and cross references are given where to find more
information. Reading this section should give you a first overview of the capabilities of Analog
Insydes.
1.2 Getting Started 13

Analysis Task
Following, we want to analyze the ΜA741 operational amplifier. The task is to find an interpretable
symbolic formula for the corner frequency of the small-signal voltage transfer function. This is useful
to identify those circuit elements and parasitics, which have a dominant influence on it. In addition,
the symbolic transfer function can be utilized for further investigation, such as the extraction of its
poles and zeros, to find methods for the compensation of certain effects.

Importing Schematics
To import the schematics picture of the operational amplifier, we use the Analog Insydes command
DXFGraphics (Section 3.13.2). This command translates two-dimensional DXF data into Mathematica
graphics objects which can be displayed in a Mathematica notebook. Most schematics entries of
commercial circuit simulators support the export of schematics in DXF format. DXFGraphics allows
for importing your schematics into Mathematica for documentation purposes.
Before using DXFGraphics , of course we have to load the Analog Insydes master package as described
in Section 1.2.2.
In[1]:= <<AnalogInsydes‘

In[2]:= DXFGraphics["AnalogInsydes/DemoFiles/OP−741.dxf"]

Vos 5 Vic
+
-
-
+

0
1
Q132
Q8 Q9 Q12 Q131
Vid QPNP741 V1
- QPNP741
QPNP741 QPNP741
QPNP741 +
+ 22 Q14
2 16 QNPN741 -
Q1 QNPN741 Q2 Q15
QNPN741 R5 25
4 40k QNPN741
Q18 QNPN741
6 7 R6
Q19 27 V
QNPN741
QPNP741
Q3 Q4
QPNP741 26 R13 0
17 R10 1k 0
23 R7
3 C1
30p 50k
Q21 22
QPNP741 27
Q222 24 Q20
8 Q7 QNPN741 9 R12 18Q16 QNPN741
Q221 QPNP741
QPNP741 QPNP741
15 Q11
300 Q10 Q17
Q5 Q6 QNPN741 QNPN741 QNPN741
QNPN741 QNPN741 19
10
Q23 20 21 +
V2
11 12 14 QNPN741
-
R1 R3 R2 R4 R8
R9 QNPN741 Q24 R11
1k 50k 1k 5k 50k 100 50k
13

Out[2]= … Graphics …

DXFGraphics provides many options for altering the appearance of imported DXF files. They are
described in Section 3.13.2.

Importing Netlist Data


For the application of symbolic analysis, especially symbolic approximation, the next step is to
generate a netlist including the numerical reference information. The netlist of the operational
amplifier ΜA741 consists of 45 elements. Writing the complete circuit in the Analog Insydes netlist
language (which is described in Chapter 2.2 and Chapter 2.3) by hand would be a tedious and
error-prone task. Therefore, Analog Insydes provides the command ReadNetlist (Section 3.10.1),
14 1. A Short Introduction

which automatically translates an external netlist description into the Analog Insydes netlist format.
You can import netlists written for or generated by Eldo, PSpice, Saber, and the Spectre to Analog
Insydes interface for Analog Artist.
The first argument to ReadNetlist is the simulator input file. Since this file (*.cir in our case)
only contains the numerical values of the elements, the operating-point information and the values
for the small-signal parameters of the transistors have to be extracted from the simulator output file
(*.out in our case). This is performed automatically by ReadNetlist , too. All we have to do is
specifying the corresponding simulator output file as second argument.
In[3]:= op741 = ReadNetlist[
"AnalogInsydes/DemoFiles/OP−741.cir",
"AnalogInsydes/DemoFiles/OP−741.out",
Simulator −> "PSpice", KeepPrefix −> False]
Out[3]= … Circuit …

As the syntax of external netlist files varies for each simulator, you have to specify from which
external format you are reading by means of the Simulator option of ReadNetlist .
The return value of ReadNetlist is a Circuit object which contains symbolic values for each netlist
element as well as the corresponding numerical reference information. By default, the Circuit object
is displayed as a single line in your output cell. To view the complete netlist apply the command
DisplayForm to the Circuit object (we will not evaluate the command since the output is too big
to be shown here):
DisplayForm[op741]
Additionally, you can use the command Statistics (Section 3.6.17) to get an impression of the
circuit complexity. This command prints the number of different element types occuring in the
circuit.
In[4]:= Statistics[op741]
Number of Resistors : 13
Number of Capacitors : 1
Number of VoltageSources : 5
Number of models BJT/QNPN741 : 15
Number of models BJT/QPNP741 : 11
Total number of elements : 45

Setting Up Circuit Equations


Once the netlist is imported, the next step is to set up the symbolic circuit equations. In Analog
Insydes this can be done automatically using the command CircuitEquations (Section 3.5.1). The
Analog Insydes netlist read by ReadNetlist contains generic model references for each transistor and
does not specifiy a concrete model implementation. Thus, we have to instruct Analog Insydes which
model to use during equation setup by means of the option ModelLibrary . Analog Insydes comes
with a predefined SPICE-compatible, symbolic model library in three different complexity levels
called "FullModels‘" , "SimplifiedModels‘" , and "BasicModels‘" (the implemented models are
explained in detail in Chapter 4.3. For special tasks the model library can be extended by the user;
1.2 Getting Started 15

this topic is discussed in Chapter 2.3). In the following, we choose a complexity-reduced BJT model
from the Analog Insydes model library by setting the option ModelLibrary −> "BasicModels‘" .
Note that a quote mark ("‘") is following the word BasicModels .
In[5]:= mnaAC741 = CircuitEquations[op741,
ElementValues −> Symbolic,
ModelLibrary −> "BasicModels‘"]
Out[5]= … DAE@AC, †33 ´ 33‡D …

The additional option ElementValues −> Symbolic tells Analog Insydes to set up equations using
the symbolic element values instead of the numerical ones. By default, CircuitEquations sets up
small-signal equations in matrix formulation, but DC or transient equations can be set up, too. See
Section 3.5.1 and Chapter 2.4 for details. CircuitEquations returns a DAEObject which contains
the equation system as well as additional data which is used and extracted automatically by other
Analog Insydes commands. As for Circuit objects, a DAEObject is printed in short notation only
and can be displayed using DisplayForm (we once more omit evaluating the command since the
equation system is too big to be printed here):
DisplayForm[mnaAC741]
Again, you can use Statistics (Section 3.6.17) to get an impression of the equation size.
In[6]:= Statistics[mnaAC741]
Number of equations : 33
Number of variables : 33
Number of entries : 1089
Number of non−zero entries : 171
Complexity estimate : 1.6e21

Importing Simulation Data


When using netlists from external simulators we always have to verify that the models used during
equation setup are compatible to the ones used by the simulator. This is done by comparing
the numerical solution calculated by the external simulator with the solution calculated by Analog
Insydes. If both solutions do not coincide within a tolerable error range, we have to go back one step
and choose different models during equation setup before going on with the symbolic analysis. To
simplify this procedure, Analog Insydes provides the command ReadSimulationData (Section 3.10.3)
for importing numerical data generated by an external simulator. As for ReadNetlist we have to
specify from which format we are reading by means of the Simulator option. The list of supported
formats is shown in Section 3.10.1.
In[7]:= op741data = ReadSimulationData[
"AnalogInsydes/DemoFiles/OP−741.csd",
Simulator −> "PSpice"]

88VH26L ® InterpolatingFunction@880.1, 1. ´ 106 <<, <>D<<


Out[7]=
16 1. A Short Introduction

ReadSimulationData returns the result according to the Analog Insydes numerical data format
which is described in Section 3.7.1. It consists of a list of rules, where the variables (which are
returned as strings) are assigned InterpolatingFunction objects.

Graphically Displaying Simulation Data


We can use Mathematica’s ReplaceAll operator (or /. in short notation) to extract a single
interpolating function from the numerical data and assign it to a new variable.
In[8]:= vout741PSpice = "V(26)" /. First[op741data]
Out[8]= InterpolatingFunction@880.1, 1. ´ 106 <<, <>D

The variable vout741PSpice now contains the numerical data for the output voltage at node
26. Its waveform can be graphically displayed in a Bode diagram using the function BodePlot
(Section 3.9.1).
In[9]:= BodePlot[vout741PSpice[f], {f, 0.1, 10^6}]

100
Magnitude (dB)

80
60
40
20
0
1.0E-1 1.0E1 1.0E3 1.0E5
Frequency

0
Phase (deg)

-20
-40
-60
-80

1.0E-1 1.0E1 1.0E3 1.0E5


Frequency

Out[9]= … Graphics …

Analog Insydes provides several standard graphic functions for visualizing numerical analysis results,
see Chapter 2.5 and Chapter 3.9.

Performing Reference Simulation


A numerical reference simulation is performed applying the Analog Insydes function ACAnalysis
(Section 3.7.3) in the frequency range of interest. The first argument of ACAnalysis is the DAEObject
created by CircuitEquations , which contains the system of equations. The second argument denotes
the output variable to solve for. We are interested in the node voltage at node 26 and according to
the automatic naming mechanism (which is described in Section 2.4.1) the corresponding variable is
called V$26.
1.2 Getting Started 17

In[10]:= reference = ACAnalysis[mnaAC741, V$26, {f, 0.1, 10^6}]

88V$26 ® InterpolatingFunction@880.1, 1. ´ 106 <<, <>D<<


Out[10]=

Next, the frequency response calculated with Analog Insydes and the simulation data imported from
PSpice are compared graphically, using the capability of the command BodePlot to display several
transfer functions within one plot.
In[11]:= BodePlot[reference, {vout741PSpice[f], V$26[f]},
{f, 0.1, 10^6}, ShowLegend −> False]

100
Magnitude (dB)

80
60
40
20
0
1.0E-1 1.0E1 1.0E3 1.0E5
Frequency

0
Phase (deg)

-20
-40
-60
-80

1.0E-1 1.0E1 1.0E3 1.0E5


Frequency

Out[11]= … Graphics …

The curves match perfectly in the frequency range of interest. Hence, the simplified BJT model is
sufficient for being used in the next step of the symbolic analysis flow.

Calculating the Complexity of the Symbolic Transfer Function


Recall that the task is to calculate the symbolic transfer function in order to extract a formula for the
corner frequency. Thus, at this point it is useful to estimate the complexity of the symbolic transfer
function to find out whether the number of its terms is manageable. This can be done with the help
of the function ComplexityEstimate (Section 3.11.1).
In[12]:= ComplexityEstimate[mnaAC741] // N
Out[12]= 1.61868 ´ 1021

ComplexityEstimate returns an integer value. We use Mathematica‘s N operator to transform this


integer into a real number. The result shows that the number of terms forming the fully expanded
symbolic transfer function is greater than 1.6 ‰ 1021 and thus too large to be handled. Therefore,
we will now apply a routine which removes all those terms whose influence on the behavior of the
transfer function is negligible. This drastically reduces the complexity.
18 1. A Short Introduction

Setting Up Circuit Equations for Approximation


To prepare the simplification process we set up the system of circuit equations again. As against
the previous call to the function CircuitEquations , where the circuit equations were given in the
modified nodal analysis format, they are set up in sparse tableau formulation this time. Sparse
tableau is the preferred equation formulation when performing linear approximation tasks. Details
about the Formulation option are given in Section 3.5.1.
In[13]:= staAC741 = CircuitEquations[op741,
ElementValues −> Symbolic, Formulation −> SparseTableau,
ModelLibrary −> "BasicModels‘"]
Out[13]= … DAE@AC, †402 ´ 402‡D …

The returned equation system is a DAEObject with 402 equations and 402 variables.
In[14]:= Statistics[staAC741]
Number of equations : 402
Number of variables : 402
Number of entries : 161604
Number of non−zero entries : 1392
Complexity estimate : 1.6e21
Although this sparse tableau system is more than 10 times bigger than the modified nodal system,
it usually produces better approximation results.

Performing Matrix Approximation


Now we call the matrix approximation routine on the symbolic circuit equations of the ΜA741 circuit.
This routine simplifies the equations based on numerical constraints with respect to a given output
variable. The required information is provided in form of several sampling points, specified in
combination with a maximum error constraint each. The approximation routine then processes the
matrix such that the sought output function is located within the defined error range around the
given sampling points. For further information please refer to Section 3.11.3.
To capture the first corner frequency, we place sampling points at 1 Hz and at 10 Hz with a maximum
error of 30% each.
In[15]:= samplingpoints = {{s −> 2. Pi I 1., MaxError −> 0.3},
{s −> 2. Pi I 10., MaxError −> 0.3}}

88s ® 6.28319 ä, MaxError ® 0.3<, 8s ® 62.8319 ä, MaxError ® 0.3<<


Out[15]=

With the given setup, the approximation routine can be called. The computation is carried out
with respect to the output voltage across the load resistor R13, which in this case is equivalent
to the sought transfer function. Again, based on the automatic naming scheme (Section 2.4.1), the
corresponding variable is called V$R13 (note that sparse tableau equations consist of branch voltages
instead of node voltages).
1.2 Getting Started 19

In[16]:= op741approx = ApproximateMatrixEquation[staAC741, V$R13,


samplingpoints]
Out[16]= … DAE@AC, †402 ´ 402‡D …

In[17]:= Statistics[op741approx]
Number of equations : 402
Number of variables : 402
Number of entries : 161604
Number of non−zero entries : 455
Complexity estimate : 14
As another call to the function Statistics shows, the approximation routine could considerably
reduce the complexity of the DAEObject (i.e. the number of non-zero entries), although its equation
size did not change. With just a small number of terms remaining, a symbolic computation of the
transfer function is now possible.

Calculating the Transfer Function


To calculate the transfer function, we now solve the approximated system of equations for the output
voltage:
In[18]:= approximation = Solve[op741approx, V$R13]

99V$R13 ® Igm$Q1 gm$Q16 gm$Q17 gm$Q2 gm$Q3


Out[18]=

gm$Q4 gm$Q5 R9 Ro$Q131 Ro$Q17 Ro$Q4 Rpi$Q16 Rpi$Q17 VIDM ‘


2

Igm$Q3 H-gm$Q1 gm$Q2 - gm$Q1 gm$Q4L gm$Q5 H-Ro$Q131 - Ro$Q17L


Hgm$Q16 gm$Q17 R8 R9 Ro$Q4 Rpi$Q16 Rpi$Q17 +
Ro$Q4 HR9 Ro$Q4 + gm$Q17 R8 Ro$Q4 Rpi$Q17LL -
C1 gm$Q16 gm$Q17 gm$Q3 H-gm$Q1 gm$Q2 - gm$Q1 gm$Q4L gm$Q5
2
R9 Ro$Q131 Ro$Q17 Ro$Q4 Rpi$Q16 Rpi$Q17 sM==

Again, we use Mathematica’s ReplaceAll operator to extract the calculated solution and assign it to
a new variable.
In[19]:= vout741 = V$R13 /. First[approximation] // Simplify

Hgm$Q16 gm$Q17 gm$Q2 gm$Q4 R9


Out[19]=

Ro$Q131 Ro$Q17 Ro$Q4 Rpi$Q16 Rpi$Q17 VIDL 


HHgm$Q2 + gm$Q4L Hgm$Q17 R8 HRo$Q131 + Ro$Q17L Ro$Q4 Rpi$Q17 +
R9 HRo$Q17 HRo$Q4 + gm$Q16 gm$Q17 R8 Rpi$Q16 Rpi$Q17L +
Ro$Q131 HRo$Q4 + gm$Q16 gm$Q17 R8 Rpi$Q16 Rpi$Q17 +
C1 gm$Q16 gm$Q17 Ro$Q17 Ro$Q4 Rpi$Q16 Rpi$Q17 sLLLL

This expression now represents the approximated symbolic transfer function of the ΜA741 circuit. It
contains only those circuit elements and parasitics that were not removed by the matrix approximation
routine. Thus, they have been identified as those elements, which have a major influence on the
behavior of the transfer function.
20 1. A Short Introduction

Verifying Approximation Results


The quality of the approximation can be determined by performing a numerical comparison between
the simplified transfer function and the data imported from the numerical simulator (PSpice in this
case). Therefore, we need to extract the design point from the DAEObject first using the command
GetDesignPoint (Section 3.6.12). The design point specifies those numerical values for each one of
the circuit elements that were given in the netlist.
In[20]:= designpoint = GetDesignPoint[staAC741]

8Rpi$Q1 ® 756000., Ro$Q1 ® 2.19 ´ 107 , Cbc$Q1 ® 3.7 ´ 10-13 ,


Out[20]=

Cbe$Q1 ® 1.47 ´ 10-12 , gm$Q1 ® 0.00029, Cbx$Q1 ® 0.,


Rpi$Q2 ® 753000., Ro$Q2 ® 2.18 ´ 107 , Cbc$Q2 ® 3.7 ´ 10-13 ,
Cbe$Q2 ® 1.47 ´ 10-12 , gm$Q2 ® 0.000291, Cbx$Q2 ® 0.,
Rpi$Q3 ® 219000., Ro$Q3 ® 8.46 ´ 106 , Cbc$Q3 ® 3.85 ´ 10-13 ,
Cbe$Q3 ® 1.42 ´ 10-12 , gm$Q3 ® 0.000287, Cbx$Q3 ® 0.,
Rpi$Q4 ® 217000., Ro$Q4 ® 8.4 ´ 106 , Cbc$Q4 ® 3.87 ´ 10-13 ,
Cbe$Q4 ® 1.42 ´ 10-12 , gm$Q4 ® 0.000288, Cbx$Q4 ® 0.,
Rpi$Q5 ® 705000., Ro$Q5 ® 2.04 ´ 107 , Cbc$Q5 ® 8.28 ´ 10-13 ,
Cbe$Q5 ® 1.47 ´ 10-12 , gm$Q5 ® 0.000285, Cbx$Q5 ® 0.,
Rpi$Q6 ® 705000., Ro$Q6 ® 2.04 ´ 107 , Cbc$Q6 ® 7.93 ´ 10-13 ,
Cbe$Q6 ® 1.47 ´ 10-12 , gm$Q6 ® 0.000285, Cbx$Q6 ® 0.,
Rpi$Q7 ® 533000., Ro$Q7 ® 1.55 ´ 107 , Cbc$Q7 ® 2.97 ´ 10-13 ,
Cbe$Q7 ® 1.48 ´ 10-12 , gm$Q7 ® 0.000447, Cbx$Q7 ® 0.,
Rpi$Q8 ® 89500., Ro$Q8 ® 3.46 ´ 106 , Cbc$Q8 ® 1. ´ 10-12 ,
Cbe$Q8 ® 1.45 ´ 10-12 , gm$Q8 ® 0.000559, Cbx$Q8 ® 0., R1 ® 1000.,
R2 ® 1000., R3 ® 50000., Rpi$Q9 ® 89500., Ro$Q9 ® 3.46 ´ 106 ,
Cbc$Q9 ® 3.62 ´ 10-13 , Cbe$Q9 ® 1.45 ´ 10-12 , gm$Q9 ® 0.000732,
Cbx$Q9 ® 0., Rpi$Q10 ® 293000., Ro$Q10 ® 8.51 ´ 106 ,
Cbc$Q10 ® 3.81 ´ 10-13 , Cbe$Q10 ® 1.5 ´ 10-12 , gm$Q10 ® 0.000742,
Cbx$Q10 ® 0., Rpi$Q11 ® 7260., †44‡, Ro$Q17 ® 240000.,
Cbc$Q17 ® 3.82 ´ 10-13 , Cbe$Q17 ® 1.6 ´ 10-12 , gm$Q17 ® 0.0263,
Cbx$Q17 ® 0., R6 ® 27., R7 ® 22., R8 ® 100., R9 ® 50000.,
R10 ® 50000., R11 ® 50000., R12 ® 300., Rpi$Q18 ® 368000.,
Ro$Q18 ® 1.07 ´ 107 , Cbc$Q18 ® 1. ´ 10-12 , Cbe$Q18 ® 1.49 ´ 10-12 ,
gm$Q18 ® 0.000543, Cbx$Q18 ® 0., Rpi$Q19 ® 25500.,
Ro$Q19 ® 740000., Cbc$Q19 ® 8.26 ´ 10-13 , Cbe$Q19 ® 1.57 ´ 10-12 ,
gm$Q19 ® 0.00787, Cbx$Q19 ® 0., Rpi$Q20 ® 5810.,
Ro$Q20 ® 225000., Cbc$Q20 ® 1.11 ´ 10-12 , Cbe$Q20 ® 4.48 ´ 10-12 ,
gm$Q20 ® 0.0111, Cbx$Q20 ® 0., Rpi$Q21 ® 3.34 ´ 1013 ,
Ro$Q21 ® 6.24 ´ 1011 , Cbc$Q21 ® 3.66 ´ 10-13 , Cbe$Q21 ® 1. ´ 10-12 ,
gm$Q21 ® 3.43 ´ 10-13 , Cbx$Q21 ® 0., Rpi$Q24 ® 1.86 ´ 1014 ,
Ro$Q24 ® 9.28 ´ 1011 , Cbc$Q24 ® 1. ´ 10-12 , Cbe$Q24 ® 1. ´ 10-12 ,
gm$Q24 ® 3.77 ´ 10-18 , Cbx$Q24 ® 0., Rpi$Q23 ® 1.86 ´ 1014 ,
Ro$Q23 ® 9.82 ´ 1011 , Cbc$Q23 ® 7.13 ´ 10-13 , Cbe$Q23 ® 1. ´ 10-12 ,
gm$Q23 ® 6.91 ´ 10-14 , Cbx$Q23 ® 0., C1 ® 3. ´ 10-11 ,
Rpi$Q222 ® 7550., Ro$Q222 ® 292000., Cbc$Q222 ® 3.75 ´ 10-13 ,
Cbe$Q222 ® 1.52 ´ 10-12 , gm$Q222 ® 0.00845, Cbx$Q222 ® 0.,
Rpi$Q221 ® 5. ´ 1013 , Ro$Q221 ® 7.67 ´ 1011 , Cbc$Q221 ® 3.75 ´ 10-13 ,
Cbe$Q221 ® 3.88 ´ 10-13 , gm$Q221 ® -2.68 ´ 10-14 ,
Cbx$Q221 ® 0., R13 ® 1000., VID ® 1., Simulator ® PSpice<
1.2 Getting Started 21

The numerical representation of the approximated transfer function depending on the Laplace
variable s is now found by applying the numerical design point data to the symbolic transfer
function.
In[21]:= vout741N[s_] = vout741 /. designpoint // Simplify

7.32152 ´ 1022
Out[21]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€
2.90287 ´ 1017 + 1.51745 ´ 1016 s

Another Bode plot shows the PSpice simulation data compared with the approximated numeric
transfer function in the frequency range from 0.1 Hz to 1 MHz.
In[22]:= BodePlot[{vout741PSpice[f], vout741N[2. Pi I f]},
{f, 0.1, 10^6}, ShowLegend −> False]

100
Magnitude (dB)

80
60
40
20
0
1.0E-1 1.0E1 1.0E3 1.0E5
Frequency

0
Phase (deg)

-20
-40
-60
-80

1.0E-1 1.0E1 1.0E3 1.0E5


Frequency

Out[22]= … Graphics …

It is apparent that although the number of terms occuring in the transfer function has been
reduced from almost 1.6 ‰ 1021 to 14 (!), the curves still match perfectly in the frequency range
of interest. Therefore, the approximation is qualified to replace the actual transfer function for
further computations.

Further Processing
From the approximated transfer function we can now extract additional information, such as the
calculation and graphical representation of its poles and zeros.
The poles of the approximated symbolic transfer function can be found by calculating the zeros of
its denominator.
In[23]:= poles1 = Solve[Denominator[vout741] == 0, s] // Simplify

88s ® -HHRo$Q131 + Ro$Q17L Hgm$Q17 R8 Ro$Q4 Rpi$Q17 +


Out[23]=

R9 HRo$Q4 + gm$Q16 gm$Q17 R8 Rpi$Q16 Rpi$Q17LLL 


HC1 gm$Q16 gm$Q17 R9 Ro$Q131 Ro$Q17 Ro$Q4 Rpi$Q16 Rpi$Q17L<<

This single pole of the approximated transfer function corresponds to the dominant pole of the
original transfer function. To achieve its value, we have to insert the given design-point information.
22 1. A Short Introduction

Out[24]= 88s ® -19.1299<<


In[24]:= p1 = poles1 /. designpoint

We now verify the above result by computing the exact pole locations, employing the function
PolesByQZ (Section 3.8.4) on the original equation system.
In[25]:= poles = PolesByQZ[mnaAC741]

8-4.19822 ´ 1010 , -3.02054 ´ 1010 , -3.97873 ´ 107 - 7.96404 ´ 107 ä,


Out[25]=

-3.97873 ´ 107 + 7.96404 ´ 107 ä, -6.47642 ´ 106 ,


-8.33125 ´ 107 + 1.17 ´ 108 ä, -8.33125 ´ 107 - 1.17 ´ 108 ä,
-2.53983 ´ 108 , -2.04133 ´ 108 , -2.02066 ´ 108 , -3.85479 ´ 108 ,
-6.26147 ´ 108 , -8.75148 ´ 108 , -19.507726973459277,
-9.68714 ´ 108 , -1.2364 ´ 109 , -2.15863 ´ 109 - 6.82302 ´ 108 ä,

-9.89724 ´ 109 , -1.58287 ´ 1010 , -1.46898 ´ 1010 <


-2.15863 ´ 109 + 6.82302 ´ 108 ä, -2.63327 ´ 109 , -7.93728 ´ 109 ,

Now we sort the poles in ascending order of their absolute values.


In[26]:= Sort[poles, Abs[#1] < Abs[#2] &]

8-19.507726973459277, -6.47642 ´ 106 ,


Out[26]=

-3.97873 ´ 107 + 7.96404 ´ 107 ä, -3.97873 ´ 107 - 7.96404 ´ 107 ä,


-8.33125 ´ 107 - 1.17 ´ 108 ä, -8.33125 ´ 107 + 1.17 ´ 108 ä,
-2.02066 ´ 108 , -2.04133 ´ 108 , -2.53983 ´ 108 , -3.85479 ´ 108 ,
-6.26147 ´ 108 , -8.75148 ´ 108 , -9.68714 ´ 108 , -1.2364 ´ 109 ,
-2.15863 ´ 109 + 6.82302 ´ 108 ä, -2.15863 ´ 109 - 6.82302 ´ 108 ä,

-1.58287 ´ 1010 , -3.02054 ´ 1010 , -4.19822 ´ 1010 <


-2.63327 ´ 109 , -7.93728 ´ 109 , -9.89724 ´ 109 , -1.46898 ´ 1010 ,

This yields a list, whose first entry represents the equivalent to the numerical solution which was
found before with the help of the approximated transfer function. Since both values match well, this
is another indication that the extracted formula for the pole indeed describes the dominant pole of
the operational amplifier.
For further insights, there are various graphics functions available to visualize the extracted
information, such as the functions RootLocusPlot (Section 3.9.5) or NyquistPlot (Section 3.9.4).
For details please refer to the respective sections.

Conclusion
This example showed the application of Analog Insydes on the analysis of the ΜA741 operational
amplifier for extracting a formula for the corner frequency of the small-signal transfer function. In a
first step we imported the netlist and simulation data files from PSpice, set up the equations in Analog
Insydes and verified the numerical solution. A complexity estimation showed that calculating the
transfer function for the original equation system is not possible, thus we applied an approximation
routine to achieve a simplified equation system. Using this system it was possible to symbolically
calculate its transfer function. Finally, we achieved a symbolic formula describing the pole of the
simplified transfer function and the dominant pole of the original transfer function. An additional
1.2 Getting Started 23

comparison of the numerical pole values showed that indeed the formula represents the dominant
pole. This symbolic formula now provides deeper insight into the corner frequency location.

1.2.4 The Online Help System


Because Analog Insydes is a complex system, it comes with a detailed online documentation: For
quick information, a compact help text is available for each Analog Insydes symbol. This text can be
displayed using the Mathematica ? operator (which is also called Information ). For Analog Insydes
commands, the purpose and function patterns are printed, for Analog Insydes options, the purpose
and possible values are given. For example:
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Get help text for the In[2]:= ?LoadModel


command LoadModel .
LoadModel[name, selector] or LoadModel[{{name1,
selector1}, ...}] loads one or several models from the
model library. LoadModel[name, selector, Scope −>
scope] assigns local or global scope to the loaded
model.
Get help text for the In[3]:= ?Protocol
option Protocol .
Protocol is a global Analog Insydes option used by several
functions. It specifies if and where protocols should
be printed. Option values are StatusLine, Notebook,
All, or None, or a list of these symbols.
For more detailed information, the complete Analog Insydes documentation including tutorial and
appendix is available in the standard Mathematica online help system. Launch the help browser
and select the category Add-ons. In the left column then appears a row labeled Analog Insydes. By
choosing this item you enter the Analog Insydes online documentation. For searching a certain
keyword, select the Master Index category and type the keyword in the Go To: field. One or more
hyperlinks to corresponding sections in the Analog Insydes documentation will then be given.
Note that for the documentation to appear in the help browser, Analog Insydes has to be properly
installed on your system and the help index has to be recalculated. For the latter choose the menu
item Help->Rebuild Help Index.

1.2.5 The Analog Insydes Palette


Analog Insydes provides a palette window which allows you to enter nearly all Analog Insydes
commands by simply pressing a button.
The palette is divided into subgroups which can be opened by clicking on the triangle symbol.
Clicking on a button pastes the corresponding text into your session notebook. Clicking on a button
marked with a blue star pastes a more complex skeleton into your notebook. The status line of the
palette window indicates which skeleton is pasted.
24 1. A Short Introduction

The Analog Insydes palette

By choosing the menu item File->Palettes->AnalogInsydes you launch the Analog Insydes palette
window.
Alternatively, you can find the Analog Insydes palette in the file
aidir/FrontEnd/Palettes/AnalogInsydes.nb
of your Analog Insydes installation. Use the command Info (Section 3.15.6) to obtain the path of
your Analog Insydes installation directory.
1.3 What’s New? 25

1.3 What’s New?


Since the first release in 1998, Analog Insydes has been successfully applied to real-world problems
by our customers. The key algorithms implemented in Analog Insydes – particularly the symbolic
approximation methods – proved to be very effective, but it turned out that improvements regarding
tool functionality, user-friendliness, interfaces, processing speed, and the device model library would
be desirable. After three years of development Analog Insydes version 2 had been released in
2001. Since then the integration of additional platform and circuit design environments were added
successfully to our software, here is the result: Analog Insydes version 2.1. This chapter guides you
through the most noticable enhancements of the new version and the last major release.

1.3.1 New in Version 2.1

New Interfaces for Spectre


Simulation data import
Analog Insydes 2.1 provides a new interface to the Spectre circuit design environment. The Analog
Insydes command ReadSimulationData has been extended for reading Spectre PSF files.
Netlist import via Analog Artist
A platform-independent netlist converter with small-signal data and model-card import functionality
is now available for files generated by the Spectre to Analog Insydes interface for Analog Artist.

Extended Device Model Library


The Analog Insydes device model library was extented to treat Spectre compatible models for R, L,
C, D, BJT, MOS, and JFET.

Full Integration of High-Performance MathLink Binaries on Mac OS X


Analog Insydes 2.1 is now fully compatible with Mac OS X, including native high-performance
MathLink binaries for the QZ algorithm and matrix approximation.

Compatibility to Version 2
Despite the improvements of Analog Insydes version 2.1, it is 100% compatible with Analog Insydes 2.
26 1. A Short Introduction

1.3.2 New in Version 2: An Overview

New Interfaces for Eldo, PSpice, and Saber


Netlist import including small-signal and model-card parameters
Behavioral model writer
Simulation data import and export

New Device Model Library


Eldo and PSpice compatible models for R, L, C, D, BJT, MOS, and JFET
BJT: full Gummel-Poon small-signal and large-signal models
MOS: full Level 1-3 + BSIM3v3 small-signal models, Level 1 large-signal model

Extended Circuit Description and Modeling Language


Model parameter sets, global parameters, multiple source values
Enhanced modeling language for nonlinear dynamic systems

Improved Circuit Equation Setup


Automatic model library search
Automatic design-point extraction for linear and nonlinear circuits
Consistent data handling through DAEObjects

New and Improved Analysis Modes


AC, noise, pole/zero, DC, DC transfer, temperature, transient, parametric, root locus

New and Improved Symbolic Approximation Techniques


New and improved linear approximation techniques for AC and pole/zero analysis
New approximation techniques for nonlinear circuits

Full Integration of High-Performance MathLink Binaries


For symbolic matrix approximation and numerical pole/zero analysis (QZ algorithm)
Multi-platform support (HP-UX, Linux, Solaris, Windows)
1.3 What’s New? 27

Graphics Functions
New and improved graphics functions
Improved command interfaces for a more comfortable use

Improved User Interface


Improved user interface allows for setting up and running circuit analyses from Eldo, PSpice, or
Saber netlists with as few as three Analog Insydes commands

1.3.3 New in Version 2: A More Detailed Description


The most noticeable changes between Analog Insydes versions 1 and 2 were made to the circuit
description and modeling language and to the way circuit equations are set up, stored, and presented
to the user:

Netlist Format
The circuit description language (netlist format) was extended by functionality for managing device
model parameter sets (model cards), global parameter settings, initial conditions, and multiple
source values for different analysis modes (AC, DC, transient). With these enhancements it is now
possible to represent all netlist and device model information contained in a SPICE circuit description
consistently in an Analog Insydes Circuit object.
The netlist fragment shown below illustrates the use of some new language features. Note that
the unspecific arguments of the keywords Model, Selector , and Parameters in the value field
of the device reference Q1 permit an easy selection of device models and parameter sets at run
time using Mathematica’s pattern rewriting functionality. The model expansion mechanism of Analog
Insydes 2 makes use of this approach to automatically select appropriate device models according to
the specified analysis mode.
28 1. A Short Introduction

Analog Insydes 2 netlist amplifier = Circuit[


fragment Netlist[
{V1, {1, 0}, Symbolic −> V1,
Value −> {AC −> 1, DC −> 2.5,
Transient−>SinWave[Time, 2.5, 0.1, 1000]}},
{Q1, {2 −> C, 1 −> B, 3 −> E},
Model−>Model[BJT, NDEF, Q1],
Selector −> Selector[BJT, NDEF, Q1],
Parameters −> Parameters[BJT, NDEF, Q1],
GM$ac −> 0.02, RPI$ac −> 5.0*10^3,       },
   
],
ModelParameters[Name −> NDEF, Type −> NPN,
IS −> 10^−16, BF −> 100, BR −> 1, VAF −> 150],
GlobalParameters[TEMP −> 300, GMIN −> 10^−12]
]

Circuit Equations
In Analog Insydes 1, symbolic circuit equations and corresponding numerical information (design
point, initial conditions, etc.) were not handled in a consistent fashion. To prevent errors due
to potentially inconsistent data and to provide a unified and more user-friendly mechanism for
managing all additional data associated with a system of symbolic circuit equations, the internal
representation of circuit equations was fundamentally changed in version 2. Now, all equation setup
and circuit analysis functionality is centered around a common data structure, the DAEObject.
A DAEObject is generated by means of the command CircuitEquations . It represents a linear
or nonlinear system of differential-algebraic equations (DAE) along with numerical data needed for
numerical analysis or symbolic approximation. In addition, a DAEObject contains information about
the type of equations it represents (AC/DC/transient, MNA/STA) plus a snapshot of all relevant
option settings taken at the point of time when the equations were set up. This data encapsulation
approach ensures the consistency of all data belonging to a particular circuit analysis context and
reduces the number of parameters that need to be passed to functions which operate on circuit
equations.

Interfaces
Analog Insydes 2 provides several new or improved modules for interfacing with commercial circuit
design environments. Platform-independent netlist converters with small-signal data and model-
card import functionality are now available for a variety of widely used circuit simulators, including
Eldo, PSpice, and Saber. Waveforms can be imported from Eldo, PSpice, and Saber data files. Circuit
schematics can be imported into Mathematica via a DXF file converter. Moreover, Analog Insydes 2
features a model writer which is capable of generating behavioral model templates (e.g. Saber MAST)
automatically from a DAEObject.
1.3 What’s New? 29

Modeling Language
As a consequence of the requirements identified during recent work on symbolic modeling and
analysis of nonlinear circuits, the behavioral modeling capabilities for nonlinear dynamic systems
were substantially extended. With the enhanced model description format of Analog Insydes 2, it
is now possible to designate model port nodes as optional, to specify default values for model
parameters as well as initial conditions and guesses for model variables, and to control how design-
point information is generated for symbolic parameters of model equations.

Library Concept
Based on the modeling language extensions described above, a completely new device model library
concept was designed for Analog Insydes 2. Eldo and PSpice compatible models are available for R,
L, C, D, BJT, MOS, and JFET devices. Three model simplification levels can be selected when setting
up circuit equations to control the complexity of symbolic analysis.

Nonlinear Symbolic Analysis


Completely new functionality has been implemented for symbolic analysis and approximation of
nonlinear circuits. Based on a flexible user interface, the approximation routines allow an arbitrary
choice of analysis and error-control functions. In combination with the new model writer, Analog
Insydes 2 can be used for automated generation of nonlinear behavioral models.

Pole/Zero Analysis
Efficient numerical pole/zero and root locus analysis is now supported through two different
generalized eigenvalue problem solvers: an enhanced version of the QZ algorithm and a variant
of the Jacobi orthogonal correction method (JOCM). The introduction of the DAEObject concept
reduces the amount of parameters passed to functions. In addition, a new matrix-based method for
symbolic pole/zero analysis has been implemented. The algorithm simplifies a symbolic generalized
eigenvalue problem with respect to a selected root, using the JOCM for efficient iterative error
tracking.

User Interface
The use of Analog Insydes 2 has been considerably simplified by combining many frequently used
steps in powerful macro commands and providing more default actions. With as few as three
Analog Insydes commands it is possible to set up and run circuit analyses from Eldo, PSpice, or
Saber netlists. In addition, the external binaries (QZ algorithm, matrix approximation) have been
fully integrated into Analog Insydes 2 and can be used transparently like built-in commands.
30 1. A Short Introduction

Multi-Platform Support
Multi-platform support is available for all binaries: One Analog Insydes installation can be accessed
from different platforms. Transparently for the user the correct binaries are automatically chosen.
This allows for installing Analog Insydes on a site-wide file server and simultaneously using it from
different platforms.

1.3.4 Compatibility
To realize the improvements made in version 2 of Analog Insydes, drastic changes on the internal
data format had to be performed, such that we could not keep 100% compatibility with version 1.
As a consequence, version 1 notebooks may not evaluate without errors using Analog Insydes 2.
But fortunately, only some minor changes (like modifying function arguments) are usually sufficient
to evaluate with version 2. These changes are listed below. Note that this also applies to Analog
Insydes 2.1, because it is fully compatible to Analog Insydes 2.

ApproximateMatrixEquation
altered pattern according to ApproximateTransferFunction
former option PrintProtocol now called Protocol , option values changed

CircuitEquations
option DefaultModelLibrary now called ModelLibrary
option DifferentialOperator now called FrequencyVariable
option setting SparseTableauVariant −> Basic | Extended now obtained by
Formulation −> SparseTableau | ExtendedTableau
option setting SymbolicValues −> True | False now obtained by
ElementValues −> Symbolic | Value
option setting TimeDomain −> True | False now obtained by AnalysisMode −> Transient | AC
option UnitValues is obsolete

CSDFRead
former command CSDFRead substituted by new implementation called ReadSimulationData

DXFGraphics
option FillColor now called FillColors , option values modified
options LineThickness , LineAbsoluteThickness , PolylineWidthScale , PrimitivesOut ,
TextOffsetX , TextOffsetY , and TextAlignBottom are obsolete
1.3 What’s New? 31

NDAESolve, NDAESolveDC
former command NDAESolveDC substituted by additional pattern for NDAESolve
option AnalysisMethod now called AnalysisMode
modified values for option Protocol

RootLocusPlot
modified values for options PoleStyle and ZeroStyle

SolveCircuitEquations
former command SolveCircuitEquations substituted by Solve

spice2ai.exe, SpiceToAI, WhereIsSpice2ai


former external executable spice2ai.exe and wrapper function SpiceToAI substituted by new
implementation ReadNetlist
options Spice2aiOptions and Spice2aiPath are obsolete
command WhereIsSpice2ai is obsolete

CheckedCircuit, CheckedNetlist, FlatNetlist


replaced by NetlistObject[Checked | Flat]
Tutorial

2.1 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

2.2 Netlists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

2.3 Circuits and Subcircuits . . . . . . . . . . . . . . . . . . . 48

2.4 Setting up and Solving Circuit Equations . . . . . . . . . . 72

2.5 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

2.6 Modeling and Analysis of Nonlinear Circuits . . . . . . . . 92

2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits . . 106

2.8 Linear Symbolic Approximation . . . . . . . . . . . . . . 130

2.9 Frequency-Domain Analysis of Linear Circuits . . . . . . 145

2.10 Nonlinear Symbolic Approximation . . . . . . . . . . . . 167


34 2. Tutorial

2.1 Preface

2.1.1 How to Read this Tutorial


Whereas Part 3 of this book serves as a reference manual for all Analog Insydes commands,
Part 2 explains dedicated topics of Analog Insydes in a tutorial manner. Although this part is
entitled Tutorial, it is not meant to be read entirely at once by the novice user before working with
Analog Insydes. Rather, each chapter can be read separately to get a more detailed insight into the
corresponding topic. For example, Chapter 2.3 describes how to write your own subcircuits and
models and how to use them during equation setup. However, in the usual application, netlists are
imported automatically using the command ReadNetlist , and equations are set up using predefined
models of the Analog Insydes model library. Thus, in most cases there is no need to write netlists
and models by hand. Nevertheless, you may encounter a task that requires a special hand-written
device model. In this case it is recommended to consult Chapter 2.3 (and perhaps Chapter 2.2 as
well) to learn more about the fine points of Analog Insydes’ modeling capabilities. For the novice
user we recommend to read Chapter 2.4, Chapter 2.5, Chapter 2.7, and Chapter 2.9.

2.1.2 Loading Analog Insydes


The first thing we need to do before we can use any circuit analysis function is to load the Analog
Insydes master package. This file reads in the context AnalogInsydes‘Main‘ which contains all
function definitions for working with netlists. In addition, the master package sets up autoload
declarations for other Analog Insydes functions which are not defined in the Main context.
Loading of Analog Insydes is performed by evaluating the command
<<AnalogInsydes‘

in a Mathematica notebook window.


If this command fails then check if your package directory is on Mathematica’s list of search paths. For this,
evaluate the expression $Path in a Mathematica notebook and inspect the result. If the path to your Analog
Insydes directory is not listed then append it to the list with the command AppendTo[$Path, "your Analog
Insydes path"] and re-execute the above command.
Besides loading the Analog Insydes context and installig autoloaders, the above command additionally
reads several init files which allow for adapting Analog Insydes to your local needs. Section 3.15.1
describes the location of the init files, the loading order, and how to suppress loading of init files.
An init file can for example be used to permanently change default values of options.
Once Analog Insydes is loaded, you can obtain information on your local Analog Insydes installation
using the commands described in Chapter 3.15.
2.2 Netlists 35

2.2 Netlists

2.2.1 The Netlist Format


Analog Insydes provides functions which can automatically set up several types of circuit equations
from the netlist description of a circuit. Netlists are sequences of Mathematica lists encapsulated by
the Analog Insydes command Netlist (Section 3.1.1). There must be one such list, or netlist entry,
for each element in a circuit. Netlist entries are not required to be listed in any particular order.
netlistname =
Netlist[
netlist entry 1,
netlist entry 2,
   
]
A Netlist object is the Analog Insydes data structure for representing flat netlists. For hierarchical
circuit descriptions using subcircuits, the Circuit object is used which is discussed in Chapter 2.3.
For a simple example refer to the voltage divider circuit shown in Figure 2.1.
1

R1

V0 2

R2

Figure 2.1: Voltage divider circuit

An Analog Insydes netlist desribing the circuit looks as follows:


In[1]:= <<AnalogInsydes‘

In[2]:= voltageDivider =
Netlist[
{V0, {1, 0}, 10},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …
36 2. Tutorial

The Netlist command returns a raw netlist object which prints its content in short notation, i.e.
only the number of elements is shown. To get a more detailed view of the netlist content use the
command DisplayForm :

Out[3]//DisplayForm= Netlist HRaw, 3 EntriesL:


In[3]:= DisplayForm[voltageDivider]

8V0, 81, 0<, 10<


8R1, 81, 2<, R1<
8R2, 82, 0<, R2<

The netlist entry format (see Section 3.1.3) bears some remote similarity to that of the well-known and
widely used numerical circuit simulator SPICE in that circuit elements are specified by an individual
name, a list of nodes, and a value. In Analog Insydes, netlist entries must be lists of three fields
which are called the reference designator, the connectivity list, and the value field:
{reference designator, {connectivity list}, value field}
This global scheme describes the only valid syntax for netlist entries – there is no exception to this
format.

Reference Designators
The reference designator is a unique name by which a particular circuit element can be distinguished
from all other elements in the same netlist. Typically, the leading one, two, or three characters of a
reference designator implicitly determine the type of the corresponding element. Hence, V0 denotes
a voltage source (type tag V), R1 and R2 denote resistors (type tag R), and VCCS a voltage-controlled
current source (type tag VC).
There are mechanisms to override automatic type detection from reference designators explicitly but this and
other related advanced topics will be discussed later.
Unlike Mathematica variables, type tags are not case sensitive. Therefore, two circuit elements with
reference designators R1 and r1 are both recognized as resistors. However, the symbols R1 and r1
represent two entirely different elements.

Connectivity Lists and Node Identifiers


The connectivity list specifies the nodes of the circuit to which the terminals of an element are
connected. For that purpose, every node in a circuit must be given a unique name, a node identifier,
by which it can be referenced. While some circuit simulators require the nodes to be enumerated
by consecutive nonnegative integers, Analog Insydes lets you choose node identifiers quite freely.
You do not have to number your nodes consecutively, nor do you need to use numbers as node
identifiers at all. In addition to nonnegative integers, you may also use symbols or strings as node
labels. The only requirement is that the circuit’s ground node must be identified by the label 0
(zero). Internally all node identifiers are converted to strings. Thus, the node identifiers OUT and
"OUT" refer to the same node. Moreover, node identifiers are case sensitive. Thus, OUT and Out refer
to different nodes.
2.2 Netlists 37

1 4 out1

R V1
gm*V1
2 6 out2
Figure 2.2: Resistor and voltage-controlled current source

For a two-terminal element, such as a resistor (Section 4.2.1), the connectivity list must contain
exactly two node identifiers whereas a controlled source, i.e. a four-terminal element, requires four
node identifiers: two for the controlling branch and two for the controlled branch. Netlist entries for
the resistor and the voltage-controlled current source (Section 4.2.13) shown in Figure 2.2 thus have
to be written as follows:
{R1, {1, 2}, R}
{VC2, {4, 6, out1, out2}, gm}

Reference Directions for Currents and Voltages


In Analog Insydes netlists, the order of the nodes in a connectivity list determines the positive
reference direction for both the associated branch voltage and the branch current. In other words,
the reference directions for voltages and currents always have the same orientation.

I$V0

V0

Figure 2.3: Voltage source, reference directions for branch voltage and current

In Figure 2.3, the positive terminal of the voltage source (Section 4.2.10) is connected to node 1,
and the negative terminal is connected to node 2. The corresponding netlist entry then defines the
positive reference direction for the branch voltage as well as for the current I$V0 to be oriented from
node 1 to node 2:
38 2. Tutorial

{V0, {1, 2}, V0}


Hence, a positive value for the branch current, I$V0 > 0, denotes a current flowing from node 1 to
node 2. So whenever a circuit analysis yields a negative result for I$V0 there is nothing wrong. This
just means that the current is in fact flowing into the opposite direction, i.e. from node 2 to node 1.

Element Values
As opposed to SPICE, the values of circuit elements need not be purely numerical quantities. Since
Mathematica is capable of performing mathematical calculations symbolically, the element values may
also be any symbolic or mixed symbolic/numeric expressions. In the voltage-divider example (see
Figure 2.1) we assigned a numerical value of 10 (Volts) to the voltage source whereas we used the
symbolic values R1 and R2 for the two resistors. (Note that you don’t have to specify any units
like Volts for numerical values.) In this case, the symbols used for the values of the resistors are
identical to the reference designators, but we could also have supplied any other valid Mathematica
expression.

R1=R
V0 out

R2=2*R

Figure 2.4: Voltage divider circuit with different node names and resistor values

Let’s make use of some of the facts presented in the preceding paragraphs by renaming node 2 of
the voltage divider to out, arbitrarily making the assignments R1 = R and R2 = 2 × R, and rewriting
the netlist accordingly (see Figure 2.4):
In[4]:= voltageDivider2 =
Netlist[
{V0, {1, 0}, 10},
{R1, {1, out}, R},
{R2, {out, 0}, 2 R}
]
Out[4]= … Netlist@Raw, †3‡D …
2.2 Netlists 39

2.2.2 Circuit Elements

Element Types
Having learned the basics about the netlist format we will now take a look at the circuit element
types (see Chapter 4.2) which are supported by Analog Insydes. The names of all available types
are stored in a globally accessible list named ElementTypes (Section 3.1.5):
In[5]:= ElementTypes

8Resistor, Conductance, Admittance, Impedance, Capacitor,


Out[5]=

Inductor, CurrentSource, VoltageSource, CCCSource, CCVSource,


VCCSource, VCVSource, Nullator, Norator, Fixator, OpAmp, OTAmp,
ABModel, OpenCircuit, ShortCircuit, SignalSource, Amplifier,
Integrator, Differentiator, TransmissionLine, TransferFunction<

To obtain information about the netlist format for a particular circuit element, type ?element. This
will print the corresponding usage message to the screen. For example, let’s find out more about
the elements Capacitor (Section 4.2.5) and VCCSource (Section 4.2.13):
In[6]:= ?Capacitor
Capacitor (type tag "C") denotes a linear capacitor. The
netlist format is {Cname, {N1, N2}, value}. Network
equation setup for capacitors is influenced by the
value field option Pattern.

In[7]:= ?VCCSource
VCCSource (type tag "VC") denotes a linear
voltage−controlled current source. The netlist format
is {VCname, {C1, C2, N1, N2}, value}. Note that the
nodes of the controlling branch, C1 and C2, are listed
before those of the controlled branch, N1 and N2. As
compared to Spice, the order is reversed!
You may have noticed that there are no such elements as diodes, bipolar or MOS transistors contained
in ElementTypes .
Nevertheless, Analog Insydes comes with a predefined library of symbolic semiconductor device models (see
Chapter 4.3), which contains full-precision SPICE-compatible models for the most important devices such as
Diodes, BJTs, MOSFETs, and JFETs.
In addition to the linear electric circuit elements like resistors and capacitors the list of element types
contains six elements from control theory, namely signal sources, amplifiers, integrators, etc. This is
because Analog Insydes is capable of analyzing linear control circuits as well. You can even perform
symbolic analyses of systems which contain both electrical and control components, allowing you to
do behavioral circuit modeling across different levels of abstraction.
40 2. Tutorial

Controlled Sources: Some Caveats


If you have worked with SPICE netlists before you will see some differences in the way you have
to formulate the netlist entries for controlled sources in an Analog Insydes netlist. Apart from the
more meaningful type tags (VV, CC, VC, CV as opposed to E, F, G, H), Analog Insydes uses a uniform
scheme for all four types of controlled sources, i.e. you have to specify two nodes for the controlling
branch and two nodes for the controlled branch for both voltage-controlled and current-controlled
sources.

C1 N1 1 3

I1 r*I1 V1
gm*V1
C2 N2 2 4
Figure 2.5: Current-controlled voltage source (left) and voltage-controlled current source (right)

For the two controlled sources shown in Figure 2.5 the netlist entries must be written as follows.
Note, that the nodes of the controlling branches are listed first.
{CV1, {C1, C2, N1, N2}, r}
{VC2, {1, 2, 3, 4}, gm}
Analog Insydes treats controlled sources as true two-port elements, so every controlled source adds
two electrical branches to a circuit, a controlling and a controlled branch. In the case of current-
controlled sources you have to keep in mind that the controlling branch is nothing else than a short
circuit (Section 4.2.8). Therefore, do not connect the controlling branch of a current-controlled source
in parallel to another circuit element. Instead, always use a series connection of the controlling
branch and the circuit element whose branch current controls the source.
Let’s clarify this important point by writing a netlist for the circuit shown in Figure 2.6. The current-
controlled current source is controlled by the current flowing through the resistor RB. If we wrote
the netlist entry for the CCCS (Section 4.2.11) as
{CC1, {1, 0, 2, 0}, beta}
the controlling branch would be inserted in parallel to RB and thus short-circuit the resistor.
2.2 Netlists 41

CM
1 2

V0 RB RL

IB beta*IB

Figure 2.6: Result of incorrectly inserted current-controlled current source

The correct solution to this problem is to add another node to the circuit and connect the controlling
branch in series with RB as shown in Figure 2.7.

CM
1 2

V0 RB RL
3
IB beta*IB

Figure 2.7: CCCS circuit with correctly inserted controlling branch

We can then write a correct netlist as follows:


In[8]:= cccsCircuit =
Netlist[
{V0, {1, 0}, V0},
{RB, {1, 3}, RB},
{CM, {1, 2}, CM},
{CC1, {3, 0, 2, 0}, beta},
{RL, {2, 0}, RL}
]
Out[8]= … Netlist@Raw, †5‡D …

2.2.3 A Brief Preview on Circuit Analysis


There is much more to learn about netlists, but before going into the details let’s get an impression of
Analog Insydes’ basic symbolic circuit analysis functionality. Computing voltages and currents in a
circuit requires essentially two steps: Setting up a system of circuit equations and then solving these
equations. Circuit equations can be set up automatically by applying the function CircuitEquations
(Section 3.5.1) to a netlist description.
We set up equations for the voltage divider circuit defined in Section 2.2.1 (see Figure 2.1):
42 2. Tutorial

In[9]:= vdeqs = CircuitEquations[voltageDivider]


Out[9]= … DAE@AC, †3 ´ 3‡D …

By default, CircuitEquations sets up a system of modified nodal, or MNA, equations (Modified


Nodal Analysis) in the frequency domain. The return value is a DAEObject which contains the three
components of the linear matrix equation A × x = b, where A is the coefficient matrix, x the vector
of unknown voltages and currents, and b the vector of independent sources. To display the system
of equations in a more readable form we can apply the command DisplayForm to the DAEObject
vdeqs:
In[10]:= DisplayForm[vdeqs]

i €€€€€
j 1zy i V$1 y
Out[10]//DisplayForm=
j
j z
z j z i
j
0 y
z
j
j z
z.j
j
j V$2 zz
z == j
j
j 0 zz
z
1 1

j z
R1€ - €€€€€
R1€

j
j R1 z j
z j z
z j
j z
z
k 1 0{ k { k {
1 1 1
- €€€€€
€ €€€€€
R1 € + €€€€€
R2€ 0
0 I$V0 10

Here, the vector of unknowns comprises the node voltages V$1 and V$2 at nodes 1 and 2, plus the
current I$V0 flowing through the voltage source V0.
We can solve the MNA equations by using the function Solve (Section 3.5.4). Given the system
of equations and no additional arguments, Solve solves for all voltages and currents listed in the
vector of unknowns.
In[11]:= Solve[vdeqs]

Out[11]= 99I$V0 ® - €€€€€€€€€€€€€€€€€€ , V$2 ® €€€€€€€€€€€€€€€€€€ , V$1 ® 10==


10 10 R2
R1 + R2 R1 + R2

The values of V$1 and V$2 correspond to what we would expect from a voltage divider. If you
wonder about the negative sign of I$V0 remember what has been said about positive reference
directions of branch voltages and currents in Section 2.2.1.
As a second example we will compute the node voltage at node 2 of the CCCS circuit (see Figure 2.7)
as a symbolic function of the circuit parameters in the frequency domain.
In[12]:= cccseqs = CircuitEquations[cccsCircuit];
DisplayForm[cccseqs]

i
j y
z
Out[13]//DisplayForm=
j
j z
z i V$1 y i 0 y
j
j z j
j z
z j
j 0 z
z
beta z j z j z
1 1

j -CM s z j z j z
€€€€€
RB€ + CM s -CM s - €€€€€
RB€ 1 0
j
j z
z j
j z
z j
j z
z
j
j z j
z.j
j z
z j
j z
z
j
j z
z j z
z j
j z
z
1
€€€€€
RL€ + CM s 0 0 V$2
j
j 1 z z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
j z j z j z
V$3 == 0
j 0 z j z j z
1 1
- €€€€€
€ €€€€€
RB€
j z
0 0
j z k IC$CC1 { k {
RB
I$V0 V0
k 0 {
1 0 0 0
0
0 0 1 0

The last variable in the vector of unknowns, IC$CC1, denotes the controlling current of the controlled
source CC1 (see Section 2.4.1). We can solve for V$2 by explicitly passing this variable as a second
argument to Solve.

RL Hbeta - CM RB sL V0
In[14]:= Solve[cccseqs, V$2]

Out[14]= 99V$2 ® - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€ ==


RB H1 + CM RL sL
€€€€€€€€€€€€€€€€
2.2 Netlists 43

The result represents the Laplace transform of the zero-state response of the voltage at node 2,
expressed in terms of the complex frequency variable s.
The zero-state response is the response of a system which was in the zero state at the time just prior to the
application of the input signal. Zero state means that all initial conditions, i.e. capacitor voltages and inductor
currents, are zero.

2.2.4 More about Netlists

The General Value-Field Format


As indicated in the previous section, some aspects regarding the netlist format have not yet been
mentioned. So far, we have used only the simplest form of writing netlist entries (see Section 2.2.1).
In general, however, the value field of a netlist entry does not need to be a single Mathematica
expression but may also be a nonempty sequence of options. Netlist entries may thus look like this:
{name, {nodes}, option1 −> value1 , option2 −> value2 ,       }
There are several value-field option keywords which Analog Insydes understands (see Section 3.1.4):
Value, Symbolic , Type, Pattern, InitialCondition , Model (Section 3.2.1), and Subcircuit
(Section 3.2.2). Their meanings will be discussed in the following subsections.

Value
If the value field is written in its general sequence-of-options form then all of its components must be
options. This necessitates an option which specifies the value of the circuit element, namely Value
(see Section 3.1.4). With the Value option we can rewrite a netlist entry such as
{R1, {1, 2}, R1}
in the following semantically equivalent general form:
{R1, {1, 2}, Value −> R1}
Of course, as long as the value field contains no more information than only the element value the
simple form is the preferred form. Note that if the value field is written in option form, then the
Value option must be present.

Symbolic
The Symbolic option (see Section 3.1.4) is closely related to the Value option. It allows you to
specify an alternative symbolic element value in addition to a numerical value given as argument to
the Value option, for instance:
{R1, {1, 2}, Value −> 100, Symbolic −> R1}
By default, circuit equations are set up using the arguments of the Value options as element values,
but CircuitEquations (Section 3.5.1) can be instructed to use the symbolic values instead wherever
44 2. Tutorial

the Symbolic option is given. This allows for assigning both a numerical as well as a symbolic value
to a circuit element. You will be able to assess the value of this feature better once you have learned
more about the topics described in Chapter 2.3 and Chapter 2.8.

Type
The value field option Type (see Section 3.1.4) allows you to specify the type of an element explicitly,
thus overriding the automatic type detection from an element’s reference designator. The argument
to the Type option must be the full name of a circuit element type supported by Analog Insydes
(see Chapter 4.2). The available types are listed in the global variable ElementTypes . Using the
Type option we could write a netlist entry for a resistor in the following way even though the name
Shunt does not begin with the type tag R.
{Shunt, {1, 2}, Type −> Resistor, Value −> R1}
Moreover, as Analog Insydes generates voltage and current identifiers (see Section 2.4.1) by adding
the prefixes "V$" and "I$" to the reference designators, the Type option gives us some more influence
on the names of voltages and currents. In this example, the resistor current would be named
I$Shunt , whereas it would be named I$R1 for the netlist entries from the previous two subsections.
The example below shows a more convincing application of the Type option. Assume that you have
an amplifier circuit with an output load connected between nodes out and ground, and that you
wish to calculate the amplifier’s frequency responses for both resistive and capacitive loads. You
could, of course, write two separate netlists for this purpose. On the other hand, the Type option
offers you the alternative to set up only one single netlist but with a variable load type:
amplifier =
Netlist[
   
{Load, {out, 0}, Type −> loadtype, Value −> loadval},
   
]

Then, by replacing the type variable with a concrete type name, you can set up circuit equations for
a particular type of load, e.g. for a capacitor:
CircuitEquations[
amplifier /. {loadtype −> Capacitor, loadval −> CL}]
Note that in both cases the identifier for the load current will be I$Load, regardless of the load
element type eventually selected.
Finally, the Type option helps us to correct a frequently made mistake, which usually occurs
when a netlist contains a supply voltage source named VCC. If we relied on automatic type
detection from the reference designator VCC, Analog Insydes would give us the error message
"Netlist::numnode: Expected 4 nodes but received 2 for VCCSource VCC". The reason for this
error is that VC is the type tag for voltage-controlled current sources, so Analog Insydes interprets
VCC as (VC)C and not as a voltage source V(CC). This problem can be easily solved by means of the
Type directive:
2.2 Netlists 45

{VCC, {1, 0}, Type −> VoltageSource, Value −> VCC}

Pattern
The Pattern option (see Section 3.1.4) can be used only in conjunction with two-terminal immittances,
i.e. impedance and admittance elements such as resistors (Section 4.2.1), conductances (Section 4.2.2),
capacitors (Section 4.2.5), and inductors (Section 4.2.6). With this directive you can explicitly choose
whether the contribution of an immittance element to a system of modified nodal equations is
entered into the matrix using the fill-in pattern for admittances or the pattern for impedances. The
two associated values of the Pattern option are Impedance and Admittance .
When setting up modified nodal equations, Analog Insydes automatically converts impedance
elements such as resistors into their admittance equivalents in order to keep the matrix size as
small as possible. In other words, a resistor with the value R will be treated as an admittance
with the value 1/R and will be entered into the modified nodal matrix using the fill-in pattern
for admittances (see the example in Section 2.2.3). However, if we are interested in computing the
current through a particular resistor it would be better to use the fill-in pattern for impedances
as this would augment the MNA system by the corresponding branch current. So if we want to
calculate the load current of the above-mentioned amplifier using the MNA formulation we would
have to select the impedance pattern for the load resistor in order to introduce the branch current
I$Load:
{Load, {out, 0}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
Let’s experiment with some value-field options using the CCCS circuit from Section 2.2.2 (see
Figure 2.7). We replace the resistor RL by a variable load type and select the fill-in pattern for
impedances.
In[15]:= cccsCircuit2 =
Netlist[
{V0, {1, 0}, V0},
{RB, {1, 3}, RB},
{CM, {1, 2}, CM},
{CC1, {3, 0, 2, 0}, beta},
{Load, {2, 0}, Type −> loadtype, Value −> loadval,
Pattern −> Impedance}
]
Out[15]= … Netlist@Raw, †5‡D …

We choose a resistive load with the symbolic value RL and set up the MNA equations. Due to the
Pattern directive, the load current I$Load now appears as an additional variable for which we can
solve directly.
46 2. Tutorial

In[16]:= cccseqs2 = CircuitEquations[


cccsCircuit2 /. {loadtype −> Resistor, loadval −> RL}];
DisplayForm[cccseqs2]

i
j 0 yz
Out[17]//DisplayForm=
j
j z i V$1 z
z j y i 0 z
j y
j
j 0 beta 1 zz j
j z
z j
j 0 zz
j z j z
1 1

j z
€€€€€
RB€ + CM s -CM s - €€€€€
RB€
j z j z
1 0
j
j
j z
z j
j z
z j
j z
z
j z j z j z
j 0 zz j
j z
z j
j z
z
-CM s
j z
CM s 0 V$2
j
j z
z j
j z
z j
j z
z
j
j z j
j z
z j
j z
z
0 z j z j z
0
j z
1 1 V$3
j z j z
- €€€€€
€ 0 €€€€€
RB€ 0 1
j
j z
z j z j z
==
j z j z
.
j z
RB

j z j z j z
z j z j z
V0
j 0 z
I$V0
j j z j z
1 0 0 0 0

k RL { k I$Load { k {
0 0 1 0 0 IC$CC1 0
0 -1 0 0 0 0

Hbeta - CM RB sL V0
In[18]:= Solve[cccseqs2, I$Load]

Out[18]= 99I$Load ® - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€


€€€€€€€€€€€€€€€€ ==
RB H1 + CM RL sL

Next, we select a capacitive load CL and solve for the load current again.
In[19]:= cccseqs3 = CircuitEquations[
cccsCircuit2 /. {loadtype −> Capacitor, loadval −> CL}];
DisplayForm[cccseqs3]

i €€€€€
j y
z
Out[20]//DisplayForm=
j
j z
z i V$1 z
j y i 0 z
j y
j
j z
z j
j z
z j
j 0 zz
1 1

j z j z j z
RB€ + CM s -CM s - €€€€€
RB€ 1 0 0
j
j
j
z
z
z j
j z
z j
j z
z
j
j z
z j
j
j V$3 z z
z
j
j
j 0 zz
z
-CM s
j z
CM s 0 0 beta 1
j z j z
V$2
j
j z.j
z j z
z j
j z
z
j
j
j
z
z
z j
j z
z j
j z
z
1 1

j z j z
- €€€€€
€ 0 €€€€€
€ 0 1 0
j
j z j
z j z
z j
j z
z
==
j z
RB RB

j
j z
z j
j
j
z
z
z
j
j
j
z
z
z
I$V0 V0
j z j z j z
1 0 0 0 0 0
j
j z
z k I$Load { k {
IC$CC1 0
k {
0 0 1 0 0 0
-1 1
€€€€€€€€ 0
0 0 0 0 CL s€

CL H-beta + CM RB sL V0
In[21]:= Solve[cccseqs3, I$Load]

Out[21]= 99I$Load ® €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€€€€ ==


HCL + CML RB
€€€€€€€€€€€€€€€€

InitialCondition
With the InitialCondition option (see Section 3.1.4), you can specify initial currents and voltages
for the dynamic elements Inductor (Section 4.2.6) and Capacitor (Section 4.2.5), respectively. If no
initial condition is given explicitly, it will be assumed to be zero (AC analysis) or will be calculated
automatically from the operating-point data (transient analysis).
As an example, we set an initial capacitor voltage of V0 for the netlist entry C1 of the following filter
circuit:
In[22]:= filter =
Netlist[
{V1, {1, 0}, V1},
{R1, {1, 2}, R1},
{C1, {2, 0}, Value −> C1, InitialCondition −> V0}
]
Out[22]= … Netlist@Raw, †3‡D …
2.2 Netlists 47

In[23]:= filtereqs = CircuitEquations[filter,


InitialConditions −> Automatic];
DisplayForm[filtereqs]

i
j €€€€€ 1yz j
Out[24]//DisplayForm=
j
j z
z i V$1 zy i 0 z
j y
j
j z
z j
j
j z
z j
j C1 V0 z
z
z j z
1 1

j z
R1€ - €€€€€
R1€

j
j R1 z j
z j z
z j
j z
z
0 { k I$V1 { k V1 {
==
k 1
- 1
€€€€€
€ 1
€€€€€
€ + C1 s 0 . V$2
R1
0

See Section 2.7.5 for a description of initial condition handling during equation setup.

Model, Subcircuit
The purpose of the Model and Subcircuit directives is to mark a netlist entry as being a reference
to a device model or subcircuit definition. Chapter 2.3 deals with the details.
48 2. Tutorial

2.3 Circuits and Subcircuits

2.3.1 Circuits, Netlists, and Subcircuits

Hierarchical Netlist Entry


The flat netlist representation we used so far is usually sufficient for small analysis tasks with no
more than a handful of circuit elements. Now imagine that we want to analyze active circuits like
the transistor amplifier shown in Figure 3.1, and want to do several transfer function calculations
with different transistor models. It would be rather inconvenient if we had to edit the netlist
every time we select another semiconductor device model. Therefore, Analog Insydes provides a
hierarchical netlist entry scheme which allows us to regard the transistor object as a black box with
three terminals and lets us write a netlist for the circuit containing only a reference to the box but
no specification of what’s inside. Separately from this netlist, we can define one or more concrete
realizations of the box in the form of equivalent (sub)circuits and let Analog Insydes automatically
replace the reference by one of the subcircuit definitions.

RC
R1 3

1 VCC
Q1
4
Vout
V1 R2 RE

Figure 3.1: Common-emitter transistor amplifier

The Circuit Object


When structured hierarchically, a circuit description comprises a top-level netlist with subcircuit or
model references, and a set of subcircuit definitions.
2.3 Circuits and Subcircuits 49

Throughout this text, the terms "subcircuit" and "model" shall be used as synonyms because small-signal
device models are effectively implemented as subcircuits composed of circuit primitives like resistors and
controlled sources.
Keeping all netlist and subcircuit components of a circuit together is the task of the Analog Insydes
data structure Circuit (Section 3.1.2), whose content sequence may be any number of netlist and
subcircuit definitions.
Circuit[
Netlist[top-level netlist with subcircuit references],
Model[subcircuit/model definition],
   
Model[subcircuit/model definition]
]
A Circuit object additionally may contain model parameters and global parameters, see
ModelParameters (Section 3.1.10) and GlobalParameters (Section 3.1.11).
When a Circuit object is defined, it is printed in short notation only. To view the entire circuit
structure use the command DisplayForm .

2.3.2 Defining Subcircuits and Device Models

The Model Object


Let’s start to work with hierarchically structured netlists by learning how to define subcircuits using
the Analog Insydes objects Model (Section 3.2.1) or Subcircuit (Section 3.2.2). This section describes
how to write netlist-based models or subcircuits. Section 2.6.2 shows how to write equation-based
models.
Model and Subcircuit are semantically equivalent symbols. In fact, Subcircuit is just an alias name
for Model. You may want to use both names in a Circuit if you wish to give visual cues as to which
subcircuits represent device models by using the Model directive for these and the Subcircuit object for all
other subcircuits.
The Model object takes several arguments which must all be written in Mathematica’s option syntax
keyword −> value. Four of the arguments must always be present whereas the remaining ones are
optional or have default values. Below, the optional arguments are printed in slanted typewriter
font. For now, we will restrict ourselves to the discussion of the required arguments. The optional
ones will be introduced later in a step-by-step fashion, as this will help you to better understand
why and when they are needed.
50 2. Tutorial

Model[
Name −> subcircuit class name,
Selector −> selector,
Scope −> scope,
Ports −> {port nodes},
Parameters −> {parameters},
Defaults −> {defaults},
Translation −> {parameter translation rules},
Definition −> Netlist[subcircuit netlist]
]
The value of the Name argument must be a symbol which identifies an entire group, or class, of
different subcircuit implementations of a non-primitive object, such as a transistor. The value of the
Selector argument, which must also be a symbol, then selects one particular member from this
class. The Ports argument defines the port nodes of a subcircuit structure. Its value must be a list
of the identifiers of the subcircuit nodes which serve as external connection points.
Finally, the netlist of the subcircuit must be specified by means of the Definition argument. There
is no built-in limit for the nesting depth of subcircuits, so the netlist may itself contain references
to other Model definitions. However, you may only reference but not define subcircuits within
subcircuits.

Small-Signal Transistor Models


To fully understand this abstract description of the Model function, let’s examine a practical example.
Assume that we want to calculate the AC voltage transfer function of the common-emitter amplifier
from Section 2.3.1 (see Figure 3.1) and want to replace the transistor by either one of the two
small-signal equivalent circuits shown in Figure 3.2.
2.3 Circuits and Subcircuits 51

E
CM
B C B C
IB IB
X X
R0
RB RB
beta*IB beta*IB
E E E E
Figure 3.2: Different transistor small-signal models: simple (left), dynamic (right)

Both circuits have in common that they represent the same object, namely an NPN transistor. Thus,
they are two members of a subcircuit class we shall name NPNTransistor :
Name −> NPNTransistor

Within this class, each member must have a unique selector by which it can be identified. We will
denote the simple small-signal model on the left-hand side of Figure 3.2 by
Selector −> ACsimple

and the one on the right-hand side by


Selector −> ACdynamic

From now on we will adopt the notation name/selector for denoting a subcircuit definition. For
instance, we will refer to the model defined with Name −> NPNTransistor and Selector −> ACsimple
as NPNTransistor/ACsimple . Both subcircuits contain four nodes: B, C, E, and X, where B, C, and E
represent the transistor’s base, collector, and emitter terminal respectively. The node X is an internal
subcircuit node which is needed for properly connecting the controlling branch of the current-
controlled current source in series with the base resistor RB (see also Section 2.2.2). Therefore, we
declare only B, C, and E as port nodes of the subcircuits in order to make X invisible from the outside:
Ports −> {"B", "C", "E"}
Note that we use strings to denote the port nodes instead of symbols. Although this requires some
more typing this is the recommended way for specifying nodes: If we would have used symbols
in the above example, the symbol for the emitter node E could have been mixed up with the
Mathematica symbol E which denotes the exponential constant e.
52 2. Tutorial

Connections to subcircuits can only be made through designated port nodes. Any attempt to interface
directly with an internal node will cause the generation of an error message when the netlist hierarchy
is flattened. However, there is one exception: since the ground node (0) is considered to be global,
elements in subcircuit definitions may be connected directly with global ground without the need
to specify 0 as a port node. In fact, 0 cannot be used as port node identifier in Analog Insydes.
Finally, all which remains to do is to write the netlists of the two subcircuits and set up the Model
definitions as follows:
Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Ports −> {"B", "C", "E"},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CC, {"B", "X", "C", "E"}, beta}
]
]

Model[
Name −> NPNTransistor,
Selector −> ACdynamic,
Ports −> {"B", "C", "E"},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CM, {"B", "C"}, CM},
{CC, {"B", "X", "C", "E"}, beta},
{RO, {"C", "E"}, RO}
]
]
In this example, we used node names for all subcircuit nodes given by strings ("B", "C", "E", "X") but
we could have used positive integers just as well. However, using symbolic names is usually preferable. The
reason is that during subcircuit expansion all internal nodes of subcircuit objects will be instantiated and
labeled with unique identifiers such as X$Q1, which are automatically generated from the node names and the
reference designator of the subcircuit instance. If an internal node identifier is an integer, e.g. 2, the generated
instance identifier 2$Q1 could be confused easily with the product 2*$Q1.

2.3.3 Referencing Subcircuits

The Netlist Entry Format for Subcircuit References


Subcircuits or device models defined with the Model command can be referenced from a netlist on a
higher hierarchy level by a netlist entry whose value field contains the options Model and Selector :
2.3 Circuits and Subcircuits 53

{subcircuit instance name, {port connections},


Model −> subcircuit class name, Selector −> selector}
To reference a subcircuit object (see Section 3.1.8) the subcircuit class name and the selector must
be the same identifiers as those given as arguments to the Name and Selector parameters in the
corresponding Model statement. The subcircuit instance name may be any symbol or string which can
serve as the unique identifier of this instance of the subcircuit object.
You can even use subcircuit instance names which begin with an element type tag known to Analog Insydes.
A subcircuit reference with an instance identifier such as RX will never be confused with a resistor because
the reference will have been expanded before circuit equations are set up.
A netlist entry which marks a reference to an instance of the NPN transistor model
NPNTransistor/ACsimple , using the instance identifier Q1, would be written as follows:
{Q1, {connectivity},
Model −> NPNTransistor, Selector −> ACsimple}
This line does not yet specify how the instance Q1 of NPNTransistor/ACsimple should be embedded
into the surrounding circuit structure, i.e. which nodes of the latter should be connected to the
subcircuit’s port nodes. Associating external nodes with subcircuit port nodes is done by means of
a special format of the connectivity field. All entries of this field must be written as rules of the form
external node −> subcircuit port node
In our common-emitter amplifier (see Figure 3.1 in Section 2.3.1), node 1 of the top-level netlist is
connected to the base node "B" of the transistor, node 3 to the collector node "C", and node 4 to the
emitter node "E", resulting in a node-to-port mapping such as this:
{Q1, {1 −> "B", 3 −> "C", 4 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple}
Since the mapping is defined by names, the relative positions of the entries in the connectivity field
are not important. We could have written the connectivity field as
{3 −> "C", 1 −> "B", 4 −> "E"}
equally well.

A Hierarchical Netlist Description of the Amplifier


Having learned how to define and how to make references to subcircuits (see Section 3.1.8), we can
now write a hierarchically structured netlist for the common-emitter amplifier from Section 2.3.1 (see
Figure 3.1).
In[1]:= <<AnalogInsydes‘
54 2. Tutorial

In[2]:= commonEmitterAmplifier=
Circuit[
Netlist[
{V1, {1, 0}, inputVoltage},
{VCC, {2, 0}, Type −> VoltageSource,
Value −> supplyVoltage},
{R1, {2, 1}, R1},
{R2, {1, 0}, R2},
{RC, {2, 3}, RC},
{RE, {4, 0}, RE},
{Q1, {1 −> "B", 3 −> "C", 4 −> "E"},
Model −> NPNTransistor, Selector −> BJTModel}
],

Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Ports −> {"B", "C", "E"},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CC, {"B", "X", "C", "E"}, beta}
]
],

Model[
Name −> NPNTransistor,
Selector −> ACdynamic,
Ports −> {"B", "C", "E"},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CM, {"B", "C"}, CM},
{CC, {"B", "X", "C", "E"}, beta},
{RO, {"C", "E"}, RO}
]
]
]
Out[2]= … Circuit …

Note that in the top-level netlist of this circuit description we used a generic subcircuit selector
BJTModel and not ACsimple or ACdynamic . This allows us to select the model at run time by
replacing BJTModel with ACsimple or ACdynamic just before the subcircuit hierarchy is expanded.
In addition, for reasons which will become apparent in the next section, we have used the variables
inputVoltage and supplyVoltage to denote the values of the voltage sources V1 and VCC.
Remember that the Type directive in the value field of VCC prevents Analog Insydes from falsely interpreting
the netlist entry as belonging to a voltage-controlled current source.
2.3 Circuits and Subcircuits 55

2.3.4 Subcircuit Expansion

The ExpandSubcircuits Command


Before we can set up circuit equations we must resolve all references to subcircuit objects. Subcircuit
instantiation and flattening the netlist is done by the command ExpandSubcircuits (Section 3.4.1)
which accepts a Circuit (Section 3.1.2) or a Netlist (Section 3.1.1) object as argument and returns
a flat netlist object.Such a flat netlist is similar to a Netlist, except that it is guaranteed to contain
only circuit primitives and no subcircuit references.
Please note that subcircuit expansion is taken care of automatically by CircuitEquations, so that there is
usually no need to call ExpandSubcircuits explicitly, except for inserting models into the global data base.
Section 2.3.6 deals with this topic.
We can now use ExpandSubcircuits to generate one flat netlist of the common-emmitter amplifier
from Section 2.3.1 (see Figure 3.1) for each of the two transistor models we have defined. As the
circuit description is still generic we must first personalize it by replacing its variables according to
the specific analysis task. Our task was to calculate the small-signal voltage transfer function, so
besides choosing an appropriate transistor model we must set the value of the supply voltage source
VCC to zero and the value of the input signal source to 1 (see Section 2.9.2). Then, the node voltage
at the output node 3 will be identical to the transfer function. We apply these variable settings to the
netlist with the Mathematica command ReplaceAll (or /. in short notation) and pass the resulting
netlist to ExpandSubcircuits .
In[3]:= flatAmpSimple = ExpandSubcircuits[
commonEmitterAmplifier /.
{supplyVoltage −> 0, inputVoltage −> 1,
BJTModel −> ACsimple}];
DisplayForm[flatAmpSimple]

Netlist HFlat, 8 EntriesL:


Out[4]//DisplayForm=

8V1, 81, 0<, 1<


8VCC, 82, 0<, Type ® VoltageSource, Value ® 0<
8R1, 82, 1<, R1<
8R2, 81, 0<, R2<
8RC, 82, 3<, RC<
8RE, 84, 0<, RE<
8RB$Q1, 8X$Q1, 4<, RB<
8CC$Q1, 81, X$Q1, 3, 4<, beta<
56 2. Tutorial

In[5]:= flatAmpDyn = ExpandSubcircuits[


commonEmitterAmplifier /.
{supplyVoltage −> 0, inputVoltage −> 1,
BJTModel −> ACdynamic}];
DisplayForm[flatAmpDyn]

Netlist HFlat, 10 EntriesL:


Out[6]//DisplayForm=

8V1, 81, 0<, 1<


8VCC, 82, 0<, Type ® VoltageSource, Value ® 0<
8R1, 82, 1<, R1<
8R2, 81, 0<, R2<
8RC, 82, 3<, RC<
8RE, 84, 0<, RE<
8RB$Q1, 8X$Q1, 4<, RB<
8CM$Q1, 81, 3<, CM<
8CC$Q1, 81, X$Q1, 3, 4<, beta<
8RO$Q1, 83, 4<, RO<

As we can see from the flattened netlists, ExpandSubcircuits has not simply replaced the subcircuit
references by the original netlists from the Model definitions. The function has also generated
unique symbols for all internal reference designators and node identifiers in the subcircuit netlists by
appending a separator character ($) and the subcircuit instance name (Q1) to the original identifiers.
This eliminates possible name conflicts with reference designators from the top-level netlist and
allows for using multiple instances of a subcircuit definition.

Analysis of the Common-Emitter Amplifier


Now we can analyze the circuit by means of the functions CircuitEquations (Section 3.5.1) and
Solve (Section 3.5.4). We start by setting up the modified nodal equations for the simple AC model
from the flattened netlist. Note that we could call CircuitEquations on the Circuit object equally
well. We used ExpandSubcircuits for demonstrating the subcircuit expansion mechanism.
2.3 Circuits and Subcircuits 57

In[7]:= eqAmpSimple = CircuitEquations[flatAmpSimple];


DisplayForm[eqAmpSimple]

i €€€€€
j y
z
Out[8]//DisplayForm=
j
j z
z
j
j z
z
1 1 1

j z
R1€ + €€€€€
R2€ - €€€€€
R1€ 0 0 0 1 0 1
j
j
j
z
z
z
j
j z
j beta z
z
1 1 1 1
- €€€€€
R1€ €€€€€
R1€ + €€€€€
RC€ - €€€€€
RC€ 0 0 0 1 0
j
j
j
z
z
z
j
j z
j -beta z
z
1 1
- €€€€€
RC€ €€€€€
RC€
j z
0 0 0 0 0
j
j z
z
j
j
j
z
z
-1 z
1 1 1

j z
0 0 0 €€€€€
RB€ + €€€€€
RE€ - €€€€€
RB€ 0 0
j z
.
j
j z
z
j
j
j 0 z z
z
1 1
- €€€€€
RB€ €€€€€
RB€
j z
0 0 0 0 0
j
j z
j
j
j 0 z z
z
z
1 0 0 0 0 0 0
j z
k 0 {
0 1 0 0 0 0 0
1 0 0 0 -1 0 0

i
j y
z i
j
0y
z
j
j z
z j
j 0zz
j
j z
z j
j z
z
V$1
j
j z
z j
j z
j
j
j
z
z
z
j
j
j 0zz
z
z
V$2
j
j
j
z
z
z
j
j
j
z
z
z
j
j z
z j
j z
z
V$3
j
j
j
z
z
z
j
j
j
z
z
z
j
j z
z j
j z
z
V$4 0
j
j z
z j
j z
1z
==
j
j I$V1 z z j
j z
z
j z j z
V$X$Q1 0
j
j z
z j
j z
z
j
j z
z j
j z
j
j z
z j z
j z
z
k IC$CC$Q1 { k0{
I$VCC 0

To compute the small-signal voltage transfer function we must solve the MNA equations for the
node voltage V$3 at the output node 3.
In[9]:= v3 = Solve[eqAmpSimple, V$3]

Out[9]= 99V$3 ® - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€


€€€€€€€€€€ ==
beta RC
RB + RE + beta RE

The following command extracts the symbolic transfer function expression from the return value of
Solve.
In[10]:= vtf = V$3 /. First[v3]
beta RC
Out[10]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€
RB + RE + beta RE

Now, let’s see what happens when we make the (usually realistic) assumption that the transistor
current gain is very large:
In[11]:= Limit[vtf, beta −> Infinity]
RC
Out[11]= - €€€€€€€
RE

The above result is indeed identical to the well-known approximate formula for the voltage gain of
a common-emitter amplifier. Doing the same calculations for the other transistor model shall be left
to the reader as an exercise.
58 2. Tutorial

2.3.5 Subcircuit Parameters

Instantiating Element Values in Subcircuit Definitions


Although reference designators and internal node identifiers in subcircuit netlists are always uniquely
instantiated we still have to cope with one difficulty that arises when working with multiple
references to the same model definition. Consider the following small-signal equivalent circuit of a
Darlington amplifier (see Figure 3.3) for which we shall have to compute the overall current gain as
a function of the individual current gains of the two transistors Q1 and Q2. The gain can be obtained
by calculating the output response to a unit current I1 = 1 applied at the input.

1
Q1 Iload
I1 Q2
3 RL

Figure 3.3: Darlington amplifier (small-signal equivalent circuit)

Let’s decide to use the transistor model NPNTransistor/ACsimple from Section 2.3.2 (see Figure 3.2)
for both transistors. We would then write the circuit description and expand the model references
as follows.
Remember that the Pattern option in the value field of the netlist entry Load causes the current through the
load resistor to be introduced into the modified nodal equations, allowing us to compute the current directly.
Alternatively, we could have inserted a short circuit in between RL and node 2 for measuring the current.
2.3 Circuits and Subcircuits 59

In[12]:= Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
],

Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Ports −> {"B", "C", "E"},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CC, {"B", "X", "C", "E"}, beta}
]
]
] // ExpandSubcircuits // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[12]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 8X$Q1, 3<, RB<
8CC$Q1, 81, X$Q1, 2, 3<, beta<
8RB$Q2, 8X$Q2, 0<, RB<
8CC$Q2, 83, X$Q2, 2, 0<, beta<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

While ExpandSubcircuits (Section 3.4.1) has generated unique identifiers for the base resistor RB
and the current-controlled current source CC for each instance of the transistor model, it has not
made any changes to the associated symbolic element values RB and beta. Obviously, these have
been regarded as global symbols, resulting in identical base resistances and current gains of both
transistors. This is certainly not the result we wanted because the individual current gains of
the transistors in a Darlington stage may be quite different. Instead, ExpandSubcircuits should
instantiate the element values as well, and thus generate the symbols RB$Q1, RB$Q2, beta$Q1, and
beta$Q2 for the two resistors and the two current gains respectively.
The reason behind the unwanted behavior exhibited here is that ExpandSubcircuits has not been
explicitly instructed to treat RB and beta as what they really are, namely as parameters of the model.
We can solve this problem by adding the parameter declaration
Parameters −> {RB, beta}
to our Model definition, which instructs ExpandSubcircuits to replace all occurrences of these
symbols in the value fields of the subcircuit netlist by different identifiers for each subcircuit
instance.
60 2. Tutorial

In[13]:= darlington =
Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
],

Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Ports −> {"B", "C", "E"},
Parameters −> {RB, beta},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CC, {"B", "X", "C", "E"}, beta}
]
]
]
Out[13]= … Circuit …

In[14]:= ExpandSubcircuits[darlington] // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[14]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 8X$Q1, 3<, RB$Q1<
8CC$Q1, 81, X$Q1, 2, 3<, beta$Q1<
8RB$Q2, 8X$Q2, 0<, RB$Q2<
8CC$Q2, 83, X$Q2, 2, 0<, beta$Q2<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

After having been defined as parameters, the base resistances and current gains appear properly
instantiated in the flat netlist. We can now complete our analysis of the Darlington amplifier by
solving the MNA equations for the load current I$Load.
2.3 Circuits and Subcircuits 61

In[15]:= eqDarlington = CircuitEquations[darlington];


DisplayForm[eqDarlington]

i
j
0 y
z
Out[16]//DisplayForm=
j
j
j beta$Q1 beta$Q2 -1 z
z
z
j z
0 0 0 0 0 1 0
j
j
j
z
z
j
j 0 zz
z
0 0 0 0 0
j
j
j
z
z
z
j
j z
z
1 1

j 0 z
0 0 €€€€€€€€ €€€€ - €€€€€€€€ €€€€ 0 -beta$Q1 1
j
j z
z
RB$Q1 RB$Q1

j
j
j
z
z
z
j 0 z
1 1
- €€€€€€€€
€ €€€ €€€€€€€€
€ €€€ -1
j z
0 0 0 0
j
j z
z
RB$Q1 RB$Q1 .
j
j
j
z
z
j 0 zz
1
€€€€€€€€
€€€€ -1
j z
0 0 0 0 0
j
j z
z
RB$Q2

j
j
j 0 zz
z
-1
j0 0 z
1 0 0 0 0 0

k0 1 RL {
1 0 -1 0 0
0 0 0 0 0

i
j y
z i
j
1y
z
j
j
j
z
z
z
j
j
j 0zz
z
j z j z
V$1
j
j
j
z
z
z
j
j
j
z
z
z
j
j z
z j
j z
z
V$2
j
j z
z j
j z
j
j
j V$X$Q1 zz
z
j
j
j 0zz
z
z
V$3 0
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j z j z
==
j
j
j
z
z
z
j
j
j
z
z
z
V$X$Q2 0
j
j z
z j
j z
j
j z
z j
j 0zz
j j z
IC$CC$Q2 z j z
IC$CC$Q1 0
j z z
k I$Load { k0{

In[17]:= Solve[eqDarlington, I$Load]

88I$Load ® beta$Q1 + beta$Q2 + beta$Q1 beta$Q2<<


Out[17]=

For large current gains beta$Q1 and beta$Q2, the contribution of the product beta$Q1 × beta$Q2
dominates this sum, resulting in the known current-gain formula for a Darlington stage. Later,
in Chapter 2.8, we will learn how to let Analog Insydes extract such dominant contributions
automatically in order to provide compact and interpretable symbolic analysis results.

A Remark on Local and Global Symbols


Critical reading of the preceding text may give rise to the following question: Why are identifiers
of internal nodes always instantiated even though they are not explicitly declared as local symbols
while symbolic element values are assumed to be global symbols unless they are explicitly declared
as parameters? The logic behind this behavior is that it hardly makes sense to regard any internal
node identifier in a generic subcircuit definition as a global symbol – except for rare cases in which
the global ground node is involved. Whenever we need to connect a subcircuit to a global node
we must make the connection via a port node. Otherwise, from the point of view of the subcircuit
definition, we would have to exploit bottom-up knowledge about the set of node names in the
top-level netlist, either to be sure that a certain global node is present or in order to prevent name
clashes. Consequently, the only reasonable option is that all nodes which are not ports must be local,
hence they are instantiated individually.
On the other hand, there are some applications where the element values of multiple subcircuit
instances are supposed to be identical, for example in repetitive circuit structures like RLC ladder
networks. If the element values in the subcircuit definition were generally treated as local parameters
then, after subcircuit expansion, we would have to go through the tedium of manually assigning the
62 2. Tutorial

same global symbols to all instances of the corresponding subcircuit element values. This would not
be very convenient as it would require typing something along the line of R$X1 = R$X2 = R$X3 =       =
R for every group of identical elements. By explicitly declaring which symbols in a subcircuit denote
parameters and quietly assuming all others to be global quantities, cases like that of the Darlington
amplifier as well as that of the ladder circuit are both dealt with most easily. However, Analog
Insydes provides the command MatchSymbols which applies matching information on a DAEObject.
Thus, you can decide which parameters to match even after setting up the equation system.

Passing Parameter Values to Subcircuit Instances


Though intentional and useful, the automatic instantiation of symbolic subcircuit parameters is only
a side effect of the parameter declaration. The original purpose of the Parameters argument in a
Model definition is to declare the set of local model variables which can be replaced by instance-
specific values given in the value fields of subcircuit references (see Section 3.1.8). In other words,
we can pass parameter values to a subcircuit in a similar way as we can pass arguments to a function
defined in Mathematica. Since we do not have to specify values for model parameters, automatic
instantiation comes into effect whenever a default value is needed for a parameter which has not
been assigned a value.
If we need to pass parameter values to instances of subcircuit objects we must append a sequence
of replacement rules of the form
parameter symbol −> value
to the value field of the corresponding subcircuit references. The full netlist format of a subcircuit
reference is thus
{subcircuit instance name, {port connections},
Model −> subcircuit class name, Selector −> selector,
parameter1 −> value1 , parameter2 −> value2 ,       }
To illustrate the possible cases consider the netlist of the Darlington amplifier from Section 2.3.5 (see
Figure 3.3) once again. Let’s assign the symbolic value RB1 and a numerical value of 150 to the
parameters RB and beta of Q1, respectively. In the case of Q2, we assign the symbol beta2 to the
current gain whereas we leave the parameter RB unspecified.
2.3 Circuits and Subcircuits 63

In[18]:= Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple,
RB −> RB1, beta −> 150},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple,
beta −> beta2},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
],

Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Ports −> {"B", "C", "E"},
Parameters −> {RB, beta},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CC, {"B", "X", "C", "E"}, beta}
]
]
] // ExpandSubcircuits // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[18]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 8X$Q1, 3<, RB1<
8CC$Q1, 81, X$Q1, 2, 3<, 150<
8RB$Q2, 8X$Q2, 0<, RB$Q2<
8CC$Q2, 83, X$Q2, 2, 0<, beta2<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

During subcircuit expansion, the model parameters have now been replaced by the values from the
top-level netlist. As we did not assign a value to the base resistor of Q2, the automatic instantiation
mechanism has created the symbol RB$Q2 in order to provide a default value for RB.

2.3.6 The Scope Argument

Local and Global Subcircuit Definitions


In all the preceding examples, the top-level netlist is immediately followed by the definitions of
the subcircuits referenced from within the netlist. These subcircuit definitions are local and volatile
because they are neither visible outside the scope of the enclosing Circuit statement nor do they
"survive" subcircuit expansion. When doing multiple circuit analyses with a number of frequently
used device models it would be rather tedious if we always had to include all potentially selected
models in the circuit description together with the top-level netlist. Therefore, we have the option to
make any subcircuit definition permanent and accessible from within other netlists by providing an
64 2. Tutorial

appropriate Scope argument (see Section 3.2.1). Scope has two possible values, Local and Global.
To make a subcircuit available globally, we need to set the scope as follows:
Scope −> Global

By expanding a circuit which contains only model definitions with global scope we can implement a
globally accessible model library in our current Mathematica environment. For example, let’s set up
a model library from the two NPN transistor models NPNTransistor/ACsimple and
NPNTransistor/ACdynamic from Section 2.3.2 (see Figure 3.2).
In[19]:= Circuit[
Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Scope −> Global,
Ports −> {"B", "C", "E"},
Parameters −> {RB, beta},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CC, {"B", "X", "C", "E"}, beta}
]
],

Model[
Name −> NPNTransistor,
Selector −> ACdynamic,
Scope −> Global,
Ports −> {"B", "C", "E"},
Parameters −> {RB, CM, beta, RO},
Definition −>
Netlist[
{RB, {"X", "E"}, RB},
{CM, {"B", "C"}, CM},
{CC, {"B", "X", "C", "E"}, beta},
{RO, {"C", "E"}, RO}
]
]
] // ExpandSubcircuits;
Both models are now stored in the global subcircuit database and can thus be referenced by any other
netlist. Note that simply defining the models is not sufficient for storing them in the global database –
we have to call ExpandSubcircuits in order to store them into the global database. If the Circuit
object contains a top-level Netlist , a call to CircuitEquations stores the models in the global
database, too. We can check the contents of the database using the command GlobalSubcircuits
(Section 3.3.4), which will return a list of the names and selectors of the global subcircuits.
In[20]:= GlobalSubcircuits[]

88NPNTransistor, ACdynamic<, 8NPNTransistor, ACsimple<<


Out[20]=

The global definition of the transistor models allows us to write the circuit description of the
Darlington amplifier from Section 2.3.5 (see Figure 3.3) without the Model commands. Then, during
subcircuit expansion, the global database will be searched for models which are not defined locally.
2.3 Circuits and Subcircuits 65

In[21]:= darlWithoutModels =
Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple,
RB −> RB1, beta −> 150},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple,
beta −> beta2},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
]
];
In[22]:= ExpandSubcircuits[darlWithoutModels] // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[22]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 8X$Q1, 3<, RB1<
8CC$Q1, 81, X$Q1, 2, 3<, 150<
8RB$Q2, 8X$Q2, 0<, RB$Q2<
8CC$Q2, 83, X$Q2, 2, 0<, beta2<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

Redefining and Removing Global Subcircuits


If ExpandSubcircuits or CircuitEquations is called on a Circuit object containing a global model
definition, any previously stored model in the global database with the same Name and Selector
arguments is replaced by the new one. To remove a particular subcircuit from the global database
we can use the command RemoveSubcircuit (Section 3.3.8). Its arguments must be the name and
the selector of the subcircuit definition to be deleted. The return value is a list of the names and
selectors of the remaining subcircuit definitions. For example, let’s remove the transistor model
NPNTransistor/ACdynamic . The only remaining model is then NPNTransistor/ACsimple :

Out[23]= 88NPNTransistor, ACsimple<<


In[23]:= RemoveSubcircuit[NPNTransistor, ACdynamic]

Locally Overriding Global Subcircuit Definitions


One further application of the Scope argument is that we can locally override a global subcircuit
definition. Local subcircuits always take precedence over global definitions with the same name and
selector without overwriting the global definition. To illustrate this, let’s temporarily replace the
NPNTransistor/ACsimple model with the subcircuit shown in Figure 3.4. The difference between
the original implementation of NPNTransistor/ACsimple and this model is that the latter contains a
voltage-controlled current source VCCS (Section 4.2.13) instead of a current-controlled current source
CCCS (Section 4.2.11).
66 2. Tutorial

B C

RB
gm*VBE
E E
Figure 3.4: Transistor model with voltage-controlled current source

Although the global subcircuit database still contains a definition of NPNTransistor/ACsimple we


can safely use the same name and selector for a local subcircuit without changing the global defi-
nition, provided we specify Scope −> Local. Upon subcircuit expansion, Analog Insydes first looks
for a local subcircuit with the requested name and selector. The global definition is retrieved only if
no matching local definition is present.
In[24]:= darlWithLocalModel =
Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACsimple},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
],

Model[
Name −> NPNTransistor,
Selector −> ACsimple,
Scope −> Local,
Ports −> {"B", "C", "E"},
Parameters −> {RB, gm},
Definition −>
Netlist[
{RB, {"B", "E"}, RB},
{VC, {"B", "E", "C", "E"}, gm}
]
]
];
Now, ExpandSubcircuits will use the local definition of NPNTransistor/ACsimple . The global
definition has not been altered, as we can see by expanding the netlist of the Darlington amplifier
from Section 2.3.5 (see Figure 3.3) without models again.
2.3 Circuits and Subcircuits 67

In[25]:= ExpandSubcircuits[darlWithLocalModel] // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[25]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 81, 3<, RB$Q1<
8VC$Q1, 81, 3, 2, 3<, gm$Q1<
8RB$Q2, 83, 0<, RB$Q2<
8VC$Q2, 83, 0, 2, 0<, gm$Q2<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

In[26]:= ExpandSubcircuits[darlWithoutModels] // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[26]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 8X$Q1, 3<, RB1<
8CC$Q1, 81, X$Q1, 2, 3<, 150<
8RB$Q2, 8X$Q2, 0<, RB$Q2<
8CC$Q2, 83, X$Q2, 2, 0<, beta2<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

2.3.7 The Translation Argument

Implicit Translation of Parameter Values


Another argument of the Model function which remains to be discussed is the Translation keyword.
We can use it to define functional relations between formal subcircuit parameters and internal element
values when there is no one-to-one correspondence between both. The syntax is:
Translation −> {symbol1 −> value1 , symbol2 −> value2 ,       }
The purpose of the Translation argument is best explained by an example. Assume that we wish
to analyze the Darlington amplifier from Section 2.3.5 (see Figure 3.3) using the VCCS transistor
model from Section 2.3.6 (see Figure 3.4) instead of a CCCS model. For nodal analysis, the former is
usually a better choice than the latter because the VCCS model does not increase the matrix size by
introducing additional controlling currents into the modified nodal equations. However, even with
a VCCS model we might like to describe the transistors in terms of their current gains beta instead
of their transconductances gm by making use of the well-known relation gm = beta/RB. With the
help of the Translation argument we can define a translation rule which maps the formal model
parameters RB and beta to the transconductance gm used internally as the element value of the
VCCS:
68 2. Tutorial

In[27]:= Circuit[
Model[
Name −> NPNTransistor,
Selector −> ACgm,
Scope −> Global,
Ports −> {"B", "C", "E"},
Parameters −> {RB, beta},
Translation −> {gm −> beta / RB},
Definition −>
Netlist[
{RB, {"B", "E"}, RB},
{VC, {"B", "E", "C", "E"}, gm}
]
]
] // ExpandSubcircuits;

In[28]:= darlNumParams =
Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACgm,
RB −> 400.0, beta −> 150.0},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACgm,
RB −> 100.0, beta −> 50.0},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
]
];
Just before subcircuit expansion the right-hand sides of the translation rules are evaluated with
the parameter values specified in the value fields of the subcircuit references. The evaluated
parameter translation rules are then applied to all value fields in the subcircuit netlist, resulting
in the replacement of all symbols appearing on the left-hand side of the translations. Thus, gm is
automatically calculated from RB and beta.
In[29]:= ExpandSubcircuits[darlNumParams] // DisplayForm

Netlist HFlat, 6 EntriesL:


Out[29]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 81, 3<, 400.<
8VC$Q1, 81, 3, 2, 3<, 0.375<
8RB$Q2, 83, 0<, 100.<
8VC$Q2, 83, 0, 2, 0<, 0.5<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<

Delayed Translation Rules


In this simple example, using the Translation argument is not absolutely necessary. We could have
achieved the same effect without a translation rule by writing the netlist entry for the VCCS like
this:
2.3 Circuits and Subcircuits 69

{VC, {"B", "E", "C", "E"}, beta / RB}


So why should we use translation rules at all? The answer is that parameter value translations can
also be specified by means of delayed rules, i.e. the RuleDelayed lhs :> rhs instead of the Rule
lhs −> rhs. Since delayed rules are left unevaluated until the very moment they are needed, their
right-hand sides also contain calls to external functions which perform calculations depending on
the model parameter values. For instance, let’s define a function which, given values for beta and
RB, calculates the transconductance of a transistor by solving the formula gm × RB = beta numerically
for gm, using gm = 1.0 as initial guess.
In[30]:= Transconductance[b_Real, r_Real] :=
Module[ {g},
Print["Computing gm for beta = ", b, " and RB = ", r];
g /. FindRoot[g * r == b, {g, 1.0}]
]
By means of a delayed translation rule for gm we can instruct Mathematica not to execute the function
call at the time the transistor model is defined but to wait until the rule is used to compute gm for a
particular subcircuit instance.
In[31]:= Circuit[
Model[
Name −> NPNTransistor,
Selector −> ACgm,
Scope −> Global,
Ports −> {"B", "C", "E"},
Parameters −> {RB, beta},
Translation −> {gm :> Transconductance[beta, RB]},
Definition −>
Netlist[
{RB, {"B", "E"}, RB},
{VC, {"B", "E", "C", "E"}, gm}
]
]
] // ExpandSubcircuits;
If we had used an immediate rule above, gm −> Transconductance[beta, RB], Mathematica would
have already called Transconductance with the symbolic arguments beta and RB at the time
of model definition. On the other hand, the delayed rule permits Analog Insydes to replace the
arguments with instance-specific values before making the function call. This is done once per
subcircuit instance as can be seen from the following output:
In[32]:= ExpandSubcircuits[darlNumParams] // DisplayForm
Computing gm for beta = 150. and RB = 400.
Computing gm for beta = 50. and RB = 100.

Netlist HFlat, 6 EntriesL:


Out[32]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 81, 3<, 400.<
8VC$Q1, 81, 3, 2, 3<, 0.375<
8RB$Q2, 83, 0<, 100.<
8VC$Q2, 83, 0, 2, 0<, 0.5<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<
70 2. Tutorial

An advanced application of such a parameter translation scheme would be the calculation of transistor small-
signal parameters from given operating-point voltages and currents via a set of predefined device equations.

Alternative Ways to Assign Values to Parameters


In combination with the Parameters setting there is one further useful application of the argument
Translation . Specifying a translation rule for a symbol which is also designated as a parameter of
the same subcircuit definition allows us to choose whether we let the instance value of the symbol be
calculated from other parameters or whether we assign a value to this symbol directly. For example,
let’s add the transconductance gm to the list of model parameters while leaving the translation rule
for gm unchanged:
   
Parameters −> {RB, beta, gm},
Translation −> {gm :> Transconductance[beta, RB]},
   

The value field of a reference to the transistor model can now be written in two alternative ways.
Just as in the previous subsection we can assign values to RB and beta only and let Analog Insydes
calculate gm from the two quantities automatically. Alternatively, we can bypass the translation rule
by directly assigning a value to gm, such as gm −> 0.5. Any value given for beta is then effectively
ignored because it is not needed anywhere else than in the argument list of the translation rule. In
the netlist below, we let gm$Q1 be computed from RB and beta by means of the translation rule. In
the case of Q2, however, we do not specify a value for beta but make a direct assignment to gm:
gm −> gm2. Therefore, the parameter translation function Transconductance is not called for gm$Q2:
2.3 Circuits and Subcircuits 71

In[33]:= Circuit[
Netlist[
{I1, {0, 1}, 1},
{Q1, {1 −> "B", 2 −> "C", 3 −> "E"},
Model −> NPNTransistor, Selector −> ACgm,
RB −> 400.0, beta −> 150.0},
{Q2, {3 −> "B", 2 −> "C", 0 −> "E"},
Model −> NPNTransistor, Selector −> ACgm,
RB −> 100.0, gm −> gm2},
{Load, {0, 2}, Type −> Resistor, Value −> RL,
Pattern −> Impedance}
],

Model[
Name −> NPNTransistor,
Selector −> ACgm,
Scope −> Global,
Ports −> {"B", "C", "E"},
Parameters −> {RB, beta, gm},
Translation −> {gm :> Transconductance[beta, RB]},
Definition −>
Netlist[
{RB, {"B", "E"}, RB},
{VC, {"B", "E", "C", "E"}, gm}
]
]
] // ExpandSubcircuits // DisplayForm
Computing gm for beta = 150. and RB = 400.

Netlist HFlat, 6 EntriesL:


Out[33]//DisplayForm=

8I1, 80, 1<, 1<


8RB$Q1, 81, 3<, 400.<
8VC$Q1, 81, 3, 2, 3<, 0.375<
8RB$Q2, 83, 0<, 100.<
8VC$Q2, 83, 0, 2, 0<, gm2<
8Load, 80, 2<, Type ® Resistor, Value ® RL, Pattern ® Impedance<
72 2. Tutorial

2.4 Setting up and Solving Circuit Equations

2.4.1 Naming Conventions

Automatically Generated Voltage and Current Identifiers


From the small circuit analysis examples already presented in the previous chapters you will have
noticed that Analog Insydes automatically creates variables for voltages and currents when setting
up circuit equations from a netlist. In order to interpret the equations correctly you need to know
everything about the identifier naming scheme employed by Analog Insydes.
By default, identifiers for branch voltages and currents associated with two-terminal elements are
generated by attaching the prefixes V$ and I$ to the reference designator (Section 3.1.3) of the
corresponding circuit element, respectively. For instance, the branch voltage across and branch
current through a resistor R1 would be named V$R1 and I$R1.
Similarly, identifiers for node voltages are generated by prefixing the node names with the tag V$,
so the node voltage at node 1 would be named V$1. Although the prefix is used for branch voltages
you will not experience any name clashes among branch and node voltage identifiers, provided that
your netlists do not contain any symbolic node identifiers (Section 3.1.3) which are identical to some
reference designators. However, if you would rather like different prefixes to be used for branch
and node voltages then read the following sections to learn how to change the standard settings.
In the case of a controlled source we need to distinguish between the voltages and currents at the
controlling and at the controlled branch. While the latter quantities are given names according to the
same convention as applied to two-terminal elements, controlling voltages and currents are marked
with the prefixes VC$ and IC$. For example, the voltage across and current through the controlled
branch of a controlled source VC1 would be called V$VC1 and I$VC1 whereas the corresponding
quantities at the controlling branch would be called VC$VC1 and IC$VC1.

Changing the Default Identifier Prefixes


All identifier prefix settings can be customized by changing the corresponding option. The current
option settings can be displayed using the command Options[CircuitEquations] and can be
changed using the Mathematica command SetOptions . For instance, the command
SetOptions[CircuitEquations, BranchVoltagePrefix −> "E$"]
would change the prefix used for branch voltages from V$ to E$. The names of the prefix options
and their default settings are listed below.
NodeVoltagePrefix −> "V$"
BranchVoltagePrefix −> "V$"
BranchCurrentPrefix −> "I$"
ControllingVoltagePrefix −> "VC$"
ControllingCurrentPrefix −> "IC$"
2.4 Setting up and Solving Circuit Equations 73

The values of all these options must be strings which can be converted to a single symbol by means
of the command ToExpression . Strings such as "V_" or "@I" cannot be converted to valid symbols
and may therefore not be used for this purpose.

Changing the Instance Name Separator for Reference Designators


Related to the identifier prefix options is the option InstanceNameSeparator (Section 3.14.2). This
option determines the character (or string) which Analog Insydes uses to separate name components
of reference designators generated for instantiated subcircuit elements. With the default setting
InstanceNameSeparator −> "$"
a resistor RB in a subcircuit instance Q1 would be named RB$Q1. Using SetOptions you can change
the separator character to (almost) anything you like, with the same restrictions that apply to the
choice of the prefix options.

2.4.2 Circuit Equations

The Command CircuitEquations


Setting up systems of symbolic circuit equations is done by the Analog Insydes command
CircuitEquations (Section 3.5.1), which takes a Netlist or Circuit object as first argument. In
addition, the function may be called with a variety of options – to be introduced later – with which
many aspects of equation setup can be influenced individually:
CircuitEquations[circuit, options]
If the type of the netlist argument is not a flat netlist, then the function ExpandSubcircuits
(Section 3.4.1) is automatically applied to the circuit description in order to produce a flat netlist
object before proceeding with equation setup.
This section describes how to set up equations of linear circuits in the Laplace domain.
CircuitEquations can also be used to set up DC or transient equations for nonlinear circuits. This
topic is discussed in Section 2.6.4.

1
RA 2
L1 3

V0 C1 C2 RB

Figure 4.1: RLC filter circuit


74 2. Tutorial

To illustrate equation setup let’s write down the netlist of the RLC filter circuit displayed in Figure 4.1.
In[1]:= <<AnalogInsydes‘

In[2]:= rlcfilter =
Netlist[
{V0, {1, 0}, V0},
{RA, {1, 2}, RA},
{C1, {2, 0}, C1},
{L1, {2, 3}, L1},
{C2, {3, 0}, C2},
{RB, {3, 0}, RB}
]
Out[2]= … Netlist@Raw, †6‡D …

By default, CircuitEquations sets up a system of modified nodal (MNA) equations in the frequency
domain, or, more precisely, the Laplace domain. In the Laplace domain, all linear dynamic elements
are described by frequency-dependent complex admittances or impedances, obtained by Laplace-
transforming the corresponding constitutive equations. For instance, a linear capacitance C with a
constitutive equation i(t) = C × du(t)/dt is represented by its complex admittance s × C, where s denotes
the complex Laplace frequency.
Unless specified otherwise (see netlist option Pattern in Section 3.1.4), all impedances, i.e. resistors
and inductors, are automatically converted to their admittance equivalents. Therefore, the complex
impedance s × L of an inductor L will be treated as an admittance with the reciprocal value 1/(s × L).
In[3]:= rlceqs = CircuitEquations[rlcfilter]
Out[3]= … DAE@AC, †4 ´ 4‡D …

The return value of CircuitEquations is a DAEObject which contains the three components of
the linear matrix equation A × x = b, where A is the MNA matrix, x the vector of unknown node
voltages and impedance branch currents, and b the vector of independent source voltages and source
currents. To display the system of equations in a more readable form we can apply the command
DisplayForm to the DAEObject rlceqs:
In[4]:= DisplayForm[rlceqs]

i €€€€€
j 1yz
Out[4]//DisplayForm=
j
j z
z i V$1 z
j y i 0 z
j y
j
j z j V$2 z j 0 z
0z j z j z
1 1

j - €€€€€ z j z j z
RA€ - €€€€€
RA€ 0
j
j z
z j
j z
z j
j z
z
j
j
j
z
z
z j
j z
z j
j z
z
j z j
j V$3 zz j
j z
z
1 1 1 1
RA€ €€€€€
RA€ + €€€€€€€€
L1 s€ + C1 s - €€€€€€€€
L1 s€
j
j z
z j z j z
==
j z k I$V0 {
.
k V0 {
0
k 1 0{
1 1 1
0 - €€€€€€€€
L1 s€ €€€€€
RB € + €€€€€€€€
L1 s € + C2 s 0
0 0

Solving Circuit Equations


Systems of circuit equations generated by Analog Insydes can be solved symbolically by means of
the command Solve (Section 3.5.4). The sequence of arguments may have one of the following three
forms, depending on which variable or set of variables the equations should be solved for:
Solve[dae]
Solve[dae, var]
Solve[dae, {var1 , var2 ,       }]
2.4 Setting up and Solving Circuit Equations 75

If Solve is called with a DAEObject only and no second argument is given then the solutions for
all variables contained in the vector x are computed. If, in addition to the DAEObject, one single
variable of x is specified as second argument then only this variable is solved for. To compute the
solutions for a subset of x containing more than only one variable, the second argument must be a
list of the variables of interest.
Solve finds all solutions of an equation system only for linear equations. For nonlinear (dynamic)
equations it is in general not possible to find symbolic solutions. Thus, Analog Insydes provides the
command NDAESolve (Section 3.7.5) to compute the solution of nonlinear DAE systems numerically.
See Chapter 2.7 for details.
Just like Mathematica’s built-in Solve function, Solve[dae] returns a list of rules
{{var −> solution, † † † }} which associate the variables with the corresponding solutions. Individual
solutions can be extracted from the list by using Mathematica’s ReplaceAll operator (or /. in short
notation).
Let’s solve the MNA equations of the RLC filter for the node voltages at nodes 1 and 3. Since we
are only interested in solving for two out of all four variables, we must use the third calling format:
In[5]:= rlcsol = Solve[rlceqs, {V$1, V$3}]

88V$3 ® HRB V0L  HRA + RB + L1 s + C1 RA RB s + C2 RA RB s +


Out[5]=

C1 L1 RA s2 + C2 L1 RB s2 + C1 C2 L1 RA RB s3 L, V$1 ® V0<<

As indicated above, we can retrieve the solution for a particular variable using the /.-operator. The
following input line serves to extract the value of V$3. The Mathematica command First removes the
outer level of list brackets from the set of solutions, so the result is returned as a single expression
and not as a list.
In[6]:= rlcv3 = V$3 /. First[rlcsol]

HRB V0L  HRA + RB + L1 s + C1 RA RB s +


Out[6]=

C2 RA RB s + C1 L1 RA s2 + C2 L1 RB s2 + C1 C2 L1 RA RB s3 L

Quite frequently, the raw solutions computed from symbolic circuit equations are not presented in an
immediately comprehensible form. It usually takes some additional mathematical postprocessing to
transform the results into something which is easier to read or technically more meaningful. Mathe-
matica provides several commands for rearranging expressions, such as Simplify, Factor, Together,
Apart, or Collect. The choice of which function to use depends heavily on the particular application,
and often some experimenting is required until the results are satisfactory.
For example, in the case of the above expression for V$3, we may want to combine all coefficients
belonging to the same power of s into one single coefficient each. For this purpose, we apply a
rewrite rule to all Plus subexpressions (i.e. sums) which groups the terms by corresponding powers
of s and then pulls out the si . This yields a transfer function with coefficients in the canonical
sum-of-products form.

Out[7]= HRB V0L  HRA + RB + HL1 + C1 RA RB + C2 RA RBL s +


In[7]:= rlcv3 /. p_Plus :> Collect[p, s]

HC1 L1 RA + C2 L1 RBL s2 + C1 C2 L1 RA RB s3 L
76 2. Tutorial

2.4.3 Circuit Equation Formulations

Modified Nodal Analysis


The modified nodal analysis method (MNA) has already been introduced as the default formulation
by which Analog Insydes sets up circuit equations. The MNA formulation is general, yields
relatively compact systems of equations, and is easy to implement on a computer. These and a
few other favorable properties have made it the most widely used analysis method in electrical
circuit simulators, including Analog Insydes.
There are a number of user-settable options which have an influence on the way Analog Insydes
sets up MNA equations. You have already encountered the netlist option Pattern which specifies
explicitly whether to use the impedance or admittance fill-in pattern for an immittance element, i.e.
a two-terminal admittance or impedance. This option allows, for instance, to prevent the implicit
conversion of an impedance to an admittance, thereby augmenting the MNA system by the branch
current of the impedance. However, the Pattern option pertains only to the element in whose
value field it is given. To prevent implicit impedance conversion globally you can set the value
of the CircuitEquations option ConvertImmittances to False, either permanently by modifying
Options[CircuitEquations] using the SetOptions directive, or temporarily by passing the option
ConvertImmittances −> False to the function CircuitEquations :
In[8]:= CircuitEquations[rlcfilter,
ConvertImmittances −> False] // DisplayForm

i
j
0 y i V$1 y
z j z i
j
0 y
z
Out[8]//DisplayForm=
j
j
j 0 zz j
j z
z j
j 0 zz
j z
z j
j z
z j
j z
z
0 0 0 1 1 0
j
j z
z j
j z
z j
j z
j
j
j 1 zz
z j
j
j V$3 zz
z j
j
j 0 zz
z
z
0 C1 s 0 0 -1 1 V$2
j
j z
z j
j z
z j
j z
z
j
j
j 0 zz j
j z
z j
j z
z
z j z j z
0 0 C2 s 0 0 -1
j
j z
z j
j z
z j
j z
z
j
j
j 0 zz j
j z
z j
j z
z
z j z j z
1 0 0 0 0 0 . I$V0 == V0
j
j z
z j
j z
z j
j z
j
j
j 0 0 L1 s 0 zz
z j
j
j z
I$L1 z
z j
j
j 0 zz
z
z
-1 1 0 0 RA 0 I$RA 0
j z j z j z
k 0 RB { k I$RB { k 0 {
0 -1 1
0 -1 0 0 0

The Formulation Option


With modified nodal analysis being the default analysis method there is usually no need to request
this formulation explicitly. However, if you have changed the default settings in
Options[CircuitEquations] or if you wish to use one of the analysis methods to be discussed in
the following subsections you need to specify the formulation as an option to CircuitEquations .
The option keyword is Formulation , and the option value can be either
ModifiedNodal, SparseTableau , or ExtendedTableau . Hence, modified nodal analysis can be
explicitly selected by this command:
2.4 Setting up and Solving Circuit Equations 77

In[9]:= CircuitEquations[rlcfilter,
Formulation −> ModifiedNodal] // DisplayForm

i €€€€€
j 1yz
Out[9]//DisplayForm=
j
j z
z i V$1 z
j y i 0 z
j y
j
j z j z j 0 z
0z j z j z
1 1

j z j z j z
RA€ - €€€€€
RA€ 0
j
j z
z j
j z
z j
j z
z
j
j
j z
z j
j z
z j
j z
z
j z
z j
j V$3 zz j
j z
z
1 1 1 1
- €€€€€
RA€ €€€€€
RA€ + €€€€€€€€
L1 s€ + C1 s - €€€€€€€€
L1 s€ V$2
j
j z
z j z j z
==
j z k I$V0 {
.
k V0 {
0
k 1 0{
1 1 1
0 - €€€€€€€€
L1 s€ €€€€€
RB € + €€€€€€€€
L1 s € + C2 s 0
0 0

Sparse Tableau Analysis: The Basic Formulation


In addition to nodal analysis, Analog Insydes also offers the possibility to set up circuit equations
according to two variants of the sparse tableau formulation (STA). For an electrical network containing
n electrical branches, the basic variant of the sparse tableau comprises the n topological node and
loop equations resulting from Kirchhoff’s voltage law (KVL) and current law (KCL), plus the n
voltage-current relations of the circuit elements. Hence, the basic sparse tableau forms the following
2n ‰ 2n matrix equation in terms of the branch voltages v and the branch currents i.

ij B 0 zy v ij 0 yz
jjj zzz jjj zzz
jj K
zz i O jj 0 zz
k { ks{
0 A =
Y Z

Here, A denotes the nodal incidence matrix of the network graph and B a loop incidence matrix of
maximum rank. B is derived automatically from A by an algorithm which searches for a tree in the
network graph and then extracts the fundamental loop matrix defined by that tree. The matrices Y
and Z in the third row of the tableau represent the coefficient matrices of the element relations. On
the right-hand side, s denotes the contribution of the independent sources. All remaining tableau
entries are structurally zero (0).
78 2. Tutorial

In[10]:= CircuitEquations[rlcfilter,
Formulation −> SparseTableau] // DisplayForm

i
j
0 y i V$V0 y
z j z
Out[10]//DisplayForm=
j
j 0 z
z j
j V$RA z
z
j
j z
z j
j z
z
-1 1 1 0 0 0 0 0 0 0 0
j
j z
z j
j z
z
j
j
j 0 z
z
z
j
j
j
z
z
z
-1 1 0 1 1 0 0 0 0 0 0
j
j z
z j
j z
z
j
j
j 0 z
z
z
j
j
j
z
z
z
-1 1 0 1 0 1 0 0 0 0 0 V$C1
j
j z
z j
j z
j
j 0
j
z
0 z
z
j
j
j V$C2 z
z
z
z
0 0 0 0 0 0 1 1 0 0 0 V$L1
j
j z
z j
j z
z
j
j 1 z
z j
j z
z
j z j z
0 0 0 0 0 0 -1 1 1 0
j
j z
z j
j z
z
j
j 0 z
z j
j z
z
j z j z
0 0 0 0 0 0 0 0 0 -1 1 V$RB
j
j z
z j
j z
z
. ==
j
j z
0 z j
j z
I$RA z
j z j
z z
1 0 0 0 0 0 0 0 0 0 0 I$V0
j
j j z
j
j
j 0 z
z
z
z
j
j
j
j I$C1 z
z
z
z
0 -1 0 0 0 0 0 RA 0 0 0
j
j z
z j
j z
z
j
j 0 z
z j
j z
z
0 0 -1
j z j z
0 0 C1 s 0 0 0 0 0
j
j z j z
j
j -1 0 z
z
z
j
j z
z
j I$C2 z
z j
-1
j 0 z
0 0 0 0 0 0 0 0 L1 s 0 I$L1

k 0 0 RB { k I$RB {
0 0 0 C2 s 0 0 0 0 0
0 0 0 0 -1 0 0 0 0

i
j
0 y
z
j
j
j 0 zz
z
j
j
j
z
z
j
j
j 0 zz
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j z
0
j
j z
j
j
j 0 zz
z
z
0
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j z
V0
j
j
j
z
z
j
j 0 zz
z
0
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j z
0

k 0 {
0

Sparse Tableau Analysis: The Extended Formulation


Analog Insydes also supports an extended sparse tableau formulation in which the vector of
unknowns comprises the branch voltages v, the branch currents i, and the node voltages vn .
With I denoting an identity matrix of rank n and AT the transpose of the nodal incidence matrix A,
Kirchhoff’s voltage law is expressed indirectly in terms of the node voltages as I × v - AT × vn = 0.
Therefore, the extended sparse tableau formulation does not require the calculation of a loop matrix,
though at the expense of a larger matrix size than that of the basic variant:

ij I 0 -A yz ij v yz ij 0 yz
jjj zj z j z
jj 0 A 0 zzzz jjjj I zzzz = jjjj 0 zzzz
T

kY Z 0 { k vn { k s {

The extended variant is selected by the option setting Formulation −> ExtendedTableau :
2.4 Setting up and Solving Circuit Equations 79

In[11]:= rlcstaext = CircuitEquations[rlcfilter,


Formulation −> ExtendedTableau];
DisplayForm[rlcstaext]

i
j
0 y
z
Out[12]//DisplayForm=
j
j
j 0 zz
j z
z
1 0 0 0 0 0 0 0 0 0 0 0 -1 0
j
j z
j
j
j 0 -1 0 zz
z
z
0 1 0 0 0 0 0 0 0 0 0 0 -1 1
j
j z
j
j
j 0 -1 1 zz
z
z
0 0 1 0 0 0 0 0 0 0 0 0
j
j z
j
j
j 0 -1 z
z
z
z
0 0 0 1 0 0 0 0 0 0 0 0
j
j z
j
j0 0
j 0 -1 z
z
z
z
0 0 0 0 1 0 0 0 0 0 0 0 0
j
j z
j
j
j 0 zz
z
z
0 0 0 1 0 0 0 0 0 0 0
j
j z
j
j
j 0 zz
z
z
0 0 0 0 0 0 1 1 0 0 0 0 0 0
j
j z
j
j0 0
j 0 zz
z
z
0 0 0 0 0 0 0 -1 1 1 0 0 0 0 .
j
j z
j
j 0 zz
z
-1
j z
0 0 0 0 0 0 0 1 1 0 0
j
j z
j
j
j 0 zz
z
z
1 0 0 0 0 0 0 0 0 0 0 0 0 0
j
j z
j
j 0 0 C1 s 0 0 zz
z
-1
j z
0 0 0 0 0 0 RA 0 0 0 0 0 0
j
j z
j
j 0 zz
z
0 0 -1
j z
0 0 0 0 0 0 0
j
j z
j
j 0 zz
z
-1
j z
0 0 0 0 0 0 0 0 L1 s 0 0 0 0

k0 0 0 {
0 0 0 0 C2 s 0 0 0 0 0 -1 0 0 0
0 0 0 -1 0 0 0 0 0 RB 0 0

i
j
V$V0 y
z i
j
0 y
z
j
j V$RA z
z j
j 0 zz
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
V$C1 0
j
j z
z j
j z
z
j
j z
V$C2 z j
j z
z
j z j z
V$L1 0
j
j z
z j
j z
z
j
j z
z j
j z
z
j z j z
0
j
j z
z j
j z
j
j
j z
I$V0 z
z j
j
j 0 zz
z
z
V$RB 0
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
I$RA == 0
j
j z
z j
j z
j
j z
j I$L1 z
z j
j
j V0 z
z
z
z
I$C1 0
j
j z
z j
j z
z
j
j z
z j
j z
z
j
j z
z j
j z
z
j z
j I$RB z
z j
j z
z
j
j z j
j z
z
I$C2 0
j
j z
z j
j z
j
j V$1 z
j z
z j
j
j 0 zz
z
z
0
j
j z
z j
j z
z
j
j z
z j
j z
z
j z j z
k V$3 { k 0 {
V$2 0

Of course, the solution for a particular quantity in a circuit does not depend on the type of equations
from which the solution is computed. So the value for V$3 obtained by an extended sparse tableau
analysis is identical to the one computed by modified nodal analysis:
In[13]:= V$3 /. First[Solve[rlcstaext, V$3]]
Out[13]=

RA RB - HRA - L1 s H-1 - C1 RA sLL HRB - L1 s H-1 - C2 RB sLL


L1 RB s V0
- €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€
80 2. Tutorial

2.4.4 Additional Options for CircuitEquations


All Analog Insydes options which have an influence on circuit equation setup by the function
CircuitEquations can be accessed through Options[CircuitEquations] . The current option
settings can be inspected by retrieving the value of this variable:
In[14]:= Options[CircuitEquations]

8AnalysisMode ® AC, BranchCurrentPrefix ® I$,


Out[14]=

BranchVoltagePrefix ® V$, ControllingCurrentPrefix ® IC$,


ControllingVoltagePrefix ® VC$, ConvertImmittances ® True,
DefaultSelector ® Automatic, DesignPoint ® Automatic,
ElementValues ® Value, Formulation ® ModifiedNodal,
FrequencyVariable ® s, IgnoreMissingGround ® False,
IndependentVariable ® Automatic, InitialConditions ® None,
InitialGuess ® Automatic, InitialTime ® 0,
InstanceNameSeparator ® Inherited@AnalogInsydesD,
LibraryPath ® Inherited@AnalogInsydesD, MatrixEquation ® True,
ModelLibrary ® Inherited@AnalogInsydesD, ModeValues ® None,
NodeVoltagePrefix ® V$, Protocol ® Inherited@AnalogInsydesD,
Symbolic ® All, TimeVariable ® t, Value ® None<

Some of these options are discussed in more detail below.

AnalysisMode
CircuitEquations sets up circuit equations for the analysis modes AC, DC, and transient. Which
mode to use is determined by the option AnalysisMode , whose value is one of the symbols AC, DC,
and Transient . The default value is AC. Up to now, we used CircuitEquations to create small-
signal equations. Section 2.6.4 describes how to set up DC equations and Section 2.7.1 describes how
to set up transient equations.

MatrixEquation
Using the option MatrixEquation −> False, we can force CircuitEquations not to use a matrix
representation when setting up small-signal circuit equations but to return a list of scalar equations
instead.
In[15]:= CircuitEquations[rlcfilter,
MatrixEquation −> False] // DisplayForm
Out[15]//DisplayForm=
99I$V0 + €€€€€€€€€€€€€€€€
V$1 - V$2 -V$1 + V$2 V$2 - V$3
€€€€€€€€ == 0, C1 s V$2 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ + €€€€€€€€€€€€€€€€
€€€€€€€€ == 0,
RA RA L1 s
V$3 -V$2 + V$3
€€€€€€€€€€ + C2 s V$3 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0, V$1 == V0=,
8V$1, V$2, V$3, I$V0<, DesignPoint ® 8<=
RB L1 s

When the matrix representation is turned off, the value returned by CircuitEquations is a
DAEObject containing the circuit equations as a list of two elements, the first being the system of
circuit equations and the second the vector of unknowns. The advantage of the scalar representation
is that it consumes less memory than the matrix representation because Mathematica does not have
2.4 Setting up and Solving Circuit Equations 81

a special storage mechanism for sparse matrices. Nevertheless, some commands (e.g. ACAnalysis )
rely on the fact that the equation system is formulated in matrix representation.

FrequencyVariable
The option FrequencyVariable −> symbol specifies the symbol which Analog Insydes uses to denote
the differential operator, i.e. the complex frequency, in the Laplace domain. By default, this is the
symbol s, but if you prefer to use another symbol for this purpose, for instance p, you can replace
s by p as follows:
In[16]:= CircuitEquations[rlcfilter,
FrequencyVariable −> p] // DisplayForm

i €€€€€
j 1y
z
Out[16]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0 y
z
j z j
j 0z j V$2 zz j
j 0 zz
1 1

j z
RA€ - €€€€€
RA€ 0
j
j z
z j
j z
z j
j z
z
j
j z
z j
j
j
z
z
z j
j
j z
z
z
j 0
j z
z j z j z
1 1 1 1
- €€€€€
RA€ €€€€€€€€
L1 p€ + C1 p + €€€€€
RA€ - €€€€€€€€
L1 p€
j
j z
0z j
j z
z j
j z
z
j z
. ==
j z k I$V0 { k {
1 1 1 V$3 0
k 1 0{
- €€€€€€€€
L1 p€ €€€€€€€€
L1 p€ + C2 p + €€€€€
RB€
V0
0 0

ElementValues
With ElementValues −> Symbolic we can instruct CircuitEquations to use the symbolic values
from the value fields of netlist entries in which a Symbolic option is given. To demonstrate the effect
of this option let’s make some enhancements to the netlist of the RLC filter circuit from Section 2.4.2
(see Figure 4.1). Using the extended value-field format (see Section 3.1.4) we specify a numerical as
well as a symbolic value for the circuit elements.
In[17]:= rlcfilter2 =
Netlist[
{V0, {1, 0}, Value −> V0, Symbolic −> V0},
{RA, {1, 2}, Value −> 1000., Symbolic −> RA},
{C1, {2, 0}, Value −> 4.7*10^−6, Symbolic −> C1},
{L1, {2, 3}, Value −> 1.0*10^−3, Symbolic −> L1},
{C2, {3, 0}, Value −> 2.2*10^−5, Symbolic −> C2},
{RB, {3, 0}, Value −> 1000., Symbolic −> RB}
];
Note that the value of the Symbolic option needs not to coincide with the reference designator
as this is the case in the example above. You can use any Mathematica expression as value to the
Symbolic field.
A call to CircuitEquations without any additional options (i.e. the default value of the
ElementValues option is used, which is Value) will then cause the numerical values to be entered
into the matrix as these are given as arguments to the Value rules.
82 2. Tutorial

In[18]:= rlc2eqs = CircuitEquations[rlcfilter2];


DisplayForm[rlc2eqs]

i
j
1y
z
Out[19]//DisplayForm=
j
j z
j
j 0z
z
z
0.001 -0.001 0
j
j z.
z
j
j
j z
z
0z
1000. -6 1000.

j z
-0.001 0.001 + €€€€€€€€
€ €€€ + 4.7 ´ 10 s - €€€€€€€€
s €€€€

j
j z
z
s

j z
k 0{
1000. 1000.
0 - €€€€€€€€
s €€€€ 0.001 + €€€€€€€€
s €€€€ + 0.000022 s
1 0 0

i V$1 z
j y i 0 z
j y
j
j
j V$2 zz
z
j
j
j 0 zz
z
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j
j
j
z
z
z
j z j z
==
k I$V0 { k V0 {
V$3 0

Alternatively, we can select the symbolic values by means of the option ElementValues −> Symbolic .
Note that ElementValues affects only those netlist entries in whose value field a Symbolic rule is
present.
In[20]:= rlc2eqs2 = CircuitEquations[rlcfilter2,
ElementValues −> Symbolic];
DisplayForm[rlc2eqs2]

i
j €€€€€ 1yz
Out[21]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0 y
z
j
j z j V$2 z j 0 z
0z j z j z
1 1

j z j z j z
RA€ - €€€€€
RA€ 0
j
j z
z j
j z
z j
j z
z
j
j
j 0
z
z
z
.j
j z
z == j
j z
z
j z j
j z
z j
j z
z
1 1 1 1
- €€€€€
RA€ €€€€€
RA€ + €€€€€€€€
L1 s€ + C1 s - €€€€€€€€
L1 s€
j
j
j L1 s€ + C2 s 0 z
z j z
z k I$V0 { j z
k {
V$3 0
k 1 0{
1 1 1
- €€€€€€€€
L1 s€ €€€€€
RB€ + €€€€€€€€
V0
0 0
2.5 Graphics 83

2.5 Graphics
Mathematica has proven to be a powerful problem-solving environment for a large variety of
engineering tasks. One of many reasons which make Mathematica such a useful tool is that it
provides excellent support for visualizing the results of technical computations. Due to its freely
programmable graphics functionality the flexibility of adapting the graphics display to individual
applications is virtually unlimited. Analog Insydes extends Mathematica’s basic graphic capabilities
by adding special plotting functions for circuit analysis and design, including Bode, Nyquist, Nichol,
root locus plots, and transient waveforms.

2.5.1 Bode Plots


The Bode plot is perhaps the most commonly used graphing scheme for visualizing frequency
responses of linear analog systems. It consists of two separate charts which display magnitude and
phase of a transfer function on a logarithmic and a linear scale vs. frequency, the latter being scaled
logarithmically. The magnitude values are usually given in decibels (dB) and the phase values in
degrees.
In Analog Insydes, Bode plots are displayed using the command BodePlot (Section 3.9.1). With the
basic syntax
BodePlot[tfunc, frange]
you can plot the transfer function tfunc within the frequency range frange. The transfer function
must be a complex-valued function of the frequency variable fvar, and the frequency range a list of
the form {fvar, fstart, fend}. BodePlot also allows to plot several transfer functions simultaneously.
For this purpose, the first argument of BodePlot must be specified as a list of transfer functions.
BodePlot[{tfunc 1 , tfunc2 ,       }, frange]
To demonstrate the Bode plot facility we define the following transfer function in terms of the
frequency variable s.
In[1]:= <<AnalogInsydes‘

In[2]:= H1[s_] := 1000./(1. + 10.1*s + s^2)

We then display a Bode plot of the frequency response by evaluating H1 along the imaginary axis,
s = I × Ω, for a frequency range of 0.001 /sec to 1000 /sec.
84 2. Tutorial

In[3]:= BodePlot[H1[I w], {w, 0.001, 1000.}]

Magnitude (dB) 60
40
20
0
-20
-40
-60
1.0E-3 1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2 1.0E3
Frequency

0
-25
Phase (deg)

-50
-75
-100
-125
-150
-175
1.0E-3 1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2 1.0E3
Frequency

Out[3]= … Graphics …

BodePlot Options
The output generated by BodePlot is influenced by a number of options listed in
Options[BodePlot] , many of which are inherited from Options[LogLinearListPlot] from Mathe-
matica’s standard package Graphics‘Graphics‘ . Here, we will discuss only some of those options
which pertain exclusively to BodePlot or which must be used with a different syntax as compared
to LogLinearListPlot . The relevant options and their default settings are listed below. Defaults
are listed first, followed by the possible alternatives printed in slanted typewriter font.
MagnitudeDisplay −> Decibels | AbsoluteValues | Linear
PhaseDisplay −> Degrees | Radians
PlotRange −> {Automatic, Automatic}
The option MagnitudeDisplay controls the display of the magnitude values. When set to
AbsoluteValues , magnitude values are not converted to decibels. Instead the absolute numerical
values are displayed on a logarithmic scale. When MagnitudeDisplay is set to Linear, magnitude
values are displayed on a linear scale. In a strict sense, the latter does no longer constitute a true
Bode plot, but there exist a few applications where linear magnitude scaling is useful.
With the value of the option PhaseDisplay we can choose whether phase values are shown as
degrees or as radians.
The meaning of the PlotRange option is slightly different for BodePlot than for other Mathematica
plotting commands. Here, the value of PlotRange must be a list of two elements, {range m , rangep },
specifying the plot ranges of the y-axes of the magnitude and the phase chart respectively. PlotRange
has no effect on the ranges of the x-axes as these are determined by the given frequency range. The
format for both y-ranges is the usual one as documented in the Mathematica manual, so any of the
forms below are valid syntax:
2.5 Graphics 85

Automatic
{ymin, ymax}
{ymin, Automatic}

Let’s graph H1 together with a second transfer function H2 and watch the effects of some BodePlot
options. Other common graphics options such as PlotStyle can be applied just as usual.
In[4]:= H2[s_] := 100./(1.6 + 8.2*s + s^2)

In[5]:= BodePlot[{H1[I w], H2[I w]}, {w, 0.001, 1000.},


PhaseDisplay −> Radians,
PlotRange −> {{−60, 80}, Automatic},
PlotStyle −> {{RGBColor[0, 0, 1], Dashing[{0.05}]},
{RGBColor[0, 1, 0]}}]

80
Magnitude (dB)

60
40
20
0
-20
-40

1.0E-3 1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2 1.0E3


Frequency

0
-0.5
Phase (rad)

-1
-1.5
-2
-2.5
-3
1.0E-3 1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2 1.0E3
Frequency

Out[5]= … Graphics …

2.5.2 Nyquist Plots


Another widely used graphical representation of transfer functions is the Nyquist plot. It is a
parametric plot of the real and imaginary part of a transfer function in the complex plane as the
frequency parameter sweeps through a given interval. Nyquist plots are particularly useful for
stability analysis in control system design because one can immediately check whether a negative
feedback loop meets Nyquist’s stability criterion: If the Nyquist curve of the open loop system wraps
around the point -1 on the real axis then the corresponding closed loop system is unstable.
Nyquist plots are produced by the command NyquistPlot (Section 3.9.4) whose argument sequence
is the same as that of BodePlot (Section 3.9.1). Just as in the case of the latter you can plot one
single transfer function or several transfer functions simultaneously.
Let’s make a Nyquist plot of the frequency response of a system which is formed by a series
connection of the two transfer functions H1 and H2, followed by a 54 dB attenuator (-54 dB » 0.002).
The overall transfer function of the resulting system is given by the product of the individual transfer
functions.
86 2. Tutorial

In[6]:= H12a[s_] := H1[s] * H2[s] * 0.002

To make the curve look smoother we increase the number of plot points to 100.
In[7]:= NyquistPlot[H12a[I w], {w, 0.001, 1000.},
PlotPoints −> 100]

Im
Re
20 40 60 80 100 120

-20

-40

-60

-80

Out[7]= … Graphics …

We determine whether the corresponding closed-loop system is stable or unstable by taking a closer
look at the region around the point (-1, 0) using the PlotRange option.
In[8]:= NyquistPlot[H12a[I w], {w, 0.1, 1000.},
PlotPoints −> 100, PlotRange −> {{−3, 1}, {−1, 1}}]

Im
1
0.75
0.5
0.25
Re
-3 -2.5 -2 -1.5 -1 -0.5 0.5 1
-0.25
-0.5
-0.75
-1

Out[8]= … Graphics …

This plot reveals that the point (-1, 0) is located to the right of the Nyquist curve, i.e. the curve
wraps around the critical point. Hence the closed-loop system is unstable.
2.5 Graphics 87

NyquistPlot Options
NyquistPlot inherits its plot options, which are accessible through
Options[NyquistPlot] , from Mathematica’s standard function ListPlot . See the Mathematica book
for detailed explanations of these options. NyquistPlot has additional options like, for example
FrequencyScaling which controls the spacing of the frequency points at which the transfer function
is sampled. FrequencyScaling can be set to Linear or Exponential , resulting in equidistant or
exponentially spaced sampling points respectively. The default is Exponential .

2.5.3 Nichol Plots


Yet another method of visualizing frequency responses is Nichol’s chart. A Nichol plot is similar to
a Nyquist plot but shows gain on a logarithmic scale (dB) vs. phase on a linear scale (degrees), with
an axis origin at the point (0 dB, -180é ). The advantage of Nichol’s chart is the ease by which gain
and phase margins can be determined graphically. The gain margin is simply the negative value of
the gain axis intersect. The phase margin is equal to the distance between the axis origin and the
phase axis intersect.
Nichol charts are computed by the function NicholPlot (Section 3.9.3). The argument sequence is
the same as for NyquistPlot (Section 3.9.4) or BodePlot (Section 3.9.1).
Let’s use a Nichol chart to determine the gain and phase margins of a system which is characterized
by the following transfer function.
In[9]:= H3[s_] := 20*(3 + s)/(s*(5 + s)*(20 + 5*s + 2*s^2))

We draw a Nichol chart of H3[I w] for an angular frequency Ω varying from 0.1 sec-1 to 5 sec-1 .
Again, we increase the number of plot points to produce a smooth curve.
In[10]:= NicholPlot[H3[I w], {w, 0.1, 5.},
AspectRatio −> 0.8, PlotPoints −> 100]

dB
15
10
5
deg
-360 -300 -240 -120 -60 0
-5
-10
-15
-20

Out[10]= … Graphics …

Now, in order to read off the margins better, we zoom in on the part of the curve located in the
fourth quadrant.
88 2. Tutorial

In[11]:= NicholPlot[H3[I w], {w, 0.1, 5.}, AspectRatio −> 0.8,


PlotPoints −> 100, PlotRange −> {{−200, −80}, {−15, 2}}]

dB

deg
-150 -120 -90
-2.5

-5

-7.5

-10

-12.5

-15

Out[11]= … Graphics …

The curve crosses the gain axis at a gain of -12.5 dB, so we have a gain margin of 12.5 dB. At the
phase axis intersect we have a phase value of approximately -100é which is 80é away from the axis
origin. Hence, the phase margin is 80é .

NicholPlot Options
Like NyquistPlot , NicholPlot inherits its options from ListPlot. NicholPlot has additional
options like, for example, PhaseDisplay (see Section 2.5.1) and FrequencyScaling (see Section 2.5.2).

2.5.4 Root Locus Plots


Let H(s, k) denote a rational transfer function whose coefficients depend on the real parameter k. A
root locus plot shows the locus of the poles and zeros of H(s, k) in the complex plane as k varies
within an interval [k0 , k1 ].
To draw a root locus plot use the command RootLocusPlot (Section 3.9.5). The calling format is
RootLocusPlot[tfunc, {k, k0 , k1 }]
where tfunc is a transfer function in the frequency variable s and one real parameter k.
Of course, the parameter does not necessarily have to be named k. We can also use any other symbol
to denote the parameter. Below, we define the transfer function H4[s, a] with coefficients which are
functions of the parameter a.
In[12]:= H4[s_, a_] := (a + 2*s + s^2)/(10 + 3*a*s + 4*s^2 + s^3)

Then we graph the root locus of H4 as a varies from 3 to 5. By default, RootLocusPlot samples
the parameter interval at five equally spaced points. This number can be increased or decreased by
2.5 Graphics 89

means of the PlotPoints option. The poles and zeros of the transfer function are displayed as red
crosses and green circles, respectively.
In[13]:= RootLocusPlot[H4[s, a], {a, 3, 5}]

a = 3.000e0 .. 5.000e0 (0% .. 100%)


Im s
Poles
0%
2.0E0

1.
100%
Re s
-2.0E0 -1. -0.5
Zeros
-1. 0%

-2.0E0

100%

Out[13]= … Graphics …

RootLocusPlot Options
RootLocusPlot inherits its options from Graphics and adds its own options like PoleStyle and
ZeroStyle to Options[RootLocusPlot] . With these options you can customize the display of poles
and zeros, e.g. for better black-and-white printouts. The syntax of the PoleStyle option is
PoleStyle −> mark[size, colorfunc, grstyle]
where mark specifies the marker symbol (e.g. CrossMark , PlusMark , CircleMark , SquareMark , and
PointMark ), size denotes the size of the marker in scaled coordinates, colorfunc is a pure function that
returns a color value for an argument between 0 and 1, and grstyle is a Mathematica graphics style
or a sequence of styles, such as Hue or Thickness . Note that everything mentioned above applies
to the ZeroStyle option as well.
In the following command line we instruct RootLocusPlot to modify the styles for the pole and
zero markers:
90 2. Tutorial

In[14]:= RootLocusPlot[H4[s, a],{a, 3, 5},


PoleStyle −> PlusMark[0.03, Hue[1−0.3*#] &,
Thickness[0.012]],
ZeroStyle −> PointMark[0.03, Hue[0.5−0.3*#] &,
Thickness[0.005]]]

a = 3.000e0 .. 5.000e0 (0% .. 100%)


Im s
Poles
0%
2.0E0

1.
100%
Re s
-2.0E0 -1. -0.5
Zeros
-1. 0%

-2.0E0

100%

Out[14]= … Graphics …

Pole-Zero Plots of Transfer Functions Without Parameters


The RootLocusPlot function can also be used to display the pole and zero locations of transfer
functions without parameters. For this purpose, RootLocusPlot must be called with a univariate
transfer function, and no parameter interval must be passed as a second argument.
In[15]:= RootLocusPlot[H3[s]]

Im s

2.0E0

1.

Re s
-5.0E0 -2.0E0 -1. -0.5

-1.

-2.0E0

Out[15]= … Graphics …
2.5 Graphics 91

Animating Root Locus Plots


Sometimes it is helpful to animate a root locus plot because this shows the orientations of the
pole and zero trajectories better than a static plot. Let’s demonstrate root locus plot animation on
the transfer function H4[s, a] from above. To prepare the animation we compute a sequence of
pole-zero plots with identical plot ranges by mapping the following RootLocusPlot function to a
table of parameter values ranging from -3 to 5 in steps of 2. This is necessary because we want to
produce one separate plot in every parameter step instead of one single plot in which the solutions
from all steps are superimposed.
In[16]:= RootLocusPlot[H4[s, a], {a, #, #},
PoleStyle −> CrossMark[0.03, Hue[0.7] &,
Thickness[0.007]],
ZeroStyle −> CircleMark[0.03, Hue[0.3] &,
Thickness[0.007]],
PlotRange −> {{−6, 1}, {−4, 4}},
ShowLegend −> False,
LinearRegionStyle −> RGBColor[1, 1, 1]
] & /@ Table[x, {x, −3, 5, 2}]

a = 5.000e0 Im s

2.0E0

1.

Re s
-5.0E0 -2.0E0 -1. 1.

-1.

-2.0E0

8… Graphics …, … Graphics …, … Graphics …, … Graphics …, … Graphics …<


Out[16]=

We show only one plot here; several plots are generated if the command is evaluated in a Mathematica
notebook.
To animate the root locus plot double-click on one of the images. Alternatively, you can select
the resulting group of notebook cells containing the images with your mouse and then click on
Cell | Animate Selected Graphics in Mathematica’s frontend menu.

2.5.5 Transient Waveforms


For displaying transient waveforms, Analog Insydes provides the command
TransientPlot (Section 3.9.6). The usage of this function is demonstrated in Section 2.7.1 and
Section 2.7.6.
92 2. Tutorial

2.6 Modeling and Analysis of Nonlinear Circuits

2.6.1 Behavioral Models


In Chapter 2.3 we implemented small-signal equivalent circuits for semiconductor devices as
subcircuit objects composed of the available linear circuit primitives. We cannot use this approach
to model the electrical characteristics of nonlinear elements, such as diodes or transistors. However,
particularly for nonlinear circuit analysis, Analog Insydes provides special support for modeling
arbitrary circuit element characteristics by specifying device equations directly.
Models which are based on sets of mathematical equations describing the behavior of a circuit
element or an analog building block are frequently called (analog) behavioral models, or ABMs. A
behavioral model is similar to a subcircuit object in that it constitutes a box which is connected to a
circuit through electrical ports. As indicated above, the difference is that the interior of a behavioral
model box is implemented in terms of symbolic equations rather than a netlist. With Analog Insydes’
behavioral modeling capabilities you can model a large variety of nonlinear element characteristics.
You can then use the function CircuitEquations (Section 3.5.1), with which you are already familiar,
to set up symbolic systems of nonlinear modified nodal or sparse tableau equations.

2.6.2 Defining Behavioral Models

The Argument Sequence of the Model Command for ABM Definitions


Behavioral models are defined using the Model (Section 3.2.1) command, just like subcircuits (see
Section 2.3.2). Analog Insydes recognizes a request to define a behavioral model by the presence of
the named parameter Variables and the absence of a subcircuit Netlist on the right-hand side of
the Definition argument in a Model call. The full syntax for an ABM definition is shown below.
Again, slanted typewriter font denotes optional arguments.
Model[
Name −> subcircuit class name,
Selector −> selector,
Scope −> scope,
Ports −> {port nodes},
Parameters −> {parameters},
Symbolic −> {symbolic parameters},
Defaults −> {defaults},
InitialConditions −> {initial conditions},
InitialGuess −> {initial guess},
Translation −> {parameter translation rules},
Variables −> {variables},
Definition −> Equations[equations]
]
2.6 Modeling and Analysis of Nonlinear Circuits 93

Except for the additional arguments and the keyword Definition , all other named arguments of
the Model function have the same meaning as for subcircuit definitions. Following, we discuss the
two arguments Definition and Variables .

Example: A Diode
Let’s illustrate the steps which are necessary to define a behavioral model by implementing a
nonlinear device model for a junction diode.

vd/vt
VD id(vd)=Is (e -1)

ID

Figure 6.1: Junction diode

The diode shown in Figure 6.1 has two terminals, the anode and the cathode, denoted by the node
identifiers A and C, respectively. The branch voltage vD and the branch current iD satisfy the device
equation

iD = IS × (evD /Vt - 1)

where IS denotes the reverse-bias saturation current and Vt the thermal voltage. Typical values for IS
are 10-9 A       10-15 A. Vt is given by k T/q where k denotes Boltzmann’s constant (k = 1.381 × 10-23 Ws/K).
T is the absolute temperature (in Kelvin), and q is the charge of an electron (q = 1.602 × 10-19 As).
In[1]:= <<AnalogInsydes‘

In[2]:= ThermalVoltage[T_] := 1.381*10^−23 * T / (1.602*10^−19)

At a temperature of 300 K (= 27é C), Vt is approximately 26 mV:


In[3]:= ThermalVoltage[300.]
Out[3]= 0.0258614

Since the thermal voltage is only defined in terms of constants and the global quantity temperature,
Vt is a global parameter. Thus, we have a local parameter of the diode device equation which is
IS , and a global parameter which is Vt . Note that a global parameter param is defined by setting
Global[param] in the Parameters argument. Assuming Scope −> Local and no Translation rules,
the first half of the Model definition is thus given by
94 2. Tutorial

Model[
Name −> Diode,
Selector −> DC,
Ports −> {A, C},
Parameters −> {Is, Global[Vt]},
   
]

The Definition Argument


For behavioral model definitions, the Definition parameter must be of the form
Definition −> Equations[eq1 , eq2 ,       ]
where eq1 , eq2 ,       denote the symbolic device equations. (For compatibility reasons the right hand
side of the Definition parameter may also be a list of equations.) When specifying an arbitrary
set of equations we must tell Analog Insydes how the unknowns of the equations relate to the port
currents and voltages of a model object.

node+

Voltage[node+, node-] Current[node+, node-]

node-
Figure 6.2: Voltage and current identifiers at a model port branch

Ports of behavioral models are defined in terms of electrical port branches. Every unique pair
of node identifiers [node+, node−] introduces an electrical port branch in between the model port
nodes node+ and node−. For the associated port voltage and current the positive reference direction
is defined to be oriented from node+ to node−, which is illustrated in Figure 6.2.
Port variables in behavioral model equations can be referred to by means of two special keywords
which are recognized by Analog Insydes and replaced by the corresponding global current or voltage
identifiers during model instantiation and expansion. The keywords provided to make references to
port currents and voltages are, respectively:
Current[node+, node-]
Voltage[node+, node-]
Note that the above definition of positive reference directions implies that Current[nodeA, nodeB] and
Current[nodeB, nodeA] are two different quantities and refer to different port branches. Similarly,
Current[nodeA, nodeB] and Voltage[nodeB, nodeA] do not refer to the same port branch.
2.6 Modeling and Analysis of Nonlinear Circuits 95

In the case of the diode we have two port nodes A and C, which are connected by an electrical port
branch [A, C]. The port current, i.e. iD , is thus designated by Current[A, C] and the port voltage,
i.e. vD , is designated by Voltage[A, C]. Hence, the model equation must be written as
Definition −>
Equations[Current[A, C] == Is (Exp[Voltage[A, C]/Vt] − 1)]

In this example, the Definition contains only one single equation, but there is no limit to the
number of equations. We will discuss some more advanced examples in which this will become
apparent later in this chapter.
A note on interfacing: Some numerical circuit simulators with behavioral model simulation capabilities use the
currents into the pins (port nodes) of a model object and the node voltages at the pins as symbolic quantities
by which the model equations are interfaced with the exterior circuit. This approach is not well suited for other
analysis methods than modified nodal analysis. Using port branches with associated currents and voltages
facilitates setting up other formulations which involve loop equations, such as the sparse tableau.

The Variables Argument


The Variables argument serves to specify the symbols which are unknowns of the model equations.
The diode equation contains two unknowns, Current[A, C] and Voltage[A, C], so the Variables
argument is
Variables −> {Current[A, C], Voltage[A, C]}
The need for the Variables specification may not be entirely obvious here. One might argue that
Analog Insydes should know that port current and voltage identifiers are unknowns. However,
port currents and voltages are not always the only variables of a set of model equations. Similarly
to a subcircuit which may have internal nodes, a behavioral model may also contain internal
variables which are not of the form Voltage[node+, node−] or Current[node+, node−]. Without the
Variables argument, Analog Insydes would not be able to distinguish between internal variables
and global parameters, such as Vt in the diode equation. So, by convention, you must specify all
identifiers in a set of model equations which are neither local nor global parameters, including the
port branch quantities. The complete ABM definition for the diode is then given by
Model[
Name −> Diode,
Selector −> DC,
Ports −> {A, C},
Parameters −> {Is, Global[Vt]},
Variables −> {Current[A, C], Voltage[A, C]},
Definition −>
Equations[Current[A, C] == Is (Exp[Voltage[A, C]/Vt] − 1)]
]
96 2. Tutorial

2.6.3 Referencing Behavioral Models


Behavioral models are referenced exactly like subcircuits. Since we have already learned in Chapter 2.3
how to write hierarchical netlists we can start immediately with an example. Let’s write a netlist for
the diode circuit in Figure 6.3 using the diode model developed above.
1

R1

V0 2

D1

Figure 6.3: Diode circuit

In[4]:= diodeNetwork =
Circuit[
Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{D1, {2 −> A, 0 −> C},
Model −> Diode,
Selector −> DC}
],
Model[
Name −> Diode,
Selector −> DC,
Ports −> {A, C},
Parameters −> {Is, Global[Vt]},
Variables −> {Current[A, C], Voltage[A, C]},
Definition −>
Equations[
Current[A, C] == Is (Exp[Voltage[A, C]/Vt] − 1)
]
]
]
Out[4]= … Circuit …

2.6.4 Nonlinear Circuit Equations

Setting up Nonlinear Equations


Using the command CircuitEquations you can set up modified nodal or sparse tableau equations
for nonlinear circuits just as for linear circuits. The only restriction is that nonlinear systems of
2.6 Modeling and Analysis of Nonlinear Circuits 97

equations cannot be set up in matrix form. Therefore, whenever a netlist contains behavioral models,
you must call CircuitEquations with the option MatrixEquation −> False, or as in our case,
you need to switch the AnalysisMode to e.g. DC for setting up nonlinear static equations which
automatically implies the setting MatrixEquation −> False.
In[5]:= dnwmna = CircuitEquations[diodeNetwork,
AnalysisMode −> DC];
DisplayForm[dnwmna]
Out[6]//DisplayForm=
99I$V0 + €€€€€€€€€€€€€€€€
V$1 - V$2 -V$1 + V$2
€€€€€€€€ == 0, I$AC$D1 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0,

V$1 == V0, I$AC$D1 == I-1 + 㠀€€€Vt€€€ M Is$D1=,


R1 R1
V$2

8V$1, V$2, I$V0, I$AC$D1<, DesignPoint ® 8<=

Here, we have set up a system of nonlinear modified nodal equations in the unknowns V$1, V$2,
I$V0, and I$AC$D1 . The latter symbol has been created automatically from the port current identifier
Current[A, C] in the definition of the diode model. All port branch voltages have been replaced
by corresponding differences of node voltages.
Generally, a port current Current[x, y] in a model instance MX will be denoted by symbols of the
form I$xy$MX. A port voltage Voltage[x, y] will be denoted by V$xy$MX, provided that branch
voltages appear as unknowns in the selected analysis method. To examine both effects we set up
the sparse tableau equations.
In[7]:= CircuitEquations[diodeNetwork,
Formulation −> SparseTableau, AnalysisMode −> DC

Out[7]= 8V$V0, V$R1, V$AC$D1, I$V0, I$R1, I$AC$D1<


] // GetVariables

We use the command GetVariables (Section 3.6.7) to extract the list of variables from the equation
system. As you can see, the corresponding variables are called V$AC$D1 and I$AC$D1

Solving Nonlinear Equations


Solving nonlinear circuit equations analytically is, unfortunately, mathematically impossible in the
general case. However, in many applications it is possible to reduce the original set of equations by
eliminating a number of variables. This may already yield some qualitative insight into the behavior
of a nonlinear circuit. On the other hand, we can always assign values to symbolic parameters and
solve the equations numerically using NDAESolve (Section 3.7.5).
Let’s derive an expression which relates the diode current
I$AC$D1 to the input voltage V0 by eliminating all other variables. For this task, Analog Insydes
provides the function CompressNonlinearEquations (Section 3.12.2) which removes equations and
variables from a nonlinear DAEObject that are irrelevant for solving for a set of given variables. The
option setting EliminateVariables −> All additionally allows for eliminating variables that occur
linear somewhere in the equations.
98 2. Tutorial

In[8]:= dnwsol = CompressNonlinearEquations[dnwmna, I$AC$D1,


EliminateVariables −> All];
DisplayForm[dnwsol]

99I$AC$D1 == I-1 + 㠀€€€€€€€€€€€€€€€ M Is$D1=, 8I$AC$D1<, DesignPoint ® 8<=


Out[9]//DisplayForm=
-I$AC$D1 R1+V0
Vt€€€€€€€€
€€€€

The implicit equation is what we have been looking for. Without resorting to approximation methods
such as Taylor series we cannot simplify the result any further and solve for the diode current
analytically.

2.6.5 Multi-Dimensional Models

The Ebers-Moll Transistor Model


The procedure for modeling one-dimensional nonlinear element characteristics can be easily extended
to the multi-dimensional case. Let’s demonstrate multi-dimensional device modeling on a practical
example by defining nonlinear DC models for a bipolar junction transistor (see Figure 6.4).
IC

VBC C

B
IB VCE

VBE E

IE

Figure 6.4: NPN transistor

Our considerations will be based on the BJT model introduced by Ebers and Moll which expresses
the relations between the transistor currents and voltages IC , IE , VBE , and VBC as

IS
IC = IS × (eVBE /Vt - 1) - × (eVBC /Vt - 1)
Αr
IS
IE = - × (eVBE /Vt - 1) + IS × (eVBC /Vt - 1)
Αf

In these equations, the parameter IS represents the transport saturation current, Αr and Αf denote the
large-signal reverse and forward current gains of the common base configuration, and Vt designates
the thermal voltage. In integrated circuit design, the saturation current is usually expressed as the
product of the transport saturation current density JS , which is a process parameter, and the emitter
area A, which is a design parameter:
2.6 Modeling and Analysis of Nonlinear Circuits 99

IS = J S × A

The remaining two unknown voltages and currents at the transistor’s terminals, IB and VCE can be
computed from KCL and KVL (see Figure 6.5) as

IB = - (IC + IE )
VCE = VBE - VBC

IC
C
VBC C Voltage[B,C]
B Current[B,C]=-IC
IB VCE B
Current[B,E]=-IE
Voltage[B,E]
VBE E
E

IE
Figure 6.5: NPN transistor and corresponding ABM port branch definition

In most linear applications, bipolar transistors are typically operated in the forward active region
which is roughly characterized by VBE > 0.5 V and VBC < 0.3 V. Under these assumptions we can
simplify the Ebers-Moll model to

IC = IS × eVBE /Vt
IS
IE = - × eVBE /Vt
Αf

because as compared to the terms involving eVBE /Vt , all other terms are smaller by several orders of
magnitude.
A BJT operating in the forward active region acts as a good current amplifier from the base current I B
to the collector current IC with the gain relationship

IC = Β f × IB

The parameter Βf denotes the large-signal forward current gain in common-emitter configuration.
It is often more convenient to think in terms of forward and reverse current gains with respect to
100 2. Tutorial

the base current, i.e. Βf and Βr , than in terms of the model parameters Αf and Αr in the original
Ebers-Moll equations. The relationship between Αf and Βf , as well as between Αr and Βr is given by

Α
Β=
1-Α

or, equivalently,

Β
Α=
1+Β

By making use of parameter translation rules in the model definition (see Section 2.3.7), we can let
Analog Insydes compute the values for Αf and Αr automatically from given values for Βf and Βr .

Implementation of Nonlinear DC Transistor Models


With the above background information on transistor models we are now ready to define a large-
signal BJT model for DC circuit analysis. We start by implementing a global DC model for an NPN
transistor using the unsimplified device equations after Ebers and Moll from the previous subsection.
   
Name −> NPNBJT,
Selector −> EbersMoll,
Scope −> Global,
Ports −> {C, B, E},
   

Let’s decide that we do not want to characterize a transistor by the Ebers-Moll model parameters Is,
alphaf, alphar, and Vt but want to use the parameters Js, Area, betaf, betar, and Temperature
instead. We do not need to rewrite the model equations if we specify translation rules which
translate our model parameters to those of the Ebers-Moll model. Remember that the function
ThermalVoltage has already been defined in Section 2.6.2.
   
Parameters −> {betaf, betar, Js, Area, Global[Temperature]},
Translation −>
{alphaf −> betaf/(1+betaf), alphar −> betar/(1+betar),
Is −> Js*Area, Vt :> ThermalVoltage[Temperature]},
   

The Ebers-Moll equations describe the functional relations between the voltages and currents at
two electrical branches, the base-collector branch and the base-emitter branch, which we use as the
port branches of our model. Associated with the port branches are the variables Voltage[B, E],
Current[B, E], Voltage[B, C], and Current[B, C], which must be specified as
2.6 Modeling and Analysis of Nonlinear Circuits 101

   
Variables −>
{Current[B, C], Voltage[B, C],
Current[B, E], Voltage[B, E]},
   

in the model definition.


It remains to write the model equations in terms of the port branch variables, paying attention to
the different positive reference directions assumed for the port currents as compared to I C and IE in
the Ebers-Moll equations. While the latter are defined to be positive for currents flowing into the
collector and emitter, positive values of Current[B, C] and Current[B, E] denote currents flowing
out of these terminals. We account for this difference by changing the sign on the right-hand side of
the model equations.
   
Definition −>
Equations[
Current[B, C] == −Is*(Exp[Voltage[B, E]/Vt] − 1)
+ Is/alphar*(Exp[Voltage[B, C]/Vt] − 1),
Current[B, E] == Is/alphaf*(Exp[Voltage[B, E]/Vt] − 1)
− Is*(Exp[Voltage[B, C]/Vt] − 1)
],
   

To store the transistor model in the global database we wrap the complete Model definition into a
Circuit structure and expand it with ExpandSubcircuits (Section 3.4.1).
In[10]:= Circuit[
Model[
Name −> NPNBJT,
Selector −> EbersMoll,
Scope −> Global,
Ports −> {C, B, E},
Parameters −>
{betaf, betar, Js, Area, Global[Temperature]},
Translation −>
{alphaf −> betaf/(1+betaf),
alphar −> betar/(1+betar),
Is −> Js*Area, Vt :> ThermalVoltage[Temperature]},
Variables −>
{Current[B, C], Voltage[B, C],
Current[B, E], Voltage[B, E]},
Definition −>
Equations[
Current[B, C] == −Is*(Exp[Voltage[B, E]/Vt] − 1)
+ Is/alphar*(Exp[Voltage[B, C]/Vt] − 1),
Current[B, E] == −Is*(Exp[Voltage[B, C]/Vt] − 1)
+ Is/alphaf*(Exp[Voltage[B, E]/Vt] − 1)
]
]
] // ExpandSubcircuits;
102 2. Tutorial

Similarly, we define a simplified Ebers-Moll model for transistors operating in the forward active
region.
In[11]:= Circuit[
Model[
Name −> NPNBJT,
Selector −> EbersMollForwardActive,
Scope −> Global,
Ports −> {C, B, E},
Parameters −> {betaf, Js, Area, Global[Temperature]},
Translation −>
{alphaf −> betaf/(1+betaf),
Is −> Js*Area, Vt :> ThermalVoltage[Temperature]},
Variables −>
{Current[B, C], Voltage[B, C],
Current[B, E], Voltage[B, E]},
Definition −>
Equations[
Current[B, C] == −Is*(Exp[Voltage[B, E]/Vt]),
Current[B, E] == Is/alphaf*(Exp[Voltage[B, E]/Vt])
]
]
] // ExpandSubcircuits;
Both models are now stored in the global database:
In[12]:= GlobalSubcircuits[]

88NPNBJT, EbersMoll<, 8NPNBJT, EbersMollForwardActive<<


Out[12]=

2.6.6 Nonlinear DC Circuit Analysis

Calculating the Bias Point of a Transistor Circuit


Analog Insydes’ nonlinear modeling capabilities and numeric equation solver allow for solving
circuit analysis problems quickly and reliably without tedious and error-prone hand calculations.
Let’s demonstrate one such application:
Determine the operating-point currents and voltages IB, IC, VBE, VCE for the circuit shown in
Figure 6.6, if (a) RB = 500 kW and (b) RB = 100 kW. Assume that the transistor has an emitter area of
4 mil2 , Βf = 100, Βr = 0.2, JS = 6 × 10-10 ΜA/mil2 , and that it operates at a temperature of 300 K. The
values of the supply voltage and the collector resistance are VCC = 12 V and RC = 4 kW.
2.6 Modeling and Analysis of Nonlinear Circuits 103

RB RC

IB IC
3 VCC
2 Q1 VCE

VBE

Figure 6.6: Bipolar transistor circuit

For didactic reasons we do not use ReadNetlist to automatically import the netlist, but rather
write the circuit by hand. Moreover, instead of using a BJT transistor model from the predefined
Analog Insydes model library, we select a suitable model from the global database which contains
the two NPNBJT models defined in the previous section. By leaving the model selector unspecified,
Selector −> BJTModel, we can postpone the final choice of the underlying model equations until
we set up circuit equations. The option Pattern −> Impedance in the value field of RB introduces
the current I$RB into the MNA equations. The current I$RB is identical to the base current IB, so we
can compute the latter directly from the equations without having to determine it manually from IC
and IE by KCL.
In[13]:= bjtbias =
Circuit[
Netlist[
{VCC, {1, 0}, Type −> VoltageSource,
Symbolic −> VCC, Value −> 12.},
{RB, {1, 2}, Pattern −> Impedance,
Symbolic −> RB, Value −> 500.*10^3},
{RC, {1, 3}, Symbolic −> RC, Value −> 4000.},
{Q1, {3 −> C, 2 −> B, 0 −> E},
Model −> NPNBJT, Selector −> BJTModel,
betaf −> 100., betar −> 0.2,
Js −> 6.*10^−16, Area −> 4., Temperature −> 300.}
]
]
Out[13]= … Circuit …

In order to keep model complexity as low as possible, we make the initial assumption that Q1
operates in the forward active region and set up a system of symbolic static circuit equations using
the simplified Ebers-Moll model by setting the options AnalysisMode −> DC and
ElementValues −> Symbolic .
104 2. Tutorial

In[14]:= mnaeqsfa = CircuitEquations[


bjtbias /. BJTModel −> EbersMollForwardActive,
AnalysisMode −> DC, ElementValues −> Symbolic];
DisplayForm[mnaeqsfa]
Out[15]//DisplayForm=
99I$RB + I$VCC + €€€€€€€€€€€€€€€€
V$1 - V$3
€€€€€€€€ == 0, I$BC$Q1 + I$BE$Q1 - I$RB == 0,
RC
-V$1 + V$3
-I$BC$Q1 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0, V$1 == VCC,
RC

I$BE$Q1 == 2.424 ´ 10-15 ã38.6676 V$2 =,


I$RB RB - V$1 + V$2 == 0, I$BC$Q1 == -2.4 ´ 10-15 ã38.6676 V$2 ,

8V$1, V$2, V$3, I$VCC, I$RB, I$BC$Q1, I$BE$Q1<,


DesignPoint ® 8VCC ® 12., RB ® 500000., RC ® 4000.<=

This system of equations can be solved by Analog Insydes’ numerical root finding function NDAESolve
(Section 3.7.5), which starts from an initial guess for the values of the variables. By default, initial
values of 0.0 for all unknowns are chosen which is very often close enough to ensure convergence.
In[16]:= NDAESolve[mnaeqsfa, {t, 0}]

88V$1 ® 12., V$2 ® 0.712996, V$3 ® 2.9704, I$VCC ® -0.00227997,


Out[16]=

I$RB ® 0.000022574, I$BC$Q1 ® -0.0022574, I$BE$Q1 ® 0.00227997<<

From the result we can immediately read off the operating point. We have

VBE = V$2 = 0.713 V


VCE = V$3 = 2.970 V
IB = I$RB = 0.023 mA
IC = -I$BC$Q1 = 2.257 mA

Next, we repeat the same calculation for RB = 100 kW using the command UpdateDesignPoint
(Section 3.6.14) to alter the numeric element value for RB.
In[17]:= mnaeqsfa = UpdateDesignPoint[mnaeqsfa, RB −> 1.*10^5];
NDAESolve[mnaeqsfa, {t, 0}]

88V$1 ® 12., V$2 ® 0.75452, V$3 ® -32.9819, I$VCC ® -0.0113579,


Out[18]=

I$RB ® 0.000112455, I$BC$Q1 ® -0.0112455, I$BE$Q1 ® 0.0113579<<

This time, we obtain a physically nonsensical value of -32.98 V for VCE which indicates that our
initial assumption about the operating condition of Q1 has been violated. Indeed, for RB = 100 kW,
Q1 operates in deep saturation. We must therefore select the full Ebers-Moll model to take these
effects into account.
2.6 Modeling and Analysis of Nonlinear Circuits 105

In[19]:= mnaeqssat = CircuitEquations[


bjtbias /. BJTModel −> EbersMoll,
AnalysisMode −> DC, ElementValues −> Symbolic];
DisplayForm[mnaeqssat]
Out[20]//DisplayForm=
99I$RB + I$VCC + €€€€€€€€€€€€€€€€
V$1 - V$3
€€€€€€€€ == 0, I$BC$Q1 + I$BE$Q1 - I$RB == 0,
RC
-V$1 + V$3
-I$BC$Q1 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0, V$1 == VCC, I$RB RB - V$1 + V$2 == 0,
I$BC$Q1 == -2.4 ´ 10-15 H-1 + ã38.6676 V$2 L +
RC

1.44 ´ 10-14 H-1 + ã38.6676 HV$2-V$3L L, I$BE$Q1 ==


2.424 ´ 10-15 H-1 + ã38.6676 V$2 L - 2.4 ´ 10-15 H-1 + ã38.6676 HV$2-V$3L L=,
8V$1, V$2, V$3, I$VCC, I$RB, I$BC$Q1, I$BE$Q1<,
DesignPoint ® 8VCC ® 12., RB ® 500000., RC ® 4000.<=

Solving these enhanced equations will now deliver a proper result for RB = 100 kW.
In[21]:= mnaeqssat = UpdateDesignPoint[mnaeqssat, RB −> 1.*10^5];
NDAESolve[mnaeqssat, {t, 0}]

88V$1 ® 12., V$2 ® 0.720901, V$3 ® 0.13522, I$VCC ® -0.00307899,


Out[22]=

I$RB ® 0.000112791, I$BC$Q1 ® -0.0029662, I$BE$Q1 ® 0.00307899<<

We finally obtain:

VBE = V$2 = 0.721 V


VCE = V$3 = 0.135 V
IB = I$RB = 0.113 mA
IC = -I$BC$Q1 = 2.966 mA

2.6.7 References
The BJT circuit DC analysis example was adapted from the book by R. L. Geiger, P. E. Allen, and
N. R. Strader: VLSI Design Techniques for Analog and Digital Circuits, Mc-Graw Hill, 1990.
106 2. Tutorial

2.7 Time-Domain Analysis of Nonlinear Dynamic


Circuits
In Chapter 2.6 it was shown how to model and analyze circuits with nonlinear element characteristics.
In this chapter, we extend these considerations to the analysis of circuits containing not only nonlinear
but also dynamic components, such as capacitors and inductors. From a mathematical point of view
this means that a system of equations which describes a nonlinear dynamic circuit involves linear
and nonlinear algebraic constraints as well as time derivatives of some circuit variables. Equations
with these properties are called system of nonlinear Differential and Algebraic Equations, or DAE.
When analyzing a dynamic circuit we are usually interested in finding the response of the circuit to
a given input signal as a function of time. This analysis mode is commonly referred to as transient
analysis. Computing a transient response requires solving an implicit DAE system numerically,
starting from an initial solution for the voltages and currents known as the DC operating point.
With Mathematica’s built-in command NDSolve we cannot handle this type of problem because
solving differential equations with algebraic constraints is not supported. Therefore, Analog Insydes
includes a special DAE solver for circuit simulation called NDAESolve which will be introduced in
the following section.

2.7.1 Transient Circuit Analysis

A Diode Rectifier Circuit


Let’s start to demonstrate transient analysis on the half-wave diode rectifier circuit shown in
Figure 7.1. This circuit contains both nonlinear as well as dynamic components, namely the diode
D1 and the capacitor C1. Given numerical element values and input voltage waveform V0 = Vin (t)
we shall compute the transient response Vout (t) across the load resistor R1.

D1
1 2

V0 C1 R1 Vout

Figure 7.1: Diode rectifier circuit

As usual, we prepare our circuit analysis by writing a netlist description of the circuit. For the diode,
we use the model from the Analog Insydes model data base (Chapter 4.3). The model parameters
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 107

Is (saturation current) and Vt (thermal voltage) are set to Is = 1 pA and Vt = 26 mV. The values of
the circuit elements are assumed to be R1 = 100 W and C1 = 100 nF.
In[1]:= <<AnalogInsydes‘

In[2]:= rectifier =
Circuit[
Netlist[
{V0, {1, 0}, Vin},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*10^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice",
IS −> 1.*10^−12}
]
]
Out[2]= … Circuit …

Next, we use the function CircuitEquations (Section 3.5.1) to set up a system of nonlinear
differential MNA equations in the time domain. In oder to express all voltages and currents as
functions of time f (t) and to include time derivatives f ¢ (t) introduced by dynamic components the
option AnalysisMode −> Transient must be specified in the function call.
AnalysisMode −> Transient implies MatrixEquation −> False, therefore the equations are written
as list of equations regardless of the current setting of MatrixEquation . CircuitEquations returns
a Transient DAEObject which can be displayed via the command DisplayForm .
In[3]:= rectifierMNA = CircuitEquations[rectifier,
AnalysisMode −> Transient];
DisplayForm[rectifierMNA]

88I$AC$D1@tD + I$V0@tD == 0,
Out[4]//DisplayForm=

-I$AC$D1@tD + 0.01 V$2@tD + 1. ´ 10-7 V$2 @tD == 0,


¢

1. ´ 10-12 H-1 + ã38.6635 HV$1@tD-V$2@tDL L + 1. ´ 10-12 HV$1@tD - V$2@tDL<,


V$1@tD == Vin, I$AC$D1@tD ==

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<, DesignPoint ® 8<<

This set of modified nodal equations is a typical DAE system. It comprises implicit differential
equations as well as both linear and nonlinear algebraic constraints.

The NDAESolve Command


Analog Insydes provides the function NDAESolve (Section 3.7.5) for solving DAE systems numerically.
NDAESolve[dae, {tvar, t0 X, t1 \} X, params\ X, opts\]
where dae is a DC or Transient DAEObject containing the circuit equations and variables. The
argument tvar denotes the time variable for which the solutions are computed in the time interval
tvar Î [t0 , t1 ], or at the time instant tvar = t0 . Additionally, params allows for carrying out a parametric
analysis. For possible parameter specifications please refer to Section 3.7.2. Finally, opts is a sequence
of zero or more solver options of the form option −> value (see Section 2.7.4).
108 2. Tutorial

Let’s use NDAESolve to compute the transient response Vout (t) of the diode circuit to a sinusoidal
input voltage Vin (t) = 1 V × sin(Ωt). We choose Ω = 106 s-1 , replace the symbol Vin which denotes the
input voltage by the sine function, and integrate the circuit equations numerically with respect to
the time variable t from t0 = 0 to t1 = 20 Μs.
In[5]:= solutions = NDAESolve[rectifierMNA /. Vin −> Sin[10^6 t],
{t, 0., 2.*10^−5}]

88V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


Out[5]=

V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,


I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D<<

Like Mathematica’s NDSolve, NDAESolve returns the solutions for the node voltages and currents
in terms of InterpolatingFunction objects. This allows for accessing the numerical values of all
variables at any point of time in the simulation interval. To obtain the voltages and currents at a
certain point of time ti , we first have to rewrite the interpolating functions as functions of time.
In[6]:= functions =
First[solutions] /. Rule[a_, b_] −> Rule[a, b[t]]

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D@tD,


Out[6]=

V$1 ® InterpolatingFunction@880., 0.00002<<, <>D@tD,


I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D@tD,
I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D@tD<

Then we replace t by a particular value, here t = 10 Μs. This yields the solution vector as a list of
rules.
In[7]:= functions /. t −> 10^−5

8V$2 ® 0.337585, V$1 ® -0.543881,


Out[7]=

I$V0 ® 1.88147 ´ 10-12 , I$AC$D1 ® -1.88147 ´ 10-12 <

From the result we can immediately extract the voltage values for V0 (t = 10 Μs) and Vout (t = 10 Μs),
as well as the value for the diode current ID1 (t = 10 Μs)

V0 = V$1 = -0.544 V
Vout = V$2 = 0.338 V
ID1 = I$AC$D1 = -1.9 pA

Plotting Transient Waveforms


For graphical display of transient waveforms computed with NDAESolve , Analog Insydes provides
the function TransientPlot (Section 3.9.6). With TransientPlot , several interpolating functions

TransientPlot[Xnumericaldata,\ vars, {tvar, t0 , t1 } X, opts\]


can be plotted in a single diagram or displayed as graphics array. The command syntax is

where numericaldata is a list of rules of interpolating functions. The format is compatible to the return
value of e.g. NDSolve and NDAESolve (see Section 3.7.1). The argument vars is a list of the variables
to be plotted. Besides the variables themselves, this list may also contain mathematical expressions
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 109

in terms of these variables. The symbol tvar denotes the time variable for which the waveforms are
plotted from tvar = t0 to tvar = t1 . Zero or more options opts can be specified as sequence of rules of
the form option −> value (see Section 2.7.6).
To visualize the transient waveforms of the node voltages V$1 and V$2 in the simulated time interval
we can use TransientPlot as shown below. By default, all waveforms are superimposed in one
single graph.
In[8]:= TransientPlot[solutions, {V$1[t], V$2[t]},
{t, 0., 2.*10^−5}]

0.5
V$1[t]

t
-6 0.00001 0.000015 0.00002
5. 10 V$2[t]
-0.5

-1

Out[8]= … Graphics …

Quasi-DC Analysis
To demonstrate the influence of the capacitor C1 on the output voltage we rerun the simulation,
but this time we neglect the dynamic components of the circuit equations. This can be achieved
by setting the NDAESolve option AnalysisMode from its default value Transient to DC. The DC
analysis method replaces all time derivatives in the circuit equations by zero. Thus, inductors are
replaced by short circuits because all inductor voltages are set to zero, and capacitors are replaced
by open circuits because all capacitor currents are set to zero.

¶IL (t) DC
~
Inductor: VL (t) = L =Þ VL (t) = 0 = Short Circuit
¶t
¶UC (t) DC
~
Capacitor: IC (t) = C =Þ IC (t) = 0 = Open Circuit
¶t

Let’s apply quasi-DC analysis to our rectifier circuit by specifying the above-mentioned option in the
call to NDAESolve .
In[9]:= solDC = NDAESolve[rectifierMNA /. Vin −> Sin[10^6 t],
{t, 0., 10^−5}, AnalysisMode −> DC]

88V$1 ® InterpolatingFunction@880., 0.00001<<, <>D,


Out[9]=

V$2 ® InterpolatingFunction@880., 0.00001<<, <>D,


I$V0 ® InterpolatingFunction@880., 0.00001<<, <>D,
I$AC$D1 ® InterpolatingFunction@880., 0.00001<<, <>D<<
110 2. Tutorial

The influence of the capacitor C1 can be clearly recognized from the plot of the node voltages V$1
and V$2.
In[10]:= TransientPlot[solDC, {V$1[t], V$2[t]}, {t, 0., 10^−5}]

0.5
V$1[t]

t
-6 -6 -6 -6 0.00001
2. 10 4. 10 6. 10 8. 10 V$2[t]
-0.5

-1

Out[10]= … Graphics …

2.7.2 Analysis of a Differential Amplifier

Transient Analysis
In this section, we want to examine a more complicated circuit to demonstrate the features and
capabilities of the DAE solver. Consider the differential amplifier circuit shown in Figure 7.2
consisting of four bipolar junction transistors. We shall compute the transient response Vout (t)
to a rectangular voltage pulse applied at node 1.
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 111

VCC RC1 RC2 RBIAS

4 5

Vout
Cload
1
RS1 3
Q1 Q2
2
V1 RS2
6

Q3 Q4

9
VEE

Figure 7.2: Differential amplifier circuit

Again we start by writing a netlist (of course we could have used ReadNetlist as well). Let the
values of the circuit elements be given as RS1 = RS2 = 1 kW, RC1 = RC2 = 10 kW, RBIAS = 20 kW, and
CLOAD = 5 pF. The supply voltages are VCC = 12 V and VEE = -12 V. For all transistors Q1,      , Q4,
we use the full Gummel-Poon transistor model implemented in the Analog Insydes model library
(see Section 4.3.2). We assume the following model parameter values: transport saturation current
IS = 14.34 × 10-15 A, large-signal forward and reverse current gains BF = 255.9 and BR = 6.092, and
the global temperature TEMP = 300.15 K.
112 2. Tutorial

In[11]:= diffAmp =
Circuit[
Netlist[
{RS1, {1, 2}, Symbolic −> RS1, Value −> 1.*10^3},
{RS2, {3, 0}, Symbolic −> RS2, Value −> 1.*10^3},
{RC1, {4, 8}, Symbolic −> RC1, Value −> 1.*10^4},
{RC2, {5, 8}, Symbolic −> RC2, Value −> 1.*10^4},
{RBIAS, {7, 8}, Symbolic −> RBIAS, Value −> 2.*10^4},
{CLOAD, {4, 5},
Symbolic −> CLOAD, Value −> 5.*10^−12},
{Q1, {4 −> C, 2 −> B, 6 −> E}, Model −> BJT,
Selector −> GummelPoon, Parameters −> BJTNPN},
{Q2, {5 −> C, 3 −> B, 6 −> E}, Model −> BJT,
Selector −> GummelPoon, Parameters −> BJTNPN},
{Q3, {6 −> C, 7 −> B, 9 −> E}, Model −> BJT,
Selector −> GummelPoon, Parameters −> BJTNPN},
{Q4, {7 −> C, 7 −> B, 9 −> E}, Model −> BJT,
Selector −> GummelPoon, Parameters −> BJTNPN},
{VCC, {8, 0}, Type −> VoltageSource,
Symbolic −> VCC, Value −> 12.},
{VEE, {9, 0}, Symbolic −> VEE, Value −> −12.},
{V1, {1, 0}, V1}
],
ModelParameters[Name −> BJTNPN, Type −> "NPN",
BF −> 255.9, BR −> 6.092, IS −> 14.34*10^−15],
GlobalParameters[TEMP −> 300.15]
]
Out[11]= … Circuit …

Setting up the circuit equations in the time-domain yields the following DAE system of 32 equations
in 32 variables.
In[12]:= diffAmpMNA = CircuitEquations[diffAmp,
AnalysisMode −> Transient]
Out[12]= … DAE@Transient, †32 ´ 32‡D …

Next, we define the input signal V1 (t). We choose a rectangular voltage pulse with an amplitude
of 2 V, a duration of 4 Μs and a delay of 2.5 Μs. This waveform can be set by the Analog Insydes
command PulseWave (Section 4.1.3).
In[13]:= Vpulse[t_] :=
PulseWave[t, 0, 2, 2.5*10^−6, 0, 0, 4.*10^−6, 10^−5]
A graphical representation of the stimulus signal is shown below.
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 113

In[14]:= TransientPlot[Vpulse[t], {t, 0., 10^−5},


PlotRange −> {−1, 3}]

2.5

1.5

1
Vpulse[t]

0.5

t
-6 -6 -6 -6 0.00001
2. 10 4. 10 6. 10 8. 10
-0.5

-1

Out[14]= … Graphics …

Then, we call
NDAESolve to simulate the transient behavior of the differential amplifier for t Î [0, 10 Μs]. The
NonlinearMethod option allows for choosing between different algorithms for solving systems of
nonlinear algebraic equations numerically. By default, Mathematica’s numerical solver FindRoot is
applied, whereas in this example we want to make use of another implementation of Newton’s
method called NewtonIteration .
In[15]:= transient = NDAESolve[diffAmpMNA /. V1 −> Vpulse[t],
{t, 0., 10^−5}, NonlinearMethod −> NewtonIteration];
Now, we use TransientPlot to plot the waveforms of the input and output voltages V$1 and V$5.
In[16]:= TransientPlot[transient, {V$1[t], V$5[t]},
{t, 0., 10^−5}]

12

10

8 V$1[t]

4 V$5[t]

t
-6 -6 -6 -6 0.00001
2. 10 4. 10 6. 10 8. 10

Out[16]= … Graphics …

DC-Transfer Analysis
Next, we shall compute the DC-transfer characteristic Vout (Vin ) = V$5[V1] of the differential
amplifier circuit as the input voltage is swept from -0.5 V to +0.5 V. Therefore, we first set up the
static circuit equations by calling CircuitEquations with the option setting AnalysisMode −> DC.
114 2. Tutorial

Additionally, we formulate symbolic equations by setting ElementValues −> Symbolic. The option
setting Symbolic −> None causes all device model parameters to be replaced by their numerical
values.
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 115

In[17]:= staticequations = CircuitEquations[diffAmp,


AnalysisMode −> DC, ElementValues −> Symbolic,
Symbolic −> None];
DisplayForm[staticequations]
Out[18]//DisplayForm=
99I$V1 + €€€€€€€€€€€€€€€€
V$1 - V$2 -V$1 + V$2
€€€€€€€€ == 0, I$BS$Q1 + €€€€€€€€€€€€€€€€ €€€€€€€€€€€ == 0,
RS1 RS1
V$3 V$4 - V$8
I$BS$Q2 + €€€€€€€€€€ == 0, I$CS$Q1 + €€€€€€€€€€€€€€€€ €€€€€€€€ == 0,
RS2 RC1
V$5 - V$8
I$CS$Q2 + €€€€€€€€€€€€€€€€ €€€€€€€€ == 0, I$CS$Q3 + I$ES$Q1 + I$ES$Q2 == 0,
RC2
V$7 - V$8
I$BS$Q3 + I$BS$Q4 + I$CS$Q4 + €€€€€€€€€€€€€€€€ €€€€€€€€ == 0,
RBIAS
-V$4 + V$8 -V$5 + V$8 -V$7 + V$8
I$VCC + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0,
RC1 RC2 RBIAS
I$ES$Q3 + I$ES$Q4 + I$VEE == 0, -I$BS$Q1 - I$CS$Q1 - I$ES$Q1 == 0,

ic$Q1 == 1.434 ´ 10-14 H-1. + ã38.6635 HV$2-V$6L L - 1.16415


I$BS$Q1 == ib$Q1, -I$BS$Q1 - I$ES$Q1 == ic$Q1,

I1.434 ´ 10-14 H-1. + ã38.6635 HV$2-V$4L L + 1. ´ 10-12 HV$2 - V$4LM +


1. ´ 10-12 HV$2 - V$6L, ib$Q1 == 0.16415 I1.434 ´ 10-14
H-1. + ã38.6635 HV$2-V$4L L + 1. ´ 10-12 HV$2 - V$4LM + 0.00390778
I1.434 ´ 10-14 H-1. + ã38.6635 HV$2-V$6L L + 1. ´ 10-12 HV$2 - V$6LM,
-I$BS$Q2 - I$CS$Q2 - I$ES$Q2 == 0, I$BS$Q2 == ib$Q2,

ic$Q2 == 1.434 ´ 10-14 H-1. + ã38.6635 HV$3-V$6L L - 1.16415


-I$BS$Q2 - I$ES$Q2 == ic$Q2,

I1.434 ´ 10-14 H-1. + ã38.6635 HV$3-V$5L L + 1. ´ 10-12 HV$3 - V$5LM +


1. ´ 10-12 HV$3 - V$6L, ib$Q2 == 0.16415 I1.434 ´ 10-14
H-1. + ã38.6635 HV$3-V$5L L + 1. ´ 10-12 HV$3 - V$5LM + 0.00390778
I1.434 ´ 10-14 H-1. + ã38.6635 HV$3-V$6L L + 1. ´ 10-12 HV$3 - V$6LM,
-I$BS$Q3 - I$CS$Q3 - I$ES$Q3 == 0, I$BS$Q3 == ib$Q3,

ic$Q3 == 1.434 ´ 10-14 H-1. + ã38.6635 HV$7-V$9L L - 1.16415


-I$BS$Q3 - I$ES$Q3 == ic$Q3,

I1.434 ´ 10-14 H-1. + ã38.6635 H-V$6+V$7L L + 1. ´ 10-12 H-V$6 + V$7LM +


1. ´ 10-12 HV$7 - V$9L, ib$Q3 == 0.16415 I1.434 ´ 10-14
H-1. + ã38.6635 H-V$6+V$7L L + 1. ´ 10-12 H-V$6 + V$7LM + 0.00390778
I1.434 ´ 10-14 H-1. + ã38.6635 HV$7-V$9L L + 1. ´ 10-12 HV$7 - V$9LM,
-I$BS$Q4 - I$CS$Q4 - I$ES$Q4 == 0, I$BS$Q4 == ib$Q4,

ic$Q4 == 0. + 1.434 ´ 10-14 H-1. + ã38.6635 HV$7-V$9L L +


-I$BS$Q4 - I$ES$Q4 == ic$Q4,

1. ´ 10-12 HV$7 - V$9L, ib$Q4 == 0. + 0.00390778


I1.434 ´ 10-14 H-1. + ã38.6635 HV$7-V$9L L + 1. ´ 10-12 HV$7 - V$9LM,
V$8 == VCC, V$9 == VEE, V$1 == V1=, 8V$1, V$2, V$3, V$4, V$5, V$6,
V$7, V$8, V$9, I$BS$Q1, I$CS$Q1, I$ES$Q1, ib$Q1,
ic$Q1, I$BS$Q2, I$CS$Q2, I$ES$Q2, ib$Q2, ic$Q2,
I$BS$Q3, I$CS$Q3, I$ES$Q3, ib$Q3, ic$Q3, I$BS$Q4,

DesignPoint ® 8RS1 ® 1000., RS2 ® 1000., RC1 ® 10000.,


I$CS$Q4, I$ES$Q4, ib$Q4, ic$Q4, I$VCC, I$VEE, I$V1<,

RC2 ® 10000., RBIAS ® 20000., CLOAD ® 5. ´ 10-12 ,


VCC ® 12., VEE ® -12., V1 ® V1, TEMP ® 300.15<=
116 2. Tutorial

Then, we run NDAESolve sweeping the parameter V1 in the interval [-0.5 V, 0.5 V]. Note that the
sweep variable can be any network parameter, for instance a voltage or current source parameter, a
model parameter, or even any unknown in the system of equations.
In[19]:= dctransfer = NDAESolve[staticequations, {V1, −0.5, 0.5}];

To display the DC-transfer curve graphically we again apply the function TransientPlot . For our
DC-transfer analysis we want to plot the output voltage V$5 versus the input voltage V1:
In[20]:= TransientPlot[dctransfer, {V$5[V1]}, {V1, −0.5, 0.5}]

12

10

6 V$5[V1]

V1
-0.4 -0.2 0.2 0.4

Out[20]= … Graphics …

The resulting plot shows the typical tanh-shaped transfer characteristic of this type of differential
amplifier.

Parametric Analyses
Finally, we demonstrate the usage of NDAESolve for carrying out parametric analyses. As an example,
we perform a parametric analysis of the above computed DC-transfer characteristic V$5[V1]. As

VCC Î 810 V, 11 V, 12 V<. Note that for parametric analyses NDAESolve returns a multi-dimensional
additional sweep parameter we choose the positive reference voltage VCC which shall take the values

data object (see Section 3.7.1).


2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 117

In[21]:= paramdctransfer = NDAESolve[staticequations,


{V1, −0.5, 0.5}, {VCC, {10, 11, 12}}]

88V$1 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,


Out[21]=

V$2 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,


V$3 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
V$4 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
V$5 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
V$6 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
V$7 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
V$8 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
V$9 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$BS$Q1 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$CS$Q1 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$ES$Q1 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
ib$Q1 ® InterpolatingFunction@88-0.5, 0.5<<, <>D, †8‡,
I$ES$Q3 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
ib$Q3 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
ic$Q3 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$BS$Q4 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$CS$Q4 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$ES$Q4 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
ib$Q4 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
ic$Q4 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$VCC ® InterpolatingFunction@88-0.5, 0.5<<, <>D,
I$VEE ® InterpolatingFunction@88-0.5, 0.5<<, <>D,

SweepParameters ® 8VCC ® 10.<<, 8†1‡<, †1‡<


I$V1 ® InterpolatingFunction@88-0.5, 0.5<<, <>D,

The above generated multi-dimensional data format is supported by TransientPlot . Thus, we can
display all sweep traces of the DC-transfer characteristic in a single plot.
In[22]:= TransientPlot[paramdctransfer, {V$5[V1]},
{V1, −0.5, 0.5}]

12

10

6 V$5[V1]

V1
-0.4 -0.2 0.2 0.4

Out[22]= … Graphics …
118 2. Tutorial

2.7.3 Flow of Transient Circuit Analysis

A Summary of the Transient Analysis Procedure


In this subsection, we summarize the steps which are necessary to perform a transient analysis of a
dynamic circuit with Analog Insydes.
1) Write a netlist of the circuit to be simulated, specifying numerical values for all circuit elements or
use ReadNetlist (Section 3.10.1) for automatically importing netlists from external simulator files.
circuit =
Circuit[
Netlist[     ],
Model[     ],
   
]

2) Set up a system of time-domain circuit equations using CircuitEquations with the option
setting AnalysisMode −> Transient . For numerical circuit simulation you should use modified
nodal analysis, which is the default formulation. Modified nodal equations are smaller in size and
therefore require less simulation time.
mnaequations =
CircuitEquations[circuit, AnalysisMode −> Transient]

3) Apply the command NDAESolve to the circuit equations to calculate the transient solution in the
time interval t Î [t0 , t1 ], where t0 is usually zero.
transient = NDAESolve[mnaequations, {t, t0 , t1 }]
4) Use TransientPlot for transient waveform display. Select the variables to be plotted by means
of the list vars and specify the display time interval [ta , tb ]. The latter need not be the same as
the simulation time interval [t0 , t1 ]. You can use any other values for ta and tb to zoom in onto a
particular section of a trace as long as the condition t0 £ ta < tb £ t1 holds.
TransientPlot[transient, vars, {t, ta , tb }]

NDAESolve Program Flow


Now, let’s take a closer look at the strategy NDAESolve employs to integrate a system of differential
and algebraic equations. The main idea behind the algorithm is to transform the problem of solving
a nonlinear system of differential and algebraic equations into a sequence of linear and purely algebraic
problems which can be solved rather easily. The transformation is carried out in two stages. In
the first step, the differential equations are discretized by replacing all time derivatives with a finite
difference approximation. The differential equations are thus evaluated and solved at discrete time
steps only. The finite difference approximation scheme used by NDAESolve is an implicit integration
method known as the trapezoidal rule. In a second step the resulting nonlinear algebraic system of
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 119

equations is then solved for the voltages and currents using the multi-dimensional Newton-Raphson
method.
Circuit equations are usually stiff, which means that their solutions involve both very rapid and very
slow transients. To avoid loss of accuracy and convergence problems during rapid transients as well
as excessive computation time requirements for slow transients the step size is chosen adaptively at
each time step according to the curvature of the waveform. Whenever a waveform changes quickly
the step size is cut back whereas it is increased during periods of latency. The behavior of the
step size control algorithm depends on the values of five parameters which will be discussed in the
following section. The associated NDAESolve options by which the default parameter settings can be
changed are StartingStepSize , MaxStepSize , MinStepSize , StepSizeFactor , and MaxDelta.
Figure 7.3 shows a flow graph of the algorithm implemented in NDAESolve .
120 2. Tutorial

input of circuit netlist

set up time-domain
circuit equations

compute initial transient solution


= DC operating point

substitute time derivatives


at time step t using trapezoidal method

solve nonlinear system of iteration time step


equations at time step t
i++ t+=h
using Newton’s method

no
convergence Y
AND i<imax

N
step size control
i==imax
Y h = StepSizeFactor
or
N h *= StepSizeFactor

store solution at time step t

Y
t<tmax
N

interpolation of data

output of solutions as
interpolated functions

Figure 7.3: NDAESolve program flow


2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 121

2.7.4 NDAESolve Options

Options[NDAESolve]
Several options are available for NDAESolve most of which need not be changed unless there are
problems with the default settings, such as convergence problems. To list all options associated with
NDAESolve inspect the value of Options[NDAESolve] :
In[23]:= Options[NDAESolve]

8AccuracyGoal ® 6, AnalysisMode ® Transient,


Out[23]=

BreakOnError ® False, Compiled ® True, CompressEquations ® False,


DesignPoint ® Automatic, InitialConditions ® Automatic,

InterpolationOrder ® 1, MaxDelta ® 1., MaxIterations ® 8100, 20<,


InitialGuess ® Automatic, InitialSolution ® Automatic,

MaxSteps ® Automatic, MaxStepSize ® Automatic,


MinStepSize ® Automatic, NonlinearMethod ® FindRoot,

RandomFunction ® HRandom@Real, 80., 0.1<D &L,


OutputVariables ® All, Protocol ® Inherited@AnalogInsydesD,

ReturnDerivatives ® False, Simulator ® Inherited@AnalogInsydesD,


SimulatorExecutable ® Automatic, StartingStepSize ® Automatic,
StepSizeFactor ® 1.5, WorkingPrecision ® 16<

Below, a set of NDAESolve options is explained in more detail:

InitialGuess
With the default setting InitialGuess −> Automatic , zero is used as initial guess for all variables
when solving a system of nonlinear equations by means of Newton iterations. Whenever this setting
causes numerical problems, such as division-by-zero errors or failure to converge, you can use
InitialGuess to specify your own initial guess as a list of rules of the form:
InitialGuess −> {var1 −> value1 ,       , varn −> valuen }
Note that the variables vari are specified without the time variable tvar.

InitialSolution
With the option InitialSolution we can force NDAESolve to use a certain DC solution as initial
operating point for a transient analysis. A set of initial values must be provided as a list of rules
which associate a numerical value with a variable from the system of equations. Missing variables
are then computed consistently.
InitialSolution −> {var1 −> value1 ,       , varn −> valuen }
Note that the variables vari are specified without the time variable tvar.

MaxDelta
One of the conditions that are checked by the integration step size control mechanism is whether the
values of some variables change abruptly from one time step to the next. The maximum allowed
122 2. Tutorial

difference between two successive values is controlled by the option MaxDelta. The default setting
is MaxDelta −> 1.0. This value is large enough to allow sudden steps of input voltages which are
quite usual in the case of pulse excitations.

MaxIterations
The option MaxIterations specifies the maximum number of steps that the nonlinear equation

a list of two integers 8int1 , int2 <. If it is specified as a single integer int then it is equivalent to the
solver should use in attempting to find a solution. The option setting can either be an integer int or

list 8int, int<. The first integer value defines the iteration limit for finding a DC operating point and
the second integer value the iteration limit for transient computations, respectively. If the number
of iterations for the operating-point computation exceeds the limit, an error message is generated
and the computation is interrupted. If the iteration limit for transient computations is exceeded,
the step size is reduced by the factor given by the option StepSizeFactor . The default setting is
MaxIterations −> {100, 20}.

MaxSteps
The option MaxSteps limits the total number of integration steps. The simulation is stopped
immediately if the limit is exceeded. The default setting is MaxSteps −> Automatic , which means
MaxSteps = /t1 - t0 / × StartingStepSize -1 .

MaxStepSize
It is sometimes possible to speed up simulations by allowing a larger maximum integration step size.
With the option MaxStepSize the present step size limit can be extended or reduced. The default
setting is MaxStepSize −> Automatic , which means MaxStepSize = /t1 - t0 / × 10-2 .

MinStepSize
The lower limit of the integration step size can be specified by the option MinStepSize . NDAESolve
stops a simulation immediately if the integration step size falls below this limit. The default setting
is MinStepSize −> Automatic , which means MinStepSize = /t1 - t0 / × 10-5 .

NonlinearMethod
The option NonlinearMethod chooses among different numerical algorithms for solving the nonlinear
algebraic systems of equations which arise due to the discretization of DAEs. By default, Mathe-
matica’s numerical solver FindRoot is used for this purpose. Alternatively, you can employ Analog
Insydes’ own implementation of the multi-dimensional Newton-Raphson method by specifying
NonlinearMethod −> NewtonIteration .
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 123

Protocol
With the option setting Protocol −> Notebook , NDAESolve can be instructed to print protocol
information to your notebook as the computation proceeds. The protocol includes an output of the
initial guess, the initial transient solution, shows the percentage of the computation completed, and
the number of time steps which were necessary to carry out the computation. The default setting is
Protocol −> Inherited[AnalogInsydes] which means that NDAESolve inherits the option setting
from the global setting specified in Options[AnalogInsydes] . See also Section 3.14.5.

StartingStepSize
The option StartingStepSize helps to overcome convergence problems at the beginning of a
simulation. If NDAESolve fails to converge during the first time step you can use
StartingStepSize to specify a smaller value for the initial integration step size. The default setting
is StartingStepSize −> Automatic , which means StartingStepSize = /t1 - t0 / × 10-3 .

StepSizeFactor
To reduce computation time and increase simulation accuracy NDAESolve employs an automatic step
size control scheme. If the estimated simulation error in between two integration time steps is very
low then the step size is increased. On the other hand, if the estimated error is too large the step
size is cut back. Increasing and reducing the step size is performed by multiplying or dividing the
current step size by a factor given by the value of the option StepSizeFactor . The default setting
is StepSizeFactor −> 1.5.

2.7.5 Transient Analysis with Initial Conditions

Circuits with Initial Conditions


The handling of initial conditions was rather complicated with version 1 of Analog Insydes.
Therefore, the netlist format was extended to treat initial conditions of dynamic circuit elements
such as capacitors or inductors. This is done by specifying the setting InitialCondition −> value
in the option field of the particular netlist entry (see Section 3.1.4).
Consider the RLC circuit shown in Figure 7.4. The initial voltage VC1 across the capacitor C1 at t = 0
is given as VC1 = Vic . Assume that the following numerical values are given for the circuit elements:
R1 = 1 W, L1 = 10 ΜH, C1 = 0.3 ΜF, and Vic = 2 mV.
124 2. Tutorial

Vic

1 2

L1 C1 R1
Iout

Figure 7.4: Oscillator circuit with initial condition

We start with writing a circuit netlist which includes the initial condition of the capacitor C1.
In[24]:= oscillator =
Netlist[
{L1, {0, 1}, Symbolic −> L1, Value −> 1.*10^−5},
{C1, {1, 2}, Symbolic −> C1, Value −> 3.*10^−7,
InitialCondition −> 0.002},
{R1, {2, 0}, Symbolic −> R1, Value −> 1.}
]
Out[24]= … Netlist@Raw, †3‡D …

Following, we distinguish two alternatives for considering initial conditions of dynamic circuit
elements.

Initial Conditions for some Dynamic Elements


With the option setting InitialConditions −> Automatic the function CircuitEquations can be
instructed to use initial conditions for those elements for which such a condition has been specified
in the netlist entry. All others are then computed consistently by NDAESolve . For our example, we
set up a system of modified nodal equations from the circuit configuration at the time t = 0.
In[25]:= oscillatorMNA1 = CircuitEquations[oscillator,
AnalysisMode −> Transient, ElementValues −> Symbolic,
InitialConditions −> Automatic];
DisplayForm[oscillatorMNA1]

99-I$L1@tD + C1 HV$1 @tD - V$2 @tDL == 0,


Out[26]//DisplayForm=
¢ ¢

€€€€€€€€€€€€€€€€€€ + C1 H-V$1 @tD + V$2 @tDL == 0, V$1@tD + L1 I$L1 @tD == 0,


V$2@tD ¢ ¢ ¢

V$1@0D - V$2@0D == 0.002=, 8V$1@tD, V$2@tD, I$L1@tD<,


R1

DesignPoint ® 8L1 ® 0.00001, C1 ® 3. ´ 10-7 , R1 ® 1.<=


2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 125

Note that the initial condition for the capacitor C1 is given by the node voltage difference
V$1[0] - V$2[0] and is included in the set of time-domain equations. Applying NDAESolve yields
the following DC operating-point values for the node voltages and the initial inductor current I$L1:

Out[27]= 88V$1 ® 0., V$2 ® -0.002, I$L1 ® -0.002<<


In[27]:= NDAESolve[oscillatorMNA1, {t, 0.}]

For the DC analysis the inductor was replaced by a short circuit, therefore V$1 is zero. I$L1 has
the same numerical value as V$2 because the resistor has the unit value 1 W. Now, we compute the
transient response:
In[28]:= transient1 = NDAESolve[oscillatorMNA1, {t, 0., 10^−4}]

88V$1 ® InterpolatingFunction@880., 0.0001<<, <>D,


Out[28]=

V$2 ® InterpolatingFunction@880., 0.0001<<, <>D,


I$L1 ® InterpolatingFunction@880., 0.0001<<, <>D<<

Finally, we plot the transient waveform of the output current Iout (given by the inductor current I$L1)
in the simulated time interval.
In[29]:= TransientPlot[transient1, {I$L1[t]}, {t, 0., 10^−4},
PlotRange −> All]

0.0015

0.001

0.0005

t
0.00002 0.00004 0.00006 0.00008 0.0001 I$L1[t]
-0.0005

-0.001

-0.0015

-0.002

Out[29]= … Graphics …

Initial Conditions for all Dynamic Elements


Alternatively, the function CircuitEquations can be instructed to use initial conditions for all
dynamic elements by applying the option setting InitialConditions −> All. Initial conditions
which are not explicitly specified in the netlist are then assumed to be zero. For our example, we
again set up a system of modified nodal equations from the circuit configuration at the time t = 0.
126 2. Tutorial

In[30]:= oscillatorMNA2 = CircuitEquations[oscillator,


AnalysisMode −> Transient, ElementValues −> Symbolic,
InitialConditions −> All];
DisplayForm[oscillatorMNA2]

99-I$L1@tD + C1 HV$1 @tD - V$2 @tDL == 0,


Out[31]//DisplayForm=
¢ ¢

€€€€€€€€€€€€€€€€€€ + C1 H-V$1 @tD + V$2 @tDL == 0, V$1@tD + L1 I$L1 @tD == 0,


V$2@tD ¢ ¢ ¢

I$L1@0D == 0, V$1@0D - V$2@0D == 0.002=, 8V$1@tD, V$2@tD,


R1

I$L1@tD<, DesignPoint ® 8L1 ® 0.00001, C1 ® 3. ´ 10-7 , R1 ® 1.<=

Note that this time the time-domain equations contain not only the initial condition for the
capacitor C1 (given by the node voltage difference V$1[0] - V$2[0]) but also an initial condition for
the inductor current I$L1[0]. Now, we compute the DC operating point and the transient response
by applying NDAESolve .

Out[32]= 88V$1 ® 0.002, V$2 ® 0., I$L1 ® 0.<<


In[32]:= NDAESolve[oscillatorMNA2, {t, 0.}]

In[33]:= transient2 = NDAESolve[oscillatorMNA2, {t, 0., 10^−4}]

88V$1 ® InterpolatingFunction@880., 0.0001<<, <>D,


Out[33]=

V$2 ® InterpolatingFunction@880., 0.0001<<, <>D,


I$L1 ® InterpolatingFunction@880., 0.0001<<, <>D<<

Finally, we plot the output current.


In[34]:= TransientPlot[transient2, {I$L1[t]}, {t, 0., 10^−4},
PlotRange −> All]

0.0002

0.0001

t
0.00002 0.00004 0.00006 0.00008 0.0001 I$L1[t]
-0.0001

-0.0002

-0.0003

Out[34]= … Graphics …

Please note the different transient waveforms dependent on the usage of initial conditions.
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 127

2.7.6 TransientPlot Options

Options[TransientPlot]
As was shown previously, the function TransientPlot provides a convenient way for displaying
results of NDAESolve or NDSolve computations. The appearance of TransientPlot graphics can be
changed with the following set of options:
In[35]:= Options[TransientPlot]

9AspectRatio ® €€€€€€€€€€€€€€€€
Out[35]=
1
€€€€€€€€€€€€€€€€€ , Axes ® True,
GoldenRatio
AxesLabel ® None, AxesOrigin ® Automatic, AxesStyle ® Automatic,

Compiled ® True, DefaultColor ® Automatic, Epilog ® 8<,


Background ® GrayLevel@0.92D, ColorOutput ® Automatic,

Frame ® False, FrameLabel ® None, FrameStyle ® Automatic,


FrameTicks ® Automatic, GridLines ® None,
ImageSize ® Automatic, MaxBend ® 10., PlotDivision ® 30.,

PlotRegion ® Automatic, PlotStyle ® 88RGBColor@1., 0., 0.D,


PlotLabel ® None, PlotPoints ® 30, PlotRange ® Automatic,

8RGBColor@0., 0., 1.D, AbsoluteThickness@1.D,


AbsoluteThickness@1.D, AbsolutePointSize@3.D<,

8RGBColor@0., 0.8, 0.D, AbsoluteThickness@1.D,


AbsoluteDashing@810., 8.<D, AbsolutePointSize@3.D<,

8RGBColor@0.7, 0., 0.9D, AbsoluteThickness@1.D,


AbsoluteDashing@84., 8.<D, AbsolutePointSize@3.D<,

Prolog ® 8<, RotateLabel ® True, Ticks ® Automatic,


AbsoluteDashing@810., 8., 4., 8.<D, AbsolutePointSize@3.D<<,

DefaultFont ¦ $DefaultFont, DisplayFunction ¦ $DisplayFunction,


FormatType ¦ $FormatType, TextStyle ¦ $TextStyle,
GraphicsSpacing ® 0.1, Parametric ® False,
ShowLegend ® True, ShowSamplePoints ® False,
SingleDiagram ® True, SweepParameters ® Automatic=

Most options are standard options of Graphics objects. Therefore, we will restrict ourselves to the
discussion of the remaining keywords Parametric , ShowSamplePoints , and SingleDiagram .

Parametric
With Parametric −> True parametric plots of two interpolating functions can be displayed. In this
case, TransientPlot requires a list of two display variables xvar and yvar, where xvar denotes
the x-axis variable and yvar the y-axis variable. TransientPlot then shows a trace of the points
{xvar[par], yvar[par]} as the parameter par is swept from par0 to par1 .
TransientPlot[numericaldata, {xvar[par], yvar[par]},
{par, par0 , par1 }, Parametric −> True]
The axes are automatically labeled by the specified variable names. As an example we perform a
parametric plot of the transient response of the diode rectifier circuit introduced in Section 2.7.1 (see
Figure 7.1).
128 2. Tutorial

In[36]:= TransientPlot[solutions, {V$1[t], V$2[t]},


{t, 10^−6, 10^−5}, Parametric −> True]

V$2[t]
0.4

0.35

0.3

0.25

V$1[t]
-1 -0.5 0.5 1

Out[36]= … Graphics …

ShowSamplePoints
Changing the default setting of the option ShowSamplePoints from False to True allows for
visualizing the sample points stored in InterpolatingFunction objects. By this, the variation of the
step size in a computed interval can be observed. The simulation data is displayed via Mathematica’s
ListPlot .
In[37]:= TransientPlot[solutions, {V$1[t], V$2[t]},
{t, 0., 2.*10^−5}, ShowSamplePoints −> True]

0.5
V$1[t]

t
-6 0.00001 0.000015 0.00002
5. 10 V$2[t]
-0.5

-1

Out[37]= … Graphics …

SingleDiagram
With the option
SingleDiagram you can choose whether to combine the traces of several interpolating functions in a
single diagram or display them in a separate plot each. The default SingleDiagram −> True causes
all traces to be combined. To display an array of plots use SingleDiagram −> False. Note that it
is possible to generate not only plots of circuit variables, but also plots of expressions involving
2.7 Time-Domain Analysis of Nonlinear Dynamic Circuits 129

these variables. For example, the following graphics array contains a plot of the voltage across the
capacitor Cload of the differential amplifier circuit from Section 2.7.2 (see Figure 7.2). The capacitor
voltage is given by the difference of the node voltages V$5 and V$4.
In[38]:= TransientPlot[transient, {V$4[t], V$5[t] − V$4[t]},
{t, 0., 10^−5}, SingleDiagram −> False]

4
V$4[t]
3

t
-6 -6 -6 -6 0.00001
2. 10 4. 10 6. 10 8. 10

10

4
V$5[t] - V$4[t]
2

t
-6 -6 -6 -6 0.00001
2. 10 4. 10 6. 10 8. 10

Out[38]= … GraphicsArray …
130 2. Tutorial

2.8 Linear Symbolic Approximation

2.8.1 Introduction to Symbolic Approximation

The Complexity Problem


If you have previous experiences with symbolic circuit analysis programs or if you have done some
experiments with Analog Insydes before reading this chapter you may have already become aware
of a major obstacle which is inherent to symbolic computations. While the carefully selected example
circuits analyzed in the preceding chapters all yield transfer functions of no more than a few lines
in length minor modifications such as adding an element or two to the circuit or choosing a slightly
more complex transistor model may already lead to expressions of incredible size. In fact, expression
complexity increases exponentially with the number of symbols in your circuit descriptions, allowing
for full symbolic analysis of very small circuits only.

RC
2.2k
R1 C2
100k 3 5
C1 1u
1 2 VCC
Q1
100n 4 RL Vout
47k
V1 R2 RE
47k 1k

Figure 8.1: Common-emitter amplifier with coupling capacitors and resistive load

Let us demonstrate this effect by computing the symbolic voltage transfer function of the common-
emitter amplifier displayed in Figure 8.1. This circuit is essentially the same as the common-emitter
amplifier from Section 2.3.1 (see Figure 3.1) except that coupling capacitors and a resistive load have
been added.
2.8 Linear Symbolic Approximation 131

Following, the netlist description of the circuit is imported via the Analog Insydes command
ReadNetlist (Section 3.10.1) from already existing simulator files. For more details refer to
Section 2.9.2.
In[1]:= <<AnalogInsydes‘

In[2]:= ceamp = ReadNetlist[


"AnalogInsydes/DemoFiles/emitter.cir",
"AnalogInsydes/DemoFiles/emitter.out",
KeepPrefix −> False, Simulator −> "PSpice"]
Out[2]= … Circuit …

From the netlist description, we set up a 32 ‰ 32 system of symbolic sparse tableau equations. We
use a complexity-reduced transistor model from the Analog Insydes model library by specifying the
option ModelLibrary (Section 3.14.4).
In[3]:= ceampsta = CircuitEquations[ceamp,
ElementValues −> Symbolic, Formulation −> SparseTableau,
ModelLibrary −> "BasicModels‘"]
Out[3]= … DAE@AC, †32 ´ 32‡D …

Then we solve the equations for the output voltage V$RL and extract the expression for V$RL from
the result.
In[4]:= ceampvout = Together[
V$RL /. First[Solve[ceampsta, V$RL]]]

HC1 R1 R2 s2
Out[4]=

HC2 RC RE RL - C2 gm$Q1 RC RL Ro$Q1 Rpi$Q1 + C2 Cbc$Q1 RC RE RL Ro$Q1


s + C2 Cbx$Q1 RC RE RL Ro$Q1 s + C2 Cbc$Q1 RC RE RL Rpi$Q1 s +
C2 Cbe$Q1 RC RE RL Rpi$Q1 s + C2 Cbx$Q1 RC RE RL Rpi$Q1 s +
C2 Cbc$Q1 RC RL Ro$Q1 Rpi$Q1 s + C2 Cbx$Q1 RC RL Ro$Q1 Rpi$Q1 s +
C2 Cbc$Q1 gm$Q1 RC RE RL Ro$Q1 Rpi$Q1 s + C2 Cbx$Q1 gm$Q1 RC RE

C2 Cbe$Q1 Cbx$Q1 RC RE RL Ro$Q1 Rpi$Q1 s2 L V1L 


RL Ro$Q1 Rpi$Q1 s + C2 Cbc$Q1 Cbe$Q1 RC RE RL Ro$Q1 Rpi$Q1 s2 +

HR1 R2 RC + R1 R2 RE + R1 RC RE + R2 RC RE + R1 R2 Ro$Q1 + R1 RE Ro$Q1 +


R2 RE Ro$Q1 + R1 RC Rpi$Q1 + R2 RC Rpi$Q1 +
R1 RE Rpi$Q1 + R2 RE Rpi$Q1 + R1 Ro$Q1 Rpi$Q1 +
R2 Ro$Q1 Rpi$Q1 + gm$Q1 R1 RE Ro$Q1 Rpi$Q1 +
gm$Q1 R2 RE Ro$Q1 Rpi$Q1 + C1 R1 R2 RC RE s + †153‡ +
C2 Cbe$Q1 Cbx$Q1 R1 R2 RC RE Ro$Q1 Rpi$Q1 s3 +
C1 C2 Cbc$Q1 R1 R2 RC RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 R2 RC RL Ro$Q1 Rpi$Q1 s3 +
C1 C2 Cbx$Q1 R1 R2 RC RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbe$Q1 Cbx$Q1 R1 R2 RC RL Ro$Q1 Rpi$Q1 s3 +
C1 C2 Cbe$Q1 R1 R2 RE RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 R2 RE RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbe$Q1 Cbx$Q1 R1 R2 RE RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 RC RE RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbe$Q1 Cbx$Q1 R1 RC RE RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R2 RC RE RL Ro$Q1 Rpi$Q1 s3 +
C2 Cbe$Q1 Cbx$Q1 R2 RC RE RL Ro$Q1 Rpi$Q1 s3 +
C1 C2 Cbc$Q1 gm$Q1 R1 R2 RC RE RL Ro$Q1 Rpi$Q1 s3 +
C1 C2 Cbx$Q1 gm$Q1 R1 R2 RC RE RL Ro$Q1 Rpi$Q1 s3 +

C1 C2 Cbe$Q1 Cbx$Q1 R1 R2 RC RE RL Ro$Q1 Rpi$Q1 s4 L


C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 RC RE RL Ro$Q1 Rpi$Q1 s4 +
132 2. Tutorial

Even for this very small circuit we obtain a transfer function which contains more than 150 product
terms. If you are not impressed yet try calculating the symbolic transfer function of two amplifier
stages connected in series, or rather, use ComplexityEstimate (Section 3.11.1) to get an estimate of
the expression size.
Analog Insydes provides the command ComplexityEstimate for computing an estimate of the
number of product terms in a transfer function computed from a symbolic matrix equation A × x = b
(note that the equations have to be given as a system of AC circuit equations). More precisely, the
function computes a lower bound for the number of product terms in the determinant of A. For our
common-emitter amplifier this yields the following estimate:
In[5]:= ComplexityEstimate[ceampsta]
Out[5]= 185

A primary goal of symbolic circuit analysis is to give us qualitative insight into circuit behavior.
From a symbolic formula we can read off which circuit elements have an influence on particular
circuit characteristics, such as voltage gains or poles and zeros, and we can draw conclusions on
how to modify element values in order to make a circuit meet some performance specifications. It
is quite obvious, though, that this requires the formulas to be rather small – ideally no more than
one line on the screen – because an expression as large as the one above hardly yields any insight.
Unfortunately, there is little we can do to reduce the size of symbolic analysis results in a purely
algebraic way. Algebraic simplifications such as factoring and cancelling common terms seldom have
a sufficiently large impact on expression complexity because transfer functions are usually composed
of irreducible polynomials. In addition, factored or partially factored expressions are not necessarily
easier to understand than their expanded forms. Exact symbolic analysis is therefore infeasible for
most circuits of practical size.

Approximating Symbolic Expressions


There are two ways to cope with the complexity problem. The first one is to keep circuit and device
models always as simple as possible. Carefully balancing model accuracy and simplicity holds the
key to obtaining meaningful results from symbolic circuit analysis programs, so any knowledge about
a particular analysis task should be exploited before running the analyzer. For instance, if our task
was to find a symbolic expression describing the voltage gain of the common-emitter amplifier in the
passband frequency range for a high-impedance load we should short-circuit the coupling capacitors,
neglect the load resistor, and use a transistor model which just meets our accuracy requirements.
In other words, to obtain compact results we should model and analyze the circuit exactly like we
already did in Chapter 2.3. The major disadvantage of such a-priori simplifications on circuit level
is, however, that we cannot always control the final error in our computations which is invariably
introduced by neglecting some elements.
The second approach to the generation of interpretable formulas is known as symbolic approximation
or symbolic simplification, which refers to a whole family of hybrid symbolic/numeric algorithms for
expression simplification. Symbolic approximation techniques require more numerical knowledge
about the circuit under examination than manual simplifications but yield compact expressions with
predictable error in a fully automatic way. The basic idea behind all these algorithms is to compare
the magnitudes of symbolic terms in a transfer function or a system of equations on the basis of
2.8 Linear Symbolic Approximation 133

numerical reference values and then to discard all those terms which have negligible influence on
the result. In most cases, this leads to a dramatic reduction of expression complexity, thus allowing
for approximate symbolic analysis of reasonably large circuits.

R1
R3
V0 2 3

R2 R4

Figure 8.2: Double voltage divider

To understand how symbolic approximation works let’s look at a simple example – the transfer
function of the double voltage divider shown in Figure 8.2:
In[6]:= doubleVoltageDivider =
Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2},
{R3, {2, 3}, R3},
{R4, {3, 0}, R4}
]
Out[6]= … Netlist@Raw, †5‡D …

In[7]:= dvdmna = CircuitEquations[doubleVoltageDivider];


DisplayForm[dvdmna]

i €€€€€
j y
1z
Out[8]//DisplayForm=
j
j z
z i V$1 zy i 0 zy
j
j z j
j z j
j 0 z
0z j z j z
1 1

j z j z j z
R1€ - €€€€€
R1€ 0
j
j z
z j
j z
z j
j z
z
j
j
j z
z j
j z
z j
j z
z
j z
0z j
j z
z j
j z
z
1 1 1 1 1
- €€€€€
R1€ €€€€€
R1€ + €€€€€
R2€ + €€€€€
R3€ - €€€€€
R3€ V$2
j
j z
z j z j z
==
j z k I$V0 {
.
k V0 {
V$3 0
k 1 0{
1 1 1
0 - €€€€€
R3€ €€€€€
R3€ + €€€€€
R4€
0 0

In[9]:= tfdvd = (V$3 / V0) /. First[Solve[dvdmna, V$3]]


R2 R4
Out[9]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€
R1 R2 + R1 R3 + R2 R3 + R1 R4 + R2 R4

Without any additional knowledge about the circuit this transfer function cannot be simplified much
further algebraically. Now, let’s assume that in this particular circuit the values of R1 and R2 are
approximately equal, as well as those of R3 and R4, but that R1 and R2 have much smaller values
134 2. Tutorial

than R3 and R4: R1, R2 ` R3, R4. Under these conditions we can discard the product term R1 × R2 in
the denominator of the transfer function because it is the product of two small quantities and thus
contributes little to the total value of the expression as compared to the other terms:
In[10]:= simptfdvd = tfdvd /. R1*R2 −> 0
R2 R4
Out[10]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€
R1 R3 + R2 R3 + R1 R4 + R2 R4

The resulting function can now be factored and simplifies to a more meaningful form.
In[11]:= Factor[simptfdvd]

HR1 + R2L HR3 + R4L


R2 R4
Out[11]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€

This approximate formula holds for all sets of resistor values for which the condition R1, R2 ` R3, R4
is satisfied, but no longer in the general case. Symbolic approximation thus always implies a trade-off
between low expression complexity on the one hand and generality and precision on the other.

Numerical Reference Values: Design Points


Deciding on which terms to discard from a symbolic expression on the basis of vague information
such as "X is much larger than Y" may be feasible for humans but is virtually impossible to do for a
computer. This is particularly true when an expression contains a large number of symbols in non-
trivial combinations. To enable a computer to reduce a symbolic expression to its dominant content
we must provide input which allows for clear yes-or-no decisions on whether a term is important
or negligible. This input can be given as a set of accompanying numerical reference values for the
symbols, known as a design point, based on which the contributions of compound symbolic terms
can be compared numerically. Design-point values need not always be the exact element values for
which a circuit works within specifications. However, the reference values should reflect the relative
magnitude relations among the symbols in a realistic way.
In the case of the double voltage divider we could express the conditions on the relative magnitudes
of the resistors by an (arbitrary) numerical assignment of design-point values such as R1 = R2 = 10W
and R3 = R4 = 1000W. We rewrite the netlist of the double voltage divider keeping both a symbolic
element value and an associated design-point value together in each netlist entry.
In[12]:= doubleVoltageDivider =
Netlist[
{V0, {1, 0}, Symbolic −> V0, Value −> 1.},
{R1, {1, 2}, Symbolic −> R1, Value −> 10.},
{R2, {2, 0}, Symbolic −> R2, Value −> 10.},
{R3, {2, 3}, Symbolic −> R3, Value −> 1000.},
{R4, {3, 0}, Symbolic −> R4, Value −> 1000.}
]
Out[12]= … Netlist@Raw, †5‡D …

Now, we set up the corresponding equations using the option setting ElementValues −> Symbolic .
The design-point values are then automatically stored in the DAEObject and can be extracted via
GetDesignPoint (Section 3.6.12).
2.8 Linear Symbolic Approximation 135

In[13]:= dvdmna = CircuitEquations[doubleVoltageDivider,


ElementValues −> Symbolic]
Out[13]= … DAE@AC, †4 ´ 4‡D …

In[14]:= designpoint = GetDesignPoint[dvdmna]

8V0 ® 1., R1 ® 10., R2 ® 10., R3 ® 1000., R4 ® 1000.<


Out[14]=

With these reference values we can evaluate the symbolic expression numerically. Below, we apply
the function HoldForm to the Plus operation which prevents the denominator from being evaluated
to a single number.
In[15]:= tfdvd /. Plus −> HoldForm[Plus] /. designpoint
10000.
Out[15]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€
Plus@100., 10000., 10000., 10000., 10000.D

By comparing the individual numerical values we, as well as a computer, can now clearly see that
the first argument of the Plus expression, corresponding to the term R1 ×R2, contributes only 0.25% to
the total value of the denominator. The term can thus be safely removed from the transfer function
if we allow for an error of, say, 5% or less in the design point.

2.8.2 Solution-Based Symbolic Approximation

Groups of Symbolic Approximation Techniques


Symbolic approximation techniques can be divided into three different groups of methods which
perform Simplifications Before, During, or After the Generation of symbolic formulas (SBG, SDG,
and SAG methods). The approach discussed above is thus an SAG, or solution-based, method
because we computed the complete transfer function first and then simplified it. While the principle
behind this SAG technique was demonstrated on the transfer function of a non-dynamic system it
can be applied to general transfer functions containing powers of the frequency variable s as well.
In this case, all symbolic coefficients of the different powers of s are simplified separately up to a
given maximum error.

Approximating Transfer Functions


Analog Insydes provides the function ApproximateTransferFunction (Section 3.11.2) for solution-
based symbolic approximation. The argument sequence is
ApproximateTransferFunction[tfunc, fvar, dp, maxerr]
where tfunc is a rational transfer function in the frequency variable fvar, dp is a design-point
specification, and maxerr is the maximum relative error of the simplified coefficients of fvar in the
design point. The design point must be specified as a list of rules which associate numerical values
with the symbols in tfunc, and maxerr is a real number between 0 and 1.
136 2. Tutorial

Let’s apply solution-based approximation to the transfer function of the common-emitter amplifier
calculated in the preceding section. First, we extract the list of design-point values from the
DAEObject using GetDesignPoint .
In[16]:= dpceamp = GetDesignPoint[ceampsta]

8C1 ® 1. ´ 10-7 , C2 ® 1. ´ 10-6 , R1 ® 100000.,


Out[16]=

RC ® 2200., R2 ® 47000., Rpi$Q1 ® 2200., Ro$Q1 ® 36400.,


Cbc$Q1 ® 4.39 ´ 10-12 , Cbe$Q1 ® 7.01 ´ 10-11 , gm$Q1 ® 0.0808,
Cbx$Q1 ® 0., RE ® 1000., V1 ® 1., RL ® 47000., Simulator ® PSpice<

Then we let ApproximateTransferFunction remove all numerical insignificant terms from the
coefficients of the frequency variable s, thereby allowing for a maximum design-point error of 10%
in each coefficient. Note that a 10% coefficient error does not imply 10% error on the magnitude of
the transfer function in the design point. Ideally, the coefficient error should be a common factor
and thus cancel from numerator and denominator, yielding zero overall error in the design point.
In practice, however, there is no direct correlation between the overall error and the maximum
coefficient error. The former is usually lower than the latter but may, in some cases, even be larger.
In[17]:= voutsimp = ApproximateTransferFunction[ceampvout,
s, dpceamp, 0.1] // Together

H-C1 C2 gm$Q1 R1 R2 RC RL Rpi$Q1 s2 V1 + C1 C2 Cbc$Q1 gm$Q1 R1 R2 RC RE


Out[17]=

RL Rpi$Q1 s3 V1 + C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 RC RE RL Rpi$Q1 s4 V1L 


HR1 R2 + gm$Q1 R1 RE Rpi$Q1 + gm$Q1 R2 RE Rpi$Q1 + C2 R1 R2 RL s +
C1 gm$Q1 R1 R2 RE Rpi$Q1 s + C2 gm$Q1 R1 RE RL Rpi$Q1 s +
C2 gm$Q1 R2 RE RL Rpi$Q1 s + C1 C2 gm$Q1 R1 R2 RE RL Rpi$Q1 s2 +

RE RL Rpi$Q1 s3 + C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 RC RE RL Rpi$Q1 s4 L


C1 C2 Cbe$Q1 R1 R2 RE RL Rpi$Q1 s3 + C1 C2 Cbc$Q1 gm$Q1 R1 R2 RC

Here, the approximation process reduces the original transfer function to only 12 significant terms.
We can check the quality of the approximation by evaluating it with the design-point values and
comparing it graphically with the original function.
In[18]:= voutexactn[s_] = Together[ceampvout /. dpceamp]

I470. s2 I-6.68943 ´ 108 + 3.00693 s + 2.54816 ´ 10-9 s2 MM ‘


Out[18]=

I1.15576 ´ 1015 + 5.9939 ´ 1013 s +


1.52545 ´ 1011 s2 + 1543.08 s3 + 1.19764 ´ 10-6 s4 M

In[19]:= voutsimpn[s_] = voutsimp /. dpceamp

I-8.63878 ´ 106 s2 + 0.0379242 s3 + 3.29021 ´ 10-11 s4 M ‘


Out[19]=

I3.08307 ´ 1010 + 1.53259 ´ 109 s +


3.92672 ´ 106 s2 + 0.041331 s3 + 3.29021 ´ 10-11 s4 M

For the following BodePlot we choose a linear scaling of the magnitude values to get a better
impression of the true magnitude error. It turns out that the simplified expression (dashed line)
approximates the original transfer function (solid line) quite well, although it comprises only about
one tenth of the terms of the latter.
2.8 Linear Symbolic Approximation 137

In[20]:= BodePlot[{voutexactn[2. Pi I f], voutsimpn[2. Pi I f]},


{f, 1., 1.*10^9}, MagnitudeDisplay −> Linear]

Magnitude
1.5

0.5

0
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
-50
Phase (deg)

-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Out[20]= … Graphics …

2.8.3 Equation-Based Symbolic Approximation

Coping with the Limit of Solution-Based Approximation Techniques


Solution-based expression approximation techniques have one obvious drawback: they can only
be applied to symbolic transfer functions after these have been computed from systems of circuit
equations. This precludes the use of SAG techniques in those cases where calculating an unsimplified
symbolic transfer function is technically impossible. In practice, the limit is reached very quickly,
because even for small analog building blocks with ten or less active devices the term count of the
transfer functions can be expected to grow into the millions, if not into billions.
To cope with these cases we must resort to simplification-before-generation techniques which
simplify the problem beforehand, i.e. even before a transfer function is computed symbolically.
Such simplifications can be done manually on circuit level, for instance by replacing negligible
components with zero-admittance or zero-impedance elements. However, as controlling the error
introduced by manual simplifications is usually difficult, Analog Insydes provides an automatic and
more reliable SBG algorithm which operates on systems of symbolic circuit equations. Hence, it
belongs to the class of equation-based approximation techniques.
Given a system of symbolic linear circuit equations in matrix form A × x = b and a design point,
the equation-based approximation algorithm implemented in Analog Insydes finds and removes
all symbolic matrix entries whose numerical contribution to the design-point value of the transfer
function is negligible, thereby keeping track of the accumulated approximation error. As the number
of removed matrix entries is usually quite large the solution of the resulting simplified matrix
equation will be much less complex than the solution of the unsimplified system. Therefore, we can
calculate simplified symbolic transfer functions without ever having to compute the full expressions
138 2. Tutorial

at all. This will be illustrated by an example right after the following explanations on how to specify
design points for the matrix approximation function.

Design Points for Matrix Approximation


Since the matrix approximation algorithm can work with multiple design points with individual
error bounds, the design points must be specified in a slightly different form as compared to those
for solution-based approximation:
designpoint = {
{symbol −> value,       , MaxError −> maxerr1 },
{symbol −> value,       , MaxError −> maxerr2 },
   
}
Note that for symbols which are not specified here the corresponding design-point value is
automatically extracted from the design point stored in the DAEObject. Each set of design-
point values must be accompanied by a rule with the keyword MaxError on its left-hand side.
This rule specifies the maximum relative error by which the magnitude of the solution of the
approximated system of equations may deviate from the value of the magnitude of the transfer
function in the corresponding design point. The error bound maxerr must be a real number
greater than zero. Note that the error definition used here is different from the one used with
ApproximateTransferFunction in that it pertains to the total error on the magnitude of the entire
transfer function at certain frequencies and not to the error on individual coefficients. It is thus a
more reliable error measure than the coefficient error.
Let’s define a design point for applying matrix approximation to our double-voltage-divider example
(see Figure 8.2 in Section 2.8.1). We can use the same numerical values for the resistors and the
voltage source as we did for solution-based approximation. If we allow for up to 5% magnitude
error of the simplified result with respect to the unsimplified solution we must write the error bound
specification as MaxError −> 0.05. Note that although we have only one single design point here
we must wrap the list of rules into an additional level of list braces.
In[21]:= dpdvd = {{MaxError −> 0.05}};

Approximating Symbolic Matrix Equations


Symbolic matrix equations can be approximated by means of the command
ApproximateMatrixEquation (Section 3.11.3), which has the following command syntax:
ApproximateMatrixEquation[dae, var, dp, opts]
The first argument dae represents a DAEObject containing small-signal circuit equations in matrix
form as returned by CircuitEquations , var specifies the variable for which the equations should be
solved after approximation, and dp denotes a list of design points as discussed above. The remaining
argument opts is a sequence of options which may also be empty.
We are now ready to try out equation-based approximation on the MNA equations of the voltage
divider. For comparison, here are the original unsimplified equations again.
2.8 Linear Symbolic Approximation 139

In[22]:= DisplayForm[dvdmna]

i €€€€€
j 1y
z
Out[22]//DisplayForm=
j
j z
z i V$1 zy i 0 zy
j
j z j
j z j
j 0 z
0z j z j z
1 1

j z j z j z
R1€ - €€€€€
R1€ 0
j
j
j z
z j
j z
z j
j z
z
j
j 0 z
z j
j V$3 zz j
j 0 zz
j 0z
z j
j z
z j
j z
z
1 1 1 1 1
- €€€€€
R1€ €€€€€
R1€ + €€€€€
R2€ + €€€€€
R3€ - €€€€€
R3€ V$2
j
j z
z j z j z
==
j z k I$V0 {
.
k V0 {
k 0{
1 1 1
- €€€€€
R3€ €€€€€
R3€ + €€€€€
R4€
1 0 0

Since we are interested in a simplified solution for the voltage at the output node 3, we specify V$3
as the variable for which the equations are to be approximated.
In[23]:= approxdvd = ApproximateMatrixEquation[dvdmna,
V$3, dpdvd];
DisplayForm[approxdvd]

i
j
1y
z
Out[24]//DisplayForm=
j
j z i
j
V$1 y
z i
j
0 y
z
j
j - €€€€€ 0z
z
z j
j
j z
z
z j
j
j 0 zz
z
0 0 0
j
j z
z.j
j z
z == j
j z
z
j
j z
z j
j z
z j
j z
z
j z j z j z
1 1 1

j 0z
€ €€€€€
€ + €€€€€
R2€
j z j z
0
j z j
V$2
j 0 z z j z
R1 R1

k 1 0{ k { k {
1
- €€€€€ 1 1 V$3 0
R3€ €€€€€
R3€ + €€€€€
R4€
0 0 I$V0 V0

The result is a matrix equation from which all numerical irrelevant symbolic terms have been
removed. We can now compute a simplified transfer function directly by solving the approximated
equations.
In[25]:= Solve[approxdvd, V$3]

Out[25]= 99V$3 ® €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€


€€€€€€€€€€€€€€€€ ==
HR1 + R2L HR3 + R4L
R2 R4 V0

In this case, we obtain identical results from both equation-based and solution-based approximation.
However, as opposed to the latter, equation-based approximation does not require an exact symbolic
solution to be computed first. In such a small example this advantage makes nearly no difference,
but it will turn out to be a key factor in larger applications.

Approximating the Equations of the Amplifier


As an example for a slightly larger application let’s continue with our well-known common-emitter
amplifier once more. Again, we start by setting up a design point for
ApproximateMatrixEquation , reusing the numerical values we defined for simplifying the exact
solution with ApproximateTransferFunction . For matrix approximation, however, we still need
some more numerical information. While the SAG algorithm approximates the coefficients of a
transfer function independently, the SBG method uses the total value of a transfer function in
a design point as reference quantity. Therefore, we must specify one or more particular frequency
points at which ApproximateMatrixEquation should monitor the change in the value of the transfer
function caused by the removal of terms.
Here, we might be interested in computing a simplified expression describing the passband voltage
gain of the amplifier. The Bode plot above shows that the passband extends from about 100 Hz to
several MHz, so we choose a design-point value for the operating frequency in the middle of the
passband, e.g. at f = 10 kHz. The corresponding value for the Laplace frequency s is then given by
140 2. Tutorial

s = 2Π × I × f . Finally, we limit the approximation error in this frequency point to 10% of the original
magnitude value.
In[26]:= dpceamp2 = {{s −> 2. Pi I 10^4, MaxError −> 0.1}};

In the next step, we approximate the sparse tableau equations of the amplifier for the given design-
point data with respect to the output voltage V$RL.
In[27]:= approxceamp = ApproximateMatrixEquation[ceampsta,
V$RL, dpceamp2]
Out[27]= … DAE@AC, †32 ´ 32‡D …

Then we solve the approximated system for V$RL to obtain a simplified voltage transfer function.
In[28]:= voutsimp2 = (V$RL / V1) /. First[Solve[approxceamp, V$RL]]
RC
Out[28]= - €€€€€€€
RE

By equation-based approximation we have reduced the symbolic transfer function to the simple
quotient of two resistor values. In comparison to the original transfer function, which is composed
of more than 150 terms, this may seem to be a rather surprising result. From a technical point of
view, however, the extreme reduction of complexity is not surprising at all because the amplifier
was designed to have a voltage gain of approximately −RC/RE. Therefore, our approximate symbolic
analysis just extracted knowledge which was put into this circuit structure at the time of its design.
Again, we evaluate the simplified expression with the design-point values and compare the result
with the original transfer function.
In[29]:= voutsimp2n[s_] = voutsimp2 /. dpceamp
Out[29]= -2.2

In[30]:= BodePlot[{voutexactn[2. Pi I f], voutsimp2n[2. Pi I f]},


{f, 1., 1.*10^9}, MagnitudeDisplay −> Linear,
PlotRange −> {{0, 2.5}, Automatic}]

2.5
2
Magnitude

1.5
1
0.5

1.0E0 1.0E2 1.0E4 1.0E6 1.0E8


Frequency

0
-50
Phase (deg)

-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Out[30]= … Graphics …

It becomes immediately apparent from the plots that the result obtained by means of SBG does
not constitute a global description of the frequency response of the amplifier. As opposed to the
2.8 Linear Symbolic Approximation 141

SAG solution, the SBG solution is only valid in the passband region and does not reflect the
behavior the amplifier exhibits for very low or very high frequencies. But remember that such a
local approximation was precisely what we asked for because we specified only one reference point
on the frequency axis at 10 kHz.
Equation-based approximation thus allows us to compute reduced-order circuit models for limited
frequency ranges. Of course, we can also define several frequency points at which
ApproximateMatrixEquation monitors the approximation error in order to extend range of validity
of a simplified expression. However, best results in terms of expression complexity are usually
obtained through local approximations.

2.8.4 Combining SBG and SAG


While equation-based approximation can reduce the complexity of a symbolic expression greatly the
result may still contain some insignificant terms. So it is generally a good idea to apply solution-
based simplification to such a transfer function as well in order to remove the remaining irrelevant
contributions. The following example demonstrates the combination of SBG and SAG.
First, we use matrix approximation to compute a reduced-order transfer function of the amplifier
from Section 2.8.1 (see Figure 8.1) which is valid for the passband and also for low frequencies.
Therefore, we add a second reference point at 1 Hz to the list of design points. We allow for an error
of up to 20% in that point because we do not need high precision there.
In[31]:= dpceamp3 = {{s −> 2. Pi I 10^4, MaxError −> 0.1},
{s −> 2. Pi I 1, MaxError −> 0.2}};
In the subsequent call to ApproximateMatrixEquation we specify the option
CompressEquations −> True. The effect of this option is that all rows and columns of the matrix
equation which are not needed to compute the variable of interest will be deleted after approximation.
Unlike approximation this is a mathematically exact operation, so no further information will be lost.
The benefit gained from compressing a matrix equation is a speed-up in solving the system.
In[32]:= approxceamp3 = ApproximateMatrixEquation[ceampsta,
V$RL, dpceamp3, CompressEquations −> True]
Out[32]= … DAE@AC, †25 ´ 25‡D …

With the CompressEquations option the approximated equations are reduced from a 32 ‰ 32 to a
25 ‰ 25 system without changing the symbolic solution for V$RL. The compression factor usually
increases with larger matrix sizes and error bounds. Solving the approximated system yields the
following expression.
142 2. Tutorial

In[33]:= voutsimp3 = Together[


V$RL /. First[Solve[approxceamp3, V$RL]]]

-HC1 C2 R1 R2 RL H-RC RE s2 - RC Rpi$Q1 s2 + gm$Q1 RC Ro$Q1 Rpi$Q1 s2 L


Out[33]=

V1L  HR1 RC RE + R2 RC RE + R1 RE Ro$Q1 + R2 RE Ro$Q1 +


R1 RC Rpi$Q1 + R2 RC Rpi$Q1 + R1 Ro$Q1 Rpi$Q1 + R2 Ro$Q1 Rpi$Q1 +
gm$Q1 R1 RE Ro$Q1 Rpi$Q1 + gm$Q1 R2 RE Ro$Q1 Rpi$Q1 +
C1 R1 R2 RC RE s + C2 R1 RC RE RL s + C2 R2 RC RE RL s +
C1 R1 R2 RE Ro$Q1 s + Cbc$Q1 R1 R2 RE Ro$Q1 s + C2 R1 RC RE Ro$Q1 s +
C2 R2 RC RE Ro$Q1 s + C2 R1 RE RL Ro$Q1 s + †22‡ +
C2 Cbc$Q1 R1 R2 RC RE Ro$Q1 s2 + C1 C2 R1 R2 RE RL Ro$Q1 s2 +
C2 Cbc$Q1 R1 R2 RE RL Ro$Q1 s2 + C2 Cbe$Q1 R1 R2 RC RE Rpi$Q1 s2 +
C1 C2 R1 R2 RC RL Rpi$Q1 s2 + C2 Cbe$Q1 R1 R2 RC RL Rpi$Q1 s2 +
C2 Cbe$Q1 R1 R2 RE RL Rpi$Q1 s2 + C1 C2 R1 R2 RC Ro$Q1 Rpi$Q1 s2 +
C2 Cbc$Q1 R1 R2 RC Ro$Q1 Rpi$Q1 s2 + C2 Cbe$Q1 R1 R2 RC
Ro$Q1 Rpi$Q1 s2 + C1 C2 gm$Q1 R1 R2 RC RE Ro$Q1 Rpi$Q1 s2 +
C2 Cbc$Q1 gm$Q1 R1 R2 RC RE Ro$Q1 Rpi$Q1 s2 + C1 C2 R1 R2 RL
Ro$Q1 Rpi$Q1 s2 + C2 Cbc$Q1 R1 R2 RL Ro$Q1 Rpi$Q1 s2 +
C2 Cbe$Q1 R1 R2 RL Ro$Q1 Rpi$Q1 s2 + C2 Cbc$Q1 gm$Q1 R1 R2 RC RL

C2 Cbc$Q1 gm$Q1 R1 R2 RE RL Ro$Q1 Rpi$Q1 s2 L


Ro$Q1 Rpi$Q1 s2 + C1 C2 gm$Q1 R1 R2 RE RL Ro$Q1 Rpi$Q1 s2 +

As compared to the result of our previous equation-based simplification this transfer function is quite
lengthy again. Still, approximating the matrix has reduced the degree of the solution. Therefore,
we can apply solution-based approximation to compute a simplified transfer function which is more
compact than our SAG-only solution and valid over a larger frequency range than our first SBG
result.
In[34]:= voutSBGSAG = ApproximateTransferFunction[voutsimp3,
s, dpceamp, 0.1]

-HC1 C2 gm$Q1 R1 R2 RC RL Ro$Q1 Rpi$Q1 s2 V1L 


Out[34]=

Hgm$Q1 R1 RE Ro$Q1 Rpi$Q1 + gm$Q1 R2 RE Ro$Q1 Rpi$Q1 +


HC1 gm$Q1 R1 R2 RE Ro$Q1 Rpi$Q1 + C2 gm$Q1 R1 RE RL Ro$Q1 Rpi$Q1 +

s + C1 C2 gm$Q1 R1 R2 RE RL Ro$Q1 Rpi$Q1 s2 L


C2 gm$Q1 R2 RE RL Ro$Q1 Rpi$Q1L

The common factor which appears in the coefficients of the numerator and the denominator of this
transfer function can be cancelled by algebraic simplification:
In[35]:= voutsimp3s = Simplify[voutSBGSAG]

RE HR1 + R2 + C1 R1 R2 sL H1 + C2 RL sL
C1 C2 R1 R2 RC RL s2 V1
Out[35]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€€€€€€

The above result is very useful because it allows for reading off approximate symbolic expressions
for the poles. To calculate these explicitly we must solve the denominator of the transfer function
for s:
In[36]:= poles = Solve[Denominator[voutsimp3s] == 0, s]

Out[36]= 99s ® €€€€€€€€€€€€€€€€


€€€€€ =, 9s ® - €€€€€€€€€€€€€€ ==
-R1 - R2 1
C1 R1 R2 C2 RL

From our SAG-only approximation (voutsimp) alone we cannot determine the poles so easily because
the denominator is a polynomial of degree 3. On the other hand, the SBG-only approximation is
2.8 Linear Symbolic Approximation 143

too large to yield meaningful expressions for the poles. This shows that combining SBG with SAG
techniques can also be a powerful approach for computing other circuit characteristics than only
transfer functions.
In[37]:= voutsimp3n[s_] = voutsimp3s /. dpceamp

H1 + 0.047 sL H147000. + 470. sL


48.598 s2
Out[37]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€

Finally, we plot this simplified transfer function together with the original function to visualize the
effects of our low-and-mid-frequency approximation. The Bode plot shows that the approximation
is valid from zero frequency to the upper end of the passband at about 1 MHz. High-frequency
effects are not described because we did not specify a design point in the frequency region beyond
the passband.
In[38]:= BodePlot[{voutexactn[2. Pi I f], voutsimp3n[2. Pi I f]},
{f, 1., 1.*10^9}, MagnitudeDisplay −> Linear,
PlotRange −> {{0, 2.5}, Automatic}]

2.5
2
Magnitude

1.5
1
0.5

1.0E0 1.0E2 1.0E4 1.0E6 1.0E8


Frequency

0
-50
Phase (deg)

-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Out[38]= … Graphics …

2.8.5 Options for ApproximateMatrixEquation


ApproximateMatrixEquation can be called with a number of options, most of which are for
very advanced usage only and need not be changed unless there appear to be problems with the
default settings. Since all options from Options[ApproximateMatrixEquation] are documented in
Section 3.11.3, we will restrict ourselves to the discussion of the option SortingMethod . Note that
the option CompressEquations has already been introduced in Section 2.8.4.

SortingMethod
ApproximateMatrixEquation removes negligible contributions from a matrix equation term by term
following a ranking scheme which causes the term with the smallest influence on the solution to be
removed first. The term ranking is obtained by sorting the list of the individual numerical influences
144 2. Tutorial

of all terms by least influence. If only one design point is present, the sorting order is obvious, but
it is not obvious for two or more design points. For example, if removing matrix entry X causes a
magnitude error of 0.01% in design point 1 and an error of 10% in design point 2 while the error
values for matrix entry Y are 0.2% and 0.5% respectively, which entry should be removed first?
Removing X first would introduce a very small error in design point 1 but an excessively large one
in design point 2. On the other hand, Y has a much larger influence in design point 1 than X but
the total error in both design points would be smaller if Y is removed first.
SortingMethod is an option which selects the sorting strategy that is applied to the influence list
to obtain the term rankings. By default, terms are ranked by least influence on the solution in
the primary design point, that is design point 1. In the above example, this strategy would give X
precedence over Y. The corresponding option setting in Options[ApproximateMatrixEquation] is
SortingMethod −> PrimaryDesignPoint

The other available strategy ranks terms by least arithmetic mean influence in all design points,
which would give Y precedence over X:
SortingMethod −> LeastMeanInfluence

Usually, LeastMeanInfluence is the better choice if the calculations involve more than one design
point. To examine the effect of selecting a different term ranking method we repeat the previous
approximation run with SortingMethod −> LeastMeanInfluence .
In[39]:= approxceamp4 = ApproximateMatrixEquation[ceampsta,
V$RL, dpceamp3, CompressEquations −> True,
SortingMethod −> LeastMeanInfluence]
Out[39]= … DAE@AC, †19 ´ 19‡D …

Solving these approximated equations now yields a much simpler expression.


In[40]:= voutsimp4 = V$RL /. First[Solve[approxceamp4, V$RL]]

-HC1 C2 gm$Q1 R1 R2 RC RL Rpi$Q1 s2 V1L 


Out[40]=

HH1 + C2 RL sL HR1 R2 + gm$Q1 R1 RE Rpi$Q1 +


gm$Q1 R2 RE Rpi$Q1 + C1 gm$Q1 R1 R2 RE Rpi$Q1 sLL

Here, we determined the approximation sequence by using the average of the design-point errors as
sorting criterion. In our first approximation run with two design points the term influences on the
second design point at 1 Hz were not taken into consideration when the ranking was computed. The
error bound at design point 2 was reached quickly because some terms were removed first which
had low influence in design point 1 but large influence in design point 2.
2.9 Frequency-Domain Analysis of Linear Circuits 145

2.9 Frequency-Domain Analysis of Linear Circuits


In the preceding chapters, many aspects of the circuit modeling and analysis functionality provided
by Analog Insydes have been introduced in a rather loosely connected fashion. In this chapter
we will now discuss how these techniques and functions can be applied to small-signal analysis
(or AC analysis) of linear or linearized circuits in the frequency domain. Primarily, this includes
classical symbolic analysis tasks such as computing transfer functions, input and output impedances,
or calculating two-port parameters. However, we will see that by making use of Mathematica’s
vast symbolic computation and expression manipulation capabilities it is easy to extend the standard
techniques for calculating nominal small-signal characteristics to the analysis of many other quantities
which are of interest to circuit designers. Such quantities are, for example, sensitivities or effects
caused by nonidealities of circuit elements due to process tolerances or temperature dependence.

2.9.1 Transistor Models

MOS Transistors
We will show how Analog Insydes can be used to solve practical AC circuit analysis problems by
demonstrating the above-mentioned analysis tasks on a number of basic transistor circuits. Although
Analog Insydes has built-in device models (see Chapter 4.3), we start with implementing a set of
suitable transistor models in order to better understand the modeling language of Analog Insydes.
Since bipolar transistor models have already been dealt with to some extent, we begin with a
discussion of MOS field-effect transistor models.
D D

G B G B

S S
Figure 9.1: NMOS (left) and PMOS (right) transistor

Figure 9.1 shows the schematic representations of an n-channel type (NMOS) and a p-channel type
(PMOS) MOSFET on the left-hand side and right-hand side, respectively. The letters D, G, B, and S
denote the drain, gate, bulk (substrate), and source connections of the devices. For both NMOS and
PMOS transistors, the small-signal operation at DC or low frequencies is characterized by the small-
signal equivalent circuit shown in Figure 9.2. The symbol VGS represents the gate-source voltage,
which is the main controlling factor for the drain current of the MOSFET, and VBS denotes the
bulk-source, or back-gate, voltage. The model parameters of the small-signal equivalent circuits are
the transconductance gm, the drain-source conductance GDS and the back-gate transconductance gmb,
which is usually, but not always, considerably smaller than gm.
146 2. Tutorial

G B
GDS
VGS VBS
gm*VGS gmb*VBS
S S

Figure 9.2: Low-frequency small-signal model for MOS transistors

To describe the MOSFET AC operation at higher frequencies more accurately a number of parasitic
capacitances are added to the low-frequency model, namely the gate-source and gate-drain capacitances
CGS and CGD, and the bulk-source and bulk-drain capacitances CBS and CBD. The resulting high-
frequency AC model is displayed in Figure 9.3. For simplicity, we have neglected the ohmic
resistances in the drain and source regions which are usually accounted for by two additional
resistors in between the physical drain and source connections and the corresponding terminals of
the internal MOSFET device.

D
CGD CBD
G B
GDS
VGS CGS CBS VBS
gm*VGS gmb*VBS
S S
Figure 9.3: High-frequency small-signal model for MOS transistors

Implementation of Small-Signal MOS Transistor Models


For the following calculations we do not need the high-frequency MOSFET equivalent circuit.
Therefore, we only implement the low-frequency model at this point. The former will be dealt with
later when you have learned more about advanced techniques for associating numerical design-point
values with symbolic subcircuit parameters.
In[1]:= <<AnalogInsydes‘
2.9 Frequency-Domain Analysis of Linear Circuits 147

In[2]:= lfMOSmodel =
Circuit[
Model[
Name −> MOSFET,
Selector −> LowFrequency,
Scope −> Global,
Ports −> {D, G, S, B},
Parameters −> {gm, gmb, Gds},
Definition −>
Netlist[
{VCG, {G, S, D, S}, gm},
{VCB, {B, S, D, S}, gmb},
{GDS, {D, S}, Gds}
]
]
]
Out[2]= … Circuit …

To store the model definition in the global subcircuit database we expand the Circuit object using
the function ExpandSubcircuits (Section 3.4.1). The contents of the database can be inspected with
the command GlobalSubcircuits (Section 3.3.4).
In[3]:= ExpandSubcircuits[lfMOSmodel];

Out[4]= 88MOSFET, LowFrequency<<


GlobalSubcircuits[]

2.9.2 Transfer Functions

A CMOS Differential Amplifier


The most basic application of linear symbolic circuit analysis is to compute transfer functions as
analytic expressions of the circuit parameters and the Laplace frequency s. For instance, consider the
single-ended CMOS differential amplifier stage shown in Figure 9.4 where we might be interested in
computing the AC transfer function from the input voltage at node 1 to the output voltage across
the load capacitor CL.
148 2. Tutorial

6 VDD

M3 M4

5
4
1 2
M1 M2
3
CL
V1 V2

IBIAS

Figure 9.4: Single-ended CMOS differential stage

Following, the netlist description of the circuit is not written by hand, but imported via the Analog
Insydes command ReadNetlist (Section 3.10.1) from already existing simulator files. This function
supports the standard application of symbolic analysis which is the extension of a simulation
performed with a numerical circuit simulator. By this, a time-consuming and error-prone data
conversion by hand is ruled out. In our case we start from a PSpice simulation. Thus, we need
to specify the PSpice netlist and output file in the ReadNetlist call, as well as the option setting
Simulator −> "PSpice" for applying the simulator-specific interface functionality.
In[5]:= cmosdiffamp = ReadNetlist[
"AnalogInsydes/DemoFiles/CMOSdiffamp.cir",
"AnalogInsydes/DemoFiles/CMOSdiffamp.out",
KeepPrefix −> False, Simulator −> "PSpice"]
Out[5]= … Circuit …

In[6]:= Statistics[cmosdiffamp]
Number of Capacitors : 1
Number of CurrentSources : 1
Number of VoltageSources : 3
Number of models MOSFET/MODN : 2
Number of models MOSFET/MODP : 2
Total number of elements : 9
The automatically generated netlist description of the amplifier contains generic model references of
the form
2.9 Frequency-Domain Analysis of Linear Circuits 149

{refdes, {connections},
Model −> Model[devtype, parset, refdes],
Selector −> Selector[devtype, parset, refdes],
Parameters −> Parameters[devtype, parset, refdes],
   }
This allows for an easy exchange of device models and parameter sets for each device or group of
devices by means of pattern matching and rewriting. The command
CircuitEquations (Section 3.5.1) makes use of the above syntax when automatically selecting device
models for a specific analysis mode.

Computing the Single-Input to Single-Ended Voltage Gain


Now, we are ready to analyze the circuit. In order to compute the voltage transfer function from
node 1 to node 5 we must first set up a system of circuit equations for the small-signal configuration
of the amplifier. This means that all DC sources, namely VDD and IBIAS, are set to zero. Moreover,
all signal sources whose contribution is not of interest, i.e. V2, are set to zero as well. The resulting
equivalent circuit is shown in Figure 9.5.

6 VDD=0

M3 M4

5
4
1 2
M1 M2
3
CL
V1=1 V2=0
IBIAS=0

Figure 9.5: Differential stage, configuration for small-signal transfer function analysis

In the frequency domain, the relation between a response Y(s), an excitation X(s), and the
corresponding transfer function H(s) of a linear system is given by the equation
150 2. Tutorial

Y(s) = H(s) × X(s)

Hence, the Laplace transform of the output signal, Y(s), is identical to the transfer function if we let
X(s) = 1:

X(s) = 1 Þ Y(s) = H(s)

Therefore, we can obtain the transfer function of the differential amplifier by applying a unit voltage
to the input and computing the output voltage V$5[s] at node 5 because V$5[s] = H[s] for V1 = 1.
In the following command line we select the low-frequency small-signal MOSFET model by
application of the CircuitEquations option setting
DefaultSelector −> LowFrequency (see Section 3.5.1). Additionally, we set up symbolic circuit
equations in modified nodal formulation (which is the default for CircuitEquations ):
In[7]:= mnacmos = CircuitEquations[cmosdiffamp,
ElementValues −> Symbolic,
DefaultSelector −> LowFrequency]
Out[7]= … DAE@AC, †9 ´ 9‡D …

Next, we solve the MNA equations for V$5 using the function Solve (Section 3.5.4):
In[8]:= solcmos = V$5 /. First[Solve[mnacmos, V$5]]

-H-HGds$M1 H-Gds$M2 - gm$M2L +


Out[8]=

HGds$M1 + Gds$M2 + gm$M1 + gm$M2L gm$M4L


Hgm$M1 HGds$M1 + Gds$M2 + gm$M1 + gm$M2L V1 - H-Gds$M1 - gm$M1L
H-gm$M1 V1 - gm$M2 V2LL + HGds$M1 H-Gds$M1 - gm$M1L +
HGds$M1 + Gds$M2 + gm$M1 + gm$M2L HGds$M1 + Gds$M3 + gm$M3LL
Hgm$M2 HGds$M1 + Gds$M2 + gm$M1 + gm$M2L V2 -
H-Gds$M2 - gm$M2L H-gm$M1 V1 - gm$M2 V2LLL 
H-Gds$M2 H-Gds$M1 - gm$M1L HGds$M1 H-Gds$M2 - gm$M2L +
HGds$M1 + Gds$M2 + gm$M1 + gm$M2L gm$M4L +
HGds$M1 H-Gds$M1 - gm$M1L + HGds$M1 + Gds$M2 + gm$M1 + gm$M2L
HGds$M1 + Gds$M3 + gm$M3LL HGds$M2 H-Gds$M2 - gm$M2L +
HGds$M1 + Gds$M2 + gm$M1 + gm$M2L HGds$M2 + Gds$M4 + CL sLLL

Finally, we apply a list of replacement rules to replace the values of the DC sources and V2 by zero,
set the input voltage V1 to 1, and rewrite the desired transfer function into canonical sum-of-products
form using the Mathematica function Together :
2.9 Frequency-Domain Analysis of Linear Circuits 151

In[9]:= tfcmos = Together[


solcmos /. {V1 −> 1, V2 −> 0, IBIAS −> 0, VDD −> 0}]

HGds$M2 Gds$M3 gm$M1 + Gds$M3 gm$M1 gm$M2 + Gds$M2 gm$M1 gm$M3 +


Out[9]=

gm$M1 gm$M2 gm$M3 + Gds$M2 gm$M1 gm$M4 + gm$M1 gm$M2 gm$M4L 


HGds$M1 Gds$M2 Gds$M3 + Gds$M1 Gds$M2 Gds$M4 + Gds$M1 Gds$M3
Gds$M4 + Gds$M2 Gds$M3 Gds$M4 + Gds$M2 Gds$M3 gm$M1 +
Gds$M3 Gds$M4 gm$M1 + Gds$M1 Gds$M4 gm$M2 + Gds$M3 Gds$M4 gm$M2 +
Gds$M1 Gds$M2 gm$M3 + Gds$M1 Gds$M4 gm$M3 + Gds$M2 Gds$M4 gm$M3 +
Gds$M2 gm$M1 gm$M3 + Gds$M4 gm$M1 gm$M3 + Gds$M4 gm$M2 gm$M3 +
Gds$M1 Gds$M2 gm$M4 + Gds$M2 gm$M1 gm$M4 + CL Gds$M1 Gds$M2 s +
CL Gds$M1 Gds$M3 s + CL Gds$M2 Gds$M3 s + CL Gds$M3 gm$M1 s +
CL Gds$M1 gm$M2 s + CL Gds$M3 gm$M2 s + CL Gds$M1 gm$M3 s +
CL Gds$M2 gm$M3 s + CL gm$M1 gm$M3 s + CL gm$M2 gm$M3 sL

Note that alternatively one could use the functions UpdateDesignPoint (Section 3.6.14) and
ApplyDesignPoint (Section 3.6.13) to modify or insert design-point values.

Computing Differential Gains


Similarly, we can compute the differential gain of the amplifier by splitting up the input signal into
two equal parts with opposite phase, i.e. V1 = 1/2 and V2 = -1/2.
In[10]:= diffgain = Together[
solcmos /. {V1 −> 1/2, V2 −> −1/2, IBIAS −> 0, VDD −> 0}]

HGds$M2 Gds$M3 gm$M1 + Gds$M1 Gds$M3 gm$M2 + 2 Gds$M3 gm$M1 gm$M2 +


Out[10]=

Gds$M2 gm$M1 gm$M4 + Gds$M1 gm$M2 gm$M4 + 2 gm$M1 gm$M2 gm$M4L 


Gds$M2 gm$M1 gm$M3 + Gds$M1 gm$M2 gm$M3 + 2 gm$M1 gm$M2 gm$M3 +

H2 HGds$M1 Gds$M2 Gds$M3 + Gds$M1 Gds$M2 Gds$M4 +


Gds$M1 Gds$M3 Gds$M4 + Gds$M2 Gds$M3 Gds$M4 +
Gds$M2 Gds$M3 gm$M1 + Gds$M3 Gds$M4 gm$M1 +
Gds$M1 Gds$M4 gm$M2 + Gds$M3 Gds$M4 gm$M2 + Gds$M1 Gds$M2
gm$M3 + Gds$M1 Gds$M4 gm$M3 + Gds$M2 Gds$M4 gm$M3 +
Gds$M2 gm$M1 gm$M3 + Gds$M4 gm$M1 gm$M3 + Gds$M4 gm$M2 gm$M3 +
Gds$M1 Gds$M2 gm$M4 + Gds$M2 gm$M1 gm$M4 + CL Gds$M1 Gds$M2 s +
CL Gds$M1 Gds$M3 s + CL Gds$M2 Gds$M3 s + CL Gds$M3 gm$M1 s +
CL Gds$M1 gm$M2 s + CL Gds$M3 gm$M2 s + CL Gds$M1 gm$M3 s +
CL Gds$M2 gm$M3 s + CL gm$M1 gm$M3 s + CL gm$M2 gm$M3 sLL

From this formula, the DC gain can be obtained by setting the complex Laplace frequency s = 0:
In[11]:= diffgainDC = diffgain /. s −> 0

HGds$M2 Gds$M3 gm$M1 + Gds$M1 Gds$M3 gm$M2 + 2 Gds$M3 gm$M1 gm$M2 +


Out[11]=

Gds$M2 gm$M1 gm$M4 + Gds$M1 gm$M2 gm$M4 + 2 gm$M1 gm$M2 gm$M4L 


Gds$M2 gm$M1 gm$M3 + Gds$M1 gm$M2 gm$M3 + 2 gm$M1 gm$M2 gm$M3 +

H2 HGds$M1 Gds$M2 Gds$M3 + Gds$M1 Gds$M2 Gds$M4 + Gds$M1 Gds$M3


Gds$M4 + Gds$M2 Gds$M3 Gds$M4 + Gds$M2 Gds$M3 gm$M1 +
Gds$M3 Gds$M4 gm$M1 + Gds$M1 Gds$M4 gm$M2 + Gds$M3 Gds$M4
gm$M2 + Gds$M1 Gds$M2 gm$M3 + Gds$M1 Gds$M4 gm$M3 +
Gds$M2 Gds$M4 gm$M3 + Gds$M2 gm$M1 gm$M3 + Gds$M4 gm$M1 gm$M3 +
Gds$M4 gm$M2 gm$M3 + Gds$M1 Gds$M2 gm$M4 + Gds$M2 gm$M1 gm$M4LL
152 2. Tutorial

2.9.3 Device Mismatch

Applying Matching Information


Many analog circuit designs, including our CMOS differential amplifier, rely upon the theoretical
assumption that some semiconductor devices are perfectly matched. For instance, the transistors M1
and M2, as well as M3 and M4, must have equal small-signal characteristics to make the differential
stage function ideally, i.e. with zero offset voltage and infinite common-mode rejection ratio (CMRR).
For applying matching information Analog Insydes provides the function
MatchSymbols (Section 3.6.15). All symbols of a matching group are replaced by a common symbol.
In our example, the matching group specification {"$M1", "$M2", "12"} causes all symbols which
end with "$M1" or "$M2" to be replaced by a symbol which ends with "12". Thus, gm$M1 and gm$M2
are replaced by gm12, as well as Gds$M1 and Gds$M2 are replaced by Gds12. For the amplifier stage
this yields an enormous reduction of the expression size for the differential gain:
In[12]:= dgmatch = Simplify @ MatchSymbols[diffgainDC,

gm12 HGds34 + 2 gm34L


{{"$M1", "$M2", "12"}, {"$M3", "$M4", "34"}}]

2 HGds12 + Gds34L HGds34 + gm34L


Out[12]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€

Computing Common-Mode Gains with Mismatch


In practice, however, the matching condition cannot always be fulfilled completely because process
tolerances or temperature gradients can cause slight differences in transistor parameters that were
originally meant to be identical. The result is a deviation from the nominal circuit behavior which
may even be unacceptably large. Therefore, it is necessary to take possible performance degradations
due to device mismatch into account during circuit design.
With a symbolic analyzer we can derive formulas which express circuit characteristics in terms of
nominal parameter values plus mismatch contributions. In Analog Insydes, accounting for mismatch
is simply achieved by assigning the same symbolic element value to two nominally equal components
and adding a "delta term" to one of the element values. Two resistors R1 and R2 with the same
nominal value R would thus be assigned the values R and R + dR, respectively, where dR represents
the mismatch contribution.
To demonstrate this procedure let’s examine the influence of device mismatch on the common-mode
gain of the CMOS amplifier from Section 2.9.2 (see Figure 9.4). To consider the corresponding
mismatch information, we set up a list of replacement rules. Since M1 and M2 should match, both
transconductances gm$M1 and gm$M2 are assigned the value gm12. Mismatch is then accounted
by adding the delta term dgm12 to the transconductance of gm$M2. Similarly, all other transistor
parameter values are expressed in terms of a nominal value plus a mismatch term.
In[13]:= mismatchparams = {
gm$M1 −> gm12, Gds$M1 −> Gds12,
gm$M2 −> gm12 + dgm12, Gds$M2 −> Gds12 + dGds12,
gm$M3 −> gm34, Gds$M3 −> Gds34,
gm$M4 −> gm34 + dgm34, Gds$M4 −> Gds34 + dGds34};
2.9 Frequency-Domain Analysis of Linear Circuits 153

First, we can compute the common-mode gain taking mismatch into account by applying the same
unit signal to both input nodes simultaneously, i.e. V1 = V2 = 1 and by applying the above defined
replacement rules describing the device mismatch:
In[14]:= cmgmismatch = Together[solcmos /. mismatchparams
/. {V1 −> 1, V2 −> 1, IBIAS −> 0, VDD −> 0}]

H-dgm12 dgm34 Gds12 - dgm12 Gds12 Gds34 + dGds12 dgm34 gm12 +


Out[14]=

dGds12 Gds34 gm12 - 2 dgm12 Gds12 gm34 + 2 dGds12 gm12 gm34L ‘


IdGds12 dGds34 Gds12 + dGds34 dgm12 Gds12 + dGds12 dgm34 Gds12 +
dGds34 Gds122 + dgm34 Gds122 + dGds12 dGds34 Gds34 +
dGds34 dgm12 Gds34 + 2 dGds12 Gds12 Gds34 + 2 dGds34 Gds12 Gds34 +
dgm12 Gds12 Gds34 + 2 Gds122 Gds34 + dGds12 Gds342 +
dgm12 Gds342 + 2 Gds12 Gds342 + dGds12 dgm34 gm12 +
dGds34 Gds12 gm12 + dgm34 Gds12 gm12 + dGds12 Gds34 gm12 +
2 dGds34 Gds34 gm12 + 2 Gds12 Gds34 gm12 + 2 Gds342 gm12 +
dGds12 dGds34 gm34 + dGds34 dgm12 gm34 + 2 dGds12 Gds12 gm34 +
2 dGds34 Gds12 gm34 + 2 Gds122 gm34 + dGds12 Gds34 gm34 +
dgm12 Gds34 gm34 + 2 Gds12 Gds34 gm34 + 2 dGds12 gm12 gm34 +
2 dGds34 gm12 gm34 + 2 Gds12 gm12 gm34 + 2 Gds34 gm12 gm34 +
CL dGds12 Gds12 s + CL dgm12 Gds12 s + CL Gds122 s +
CL dGds12 Gds34 s + CL dgm12 Gds34 s + 2 CL Gds12 Gds34 s +
CL Gds12 gm12 s + 2 CL Gds34 gm12 s + CL dGds12 gm34 s +
CL dgm12 gm34 s + 2 CL Gds12 gm34 s + 2 CL gm12 gm34 sM

Now, we compute the common-mode gain in the ideal case where all mismatch terms are zero:
In[15]:= Simplify[cmgmismatch
/. {dgm12 −> 0, dGds12 −> 0, dgm34 −> 0, dGds34 −> 0}]
Out[15]= 0

Just as expected, for perfectly matching devices the common-mode gain is zero.
In the presence of mismatch terms the common-mode gain is a rather lengthy transfer function
whose size makes it hard to read off how the tolerances of individual circuit components contribute
to the deviation from the nominal behavior. However, we can find out which mismatch terms have
dominant influence by employing symbolic approximation methods (see Chapter 2.8). Below, we
choose the design-point values for the MOSFET small-signal parameters gm and Gds taken from the
PSpice operating-point simulation. Note that the corresponding data is already included in the above
imported Circuit object cmosdiffamp .
Assuming a transistor matching precision of 1% the delta terms are given by multiplying the nominal
values with 0.01.
In[16]:= dpcmos = {CL −> 1.*10^−13,
gm12 −> 6.*10^−5, dgm12 −> 6.*10^−7,
Gds12 −> 3.*10^−7, dGds12 −> 3.*10^−9,
gm34 −> 6.*10^−5, dgm34 −> 6.*10^−7,
Gds34 −> 8.*10^−7, dGds34 −> 8.*10^−9};
With these design-point values we approximate the expression for the common-mode gain to a
coefficient error of 5%.
154 2. Tutorial

In[17]:= cmgSAG = ApproximateTransferFunction[


cmgmismatch, s, dpcmos, 0.05] // Simplify

gm12 HGds12 + Gds34 + CL sL


-dgm12 Gds12 + dGds12 gm12
Out[17]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€

The numerator of the result indicates that the nonideal behavior is largely due to mismatch between
M1 and M2. On the other hand, tolerances between M3 and M4 have little impact on common-mode
operation.

Computing CMRR
Using the same design point we can also simplify the differential DC gain a bit further, which yields
the known approximate gain formula for this amplifier topology:
In[18]:= dgSAG = ApproximateTransferFunction[
dgmatch, s, dpcmos, 0.05] // Simplify
gm12
Out[18]= €€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€
Gds12 + Gds34

Having derived expressions for both the differential and the common-mode gain we can now
calculate the common-mode rejection ratio which is defined as the quotient of both quantities. We
let s = 0 to focus on the DC component only.
In[19]:= CMRR = (dgSAG / cmgSAG) /. s −> 0

gm122
Out[19]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€
-dgm12 Gds12 + dGds12 gm12

The conclusion that can be drawn from this result is that increasing CMRR requires making the
transconductances gm12 of M1 and M2 larger.

2.9.4 Input and Output Impedances

Circuit Configuration for Impedance Calculations


Since input and output impedances are transfer functions just like voltage gains we can compute
the former using the same circuit analysis procedures as for any other transfer function. An input
impedance is the transfer function from the current flowing into a port to the voltage across the
same port (see Figure 9.6).
2.9 Frequency-Domain Analysis of Linear Circuits 155

V$in
Iin=1

circuit

Figure 9.6: Unit current source excitation for input impedance calculations

Likewise, an input admittance is the transfer function from a voltage across the port to the current
into the port. The same applies to output impedances and admittances which are, in fact, just the
input impedances and admittances at a port which is designated as an output. Consequently, to
calculate an output impedance we must connect a unit current source to the port, set up a system of
circuit equations, and solve for the port voltage.

Computing the Output Impedance of the CMOS Amplifier


To determine the output impedance of the differential amplifier (see Figure 9.4 in Section 2.9.2) we
replace the load capacitor by a stimulus current source as displayed in Figure 9.7.

6 VDD=0

M3 M4

5
4
1 2
M1 M2
IZOUT=1
3

V1=0 V2=0
IBIAS=0

Figure 9.7: Differential amplifier, small-signal configuration for computing the output impedance
156 2. Tutorial

Replacing the load capacitor is done by editing our via ReadNetlist imported netlist. Therefore,
we first remove the netlist entry for CL using the Analog Insydes command DeleteElements
(Section 3.6.2) and in a second step we add an independent current source IZ using the command
AddElements (Section 3.6.1).
In[20]:= cmosdiffamp2 = DeleteElements[cmosdiffamp, CL];
cmosdiffamp2 = AddElements[cmosdiffamp2,
{IZ, {0, 5}, IZout}];
After the modification of the netlist we set up the modified nodal equations and solve for the voltage
at the output port, i.e. V$5.
In[22]:= mnaZout = CircuitEquations[cmosdiffamp2,
ElementValues −> Symbolic,
DefaultSelector −> LowFrequency]
Out[22]= … DAE@AC, †9 ´ 9‡D …

In[23]:= zout = Together[V$5 /. First[Solve[mnaZout, V$5]]


/. {IBIAS −> 0, VDD −> 0, V1 −> 0, V2 −> 0, IZout −> 1}]

HGds$M1 Gds$M2 + Gds$M1 Gds$M3 +


Out[23]=

Gds$M1 gm$M3 + Gds$M2 gm$M3 + gm$M1 gm$M3 + gm$M2 gm$M3L 


Gds$M2 Gds$M3 + Gds$M3 gm$M1 + Gds$M1 gm$M2 + Gds$M3 gm$M2 +

HGds$M1 Gds$M2 Gds$M3 + Gds$M1 Gds$M2 Gds$M4 +


Gds$M1 Gds$M3 Gds$M4 + Gds$M2 Gds$M3 Gds$M4 +
Gds$M2 Gds$M3 gm$M1 + Gds$M3 Gds$M4 gm$M1 + Gds$M1 Gds$M4 gm$M2 +
Gds$M3 Gds$M4 gm$M2 + Gds$M1 Gds$M2 gm$M3 + Gds$M1 Gds$M4 gm$M3 +
Gds$M2 Gds$M4 gm$M3 + Gds$M2 gm$M1 gm$M3 + Gds$M4 gm$M1 gm$M3 +
Gds$M4 gm$M2 gm$M3 + Gds$M1 Gds$M2 gm$M4 + Gds$M2 gm$M1 gm$M4L

For matching the MOS transistors forming the differential pair and the current-mirror load we again
apply the command MatchSymbols :
In[24]:= zoutmatch = Together @ MatchSymbols[zout,
{{"$M1", "$M2", "12"}, {"$M3", "$M4", "34"}}]

2 HGds12 + Gds34L HGds34 + gm34L


Gds12 + 2 Gds34 + 2 gm34
Out[24]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€

As usual, this expression contains many numerically small terms which are identified and discarded
by ApproximateTransferFunction . The output impedance is then given by the following simple
formula in terms of the drain-source conductances Gds12 and Gds34.
In[25]:= zoutSAG = ApproximateTransferFunction[
zoutmatch, s, dpcmos, 0.05] // Simplify
1
Out[25]= €€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€
Gds12 + Gds34
2.9 Frequency-Domain Analysis of Linear Circuits 157

2.9.5 Two-Port Parameters

Two-Port Representations
It is easy to extend the analysis procedures for computing transfer functions to two-port parameter
analysis because two-port or, more generally, n-port matrices can be regarded as transfer functions
in several dimensions. Indeed, every single coefficient in a two-port matrix is a transfer function
from one port current or voltage to another, so we could obtain the four coefficients of a two-port
matrix by means of four separate transfer function analyses. However, we will apply a more efficient
strategy which allows for calculating complete n-port matrices in only one step.

I1 I2

V1 V2

Figure 9.8: Two-port current and voltage reference directions

Figure 9.8 shows the voltages and currents at the terminals of a two port. The relation between the
port quantities V1 , V2 , I1 , and I2 is generally given as a linear mapping of two equations in four
variables:

ijj p11 p12 yzz ijj I1 yzz ijj q11 q12 yzz ijj V1 yzz ijj 0 yzz
j z×j z+j z×j z=j z
k p21 p22 { k I2 { k q21 q22 { k V2 { k 0 {

Solving these equations for any combination of two-port voltages or currents yields one of six possible
two-port representations known as the admittance, impedance, hybrid I and II, and cascade I and II
forms. For example, solving for I1 and I2 in terms of V1 and V2 results in the admittance, or Y-matrix,
representation

ijj I1 yzz ijj y11 y12 yzz ijj V1 yzz


j z=j z×j z
k I2 { k y21 y22 { k V2 {

whose coefficients y11 ,       , y22 are known as the Y-parameters of the two port. Similarly, solving for
V1 and V2 in terms of I1 and I2 yields the impedance, or Z-matrix, representation:

ij V1 yz ij z11 z12 yz ij I1 yz
jj zz = jj zz × jj zz
k V2 { k z21 z22 { k I2 {
158 2. Tutorial

Stimulus Sources for Two-Port Calculations


A particular two-port matrix can be computed by connecting appropriate stimulus sources to the
ports and solving for the opposite port quantities. For instance, if we want to compute a Z-matrix we
must connect current sources to the ports, set up circuit equations and solve for the corresponding
port voltages. Likewise, a Y-matrix is obtained by connecting voltage sources V1 and V2 to the ports
and determining the port currents I$V1 and I$V2 in terms of these voltages.

I$V1 I$V2

V1 Y V2

Figure 9.9: Voltage source excitation for Y-matrix calculation

Note that a straightforward combination of the two-port circuit and the excitation sources as shown
in Figure 9.9 will not yield an entirely correct result. The resulting Y-parameters would have a wrong
sign because the positive reference directions for the branch currents of the voltage sources are not
oriented according to the reference directions for two-port terminal currents.
Remember that the positive reference direction for the current and voltage in a circuit branch is always
determined by the order of the nodes in the corresponding netlist entry (see Chapter 2.2).
The reference direction for the port currents can be aligned with the two-port terminal current
directions by reversing the order of the nodes in the netlist entries belonging to the stimulus sources.
However, the voltage reference directions, whose initial settings were correct, are changed by this
operation as well. Hence, to compensate this unwanted effect, the voltages must be given negative
values in the netlist (see Figure 9.10).

I$V1 I$V2

-V1 Y -V2

Figure 9.10: Correct voltage source excitation for computing Y-parameters

Computing Y-Parameters
Let’s demonstrate the procedure for two-port analysis by calculating the Y-matrix of the circuit shown
in Figure 9.11.
2.9 Frequency-Domain Analysis of Linear Circuits 159

CM
I1 I2

V1 RB RO V2
gm*V1

Figure 9.11: Two-port circuit

As discussed in the preceding subsection we must connect stimulus voltage sources to the circuit
as shown in Figure 9.12 and write the corresponding netlist. If you want to calculate two-port
parameters of a circuit whose netlist was read by ReadNetlist , you can use DeleteElements
(Section 3.6.2) and AddElements (Section 3.6.1) to edit the netlist.

CM
I$V11 2 I$V2

-V1 RB RO -V2
gm*V1
0

Figure 9.12: Correct voltage source excitation for computing Y-parameters

In[26]:= twoport =
Netlist[
{V1, {0, 1}, −V1},
{V2, {0, 2}, −V2},
{RB, {1, 0}, RB},
{CM, {1, 2}, CM},
{VC1, {1, 0, 2, 0}, gm},
{RO, {2, 0}, RO}
]
Out[26]= … Netlist@Raw, †6‡D …

Next, we set up a system of circuit equations and compute the port currents I$V1 and I$V2 as
functions of the stimulus voltages V1 and V2.
160 2. Tutorial

In[27]:= twoportmna = CircuitEquations[twoport];


DisplayForm[twoportmna]

i €€€€€
j -1 0 zy i V$1 y
Out[28]//DisplayForm=
j
j z
z j z i
j
0 y
z
j
j z
z j
j V$2 zz j
j 0 zz
j z j z
1

j z
RB€ + CM s -CM s
j
j z
z j
.j
j z
z j
j z
z
j
j z
z j
j z
z
z j
j z
z
j
j z
z j z j
j z
z
1

j z j z
gm - CM s €€€€€
€ + CM s 0 -1
j z
RO ==
k { k {
-V1
k {
-1 0 0 0 I$V1
0 -1 0 0 I$V2 -V2

In[29]:= ypar = Solve[twoportmna, {I$V1, I$V2}]

Out[29]= 99I$V1 ® - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€


-V1 - CM RB s V1 + CM RB s V2
€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€ ,

I$V2 ® -H-gm + CM sL V1 + J €€€€€€€ + CM sN V2==


RB
1
RO

The Y-parameters of the two-port circuit are given by the coefficients of V1 and V2 on the right-hand
sides of the solutions.
In[30]:= yrhs = {I$V1, I$V2} /. First[ypar];
MatrixForm[yrhs]

i
j y
z
Out[31]//MatrixForm= j
j
j z
z
z
-V1-CM RB s V1+CM RB s V2

H
- €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€
k {
RB
1
-H-gm + CM sL V1 + €€€€€
RO € + CM sL V2

To set up the Y-matrix we must extract the coefficient matrix from these two linear expressions, for
example by computing the Jacobian with respect to V1 and V2.
In[32]:= JacobianMatrix[eqs_, vars_] := Outer[D, eqs, vars]

In[33]:= ymatrix = JacobianMatrix[yrhs, {V1, V2}];


MatrixForm[ymatrix]

i - €€€€€€€€ -CM s y
Out[34]//MatrixForm= j
j
j
j
z
z
z
z
-1-CM RB s
€€€€€€€€€€€€
k {
RB
1
gm - CM s €€€€€
RO € + CM s

2.9.6 Advanced Transistor Modeling

Implementation of MOS Models with Inline Design-Point Information


By using the value-field keywords Value and Symbolic we can provide design-point information
in subcircuit or model definitions. However, directly specifying numerical values in the netlist de-
finition of a model object hardly makes sense because, in general, different model instances have
different sets of design-point values. Therefore, instead of treating these values as global quantities
we must pass individual parameter sets to every model instance.
The techniques for passing parameters to subcircuit instances have already been dealt with in
Chapter 2.3, and the same approaches can be used to handle instance-specific design-point information.
Here, we just have to observe the additional requirement that every element in a model netlist now
needs two symbolic parameters: one that represents the symbolic value of the element and one that
is replaced by the associated numerical value during subcircuit expansion.
2.9 Frequency-Domain Analysis of Linear Circuits 161

For standard applications, you do not need to take care of these things as on the one hand Analog Insydes
provides a library with built-in device models and on the other hand there is no need to write netlists by hand
as this is automatically done by ReadNetlist. Following, we explain the internal model mechanism which
is implemented in the Analog Insydes model library.
Consider the following circuit description which contains a model definition for the high-frequency
MOSFET model introduced in Section 2.9.1 (see Figure 9.3). The symbolic element values are given
as arguments to the Symbolic options while the design-point values, denoted by the names with
a trailing $ac, are given as arguments to the Value options. Both sets of symbols must appear in
the parameter lists of the model definitions to allow for passing design-point values from a model
reference to a model instance and to ensure that symbolic parameters are correctly instantiated.
In[35]:= hfMOSmodel =
Circuit[
Model[
Name −> MOSFET,
Selector −> HighFrequency,
Scope −> Global,
Ports −> {D, G, S, B},
Parameters −> {gm, gmb, Gds, Cgs, Cgd, Cbs, Cbd,
GM$ac, GMB$ac, GDS$ac, CGS$ac, CGD$ac, CBS$ac,
CBD$ac},
Definition −> Netlist[
{CGS, {G, S}, Value −> CGS$ac, Symbolic −> Cgs},
{CGD, {G, D}, Value −> CGD$ac, Symbolic −> Cgd},
{VCG, {G, S, D, S}, Value −> GM$ac,
Symbolic −> gm},
{GDS, {D, S}, Value −> GDS$ac, Symbolic −> Gds},
{VCB, {B, S, D, S}, Value −> GMB$ac,
Symbolic −> gmb},
{CBD, {B, D}, Value −> CBD$ac, Symbolic −> Cbd},
{CBS, {B, S}, Value −> CBS$ac, Symbolic −> Cbs}
]
]
]
Out[35]= … Circuit …

In[36]:= ExpandSubcircuits[hfMOSmodel];
GlobalSubcircuits[]

88MOSFET, HighFrequency<, 8MOSFET, LowFrequency<<


Out[37]=

Generating Design Points


Please consider the circuit description of the differential amplifier circuit from Section 2.9.2 (see
Figure 9.4). From the netlist entries for M1 to M4 it becomes apparent how the design-point
information is specified for each transistor model instance. Values are assigned only to parameters
which represent numerical information. No assignments are made to the corresponding symbolic
model parameters to let them be instantiated automatically. Note again, that this is all taken care of
automatically by the command ReadNetlist .
162 2. Tutorial

Let’s examine the effects of the preceding parameter definitions and assignments by recalculating the
single-input-to-single-ended voltage transfer function of the differential amplifier, this time using the
high-frequency MOS model we just defined. First, we set up symbolic circuit equations using the
option setting DefaultSelector −> HighFrequency .
In[38]:= eqscmoshf = CircuitEquations[cmosdiffamp,
ElementValues −> Symbolic,
DefaultSelector −> HighFrequency]
Out[38]= … DAE@AC, †9 ´ 9‡D …

As a result of default parameter instantiation (see Chapter 2.3) unique symbolic values have been
generated for all instances of the transistor model elements. In addition, the arguments of the Value
keywords have been replaced by the numerical values specified in the model references. Therefore,
we can now use GetDesignPoint to extract the design-point list from the DAEObject.
In[39]:= GetDesignPoint[eqscmoshf]

8V2 ® 0.0001, V1 ® 1., CL ® 1. ´ 10-13 , Cgs$M3 ® 2.38 ´ 10-13 ,


Out[39]=

Cgd$M3 ® 0., gm$M3 ® 0.0000654, Gds$M3 ® 7.89 ´ 10-7 ,


gmb$M3 ® 0.0000217, Cbd$M3 ® 0., Cbs$M3 ® 0., Cgs$M4 ® 2.38 ´ 10-13 ,
Cgd$M4 ® 0., gm$M4 ® 0.0000654, Gds$M4 ® 7.89 ´ 10-7 ,
gmb$M4 ® 0.0000217, Cbd$M4 ® 0., Cbs$M4 ® 0., Cgs$M1 ® 2.33 ´ 10-13 ,
Cgd$M1 ® 0., gm$M1 ® 0.0000596, Gds$M1 ® 3.01 ´ 10-7 ,
gmb$M1 ® 0.0000441, Cbd$M1 ® 0., Cbs$M1 ® 0., Cgs$M2 ® 2.33 ´ 10-13 ,
Cgd$M2 ® 0., gm$M2 ® 0.0000596, Gds$M2 ® 3.01 ´ 10-7 ,
gmb$M2 ® 0.0000441, Cbd$M2 ® 0., Cbs$M2 ® 0., Simulator ® PSpice<

2.9.7 AC Analysis of the CMOS Amplifier


To conclude this chapter let’s carry out an AC analysis of the CMOS amplifier. Our task shall be
to determine a symbolic formula which approximates the frequency response of the voltage gain
to first order. We begin with importing the numerical data from the PSpice small-signal simulation
applying the Analog Insydes command ReadSimulationData (Section 3.10.3). Note that we have to
specify the simulator-specific option setting Simulator −> "PSpice" .
In[40]:= data = ReadSimulationData[
"AnalogInsydes/DemoFiles/CMOSdiffamp.csd",
Simulator −> "PSpice"]

88VH5L ® InterpolatingFunction@881., 1. ´ 109 <<, <>D<<


Out[40]=

In[41]:= tfcmosPSpice := "V(5)" /. First[data]

The Bode diagram of the simulation result shows that the transfer function has a dominant pole
which is responsible for the corner in the magnitude response at 1 MHz.
2.9 Frequency-Domain Analysis of Linear Circuits 163

In[42]:= BodePlot[tfcmosPSpice[f], {f, 1., 1.*10^9}]

30

Magnitude (dB)
20
10
0
-10
-20
-30
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
Phase (deg)

-20
-40
-60
-80
-100
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Out[42]= … Graphics …

Next, we set up a system of circuit equations in symbolic form. Remember that this requires
specifying the option
ElementValues −> Symbolic in the call to CircuitEquations . Furthermore, we use a complexity-
reduced device model for the transistors by the option setting ModelLibrary −> "BasicModels‘"
(see Section 3.14.4) as we shall not be interested in high-frequency parasitic effects.
In[43]:= stacmoshf = CircuitEquations[cmosdiffamp,
ElementValues −> Symbolic, Formulation −> SparseTableau,
ModelLibrary −> "BasicModels‘"]
Out[43]= … DAE@AC, †50 ´ 50‡D …

We can now perform a numerical reference simulation within Analog Insydes to ensure that the
imported data is correct and that the employed transistor models are sufficient for computing the
small-signal voltage gain and the subsequent symbolic approximations. The corresponding Analog
Insydes command for carrying out a numerical small-signal analysis is ACAnalysis (Section 3.7.3).
In[44]:= reference = ACAnalysis[stacmoshf, {V$CL}, {f, 1., 1.*^9}]

88V$CL ® InterpolatingFunction@881., 1. ´ 109 <<, <>D<<


Out[44]=

Within the Bode diagram we compare the results of the PSpice simulation and the Analog Insydes
simulation. One can see that the curves match perfectly in the computed frequency range.
164 2. Tutorial

In[45]:= BodePlot[reference, {tfcmosPSpice[f], V$CL[f]},


{f, 1., 1.*10^9}, ShowLegend −> False]

30
Magnitude (dB)

20
10
0
-10
-20
-30
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
Phase (deg)

-20
-40
-60
-80
-100
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Out[45]= … Graphics …

Following, we can proceed with carrying out the symbolic approximation. Note that statistical
information concerning DAEObjects can be displayed via the Analog Insydes command Statistics
(Section 3.6.17):
In[46]:= Statistics[stacmoshf]
Number of equations : 50
Number of variables : 50
Number of entries : 2500
Number of non−zero entries : 139
Complexity estimate : 184
You may ask yourself why we set up the sparse tableau above instead of modified nodal equations which would
be considerably smaller. The reason for this is that, in most cases, equation-based symbolic approximation
tends to produce better results when applied to tableau equations.
To capture the corner in the magnitude response we select two representative design points on the
frequency axis, one to the left of the corner at 10 kHz and the other to the right of the corner at
1 MHz (see Chapter 2.8).
In[47]:= dpSBG = {{s −> 2. Pi 10^4 I, MaxError −> 0.1},
{s −> 2. Pi 10^6 I, MaxError −> 0.1}};
Then, we approximate the tableau matrix with respect to the voltage across the load capacitor CL:
In[48]:= stacmoshfSBG = ApproximateMatrixEquation[
stacmoshf, V$CL, dpSBG]
Out[48]= … DAE@AC, †50 ´ 50‡D …

Please note the reduced complexity of the returned DAEObject inspected via Statistics :
2.9 Frequency-Domain Analysis of Linear Circuits 165

In[49]:= Statistics[stacmoshfSBG]
Number of equations : 50
Number of variables : 50
Number of entries : 2500
Number of non−zero entries : 87
Complexity estimate : 48
Next, we solve for the capacitor voltage V$CL to obtain a simplified transfer function:
In[50]:= tfcmoshf = Together[V$CL
/. First[Solve[stacmoshfSBG, V$CL]]]

HGds$M2 Gds$M3 gm$M1 V1 + Gds$M3 gm$M1 gm$M2 V1 +


Out[50]=

Gds$M2 gm$M1 gm$M3 V1 + gm$M1 gm$M2 gm$M3 V1 +


Gds$M2 gm$M1 gm$M4 V1 + gm$M1 gm$M2 gm$M4 V1 -
Gds$M1 Gds$M3 gm$M2 V2 - Gds$M3 gm$M1 gm$M2 V2 -

Gds$M1 gm$M2 gm$M4 V2 - gm$M1 gm$M2 gm$M4 V2L 


Gds$M1 gm$M2 gm$M3 V2 - gm$M1 gm$M2 gm$M3 V2 -

HGds$M1 Gds$M2 Gds$M3 + Gds$M1 Gds$M2 Gds$M4 + Gds$M1 Gds$M3


Gds$M4 + Gds$M2 Gds$M3 Gds$M4 + Gds$M2 Gds$M3 gm$M1 +
Gds$M3 Gds$M4 gm$M1 + Gds$M1 Gds$M4 gm$M2 + Gds$M3 Gds$M4 gm$M2 +
Gds$M1 Gds$M2 gm$M3 + Gds$M1 Gds$M4 gm$M3 + Gds$M2 Gds$M4 gm$M3 +
Gds$M2 gm$M1 gm$M3 + Gds$M4 gm$M1 gm$M3 + Gds$M4 gm$M2 gm$M3 +
Gds$M1 Gds$M2 gm$M4 + Gds$M2 gm$M1 gm$M4 + Cgd$M2 Gds$M1 Gds$M2 s +
CL Gds$M1 Gds$M2 s + Cgd$M2 Gds$M1 Gds$M3 s +
Cgd$M4 Gds$M1 Gds$M3 s + CL Gds$M1 Gds$M3 s +
Cgd$M2 Gds$M2 Gds$M3 s + Cgd$M4 Gds$M2 Gds$M3 s +
CL Gds$M2 Gds$M3 s + Cgd$M2 Gds$M3 gm$M1 s + Cgd$M4 Gds$M3 gm$M1 s +
CL Gds$M3 gm$M1 s + Cgd$M2 Gds$M1 gm$M2 s + CL Gds$M1 gm$M2 s +
Cgd$M2 Gds$M3 gm$M2 s + Cgd$M4 Gds$M3 gm$M2 s +
CL Gds$M3 gm$M2 s + Cgd$M2 Gds$M1 gm$M3 s + Cgd$M4 Gds$M1 gm$M3 s +
CL Gds$M1 gm$M3 s + Cgd$M2 Gds$M2 gm$M3 s + Cgd$M4 Gds$M2 gm$M3 s +
CL Gds$M2 gm$M3 s + Cgd$M2 gm$M1 gm$M3 s + Cgd$M4 gm$M1 gm$M3 s +
CL gm$M1 gm$M3 s + Cgd$M2 gm$M2 gm$M3 s + Cgd$M4 gm$M2 gm$M3 s +
CL gm$M2 gm$M3 s + Cgd$M4 Gds$M1 gm$M4 s + Cgd$M4 Gds$M2 gm$M4 s +
Cgd$M4 gm$M1 gm$M4 s + Cgd$M4 gm$M2 gm$M4 sL

Approximating the tableau equations has reduced the transfer function, which was initially of order
four, to the first-order formula we were looking for. In a last postprocessing step, we can remove all
remaining numerically irrelevant terms by solution-based approximation.
In[51]:= dpcmos2 = GetDesignPoint[stacmoshf];

In[52]:= tfcmoshfSAG = Simplify @


ApproximateTransferFunction[tfcmoshf, s, dpcmos2, 0.1]

Hgm$M1 gm$M2 Hgm$M3 + gm$M4L V1L 


Out[52]=

HGds$M2 gm$M1 Hgm$M3 + gm$M4L + Hgm$M1 + gm$M2L HGds$M4 gm$M3 +


HCgd$M2 gm$M3 + CL gm$M3 + Cgd$M4 Hgm$M3 + gm$M4LL sLL

From the above result we can now easily compute a formula for the pole of the transfer function by
solving the denominator of the expression for s:
In[53]:= Solve[Denominator[tfcmoshfSAG] == 0, s] // Simplify

88s ® -HGds$M4 Hgm$M1 + gm$M2L gm$M3 +


Out[53]=

Gds$M2 gm$M1 Hgm$M3 + gm$M4LL  HHgm$M1 + gm$M2L


HCgd$M2 gm$M3 + CL gm$M3 + Cgd$M4 Hgm$M3 + gm$M4LLL<<
166 2. Tutorial

Finally, we verify the result by evaluating the approximated formula with the design-point values
and comparing its frequency response to that of the original PSpice simulation. The simplified
formula turns out to be a good approximation from DC up to a frequency of about 10 MHz.
In[54]:= tfcmoshf2 = Together[tfcmoshfSAG
/. dpcmos2 /. s −> 2 Pi I f]

4.64623 ´ 10-13
Out[54]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€
8.49729 ´ 10-15 + 1.0776 ´ 10-20 ä f

In[55]:= BodePlot[reference, {tfcmosPSpice[f], tfcmoshf2},


{f, 1., 1.*10^9}, ShowLegend −> False]

30
Magnitude (dB)

20
10
0
-10
-20
-30
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
Phase (deg)

-20
-40
-60
-80
-100
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Out[55]= … Graphics …
2.10 Nonlinear Symbolic Approximation 167

2.10 Nonlinear Symbolic Approximation


The linear simplification techniques implemented in Analog Insydes proved to be very effective
and powerful. As of version 2, simplification routines for nonlinear circuits have been added to
Analog Insydes. They are able to reduce the complexity of symbolic nonlinear differential-algebraic
equations systems (DAE) with automated error control and can be used, for example, for behavioral
model generation.
Section 2.10.1 describes the main principles of the nonlinear simplification techniques in Analog
Insydes. Section 2.10.2 shows their application on an example.

2.10.1 Introduction to Nonlinear Approximation


As opposed to the linear case, for nonlinear approximation techniques there is no distinction
between simplification-before-generation and simplification-after-generation methods. All nonlinear
simplification commands expect a symbolic DAEObject as input and return an approximated symbolic
DAEObject. This simplified system can then be approximated further until the desired complexity
reduction is reached. During simplification, the error is measured by numerical simulations and the
simplification is stopped as soon as the error exceeds a user-given error bound. Different user-defined
numerical analyses can be performed for error calculation.
Before the nonlinear simplification techniques can be applied, the equation system has to be prepared
using the command NonlinearSetup (Section 3.12.1). The command syntax is as follows:
NonlinearSetup[dae, inputs, outputs, mode1 −> {settings1 },       ]
The first argument of
NonlinearSetup is the DAEObject to be simplified. It has to be set up in symbolic formulation for
DC or transient analysis mode. See the command CircuitEquations (Section 3.5.1), especially the
options ElementValues and AnalysisMode , for setting up an appropriate equation system.
Then you have to specify the input and output symbols of the equation system. During simplification,
the input symbols are swept in a user-given range, whereas the value of the output symbols is used
to calculate the numerical error. All parameters of the DAEObject can be used as input symbols.
To get a list of all valid input symbols, use the command GetParameters (Section 3.6.9). On the
other hand, all variables of the DAEObject can be used as output symbols. To get a list of all valid
output symbols, use the command GetVariables (Section 3.6.7). Both arguments inputs and outputs
can either be a single symbol or a list of symbols. Since several input and output symbols can be
specified, the nonlinear simplification techniques are able to approximate multi-input/multi-output
(MIMO) systems.
Finally, the analysis modes used for error calculation have to be given as rules of the form
modei −> {settingsi }, where modei is either DT (for DC-transfer analysis) or AC (for AC analysis).
The argument settingsi is a sequence of rules for specifying the sweep range (using the symbol
Range), the simulation function (using the symbol SimulationFunction ), and the error function
(using the symbol ErrorFunction ). The sweep range is a required argument and determines for
168 2. Tutorial

each input symbol (as specified by inputs) the numerical range in which to sweep the symbol during
numerical simulation. The sweep range is given by a standard Analog Insydes parameter sweep
specification as described in Section 3.7.2. Both the simulation function and error function arguments
are optional and for advanced usage only. For usual applications you do not need to specify them.
For example, the argument
DT −> {Range −> {VIN, {0., 5., 1.}}}
specifies that a DC-transfer analysis has to be performed for error calculation. For this, the input
symbol VIN has to be swept from 0. to 5. in steps of 1. and the default simulation and error
functions have to be used.
NonlinearSetup returns a new DAEObject which is prepared for nonlinear approximation. All data
given as arguments to NonlinearSetup are stored in the returned DAEObject and automatically
extracted by subsequent commands, such that there is no need to specify them again. Additionally,
NonlinearSetup performs numerical simulations and stores the result as reference values used for
error calculations. You can use the command NonlinearSettings (Section 3.12.5) to inspect which
data has been added to the DAEObject for nonlinear simplifications.
Once the DAEObject is prepared, there are two major commands for nonlinear simplifications:
CompressNonlinearEquations and CancelTerms .

CompressNonlinearEquations
CompressNonlinearEquations (Section 3.12.2) removes equations and eliminates variables from the
DAEObject which are irrelevant for solving for the output variables. The general syntax is as follows:
CompressNonlinearEquations[dae, vars]
If the given DAEObject is prepared via NonlinearSetup , the output variables specified in the call
to NonlinearSetup are added to the given list vars of variables to hold in the equation system.
Note that compressing equations is a mathematically exact operation, there is no need to perform
numerical error calculations.
Since
CompressNonlinearEquations reduces the number of equations in a DAEObject, it is recommended
as the first step in a nonlinear simplification procedure.

CancelTerms
CancelTerms (Section 3.12.3) simplifies a DAEObject by successive removal of terms in the equation
system. The general syntax is as follows:
CancelTerms[dae, maxerrors]
After each each term removal, CancelTerms performs a numeric simulation (as set by
NonlinearSetup ), calculates the error, and compares it to the user-given error bound maxerrors. If
the error caused by a simplification exceeds this error bound, the simplification is undone.
2.10 Nonlinear Symbolic Approximation 169

CancelTerms returns the simplified DAEObject. All nonlinear options which are stored in dae
are copied to the new system. Thus, the returned system can be used as input for subsequent
simplifications.
By default, CancelTerms removes terms in top-level sums of the equation system. Using the option
Level, removal of terms can be performed in deeper levels, too. The value of this option is either
a non-negative integer, a list of non-negative integers, or the symbol All. For the latter, removal of
terms is performed in all levels, starting on top level.

2.10.2 Analyzing a Square Root Function Block


In this section the application of the nonlinear simplification functions is demonstrated on an
example. Figure 10.1 shows the schematic of a nonlinear square root function block consisting of
four bipolar transistors.

VLOAD VCC
I0
Q3

Q2

Q4
Q1 5

II

Figure 10.1: Square root function block

The input is given by the current source II and the voltage source VLOAD, the output is given by the
current through the voltage source VLOAD. Using the nonlinear approximation routines we want to
generate a symbolic expression for the static input output behavior of the circuit.

Importing Numerical Data


In PSpice the numerical simulation is performed as a DC sweep on ii and vload. The corresponding
part of the .cir-file looks as follows:
.op
.dc ii 0.0 0.001 0.00001 vload 0 3.5 0.875
.probe/csdf
.options numdgt=8
170 2. Tutorial

As a first step we import the numerical simulation data calculated with PSpice into Mathematica
using ReadSimulationData (Section 3.10.3).
In[1]:= <<AnalogInsydes‘

In[2]:= data = ReadSimulationData[


"AnalogInsydes/DemoFiles/Sqrt.txt",
Simulator −> "PSpice"]
Out[2]= †1‡

ReadSimulationData returns the two-dimensional sweep data as a list of lists of one-dimensional


interpolating functions as described in Section 3.7.1. To transform the data into a list of two-
dimensional interpolating functions we can use the command ConvertDataTo2D (Section 3.13.1). In
the following step we extract the interpolating function corresponding to the output value I(VLOAD)
and assign it to the function ivloadPSpice .
In[3]:= data2d = ConvertDataTo2D[data]

8VH3L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,


Out[3]=

VH5L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,


VH1L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
VHoutL ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
VH4L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IHIIL ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IHIBL ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IHVLOADL ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IHvdcL ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ICHQ1L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IBHQ1L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IEHQ1L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ISHQ1L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ICHQ2L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IBHQ2L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IEHQ2L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ISHQ2L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ICHQ3L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IBHQ3L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IEHQ3L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ISHQ3L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ICHQ4L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IBHQ4L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
IEHQ4L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D,
ISHQ4L ® InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D<

In[4]:= ivloadPSpice[VLOAD_, II_] =


"I(VLOAD)"[VLOAD, II] /. data2d

InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D@VLOAD, IID


Out[4]=

The interpolating function ivloadPSpice can now be plotted in a three-dimensional plot:


2.10 Nonlinear Symbolic Approximation 171

In[5]:= Plot3D[ivloadPSpice[VLOAD, II],


{VLOAD, 0., 3.5}, {II, 0., 0.001},
AxesLabel −> {"VLOAD", "II", ""},
PlotLabel −> "IVLOAD (PSpice)"]

IVLOAD (PSpice)

0.0003
0.0002 0.001
0.0001 0.0008
0 0.0006
0 II
1 0.0004
2 0.0002
VLOAD
3 0

Out[5]= … SurfaceGraphics …

Equation Setup
In the next step the equation system has to be set up. For this we import the PSpice .cir-file and
convert it into an Analog Insydes Circuit object using the command ReadNetlist (Section 3.10.1).
In[6]:= netlist = ReadNetlist[
"AnalogInsydes/DemoFiles/Sqrt.cir",
Simulator −> "PSpice"];
DisplayForm[netlist]
Out[7]//DisplayForm=

Netlist HRaw, 8 EntriesL:


Circuit:

8Q1, 83 ® C, 5 ® B, 0 ® E<, Model ® Model@BJT, BJTNPN, Q1D, Selector ® Selec


8Q2, 81 ® C, 3 ® B, 5 ® E<, Model ® Model@BJT, BJTNPN, Q2D, Selector ® Selec
8Q3, 8OUT ® C, 3 ® B, 4 ® E<, Model ® Model@BJT, BJTNPN, Q3D, Selector ® Sel
8Q4, 84 ® C, 4 ® B, 0 ® E<, Model ® Model@BJT, BJTNPN, Q4D, Selector ® Selec
8VLOAD, 81, OUT<, Type ® VoltageSource, Value ® 8AC ® 0, DC È Transient ® 3.
8II, 85, 0<, Type ® CurrentSource, Value ® 8AC ® 0, DC È Transient ® 0.0001<
8IB, 81, 3<, Type ® CurrentSource, Value ® 8AC ® 0, DC È Transient ® 0.0001<
8VDC, 81, 0<, Type ® VoltageSource, Value ® 8AC ® 0, DC È Transient ® 5.<, S
ModelParameters@Name ® BJTNPN, Type ® NPND
GlobalParameters@Simulator ® PSpiceD

Afterwards, we set up a symbolic DC equation system using the modified nodal formulation. Since
we are not interested in temperature effects, we instruct CircuitEquations (Section 3.5.1) to replace
TEMP, TNOM, the elementary charge $q, and Boltzmann’s constant $k by their numerical values.
172 2. Tutorial

In[8]:= mnaFull = CircuitEquations[netlist,


AnalysisMode −> DC, ElementValues −> Symbolic,
Value −> {"*" −> {TEMP, TNOM, $q, $k}}]
Out[8]= … DAE@DC, †27 ´ 27‡D …

In[9]:= GetVariables[mnaFull]

8V$1, V$3, V$4, V$5, V$OUT, I$BS$Q1, I$CS$Q1,


Out[9]=

I$ES$Q1, ib$Q1, ic$Q1, I$BS$Q2, I$CS$Q2, I$ES$Q2,


ib$Q2, ic$Q2, I$BS$Q3, I$CS$Q3, I$ES$Q3, ib$Q3, ic$Q3,
I$BS$Q4, I$CS$Q4, I$ES$Q4, ib$Q4, ic$Q4, I$VLOAD, I$VDC<

In[10]:= GetParameters[mnaFull]

8AREA$Q1, AREA$Q2, AREA$Q3, AREA$Q4, BF$Q1,


Out[10]=

BF$Q2, BF$Q3, BF$Q4, BR$Q1, BR$Q2, BR$Q3, BR$Q4,


GMIN, IB, II, IS$Q1, IS$Q2, IS$Q3, IS$Q4, VDC, VLOAD<

Numerical Reference Calculation


Using NDAESolve (Section 3.7.5) we now perform the same numerical simulation as in PSpice,
transform the result again into a two-dimensional interpolating function, and plot it in a three-
dimensional plot.
In[11]:= data = NDAESolve[mnaFull,
{II, 0.0, 0.001}, {VLOAD, 0., 3.5, 0.5}];
In[12]:= data2d = ConvertDataTo2D[data];

In[13]:= ivload[VLOAD_, II_] = I$VLOAD[VLOAD, II] /. data2d

InterpolatingFunction@880., 3.5<, 80., 0.001<<, <>D@VLOAD, IID


Out[13]=
2.10 Nonlinear Symbolic Approximation 173

In[14]:= Plot3D[ivload[VLOAD, II],


{VLOAD, 0., 3.5}, {II, 0., 0.001},
AxesLabel −> {"VLOAD", "II", ""},
PlotLabel −> "IVLOAD (Analog Insydes)"]

IVLOAD (Analog Insydes)

0.0003
0.0002 0.001
0.0001 0.0008
0 0.0006
0 II
1 0.0004
2 0.0002
VLOAD
3 0

Out[14]= … SurfaceGraphics …

Model Validation
One key step is now to check if the numerical simulation in Analog Insydes is identical to the result
of the PSpice simulation, i.e. to check if we have chosen appropriate transistor models. This can for
example be done by comparing the graphical output. We choose some arbitrary value for VLOAD and
plot both output values in one graph sweeping II. The plot shows that both curves are identical
(for this value of VLOAD). Alternatively, we can calculate the maximum difference of both output
values evaluated on a uniform grid. The result shows that the deviation is of order 1 ΜA.
In[15]:= TransientPlot[{ivloadPSpice[2., II], ivload[2., II]},
{II, 0., 0.001}]

0.0003
0.00025
ivloadPSpice[2., II]
0.0002
0.00015
0.0001 ivload[2., II]

0.00005
II
0.00020.00040.00060.0008 0.001

Out[15]= … Graphics …
174 2. Tutorial

In[16]:= Max @ Map[Abs[Apply[ivload,#] − Apply[ivloadPSpice,#]] &,


Flatten[Table[{VLOAD, II},
{VLOAD, 0., 3.5, 0.1}, {II,0., 0.001, 0.000025}], 1]]
Out[16]= 2.62136 ´ 10-7

Starting Nonlinear Simplifications


Now that we have ensured to use the same equation system as PSpice does, we can proceed with the
nonlinear simplification routines. The task is to generate a simplified static equation system which
has the same input-output behavior as the original system mnaFull. To get an impression of the
complexity of the original system, we use the command Statistics (Section 3.6.17).
In[17]:= Statistics[mnaFull]
Number of equations : 27
Number of variables : 27
Length of equations : {4, 4, 3, 3, 2, 3, 2, 3, 8, 8,
3, 2, 3, 9, 9, 3, 2, 3, 9, 9, 3, 2, 3, 4, 4, 3, 2}
Terms with derivatives : 0
Sums in levels : {113, 20}

Compressing Equations
In a first step we eliminate irrelevant variables using the function CompressNonlinearEquations
(Section 3.12.2). The argument {I$VLOAD} to CompressNonlinearEquations assures that our variable
of interest is not eliminated from the equation system. Eliminating variables is a mathematically exact
operation, thus no error calculation is needed. As in our example, this usually reduces the number
of equations drastically (but not necessarily the number of terms) and is therefore recommended as
the first step in the simplification procedure.
In[18]:= step1 = CompressNonlinearEquations[mnaFull, {I$VLOAD}]
Out[18]= … DAE@DC, †6 ´ 6‡D …

In[19]:= Statistics[step1]
Number of equations : 6
Number of variables : 6
Length of equations : {16, 24, 9, 23, 3, 2}
Terms with derivatives : 0
Sums in levels : {77, 42}

Preparing Approximation Routines


To further reduce the complexity of the DAE system we now cancel terms in the equations. Since
this operation alters the output of the system, numerical control simulations have to be applied to
check the current error. We use NonlinearSetup (Section 3.12.1) to prepare the DAEObject for the
following simplification steps. Since we are dealing with a static equation system, we choose the
2.10 Nonlinear Symbolic Approximation 175

DT analysis mode for error checking, specifying sweep ranges for both input values VLOAD and II.
NonlinearSetup performs a numerical reference simulation and stores the result in the returned
DAEObject. These numerical values are used automatically to calculate the error in subsequent
simplification steps.
In[20]:= step2 = NonlinearSetup[step1, {II, VLOAD}, {I$VLOAD},
DT −> {Range −>
{{VLOAD, 0., 3.5, 0.5}, {II, 0., 0.001, 0.0002}} }]
Out[20]= … DAE@DC, †6 ´ 6‡D …

Cancelling Terms
Once we have set up the DAE system we call CancelTerms (Section 3.12.3) where we specify an
error bound for the output variable. CancelTerms then deletes terms in the equation system using
this error bound. Afterwards we again use Statistics to inspect the complexity reduction achieved
by CancelTerms .
In[21]:= step3 = CancelTerms[step2, {DT −> {I$VLOAD −> 25.*^−6}}]
Out[21]= … DAE@DC, †6 ´ 6‡D …

In[22]:= Statistics[step3]
Number of equations : 6
Number of variables : 6
Length of equations : {2, 2, 2, 4, 2, 1}
Terms with derivatives : 0
Sums in levels : {12, 4}
Note that CancelTerms reduces the number of terms drastically.

Compressing Equations again


Deletion of terms changes the equations in such a way that it is often possible to further solve
equations for some variables. Thus, we can again try to eliminate variables using
CompressNonlinearEquations . Here, two more equations can be removed from the system. Note
that CompressNonlinearEquations automatically retrieves the settings made by NonlinearSetup ,
so there is no need to specify the variable of interest I$VLOAD as a second argument. Afterwards we
drop those parameters from the design point which no longer appear in the equation system using
UpdateDesignPoint (Section 3.6.14).
In[23]:= step4 = CompressNonlinearEquations[step3]
Out[23]= … DAE@DC, †4 ´ 4‡D …
176 2. Tutorial

In[24]:= Statistics[step4]
Number of equations : 4
Number of variables : 4
Length of equations : {2, 2, 2, 4}
Terms with derivatives : 0
Sums in levels : {10, 4}
In[25]:= step5 = UpdateDesignPoint[step4]
Out[25]= … DAE@DC, †4 ´ 4‡D …

In[26]:= step5 // DisplayForm

88-II + 1. AREA$Q2 ã38.6635 HV$3-V$5L IS$Q2 == 0,


Out[26]//DisplayForm=

1. IB - 1. AREA$Q1 ã38.6635 V$5 IS$Q1 == 0,


-1. AREA$Q3 ã38.6635 HV$3-V$4L IS$Q3 + 1. I$VLOAD == 0,

1. I$VLOAD == 0<, 8V$3, V$4, V$5, I$VLOAD<,


1. IB - 1. AREA$Q1 ã38.6635 V$5 IS$Q1 - 1. AREA$Q4 ã38.6635 V$4 IS$Q4 +

DesignPoint ® 8II ® 0.0001, IB ® 0.0001, AREA$Q1 ® 1.,

IS$Q3 ® 1. ´ 10-16 , AREA$Q4 ® 1., IS$Q4 ® 1. ´ 10-16 <<


IS$Q1 ® 1. ´ 10-16 , AREA$Q2 ® 1., IS$Q2 ® 1. ´ 10-16 , AREA$Q3 ® 1.,

Looking at the simplified DAE system one can see that the parameter VLOAD disappeared from the
equations. The three-dimensional plot of the output from the beginning shows that the output does
not depend on VLOAD, thus the simplification procedure automatically removes this parameter from
the equation system.

Validating the Result


Now we can compare the output of the simplified system step5 with the output of the original
system. Since VLOAD no longer appears in the DAE system, we no longer need to perform a
multi-dimensional parametric sweep of NDAESolve . A single sweep on II suffices, resulting in a
one-dimensional interpolating function.
In[27]:= data = NDAESolve[step5, {II, 0., 0.001}];

In[28]:= ivloadSimp[II_] = I$VLOAD[II] /. First @ data


Out[28]=
InterpolatingFunction@880., 0.001<<, <>D@IID
2.10 Nonlinear Symbolic Approximation 177

In[29]:= Plot3D[ivloadSimp[II],
{VLOAD, 0., 3.5}, {II, 0., 0.001},
AxesLabel −> {"VLOAD", "II", ""},
PlotLabel −> "IVLOAD (simplified system)"]

IVLOAD (simplified system)

0.0003
0.0002 0.001
0.0001 0.0008
0 0.0006
0 II
1 0.0004
2 0.0002
VLOAD
3 0

Out[29]= … SurfaceGraphics …

To show that the requested error bound is met, we plot the deviation of the output comparing the
original and the simplified system (note the plot range).
In[30]:= Plot3D[Abs[ivloadSimp[II]−ivload[VLOAD, II]],
{VLOAD, 0., 3.5}, {II, 0., 0.001},
PlotRange −> {0, 25.*^−6},
AxesLabel −> {"VLOAD", "II", ""},
PlotLabel −> "absolute error"]

absolute error

0.00002
0.001
0.00001 0.0008
0 0.0006
0 II
1 0.0004
2 0.0002
VLOAD
3 0

Out[30]= … SurfaceGraphics …

Further Postprocessing
In the final step we further reduce the complexity of the equation system by applying some standard
Mathematica functions to manipulate the equations symbolically. In this example it is possible to solve
178 2. Tutorial

the equations for the output variable I$VLOAD symbolically yielding an explicit formula describing
the input-output behavior.
In[31]:= eqs = GetEquations[step5];

In[32]:= eqs2 = Eliminate[eqs, {V$3, V$4, V$5}]


Eliminate::ifun:
Inverse functions are being used by Eliminate, so some
solutions may not be found.

€€€€€ E ==
Out[32]=
I$VLOAD
LogA €€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
AREA$Q4 IS$Q4
€€€€€ E + LogA €€€€€€€€€€€€€€€€ €€€€€ E - 1. LogA €€€€€€€€€€€€€€€€ €€€€€ E
IB II I$VLOAD
LogA €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€
AREA$Q1 IS$Q1 AREA$Q2 IS$Q2 AREA$Q3 IS$Q3

In[33]:= Solve[Map[Exp, eqs2], I$VLOAD]

!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! !!!!!! !!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!


Out[33]=
99I$VLOAD ® - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
!!!!!!!!!!!!!!!! !!!! !!!!!!!!!!!!!!!!€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
!!!! !!!!!!!!!!!!!! !!!!!!!! !!!!!! €€€€€€€€€€€€€€€ =,
1. AREA$Q3 AREA$Q4 IB II IS$Q3 IS$Q4
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€

!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! !!!!!! !!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!


AREA$Q1 AREA$Q2 IS$Q1 IS$Q2

9I$VLOAD ® €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
!!!!!!!!!!!!!!!! !!!! !!!!!!!!!!!!!!!!€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
!!!! !!!!!!!!!!!!!! !!!!!!!! !!!!!! €€€€€€€€€€€€€€€ ==
1. AREA$Q3 AREA$Q4 IB II IS$Q3 IS$Q4
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€
AREA$Q1 AREA$Q2 IS$Q1 IS$Q2

From the result it can be seen that the output current I$VLOAD depends on the square root of the
input current II and that it is independent of the input voltage VLOAD.
Reference Manual

3.1 Netlist Format . . . . . . . . . . . . . . . . . . . . . . . 180

3.2 Subcircuit and Device Model Definition . . . . . . . . . . 192

3.3 Model Library Management . . . . . . . . . . . . . . . . 213

3.4 Expanding Subcircuits and Device Models . . . . . . . . 223

3.5 Setting Up and Solving Circuit Equations . . . . . . . . . 229

3.6 Circuit and DAEObject Manipulation . . . . . . . . . . . 257

3.7 Numerical Analyses . . . . . . . . . . . . . . . . . . . . 282

3.8 Pole/Zero Analysis . . . . . . . . . . . . . . . . . . . . . 306

3.9 Graphics Functions . . . . . . . . . . . . . . . . . . . . . 332

3.10 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 366

3.11 Linear Simplification Techniques . . . . . . . . . . . . . . 387

3.12 Nonlinear Simplification Techniques . . . . . . . . . . . . 403

3.13 Miscellaneous Functions . . . . . . . . . . . . . . . . . . 420

3.14 Global Options . . . . . . . . . . . . . . . . . . . . . . . 427

3.15 The Analog Insydes Environment . . . . . . . . . . . . . 434


180 3. Reference Manual

3.1 Netlist Format


The following chapter explains the circuit-description language used by Analog Insydes. In Analog
Insydes, circuits are described in terms of Netlist and Circuit objects. Section 3.1.2 shows the
general syntax for Circuit objects, Section 3.1.1 for Netlist objects. Sections 3.1.3–3.1.8 describe the
syntax of the Netlist object entries, Sections 3.1.9–3.1.11 describe the syntax of the Circuit object
entries.

3.1.1 Netlist

Netlist[args] defines a circuit in terms of basic components and model


references where args may be any sequence of netlist
entries

Command structure of Netlist.

A flat netlist is described in Analog Insydes by means of a Netlist object. A Netlist consists of
a sequence of netlist entries which can be either basic components or model references. Each netlist
entry is a list. The general syntax for a Netlist object is as follows:
netlistname =
Netlist[
netlist entry 1,
netlist entry 2,
   
]
The format of a netlist entry is described in Section 3.1.3.
Usually, a Netlist object is contained in a Circuit object together with model and parameter
definitions.
See also: Circuit (Section 3.1.2), CircuitEquations (Section 3.5.1), Sections 3.1.3–3.1.7.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

A simple voltage divider In[2]:= voldiv =


netlist. Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …
3.1 Netlist Format 181

3.1.2 Circuit

Circuit[args] defines a circuit in terms of top-level netlists and models


where args may be any sequence of Netlist, Subcircuit ,
Model, ModelParameters , or GlobalParameters objects

Command structure of Circuit .

With Analog Insydes you can describe electrical circuits and control systems hierarchically in terms
of netlists, subcircuit or device model definitions, and model parameter sets. Circuits are defined
with the commands Circuit or Netlist. The general syntax for a Circuit object is as follows:
Circuit[
Netlist[top-level netlist with subcircuit references],
Model[subcircuit/model definition],
   
ModelParameters[model parameters specification],
   
GlobalParameters[global parameters specification],
   
]

Multiple Netlist sections in a Circuit object will be concatenated in order of appearance


upon subcircuit expansion.

See also:
Netlist (Section 3.1.1), ModelParameters (Section 3.1.10), GlobalParameters (Section 3.1.11), Model
(Section 3.2.1), CircuitEquations (Section 3.5.1), ReadNetlist (Section 3.10.1).

Examples
The following is an example for a complete Analog Insydes circuit description including device
model and parameter definitions.
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
182 3. Reference Manual

A complex circuit In[2]:= amplifier = Circuit[


description. Netlist[
{V0, {VCC, 0}, Symbolic −> {AC−>0, _ −> VCC},
Value −> {DC | Transient −> 12}},
{V1, {1, 0}, Symbolic −> V1, Value −> {AC −> 1,
DC | Transient −> SinWave[Time, 0.8, 0.01, 1000]}},
{Q1, {2 −> C, 1 −> B, 0 −> E},
Model −> Model[BJT, DEFNPN, Q1],
Selector −> Selector[BJT, DEFNPN, Q1],
Parameters −> Parameters[BJT, DEFNPN, Q1],
GM$ac −> 0.02, RPI$ac −> 5.0*^3, RO$ac −> 1.0*^4},
{RC, {VCC, 2}, Value −> 500, Symbolic −> RC}
],
Model[Name −> BJT, Selector −> ACsimple,
Scope −> Global, Ports −> {C, B, E},
Parameters −> {gm, Rpi, Ro, GM$ac, RPI$ac, RO$ac},
Definition −> Netlist[
{RPI, {B, E}, Value −> RPI$ac, Symbolic −> Rpi},
{VC, {B, E, C, E}, Value −> GM$ac, Symbolic −> gm},
{RO, {C, E}, Value −> RO$ac, Symbolic −> Ro}
]
],
ModelParameters[Name −> DEFNPN, Type −> "NPN",
IS −> 1.0*^−16, BF −> 100, BR −> 1, VAF −> 150],
GlobalParameters[TEMP −> 300.15, GMIN −> 1.0*^−12]
]
Out[2]= … Circuit …

3.1.3 Netlist Entries


Netlist entries must be written in one of the following ways:

{refdes, {nodes}, value} simple netlist entry format


{refdes, {nodes}, Value−>value, opts}
extended value field format for netlist entries
{refdes, {node1 −>port1 , † † † }, Model−>name, Selector−>sel, par1 −>val1 , † † † }
netlist entry format for model references

Netlist entry formats.

The reference designator (refdes) is a unique name (a symbol or a string) by which a circuit component
can be identified, such as R1 and CL for a resistor R1 and a load capacitor CL . For linear netlist
elements, the first one, two, or three letters of the reference designator (the type tag) determine the
type of the element (see Chapter 4.2 for a list of available linear element types). In the following,
the simple and extended netlist entry format is described. Section 3.1.8 describes the netlist format
for model references in more detail.
3.1 Netlist Format 183

Reference designators must be symbols or strings that can be converted to symbols.


Reference designators are case sensitive. Therefore, R1 and r1 denote different elements.
All reference designators are converted internally to strings. Therefore, R1 and "R1" refer to
the same element.

The second argument of a netlist entry (nodes) specifies the nodes to which the element is connected.
The number of nodes that have to be specified depends on the element type. You may use non-
negative integers, symbols, and strings as node identifiers. The number 0, or equivalently the string
"0", designates the ground node.

Numeric node identifiers are not required to be consecutive.


Node identifiers are case sensitive. Therefore, N1 and n1 denote different nodes.
All node identifiers are converted internally to strings. Therefore, N1 and "N1" refer to the
same node.

The value of a circuit element may be a symbol, a number, or any Mathematica expression involving
both numeric and symbolic quantities.

Whenever the extended value field format is used for a netlist entry, the value of the
corresponding element must be specified with the keyword Value; this keyword may not be
omitted.

See also: Section 3.1.4.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

This defines an RLC In[2]:= rlcf = Netlist[


lowpass filter circuit. {V1, {1, 0}, V},
{R1, {1, 2}, R},
{L1, {2, 3}, L},
{C1, {3, 0}, C}
]
Out[2]= … Netlist@Raw, †4‡D …
184 3. Reference Manual

This netlist is semantically In[3]:= rlcf2 = Netlist[


identical to the previous {"V1", {1, 0}, Value −> V},
one. {"R1", {1, 2}, Value −> R},
{"L1", {2, 3}, Value −> L},
{"C1", {3, 0}, Value −> C}
]
Out[3]= … Netlist@Raw, †4‡D …

Set up a system of circuit In[4]:= CircuitEquations[rlcf] // DisplayForm


equations.
i
j 1y
z
Out[4]//DisplayForm=
j
j z
z i V$1 z
j y i0z
j y
j
j z j V$2 z j 0z
0z j z j z
1 1

j z j z j z
€€€
R€ - €€€
R€ 0
j
j z
z j
j z
z j
j z
z
j
j
j
z
z
z j
j z
z j
j z
z
j z j
j z
z j
j z
z
1 1 1 1
- €€€
R€ €€€
R€ + €€€€€€
L s€ - €€€€€€
L s€
j
j 0z
z j z j z
==
j z k I$V1 {
.
k V{
V$3 0
k 1 0{
1 1
0 - €€€€€€
L s€ €€€€€€
L s€ + C s
0 0

The example below shows a valid mixture of data types and formats for reference designators, node
identifiers, and value specifications.
This defines a voltage In[5]:= divider = Netlist[
divider circuit. {V1, {"in", 0}, Value −> 5},
{"R1", {in, out}, R},
{R2, {"out", 0}, 2*R}
]
Out[5]= … Netlist@Raw, †3‡D …

3.1.4 Netlist Entry Options


The extended value field format allows you to specify additional information related to a circuit
element expressed in terms of rules with the following keywords:

option name default value

InitialCondition Automatic the initial condition for a dynamic element


(L or C)
Pattern Automatic the MNA pattern for a two-terminal
impedance or admittance element (R, G, C,
L, Z, Y)
Symbolic (no default) the symbolic value of a circuit element
Type Automatic explicit specification of the element type

Netlist entry options.

A netlist entry in extended value field format looks like


3.1 Netlist Format 185

{refdes, {nodes}, Value −> value,


Symbolic −> symbolicvalue,
Pattern −> pattern,
Type −> type,
InitialCondition −> initialcondition}
where parameters in slanted typewriter font are optional.

InitialCondition
With InitialCondition −> ic, you can specify initial currents and voltages for inductors and
capacitors, respectively. If no initial condition is given explicitly, it will be assumed to be zero (AC
analysis) or will be calculated automatically from operating-point data (transient analysis).

Pattern
The option Pattern allows you to select the matrix fill-in patterns for two-terminal admittances and
impedances (immittances) to be used in modified nodal analysis (MNA). By default, all impedances Z
are converted to equivalent admittances Y = 1/Z to keep the dimensions of the circuit equations
small. The following values are allowed:

Automatic convert impedances to admittances for MNA


Admittance use admittance pattern for immittances
Impedance use impedance pattern for immittances

Values for the Pattern option.

An explicit Pattern specification overrides the setting of the option ConvertImmittances


locally.

Symbolic
With Symbolic −> symbol, you can specify an alternative symbolic element value in addition to a
numerical value given by Value −> value. This feature is used to associate design-point data with
symbolic element values. Note that symbol is not strictly required to be a symbol; you may also
specify any Mathematica expression. However, design-point management will work as intended only
if the value of the Symbolic option is a symbol.
186 3. Reference Manual

You may not use the Symbolic option without the Value option. If the extended value field
format is used, the Value option must always be present (except in model references).

Type
The Type option allows you to override the automatic element type detection mechanism. With the
default setting Type −> Automatic , the type of an element is determined from the leading characters
of its reference designator. With Type −> typename, the element is assumed to be of type typename
regardless of what the reference designator implies. The argument typename must be a full type name.
To get a list of all available type names, inspect the contents of the global variable ElementTypes .
See also: ElementTypes (Section 3.1.5), Section 3.1.3, Section 3.5.1.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

The following netlist illustrates the use of the netlist entry options described above. The option
Pattern −> Impedance , prevents the resistance
R1 from being converted to an equivalent admittance 1/R1 when setting up modified nodal equations.
The Type option in the value field of the component Load tells Analog Insydes to treat the element
as a resistor although the type tag is L (inductor). Finally, the InitialCondition option in the
netlist entry for C1 sets an initial capacitor voltage of 2.5V.
This illustrates the use of In[2]:= filter = Netlist[
the netlist entry options. {V1, {1, 0}, Value −> 5, Symbolic −> V1},
{R1, {1, 2}, Value −> 1000., Symbolic −> R1,
Pattern −> Impedance},
{Load, {2, 3}, Value −> 10., Symbolic −> RL,
Type −> Resistor},
{C1, {3, 0}, Value −> 1.*^−6, Symbolic −> C,
InitialCondition −> 2.5}
]
Out[2]= … Netlist@Raw, †4‡D …

Set up a system of In[3]:= CircuitEquations[filter, ElementValues −> Symbolic,


symbolic circuit equations. InitialConditions −> Automatic] // DisplayForm

i
j
1 1 y
z
Out[3]//DisplayForm=
j
j z i
j
V$1 y
z i
j
0 y
z
j
j 0 -1 z
z
z j
j
j V$2 zz
z
j
j
j 0 z z
z
0 0 0
j
j z
z j
j z
z j
j z
z
j
j
j
z
z j
j z
z j
j z
z
0 0 z j z j z
1 1

j z
€€€€€
€ - €€€€€
RL€
j z j z
0
j
j z
z j
j z
z j
j z
z
RL

j
j z j z j z
j 0 0 zz j
j z
z j
j z
z
. == 2.5 C
j z j
1 1 V$3
z j z
0 - €€€€€
RL€ €€€€€
RL€ + C s

j z
k -1 0 R1 { k { k {
1 0 0 I$V1 V1
1 0 I$R1 0
3.1 Netlist Format 187

3.1.5 ElementTypes

ElementTypes contains the names of all primitive circuit element types

Global variable ElementTypes .

The global variable ElementTypes contains a list of the internal names of all primitive circuit element
types supported by Analog Insydes. Any name from this list can be used as value of the option
Type in the value fields of netlist entries.
See also: Section 3.1.4, Chapter 4.2.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Get the list of element In[2]:= ElementTypes

8Resistor, Conductance, Admittance, Impedance, Capacitor,


type names.
Out[2]=

Inductor, CurrentSource, VoltageSource, CCCSource, CCVSource,


VCCSource, VCVSource, Nullator, Norator, Fixator, OpAmp, OTAmp,
ABModel, OpenCircuit, ShortCircuit, SignalSource, Amplifier,
Integrator, Differentiator, TransmissionLine, TransferFunction<

3.1.6 Value Specifications for Independent Sources


Independent sources may require multiple value specifications for different analysis modes. For
example, a supply voltage source may have a value of 12V for DC and transient analysis and an
AC value of 1V (e.g. for PSRR calculation). Multiple source values for both numerical and symbolic
values can be specified in a netlist entry using a special form of the extended value field syntax (see
Section 3.1.3).

Value | Symbolic−>{modespec−>value, † † † }
mode-specific source value specification
AC mode key for AC analysis
DC mode key for DC analysis
Transient mode key for transient analysis

Mode specific source value specifications.

A mode specification (modespec) is a Mathematica pattern which is compared against the value of
the option AnalysisMode given to CircuitEquations (Section 3.5.1) during equation setup. Mode
specifications are evaluated from left to right. The first matching pattern yields the element value
that will be used.
188 3. Reference Manual

If no value is specified for a particular analysis mode, the value is assumed to be zero.
Multiple element values may be given in both Value and Symbolic specifications.

The value specification in the following netlist entry will yield the source value 12 for the option
settings AnalysisMode −> DC and AnalysisMode −> Transient . For AC analysis the value 1 will be
used.
{VSUP, {VCC, 0}, Value −> {DC | Transient −> 12, AC −> 1}}
The value specification in the following netlist entry sets both the numeric and symbolic AC values
of V1 to zero whereas the values Vin and 12 are used for all other analysis modes (DC and Transient).
{V1, {1, 0}, Symbolic −> {AC −> 0, _ −> Vin},
Value −> {AC −> 0, _ −> 12}}
Note that the above approach allows you to keep symbols that represent pure DC values out of AC
equations (see example in Section 3.1.2):

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define filter circuit. In[2]:= filter = Netlist[


{V0, {1, 0}, Value −> {DC|Transient −> 5, AC −> 0},
Symbolic −> {AC −> 0, _ −> V0}},
{V1, {1, 2}, Value −> {AC −> 1, DC −> 0,
Transient −> SinWave[Time, 0.8, 0.01, 1000]},
Symbolic −> V1},
{R1, {2, 3}, Value −> 1000., Symbolic −> R1},
{C1, {3, 0}, Value −> 1.*^−6, Symbolic −> C}
]
Out[2]= … Netlist@Raw, †4‡D …

Set up AC equation In[3]:= CircuitEquations[


system. Note that filter, AnalysisMode −> AC,
symbol V0 does not appear ElementValues −> Symbolic] // DisplayForm
in the AC equations.

i
j
1 1 y
z
Out[3]//DisplayForm=
j
j z i
j
V$1 y
z i
j
0 y
z
j
j 0 -1 z
z
z j
j
j
z
z
z j
j
j 0 zz
z
0 0 0
j
j
j
z
z
z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
j z j z
1 1

j 0 0 z
0 €€€€€€ - €€€€€
R1€

j z j z j z
V$2
j z j
j z
z j
j z
z
R1

j
j
j
z
z
z j
j z
z j
j z
z
j z j z
. == 0
j 0 0 z
1 1 V$3
j z j z
0 - €€€€€
R1€ €€€€€
R1€ + C s

j z
k 1 -1 0 0 { k { k {
1 0 0 I$V0 0
0 I$V1 V1

3.1.7 Time and Frequency


The keywords Time and Frequency can be used in the value fields of netlist entries to refer to time
and the complex Laplace frequency, respectively. For example, the netlist entry
3.1 Netlist Format 189

{L1, {2, 3}, L[Time]}


defines a time-variant inductance, and
{VC2, {1, 2, 3, 4}, Frequency*C}
defines a transcapacitance, i.e. a voltage-controlled current source with a transconductance that
depends linearly on frequency.
Upon setting up circuit equations, the keywords Time and Frequency are replaced by the symbols
that designate time and frequency as set in Options[CircuitEquations] (see also Section 3.5.1).
The following analysis mode specific settings are performed:

For DC analysis, Time is replaced by the value of InitialTime and Frequency is set to zero.
For AC analysis, Time is replaced by the value of InitialTime .
For transient analysis, Frequency is set to zero.

Mode-specific replacement of Time and Frequency.

3.1.8 Model References


Subcircuits and device models are referenced via special netlist entries of the following form. A
model reference is recognized by the presence of the keyword Model in the value field.

{refdes, {node1 −>port1 , † † † }, Model−>name, Selector−>sel, par1 −>val1 , † † † }


netlist entry format for model references

Referencing models.

The following netlist entry references a transistor model NPN/DC and specifies numerical values for
the transistor parameters IS, BF, and BR:
{Q1, {1 −> C, 2 −> B, 3 −> E}, Model −> NPN, Selector −> DC,
IS −> 1.*^−16, BF −> 100, BR −> 1}
To reference a parameter set, use the value-field option Parameters −> name, where name denotes
the name of the parameter set defined with ModelParameters (see Section 3.1.10).
The following netlist entry includes a reference to the model parameter set DEFNPN.
{Q1, {1 −> C, 2 −> B, 3 −> E}, Model −> NPN, Selector −> DC,
Parameters −> DEFNPN}
190 3. Reference Manual

A model reference may contain multiple parameter set references.


References to parameter sets are replaced by the corresponding model parameters in the
given order.

When you read in circuit descriptions using the command ReadNetlist (Section 3.10.1), the Model,
Selector , and Parameters keys in the value fields of model references are returned in the generic
form key −> key[devtype, parset, refdes], for example
{Q1, {1 −> C, 2 −> B, 3 −> E},
Model −> Model[BJT, DEFNPN, Q1],
Selector −> Selector[BJT, DEFNPN, Q1],
Parameters −> Parameters[BJT, DEFNPN, Q1]}
This approach permits an easy exchange of device models and parameter sets for each device or
group of devices by means of pattern matching and rewriting (see also Section 3.4.1). In the default
case, i.e. when no replacement rules are applied to these keys, the model name, the selector, and the
parameter set key are rewritten as follows upon circuit equation setup:
Model −> devtype, Selector −> mode, Parameters −> parset
For the following model reference Q1, the generic right-hand sides of these rules are transformed as
shown below if AnalysisMode −> AC.
{Q1,{2 −> C, 1 −> B, 0 −> E}
Model −> BJT, Selector −> AC, Parameters −> DEFNPN,
GM$ac −> 0.02, RPI$ac −> 5.0*^3, RO$ac −> 1.0*^4}
See also: Model (Section 3.2.1), ModelParameters (Section 3.1.10), Section 3.1.3.

3.1.9 Model and Subcircuit


In Analog Insydes, Subcircuit is a synonym for Model. You may use either function name as you
like.
For a detailed description of the Model command, see Section 3.2.1.
3.1 Netlist Format 191

3.1.10 ModelParameters

ModelParameters[Name−>name, par1 −>val1 , † † † ]


defines a local model parameter set
ModelParameters[Name−>name, Scope−>Global, par1 −>val1 , † † † ]
stores a model parameter set in the global subcircuit
database

Command structure of ModelParameters .

In addition to subcircuit and device models, you can also define parameter sets (model cards) that
can be used in conjunction with model references in a circuit description.
The following statement defines a model parameter set for the device type DEFNPN.
ModelParameters[Name −> DEFNPN, IS −> 1.0*^−16, BF −> 100,
BR −> 1, VAF −> 150]
These model parameter sets can be used in model references by means of the Parameters keyword.
See also: Section 3.1.8.

3.1.11 GlobalParameters

GlobalParameters[par 1 −>val1 , † † † ]
defines global parameter settings

Command structure of GlobalParameters .

With GlobalParameters you can specify settings for global parameters used in a Circuit object, as
for instance TEMP or GMIN.

Global parameter definitions may be self-referencing, i.e. a global parameter may be


specified as a function of one or several others (make sure that there are no circular
references).
The list of global parameters is implicitly appended to the value fields of all model
references in a circuit. Therefore, you can use global parameter settings in a model without
having to pass these settings explicitly in each model reference.

The following examples are valid declarations for global parameters:


GlobalParameters[TEMP −> 300.15, GMIN −> 1.0*^−12]
GlobalParameters[TEMP −> TNOM, TNOM −> 300.15,
GMIN −> 1.0*^−12]
192 3. Reference Manual

3.2 Subcircuit and Device Model Definition


This chapter describes the usage of the command Model (Section 3.2.1), which enables you to
describe your circuits hierarchically in terms of subcircuits and device models. In the following
sections, Analog Insydes’ subcircuit and device modeling functionality is presented mainly from
the perspective of language syntax. Therefore, it is recommended that you also read Chapter 2.3
and Chapter 2.6 of the Analog Insydes Tutorial to understand the philosophy behind the modeling
language and learn more about methodologies for modeling linear and nonlinear circuits and devices.
Analog Insydes provides a unified modeling scheme that lets you implement and instantiate both
subcircuits and device models in exactly the same way. Therefore, the terms model and subcircuit shall
be treated as synonyms throughout this chapter. Whenever the word model is used in the following
text, it may refer to a component of a hierarchically structured circuit as well as to an equivalent
circuit or set of equations that describes a physical device. Consequently, the Analog Insydes
command Subcircuit is just an alias for Model, and you may use both names interchangeably.

3.2.1 Model

Model[keyword1 −>value1 , keyword2 −>value2 , † † † ]


defines a subcircuit or device model in terms of a netlist or
a system of behavioral equations

Command structure of Model.

Subcircuits and device models can be implemented either as netlists, i.e. as equivalent circuits
composed of electrical primitives and model references (see Section 3.1.3), or as behavioral descriptions
in terms of linear and nonlinear algebraic and differential equations. Both equivalent circuits and
analog behavioral models (ABMs) can be defined with the Model command. Model takes a sequence of
named arguments, four of which are required while the remaining arguments are optional.

Name the model class name


Selector the selector for a particular member from a model class
Ports the list of model port nodes
Definition the model definition (a netlist or a system of equations)

Required arguments of the Model command.


3.2 Subcircuit and Device Model Definition 193

Scope the scope of the model definition (local or global)


Parameters the list of model parameter names
Defaults default values for model parameters
Translation translation rules for parameter conversion
Symbolic the list of ABM parameters to be kept in symbolic form
Variables the variables in a system of ABM equations
InitialGuess initial guess for the numerical values of ABM variables
InitialConditions initial conditions for dynamic ABM variables

Optional arguments of the Model command.

A valid Model definition has the following general form:


Model[
Name −> name,
Selector −> selector
Ports −> {port nodes},
optarg1 −> value1 ,
   
Definition −> Netlist[     ] | Circuit[     ] | Equations[     ]
]

Arguments Description
The arguments of the Model command are explained in detail below.

Name

Name−>"string" the name of the model class to which the model definition
is assigned
Name−>symbol equivalent to Name−>ToString[symbol]
Name−>{"string1 ", "string2 ", † † † } assign the model definition to several model classes

Format of the Name argument.

The value of the argument Name identifies a class of model definitions for a non-primitive circuit
object or a device type, such as current mirror, operational amplifier, bipolar junction transistor, or
MOSFET. The class name must be a symbol or a string. For example, the class names of BJT and
MOSFET models are defined in the Analog Insydes model library as:
194 3. Reference Manual

Name −> "BJT"


Name −> "MOSFET"

You may assign one or more alias names to a model class by specifying a list of strings:
Name −> {"BJT", "Q"}

Internally, all model names are converted to strings. Therefore, Name−>symbol and
Name−>ToString[symbol] are equivalent name specifications.
Likewise, you can specify the model class name in a model reference (see Section 3.1.8)
either as a symbol or a string regardless of the data type used in the model definition.

Selector

Selector−>"string" the key by which the model can be identified among the
members of the model class
Selector−>symbol equivalent to Selector−>ToString[symbol]
Selector−>{"string 1 ", "string2 ", † † † }
assign several alias names to the model definition

Format of the Selector argument.

The value of the argument Selector selects a particular member from the class of models identified
with Name. For instance, the AC, DC, and dynamic large-signal models of the device type MOSFET
can be defined and distinguished with the following Name/Selector pairs:
Model[Name −> "MOSFET", Selector −> "AC",       ],
Model[Name −> "MOSFET", Selector −> "DC",       ],
Model[Name −> "MOSFET", Selector −> "Transient",       ]
By assigning several selector keys to a model definition, you can set up a list of alias names for
the model. This feature allows you to configure models for use with several closely related analysis
modes, such as AC and noise analysis (see DefaultSelector in Section 3.5.1). To prepare a model
for use with both AC and noise analysis, your selector specification should be written as follows:
Model[Name −> "MOSFET", Selector −> {"AC", "Noise"},       ]
3.2 Subcircuit and Device Model Definition 195

Internally, all model selectors are converted to strings. Therefore, Selector−>symbol and
Selector−>ToString[symbol] are equivalent selector specifications.
Likewise, you can specify the selector in a model reference (see Section 3.1.8) either as a
symbol or a string regardless of the data type used in the model definition.

Scope

Scope−>Local restrict the visibility of the model definition to the


surrounding Circuit object
Scope−>Global store the model definition in the global subcircuit database

Format of the Scope argument.

The optional argument Scope determines the scope of the model definition. With the default setting
Scope −> Local, the model can only be referenced from Netlist objects inside the Circuit object
that contains the corresponding Model statement. With Scope −> Global, the model is stored in the
global subcircuit database and can be accessed by other Circuit objects.
You can use the Scope mechanism to implement a library of frequently used device models separately
from any top-level circuit description and load the models into Analog Insydes’ global subcircuit
database. This can be accomplished by implementing a set of models in a Mathematica *.m file as
illustrated below.
(* Begin MyModels.m *)
Circuit[
Model[Name −> "BJT", Selector −> "AC", Scope −> Global,      
Definition −>       ],
Model[Name −> "MOSFET", Selector −> "AC", Scope −> Global,      
Definition −>       ],
   
] // ExpandSubcircuits;
(* End MyModels.m *)
The library file "MyModels.m" can then be loaded using the command Get["MyModels.m"] .
See also: GlobalSubcircuits (Section 3.3.4), RemoveSubcircuit (Section 3.3.8).
196 3. Reference Manual

Ports

Ports−>{portspec1 , portspec2 , † † † }
specify the nodes in the model definition which serve as
external connection points

Format of the Ports argument.

With the Ports keyword, you can define the port nodes of a model. The value of the argument
must be a list of the identifiers of the model nodes which serve as external connection points. Nodes
in a model definition which are not listed in the Ports statement (internal nodes) are not accessible
from the outside.

"string" or symbol declare a required port node


Optional[port] declare port as optional port node; if port remains
unconnected in a model reference, treat it as if it were an
internal node of the model
Optional[port, default] declare port as optional port node; if port remains
unconnected in a model reference, connect it to the node
default instead

Values for the port specification portspec.

For a three-pin BJT model with collector (C), base (B), and emitter (E) terminals, the list of port nodes
can be specified as a list of strings
Ports −> {"C", "B", "E"}
or, equivalently, as a list of symbols
Ports −> {C, B, E}

Although there is no semantic difference between these two Ports declarations, it is


recommended that you always use strings as port node identifiers. This avoids potential
errors caused by accidentally assigning a value to a Mathematica symbol which is used as a
port node identifier in some model definitions. For example, the assignment C = 1 + x will
corrupt the latter of the above Ports declarations whereas the version that uses strings is
not affected.
The global ground node 0 (or "0") may not be used as a port identifier.

In a model reference, all required ports listed in the Ports argument of the corresponding model
definition must be connected to an external node exactly once; otherwise, subcircuit expansion fails.
3.2 Subcircuit and Device Model Definition 197

By declaring a port as Optional , you can tell Analog Insydes to ignore any missing connections to
this port and perform some default action instead, such as connecting the port to the ground node.
This is useful for modeling integrated semiconductor devices with substrate pins. If the substrate
pin of a BJT or MOSFET model is an optional port, you can use the same model definition for
both three-pin and four-pin devices. If you write the Ports specifications for these device types as
shown below, then the substrate pin is connected implicitly to the ground node and source terminal,
respectively, whenever a BJT or MOSFET model is instantiated as a three-pin device.
The following Ports declaration causes the substrate pin S of a BJT device to be connected to the
ground node if S is left unconnected:
Ports −> {"C", "B", "E", Optional["S", 0]}
This causes the bulk node B of a MOSFET device to be connected to the source terminal if the port
node B is left unconnected:
Ports −> {"D", "G", "S", Optional["B", "S"]}
You can also tell Analog Insydes to leave an unconnected node floating by using Optional without
a second argument. The following Ports declaration treats S as if it were an internal node of the
model definition if S is left unconnected.
Ports −> {"C", "B", "E", Optional["S"]}

The second node given in an Optional declaration must be a required port, an internal
node of the model definition, or the global ground node.

Parameters

Parameters−>{parspec 1 , parspec2 , † † † }
specify the symbols which represent parameters of a model
definition

Format of the Parameters argument.

With the Parameters keyword, you can specify the set of symbols which represent the parameters
of a model definition. Possible values are:

symbol declare symbol as an instance-specific model parameter


Global[symbol] declare symbol as a global quantity but allow
instance-specific value assignments

Values for the parameter specification parspec.


198 3. Reference Manual

Any symbol which appears in the value field of a model netlist entry or in a set of behavioral
equations can be designated as a parameter. The difference between parameters and other symbols
is that you can assign instance-specific values only to parameters. Other symbols are regarded
as global quantities which cannot be bound to instance-specific values in a model reference. In
addition, if a model parameter p is left unbound in a model reference, it will be replaced by a
uniquely instantiated symbol p$instance upon subcircuit expansion whereas symbols representing
global quantities are not changed. The following line shows a valid example for the Parameters
declaration of a BJT model:
Parameters −> {IS, N, BF, BR}
In some cases it is necessary to override the value of a global circuit parameter locally for a particular
model instance. For example, you may have set the environmental temperature TEMP in a Circuit
object with the GlobalParameters statement
Circuit[
Netlist[     ],
GlobalParameters[TEMP −> 300.15]
]
but you want to specify a different operating temperature for an individual device, such as a
temperature sensor or the output transistor of a power amplifier. In order to override the global
value of TEMP for this device, the local temperature value must be specified explicitly in the
corresponding model reference:
{QOUT, {VCC −> C, 5 −> B, out −> E},
Model −> BJT, Selector −> DC,
IS −> 1.*^−16, N −> 1., BF −> 100., BR −> 1., TEMP −> 340.}
However, TEMP is a global quantity and not an instance parameter of the model BJT/DC. Therefore,
the local setting TEMP −> 340. in the model reference QOUT has no effect unless the Parameters
specification in the model definition is modified as follows:
Parameters −> {IS, N, BF, BR, Global[TEMP]}
Now the setting Global[TEMP] allows you to change the value of TEMP individually for any instance
of BJT/DC while the setting from the GlobalParameters list will be used for all instances for which
no local temperature value is given.

Defaults

Defaults−>{param 1 −>value1 , param2 −>value2 , † † † }


specify default values for model parameters

Format of the Defaults argument.

With the Defaults keyword, you can specify default values for model parameters which have been
left unbound in a model reference. For example, with the settings
3.2 Subcircuit and Device Model Definition 199

   
Parameters −> {IS, N, BF, BR, Global[TEMP]},
Defaults −> {IS −> 1.*^−16, N −> 1., BF −> 100.,
BR −> 1., TEMP −> 300.15},
   

you can instantiate a default BJT device without having to specify values for the parameters in the
model reference:
{QDEF, {nout −> C, 2 −> B, 3 −> E}, Model −> BJT, Selector −> DC}
During subcircuit expansion the numerical default values specified by the Defaults argument are
used as model parameter values. The above model reference is thus processed as if its value field
had been specified as shown below.
{QDEF, {nout −> C, 2 −> B, 3 −> E}, Model −> BJT, Selector −> DC,
IS −> 1.*^−16, N −> 1., BF −> 100., BR −> 1., TEMP −> 300.15}

Translation

Translation−>{param 1 −>expr1 , param2 −>expr2 , † † † }


specify model parameter translation rules

Format of the Translation argument.

The optional argument Translation allows you to specify conversion rules for calculating values of
internal model parameters from external parameters declared with the Parameters argument.
For example, the following code defines a simple BJT small-signal model with the external parameters
RB (base resistance) and
beta (current gain). Internally, the model is implemented using a VCCS whose transconductance gm
is calculated automatically from RB and beta by means of the Translation rule gm −> RB*beta .
Model[
Name −> "BJT", Selector −> "SimpleACgm",
Ports −> {"C", "B", "E"},
Parameters −> {RB, beta},
Translation −> {gm −> RB*beta},
Definition −> Netlist[
{"RB", {"B", "E"}, RB},
{"VC", {"B", "E", "C", "E"}, gm}
]
]
Translation rules may also be specified using the RuleDelayed operator (:>). This enables you
to defer the evaluation of function calls on the right-hand sides of translation rules until model
expansion. In the following list of rules, the thermal voltage Vt of a semiconductor device is
200 3. Reference Manual

calculated by a delayed rule to prevent the function ThermalVoltage to be evaluated before the
value of TEMP is known for an individual device.
Translation −> {Is −> Js*Area, Vt :> ThermalVoltage[TEMP]}
If Vt were calculated using a simple Rule (−>), ThermalVoltage would already be called at the time
of model definition, i.e. execution of the Model command.

Symbolic

Symbolic−>{symbol 1 , symbol2 , † † † }
declare behavioral model parameters as symbolic quantities
Symbolic−>{symbol 1 −>alias1 , † † † } declare behavioral model parameters as symbolic
quantities and specify alias names to be used in symbolic
circuit equations

Format of the Symbolic argument.

The optional argument


Symbolic is used only in conjunction with analog behavioral model definitions. It lets you specify
the subset of the model parameters declared in the Parameters section that will be treated as
symbolic quantities in a set of behavioral model equations. Model parameters which are not listed
in the Symbolic section are always replaced by their numerical values when you set up circuit
equations. This feature allows you to restrict the parameters that will appear in a system of symbolic
circuit equations to the ones you really wish to see.
The following code defines a DC model for a temperature-dependent linear resistor. The model
parameters are the nominal resistance RES, the first-order temperature coefficient TC1, the ambient
temperature TEMP, and the reference temperature TNOM. The Symbolic argument declares RES as a
model parameter which will appear in symbolic circuit equations. The other parameters will always
be evaluated numerically and will not appear explicitly in circuit equations.
Model[
Name −> "RES", Selector −> "DC",
Ports −> {"P", "N"},
Parameters −> {RES, TC1, Global[TEMP, TNOM]},
Symbolic −> {RES},
Variables −> {Voltage["P", "N"], Current["P", "N"]},
Definition −> Equations[
Voltage["P", "N"] ==
RES*(1 + TC1*(TEMP − TNOM))*Current["P", "N"]
]
]
Names of device model or instance parameters in netlists imported from external circuit simulators
with ReadNetlist sometimes have lengthy or ugly names. The alternative format of the Symbolic
3.2 Subcircuit and Device Model Definition 201

argument allows you to assign alias names to model parameters which will appear in symbolic
circuit equations in place of the original names.
For example, the following declaration causes the symbol R to be used instead of the original
model parameter name RES whenever you set up symbolic circuit equations with the above model
definition.
Symbolic −> {RES −> R}

Variables

Variables−>{varspec 1 , varspec2 , † † † }
specify the identifiers which represent unknowns in a set
of model equations

Format of the Variables argument.

The Variables argument is used only in conjunction with analog behavioral model definitions. It
serves to declare the identifiers in a set of model equations which represent the unknowns. The
identifiers have to be of the following form:

symbol declare symbol as an internal model variable


Voltage[port1 , port2 ] or Current[port1 , port2 ]
declare a model variable as a branch voltage or branch
current

Values for the variable specification varspec.

For each port branch you must declare both the branch voltage and the branch current as
model variables, even in cases where one of the two does not appear explicitly in the
equations.
202 3. Reference Manual

Definition

Definition−>Netlist[† † †]|Circuit[† † †]
define a model in terms of an equivalent Netlist or
Circuit object
Definition−>Equations[† † †] define a behavioral model in terms of a system of
equations

Format of the Definition argument.

With the Definition argument, you specify the implementation of a model. A model can be
implemented either as an equivalent circuit or as a set of linear or nonlinear differential-algebraic
equations.
You may use a Netlist or a Circuit object to implement an equivalent circuit. The netlist that
represents the equivalent circuit may contain primitive devices as well as further model references.
There is no fixed limit of the subcircuit nesting level.
The following example shows a model implementation for a simple RC tank.
Definition −> Netlist[
{R, {in, out}, R},
{C, {out, ref}, C}
]
A Circuit object may contain local ModelParameters sections as well as local Model definitions.
Local model definitions and parameter sets should have Scope −> Local to prevent interference
with the global subcircuit and parameter databases. Using a Circuit instead of a simple Netlist
feature allows you to define models with instance-specific model parameter sets, i.e. device model
parameters whose values are calculated from model instance parameters.
For example, the following code implements a device-level description of a bipolar differential
pair with emitter degeneration resistors. The model definition contains a local ModelParameters
statement in which the ohmic collector and emitter resistances RC and RE are calculated as functions
of the BJT area factor Area for each instance of the subcircuit DifferentialPair/DeviceLevel .
3.2 Subcircuit and Device Model Definition 203

Subcircuit[
Name −> "DifferentialPair", Selector −> "DeviceLevel",
Ports −> {"H1", "H2", "IN1", "IN2", "L"},
Parameters −> {Area, RED},
Definition −> Circuit[
Netlist[
{"Q1", {"H1" −> "C", "IN1" −> "B", "ED1" −> "E"},
Model −> "BJT", Selector −> Selector["BJT", "Q1"],
Parameters −> "LocalNPN"},
{"RED1", {"ED1", "L"}, RED},
{"Q2", {"H2" −> "C", "IN2" −> "B", "ED2" −> "E"},
Model −> "BJT", Selector −> Selector["BJT", "Q2"],
Parameters −> "LocalNPN"},
{"RED2", {"ED2", "L"}, RED}
],
ModelParameters[Name −> "LocalNPN", Type −> "NPN",
IS −> 2.*^−15, BF −> 200., RC −> 50./Area, RE −> 2./Area]
]
]
Analog Insydes allows you to implement arbitrary multi-dimensional voltage-current relations as
analog behavioral models. ABMs are implemented using sets of Equations instead of Netlist or
Circuit objects. Each model equation must be written in the form lhs == rhs, where lhs and rhs
denote arbitrary Mathematica expressions.

If you implement a behavioral model using the Equations keyword, you must declare the
unknowns of the model equations in the Variables section.

The following code implements a nonlinear DC model for a bipolar junction diode with series
resistance Rs. The first equation serves to compute the effective diode voltage vdeff. It is written in
implicit notation to demonstrate that Analog Insydes does not require model equations to be written
in explicit form var == expr, where var denotes a single symbol or branch quantity identifier.
Model[
Name −> "Diode", Selector −> "DC",
Ports −> {"A", "C"}, Parameters −> {Rs, Is, Global[Vt]},
Variables −> {Voltage["A", "C"], Current["A", "C"], vdeff},
Definition −> Equations[
Voltage["A", "C"] − Rs*Current["A", "C"] − vdeff == 0,
Current["A", "C"] == Is*(Exp[vdeff/Vt] − 1)
]
]
In addition, the
Model command lets you implement behavioral models involving ordinary differential equations
204 3. Reference Manual

(ODEs). In general, the independent variable of such equations is the time variable, denoted by
the symbol Time, but other quantities than time may be used as independent variable as well (see
Section 3.5.1).
You can attach a trailing tick mark (’) to a variable in a set of model equations to denote a time
derivative. The following model definition implements the voltage-current relation of a linear, time-
invariant capacitor in the time domain. The time derivative of the capacitor voltage is denoted by
Voltage["P", "N"]’.
   
Variables −> {Current["P", "N"], Voltage["P", "N"]},
Definition −> Equations[
Current["P", "N"] == C*Voltage["P", "N"]’
],
   

To denote a derivative of a variable var with respect to some other quantity q, you must use
Mathematica’s full derivative notation
Derivative[n][var][q]
where n is the order of the differentiation. Of course, you can also use this notation for time
derivatives. For example, the first derivative of the variable vdeff with respect to time can be
written as:
Derivative[1][vdeff][Time]
Since Time is the default quantity with respect to which derivatives are computed, the above line
can be abbreviated as follows.
Derivative[1][vdeff]

Any derivative term lacking an explicit specification of the independent variables is


assumed to be a derivative with respect to Time.
Your equations may involve second and higher-order derivatives.
Your equations may not involve partial derivatives.

See also: IndependentVariable (Section 3.5.1), Section 3.1.7.


3.2 Subcircuit and Device Model Definition 205

InitialGuess

InitialGuess−>{var 1 −>value1 , var2 −>value2 , † † † }


specify initial guesses for the values of behavioral model
variables

Format of the InitialGuess argument.

With the InitialGuess argument, you can specify a set of numerical values that will be used
by NDAESolve (Section 3.7.5) as initial guess for the solution of behavioral model variables. Initial
guesses may be specified for some or all of the variables listed in the corresponding Variables
declaration.

The default value for initial guesses is 0.


When you analyze strongly nonlinear circuits, an educated initial guess helps to speed up
DC calculations with NDAESolve considerably.
The effect of initial guess specifications on the convergence behavior of NDAESolve depends
on the type of circuit equations.

In the example shown below, initial guesses of 0.7 V and 0.8 V are specified for the model variables
vdeff and Voltage["A", "C"], respectively. No initial guess is given for Current["A", "C"],
therefore, NDAESolve uses 0 as initial guess for this current.
Model[
Name −> "Diode", Selector −> "DC",
Ports −> {"A", "C"}, Parameters −> {Rs, Is, Global[Vt]},
Variables −> {Voltage["A", "C"], Current["A", "C"], vdeff},
Definition −> Equations[
Voltage["A", "C"] − Rs*Current["A", "C"] − vdeff == 0,
Current["A", "C"] == Is*(Exp[vdeff/Vt] − 1)
],
InitialGuess −> {vdeff −> 0.7, Voltage["A", "C"] −> 0.8}
]

InitialConditions

InitialConditions−>{var 1 −>value1 , var2 −>value2 , † † † }


specify initial conditions for dynamic model variables

Format of the InitialConditions argument.


206 3. Reference Manual

With the InitialConditions argument, you can specify initial conditions for dynamic variables in
behavioral model equations. Initial conditions can be assigned to any quantity x whose derivative x’
appears in the equations. This applies to internal model variables as well as to branch voltages and
currents.
The following example shows how to specify an initial condition for the branch quantity
Voltage["P", "N"]. Note that it is not important whether this quantity appears directly in the
equations or not. However, its derivative Voltage["P", "N"]’ must be present as a prerequisite for
the assignment of an initial condition.
Model[
Name −> "Capacitor", Selector −> "Behavioral",
Ports −> {"P", "N"}, Parameters −> {C},
Variables −> {Current["P", "N"], Voltage["P", "N"]},
Definition −> Equations[
Current["P", "N"] == C*Voltage["P", "N"]’
],
InitialConditions −> {Voltage["P", "N"] −> 1.52}
]

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

The following model commands implement a CCCS-based model for bipolar transistors and an
equivalent VCCS-based model. The transconductance of the VCCS in BJT/SimpleACgm is calculated
automatically from the parameters RB and beta by means of a translation rule.
CCCS and VCCS-based In[2]:= Circuit[
BJT small-signal models. Model[
Name −> "BJT", Selector −> "SimpleACbeta",
Scope −> Global, Ports −> {"C", "B", "E"},
Parameters −> {RB, beta},
Definition −> Netlist[
{"RB", {"B", "X"}, RB},
{"CC", {"X", "E", "C", "E"}, beta}
]
],
Model[
Name −> "BJT", Selector −> "SimpleACgm",
Scope −> Global, Ports −> {"C", "B", "E"},
Parameters −> {RB, beta},
Translation −> {gm −> RB*beta},
Definition −> Netlist[
{"RB", {"B", "E"}, RB},
{"VC", {"B", "E", "C", "E"}, gm}
]
]
] // ExpandSubcircuits;

Out[3]= 88BJT, SimpleACbeta<, 8BJT, SimpleACgm<<


List the contents of the In[3]:= GlobalSubcircuits[]
global subcircuit database.
3.2 Subcircuit and Device Model Definition 207

The Circuit object shown below describes a common-source amplifier with a MOSFET device. In
the model definition for MOSFET, the bulk terminal B is defined as an optional port. Since this node
is not connected in the top-level netlist, the bulk terminal is connected implicitly to the source node.
This netlist describes a In[4]:= csamp = Circuit[
common-source amplifier. Netlist[
{V1, {1, 0}, Value −> {DC −> 1.5, AC −> 1}},
{M1, {"out" −> "D", 1 −> "G", 3 −> "S"},
Model −> "MOSFET", Selector −> "DCSmallSignal",
GM −> 2.*^−4, GMB −> 3.*^−5, GDS −> 1.*^−6},
{RD, {"VDD", "out"}, Symbolic −> Rd, Value −> 1.*^6},
{RS, {3, 0}, Symbolic −> Rs, Value −> 5000.},
{VDD, {"VDD", 0}, Value −> {DC −> 3.3, _ −> 0}}
],
Model[
Name −> "MOSFET", Selector −> "DCSmallSignal",
Ports −> {"D", "G", "S", Optional["B", "S"]},
Parameters −> {gm, gmb, Gds, GM, GMB, GDS},
Definition −> Netlist[
{VCG, {"G", "S", "D", "S"}, Symbolic −> gm,
Value −> GM},
{VCB, {"B", "S", "D", "S"}, Symbolic −> gmb,
Value −> GMB},
{GDS, {"D", "S"}, Symbolic −> Gds,
Value −> GDS}
]
]
]
Out[4]= … Circuit …

Expand the MOSFET In[5]:= ExpandSubcircuits[csamp] // DisplayForm

Netlist HFlat, 7 EntriesL:


model.
Out[5]//DisplayForm=

8V1, 81, 0<, Value ® 8DC ® 1.5, AC ® 1<<


8VCG$M1, 81, 3, out, 3<, Symbolic ® gm$M1, Value ® 0.0002, Hierarchy ® 8VCG,
8VCB$M1, 83, 3, out, 3<, Symbolic ® gmb$M1, Value ® 0.00003, Hierarchy ® 8VCB
8GDS$M1, 8out, 3<, Symbolic ® Gds$M1, Value ® 1. ´ 10-6 , Hierarchy ® 8GDS, M1<
8RD, 8VDD, out<, Symbolic ® Rd, Value ® 1. ´ 106 <
8RS, 83, 0<, Symbolic ® Rs, Value ® 5000.<
8VDD, 8VDD, 0<, Value ® 8DC ® 3.3, _ ® 0<<

This example shows the effect of the argument Symbolic in a Model statement. The model equations
describe the DC behavior of a linear resistor including first-order temperature dependence. Note that
although there are four model parameters, only the resistance appears explicitly in symbolic circuit
equations. Note also that the alias name R is used instead of RES to denote the resistance.
208 3. Reference Manual

A circuit with a resistor In[6]:= resckt = Circuit[


model. Netlist[
{V0, {1, 0}, Symbolic −> V0, Value −> 1},
{R1, {1 −> "P", 0 −> "N"},
Model −> "RES", Selector −> "DC",
RES −> 1000., TC1 −> 10^−3}
],
Model[
Name −> "RES", Selector −> "DC",
Ports −> {"P", "N"},
Parameters −> {RES, TC1, Global[TEMP, TNOM]},
Defaults −> {TC1 −> 0, TNOM −> 300.15, TEMP −> 300.15},
Symbolic −> {RES −> R},
Variables −> {Voltage["P", "N"], Current["P", "N"]},
Definition −> Equations[
Voltage["P", "N"] ==
RES*(1 + TC1*(TEMP − TNOM))*Current["P", "N"]
]
],
GlobalParameters[TEMP −> 310.]
]
Out[6]= … Circuit …

Note that only R$R1 is In[7]:= CircuitEquations[resckt, AnalysisMode −> DC,


kept in symbolic form. ElementValues −> Symbolic] // DisplayForm

88I$PN$R1 + I$V0 == 0, V$1 == V0, V$1 == 1.00985 I$PN$R1 R$R1<,


Out[7]//DisplayForm=

8V$1, I$V0, I$PN$R1<,


DesignPoint ® 8V0 ® 1, R$R1 ® 1000., TEMP ® 310.<<

The following example demonstrates the use of local model parameter sets in a subcircuit definition.
The netlist shown below represents a bipolar differential pair with emitter degeneration resistors.
The Circuit object contains a local ModelParameters statement in which the values of the BJT’s
ohmic collector and emitter resistances are calculated as a function of the area factor.
3.2 Subcircuit and Device Model Definition 209

A differential pair with In[8]:= dpwedr = Subcircuit[


emitter degeneration Name −> "DifferentialPair", Selector −> "DeviceLevel",
resistors. Ports −> {"H1", "H2", "IN1", "IN2", "L"},
Parameters −> {Area, RED},
Definition −> Circuit[
Netlist[
{"Q1", {"H1" −> "C", "IN1" −> "B", "ED1" −> "E"},
Model −> "BJT", Selector −> Selector["BJT", "Q1"],
Parameters −> "LocalNPN"},
{"RED1", {"ED1", "L"}, RED},
{"Q2", {"H2" −> "C", "IN2" −> "B", "ED2" −> "E"},
Model −> "BJT", Selector −> Selector["BJT", "Q2"],
Parameters −> "LocalNPN"},
{"RED2", {"ED2", "L"}, RED}
],
ModelParameters[Name −> "LocalNPN", Type −> "NPN",
IS −> 2.*^−15, BF −> 200., RC −> 50./Area,
RE −> 2./Area]
]
]
Out[8]=
… Subcircuit@DifferentialPair, DeviceLevel, †5‡D …

This netlist describes a In[9]:= diffamp = Circuit[


differential amplifier on Netlist[
the basis of the subcircuit {V0, {"VCC", 0}, Value −> {DC −> 9., _ −> 0}},
implemented above. {V1, {2, 0}, Value −> {DC −> 4.5, AC −> 1}},
{V2, {3, 0}, Value −> {DC −> 4.5, AC −> 0}},
{R1, {"VCC", 4}, 5000.},
{R2, {"VCC", 5}, 5000.},
{DP1, {4 −> "H1", 5 −> "H2", 2 −> "IN1",
3 −> "IN2", 6 −> "L"},
Model −> "DifferentialPair",
Selector −> "DeviceLevel",
RED −> 100., Area −> 2.},
{IBIAS, {6, 0}, Value −> {DC −> 0.001, _ −> 0}}
],
dpwedr
]
Out[9]= … Circuit …

Set up circuit equations. In[10]:= diffampeqs = CircuitEquations[diffamp,


AnalysisMode −> DC, ElementValues −> Symbolic]
Out[10]= … DAE@DC, †25 ´ 25‡D …

Out[11]= 825., 1.<


The nominal collector and In[11]:= {RC$Q1$DP1, RE$Q1$DP1} /. GetDesignPoint[diffampeqs]
emitter resistances have
been divided by the area
factor.

The following code is a slightly more complex example for a behavioral model definition. The
Model statement implements a nonlinear DC model for a bipolar junction diode, taking into account
junction voltage reduction due to series resistance (Rs) and DC convergence issues (GMIN).
210 3. Reference Manual

This code defines a diode In[12]:= Circuit[


model and stores it in the Model[
global subcircuit database. Name −> "Diode", Selector −> "DC",
Scope −> Global, Ports −> {"A", "C"},
Parameters −> {Is, Rs, Global[TEMP, GMIN]},
Defaults −> {Is −> 1.*^−15, Rs −> 0, TEMP −> 300.,
GMIN −> 1.*^−12, $q −> 1.6021918*^−19,
$k −> 1.3806226*^−23},
Translation −> {Vt −> $k*TEMP/$q},
Symbolic −> {Is, Vt, Rs, GMIN},
Variables −> {Voltage["A", "C"],
Current["A", "C"], vdeff},
Definition −> Equations[
Current["A", "C"] ==
Is*(Exp[vdeff/Vt] − 1) + vdeff*GMIN,
vdeff == Voltage["A", "C"] − Rs*Current["A", "C"]
],
InitialGuess −> {vdeff −> 0.7}
]
] // ExpandSubcircuits;

This defines a circuit with In[13]:= diodeckt = Circuit[


a diode in series Netlist[
connection with a resistor. {V1, {1, 0}, Vin},
{R1, {1, 2}, Symbolic −> R1, Value −> 1000.},
{D1, {2 −> "A", 0 −> "C"},
Model −> "Diode", Selector −> "DC", Rs −> 10.}
],
GlobalParameters[TEMP −> 330.]
]
Out[13]= … Circuit …

Set up modified nodal In[14]:= diodeeqs = CircuitEquations[diodeckt,


equations. AnalysisMode −> DC, ElementValues −> Symbolic]
Out[14]= … DAE@DC, †5 ´ 5‡D …

Display the equations. In[15]:= diodeeqs // DisplayForm


Out[15]//DisplayForm=
99I$V1 + €€€€€€€€€€€€€€€€
V$1 - V$2 -V$1 + V$2
€€€€€€€€ == 0, I$AC$D1 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0, V$1 == Vin,
I$AC$D1 == H-1 + ã L Is$D1 + GMIN vdeff$D1, vdeff$D1 ==
R1 R1

-I$AC$D1 Rs$D1 + V$2=, 8V$1, V$2, I$V1, I$AC$D1, vdeff$D1<,


vdeff$D1Vt$D1

DesignPoint ® 8Vin ® Vin, R1 ® 1000., Is$D1 ® 1. ´ 10-15 ,


Vt$D1 ® 0.0284364, Rs$D1 ® 10., GMIN ® 1. ´ 10-12 , TEMP ® 330.<=

Calculate the DC response In[16]:= diodedc = NDAESolve[diodeeqs,


while sweeping Rs$D1 {Vin, −1., 5.}, {Rs$D1, 0., 200., 50.}];
from 0 to 200 W.
3.2 Subcircuit and Device Model Definition 211

Plot the diode voltage. In[17]:= TransientPlot[diodedc, V$2[Vin], {Vin, −1., 5.}]

1.5

0.5
V$2[Vin]
Vin
-1 1 2 3 4 5

-0.5

-1

Out[17]= … Graphics …

This example demonstrates how to specify initial conditions. The netlist describes an RLC series
resonator. The behavior of the LC subcircuit is modeled by a system of differential equations.
An RLC circuit with a In[18]:= rlcfilter = Circuit[
behavioral description for Netlist[
the LC resonator. {R, {1, 0}, 100.},
{LC, {1 −> "P", 0 −> "N"},
Model −> "LCSeriesResonator",
Selector −> "Behavioral", L −> 0.02, C −> 5.*^−7}
],
Model[
Name −> "LCSeriesResonator",
Selector −> "Behavioral",
Ports −> {"P", "N"}, Parameters −> {L, C},
Variables −> {Current["P", "N"], Voltage["P", "N"],
vind, vcap},
Definition −> Equations[
vind == L*Current["P", "N"]’,
Voltage["P", "N"] − vcap − vind == 0,
Current["P", "N"] == C*vcap’
],
InitialConditions −> {vcap −> 5.,
Current["P", "N"] −> −0.02}
]
]
Out[18]= … Circuit …

Set up time-domain circuit In[19]:= rlcfeqs = CircuitEquations[rlcfilter,


equations. AnalysisMode −> Transient,
InitialConditions −> Automatic]
Out[19]= … DAE@Transient, †6 ´ 4‡D …

Display the circuit In[20]:= rlcfeqs // DisplayForm


equations.
88I$PN$LC@tD + 0.01 V$1@tD == 0, vind$LC@tD == 0.02 I$PN$LC @tD,
Out[20]//DisplayForm=
¢

5. ´ 10-7 vcap$LC @tD, vcap$LC@0D == 5., I$PN$LC@0D == -0.02<,


-vcap$LC@tD - vind$LC@tD + V$1@tD == 0, I$PN$LC@tD ==

8V$1@tD, I$PN$LC@tD, vind$LC@tD, vcap$LC@tD<, DesignPoint ® 8<<


¢
212 3. Reference Manual

Simulate the circuit. In[21]:= rlcftran = NDAESolve[rlcfeqs, {t, 0., 0.002}]

88I$PN$LC ® InterpolatingFunction@880., 0.002<<, <>D,


Out[21]=

vcap$LC ® InterpolatingFunction@880., 0.002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.002<<, <>D,
vind$LC ® InterpolatingFunction@880., 0.002<<, <>D<<

Display the capacitor In[22]:= TransientPlot[rlcftran, {vcap$LC[t], I$PN$LC[t]},


voltage and the inductor {t, 0., 0.002}, SingleDiagram −> False, PlotRange −> All]
current.

2
vcap$LC[t]
t
0.0005 0.001 0.0015 0.002

-2

0.01
0.005
t
0.0005 0.001 0.0015 0.002
-0.005
-0.01
I$PN$LC[t]
-0.015
-0.02
-0.025

Out[22]= … GraphicsArray …

3.2.2 Subcircuit
The command Subcircuit is an alias for Model (Section 3.2.1). You may use either of the two
function names to define a subcircuit or device model.
3.3 Model Library Management 213

3.3 Model Library Management


Analog Insydes provides a number of functions for inspecting and managing the contents of its global
subcircuit database and external model libraries. These functions are described in detail below.

ListLibrary (Section 3.3.1) listing contents of a library


FindModel (Section 3.3.2) locating models
FindModelParameters (Section 3.3.3)
locating model parameters
GlobalSubcircuits (Section 3.3.4)
inspecting global subcircuit database
GlobalModelParameters (Section 3.3.5)
inspecting global model-parameters database
LoadModel (Section 3.3.6) loading models
LoadModelParameters (Section 3.3.7)
loading model parameters
RemoveSubcircuits (Section 3.3.8)
removing subcircuits from global database
RemoveModelParameters (Section 3.3.9)
removing model parameters from global database

3.3.1 ListLibrary

ListLibrary[] lists the contents of the default model library


ListLibrary["libfile"] lists the contents of the model library "libfile"

Command structure of ListLibrary .

With ListLibrary you can list the contents of one or several model library files. ListLibrary
returns the model definitions and model parameter sets stored in the specified files.
ListLibrary has the following options:
214 3. Reference Manual

option name default value

LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
device models (see Section 3.14.4)

Options for ListLibrary .

See also: FindModel (Section 3.3.2), FindModelParameters (Section 3.3.3), LoadModel (Section 3.3.6),
LoadModelParameters (Section 3.3.7).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

List the contents of the In[2]:= ListLibrary[]

8FullModels‘ ® 8… Model@BJT, 8DC, SpiceDC,


default model library.
Out[2]=

… Model@BJT, 8AC, SpiceAC, Noise, SpiceNoise<D …,


GummelPoonDC, Transient, Spice, GummelPoon<D …,

… Model@MOSFET, 8DC, SpiceDC, Transient, Spice<D …,


… Model@MOSFET, 8AC, SpiceAC, Noise, SpiceNoise<D …,
… Model@Diode, 8DC, SpiceDC, Transient, Spice<D …,
… Model@Diode, 8AC, SpiceAC, Noise, SpiceNoise<D …,
… Model@JFET, 8DC, SpiceDC, Transient, Spice<D …,
… Model@JFET, 8AC, SpiceAC, Noise, SpiceNoise<D …,
… Model@8RES, Resistor<, 8DC, Transient<D …,
… Model@8RES, Resistor<, 8AC<D …,

… Model@CAP, 8DC, Transient<D …, … Model@CAP, 8AC, Noise<D …,


… Model@8RES, Resistor<, NoiseD …,

… Model@IND, 8DC, Transient<D …, … Model@IND, 8AC, Noise<D …<<

List the contents of the In[3]:= ListLibrary[ModelLibrary −> {"BasicResistorModels‘",


specified libraries. "FullDiodeModels‘"}]

8BasicResistorModels‘ ®
Out[3]=

8… Model@8RES, Resistor<, 8AC, BasicSpiceAC, DC,

Resistor<, 8Noise, SpiceNoise<D …<, FullDiodeModels‘ ®


BasicSpiceDC, Transient, BasicSpice<D …, … Model@8RES,

8… Model@Diode, 8DC, SpiceDC, Transient, Spice<D …,


… Model@Diode, 8AC, SpiceAC, Noise, SpiceNoise<D …<<
3.3 Model Library Management 215

3.3.2 FindModel

FindModel[name, selector] searches the default library for the model definition
name/selector

Command structure of FindModel .

FindModel searches a list of model library files for a specified model definition and returns the
name of the first library in which the model was found. FindModel returns the symbol $Failed if
it cannot find the model definition in any of the library files.
FindModel has the following options:

option name default value

LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
device models (see Section 3.14.4)

Options for FindModel.

See also: FindModelParameters (Section 3.3.3), ListLibrary (Section 3.3.1),


LoadModel (Section 3.3.6).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Determine the name of the In[2]:= FindModel["BJT", "GummelPoon"] // InputForm


library file which contains Out[2]//InputForm= "FullModels‘"
the model
"BJT/GummelPoon" .

Return the name of the In[3]:= FindModel["BJT", "AC",


first library from the given ModelLibrary −> {"FullDiodeModels‘", "BasicBJTModels‘",
list which contains the "SimplifiedModels‘"}
model "BJT/AC" . ] // InputForm
Out[3]//InputForm= "BasicBJTModels‘"
216 3. Reference Manual

3.3.3 FindModelParameters

FindModelParameters[name] searches the default library for the parameter set name

Command structure of FindModelParameters .

FindModelParameters searches a list of model library files for a specified model parameter set and
returns the name of the first library in which the parameter set was found. FindModelParameters
returns the symbol $Failed if it cannot find the parameter set in any of the library files.
FindModelParameters has the following options:

option name default value

LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
device models (see Section 3.14.4)

Options for FindModelParameters .

See also: FindModel (Section 3.3.2), ListLibrary (Section 3.3.1),


LoadModelParameters (Section 3.3.7).

3.3.4 GlobalSubcircuits

GlobalSubcircuits[] lists the names and selectors of the subcircuit definitions


stored in the global subcircuit database

Command structure of GlobalSubcircuits .

With GlobalSubcircuits you can inspect the contents of the global subcircuit database.
GlobalSubcircuits returns a list of the names and selectors of the subcircuits stored in the database.
GlobalSubcircuits not only returns the name under which a model was loaded but also all
alias names assigned to the model definition. For example, "Diode", "DC" | "Transient" denotes
a model definition which can be accessed through Name −> "Diode", Selector −> "DC" as well
through Name −> "Diode" , Selector −> "Transient" .
See also: FindModel (Section 3.3.2), GlobalModelParameters (Section 3.3.5).
3.3 Model Library Management 217

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Load two model In[2]:= Circuit[


definitions from the model LoadModel["Diode", "Transient", Scope −> Global],
library and store them in LoadModel["JFET", "AC", Scope −> Global]
the global subcircuit ] // ExpandSubcircuits;
database.

Out[3]= 88Diode, DC È SpiceDC È Transient È Spice<,


List the contents of the In[3]:= GlobalSubcircuits[]

8JFET, AC È SpiceAC È Noise È SpiceNoise<<


global subcircuit database.

3.3.5 GlobalModelParameters

GlobalModelParameters[] lists the names of the model parameter sets stored in the
global model parameter database

Command structure of GlobalModelParameters .

With GlobalModelParameters you can inspect the contents of the global model parameter database.
GlobalModelParameters returns a list of the names of the parameter sets stored in the database.
See also: FindModelParameters (Section 3.3.3), GlobalSubcircuits (Section 3.3.4).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two diode model In[2]:= Circuit[


parameter sets. ModelParameters[Name −> "Diode1", Scope −> Global,
IS −> 1.2*^−12, N −> 1.1],
ModelParameters[Name −> "Diode2", Scope −> Global,
IS −> 1.0*^−14, N −> 1.5]
] // ExpandSubcircuits;

List the contents of the In[3]:= GlobalModelParameters[] // InputForm


global model parameter Out[3]//InputForm= {{"Diode1"}, {"Diode2"}}
database.
218 3. Reference Manual

3.3.6 LoadModel

LoadModel[name, selector] loads the model definition name/selector from the default
model library
LoadModel["libfile", name, selector]
loads the model definition name/selector from the model
library "libfile"
LoadModel[{{name 1 , selector1 }, † † † }]
loads the models name1 /selector1 , † † †

Command structure of LoadModel .

With LoadModel you can load a model definition from a library file. LoadModel searches a list of
model library files and returns the first model definition that matches the specified name and selector.
You can use LoadModel within a Circuit object to load a model definition at run time and assign
global scope to the model.
LoadModel has the following options:

option name default value

Scope Local the designated scope of the loaded model


definition
LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
device models (see Section 3.14.4)

Options for LoadModel.

LoadModel only loads Model records from library files; it does not store the models in the
database.
To store a loaded model in the database, you must use Circuit and ExpandSubcircuits .

See also: Circuit (Section 3.1.2), ExpandSubcircuits (Section 3.4.1),


LoadModelParameters (Section 3.3.7).
3.3 Model Library Management 219

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Load two model In[2]:= Circuit[


definitions from the model LoadModel["Diode", "Transient", Scope −> Global],
library and store them in LoadModel["JFET", "AC", Scope −> Global]
the global subcircuit ] // ExpandSubcircuits;
database.

Out[3]= 88Diode, DC È SpiceDC È Transient È Spice<,


List the contents of the In[3]:= GlobalSubcircuits[]

8JFET, AC È SpiceAC È Noise È SpiceNoise<<


global subcircuit database.

3.3.7 LoadModelParameters

LoadModelParameters[name] loads the model parameter set definition name from the
default model library
LoadModelParameters["libfile", name]
loads the model parameter set definition name from "libfile"
LoadModelParameters[{name 1 , † † †}]
loads the model parameter set definitions name1 , † † †

Command structure of LoadModelParameters .

With LoadModelParameters you can load a model parameter set definition from a library file.
LoadModelParameters searches a list of model library files and returns the first model parameter
set definition that matches the specified name.
You can use LoadModelParameters within a Circuit object to load a model parameter set definition
at run time and assign global scope to it.
LoadModelParameters has the following options:
220 3. Reference Manual

option name default value

Scope Local the designated scope of the loaded model


parameter set definition
LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
model parameter set definitions (see
Section 3.14.4)

Options for LoadModelParameters .

LoadModelParameters only loads ModelParameters records from library files; it does not
store the model parameter sets in the database.
To store a loaded model parameter set in the database, you must use Circuit and
ExpandSubcircuits .

See also: Circuit (Section 3.1.2), ExpandSubcircuits (Section 3.4.1), LoadModel (Section 3.3.6).

3.3.8 RemoveSubcircuit

RemoveSubcircuit[name, selector]
removes the subcircuit definition name/selector from the
global database
RemoveSubcircuit[All] clears the global subcircuit database

Command structure of RemoveSubcircuit .

RemoveSubcircuit allows you to remove individual subcircuit definitions from the global subcircuit
database or to clear the database completely. RemoveSubcircuit returns the list of the names and
selectors of the remaining subcircuit definitions.
See also: GlobalSubcircuits (Section 3.3.4), RemoveModelParameters (Section 3.3.9).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.3 Model Library Management 221

Load two model In[2]:= Circuit[


definitions from the model LoadModel["Diode", "Transient", Scope −> Global],
library and store them in LoadModel["JFET", "AC", Scope −> Global]
the global subcircuit ] // ExpandSubcircuits;
database.

Out[3]= 88Diode, DC È SpiceDC È Transient È Spice<,


List the contents of the In[3]:= GlobalSubcircuits[]

8JFET, AC È SpiceAC È Noise È SpiceNoise<<


global subcircuit database.

Removing the model definition automatically clears all alias names for the model. Thus, if you
remove the model "JFET/AC" , the aliases "JFET/SpiceAC" , "JFET/Noise" etc. will be deleted as
well.

Out[4]= 88Diode, DC È SpiceDC È Transient È Spice<<


Remove the subcircuit In[4]:= RemoveSubcircuit["JFET", "AC"]
definition "JFET/AC" .

Out[5]= 8<
Delete all remaining In[5]:= RemoveSubcircuit[All]
subcircuit definitions.

3.3.9 RemoveModelParameters

RemoveModelParameters[name] removes the model parameter set name from the global
database
RemoveModelParameters[All] clears the global model parameter database

Command structure of RemoveModelParameters .

RemoveModelParameters allows you to remove individual model parameter sets from the global
parameter database or to clear the database completely. RemoveModelParameters returns the list of
the names of the remaining model parameter sets.
See also: GlobalModelParameters (Section 3.3.5), RemoveSubcircuit (Section 3.3.8).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two diode model In[2]:= Circuit[


parameter sets. ModelParameters[Name −> "Diode1", Scope −> Global,
IS −> 1.2*^−12, N −> 1.1],
ModelParameters[Name −> "Diode2", Scope −> Global,
IS −> 1.0*^−14, N −> 1.5]
] // ExpandSubcircuits;

Out[3]= 88Diode1<, 8Diode2<<


List the contents of the In[3]:= GlobalModelParameters[]
global parameter database.
222 3. Reference Manual

Out[4]= 88Diode2<<
Remove the parameter set In[4]:= RemoveModelParameters["Diode1"]
"Diode1" .

Out[5]= 8<
Delete all remaining global In[5]:= RemoveModelParameters[All]
parameter sets.
3.4 Expanding Subcircuits and Device Models 223

3.4 Expanding Subcircuits and Device Models


Before Analog Insydes can set up a system of circuit equations from a netlist, all subcircuits and model
references in the netlist must be expanded and instantiated with ExpandSubcircuits . Subcircuit
expansion is taken care of automatically by CircuitEquations , so that, except for debugging
purposes, there is usually no need to call ExpandSubcircuits explicitly.

3.4.1 ExpandSubcircuits

ExpandSubcircuits[netlist, opts]
expands and instantiates all subcircuit and model
references in netlist

Command structure of ExpandSubcircuits .

Given a Netlist or Circuit object, ExpandSubcircuits expands all model references and stores
model definitions to the global model data base. It returns a Netlist object. Expanding subcircuits
is taken care of automatically by CircuitEquations , so that there is usually no need to call
ExpandSubcircuits explicitly nor to take care of its options.
ExpandSubcircuits has the following options:

option name default value

AutoloadModels True whether to load device models


automatically from the model library
DefaultSelector None the default value to be used to replace
generic subcircuit selectors
HoldModels None a list of patterns matching the names and
selectors of model references that shall
remain unexpanded
InstanceNameSeparator Inherited[AnalogInsydes]
the separator string for name components
of model variables and reference
designators (see Section 3.14.2)
KeepLocalModels False whether to keep local model definitions in a
netlist after subcircuit expansion

Options for ExpandSubcircuits , Part I.


224 3. Reference Manual

option name default value

LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
device models (see Section 3.14.4)
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Symbolic All the parameters of behavioral models to be
kept symbolic when setting up symbolic
circuit equations (see Section 3.5.1)
Value None the parameters of behavioral models to be
kept numeric when setting up symbolic
circuit equations (see Section 3.5.1)

Options for ExpandSubcircuits , Part II.

Options Description
A detailed description of all ExpandSubcircuits options is given below in alphabetical order:

AutoloadModels
With the option AutoloadModels , you can specify how ExpandSubcircuits handles references to
device models which have not been loaded into the global subcircuit database or defined locally in
the netlist. The following values are possible:

True search model libraries for device models and parameter


sets (model cards).
False do not load models from the model library automatically;
abort subcircuit expansion when a reference to an
unavailable model is found

Values for the AutoloadModels option.


3.4 Expanding Subcircuits and Device Models 225

DefaultSelector
With the option DefaultSelector , you can specify the key used by ExpandSubcircuits to replace
the right-hand sides of generic device model selector specifications in netlists generated with
ReadNetlist (Section 3.10.1). The setting DefaultSelector −> selector causes all generic selectors
to be replaced by the key selector. Possible values are:

None do not use a default value for generic model selectors


"string" use "string" as default model selector
symbol use SymbolName[symbol] as default model selector

Values for the DefaultSelector option.

With the setting DefaultSelector −> None, ExpandSubcircuits will print an error
message and abort upon encountering a generic Selector specification.

Usually ExpandSubcircuits is automatically called by CircuitEquations which sets the


DefaultSelector option to an appropriate value based on the chosen analysis mode.

HoldModels
With HoldModels −> patterns, you can specify a list of Mathematica patterns matching the names and
selectors of model references ExpandSubcircuits should not expand. Note that the application of
the HoldModels option is only necessary for advanced tasks. Usually there is no need to use this
option.
A practical application of the HoldModels option is to stop expansion of a hierarchical circuit
description at the device level. The function ReadNetlist (Section 3.10.1) makes use of this feature
to assign small-signal data read from a simulator output file to individual devices in a circuit which
contain subcircuit definitions. The following values are allowed:

pattern do not expand model references whose name specification


matches pattern
{pattern1 , pattern2 } do not expand model references whose name specification
matches pattern1 and whose selector specification matches
pattern2
{{pattern1 , pattern2 }, † † † } do not expand model references that match at least one of
the pattern pairs

Values for the HoldModels option.


226 3. Reference Manual

When HoldModels has a value other than None, ExpandSubcircuits returns a checked
Netlist or a Circuit instead of a flat Netlist regardless of whether any model references
were kept unresolved.
If the netlist contains references to local model definitions or model parameter sets, you
should use the setting KeepLocalModels −> True with the HoldModels option to prevent
local model data from being discarded prematurely.
In the above cases, ExpandSubcircuits must be called at least one more time to produce a
flat netlist.

KeepLocalModels
When you expand the model references in a Circuit only partially using the HoldModels option,
then the held model references may still contain unresolved links to local model definitions and model
parameter sets. By default, local model data is discarded after subcircuit expansion, so that essential
information for expanding the netlist completely may be lost. The setting KeepLocalModels −> True
tells ExpandSubcircuits to keep local model data for future reference. Note that for usual
applications there is no need to change the default value of this option. Possible values are:

False discard local model definitions and parameter sets from


the netlist after subcircuit expansion
True return local model definitions and parameter sets together
with the expanded netlist in a Circuit object

Values for the KeepLocalModels option.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Import PSpice netlist. In[2]:= buffer = ReadNetlist[


"AnalogInsydes/DemoFiles/Buffer.cir",
Simulator −> "PSpice"]
Out[2]= … Circuit …

The following call to ExpandSubcircuits results in an error because the model "BJT/AC" needs to
be loaded from the model library.
Turn off model In[3]:= ExpandSubcircuits[buffer, DefaultSelector −> AC,
autoloading. AutoloadModels −> False]
ExpandSubcircuits::undefsc:
Subcircuit "BJT/AC" is undefined.

Out[3]= $Failed
3.4 Expanding Subcircuits and Device Models 227

With AutoloadModels −> True, ExpandSubcircuits searches the model library for undefined device
models.
Load undefined models In[4]:= ExpandSubcircuits[buffer, DefaultSelector −> AC,
from the library. AutoloadModels −> True, Protocol −> Notebook]
Searching model libraries for model "BJT/AC".
Loading model "BJT/AC" from library FullModels‘.
Instantiating model "BJT/AC" for reference Q$T1.
Instantiating model "BJT/AC" for reference Q$T3.
Instantiating model "BJT/AC" for reference Q$T4.
Instantiating model "BJT/AC" for reference Q$T5.
Instantiating model "BJT/AC" for reference Q$T2.
Out[4]= … Netlist@Flat, †55‡D …

The following command tells Analog Insydes to load a model from the library into memory and store
it in the global subcircuit database for future reference. Further requests for the model "BJT/AC"
will not invoke a library search.
Load the model "BJT/AC" In[5]:= Circuit[
and store it in the global LoadModel["BJT", "AC", Scope −> Global]
subcircuit database. ] // ExpandSubcircuits;

Out[6]= 88BJT, AC È SpiceAC È Noise È SpiceNoise<<


List the contents of the In[6]:= GlobalSubcircuits[]
global subcircuit database.

Now that the model "BJT/AC" has been loaded into memory, turning off the autoloading mechanism
no longer results in an error when expanding the netlist buffer.
Use only model definitions In[7]:= ExpandSubcircuits[buffer, DefaultSelector −> AC,
from the subcircuit AutoloadModels −> False, Protocol −> Notebook]
database; do not search
Instantiating model "BJT/AC" for reference Q$T1.
the library.
Instantiating model "BJT/AC" for reference Q$T3.
Instantiating model "BJT/AC" for reference Q$T4.
Instantiating model "BJT/AC" for reference Q$T5.
Instantiating model "BJT/AC" for reference Q$T2.
Out[7]= … Netlist@Flat, †55‡D …

Out[8]= 8<
Clear the subcircuit In[8]:= RemoveSubcircuit[All]
database.

To illustrate how to write patterns for HoldModels , we make a list off all Model and Selector
specifications in the netlist buffer.
228 3. Reference Manual

List the Model and In[9]:= Cases[buffer, _Model | _Selector, Infinity] // InputForm
Selector specifications. Out[9]//InputForm= {Model["BJT", "Q2N2222", "Q$T1"],
Selector["BJT", "Q2N2222", "Q$T1"],
Model["BJT", "Q2N2907A", "Q$T3"],
Selector["BJT", "Q2N2907A", "Q$T3"],
Model["BJT", "Q2N2907A", "Q$T4"],
Selector["BJT", "Q2N2907A", "Q$T4"],
Model["BJT", "Q2N2907A", "Q$T5"],
Selector["BJT", "Q2N2907A", "Q$T5"],
Model["BJT", "Q2N2222", "Q$T2"],
Selector["BJT", "Q2N2222", "Q$T2"]}

You can use HoldModels to prevent expansion of a particular device type or model instance.
Do not expand references In[10]:= ExpandSubcircuits[buffer,
to "Q2N2222" devices. DefaultSelector −> AC, Protocol −> Notebook,
HoldModels −> Model[_, "Q2N2222", _]]
Searching model libraries for model "BJT/AC".
Loading model "BJT/AC" from library FullModels‘.
Instantiating model "BJT/AC" for reference Q$T3.
Instantiating model "BJT/AC" for reference Q$T4.
Instantiating model "BJT/AC" for reference Q$T5.
Out[10]= … Netlist@Checked, †37‡D …

If you want to flatten a netlist completely after partial expansion, you must specify
KeepLocalModels −> True to prevent local model definitions and parameter sets from being discarded
by ExpandSubcircuits .
Keep the transistor In[11]:= xbuffer = ExpandSubcircuits[buffer,
instance "Q$T3" and DefaultSelector −> AC, Protocol −> Notebook,
references to "Q2N2222" HoldModels −> {{Model[_, "Q2N2222", _], _},
devices; do not discard {Model[__, "Q$T3"], _}},
local model card data for KeepLocalModels −> True]
these devices.
Searching model libraries for model "BJT/AC".
Loading model "BJT/AC" from library FullModels‘.
Instantiating model "BJT/AC" for reference Q$T4.
Instantiating model "BJT/AC" for reference Q$T5.
Out[11]= … Circuit …

Expand the held model In[12]:= ExpandSubcircuits[xbuffer,


references. DefaultSelector −> AC, Protocol −> Notebook]
Instantiating model "BJT/AC" for reference Q$T1.
Instantiating model "BJT/AC" for reference Q$T3.
Instantiating model "BJT/AC" for reference Q$T2.
Out[12]= … Netlist@Flat, †55‡D …
3.5 Setting Up and Solving Circuit Equations 229

3.5 Setting Up and Solving Circuit Equations


Setting up a system of equations from a netlist description of a circuit is the central step of most circuit
analysis problems you will solve with Analog Insydes. All types of equations can be set up using the
command CircuitEquations (Section 3.5.1). Additionally, there are the commands ACEquations
(Section 3.5.2) and DCEquations (Section 3.5.3) which transform a nonlinear dynamic equation
system into a linear and static equation system, respectively. In order to solve systems of equations
symbolically, Mathematica’s built-in function Solve has been extended to handle DAEObjects as well
(see Section 3.5.4).

3.5.1 CircuitEquations

CircuitEquations[netlist, opts]
sets up a system of circuit equations from a netlist
description
CircuitEquations[circuit, opts]
sets up a system of circuit equations from a circuit
description

Command structure of CircuitEquations .

The first argument of CircuitEquations must be a Circuit or Netlist object. If it is not a flat
netlist, then ExpandSubcircuits will be called first automatically to expand any subcircuit or device
model references. CircuitEquations sets up modified nodal, sparse tableau, or extended sparse
tableau equations for AC, DC, or transient analysis. CircuitEquations returns a DAEObject.
The type and appearance of equations generated with CircuitEquations can be changed with the
following options:
230 3. Reference Manual

option name default value

BranchCurrentPrefix "I$" the prefix used for branch current identifiers


BranchVoltagePrefix "V$" the prefix used for branch voltage identifiers
ControllingCurrentPrefix "IC$" the prefix used for controlling current
identifiers
ControllingVoltagePrefix "VC$" the prefix used for controlling voltage
identifiers
InstanceNameSeparator Inherited[AnalogInsydes]
the separator string for name components
of model variables and reference
designators (see Section 3.14.2)
NodeVoltagePrefix "V$" the prefix used for node voltage identifiers

Naming convention options for CircuitEquations .

option name default value

AnalysisMode AC the circuit analysis mode


FrequencyVariable s the symbol which denotes the complex
Laplace frequency
IndependentVariable Automatic the independent variable for transient
analysis
InitialGuess Automatic the initial guess for the DC solver
InitialTime 0 the initial time for transient analysis
TimeVariable t the symbol which denotes time in transient
analysis

Analysis mode specific options for CircuitEquations .


3.5 Setting Up and Solving Circuit Equations 231

option name default value

ConvertImmittances True whether to convert impedances to


admittances for nodal analysis
ElementValues Value whether to set up numeric or symbolic
equations
Formulation ModifiedNodal the circuit analysis formulation
InitialConditions None whether to use and how to handle initial
conditions for dynamic quantities
MatrixEquation True whether to represent a system of AC
equations as matrix equation
Symbolic All the parameters of behavioral models to be
kept symbolic when setting up symbolic
circuit equations
Value None the parameters of behavioral models to be
kept numeric when setting up symbolic
circuit equations

Equation-formulation options for CircuitEquations .

option name default value

DefaultSelector Automatic the default value to be used by


ExpandSubcircuits to replace generic
model selectors
LibraryPath Inherited[AnalogInsydes]
the search path for device model libraries
(see Section 3.14.3)
ModelLibrary Inherited[AnalogInsydes]
the name of the library to be searched for
device models (see Section 3.14.4)

Model library options for CircuitEquations .


232 3. Reference Manual

option name default value

DesignPoint Automatic the design point for a symbolic DAEObject


IgnoreMissingGround False whether to ignore a missing analog ground
node
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Miscellaneous options for CircuitEquations .

See also: Netlist (Section 3.1.1), Circuit (Section 3.1.2), ExpandSubcircuits (Section 3.4.1),
Chapter 4.3.

Options Description
A detailed description of all CircuitEquations options is given below in alphabetical order:

AnalysisMode
The option AnalysisMode −> mode specifies the circuit analysis mode for which CircuitEquations
sets up a system of equations. Possible values are:

AC small-signal frequency-domain (AC) analysis


DC operating-point (DC) or DC-transfer (DT) analysis
Transient large-signal time-domain (transient) analysis

Values for the AnalysisMode option.

With the setting AnalysisMode −> AC, CircuitEquations sets up a system of small-signal Laplace-
domain equations. CircuitEquations does not linearize nonlinear circuits. Therefore, the first
argument of CircuitEquations must represent a linear circuit. If it contains references to device
models, the AC equivalent circuits of the referenced device are used to set up the equations.
By default, AC equations are set up in matrix formulation, but this can be changed using the
MatrixEquation option (see below).
With the setting AnalysisMode −> DC, CircuitEquations yields a system of (usually nonlinear) DC
equations. Any time derivatives resulting from the constitutive equations of dynamic elements as
well as derivatives with respect to other independent quantities are set to zero.
3.5 Setting Up and Solving Circuit Equations 233

With AnalysisMode −> Transient , you can set up a system of differential-algebraic equations (DAE)
for nonlinear dynamic circuits. The independent variable of transient analysis is given by the value
of the option IndependentVariable , which is not necessarily time.

BranchCurrentPrefix
With
BranchCurrentPrefix −> "string", you can specify the prefix string CircuitEquations prepends to
an element’s reference designator to generate a unique branch current identifier.
For example, with BranchCurrentPrefix −> "I$", the current through a resistor R1 will be named
I$R1.

Symbol["string" <> "refdes"] must yield a valid symbol. Therefore, "string" must not
contain characters which have a special meaning in Mathematica.

BranchVoltagePrefix
With
BranchVoltagePrefix −> "string", you can specify the prefix string CircuitEquations prepends to
an element’s reference designator to generate a unique branch voltage identifier.
For example, with BranchVoltagePrefix −> "V$", the voltage across a resistor R1 will be named
V$R1.

Symbol["string" <> "refdes"] must yield a valid symbol. Therefore, "string" must not
contain characters which have a special meaning in Mathematica.

ControllingCurrentPrefix
With ControllingCurrentPrefix −> "string", you can specify the prefix string CircuitEquations
prepends to the reference designator of a current-controlled source to generate a unique identifier
for the controlling current.
For example, with ControllingCurrentPrefix −> "IC$", the controlling current of a current-
controlled voltage source CV1 will be named IC$CV1.

Symbol["string" <> "refdes"] must yield a valid symbol. Therefore, "string" must not
contain characters which have a special meaning in Mathematica.
234 3. Reference Manual

ControllingVoltagePrefix
With ControllingVoltagePrefix −> "string", you can specify the prefix string CircuitEquations
prepends to the reference designator of a voltage-controlled source to generate a unique identifier
for the controlling voltage.
For example, with ControllingVoltagePrefix −> "VC$", the controlling voltage of a voltage-
controlled voltage source VV1 will be named VC$VV1.

Symbol["string" <> "refdes"] must yield a valid symbol. Therefore, "string" must not
contain characters which have a special meaning in Mathematica.

ConvertImmittances
With the option ConvertImmittances , you can control the way in which CircuitEquations handles
impedances when setting up modified nodal equations. The following values are allowed:

True convert impedances Z to equivalent admittances 1/Z


False do not convert impedances to equivalent admittances

Values for the ConvertImmittances option.

For example, with ConvertImmittances −> True, a resistance R1 will appear as an admittance 1/R1
in a system of modified nodal equations. With ConvertImmittances −> False, the resistance will
not be converted to an admittance, and the MNA equations will be augmented by the branch
current I$R1.

The setting of ConvertImmittances has no influence on sparse tableau equations.


An explicit Pattern specification in a netlist entry for an impedance or admittance
overrides the setting of ConvertImmittances for this element.

DefaultSelector
With the option DefaultSelector , you can specify the key used by ExpandSubcircuits to replace
the right-hand sides of generic device model selector specifications in netlists generated with
ReadNetlist (Section 3.10.1). The setting DefaultSelector −> selector causes all generic selectors
to be replaced by the key selector. Generic selector specifications have the form
Selector −> Selector["device", "type", "instance"]
for example,
3.5 Setting Up and Solving Circuit Equations 235

Selector −> Selector["BJT", "Q2N2222", "Q1"]


Possible values are:

Automatic use value of option AnalysisMode as default model


selector for ExpandSubcircuits
"string" use "string" as default model selector for
ExpandSubcircuits
symbol use SymbolName[symbol] as default model selector for
ExpandSubcircuits

Values for the DefaultSelector option.

The standard setting DefaultSelector −> Automatic causes the default selector to be determined
from the value of the option AnalysisMode . This enables ExpandSubcircuits to load semiconductor
device models from the model library which are compatible with the current analysis mode.

DesignPoint
The DesignPoint option allows you to specify a set of numerical reference values for the circuit
parameters in a symbolic system of circuit equations. It allows the following values:

Automatic extract design-point information from Value and Symbolic


specifications in the netlist
{symbol1 −>value1 , symbol2 −>value2 , † † † }
specify numerical values for symbolic circuit parameters
explicitly
None do not extract design-point information from the netlist

Values for the DesignPoint option.

The design point is stored in the DAEObject returned by CircuitEquations . If available, design-
point information is applied automatically whenever numerical calculations are performed with a
system of equations which has been set up with ElementValues −> Symbolic . The design point can
be extracted from the DAEObject with the function GetDesignPoint (Section 3.6.12).

ElementValues
With ElementValues −> value, you can decide whether CircuitEquations sets up a system of circuit
equations symbolically or numerically. Possible choices are:
236 3. Reference Manual

Value use Value specifications from the value fields of netlist


entries as element values
Symbolic use Symbolic specifications from the value fields of netlist
entries as element values

Values for the ElementValues option.

With the settings ElementValues −> Symbolic and DesignPoint −> Automatic , CircuitEquations
will extract design-point information from a netlist automatically. The design point is stored in the
DAEObject returned by CircuitEquations . It can be retrieved with GetDesignPoint (Section 3.6.12).

Formulation
The option Formulation −> type selects the type of circuit equations set up by CircuitEquations
and allows the following values:

ModifiedNodal modified nodal analysis (MNA)


SparseTableau sparse tableau analysis (STA)
ExtendedTableau extended sparse tableau analysis (ESTA)

Values for the Formulation option.

Modified nodal analysis expresses systems of circuit equations in terms of node voltages and currents
through impedance branches.
Sparse tableau analysis yields systems of circuit equations in terms of all branch currents and branch
voltages.
In addition to the branch currents and voltages, extended sparse tableau analysis also includes all
node voltages of a circuit.

To set up equations for circuits including control network elements, you must use
Formulation −> ModifiedNodal .

FrequencyVariable
With FrequencyVariable −> symbol, you can change the symbol CircuitEquations uses to denote
the complex frequency in AC equations. The default setting is FrequencyVariable −> s.
3.5 Setting Up and Solving Circuit Equations 237

IgnoreMissingGround
IgnoreMissingGround is an option needed for analyzing pure control circuits (also known as block
diagrams). Equation setup for control circuits is based on the modified nodal analysis functionality
for electrical circuits, which are expected to contain a ground node. CircuitEquations displays an
error message when you try to set up equations from a netlist in which no reference to the ground
node is present. As pure control networks do not have ground nodes, these error messages must be
suppressed by means of the IgnoreMissingGround option, which allows the following values:

False display a warning when no ground node is present


True ignore missing ground node when analyzing control
circuits

Values for the IgnoreMissingGround option.

You do not need to set IgnoreMissingGround −> True when a ground node is present in a
circuit containing both electrical and control components.

IndependentVariable
With IndependentVariable −> var, you can specify a variable other than time as independent
variable for transient analysis.
Note that in Analog Insydes, transient analysis does not necessarily mean analysis in the time
domain. You can perform transient analysis, i.e. solving differential-algebraic equations, with respect
to any other independent variable, for instance, temperature. This feature is useful for tasks such
as parametric analyses or sizing problems with differential-algebraic constraints. Possible values for
the IndependentVariable option are:

Automatic use value of option TimeVariable as independent variable


for transient analysis
symbol use symbol as independent variable for transient analysis

Values for the IndependentVariable option.

If AnalysisMode −> Transient , then time-dependent variables or derivatives of circuit variables


with respect to time or other quantities are handled as follows.
238 3. Reference Manual

If the IndependentVariable is not identical to the TimeVariable , then all time derivatives
in a system of circuit equations are set to zero and all explicit references to Time are
replaced by the value of InitialTime .
If the IndependentVariable is identical to the TimeVariable , then any derivatives with
respect to other variables, such as temperature, are set to zero.

InitialConditions
The option InitialConditions allows you to specify how CircuitEquations handles initial
conditions for dynamic quantities, such as capacitor voltages and inductor currents. The following
values are allowed:

Automatic use initial conditions where given in the value field of


netlist entries
All use initial conditions where given explicitly, set initial
conditions of all other dynamic quantities to zero
None do not use any given initial conditions

Values for the InitialConditions option.

InitialTime
With InitialTime −> t0 , you can specify the point of time for which initial conditions are given. By
default, t0 = 0, but you may choose any other value.

NodeVoltagePrefix
With NodeVoltagePrefix −> "string" you can specify the prefix string CircuitEquations prepends
to a node name to generate a node voltage identifier.
For example, with NodeVoltagePrefix −> "V$", the node voltage at node 1 will be named V$1.

Symbol["string" <> "node"] must yield a valid symbol. Therefore, "string" must not contain
characters which have a special meaning in Mathematica.
3.5 Setting Up and Solving Circuit Equations 239

Protocol
This option describes the standard Analog Insydes protocol specification (see Section 3.14.5). The
top-level function for the Protocol option is CircuitEquations . The second-level function is
ExpandSubcircuits . Protocol output generated by models is printed as third level.

Symbolic
The Symbolic option gives you control over the set of symbolic parameters of behavioral models
which are kept as symbolic quantities in a system of circuit equations. The Symbolic option is the
complement of the Value option and expects the following values:

All keep all symbolic parameters of behavioral models in


symbolic form
None replace all symbolic model parameters by numerical values
{instances −> params, † † † } keep only the specified parameters from the given
instances in symbolic form

Values for the Symbolic option.

If the value form {instances −> params, † † † } is chosen, both instances and params can be a string
pattern or a list of string patterns. The instances specification may have the following format:

"pattern" matches any reference designator "refdes" for which


StringMatchQ["refdes", "pattern"] yields True
{"pattern1 ", "pattern2 ", † † † } matches any reference designator that matches at least one
of the patterns; patterns are evaluated in the given order

Format specifications for instances.

The params specification may have the following format:

symbol matches symbol literally


"pattern" matches any symbol arg for which
StringMatchQ[ToString[arg], "pattern"] yields True
{"pattern" | symbol, † † † } matches any symbol that matches at least one of the
patterns; patterns are evaluated in the given order

Format specifications for params.


240 3. Reference Manual

Value takes precedence over Symbolic . Thus, a model parameter listed in the arguments of
both options will be converted to a numerical value.
Symbolic−>None is equivalent to Value−>All .

TimeVariable
With the option TimeVariable −> var, you can change the symbol which CircuitEquations uses to
denote time. By default, this symbol is used to denote the independent variable in transient analysis.
In addition, all explicit references to the identifier Time are replaced by the time variable.

Value
The Value option gives you control over the set of symbolic parameters of behavioral models which
are kept as numeric quantities in a system of circuit equations. The Value option is the complement
of the Symbolic option.

All replace all symbolic parameters of behavioral models by


numerical values
None keep all symbolic parameters of behavioral models in
symbolic form
{instances −> params, † † † } replace only the specified parameters from the given
instances by numerical values

Values for the Value option.

If the value form {instances −> params, † † † } is chosen, both instances and params can be a string
pattern or a list of string patterns. The instances specification may have the following format:

"pattern" matches any reference designator "refdes" for which


StringMatchQ["refdes", "pattern"] yields True
{"pattern1 ", "pattern2 ", † † † } matches any reference designator that matches at least one
of the patterns; patterns are evaluated in the given order

Format specifications for instances.

The params specification may have the following format:


3.5 Setting Up and Solving Circuit Equations 241

symbol matches symbol literally


"pattern" matches any symbol arg for which
StringMatchQ[ToString[arg], "pattern"] yields True
{"pattern" | symbol, † † † } matches any symbol that matches at least one of the
patterns; patterns are evaluated in the given order

Format specifications for params.

Value takes precedence over Symbolic . Thus, a model parameter listed in the arguments of
both options will be converted to a numerical value.
Value−>All is equivalent to Symbolic−>None .

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

This defines an RLC In[2]:= rlcf = Netlist[


lowpass filter circuit. {V1, {1, 0}, V},
{R1, {1, 2}, R},
{L1, {2, 3}, L},
{C1, {3, 0}, C}
]
Out[2]= … Netlist@Raw, †4‡D …

Set up a system of AC In[3]:= CircuitEquations[rlcf, AnalysisMode −> AC] // DisplayForm


equations.
i
j 1y
z
Out[3]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0y
z
j
j z j z j 0z
0z j z j z
1 1

j z j z j z
€€€
R€ - €€€
R€ 0
j
j z
z.j
j z
z == j
j z
z
j
j
j
z
z
z j
j z
z j
j z
z
j z j
j z
z j
j z
z
1 1 1 1
- €€€
€ €€€
€ + €€€€€€
€ - €€€€€€
L s€ V$2
j
j
j
z
0z j z
z k I$V1 { j z
R R Ls

k {
V$3 0
k 0{
1 1
0 - €€€€€€
L s€ €€€€€€
L s€ + C s
V
1 0 0

Set up a system of DC In[4]:= CircuitEquations[rlcf, AnalysisMode −> DC] // DisplayForm


equations.
Out[4]//DisplayForm=
99I$V1 + €€€€€€€€€€€€€€€€
V$1 - V$2 -V$1 + V$2
€€€€€€€€ == 0, I$L1 + €€€€€€€€€€€€€€€€
€€€€€€€€€€€ == 0, -I$L1 == 0, V$1 == V,
-V$2 + V$3 == 0=, 8V$1, V$2, V$3, I$V1, I$L1<, DesignPoint ® 8<=
R R
242 3. Reference Manual

Set up a system of In[5]:= CircuitEquations[rlcf,


time-domain equations. AnalysisMode −> Transient] // DisplayForm
Out[5]//DisplayForm=
99I$V1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD - V$2@tD
€€€€€€€€€ == 0,
R
€€€€€€€€€€€€€ == 0, -I$L1@tD + C V$3 @tD == 0,
-V$1@tD + V$2@tD ¢
I$L1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD == V, -V$2@tD + V$3@tD + L I$L1 @tD == 0=,
R
¢

8V$1@tD, V$2@tD, V$3@tD, I$V1@tD, I$L1@tD<, DesignPoint ® 8<=

Change the branch current In[6]:= CircuitEquations[rlcf,


prefix to "ib$". BranchCurrentPrefix −> "ib$"] // DisplayForm

i
j 1y
z
Out[6]//DisplayForm=
j
j z
z i V$1 y i 0y
j
j z j
j z
z j
j 0z
z
0z j z j z
1 1

j - €€€ z j z j z
€€€
R€ - €€€
R€ 0
j
j z
z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
j
j z j
z j z
z j
j z
z
1 1 1 1
R€ €€€
R€ + €€€€€€
L s€ - €€€€€€
L s€ V$2
j
j 0z
z j z j z
==
j z k ib$V1 {
.
k V{
V$3 0
k 1 0{
1 1
0 - €€€€€€
L s€ €€€€€€
L s€ + C s
0 0

Change the branch voltage In[7]:= CircuitEquations[rlcf, Formulation −> SparseTableau,


prefix to "ub$". BranchVoltagePrefix −> "ub$"] // DisplayForm

i
j
0 y i ub$V1 y
z j z i
j
0y
z
Out[7]//DisplayForm=
j
j
j 0 zz j
j ub$R1 z
z j
j 0zz
j z
z j
j z
z j
j z
z
-1 1 1 1 0 0 0
j
j
j z
z j
j z
z j
j z
z
j
j 0 zz
z j
j z
z j
j z
z
j z j z
0 0 0 0 1 1 0
j
j z j z j z
j
j
j 0 0 -1 1 zz
z
z
j
j
j
j
z
z
ub$C1 z
z
j
j
j
j
z
z
z
z
0 0 0 0 0 -1 1 ub$L1 0
j
j
j z
z j
j z
z j
j z
z
j
j 0 zz
z j
j
j z
z
z j
j
j z
z
z
0 0 0 0 0
j
j z
z j
j z
z j
j z
0z
==
j z j z j z
.
j 0 -1 0
j 0 zz j
j I$R1 z
z j
j z
z
1 0 0 0 0 0 0 I$V1 V
j
j z j z j z
j
j 0 0 Ls 0 zz
z j
j
j z
z
z j
j
j z
z
j z j z j z
j z
0 0 R 0
j z j z z
k 0 0 -1 { k I$C1 { k0{
0 0 -1 0 I$L1 0
0 0 Cs 0 0

Do not convert R and L to In[8]:= CircuitEquations[rlcf,


equivalent admittances. ConvertImmittances −> False] // DisplayForm

i
j
0 y i V$1 y
z j z i
j
0y
z
Out[8]//DisplayForm=
j
j -1 1 zz j
j V$2 zz j
j 0zz
j
j z
z j
j z
z j
j z
z
0 0 0 1 1
j
j z
z j
j z
z j
j z
z
j
j 0 -1 zz j
j z
z j
j z
z
j z j z j z
0 0 0 0
j
j z
z j
j z
z j
j z
j
j
j 0 zz
z j
j
j z
I$V1 z
z j
j
j Vzz
z
z
0 0 Cs 0 V$3 0
j
j z
z j
j z
z j
j z
z
==
j 0 z j z j z
.
j
j z
z j
z j z
z j
j z
j z
1 0 0 0 0
j j z z
k 0 -1 1 0 0 L s { k I$L1 { k0{
-1 1 0 0 R I$R1 0

The DefaultSelector option allows you to choose a different set of device models than would be
normally used for the selected analysis mode. You can use this feature to set up circuit equations
for noise analysis. Noise equations are essentially AC equations with some extensions, that can be
included by selecting noise models instead of plain AC models using DefaultSelector −> Noise.
Read in a PSpice netlist In[9]:= buffer = ReadNetlist[
and small-signal data. "AnalogInsydes/DemoFiles/Buffer.cir",
"AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[9]= … Circuit …
3.5 Setting Up and Solving Circuit Equations 243

Set up a system of AC In[10]:= CircuitEquations[buffer, AnalysisMode −> AC,


equations. Protocol −> {None, Notebook}]
> ExpandSubcircuits...
> Searching model libraries for model "BJT/AC".
> Loading model "BJT/AC" from library FullModels‘.
> Instantiating model "BJT/AC" for reference Q$T1.
> Instantiating model "BJT/AC" for reference Q$T3.
> Instantiating model "BJT/AC" for reference Q$T4.
> Instantiating model "BJT/AC" for reference Q$T5.
> Instantiating model "BJT/AC" for reference Q$T2.
Out[10]= … DAE@AC, †18 ´ 18‡D …

Set up a system of AC In[11]:= CircuitEquations[buffer, AnalysisMode −> AC,


equations with noise DefaultSelector −> Noise, Protocol −> {None, Notebook}]
extensions.
> ExpandSubcircuits...
> Searching model libraries for model "BJT/Noise".
> Loading model "BJT/Noise" from library FullModels‘.
> Instantiating model "BJT/Noise" for reference Q$T1.
> Instantiating model "BJT/Noise" for reference Q$T3.
> Instantiating model "BJT/Noise" for reference Q$T4.
> Instantiating model "BJT/Noise" for reference Q$T5.
> Instantiating model "BJT/Noise" for reference Q$T2.
Out[11]= … DAE@AC, †18 ´ 18‡D …

Specify numerical In[12]:= eqs = CircuitEquations[rlcf, DesignPoint −> {V −> 1.,


reference values for the R −> 1000., L −> 0.001, C −> 2.2*10^−6}]
circuit parameters. Out[12]= … DAE@AC, †4 ´ 4‡D …

Retrieve design point from In[13]:= GetDesignPoint[eqs]


Out[13]= 8V ® 1., R ® 1000., L ® 0.001, C ® 2.2 ´ 10-6 <
DAEObject.

Define an RLC lowpass In[14]:= rlcf2 = Netlist[


filter circuit with {V1, {1, 0}, Symbolic −> V, Value −> 1.},
design-point information. {R1, {1, 2}, Symbolic −> R, Value −> 1000.},
{L1, {2, 3}, Symbolic −> L, Value −> 0.001},
{C1, {3, 0}, Symbolic −> C, Value −> 2.2*10^−6}
]
Out[14]= … Netlist@Raw, †4‡D …

Set up a system of AC In[15]:= CircuitEquations[rlcf2,


equations with numerical ElementValues −> Value] // DisplayForm
coefficients.

i
j
1y
z
Out[15]//DisplayForm=
j
j z i
j
V$1 y
z i
j
0 y
z
j
j -0.001 0.001 + €€€€€€€€ 0z
z
z j
j z
z j
j 0 zz
0.001 -0.001 0
j z j z j z
j
j
j z
z
z.j
j
j
j
z
z
z
z == j
j
j
j
z
z
z
z
j z j
j z j z
1000. 1000.

j s 0z
s €€€€ - €€€€€€€€
s €€€€

j z j z j z
V$2
j
j z z
z k I$V1 { j z
k {
1000. 1000. -6 V$3 0
k 0{
0 - €€€€€€€€
s € €€€ €€€€€€€€
s €€€€ + 2.2 ´ 10
1 0 0 1.
244 3. Reference Manual

Set up a symbolic system In[16]:= eqssym = CircuitEquations[rlcf2,


of AC equations. ElementValues −> Symbolic]
Out[16]= … DAE@AC, †4 ´ 4‡D …

Show the equations. In[17]:= eqssym // DisplayForm

i €€€
j 1y
z
Out[17]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0y
z
j
j z j z j 0z
0z j z j z
1 1

j z j z j z
R€ - €€€
R€ 0
j
j
j
z
z
z.j
j z
z == j
j z
z
j
j z j
j z
z j
j 0z
z
j 0z
z j
j V$3 zz j
j z
z
1 1 1 1
- €€€
€ €€€
€ + €€€€€€
€ - €€€€€€
L s€ V$2
j
j z j
z z j z
j z k I$V1 {
R R Ls

k V{
k 0{
1 1
0 - €€€€€€
L s€ €€€€€€
L s€ + C s
1 0 0

Get the design point from In[18]:= GetDesignPoint[eqssym]


Out[18]= 8V ® 1., R ® 1000., L ® 0.001, C ® 2.2 ´ 10-6 <
the DAEObject.

Set up a system of sparse In[19]:= CircuitEquations[rlcf,


tableau equations. Formulation −> SparseTableau] // DisplayForm

i
j
0 y i V$V1 y
z j z i
j
0y
z
Out[19]//DisplayForm=
j
j
j 0 zz
z j
j
j V$R1 z
z
z j
j
j 0zz
z
j z j z j z
-1 1 1 1 0 0 0
j
j
j
z
z j
j z
z j
j z
z
j
j 0 zz
z j
j
j z
z
z j
j
j
z
z
z
0 0 0 0 1 1 0
j
j z
z j
j z
z j
j z
j
j 0
j 0 0 -1 1 zz
z
j
j
j
z
V$C1 z
z
j
j
j 0zz
z
z
0 0 0 0 0 -1 1 V$L1 0
j
j z j z j z
j
j
j 0 zz
z
z
j
j
j
j
z
z
z
z
j
j
j
j
z
z
z
z
0 0 0
j
j z
z j
j z
z j
j z
z
==
j 0 z j z j z
.
j
j z
z j
j z
z j
j z
z
1 0 0 0 0 0 0 I$V1 V
j
j z
z j
j z
z j
j z
j
j 0 0 Ls 0 zz j
j z
I$L1 z j
j 0zz
j z j z j z
j z
0 -1 0 0 0 R 0 I$R1 0
j z j z z
k 0 0 -1 { k I$C1 { k {
0 0 -1 0
0 0 Cs 0 0 0

Set up a system of In[20]:= CircuitEquations[rlcf,


extended sparse tableau Formulation −> ExtendedTableau] // DisplayForm
equations.

i1 0
j
0 y i V$V1 y
z j z i0z
j y
Out[20]//DisplayForm=
j
j 0 zz j
j V$R1 z
z j
j 0zz
j
j z
z j
j z
z j
j z
z
0 0 0 0 0 0 -1 0
j
j z
z j
j z
z j
j z
z
j
j
j z
z j
j z
z j
j z
z
z j z j z
0 1 0 0 0 0 0 0 -1 1
j
j z
z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
j z j z j z
0 0 1 0 0 0 0 0 0 -1 1 V$L1 0
j
j z
z j
j z
z j
j z
j
j0 0
j 0 zz
z j
j
j z
I$V1 z
z j
j
j 0zz
z
z
0 0 0 1 0 0 0 0 0 0 -1 V$C1 0
j
j
j z
z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
z j z j z
0 0 1 1 0 0 0 0
j
j z
z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
j z j z j z
0 0 0 0 0 -1 1 0 0 0 0 . I$R1 == 0
j
j z
z j
j z
z j
j z
z
j
j z
z j
j z
I$C1 z j
j z
z
j z j z j z
0 0 0 0 0 0 -1 1 0 0 0 I$L1 0
j
j z
z j
j z
z j
j z
z
j
j z
z j
j z
z j
j z
z
j z j z j z
1 0 0 0 0 0 0 0 0 0 0 V
j
j z
z j
j z
z j
j z
z
j z j z j
j z j z j z
j z
-1
j z j z z
0 0 0 0 R 0 0 0 0 0 V$1 0

k { k { k {
0 0 -1 0 0 0 L s 0 0 0 0 V$2 0
0 0 0 C s 0 0 0 -1 0 0 0 V$3 0

The default setting for the complex frequency is FrequencyVariable −> s, which is the most widely
used symbol. However, some people prefer to use the setting FrequencyVariable −> p.
3.5 Setting Up and Solving Circuit Equations 245

Use the symbol p to In[21]:= CircuitEquations[rlcf,


denote the complex FrequencyVariable −> p] // DisplayForm
frequency.

i €€€
j 1y
z
Out[21]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0y
z
j z j z j
j 0z j z j 0zz
1 1

j - €€€ z
R€ - €€€
R€ 0
j z j z j z
j
j
j
z
z
z.j
j
j
j
z
z
z
z == j
j
j
j
z
z
z
z
j
j z
z j z j z
1 1 1 1
€ €€€€€€
€ + €€€
€ - €€€€€€
L p€
j z j z j z
V$2
j
j
0z
z j z j z
R Lp R

j z k I$V1 { k {
1 1 V$3 0
k 1 0{
0 - €€€€€€
L p€ €€€€€€
L p€ + C p
V
0 0

This defines a simple In[22]:= fbloop = Netlist[


control circuit with a {HS1, {in}, X[Frequency]},
signal source, a forward {HG1, {in, out}, Hf[Frequency]},
signal path, and a {HG2, {out, in}, Hfb[Frequency]}
feedback path. ]
Out[22]= … Netlist@Raw, †3‡D …

By default, CircuitEquations prints a warning because the netlist does not contain a reference to
the electrical ground node 0. To turn off the warning, you must set IgnoreMissingGround −> True.
Set up modified nodal In[23]:= CircuitEquations[fbloop, NodeVoltagePrefix −> "x$"]
equations for the control Netlist::gndnode: Found no connections to the ground node.
circuit.
Netlist::lttc: Less than two connections at node(s) {0}.

Out[23]= … DAE@AC, †2 ´ 2‡D …

This tells Analog Insydes In[24]:= fbleqs = CircuitEquations[fbloop,


to ignore the missing IgnoreMissingGround −> True, NodeVoltagePrefix −> "x$"];
reference to ground. fbleqs // DisplayForm
Out[25]//DisplayForm=
J N.J N == J N
1 -Hfb@sD x$in X@sD
-Hf@sD 1 x$out 0

This defines a circuit with In[26]:= tempckt = Netlist[


two time-varying and {V1, {1, 0}, V1},
temperature-dependent {R1, {1, 2}, R1[Time]*(1 + TC11*TEMP)},
resistors. {R2, {2, 0}, R2[Time]*(1 + TC12*TEMP)},
{C1, {2, 0}, C1}
]
Out[26]= … Netlist@Raw, †4‡D …

By default, TEMP is simply regarded as a global parameter. Equations for transient analysis are
formulated with time as independent variable.
Set up circuit equations In[27]:= CircuitEquations[tempckt,
for time-domain analysis. AnalysisMode −> Transient] // DisplayForm
Out[27]//DisplayForm=
99I$V1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
H1 + TC11 TEMPL R1@tD
V$1@tD - V$2@tD
€€€€€€€€€€€€€€€€
€€€€€€€ == 0,

€€€€€€€ + C1 V$2 @tD == 0,


H1 + TC12 TEMPL R2@tD H1 + TC11 TEMPL R1@tD
V$2@tD -V$1@tD + V$2@tD ¢
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€

V$1@tD == V1=, 8V$1@tD, V$2@tD, I$V1@tD<, DesignPoint ® 8<=


246 3. Reference Manual

Now we use TEMP as independent variable. This causes the time derivative due to C1 to be set to
zero and Time to be replaced by the value of InitialTime .
Designate temperature as In[28]:= CircuitEquations[tempckt, AnalysisMode −> Transient,
independent variable. IndependentVariable −> TEMP] // DisplayForm
Out[28]//DisplayForm=
99I$V1@TEMPD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
H1 + TC11 TEMPL R1@0D
V$1@TEMPD - V$2@TEMPD
€€€€€€€€€€€€€€€€
€€€€€€€€€€ == 0,

H1 + TC12 TEMPL R2@0D H1 + TC11 TEMPL R1@0D


V$2@TEMPD -V$1@TEMPD + V$2@TEMPD
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€ == 0, V$1@TEMPD ==

V1=, 8V$1@TEMPD, V$2@TEMPD, I$V1@TEMPD<, DesignPoint ® 8<=

This assigns an initial In[29]:= rlcfic = Netlist[


condition to the inductor {V1, {1, 0}, V},
L1. {R1, {1, 2}, R},
{L1, {2, 3}, Value −> L, InitialCondition −> iL0},
{C1, {3, 0}, C}
]
Out[29]= … Netlist@Raw, †4‡D …

By default, initial conditions are ignored by CircuitEquations . To use the given initial conditions,
you must specify InitialConditions −> Automatic or InitialConditions −> All.
Set up circuit equations In[30]:= CircuitEquations[rlcfic,
for transient analysis. AnalysisMode −> Transient] // DisplayForm
Out[30]//DisplayForm=
99I$V1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD - V$2@tD
€€€€€€€€€ == 0,
R
€€€€€€€€€€€€€ == 0, -I$L1@tD + C V$3 @tD == 0,
-V$1@tD + V$2@tD ¢
I$L1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD == V, -V$2@tD + V$3@tD + L I$L1 @tD == 0=,
R
¢

8V$1@tD, V$2@tD, V$3@tD, I$V1@tD, I$L1@tD<, DesignPoint ® 8<=

Use initial conditions only In[31]:= CircuitEquations[rlcfic, AnalysisMode −> Transient,


where specified explicitly. InitialConditions −> Automatic] // DisplayForm
Out[31]//DisplayForm=
99I$V1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD - V$2@tD
€€€€€€€€€ == 0,
R
€€€€€€€€€€€€€ == 0, -I$L1@tD + C V$3 @tD == 0,
-V$1@tD + V$2@tD ¢
I$L1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD == V, -V$2@tD + V$3@tD + L I$L1 @tD == 0, I$L1@0D == iL0=,
R
¢

8V$1@tD, V$2@tD, V$3@tD, I$V1@tD, I$L1@tD<, DesignPoint ® 8<=

Use given initial In[32]:= CircuitEquations[rlcfic, AnalysisMode −> Transient,


conditions, set all other InitialConditions −> All] // DisplayForm
initial conditions to zero.
Out[32]//DisplayForm=
99I$V1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD - V$2@tD -V$1@tD + V$2@tD
€€€€€€€€€ == 0, I$L1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€ == 0,
-I$L1@tD + C V$3 @tD == 0, V$1@tD == V,
R R

-V$2@tD + V$3@tD + L I$L1 @tD == 0, I$L1@0D == iL0, V$3@0D == 0=,


¢
¢

8V$1@tD, V$2@tD, V$3@tD, I$V1@tD, I$L1@tD<, DesignPoint ® 8<=


3.5 Setting Up and Solving Circuit Equations 247

Use the symbol t0 to In[33]:= CircuitEquations[rlcfic, AnalysisMode −> Transient,


denote the initial time. InitialConditions −> All, InitialTime −> t0
] // DisplayForm
Out[33]//DisplayForm=
99I$V1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
V$1@tD - V$2@tD -V$1@tD + V$2@tD
€€€€€€€€€ == 0, I$L1@tD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€ == 0,
-I$L1@tD + C V$3 @tD == 0, V$1@tD == V,
R R

-V$2@tD + V$3@tD + L I$L1 @tD == 0, I$L1@t0D == iL0, V$3@t0D == 0=,


¢
¢

8V$1@tD, V$2@tD, V$3@tD, I$V1@tD, I$L1@tD<, DesignPoint ® 8<=

Change the node voltage In[34]:= CircuitEquations[rlcf,


prefix to "vn$". NodeVoltagePrefix −> "vn$"] // DisplayForm

i
j 1y
z
Out[34]//DisplayForm=
j
j z
z i
j
vn$1 y
z i
j
0y
z
j
j z j vn$2 z j 0z
0z j z j z
1 1

j z j z j z
€€€
R€ - €€€
R€ 0
j
j z
z j
j z
z j
j z
z
j
j
j
z
z
z j
j z
z j
j z
z
j z j
j z
z j
j z
z
1 1 1 1
- €€€
R€ €€€
R€ + €€€€€€
L s€ - €€€€€€
L s€
j
j 0z
z j z j z
==
j z k I$V1 {
.
k V{
vn$3 0
k 1 0{
1 1
0 - €€€€€€
L s€ €€€€€€
L s€ + C s
0 0

With the default settings


Symbolic −> All and Value −> None, all device parameters of the diode appear in symbolic form
when you set up a system of circuit equations with ElementValues −> Symbolic.
This defines a simple In[35]:= rectifier = Netlist[
half-wave diode rectifier {V1, {1, 0}, Symbolic −> Vin,
circuit. Value −> 5*Sin[2*Pi*50*Time]},
{D1, {1 −> A, 2 −> C}, Model −> "Diode",
Selector −> Selector["Diode", "Spice", "D1"]},
{RL, {2, 0}, Symbolic −> RL, Value −> 1000.0},
{CL, {2, 0}, Symbolic −> CL, Value −> 2.2*^−5}
]
Out[35]= … Netlist@Raw, †4‡D …

Set up symbolic circuit In[36]:= CircuitEquations[rectifier, AnalysisMode −> Transient,


equations for transient ElementValues −> Symbolic] // DisplayForm
analysis.
Out[36]//DisplayForm=
99I$AC$D1@tD + I$V1@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + CL V$2 @tD == 0,
V$2@tD ¢
RL
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == Vin, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=,
1. $q HV$1@tD-V$2@tDL
3.
€€€€€€€€€€€€€€€€ TEMP

8V$1@tD, V$2@tD, I$V1@tD, I$AC$D1@tD<, DesignPoint ®


TEMP
TNOM

8Vin ® 5 Sin@100 Π tD, RL ® 1000., CL ® 0.000022, AREA$D1 ® 1.,


BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

You can also tell CircuitEquations to treat all device parameters as numeric quantities.
248 3. Reference Manual

Replace all parameters in In[37]:= CircuitEquations[rectifier, AnalysisMode −> Transient,


device model equations by ElementValues −> Symbolic, Symbolic −> None
numerical values. ] // DisplayForm
Out[37]//DisplayForm=
99I$AC$D1@tD + I$V1@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + CL V$2 @tD == 0,
V$2@tD ¢
RL

1. ´ 10-14 H-1 + ã38.6635 HV$1@tD-V$2@tDL L + 1. ´ 10-12 HV$1@tD - V$2@tDL=,


V$1@tD == Vin, I$AC$D1@tD ==

8V$1@tD, V$2@tD, I$V1@tD, I$AC$D1@tD<, DesignPoint ®


8Vin ® 5 Sin@100 Π tD, RL ® 1000., CL ® 0.000022<=

Finally, the Symbolic option allows you to specify for each device or group of devices the parameters
which CircuitEquations should keep in symbolic form.
Keep only the parameters In[38]:= CircuitEquations[rectifier,
AREA and TEMP of all AnalysisMode −> Transient, ElementValues −> Symbolic,
diode instances "D*" in Symbolic −> {"D*" −> {AREA, TEMP}}] // DisplayForm
symbolic form, replace all

99I$AC$D1@tD + I$V1@tD == 0,
other model parameters by Out[38]//DisplayForm=

-I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + CL V$2 @tD == 0, V$1@tD == Vin,


numerical values.
V$2@tD ¢
RL
12881.4 H-1.+0.00333167 TEMPL
I$AC$D1@tD == 3.69815 ´ 10-22 AREA$D1 㠀€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
TEMP€€€€€€€€€€€€€€€€
€€€€€€€€€

I-1 + 㠀€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ M TEMP3. + 1. ´ 10-12 HV$1@tD - V$2@tDL=,


11604.8 HV$1@tD-V$2@tDL

8V$1@tD, V$2@tD, I$V1@tD, I$AC$D1@tD<, DesignPoint ®


TEMP €€€€€€€€ €€€€€€

8Vin ® 5 Sin@100 Π tD, RL ® 1000.,


CL ® 0.000022, AREA$D1 ® 1., TEMP ® 300.15<=

Use the symbol Τ to In[39]:= CircuitEquations[tempckt, AnalysisMode −> Transient,


denote time. TimeVariable −> \[Tau]] // DisplayForm
Out[39]//DisplayForm=
99I$V1@ΤD + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
H1 + TC11 TEMPL R1@ΤD
V$1@ΤD - V$2@ΤD
€€€€€€€€€€€€€€€€
€€€€€€€ == 0,

€€€€€€€ + C1 V$2 @ΤD == 0,


H1 + TC12 TEMPL R2@ΤD H1 + TC11 TEMPL R1@ΤD
V$2@ΤD -V$1@ΤD + V$2@ΤD ¢
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€

V$1@ΤD == V1=, 8V$1@ΤD, V$2@ΤD, I$V1@ΤD<, DesignPoint ® 8<=

With the default settings


Symbolic −> All and Value −> None, all device parameters of the diode appear in symbolic form
when you set up a system of circuit equations with ElementValues −> Symbolic .
3.5 Setting Up and Solving Circuit Equations 249

Set up a system of In[40]:= CircuitEquations[rectifier, AnalysisMode −> Transient,


symbolic circuit equations ElementValues −> Symbolic] // DisplayForm
for transient analysis.
Out[40]//DisplayForm=
99I$AC$D1@tD + I$V1@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + CL V$2 @tD == 0,
V$2@tD ¢
RL
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == Vin, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=,
1. $q HV$1@tD-V$2@tDL
3.
€€€€€€€€€€€€€€€€ TEMP

8V$1@tD, V$2@tD, I$V1@tD, I$AC$D1@tD<, DesignPoint ®


TEMP
TNOM

8Vin ® 5 Sin@100 Π tD, RL ® 1000., CL ® 0.000022, AREA$D1 ® 1.,


BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

You can also tell CircuitEquations to treat all device parameters as numeric quantities.
Replace all parameters in In[41]:= CircuitEquations[rectifier, AnalysisMode −> Transient,
device model equations by ElementValues −> Symbolic, Value −> All] // DisplayForm
numerical values.
Out[41]//DisplayForm=
99I$AC$D1@tD + I$V1@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + CL V$2 @tD == 0,
V$2@tD ¢
RL

1. ´ 10-14 H-1 + ã38.6635 HV$1@tD-V$2@tDL L + 1. ´ 10-12 HV$1@tD - V$2@tDL=,


V$1@tD == Vin, I$AC$D1@tD ==

8V$1@tD, V$2@tD, I$V1@tD, I$AC$D1@tD<, DesignPoint ®


8Vin ® 5 Sin@100 Π tD, RL ® 1000., CL ® 0.000022<=

Finally, the Value option allows you to specify for each device or group of devices the parameters
which CircuitEquations should treat as numeric quantities.
Replace the parameters In[42]:= CircuitEquations[rectifier,
TEMP, TNOM, $k, and $q of AnalysisMode −> Transient, ElementValues −> Symbolic,
the model instance D1 by Value −> {"D1" −> {TEMP, TNOM, $k, $q}}] // DisplayForm
their numerical values.

99I$AC$D1@tD + I$V1@tD == 0,
Out[42]//DisplayForm=

-I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + CL V$2 @tD == 0, V$1@tD == Vin,


V$2@tD ¢

I$AC$D1@tD == 1. AREA$D1 H-1 + ã38.6635 HV$1@tD-V$2@tDL L IS$D1 + GMIN


RL

HV$1@tD - V$2@tDL=, 8V$1@tD, V$2@tD, I$V1@tD, I$AC$D1@tD<,


DesignPoint ® 8Vin ® 5 Sin@100 Π tD, RL ® 1000., CL ® 0.000022,
AREA$D1 ® 1., BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0,
GMIN ® 1. ´ 10-12 , IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0,
PERIM$D1 ® 0, RS$D1 ® 0, CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=
250 3. Reference Manual

3.5.2 ACEquations

ACEquations[dae, oppoint, sources]


linearizes equations about oppoint, replaces sources by
values (specified via sources), and returns an AC DAEObject
ACEquations[dae, oppoint] linearizes equations using the AC source specifiations
given by the ModeValues option stored in dae

Command structure of ACEquations .

Given a Transient or DC DAEObject, ACEquations linearizes the equation system about the given
operating point oppoint and returns an AC DAEObject. The operating point is given by a list of
rules of the form var −> value for each variable of the equation system. It is possible to assign
values to time derivatives of variables, too. The list of value mappings is added to the DesignPoint
option of the returned DAEObject. During linearization, the values of AC sources are replaced by
their AC value as given by sources, where sources is a list of rules of the form acsource −> val for
each parameter representing an AC source. If this third argument is omitted, the AC values are
automatically extracted from the ModeValues option stored in the DAEObject.
Note that, given a Netlist or Circuit object, you can set up AC equations directly using
CircuitEquations (Section 3.5.1).
ACEquations provides the following options:

option name default value

FrequencyVariable Automatic specifies the symbol denoting the complex


Laplace frequency
OperatingPointPostfix "$op" string to append to variable names
denoting symbolic operating points
DerivativePostfix "d" string to append to variable names
denoting derivatives

Options for ACEquations .

See also: DCEquations (Section 3.5.3), CircuitEquations (Section 3.5.1).

Options Description
A detailed description of all ACEquations options is given below in alphabetical order:
3.5 Setting Up and Solving Circuit Equations 251

DerivativePostfix
If symbol names denoting derivates of varibles have to be created during linearization, the value
of the DerivativePostfix option is appended to the variable name. Thus, the value of the
DerivativePostfix option has to be a string which can be converted to a valid Mathematica
symbol. The default setting is DerivativePostfix −> "d".

FrequencyVariable
The option FrequencyVariable specifies the symbol denoting the complex Laplace frequency. If set
to Automatic , the value of the option FrequencyVariable as stored in the DAEObject dae is used.
The default setting is FrequencyVariable −> Automatic .

OperatingPointPostfix
If the given operating point list oppoint contains a rule of the form var −> value, the rule opvar −> value
is added to the DesignPoint option of the returned DAEObject, where opvar is given by appending
the value of the OperatingPointPostfix option to the variable name var. Thus, the value of the
OperatingPointPostfix option has to be a string which can be converted to a valid Mathematica
symbol. The default setting is OperatingPointPostfix −> "$op".

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= rectifier = Circuit[


of a simple diode rectifier Netlist[
circuit. {V0, {1, 0}, Symbolic −> V0,
Value −>2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice",
GMIN −> 0, AREA −> 1}
]
]
Out[2]= … Circuit …

Set up transient equation In[3]:= tran = CircuitEquations[rectifier,


system. ElementValues −> Symbolic,
AnalysisMode −> Transient,
Value −> {"*" −> {TEMP, TNOM, $q, $k, AREA, GMIN}}]
Out[3]= … DAE@Transient, †4 ´ 4‡D …
252 3. Reference Manual

Show equation system. In[4]:= tran // DisplayForm


Out[4]//DisplayForm=
99I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢

V$1@tD == V0, I$AC$D1@tD == 1. H-1 + ã38.6635 HV$1@tD-V$2@tDL L IS$D1=,


R1

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<,


DesignPoint ® 8V0 ® 2. Sin@1000000 tD, R1 ® 100.,
C1 ® 1. ´ 10-7 , BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

Out[5]= 8V$2 ® 0., V$1 ® 0., I$V0 ® 0., I$AC$D1 ® 0.<


Calculate operating point. In[5]:= op = First[NDAESolve[tran, {t, 0.}]]

Linearize equations about In[6]:= ac = ACEquations[tran, op, {V0 −> 1}]


the operating point. Out[6]= … DAE@AC, †4 ´ 4‡D …

Extract equation system. In[7]:= GetEquations[ac]

9I$AC$D1 + I$V0 == 0, -I$AC$D1 + J €€€€€€€ + C1 sN V$2 == 0,


Out[7]=
1

V$1 == V0, I$AC$D1 - 38.6635 ã38.6635 HV$1$op-V$2$opL IS$D1 V$1 +


R1

38.6635 ã38.6635 HV$1$op-V$2$opL IS$D1 V$2 == 0=

Display design point In[8]:= GetDesignPoint[ac]

8R1 ® 100., C1 ® 1. ´ 10-7 , BV$D1 ® ¥, GLEAK$D1 ® 0,


stored in the DAEObject.
Out[8]=
Note that new parameters
have been generated.
GLEAKSW$D1 ® 0, IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 ,
ISW$D1 ® 0, PERIM$D1 ® 0, RS$D1 ® 0, CD$D1 ® 0, CJO$D1 ® 0,
CJSW$D1 ® 0, V0 ® 1, V$1$op ® 0., V$2$op ® 0., I$V0$op ® 0.,
I$AC$D1$op ® 0., V0$op ® 2. Sin@1000000 t$opD<

3.5.3 DCEquations

DCEquations[dae] transforms a dynamic Transient DAEObject into a static


DC DAEObject

Command structure of DCEquations .

Given a Transient DAEObject, DCEquations transforms the dynamic equations into a static system
and returns a DC DAEObject. All derivatives with respect to the IndependentVariable (as stored
in the DAEObject) are replaced by zero. The initial time is inserted into both the equations and the
design point. Depending on the value of the ModeValues option, the values of independent sources
stored in the DesginPoint option of the DAEObject are replaced by the corresponding DC values
stored in the ModeValues option of the DAEObject.
Note that, given a Netlist or Circuit object, you can set up DC equations directly using
CircuitEquations (Section 3.5.1).
3.5 Setting Up and Solving Circuit Equations 253

DCEquations provides the following options:

option name default value

InitialTime Automatic initial time to insert into the equation and


the design point
ModeValues Automatic whether to extract independent source
values from the ModeValues option of the
DAEObject

Options for DCEquations .

See also: ACEquations (Section 3.5.2), CircuitEquations (Section 3.5.1).

Options Description

InitialTime
The option InitialTime specifies the value (which can be any Mathematica expression) to be
substituted for the independent variable in the equation system and the design point. If the value
of the InitialTime option is set to Automatic , the initial time is extracted from the InitialTime
option stored in the DAEObject. The default setting is InitialTime −> Automatic .

ModeValues
The option ModeValues specifies whether values of independent sources should be updated in the
DesignPoint option of the returned DAEObject. If the value of the ModeValues option is set to
Automatic , DC values of independent sources are extracted from the ModeValues option stored in the
DAEObject. If the value of the ModeValues option is set to None, the values of independent sources
are used as-is. Note that in both cases the initial time is inserted into the design-point values. The
default setting is ModeValues −> Automatic .

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
254 3. Reference Manual

Define netlist description In[2]:= rectifier = Circuit[


of a simple diode rectifier Netlist[
circuit. {V0, {1, 0}, Symbolic −> V0,
Value −>2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice",
GMIN −> 0, AREA −> 1}
]
]
Out[2]= … Circuit …

Set up transient equation In[3]:= tran = CircuitEquations[rectifier,


system. ElementValues −> Symbolic,
AnalysisMode −> Transient,
Value −> {"*" −> {TEMP, TNOM, $q, $k, AREA, GMIN}}]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Show equation system. In[4]:= tran // DisplayForm


Out[4]//DisplayForm=
99I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢

V$1@tD == V0, I$AC$D1@tD == 1. H-1 + ã38.6635 HV$1@tD-V$2@tDL L IS$D1=,


R1

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<,


DesignPoint ® 8V0 ® 2. Sin@1000000 tD, R1 ® 100.,
C1 ® 1. ´ 10-7 , BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

Transform dynamic In[5]:= dc = DCEquations[tran]


equations into a static Out[5]= … DAE@DC, †4 ´ 4‡D …
system.

Show equation system. In[6]:= dc // DisplayForm


Out[6]//DisplayForm=
99I$AC$D1 + I$V0 == 0, -I$AC$D1 + €€€€€€€€€€ == 0,
V$2

V$1 == V0, I$AC$D1 == 1. H-1 + ã38.6635 HV$1-V$2L L IS$D1=,


R1

8V$1, V$2, I$V0, I$AC$D1<, DesignPoint ®


8V0 ® 0, R1 ® 100., C1 ® 1. ´ 10-7 , BV$D1 ® ¥, GLEAK$D1 ® 0,
GLEAKSW$D1 ® 0, IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0,
PERIM$D1 ® 0, RS$D1 ® 0, CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=
3.5 Setting Up and Solving Circuit Equations 255

3.5.4 Solve

Solve[dae] solves a system of equations given by dae for all variables


Solve[dae, var] solves for one variable
Solve[dae, {var1 , var2 , † † † }] solves for several variables

Command structure of Solve.

In order to symbolically solve systems of equations formulated by the function CircuitEquations ,


Mathematica’s built-in function Solve has been extended to handle DAEObjects as well. Solve returns
its result as lists of rules of the form {{var1 −> expr1 }, † † † }, where the variables var are assigned
symbolic expressions expr.
See also: CircuitEquations (Section 3.5.1), ACAnalysis (Section 3.7.3), NDAESolve (Section 3.7.5).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description. In[2]:= vdiv = Netlist[


{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …

Set up a system of In[3]:= vdiveqs = CircuitEquations[vdiv]


small-signal equations. Out[3]= … DAE@AC, †3 ´ 3‡D …

Display equations. In[4]:= DisplayForm[vdiveqs]

i €€€€€
j 1zy i V$1 y
Out[4]//DisplayForm=
j z j i 0 zy
j
j
j z
z
z j V$2 z
j z
z j
j
j 0 zz
j z j z
1 1

j z
R1€ - €€€€€
R1€

j
j R1 z j
z j z
z j
j z
z
k { k {
==
k 1 0{
- 1
€€€€€
€ 1
€€€€€
€ + 1
€€€€€
€ 0 .
R1 R2
0 I$V0 V0

Solve only for the variable In[5]:= Solve[vdiveqs, V$2]

Out[5]= 99V$2 ® €€€€€€€€€€€€€€€€€€ ==


V$2. R2 V0
R1 + R2

Solve for the variables V$1 In[6]:= Solve[vdiveqs, {V$1, V$2}]

Out[6]= 99V$2 ® €€€€€€€€€€€€€€€€€€ , V$1 ® V0==


and V$2. R2 V0
R1 + R2

Solve for all variables. In[7]:= solution = Solve[vdiveqs]

Out[7]= 99I$V0 ® - €€€€€€€€€€€€€€€€€€ , V$2 ® €€€€€€€€€€€€€€€€€€ , V$1 ® V0==


V0 R2 V0
R1 + R2 R1 + R2
256 3. Reference Manual

Extract value of V$2 from In[8]:= V$2 /. First[solution]


the list of solutions. R2 V0
Out[8]= €€€€€€€€€€€€€€€€€€
R1 + R2
3.6 Circuit and DAEObject Manipulation 257

3.6 Circuit and DAEObject Manipulation


This chapter describes a number of functions which simplify the usage of the key objects existing
in Analog Insydes, the Netlist object, the Circuit object, and the DAEObject. These functions
allow you to manipulate the objects without knowledge of the internal data format. The following
functions are available:

AddElements (Section 3.6.1) inserting netlist elements


DeleteElements (Section 3.6.2) deleting netlist elements
GetElements (Section 3.6.3) extracting netlist elements
RenameNodes (Section 3.6.4) renaming node identifiers
Statistics (Section 3.6.17) showing contents of a Circuit object

Functions dealing with Netlist and Circuit objects.

GetEquations (Section 3.6.5) extracting equations


GetMatrix (Section 3.6.6) extracting matrix
GetVariables (Section 3.6.7) extracting variables
GetRHS (Section 3.6.8) extracting right-hand side vector
GetParameters (Section 3.6.9) extracting parameters
GetDAEOptions (Section 3.6.10) extracting options
SetDAEOptions (Section 3.6.11) setting and modifying options
GetDesignPoint (Section 3.6.12) extracting design point
ApplyDesignPoint (Section 3.6.13)
inserting design point
UpdateDesignPoint (Section 3.6.14)
modifying design point
MatchSymbols (Section 3.6.15) matching symbol names
ShortenSymbols (Section 3.6.16) shortening symbol names
Statistics (Section 3.6.17) showing contents of a DAEObject

Functions dealing with DAEObjects.


258 3. Reference Manual

3.6.1 AddElements

AddElements[netlist, element] adds netlist entry element to netlist


AddElements[circuit, element] adds netlist entry element to the top-level netlist of circuit
AddElements[circuit, element, subcirspec]
adds netlist entry to subcircuits specified by subcirspec

Command structure of AddElements .

Given a Netlist or Circuit object, AddElements adds a new netlist element to the top-level netlist
or to subcircuits defined in the circuit and returns the new Netlist or Circuit object, respectively.
The subcircuits are given by means of the subcircuit specification subcirspec which is a sequence of
rules of the following form:

sequence description
Name−>stringpattern1 , Selector−>stringpattern 2
adds netlist entry to subcircuits whose Name matches
stringpattern1 and whose Selector matches stringpattern2
Name−>stringpattern equivalent to Name−>stringpattern, Selector−>"*"
Selector−>stringpattern equivalent to Name−>"*", Selector−>stringpattern

Possible subcircuit specifications.

The new netlist element is added to all subcircuits, whose Name and Selector fields match the string
pattern given by the subcircuit specification.
Note that there is no check whether the returned circuit defines a valid netlist.
See also: DeleteElements (Section 3.6.2), GetElements (Section 3.6.3).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define a simple voltage In[2]:= net =


divider circuit. Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …

Add a load resistance to In[3]:= netload = AddElements[net, {Rload, {2, 0}, Rload}]
the voltage divider. Out[3]= … Netlist@Raw, †4‡D …
3.6 Circuit and DAEObject Manipulation 259

Out[4]//DisplayForm= Netlist HRaw, 4 EntriesL:


Display new netlist. In[4]:= DisplayForm[netload]

8V0, 81, 0<, V0<


8R1, 81, 2<, R1<
8R2, 82, 0<, R2<
8Rload, 82, 0<, Rload<

3.6.2 DeleteElements

DeleteElements[netlist, stringpattern]
removes those netlist entries from netlist whose reference
designator matches stringpattern
DeleteElements[circuit, stringpattern]
removes those netlist entries from the top-level netlist of
circuit whose reference designator matches stringpattern
DeleteElements[circuit, stringpattern, subcirspec]
removes netlist entries in subcircuits specified by subcirspec

Command structure of DeleteElements .

Given a Netlist or Circuit object, DeleteElements removes netlist elements from the top-level
netlist or from subcircuits defined in the circuit and returns the new Netlist or Circuit object,
respectively. The argument stringpattern is either a single string pattern or a list of string patterns.
Netlist elements whose reference designator matches any of the string patterns are removed. To delete
elements in subcircuits, referencing to certain subcircuits is performed by means of the subcircuit
specification subcirspec which is a sequence of rules of the following form:

sequence description
Name−>stringpattern1 , Selector−>stringpattern 2
deletes netlist entries in subcircuits whose Name matches
stringpattern1 and whose Selector matches stringpattern2
Name−>stringpattern equivalent to Name−>stringpattern, Selector−>"*"
Selector−>stringpattern equivalent to Name−>"*", Selector−>stringpattern

Possible subcircuit specifications.

Note that there is no check whether the returned Circuit object defines a valid circuit.
See also: AddElements (Section 3.6.1), GetElements (Section 3.6.3).
260 3. Reference Manual

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define a simple voltage In[2]:= netload =


divider with load Netlist[
resistance. {V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2},
{Rload, {2, 0}, Rload}
]
Out[2]= … Netlist@Raw, †4‡D …

Remove all elements In[3]:= net = DeleteElements[netload, "*load"]


whose reference designator Out[3]= … Netlist@Raw, †3‡D …
match the string pattern
"*load" .

Out[4]//DisplayForm= Netlist HRaw, 3 EntriesL:


Display new netlist. In[4]:= DisplayForm[net]

8V0, 81, 0<, V0<


8R1, 81, 2<, R1<
8R2, 82, 0<, R2<

3.6.3 GetElements

GetElements[netlist, stringpattern]
extracts those netlist entries from netlist whose reference
designator matches stringpattern
GetElements[circuit, stringpattern]
extracts those netlist entries from the top-level netlist of
circuit whose reference designator matches stringpattern

Command structure of GetElements .

Given a Netlist or Circuit object, GetElements extracts netlist elements from the top-level netlist
and returns a list of these elements. The argument stringpattern is either a single string pattern or a
list of string patterns. Netlist elements whose reference designator matches any of the string patterns
are extracted.
See also: AddElements (Section 3.6.1), DeleteElements (Section 3.6.2).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.6 Circuit and DAEObject Manipulation 261

Define a simple voltage In[2]:= netload =


divider. Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2},
{Rload, {2, 0}, Rload}
]
Out[2]= … Netlist@Raw, †4‡D …

Extract all elements whose In[3]:= GetElements[netload, "R*"]

88R1, 81, 2<, R1<, 8R2, 82, 0<, R2<, 8Rload, 82, 0<, Rload<<
reference designator match
Out[3]=
the string pattern "R*".

3.6.4 RenameNodes

RenameNodes[netlist, repl] renames nodes in netlist


RenameNodes[circuit, repl] renames nodes in the top-level netlist of circuit

Command structure of RenameNodes .

Given a Netlist or Circuit object, RenameNodes changes node names in the top-level netlist and
returns the new Netlist or Circuit object, respectively. The replacements repl are given as a single
rule, a sequence of rules, or as a list of replacement rules of the form oldnodename −> newnodename.
The node names can be given as symbols or as strings.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define a simple voltage In[2]:= net =


divider. Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …

Out[3]= 8V$1, V$2, I$V0<


Show variable names. In[3]:= GetVariables[CircuitEquations[net]]

The variable of interest – the voltage at node 2 – is called V$2. To mark this variable as the output
variable we rename node 2 to OUT. Then the output variable is called V$OUT.
Rename node 2 to OUT. In[4]:= net2 = RenameNodes[net, {2 −> OUT}]
Out[4]= … Netlist@Raw, †3‡D …
262 3. Reference Manual

Out[5]//DisplayForm= Netlist HRaw, 3 EntriesL:


Display netlist. In[5]:= DisplayForm[net2]

8V0, 81, 0<, V0<


8R1, 81, OUT<, R1<
8R2, 8OUT, 0<, R2<

Out[6]= 8V$1, V$OUT, I$V0<


Show variable names. In[6]:= GetVariables[CircuitEquations[net2]]
Now the variable of
interest is called V$OUT.

3.6.5 GetEquations

GetEquations[dae] returns the list of equations stored in dae

Command structure of GetEquations .

Given a DAEObject dae, GetEquations returns the equation system stored in the object as a list of
equations. In case of an AC DAEObject the internal matrix representation is converted to a list of
linear equations.
See also: GetMatrix (Section 3.6.6), GetVariables (Section 3.6.7), GetRHS (Section 3.6.8),
GetParameters (Section 3.6.9), GetDAEOptions (Section 3.6.10), GetDesignPoint (Section 3.6.12).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= cir =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C}, Model −> "Diode"}
]
]
Out[2]= … Circuit …

Set up Transient DAE In[3]:= dae = CircuitEquations[cir, AnalysisMode −> Transient,


system. DefaultSelector −> "Spice", ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …
3.6 Circuit and DAEObject Manipulation 263

Return list of equations. In[4]:= GetEquations[dae]

9I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,


Out[4]=
V$2@tD ¢
R1
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == V0, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=
1. $q HV$1@tD-V$2@tDL TEMP 3.
€€€€€€€€€€€€€€€€
TEMP
TNOM

Set up AC DAE system. In[5]:= daeac = CircuitEquations[cir, AnalysisMode −> AC,


DefaultSelector −> "SpiceAC", ElementValues −> Symbolic]
Out[5]= … DAE@AC, †3 ´ 3‡D …

The system is set up as a In[6]:= DisplayForm[daeac]


matrix equation.
i
j 1yz
Out[6]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0 y
z
j
j z
z j
j z
z j
j 0 zz
1 1

j z j z j z
€€€€€€€€
€€€€ + Cd$D1 s - €€€€€€€€
€€€€ - Cd$D1 s
j + C1 s + Cd$D1 s 0 z j z j z
j z j
z z j z
Rd$D1 Rd$D1

j Rd$D1 k { k {
1 1 1 . V$2 ==
k 0{
- €€€€€€€€€€€€ - Cd$D1 s €€€€€
R1€ + €€€€€€€€
Rd$D1 €€€€
1 0 I$V0 V0

Return value is again a In[7]:= GetEquations[daeac]


list of equations.

9I$V0 + J €€€€€€€€€€€€€€€€ + Cd$D1 sN V$1 + J- €€€€€€€€€€€€€€€€ - Cd$D1 sN V$2 == 0,


Out[7]=
1 1
Rd$D1 Rd$D1
J- €€€€€€€€€€€€€€€€ - Cd$D1 sN V$1 + J €€€€€€€ + €€€€€€€€€€€€€€€€ + C1 s + Cd$D1 sN V$2 == 0,
1 1 1
Rd$D1 R1 Rd$D1
V$1 == V0=

3.6.6 GetMatrix

GetMatrix[dae] returns the matrix equations stored in dae

Command structure of GetMatrix .

Given a DAEObject dae, GetMatrix returns the matrix A of the linear equation system A × x = b
stored in the object.
Please note that GetMatrix is only valid for AC DAEObjects.
See also: GetEquations (Section 3.6.5), GetVariables (Section 3.6.7), GetRHS (Section 3.6.8),
GetParameters (Section 3.6.9), GetDAEOptions (Section 3.6.10), GetDesignPoint (Section 3.6.12).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
264 3. Reference Manual

Define a simple voltage In[2]:= net =


divider netlist. Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …

Set up AC DAE system. In[3]:= dae = CircuitEquations[net]


Out[3]= … DAE@AC, †3 ´ 3‡D …

Return matrix A. In[4]:= GetMatrix[dae] // MatrixForm

i
j 1y
z
j
j z
z
j
Out[4]//MatrixForm= j z
0z
1 1

j z
€€€€€
R1€ - €€€€€
R1€

j
j - €€€€€ z
z
k 1 0{
1 1 1
R1€ €€€€€
R1€ + €€€€€
R2€
0

3.6.7 GetVariables

GetVariables[dae] returns the list of variables stored in dae

Command structure of GetVariables .

Given a DAEObject dae, GetVariables returns the list of variables stored in the object. For AC

8symb[t],       < where symb is a symbol and t is the independent variable.


and DC DAEObjects this is a list of symbols, for Transient DAEObjects this is a list of the form

See also: GetEquations (Section 3.6.5), GetMatrix (Section 3.6.6), GetRHS (Section 3.6.8),
GetParameters (Section 3.6.9), GetDAEOptions (Section 3.6.10), GetDesignPoint (Section 3.6.12).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= cir =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C}, Model −> "Diode"}
]
]
Out[2]= … Circuit …

Set up AC DAE system. In[3]:= dae = CircuitEquations[cir, AnalysisMode −> AC,


DefaultSelector −> "SpiceAC"]
Out[3]= … DAE@AC, †3 ´ 3‡D …
3.6 Circuit and DAEObject Manipulation 265

Out[4]= 8V$1, V$2, I$V0<


Return list of variables In[4]:= GetVariables[dae]
stored in dae.

Set up Transient DAE In[5]:= daetran = CircuitEquations[cir,


system. AnalysisMode −> Transient, DefaultSelector −> "Spice"]
Out[5]= … DAE@Transient, †4 ´ 4‡D …

Out[6]= 8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<


Return list of variables In[6]:= GetVariables[daetran]
stored in daetran.

3.6.8 GetRHS

GetRHS[dae] returns the right-hand side source vector stored in dae

Command structure of GetRHS.

Given a DAEObject dae, GetRHS returns the right-hand side source vector b of the linear equation
system A × x = b stored in the object.
Please note that GetRHS is only valid for AC DAEObjects.
See also: GetEquations (Section 3.6.5), GetMatrix (Section 3.6.6), GetVariables (Section 3.6.7),
GetParameters (Section 3.6.9), GetDAEOptions (Section 3.6.10), GetDesignPoint (Section 3.6.12).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define a simple voltage In[2]:= net =


divider netlist. Netlist[
{V0, {1, 0}, V0},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]= … Netlist@Raw, †3‡D …

Set up AC DAE system. In[3]:= dae = CircuitEquations[net]


Out[3]= … DAE@AC, †3 ´ 3‡D …

Return vector b. In[4]:= GetRHS[dae] // MatrixForm

i
j
0 y
z
Out[4]//MatrixForm= j
j
j
j 0 zz
z
z
j z
k V0 {
266 3. Reference Manual

3.6.9 GetParameters

GetParameters[dae] returns the list of parameters stored in dae

Command structure of GetParameters .

Given a DAEObject dae, GetParameters returns the list of parameters occuring in the equation
system of the object.
Note that GetParameters differs from GetDesignPoint in that it returns only those parameters
which appear in the equations of dae. Moreover, it returns a list of symbols, not a list of replacement
rules.
See also: GetEquations (Section 3.6.5), GetMatrix (Section 3.6.6), GetVariables (Section 3.6.7),
GetRHS (Section 3.6.8), GetDAEOptions (Section 3.6.10), GetDesignPoint (Section 3.6.12).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= cir =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[cir,


AnalysisMode −> Transient, ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Return list of parameters In[4]:= GetParameters[dae]

8AREA$D1, C1, GMIN, IS$D1, R1, TEMP, TNOM, V0, $k, $q<
occuring in the equations
Out[4]=
of dae.
3.6 Circuit and DAEObject Manipulation 267

3.6.10 GetDAEOptions

GetDAEOptions[dae] returns the list of options stored in the DAEObject dae


GetDAEOptions[dae, symb] returns the value of the option symb stored in dae
GetDAEOptions[dae, {symb1 , symb2 , † † † }]
returns a list of values of the options symbi stored in dae

Command structure of GetDAEOptions .

Besides the equation system and the list of variables, a DAEObject contains a list of arbitrary options.
Use GetDAEOptions to extract these options: GetDAEOptions[dae] returns a list of all options stored
in the DAEObject dae. If a second argument is specified and is an option symbol, the value of this
option stored in the DAEObject is returned. If it is a list of option symbols, a list of the option
values is returned.
The function CircuitEquations (Section 3.5.1) automatically adds a number of options to the
DAEObject which have been used during equation setup.
To extract the DesignPoint option of a DAEObject it is recommended to use the function
GetDesignPoint .
See also: SetDAEOptions (Section 3.6.11), GetEquations (Section 3.6.5), GetMatrix (Section 3.6.6),
GetVariables (Section 3.6.7), GetRHS (Section 3.6.8), GetDesignPoint (Section 3.6.12).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= cir =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[cir,


AnalysisMode −> Transient, ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …
268 3. Reference Manual

Return the list of all In[4]:= GetDAEOptions[dae]

8AnalysisMode ® Transient,
options stored in dae.
Out[4]=

BranchCurrentPrefix ® I$, BranchVoltagePrefix ® V$,


ControllingCurrentPrefix ® IC$, ControllingVoltagePrefix ® VC$,

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,


ConvertImmittances ® True, DesignPoint ®

BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,


IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<,
ElementValues ® Symbolic, Formulation ® ModifiedNodal,
FrequencyVariable ® s, IgnoreMissingGround ® False,

InitialGuess ® 8I$AC$D1 ® 0, V$1 - V$2 ® 0<, InitialTime ® 0,


IndependentVariable ® t, InitialConditions ® None,

ModeValues ® 8<, NodeVoltagePrefix ® V$,


InstanceNameSeparator ® $, MatrixEquation ® True,

Symbolic ® All, TimeVariable ® t, Value ® None<

Out[5]= 8t, 0<


Return special options In[5]:= GetDAEOptions[dae, {IndependentVariable, InitialTime}]
stored in dae.

3.6.11 SetDAEOptions

SetDAEOptions[dae, name−>val] stores the value val of the option name in dae, removing
any previously stored value for this option
SetDAEOptions[dae, {name1 −>val1 , name2 −>val2 , † † † }]
stores the values vali for the options namei in dae

Command structure of SetDAEOptions .

Besides the equation system and the list of variables, a DAEObject contains a list of arbitrary options.
Use SetDAEOptions to store or to update options in a DAEObject: SetDAEOptions[dae, name −> val]
stores the value val of the option name in dae and returns the new list of options. If the second
argument is a list of option rules, the value for each option rule is stored. Previously stored values
for the given options are replaced by the new values and new options are appended to the list of
options. Note that SetDAEOptions alters the given DAEObject rather than returning a new object.
Instead it returns the updated option list.
In contrast to the Mathematica function SetOptions , the function SetDAEOptions does not check
whether a given option is a valid DAEObject option. Any option is a valid DAEObject option and
can be stored in the object (there is no Options[DAEObject] ).
To alter the DesignPoint option of a DAEObject it is recommended to use the function
UpdateDesignPoint .
See also: GetDAEOptions (Section 3.6.10), GetEquations (Section 3.6.5), GetMatrix (Section 3.6.6),
GetVariables (Section 3.6.7), GetRHS (Section 3.6.8), GetDesignPoint (Section 3.6.12),
UpdateDesignPoint (Section 3.6.14).
3.6 Circuit and DAEObject Manipulation 269

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= cir =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[cir,


AnalysisMode −> Transient, ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Inspect the value of the In[4]:= GetDAEOptions[dae, InitialTime]


InitialTime option in Out[4]= 0
dae.

Alter the value of the In[5]:= SetDAEOptions[dae, InitialTime −> 0.5]

8AnalysisMode ® Transient,
InitialTime option.
Out[5]=

BranchCurrentPrefix ® I$, BranchVoltagePrefix ® V$,


ControllingCurrentPrefix ® IC$, ControllingVoltagePrefix ® VC$,

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,


ConvertImmittances ® True, DesignPoint ®

BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,


IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<,
ElementValues ® Symbolic, Formulation ® ModifiedNodal,
FrequencyVariable ® s, IgnoreMissingGround ® False,

InitialGuess ® 8I$AC$D1 ® 0, V$1 - V$2 ® 0<,


IndependentVariable ® t, InitialConditions ® None,

ModeValues ® 8<, NodeVoltagePrefix ® V$, Symbolic ® All,


InstanceNameSeparator ® $, MatrixEquation ® True,

TimeVariable ® t, Value ® None, InitialTime ® 0.5<

Note that dae was altered In[6]:= GetDAEOptions[dae, InitialTime]


by SetDAEOptions . Out[6]= 0.5
270 3. Reference Manual

You can set arbitrary In[7]:= SetDAEOptions[dae,


options with arbitrary Comment −> "This object describes a rectifier circuit"]

8AnalysisMode ® Transient,
values.
Out[7]=

BranchCurrentPrefix ® I$, BranchVoltagePrefix ® V$,


ControllingCurrentPrefix ® IC$, ControllingVoltagePrefix ® VC$,

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,


ConvertImmittances ® True, DesignPoint ®

BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,


IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<,
ElementValues ® Symbolic, Formulation ® ModifiedNodal,
FrequencyVariable ® s, IgnoreMissingGround ® False,

InitialGuess ® 8I$AC$D1 ® 0, V$1 - V$2 ® 0<,


IndependentVariable ® t, InitialConditions ® None,

ModeValues ® 8<, NodeVoltagePrefix ® V$, Symbolic ® All,


InstanceNameSeparator ® $, MatrixEquation ® True,

TimeVariable ® t, Value ® None, InitialTime ® 0.5,


Comment ® This object describes a rectifier circuit<

3.6.12 GetDesignPoint

GetDesignPoint[dae] returns the design point stored in dae


GetDesignPoint[dae, param] returns the value of the parameter param from the design
point stored in dae
GetDesignPoint[dae, {param1 , param2 , † † † }]
returns the value of each parameter parami

Command structure of GetDesignPoint .

Given a DAEObject dae, GetDesignPoint returns the design point list stored in the object. If a
symbol is given as a second argument, the value of the corresponding parameter stored in the design
point is returned. If the second argument is a list of symbols, a list of the corresponding parameter
values is returned.
Note that GetDesignPoint differs from GetParameters in that it returns the complete design point
stored in dae and not only those parameters which appear in the equations of dae.
See also: GetEquations (Section 3.6.5), GetMatrix (Section 3.6.6), GetVariables (Section 3.6.7),
GetRHS (Section 3.6.8), GetParameters (Section 3.6.9), GetDAEOptions (Section 3.6.10).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.6 Circuit and DAEObject Manipulation 271

Define netlist description In[2]:= cir =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[cir,


AnalysisMode −> Transient, ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Return design point stored In[4]:= GetDesignPoint[dae]


in dae.
8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,
Out[4]=

BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,


IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<

Return the values of the In[5]:= GetDesignPoint[dae, {R1, C1}]


Out[5]= 8100., 1. ´ 10-7 <
parameters R1 and C1.

3.6.13 ApplyDesignPoint

ApplyDesignPoint[dae, stringpattern]
replaces all parameters of dae matching stringpattern with
their numerical values
ApplyDesignPoint[dae, {stringpattern1 , stringpattern2 , † † † }]
replaces all parameters matching a list of string patterns
with their numerical values
ApplyDesignPoint[dae] replaces all parameters of the design point with their
numerical values

Command structure of ApplyDesignPoint .

Given a DAEObject, ApplyDesignPoint returns a new DAEObject where all parameters in the
equation system which match a string pattern stringpattern are replaced with their numerical values
stored in the DesignPoint option of dae. If a list of string patterns is given, all parameters which
match at least one of the patterns are replaced. By default, all replaced parameters are removed from
272 3. Reference Manual

the DesignPoint option in the returned DAEObject. You can use the option Cleanup to change this
behavior (see below). Note that matching is performed using string patterns.
It is possible to specify a symbol symb instead of a string pattern as parameter to
ApplyDesignPoint , which is equivalent to specifying the string pattern "symb". This is also valid
for the option KeepSymbolic (see below).
ApplyDesignPoint has the following options:

option name default value

Cleanup True removes unused parameters from the


design point
KeepSymbolic {} specifies parameters to be kept symbolic
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Options for ApplyDesignPoint .

See also: UpdateDesignPoint (Section 3.6.14).

Options Description

Cleanup
This option allows for removing parameters from the design point of a DAEObject that do not occur
in the corresponding equations.
The default setting is Cleanup −> True, which means that at least all those parameters which have
been inserted numerically are removed from the design point.

KeepSymbolic
By default, all parameters which match one of the string patterns stringpatterni are replaced by their
numerical value. The option KeepSymbolic allows for filtering this list of replaced parameters. The
option value must be a list of string patterns.
All parameters which match at least one of these string patterns are kept symbolic even if they
match the string patterns given as arguments to ApplyDesignPoint . This option is especially useful
to insert the numerical value for a model parameter keeping the parameter of a specific instance
symbolic. For example,
ApplyDesignPoint[dae, "AREA*", KeepSymbolic −> {"AREA$Q1"}]
3.6 Circuit and DAEObject Manipulation 273

inserts the numerical value of the model parameter AREA for each instance except for the instance Q1
for which the parameter is kept symbolic.
The default setting is KeepSymbolic −> {}, which means not to filter the parameters to be inserted
numerically.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist. In[2]:= cir =


Circuit[
Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[cir, AnalysisMode −> Transient,


ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Show DAE system. In[4]:= DisplayForm[dae]


Out[4]//DisplayForm=
99I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢
R1
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == V0, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=,
1. $q HV$1@tD-V$2@tDL
3.
€€€€€€€€€€€€€€€€ TEMP

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<, DesignPoint ®


TEMP
TNOM

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,


BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

Insert numerical values for In[5]:= daenew = ApplyDesignPoint[dae, "*",


all parameters except KeepSymbolic −> {AREA$D1}]
AREA$D1 .
Out[5]= … DAE@Transient, †4 ´ 4‡D …
274 3. Reference Manual

Show new DAE system. In[6]:= DisplayForm[daenew]

88I$AC$D1@tD + I$V0@tD == 0,
Note that parameters are
Out[6]//DisplayForm=
removed from the
-I$AC$D1@tD + 0.01 V$2@tD + 1. ´ 10-7 V$2 @tD == 0,
DesignPoint option of ¢
daenew.
I$AC$D1@tD == 1. ´ 10-14 AREA$D1 H-1 + ã38.6635 HV$1@tD-V$2@tDL L +
V$1@tD == 2. Sin@1000000 tD,

1. ´ 10-12 HV$1@tD - V$2@tDL<, 8V$1@tD, V$2@tD,


I$V0@tD, I$AC$D1@tD<, DesignPoint ® 8AREA$D1 ® 1.<<

3.6.14 UpdateDesignPoint

UpdateDesignPoint[dae, repl] allows for modifying the DesignPoint by replacement


rules

Command structure of UpdateDesignPoint .

Given a DAEObject dae,


UpdateDesignPoint replaces all parameters in the DesignPoint option stored in dae according to
the replacement rules repl and returns the new DAEObject. The replacements repl are given as a list
of rules of the form symbol −> newvalue which means to replace the value of the parameter symbol by
the new numerical value newvalue in the design point of the DAEObject. If a replacement rule is of
the form stringpattern −> newvalue then the value of each parameter which matches the string pattern
is replaced by newvalue. This can for example be used to set a model parameter to a common value
for each instance of this model.
If UpdateDesignPoint is called without a second argument, the values of the design point are not
changed. However, if the option Cleanup is set to True (which is the default), unused parameters
are removed from the design point. Thus, this pattern is useful for stripping the design point to the
relevant data.
UpdateDesignPoint has the following options:

option name default value

Cleanup True removes unused parameters from the


design point
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Options for UpdateDesignPoint .

See also: ApplyDesignPoint (Section 3.6.13).


3.6 Circuit and DAEObject Manipulation 275

Options Description

Cleanup
This option allows for removing parameters from the design point of a DAEObject that do not occur
in the corresponding equations.
The default setting is Cleanup −> True, which means to remove all those parameters from the design
point which do not occur in the equation system.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist. In[2]:= cir =


Circuit[
Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[cir, AnalysisMode −> Transient,


ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Show DAE system. In[4]:= DisplayForm[dae]


Out[4]//DisplayForm=
99I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢
R1
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == V0, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=,
1. $q HV$1@tD-V$2@tDL
3.
€€€€€€€€€€€€€€€€ TEMP

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<, DesignPoint ®


TEMP
TNOM

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,


BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

Store new values for the In[5]:= daenew = UpdateDesignPoint[dae,


parameters R1, C1, and V0 {R1 −> 10., C1 −> 1.*^−6, V0 −> 1.}]
in the design point. Out[5]= … DAE@Transient, †4 ´ 4‡D …
276 3. Reference Manual

Show updated design In[6]:= GetDesignPoint[daenew]


point of daenew. Note
8V0 ® 1., R1 ® 10., C1 ® 1. ´ 10-6 , AREA$D1 ® 1.,
Out[6]=
that unused parameters
are removed from the

TNOM ® 300.15, $k ® 1.38062 ´ 10-23 , $q ® 1.60219 ´ 10-19 <


design point. GMIN ® 1. ´ 10-12 , IS$D1 ® 1. ´ 10-14 , TEMP ® 300.15,

3.6.15 MatchSymbols

MatchSymbols[expr, matchgroups]
matches symbols in an expression expr
MatchSymbols[dae, matchgroups]
matches symbols in a system of equations dae

Command structure of MatchSymbols .

Given an expression expr or a DAEObject dae, MatchSymbols replaces all symbols which belong to a
given matching group
matchgroups by a common symbol and returns a new expression or DAEObject, respectively. The
matching groups must be specified as lists of the form: {suffix1 , suffix2 , † † † , matchsuffix}.
Please note that the function pattern for equations uses the design-point information stored in the
DAEObject to validate the matching specifications.
MatchSymbols has the following options:

option name default value

DesignPoint Automatic list of numerical reference values for


symbolic element values in a set of circuit
equations
Tolerance 0.1 tolerance specification for matching the
symbols in a matching group

Options for MatchSymbols .

See also: ShortenSymbols (Section 3.6.16).

Options Description

DesignPoint
With
DesignPoint −> {symbol1 −> value1 , † † † } you can overwrite the design point given in the DAEObject
3.6 Circuit and DAEObject Manipulation 277

(see also CircuitEquations in Section 3.5.1). The default setting is DesignPoint −> Automatic ,
which means to use the design point given in the DAEObject.

Tolerance
Tolerance −> tol specifies the maximum relative deviation of the values of the symbols in a matching
group from the group’s mean value.
Please note that the option Tolerance is neglected if the DAEObject contains no design-point
information.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist. In[2]:= net =


Netlist[
{V0, {1, 0}, 1},
{R1, {1, 2}, Symbolic −> R1, Value −> 10.},
{R2, {2, 3}, Symbolic −> R2, Value −> 10.},
{R3, {3, out}, Symbolic −> R3, Value −> 10.},
{RL, {out, 0}, Load}
]
Out[2]= … Netlist@Raw, †5‡D …

Set up equations. In[3]:= dae = CircuitEquations[net, ElementValues −> Symbolic];


DisplayForm[dae]

i
j €€€€€ 1y
z
Out[4]//DisplayForm=
j
j z
z i V$1 z y i0z y
j
j - €€€€€€ €€€€€€ + €€€€€ z j
z j V$2 z
j
j 0z
1 1

j 0z j z j z
R1€ - €€€€€
R1€ 0 0
j
j z
z j
j z
z j
j z
z
j
j z
z j
j
j z
z j
j z
z
j
j z
z j z
z j
j z
z
1 1 1 1
€ - €€€€€
R2€
j z j z
0
j
j 0z
z j
j z
z j
j z
z
j z
R1 R1 R2

j
j z j
z j
j z
z j
j z
z
z j z
==
j 0z
1 1 1 1 . V$3 0
j z j z
- €€€€€
R2€ €€€€€
R2€ + €€€€€R3€ - €€€€€
R3€
j z
0
j
j z
z k I$V0 { k1{
V$out 0

k 1 0{
1 1 1
0 0 - €€€€€
R3€ €€€€€€€€€
Load€ + €€€€€
R3€
0 0 0

Compute voltage transfer In[5]:= vout = V$out /. First[Solve[dae]]


function. Load
Out[5]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€
Load + R1 + R2 + R3

Match symbols of resistors In[6]:= MatchSymbols[vout, {"R*", R}]


R1, R2, and R3. Load
Out[6]= €€€€€€€€€€€€€€€€
€€€€€€€€€
Load + 3 R
278 3. Reference Manual

Match symbols of resistors In[7]:= daematch = MatchSymbols[dae, {"R*", R}];


in the DAEObject. DisplayForm[daematch]

i €€€
j y
1z
Out[8]//DisplayForm=
j z
z i
j z V$1 y i 0y
j j
j z j z
j 0z V$2 z j 0z
1 1

j z j z j z
R€ - €€€
R€ 0 0
j
j z
z j
j
j
z
z
z
j
j
j
z
z
z
j
j
j z
z j
j z
z j
j z
z
j z.j
0z z j z
1 2 1
- €€€
€ €€€
€ - €€€€
j z j z
0
j
j z
z j
j z
z j
j z
z
j z
R R R

j z j
j z
V$out z j
j z
j z j z j z
j z
==
j z
1 2 1 V$3 0
j z z
- €€€€ €€€
€ - €€€

j 0z
0
j
j z
z k I$V0 {
R R

k1{
0

k 1 0{
1 1 1
0 0 - €€€ R€ €€€€€€€€€
Load€ + €€€ R€
0 0 0

Compute matched voltage In[9]:= V$out /. First[Solve[daematch]]


transfer function. Load
Out[9]= €€€€€€€€€€€€€€€€
€€€€€€€€€
Load + 3 R

Modify values of resistors In[10]:= daenew = UpdateDesignPoint[dae, {R2 −> 15., R3 −> 20.}]
R2 and R3. Out[10]= … DAE@AC, †5 ´ 5‡D …

Match symbols of resistors In[11]:= MatchSymbols[daenew, {"R*", R}] // DisplayForm


of the modified MatchSymbols::mtol:
DAEObject. Design−point values of matching group {R1, R2, R3}
do not meet the tolerance specification.

i
j €€€€€ 1y
z
Out[11]//DisplayForm=
j
j z
z i V$1 z
j y i0z
j y
j z j z j
j 0z 0z
1 1

j - €€€€€ z j z j z
R1€ - €€€€€
R1€ 0 0
j
j z
z j
j z
z j
j z
z
j z j
j z
z j
j z
j
j
j z
z j
j
z.j V$3 zz j
== j 0zz
z
1 1 1 1
R1€ €€€€€
R1€ + €€€€€
R2€ - €€€€€
R2€
z j z
0
j 0z
V$2
j
j z
z j
j z
z j
j z
z
j
j z j
z j
j z
z j
j z
z
j 0z z j z
1 1 1 1

j z j z
- €€€€€
R2€ €€€€€
R2€ + €€€€€
R3€ - €€€€€
R3€
j z
0
j
j z
z k I$V0 { k1{
V$out 0

k 1 0{
1 1 1
0 0 - €€€€€
R3€ €€€€€€€€€
Load€ + €€€€€
R3€
0 0 0

3.6.16 ShortenSymbols

ShortenSymbols[dae] replaces symbols in dae by a set of symbols with shorter


symbol names

Command structure of ShortenSymbols .

Given a DAEObject dae, ShortenSymbols replaces all symbols (variables and parameters) by a set of
new symbols with shorter symbol names and returns a new DAEObject. Please note that the new
symbols are generated at the expense of instance information as name components enclosed by the
InstanceNameSeparator are dropped.
ShortenSymbols has the following options:
3.6 Circuit and DAEObject Manipulation 279

option name default value

InstanceNameSeparator Inherited[AnalogInsydes]
specifies the character(s) used to separate
name components of variables and
parameters, see InstanceNameSeparator
(Section 3.14.2)
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Options for ShortenSymbols .

See also: MatchSymbols (Section 3.6.15).

3.6.17 Statistics

Statistics[netlist] prints type and number of netlist elements in a Netlist


object netlist
Statistics[circuit] prints type and number of netlist elements in a Circuit
object circuit
Statistics[dae] prints complexity information of a DAEObject dae

Command structure of Statistics .

The command Statistics can be used to display both type and number of the netlist elements in
a circuit or a netlist. Additionally, you can obtain detailed information concerning the complexity of
a DAEObject.
Statistics[circuit] and Statistics[netlist] provide the following information:

type and number of occurrence of each netlist element


type and number of occurrence of each model/selector call
total number of entries

Statistics[dae] for DC and Transient DAEObjects provides the following information:


280 3. Reference Manual

number of equations
number of variables
number of top-level terms for each equation
number of terms which involve derivatives
number of terms for each level

Statistics[dae] for AC DAEObjects provides the following information:

number of equations
number of variables
total number of entries
number of non-zero entries
complexity estimate (only if the DAEObject option ElementValues is set to Symbolic , and
if the option value for the time constraint is chosen large enough)

Statistics has the following options:

option name default value

Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
TimeConstraint 10 specifies the maximum number of seconds
for the complexity estimate computation for
AC DAEObjects

Options for Statistics.

TimeConstraint
TimeConstraint specifies the number of seconds after which the computation of the complexity
estimate for an AC DAEObject is aborted. The option value may be any positive numeric value or
Infinity . The default setting is TimeConstraint −> 10.
3.6 Circuit and DAEObject Manipulation 281

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist. In[2]:= cir =


Circuit[
Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Display netlist information In[3]:= Statistics[cir]


using Statistics .
Number of Resistors : 1
Number of Capacitors : 1
Number of VoltageSources : 1
Number of models Diode/Spice : 1
Total number of elements : 4
Set up DAE system. In[4]:= dae = CircuitEquations[cir, AnalysisMode −> Transient];
dae // DisplayForm

88I$AC$D1@tD + I$V0@tD == 0,
Out[5]//DisplayForm=

-I$AC$D1@tD + 0.01 V$2@tD + 1. ´ 10-7 V$2 @tD == 0,


¢

1. ´ 10-14 H-1 + ã38.6635 HV$1@tD-V$2@tDL L + 1. ´ 10-12 HV$1@tD - V$2@tDL<,


V$1@tD == 2. Sin@1000000 tD, I$AC$D1@tD ==

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<, DesignPoint ® 8<<

Display complexity In[6]:= Statistics[dae]


information using
Number of equations : 4
Statistics .
Number of variables : 4
Length of equations : {2, 3, 2, 5}
Terms with derivatives : 1
Sums in levels : {12, 2}
282 3. Reference Manual

3.7 Numerical Analyses


This chapter describes the standard numerical analyses types you can perform with most numerical
circuit simulators. The following table shows the supported analyses and their corresponding Analog
Insydes functions:

ACAnalysis (Section 3.7.3) small-signal (AC) analysis


NoiseAnalysis (Section 3.7.4) noise analysis
NDAESolve (Section 3.7.5) operating-point (DC) analysis
NDAESolve (Section 3.7.5) DC-transfer (DT) analysis
NDAESolve (Section 3.7.5) large-signal (transient) analysis

Section 3.7.1 starts with an introduction of the Analog Insydes numerical data format, which all of
the above mentioned functions rely on. Section 3.7.2 describes the format which is used in Analog
Insydes to perform parameter sweeps.

3.7.1 Analog Insydes Numerical Data Format


This section introduces the simulation data format used in Analog Insydes. Some functions like
ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4), NDAESolve (Section 3.7.5), or
ReadSimulationData (Section 3.10.3) need to return numerical data which represents zero, one, or
multi-dimensional numerical data. This data will be returned in the following form:
{{l1 −> v1 , l2 −> v2 ,       ,
SweepParameters −> {p1 −> s1 , p2 −> s2 ,       }},       }
The variable labels l and the parameter labels p can be of type String or Symbol. For operating-point
data the value vi is a single numerical value, for sweep data it is an InterpolatingFunction . The
parameter value si is always a single numerical value.
SweepParameters denotes the parameters which have been swept. It can be omitted if only one
data set is present.

3.7.2 Parameter Sweeps


A few Analog Insydes functions make use of parameter sweeping: Besides the integration variable,
NDAESolve (Section 3.7.5) allows for varying several parameters performing a multi-dimensional
parameter sweep. For preparation of the nonlinear simplification methods the range of the input
variables has to be specified as a parameter sweep using the command
NonlinearSetup (Section 3.12.1).
3.7 Numerical Analyses 283

Analog Insydes supports the following parameter sweep formats:

format description

{symbol, {f1 , † † † , fm }} symbol has values f1 , † † † , fm


{symbol, start, stop, incr} equivalent to {symbol, Range[start, stop, incr]}
{{symb1 −>f11 , † † † , symbn −>f1n }, † † † , {symb1 −>fm1 , † † † , symbn −>fmn }}
First, symb1 has value f11 ,       , and symbn has value f1n , and
so forth. In the last step, symb1 has value fm1 ,       , and symbn
has value fmn
{sweep1 , † † † , sweepm } combinations of the above sweep formats

Valid parameter sweep formats.

The following example shows valid parameter sweeps:


{{R1, {100, 1000, 10000}},
{V1, 1, 5, 1},
{{P1 −> 10, P2 −> 20}, {P1 −> 20, P2 −> 10}}}
If several sweep formats are combined in a list (as shown in the example above) the outer product
of all sweep specifications is computed.
You can use ParamSweepQ to check whether a given sweep specification is valid in the above sense.

Examples
To demonstrate the parameter sweep format, in this example section the internal command
ResolveParamSweep is used. This function returns a list where the first element is the canonical
representation of the sweep specification (i.e. a flat list of rules). The second element of the result is
for internal purposes only.
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Out[2]= 88R1 ® 100.<, 8R1 ® 1000.<, 8R1 ® 10000.<<


A one-dimensional sweep In[2]:= First @ ResolveParamSweep[{R1, {100, 1000, 10000}}]
with values given
explicitly.

A one-dimensional sweep In[3]:= First @ ResolveParamSweep[{V1, 1, 5, 1}]

88V1 ® 1.<, 8V1 ® 2.<, 8V1 ® 3.<, 8V1 ® 4.<, 8V1 ® 5.<<
with values given by an
Out[3]=
interval.
284 3. Reference Manual

The combination of both In[4]:= First @ ResolveParamSweep[


sweeps yields a {{R1, {100, 1000, 10000}}, {V1, 1, 4, 1}}]

88R1 ® 100., V1 ® 1.<, 8R1 ® 100., V1 ® 2.<,


two-dimensional sweep.
Out[4]=
8R1 ® 100., V1 ® 3.<, 8R1 ® 100., V1 ® 4.<, 8R1 ® 1000., V1 ® 1.<,
8R1 ® 1000., V1 ® 2.<, 8R1 ® 1000., V1 ® 3.<, 8R1 ® 1000., V1 ® 4.<,
8R1 ® 10000., V1 ® 1.<, 8R1 ® 10000., V1 ® 2.<,
8R1 ® 10000., V1 ® 3.<, 8R1 ® 10000., V1 ® 4.<<

You can mix any sweep In[5]:= ParamSweepQ[{{R1, {100, 1000}}, {V1, 1, 5, 1},
format to build valid {{P1 −> 10, P2 −> 20}, {P1 −> 20, P2 −> 10}}}]
multi-dimensional sweeps. Out[5]= True

3.7.3 ACAnalysis

ACAnalysis[dae, {fvar, fstart, fend}]


computes the small-signal solution of a linear DAEObject
dae within a specified frequency range [fstart, fend] as
function of the frequency variable fvar for all variables
ACAnalysis[dae, var, {fvar, fstart, fend}]
solves for the variable var
ACAnalysis[dae, {var1 , var2 , † † † }, {fvar, fstart, fend}]
solves for several variables

Command structure of ACAnalysis .

This functions allows for carrying out a numerical small-signal analysis. Given an AC DAEObject,
ACAnalysis computes the small-signal solution in the specified frequency range and returns the
result according to the Analog Insydes numerical data format described in Section 3.7.1. It consists
of lists of rules, where the variables are assigned InterpolatingFunction objects.
The result of the small-signal analysis can be displayed with Analog Insydes graphics functions such
as BodePlot (Section 3.9.1).
ACAnalysis has the following options:
3.7 Numerical Analyses 285

option name default value

FrequencyVariable Automatic specifies the symbol that denotes the


complex Laplace frequency
InterpolateResult True specifies the return format of the result
InterpolationOrder 1 specifies the interpolation order of the
resulting interpolating functions
PointsPerDecade 10 specifies the number of sampling points per
frequency decade
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
SweepPath (2. Pi I #1 &) specifies a mapping from a frequency to a
point in the complex plane

Options for ACAnalysis .

See also: BodePlot (Section 3.9.1), NoiseAnalysis (Section 3.7.4), Section 3.7.1.

Options Description
A detailed description of all ACAnalysis options is given below in alphabetical order:

FrequencyVariable
This option specifies the symbol that denotes the complex Laplace frequency. See CircuitEquations
in Section 3.5.1.
The default setting is FrequencyVariable −> Automatic , which means to use the symbol given in
the DAEObject.

InterpolateResult
If InterpolateResult is set to True, the result is returned as an interpolating function for each
variable. If the option is set to False, the result is returned as a list of {frequency, value} pairs.

InterpolationOrder
With
InterpolationOrder −> integer you can change the interpolation order of the resulting interpolating
functions (see the Mathematica object InterpolatingFunction ).
286 3. Reference Manual

The default setting is InterpolationOrder −> 1, which means linear interpolation.

PointsPerDecade
PointsPerDecade specifies the number of sampling points per frequency decade.
The default setting is PointsPerDecade −> 10.

SweepPath
SweepPath specifies a mapping from a frequency to a point in the complex plane. The option value
has to be a pure function with one argument which returns a complex number.
The default setting is SweepPath −> (2. Pi I #1 &), which specifies a sweep along the IΩ axis.

Examples
Below we compute the frequency response of a RC lowpass filter circuit.
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description. In[2]:= lowpass =


Circuit[
Netlist[
{V1, {1, 0}, 1},
{R1, {1, 2}, 100.},
{C1, {2, 0}, 1.*^−6},
{R2, {2, 3}, 100.},
{C2, {3, 0}, 1.*^−6},
{RL, {3, 0}, 1000.}
]
]
Out[2]= … Circuit …

Set up system of In[3]:= lowpasseqs = CircuitEquations[lowpass]


small-signal equations. Out[3]= … DAE@AC, †4 ´ 4‡D …

Display equations. In[4]:= DisplayForm[lowpasseqs]

i
j
1y
z
Out[4]//DisplayForm=
j
j z
z i
j
V$1 y
z i
j
0y
z
j
j z
z j
j z
z j
j 0zz
-0.01
j z j z
0.01 0
j
j
j z
z.j
j z
z == j
j z
z
j
j z
z
z j
j z
z j
j z
z
j z j
j z
-6

j z
-0.01 + ´ -0.01
j z j z
0.02 1. 10 s 0
j z
V$2
j z j z z
0{ k { k {
-6

k 1
0 -0.01 0.011 + 1. ´ 10 s 0 V$3 0
0 0 I$V1 1

Perform numerical In[5]:= acsweep = ACAnalysis[lowpasseqs, {f, 1., 1.*^6}]


small-signal analysis with
88V$1 ® InterpolatingFunction@881., 1. ´ 106 <<, <>D,
Out[5]=
ACAnalysis .
V$2 ® InterpolatingFunction@881., 1. ´ 106 <<, <>D,
V$3 ® InterpolatingFunction@881., 1. ´ 106 <<, <>D,
I$V1 ® InterpolatingFunction@881., 1. ´ 106 <<, <>D<<
3.7 Numerical Analyses 287

To solve only for one In[6]:= ACAnalysis[lowpasseqs, V$3, {f, 1., 1.*^6}]
variable, specify the
88V$3 ® InterpolatingFunction@881., 1. ´ 106 <<, <>D<<
Out[6]=
variable as second
argument.

Display the simulation In[7]:= BodePlot[acsweep, {V$2[f]}, {f, 1., 1.*^6}]


result with BodePlot .

Magnitude (dB) 0
-10
-20
-30
-40
-50
1.0E0 1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

0
Phase (deg)

-20
-40
-60
-80
1.0E0 1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

V$2[f]

Out[7]= … Graphics …

3.7.4 NoiseAnalysis

NoiseAnalysis[dae, invar, outvar, {f, fstart, fstop}]


computes the output noise and the equivalent input noise
for a linear DAEObject dae where the input signal is
specified by invar and the output by outvar

Command structure of NoiseAnalysis .

This functions allows for carrying out a numerical noise analysis. The output noise and the equivalent
input noise are computed from a linear DAEObject dae, where the parameter invar denotes the input
and the variable outvar denotes the output, respectively. Use GetParameters to get a valid list of
input symbols and GetVariables for a list of valid output symbols.
NoiseAnalysis returns the result according to the Analog Insydes numerical data format (see
Section 3.7.1) for the output noise (denoted by the symbol OutputNoise ), the equivalent input
noise (denoted by the symbol InputNoise ), the output variable outvar, and each noise source. The
computed values for the noise sources are given in A2 /Hz and V2 /Hz, input and output noise in
A/ Hz and V/ Hz, respectively.
The result of the numerical noise analysis can be displayed with Analog Insydes graphics functions
such as BodePlot (Section 3.9.1).
The DAEObject dae must be set up symbolically (use ElementValues −> Symbolic during equation
setup). Note that at least all sources (noise sources and the one small-signal input source invar)
288 3. Reference Manual

have to be accessible symbolically. When setting up equations for noise analysis, specify the option
settings AnalysisMode −> AC and DefaultSelector −> "Noise" for CircuitEquations in order
to use the noise models. See CircuitEquations (Section 3.5.1) for a description of the options
DefaultSelector and ElementValues .
Note that the noise sources are expressed in the following units:

source type unit example: thermal noise

CurrentSource A/ Hz Sqrt[4 k T / R]

VoltageSource V/ Hz Sqrt[4 k T R]

Units of noise sources.

While specifying the value of a noise source it is also assumed that the bandwidth is 1 Hz.
NoiseAnalysis has the following options:

option name default value

DesignPoint Automatic specifies a list of numerical reference values


for symbolic element values in a set of
circuit equations
FrequencyVariable Automatic specifies the symbol that denotes the
complex Laplace frequency
InterpolationOrder 1 specifies the interpolation order of the
resulting interpolating functions
PointsPerDecade 10 specifies the number of sampling points per
frequency decade
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
SweepPath (2. Pi I #1 &) specifies a mapping from a frequency to a
point in the complex plane

Options for NoiseAnalysis

See also: BodePlot (Section 3.9.1), ACAnalysis (Section 3.7.3), GetVariables (Section 3.6.7),
GetParameters (Section 3.6.9), Section 3.7.1.
3.7 Numerical Analyses 289

Options Description
A detailed description of all NoiseAnalysis options is given below in alphabetical order:

DesignPoint
With DesignPoint −> {symbol −> value, † † † }, you can specify the design point. See also
CircuitEquations (Section 3.5.1).
The default setting is DesignPoint −> Automatic , which means to use the design point given in the
DAEObject.

FrequencyVariable
This option specifies the symbol that denotes the complex Laplace frequency. See CircuitEquations
in Section 3.5.1.
The default setting is FrequencyVariable −> Automatic , which means to use the symbol given in
the DAEObject.

InterpolationOrder
With InterpolationOrder −> integer, you can change the interpolation order of the resulting
interpolating functions. See the Mathematica object InterpolatingFunction .
The default setting is InterpolationOrder −> 1, which is linear interpolation.

PointsPerDecade
PointsPerDecade specifies the number of sampling points per frequency decade.
The default setting is PointsPerDecade −> 10.

SweepPath
SweepPath specifies a mapping from a frequency to a point in the complex plane. The option value
has to be a pure function with one argument which returns a complex number.
The default setting is SweepPath −> (2. Pi I #1 &), which specifies a sweep along the IΩ axis.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
290 3. Reference Manual

Read the netlist and the In[2]:= bufcir = ReadNetlist[


operating-point "AnalogInsydes/DemoFiles/Buffer.cir",
information. "AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Choose noise models and In[3]:= bufeq = CircuitEquations[bufcir, AnalysisMode −> AC,
set up system of equations DefaultSelector −> "Noise", ElementValues −> Symbolic]
symbolically.
Out[3]= … DAE@AC, †18 ´ 18‡D …

View circuit variables. The In[4]:= GetVariables[bufeq]

8V$1, V$2, V$3, V$4, V$5, V$99, V$BS$Q$T1, V$BS$Q$T2,


variable V$99 is chosen as
Out[4]=
output symbol.
V$BS$Q$T3, V$BS$Q$T4, V$BS$Q$T5, V$CS$Q$T1, V$CS$Q$T2,
V$CS$Q$T3, V$CS$Q$T4, V$CS$Q$T5, I$V$VDD, I$V$VIN<

View circuit parameters. In[5]:= GetParameters[bufeq]

8Cbc$Q$T1, Cbc$Q$T2, Cbc$Q$T3, Cbc$Q$T4, Cbc$Q$T5,


The parameter V$VIN is
Out[5]=
chosen as input symbol.
Cbe$Q$T1, Cbe$Q$T2, Cbe$Q$T3, Cbe$Q$T4, Cbe$Q$T5, Cbx$Q$T1,
Cbx$Q$T2, Cbx$Q$T3, Cbx$Q$T4, Cbx$Q$T5, Gmu$Q$T1, Gmu$Q$T2,
Gmu$Q$T3, Gmu$Q$T4, Gmu$Q$T5, gm$Q$T1, gm$Q$T2, gm$Q$T3,
gm$Q$T4, gm$Q$T5, Ib$Q$T1, Ib$Q$T2, Ib$Q$T3, Ib$Q$T4,
Ib$Q$T5, Ic$Q$T1, Ic$Q$T2, Ic$Q$T3, Ic$Q$T4, Ic$Q$T5,
Irc$Q$T1, Irc$Q$T2, Irc$Q$T3, Irc$Q$T4, Irc$Q$T5, Irx$Q$T1,
Irx$Q$T2, Irx$Q$T3, Irx$Q$T4, Irx$Q$T5, Rc$Q$T1, Rc$Q$T2,
Rc$Q$T3, Rc$Q$T4, Rc$Q$T5, Ro$Q$T1, Ro$Q$T2, Ro$Q$T3,
Ro$Q$T4, Ro$Q$T5, Rpi$Q$T1, Rpi$Q$T2, Rpi$Q$T3, Rpi$Q$T4,
Rpi$Q$T5, Rx$Q$T1, Rx$Q$T2, Rx$Q$T3, Rx$Q$T4, Rx$Q$T5, V$VIN<
3.7 Numerical Analyses 291

Perform numerical noise In[6]:= bufnoi = NoiseAnalysis[bufeq, V$VIN, V$99,


analysis with {f, 10., 1.*^8}]
NoiseAnalysis . Note the
88OutputNoise ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Out[6]=
additional symbols

InputNoise ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,


OutputNoise and

V$99 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,


InputNoise in the result.

Ib$Q$T1 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,


Ib$Q$T2 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ib$Q$T3 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ib$Q$T4 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ib$Q$T5 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ic$Q$T1 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ic$Q$T2 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ic$Q$T3 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ic$Q$T4 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Ic$Q$T5 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irc$Q$T1 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irc$Q$T2 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irc$Q$T3 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irc$Q$T4 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irc$Q$T5 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irx$Q$T1 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irx$Q$T2 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irx$Q$T3 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irx$Q$T4 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D,
Irx$Q$T5 ® InterpolatingFunction@8810., 1. ´ 108 <<, <>D<<

Display the simulation In[7]:= BodePlot[bufnoi, {OutputNoise[f], InputNoise[f]},


result. {f, 10., 1.*^8}, PhaseDisplay −> None,
TraceNames −> {"noise(out)", "noise(in)"}]

-140

-150
Magnitude (dB)

-160

-170

-180

1.0E0 1.0E2 1.0E4 1.0E6 1.0E8


Frequency

noise(out) noise(in)

Out[7]= … Graphics …
292 3. Reference Manual

3.7.5 NDAESolve

NDAESolve[dae, {tvar, t0 }] computes the DC solution of a nonlinear DAEObject dae at


the time point tvar = t0
NDAESolve[dae, {tvar, t0 }, params]
carries out a parametric DC analysis
NDAESolve[dae, {tvar, tstart, tend}]
computes the transient or the DC-transfer solution of a
nonlinear DAEObject dae within a specified integration
interval [tstart, tend] as function of the independent
variable tvar
NDAESolve[dae, {tvar, tstart, tend}, params]
carries out a parametric transient or a parametric
DC-transfer analysis

Command structure of NDAESolve .

The function NDAESolve allows for carrying out several numerical analyses, such as an operating-
point (DC) analysis, a DC-transfer (DT) analysis, or a large-signal (transient) analysis. NDAESolve
returns the result according to the Analog Insydes numerical data format described in Section 3.7.1.
It consists of lists of rules, where the variables are assigned InterpolatingFunction objects in case
of a transient analysis or numerical values in case of a DC analysis. Both analysis modes can also
be carried out as parametric analyses. For this, specify a parameter sweep params according to the
Analog Insydes parameter sweep format described in Section 3.7.2.
The result of the numerical transient analysis can be displayed with Analog Insydes graphics
functions such as TransientPlot (Section 3.9.6).
Note that NDAESolve still supports the command structure from Release 1 where the first argument
is given as {eqns, vars} instead of a DAEObject:

NDAESolve[{eqns, vars}, {tvar, t0 }]


carries out a DC analysis
NDAESolve[{eqns, vars}, {tvar, t0 }, params]
carries out a parametric DC analysis
NDAESolve[{eqns, vars}, {tvar, tstart, tend}]
carries out a transient or a DC-transfer analysis
NDAESolve[{eqns, vars}, {tvar, tstart, tend}, params]
carries out a parametric transient or a parametric
DC-transfer analysis

Additional patterns of NDAESolve .


3.7 Numerical Analyses 293

NDAESolve has the following options:

option name default value

AccuracyGoal 6 number of digits of accuracy to seek in the


result (see also FindRoot)
Compiled True whether to compile the equations (see also
FindRoot )
MaxIterations {100, 20} maximum number of iterations of the
nonlinear solver
WorkingPrecision 16 number of digits of precision to keep in
internal computations (see also FindRoot )
NonlinearMethod FindRoot allows for switching the nonlinear equation
solver

Nonlinear solver options of NDAESolve .

option name default value

MaxDelta 1. limit for the deviation of variable values


during the automatic step size control
MaxSteps Automatic maximum number of integration steps
MaxStepSize Automatic upper limit of the integration step size
MinStepSize Automatic lower limit of the integration step size
StartingStepSize Automatic initial integration step size
StepSizeFactor 1.5 modification factor of the integration step
size

Step size control options of NDAESolve.


294 3. Reference Manual

option name default value

InitialConditions Automatic whether to consider initial conditions


InitialGuess Automatic initial guess for the operating-point
computation
InitialSolution Automatic initial solution for the operating-point
computation
RandomFunction (Random[Real, {0., 0.1}]&)
random function for perturbing the initial
guess

Operating-point computation options of NDAESolve .

option name default value

InterpolationOrder 1 interpolation order of the resulting


interpolating functions
OutputVariables All variables to appear in the solution vector
ReturnDerivatives False whether to include solutions for the
derivatives in the solution vector

Return format options of NDAESolve .


3.7 Numerical Analyses 295

option name default value

AnalysisMode Transient circuit analysis mode


BreakOnError False whether to interrupt a parametric DC or
transient analysis in case of an error
CompressEquations False whether to carry out a symbolic
pre-processing of the equation system
DesignPoint Automatic list of numerical reference values for
symbolic element values in a set of circuit
equations
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Simulator Inherited[AnalogInsydes]
standard Analog Insydes simulator
specification (see Section 3.14.6)
SimulatorExecutable Automatic name of the external simulator executable

Miscellaneous options of NDAESolve.

See also: TransientPlot (Section 3.9.6), Section 3.7.1, Section 3.7.2.

Options Description
A detailed description of all NDAESolve options is given below in alphabetical order:

AnalysisMode
The option AnalysisMode specifies the circuit analysis mode, where the default setting is
AnalysisMode −> Transient . Valid option values are as follows:

DC carries out a DC-transfer analysis


Transient carries out a large-signal time-domain analysis

Values for the AnalysisMode option.

Note that this option is only valid for the NDAESolve pattern where you have to specify a start value
tstart and an end value tend. In this case NDAESolve is able to carry out a DC-transfer analysis by
setting the option to AnalysisMode −> DC, although the input is a Transient DAEObject.
296 3. Reference Manual

Note that the DC-transfer analysis method replaces all derivatives in the circuit equations by zero.
Thus, inductors are replaced by short circuits because all inductor voltages are set to zero:

¶IL (t) DC
~
Inductor: VL (t) = L =Þ VL (t) = 0 = Short Circuit
¶t

and capacitors are replaced by open circuits because all capacitor currents are set to zero:

¶UC (t) DC
~
Capacitor: IC (t) = C =Þ IC (t) = 0 = Open Circuit
¶t

BreakOnError
The option BreakOnError allows for interrupting a parametric DC or transient analysis in case of an
error. If set to True and the computation for one parameter sweep fails, the simulation is interrupted
and $Failed is returned. The default setting is BreakOnError −> False.

CompressEquations
The option CompressEquations allows for carrying out a symbolic pre-processing of the equation
system before it is solved numerically. This means that equations and variables which are not relevant
for computing the variables of interest (given by the option OutputVariables ) are removed. Note
that this option is only effective if the option OutputVariables is not set to All. The option
is realized by an internal call of the function CompressNonlinearEquations (Section 3.12.2). The
default setting is CompressEquations −> False.

DesignPoint
With
DesignPoint −> {symbol1 −> value1 , † † † } you can overwrite the design point given in the DAEObject
(see also CircuitEquations in Section 3.5.1). The default setting is DesignPoint −> Automatic ,
which means to use the design point given in the DAEObject.

InitialConditions
The option InitialConditions allows for considering initial conditions (see also CircuitEquations
in Section 3.5.1). The default setting is InitialConditions −> Automatic . Valid option values are
as follows:
3.7 Numerical Analyses 297

None neglects initial conditions


Automatic considers initial conditions
All same as Automatic

Values for the InitialConditions option.

InitialGuess
The option InitialGuess allows for explicitly specifying an initial guess for the Newton iteration
when computing the operating point. Note that missing variables are set to zero. The default setting
is InitialGuess −> Automatic, which means that all variables have the initial value zero. Possible
option values are as follows:

Automatic uses zero values as initial guess


{var1 −> value1 , † † † } uses specified values as initial guess and sets values not
specified to zero

Values for the InitialGuess option.

InitialSolution
The option InitialSolution allows for specifying an initial solution for certain variables of the
operating point. Note that missing variables are computed consistently. The default setting is
InitialSolution −> Automatic , which automatically computes the operating point. Possible option
values are as follows:

Automatic computes operating point automatically


{var1 −> value1 , † † † } uses specified values as initial solution

Values for the InitialSolution option.

InterpolationOrder
With
InterpolationOrder −> integer you can change the interpolation order of the resulting interpolating
functions (see the Mathematica object InterpolatingFunction ). The default setting is
InterpolationOrder −> 1, which means linear interpolation.
298 3. Reference Manual

MaxDelta
One of the conditions included in the automatic step size control is a check for rapidly changing
variable values from a certain point in time to its succeeding time instant. The maximum allowed
deviation is controlled via the option MaxDelta. The default setting is MaxDelta −> 1.

MaxIterations
MaxIterations specifies the maximum number of iterations the nonlinear equation solver should use
attempting to find a solution. The option setting can either be an integer int or a list of two integers
{int1 , int2 }. If it is specified as a single integer int then it is equivalent to the list {int, int}. The
first integer value defines the iteration limit for finding a DC operating-point and the second integer
value the iteration limit for transient computations, respectively. If the number of iterations for the
operating-point computation exceeds the limit, an error message is generated and the computation is
interrupted. If the iteration limit for transient computations is exceeded, the step size is reduced by
the factor given by the option StepSizeFactor . The default setting is MaxIterations −> {100, 20}.

MaxSteps
The option MaxSteps limits the number of integration steps. The computation will be stopped

means MaxSteps = ýýýtend - tstartýýý × StartingStepSize -1 .


immediately if the limiting value is exceeded. The default setting is MaxSteps −> Automatic , which

MaxStepSize

MaxStepSize −> Automatic , which means MaxStepSize = ýýýtend - tstartýýý × 10-2 .


The option MaxStepSize specifies the upper limit of the integration step size. The default setting is

MinStepSize
The option MinStepSize specifies the lower limit of the integration step size. The computation will

MinStepSize −> Automatic , which means MinStepSize = ýýýtend - tstartýýý × 10-5 .


be stopped immediately if the integration step size falls below this limit. The default setting is

NonlinearMethod
The option NonlinearMethod allows for choosing between different algorithms for numerically
solving nonlinear equation systems. The default setting is NonlinearMethod −> FindRoot . Valid
option values are as follows:
3.7 Numerical Analyses 299

FindRoot uses Mathematica’s numerical equation solver FindRoot


NewtonIteration uses multi-dimensional Newton-Raphson implementation

Values for the NonlinearMethod option.

OutputVariables
The option OutputVariables specifies those variables which should be included in the solution
vector. The default setting is OutputVariables −> All. Valid option values are as follows:

All returns solutions for all variables


{var1 , † † † } returns solutions for the specified variables only

Values for the OutputVariables option.

RandomFunction
The option RandomFunction specifies a function used for generating random numbers for perturbing
the initial guess during the operating-point computation. Note that the generated random numbers
are added to the initial guess. The return value of the function should be a real number. The default
setting is RandomFunction −> (Random[Real, {0., 0.1}]&).

ReturnDerivatives
The option ReturnDerivatives allows for including solutions of the derivatives in the solution
vector. The default setting is ReturnDerivatives −> False.

Simulator
The option Simulator specifies the simulator which should be applied for numerically solving the
system of equations. The default setting is Simulator −> Inherited[AnalogInsydes] . Valid option
values are as follows:

"AnalogInsydes" applies internal Analog Insydes solver


"PSpice" applies PSpice kernel
"Saber" applies Saber kernel

Values for the Simulator option.


300 3. Reference Manual

In case of an external simulator kernel a behavioral model in the simulator-specific language is


generated with the function WriteModel (Section 3.10.5). Then the respective simulator kernel given
by the option SimulatorExecutable is applied, and finally the generated simulation data is imported
via the function ReadSimulationData (Section 3.10.3).
Please note that this option is in an experimental state. Additionally, it is extremely dependent on
the applied simulator, its underlying operating system, and even the available simulator version.

SimulatorExecutable
The option SimulatorExecutable specifies the name of the external simulator executable. Note
that this option is only effective if an external simulator is applied via the option Simulator . The
default setting is SimulatorExecutable −> Automatic , which means "pspice" in case of PSpice
and "saber" in case of Saber, respectively. If set to a string make sure that the simulator call
corresponds to the setting of the Simulator option. Otherwise the internal calls to the functions
WriteModel and ReadSimulationData fail. Valid option values are as follows:

Automatic generates simulator call according to the Simulator option


"string" allows user specific simulator call

Values for the SimulatorExecutable option.

StartingStepSize

StartingStepSize −> Automatic , which means StartingStepSize = ýýýtend - tstartýýý × 10-3 .


The option StartingStepSize specifies the initial integration step size. The default setting is

StepSizeFactor
To speed up the computation time NDAESolve includes an automatic step size control. If the
deviations of the variable values from one time point to its succeeding time instant fulfill certain
conditions the actual step size will be multiplied or divided by the value given by the option
StepSizeFactor . The default setting is StepSizeFactor −> 1.5.

Examples
Consider the following diode rectifier circuit with a sinusoidal input voltage.
3.7 Numerical Analyses 301

D1
1 2

V0 C1 R1 Vout

Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define netlist description In[2]:= rectifier =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up system of symbolic In[3]:= rectifiereqs = CircuitEquations[rectifier,


time-domain equations. AnalysisMode −> Transient, ElementValues −> Symbolic]
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Display equations. In[4]:= DisplayForm[rectifiereqs]


Out[4]//DisplayForm=
99I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢
R1
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == V0, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=,
1. $q HV$1@tD-V$2@tDL
3.
€€€€€€€€€€€€€€€€ TEMP

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<, DesignPoint ®


TEMP
TNOM

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 , AREA$D1 ® 1.,


BV$D1 ® ¥, GLEAK$D1 ® 0, GLEAKSW$D1 ® 0, GMIN ® 1. ´ 10-12 ,
IBV$D1 ® 0.001, IS$D1 ® 1. ´ 10-14 , ISW$D1 ® 0, PERIM$D1 ® 0,
RS$D1 ® 0, TEMP ® 300.15, TNOM ® 300.15, $k ® 1.38062 ´ 10-23 ,
$q ® 1.60219 ´ 10-19 , CD$D1 ® 0, CJO$D1 ® 0, CJSW$D1 ® 0<=

Perform numerical DC In[5]:= NDAESolve[rectifiereqs, {t, 0.}]

88V$2 ® 0., V$1 ® 0., I$V0 ® 0., I$AC$D1 ® 0.<<


analysis with NDAESolve .
Out[5]=
302 3. Reference Manual

Perform numerical In[6]:= tran = NDAESolve[rectifiereqs, {t, 0., 2.*^−5}]

88V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


transient analysis with
Out[6]=
NDAESolve .
V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D<<

Display the simulation In[7]:= TransientPlot[tran, {V$1[t], V$2[t]}, {t, 0., 2.*^−5}]
result.

1 V$1[t]

t
-6 0.00001 0.000015 0.00002
5. 10 V$2[t]
-1

-2

Out[7]= … Graphics …

Perform numerical In[8]:= dctran = NDAESolve[rectifiereqs, {t, 0., 1.*^−5},


DC-transfer analysis with AnalysisMode −> DC]
NDAESolve .
88V$1 ® InterpolatingFunction@880., 0.00001<<, <>D,
Out[8]=

V$2 ® InterpolatingFunction@880., 0.00001<<, <>D,


I$V0 ® InterpolatingFunction@880., 0.00001<<, <>D,
I$AC$D1 ® InterpolatingFunction@880., 0.00001<<, <>D<<

Display the simulation In[9]:= TransientPlot[dctran, {V$1[t], V$2[t]}, {t, 0., 1.*^−5}]
result.

1 V$1[t]

t
-6 -6 -6 -60.00001
2. 10 4. 10 6. 10 8. 10 V$2[t]
-1

-2

Out[9]= … Graphics …
3.7 Numerical Analyses 303

Perform parametric In[10]:= paramtran = NDAESolve[rectifiereqs, {t, 0., 2.*^−5},


transient analysis with {R1, Table[10^i, {i, 0, 3}]}]

88V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


NDAESolve .
Out[10]=

V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,


I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 1.<<,


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 10.<<,


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 100.<<,


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 1000.<<<


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

By default, TransientPlot displays the solutions for all parameter sweep values within a single
plot.
Display the simulation In[11]:= TransientPlot[paramtran, {V$2[t]}, {t, 0., 2.*^−5}]
result.

1.2
1
0.8
0.6 V$2[t]
0.4
0.2
t
-6 0.00001 0.000015 0.00002
5. 10

Out[11]= … Graphics …

Consider the following oscillator circuit with initial conditions at the time t = 0.
304 3. Reference Manual

Vic

1 2

L1 C1 R1
Iout

Define netlist description In[12]:= oscillator =


of a simple oscillator Netlist[
circuit. {L1, {0, 1}, Symbolic −> L1, Value −> 1.*^−5},
{C1, {1, 2}, Symbolic −> C1, Value −> 3.*^−7,
InitialCondition −> 2.*^−3},
{R1, {2, 0}, Symbolic −> R1, Value −> 1.}
]
Out[12]= … Netlist@Raw, †3‡D …

Set up system of symbolic In[13]:= oscillatoreqs1 = CircuitEquations[oscillator,


time-domain equations AnalysisMode −> Transient, ElementValues −> Symbolic,
with initial conditions InitialConditions −> Automatic];
where given in the netlist. DisplayForm[oscillatoreqs1]

99-I$L1@tD + C1 HV$1 @tD - V$2 @tDL == 0,


Out[14]//DisplayForm=
¢ ¢

€€€€€€€€€€€€€€€€€€ + C1 H-V$1 @tD + V$2 @tDL == 0, V$1@tD + L1 I$L1 @tD == 0,


V$2@tD ¢ ¢ ¢

V$1@0D - V$2@0D == 0.002=, 8V$1@tD, V$2@tD, I$L1@tD<,


R1

DesignPoint ® 8L1 ® 0.00001, C1 ® 3. ´ 10-7 , R1 ® 1.<=

Set up system of symbolic In[15]:= oscillatoreqs2 = CircuitEquations[oscillator,


time-domain equations AnalysisMode −> Transient, ElementValues −> Symbolic,
with initial conditions for InitialConditions −> All];
all dynamic netlist DisplayForm[oscillatoreqs2]
elements.

99-I$L1@tD + C1 HV$1 @tD - V$2 @tDL == 0,


Out[16]//DisplayForm=
¢ ¢

€€€€€€€€€€€€€€€€€€ + C1 H-V$1 @tD + V$2 @tDL == 0, V$1@tD + L1 I$L1 @tD == 0,


V$2@tD ¢ ¢ ¢

I$L1@0D == 0, V$1@0D - V$2@0D == 0.002=, 8V$1@tD, V$2@tD,


R1

I$L1@tD<, DesignPoint ® 8L1 ® 0.00001, C1 ® 3. ´ 10-7 , R1 ® 1.<=

Perform numerical In[17]:= tran1 = NDAESolve[oscillatoreqs1, {t, 0., 1.*^−4}];


transient analysis for both tran2 = NDAESolve[oscillatoreqs2, {t, 0., 1.*^−4}];
equation systems.

With InitialConditions −> Automatic, initial conditions are applied only where specified in the
netlist, all others are computed consistently. With InitialConditions −> All, initial conditions are
3.7 Numerical Analyses 305

set to zero for all elements for which there is no condition specified in the netlist. You can see the
difference between both possibilities in the following two plots.
Display the first In[19]:= TransientPlot[tran1, {I$L1[t]}, {t, 0., 1.*^−4},
simulation result. PlotRange −> All]

0.0015

0.001

0.0005

t
0.00002 0.00004 0.00006 0.00008 0.0001 I$L1[t]
-0.0005

-0.001

-0.0015

-0.002

Out[19]= … Graphics …

Display the second In[20]:= TransientPlot[tran2, {I$L1[t]}, {t, 0., 1.*^−4}]


simulation result.

0.0002

0.0001

t
0.00002 0.00004 0.00006 0.00008 0.0001 I$L1[t]
-0.0001

-0.0002

-0.0003

Out[20]= … Graphics …
306 3. Reference Manual

3.8 Pole/Zero Analysis


This chapter describes the Analog Insydes functions for numerical and symbolic pole/zero analysis
by solving generalized eigenvalue problems (GEPs). The GEPs considered here have the form

(A - ΛB)u = 0
H
v (A - ΛB) = 0

where A and B are real-valued square matrices that arise from decomposing the coefficient matrix
of a system of circuit equations T(s) × x = b into the contributions from the static and the dynamic
elements.

T(s) = A + sB

In the above GEP, Λ is an eigenvalue, and u and v denote the right and left eigenvectors corresponding
to Λ (vH denotes the Hermitian conjugate of v). In the following, the pairs (Λ, u) and (Λ, v) are referred
to as (left and right) eigenpairs of the matrix pencil (A, B). Analog Insydes includes two different GEP
solvers: an enhanced version of the QZ algorithm and a variant of the Jacobi orthogonal correction
method (JOCM).
The following table shows the available Analog Insydes functions for solving GEPs:

GeneralizedEigensystem (Section 3.8.1)


computing eigenvalues and eigenvectors by QZ
GeneralizedEigenvalues (Section 3.8.2)
computing eigenvalues by QZ
PolesAndZerosByQZ (Section 3.8.3)
computing poles and zeros by QZ
PolesByQZ (Section 3.8.4) computing poles by QZ
ZerosByQZ (Section 3.8.5) computing zeros by QZ
RootLocusByQZ (Section 3.8.6) computing root locus by QZ
LREigenpair (Section 3.8.7) computing eigenvalues and eigenvectors by JOCM
3.8 Pole/Zero Analysis 307

3.8.1 GeneralizedEigensystem

GeneralizedEigensystem[A, B]
computes the eigenvalues and the corresponding left and
right eigenvectors of the matrix pencil (A, B)

Command structure of GeneralizedEigensystem .

GeneralizedEigensytem computes the eigenvalues and the corresponding left and right eigenvectors
of a matrix pencil (A, B) by the QZ algorithm. The function returns a list of lists of the form
{{lambda, v, u, iter}, † † † }, where lambda denotes a finite eigenvalue of (A, B), v and
u the corresponding left and right eigenvectors, and iter the number of iterations the QZ algorithm
needed to compute lambda.
Note that this function is accessible only if the global Analog Insydes option UseExternals is set to
True and if a native version of the external MathLink module QZ.exe is available for your machine
(see Section 3.13.4).
GeneralizedEigensystem has the following option:

option name default value

Normalize True whether to normalize the eigenvectors

Option for GeneralizedEigensystem .

Unless you specify Normalize −> False, the eigenvectors are scaled such that þþvi þþ2 = þþui þþ2 = 1.
See also: GeneralizedEigenvalues (Section 3.8.2), UseExternals (Section 3.14.7).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two square In[2]:= A = {{1, 2}, {−3, 1}};


real-valued matrices. B = {{1, −1}, {0, 0}};

Compute the eigenvalues In[4]:= eigsys = GeneralizedEigensystem[A, B]

88-3.5, 80.5547, 0.83205<, 8-0.316228, -0.948683<, 0<<


and eigenvectors of (A, B).
Out[4]=

Get the eigenvalue and In[5]:= {lambda, v, u, iter} = First[eigsys];


corresponding
eigenvectors.

To show that lambda, v, and u are indeed solutions of the GEP within machine precision, we compute
the L2 norms of the residual vectors rv and ru :
308 3. Reference Manual

rv = þþþvH (A - ΛB)þþþ2
ru = þþ(A - ΛB)uþþ2

Compute the residual In[6]:= {L2Norm[Conjugate[v].(A − lambda*B)],


norms. L2Norm[(A − lambda*B).u]}
Out[6]= 85.66105 ´ 10-16 , 3.29562 ´ 10-16 <

3.8.2 GeneralizedEigenvalues

GeneralizedEigenvalues[A, B]
computes the eigenvalues of the matrix pencil (A, B) where
A and B must be real-valued square matrices

Command structure of GeneralizedEigenvalues .

GeneralizedEigenvalues computes the eigenvalues of a matrix pencil (A, B) by the QZ algorithm.


The function returns a list of the finite Λi that satisfy the GEP defined by (A, B).
Note that this function is accessible only if the global Analog Insydes option UseExternals is set to
True and if a native version of the external MathLink module QZ.exe is available for your machine
(see Section 3.13.4).
See also: GeneralizedEigensystem (Section 3.8.1), UseExternals (Section 3.14.7).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two square In[2]:= A = {{1, 2}, {−3, 1}};


real-valued matrices. B = {{1, 4}, { 2, 1}};

Out[4]= 80.514618, -1.94319<


Compute the eigenvalues In[4]:= GeneralizedEigenvalues[A, B]
of (A, B).

GeneralizedEigenvalues also works if some or all of the eigenvalues are complex and in the case
where A or B are singular.
Define two further B In[5]:= B2 = {{1, −5}, {2, 1}};
matrices. B3 = {{1, −1}, {0, 0}};

Compute the eigenvalues In[7]:= GeneralizedEigenvalues[A, B2]

8-0.772727 + 0.198132 ä, -0.772727 - 0.198132 ä<


of (A, B2 ).
Out[7]=

Out[8]= 8-3.5<
Compute the eigenvalues In[8]:= GeneralizedEigenvalues[A, B3]
of (A, B3 ).
3.8 Pole/Zero Analysis 309

3.8.3 PolesAndZerosByQZ

PolesAndZerosByQZ[dae, var] calculates the poles of the system described by the AC


DAEObject dae and the zeros with respect to var

Command structure of PolesAndZerosByQZ .

To calculate the poles and zeros of a linear circuit, the coefficient matrix of the corresponding system
of circuit equations must be decomposed into a matrix pencil (A, B). PolesAndZerosByQZ performs
this decomposition and calls GeneralizedEigenvalues to compute the poles and zeros numerically.
The argument dae must be an AC DAEObject written in matrix form (see CircuitEquations in
Section 3.5.1).
PolesAndZerosByQZ returns a list of rules of the form:
{Poles −> {poles}, Zeros −> {zeros}}
The return value can directly be used as input for RootLocusPlot for visualizing the pole/zero
distribution.

Calculating zeros requires the circuit to be a single-input system, i.e. the circuit must be
excited by a single AC input source.

Note that this function is accessible only if the global Analog Insydes option UseExternals is set to
True and if a native version of the external MathLink module QZ.exe is available for your machine
(see Section 3.13.4).
See also: PolesByQZ (Section 3.8.4), ZerosByQZ (Section 3.8.5), RootLocusPlot (Section 3.9.5),
UseExternals (Section 3.14.7).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read in a PSpice netlist In[2]:= buffer = ReadNetlist[


and small-signal data. "AnalogInsydes/DemoFiles/Buffer.cir",
"AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up a system of AC In[3]:= mnabuffer = CircuitEquations[buffer, AnalysisMode −> AC]


equations. Out[3]= … DAE@AC, †18 ´ 18‡D …
310 3. Reference Manual

Calculate both poles and In[4]:= pz = PolesAndZerosByQZ[mnabuffer, V$99]


zeros with respect to the
8Poles ® 8-1.93945 ´ 1011 , -3.51956 ´ 1010 , -279586. + 2.89305 ´ 106 ä,
Out[4]=
output voltage V$99 of the
circuit.

-2.26133 ´ 109 , -1.31955 ´ 1010 , -6.86928 ´ 109 , -8.83669 ´ 109 <,


-279586. - 2.89305 ´ 106 ä, -3.20148 ´ 106 , -3.22422 ´ 106 ,

Zeros ® 8-1.31966 ´ 1010 , -7.47584 ´ 109 , -2.26016 ´ 109 ,


1.52864 ´ 106 - 4.19572 ´ 106 ä, 1.52864 ´ 106 + 4.19572 ´ 106 ä,
-2.98706 ´ 106 , -2.40024 ´ 106 , -1.59415 ´ 1011 ,
-2.1154 ´ 1011 - 4.95934 ´ 109 ä, -2.1154 ´ 1011 + 4.95934 ´ 109 ä<<

Show the pole/zero In[5]:= RootLocusPlot[pz, LinearRegionLimit −> Infinity,


distribution. PlotRange −> 5.0*^6]

Im s

6
4. 10

6
2. 10

Re s
6 6 6 6
-4. 10 -2. 10 2. 10 4. 10

6
-2. 10

6
-4. 10

Out[5]= … Graphics …

3.8.4 PolesByQZ

PolesByQZ[dae] calculates the poles of the dynamic system described by


the AC DAEObject dae

Command structure of PolesByQZ .

To calculate the poles of a linear circuit, the coefficient matrix of the corresponding system of circuit
equations must be decomposed into a matrix pencil (A, B). PolesByQZ performs this decomposition
and calls GeneralizedEigenvalues to compute the poles numerically. The argument dae must be
an AC DAEObject written in matrix form (see CircuitEquations in Section 3.5.1).
Note that this function is accessible only if the global Analog Insydes option UseExternals is set to
True and if a native version of the external MathLink module QZ.exe is available for your machine
(see Section 3.13.4).
See also: PolesAndZerosByQZ (Section 3.8.3), ZerosByQZ (Section 3.8.5),
UseExternals (Section 3.14.7).
3.8 Pole/Zero Analysis 311

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read in a PSpice netlist In[2]:= buffer = ReadNetlist[


and small-signal data. "AnalogInsydes/DemoFiles/Buffer.cir",
"AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up a system of AC In[3]:= mnabuffer = CircuitEquations[buffer, AnalysisMode −> AC]


equations. Out[3]= … DAE@AC, †18 ´ 18‡D …

Calculate the poles of the In[4]:= PolesByQZ[mnabuffer]


circuit.
8-1.93945 ´ 1011 , -3.51956 ´ 1010 , -279586. + 2.89305 ´ 106 ä,
Out[4]=

-2.26133 ´ 109 , -1.31955 ´ 1010 , -6.86928 ´ 109 , -8.83669 ´ 109 <


-279586. - 2.89305 ´ 106 ä, -3.20148 ´ 106 , -3.22422 ´ 106 ,

3.8.5 ZerosByQZ

ZerosByQZ[dae, var] calculates the zeros of the transfer function from the AC
DAEObject dae to the output variable var

Command structure of ZerosByQZ .

To calculate the zeros of a linear circuit, the coefficient matrix of the corresponding system of circuit
equations must be decomposed into a matrix pencil (A, B). ZerosByQZ performs this decomposition
and calls GeneralizedEigenvalues to compute the zeros numerically. The argument dae must be
an AC DAEObject written in matrix form (see CircuitEquations in Section 3.5.1).

Calculating zeros requires the circuit to be a single-input system, i.e. the circuit must be
excited by a single AC input source.

Note that this function is accessible only if the global Analog Insydes option UseExternals is set to
True and if a native version of the external MathLink module QZ.exe is available for your machine
(see Section 3.13.4).
See also: PolesAndZerosByQZ (Section 3.8.3), PolesByQZ (Section 3.8.4),
UseExternals (Section 3.14.7).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
312 3. Reference Manual

Read in a PSpice netlist In[2]:= buffer = ReadNetlist[


and small-signal data. "AnalogInsydes/DemoFiles/Buffer.cir",
"AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up a system of AC In[3]:= mnabuffer = CircuitEquations[buffer, AnalysisMode −> AC]


equations. Out[3]= … DAE@AC, †18 ´ 18‡D …

Calculate the zeros of the In[4]:= ZerosByQZ[mnabuffer, V$99]


circuit with respect to the
8-1.31966 ´ 1010 , -7.47584 ´ 109 , -2.26016 ´ 109 ,
Out[4]=
output voltage V$99.
1.52864 ´ 106 - 4.19572 ´ 106 ä, 1.52864 ´ 106 + 4.19572 ´ 106 ä,
-2.98706 ´ 106 , -2.40024 ´ 106 , -1.59415 ´ 1011 ,
-2.1154 ´ 1011 - 4.95934 ´ 109 ä, -2.1154 ´ 1011 + 4.95934 ´ 109 ä<

3.8.6 RootLocusByQZ

RootLocusByQZ[dae, var, {k, k0 , k1 , incr}]


calculates the root locus of the AC DAEObject dae as the
parameter k is swept from k0 to k1 in steps of incr; zeros
are calculated with respect to the output variable var

Command structure of RootLocusByQZ .

With RootLocusByQZ you can sweep a parameter of a linear system over an interval and calculate the
root locus of the system directly from the corresponding circuit equations using the QZ algorithm.
The argument dae has to be an AC DAEObject written in matrix form (see CircuitEquations in
Section 3.5.1).
RootLocusByQZ returns data in the following form:
{{Poles −> {poles}, Zeros −> {zeros},
SweepParameters −> {k −> k0 }},       }
The return value can directly be used as input for RootLocusPlot for visualizing the root locus.
Note that this function is accessible only if the global Analog Insydes option UseExternals is set to
True and if a native version of the external MathLink module QZ.exe is available for your machine
(see Section 3.13.4).
RootLocusByQZ has the following option:
3.8 Pole/Zero Analysis 313

option name default value

Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Option for RootLocusByQZ .

See also: PolesAndZerosByQZ (Section 3.8.3), RootLocusPlot (Section 3.9.5),


UseExternals (Section 3.14.7).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read in a PSpice netlist In[2]:= buffer = ReadNetlist[


and small-signal data. "AnalogInsydes/DemoFiles/Buffer.cir",
"AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up system of symbolic In[3]:= mnabuffersym = CircuitEquations[buffer,


AC equations. AnalysisMode −> AC, ElementValues −> Symbolic]
Out[3]= … DAE@AC, †18 ´ 18‡D …

Get the design-point value In[4]:= Cbc$Q$T5 /. GetDesignPoint[mnabuffersym]


of Cbc$Q$T5 .
Out[4]= 8.39 ´ 10-12

Calculate root locus of the In[5]:= rloc = RootLocusByQZ[mnabuffersym, V$99,


circuit as Cbc$Q$T5 is {Cbc$Q$T5, 5.0*^−12, 50.0*^−12, 5.0*^−12}];
varied from 5 pF to 50 pF
in steps of 5 pF.
314 3. Reference Manual

Show the root locus. In[6]:= RootLocusPlot[rloc, LinearRegionLimit −> Infinity,


PlotRange −> 5.0*^6]

Cbc$Q$T5 = 5.000e-12 .. 5.000e-11 (0% .. 100%)


Im s
Poles
0%
6
4. 10

6
2. 10
100%
Re s
6 6 6 6
-4. 10 -2. 10 2. 10 4. 10 Zeros
0%
6
-2. 10

6
-4. 10
100%

Out[6]= … Graphics …

3.8.7 LREigenpair

LREigenpair[A, B, theta0] solves the GEP described by the matrix pencil (A, B) for an
eigenvalue Λ near the initial guess theta0 where A and B
must be real-valued square matrices of equal dimensions
LREigenpair[dae, theta0] solves the GEP defined by the coefficient matrix of the AC
DAEObject dae for an eigenvalue Λ near theta0

Command structure of LREigenpair .

As an alternative to the QZ algorithm, Analog Insydes provides the function LREigenpair for
solving GEPs iteratively using a variant of the Jacobi orthogonal correction method. This approach is
more efficient and reliable than the QZ algorithm for large GEPs when only one single eigenvalue
is sought. In addition to the eigenvalue, LREigenpair also yields the corresponding left and
right eigenvectors. The argument dae has to be an AC DAEObject written in matrix form (see
CircuitEquations in Section 3.5.1).

If the target eigenvalue is complex, the initial guess theta0 must also be a complex number.

LREigenpair returns a list of the form {{lambda, v, u, rv , ru , iter}}, where lambda, v, and u denote
the calculated eigenvalue and eigenvectors, rv and ru the corresponding L2 norms of the residual
vectors
3.8 Pole/Zero Analysis 315

rv = þþþvH (A - ΛB)þþþ2 ,
ru = þþ(A - ΛB)uþþ2 .

The last return value, iter, denotes the number of iterations needed to compute lambda with the
desired accuracy.
LREigenpair has the following options:

option name default value

AccuracyGoal Round[0.5*$MachinePrecision]
the accuracy goal for the sought eigenvalue
DesignPoint Automatic the design-point values for the coefficients
of dae
FrequencyVariable Automatic the name of the variable that represents the
complex frequency in dae
InitialGuess Automatic initial guesses for the left and right
eigenvectors
MaxIterations 60 the maximum number of iterations for the
Jacobi orthogonal correction method

Options for LREigenpair , Part I.


316 3. Reference Manual

option name default value

MaxResidual Automatic the maximum L2 norm of the residual


vectors rv and ru
Prescaling True whether to prescale the rows of the matrix
pencil
ProjectionVectors {LeftEigenvector, RightEigenvector}
the projection vectors used by the Jacobi
orthogonal correction method
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Tolerance Infinity the maximum logarithmic distance between
the initial guess theta0 and the calculated
eigenvalue Λ

Options for LREigenpair , Part II.

See also: GeneralizedEigensystem (Section 3.8.1).

Options Description
A detailed description of all LREigenpair options is given below in alphabetical order:

AccuracyGoal
AccuracyGoal −> n specifies the desired accuracy of the sought eigenvalue in terms of the number
of accurate significant digits. The value of AccuracyGoal is used to determine an appropriate setting
for the MaxResidual option if MaxResidual −> Automatic .

DesignPoint
With DesignPoint −> dp, you can specify a list of design-point values for the coefficients of
a symbolic system of circuit equations. The default setting DesignPoint −> Automatic causes
LREigenpair to use the design-point information stored in dae. You can use the DesignPoint
option to override design-point data stored in dae.

FrequencyVariable
LREigenpair needs to know the symbol which represents the complex frequency in order to be able
to decompose the system of circuit equations
3.8 Pole/Zero Analysis 317

dae into the matrices A and B. With FrequencyVariable −> Automatic , the symbol is determined
automatically from the status information stored in dae. You can specify the frequency variable
manually with FrequencyVariable −> var.

InitialGuess
With InitialGuess −> {v0, u0}, you can specify initial guesses for the sought eigenvectors v and u.
Both v0 and u0 must be real or complex-valued numeric vectors whose dimensions are compatible
with dae.

MaxIterations
MaxIterations −> n specifies the maximum number of orthogonal correction iterations LREigenpair
should use in order to find an eigenvalue and the corresponding eigenvectors. If LREigenpair fails
to find solutions which satisfy the MaxResidual specification within n iterations, a warning is
generated and the most recent iterates are returned.

MaxResidual
With MaxResidual −> maxres, you can set the convergence criterion for LREigenpair . The value
maxres denotes the maximum L2 norm the residual vectors rv and ru may have such that the current

iterating as soon as both þþrv þþ2 and þþru þþ2 fall below maxres.
set of iterates can be regarded as valid approximations of the sought eigenpairs. LREigenpair stops

With the default setting MaxResidual −> Automatic , the maximum residual norm is computed as

maxres = 10-AccuracyGoal × ý J0 ý × þþBþþ2 / þþAþþ2 .

Note that the value of maxres depends on the setting of the Prescaling option because the norms
of A and B are computed after prescaling.

Prescaling
With Prescaling −> True, LREigenpair scales the rows of the matrix pencil (A, B) such that the
absolute value of the largest coefficient in each row is 1. In general, prescaling improves the numerical
properties of ill-conditioned GEPs and helps to reduce the number of iterations. Prescaling does not
change the eigenvalues and eigenvectors of the matrix pencil. You can turn off prescaling by setting
Prescaling −> False.

ProjectionVectors
Starting with a given initial guess (J0 , v0 , u0 ) for the sought eigenvalue and eigenvectors, LREigenpair
repeatedly solves the correction equation
318 3. Reference Manual

€ ƒ € ƒ € ƒ
 A - Ji B w̃ „„„„„ ×  z „„„„„ =  -r „„„„„
‚ ỹH 0 „„„… ‚ ¶ „„„… ‚ 0 „„„…

for updates z of u and v. The symbols w̃ and ỹ denote two arbitrary projection vectors, which
must be chosen appropriately in each step to ensure convergence of the iterates. Suitable choices
for w̃ and ỹ include combinations of the initial guesses and the most recent approximations of the
eigenvectors v and u.
With the option ProjectionVectors −> {wt, yt}, you can choose the vectors LREigenpair uses as
projection vectors. Possible values are:

LeftEigenvector the most recent approximation of the left eigenvector v


RightEigenvector the most recent approximation of the right eigenvector u
InitialLeftEigenvector the initial guess v0 for the left eigenvector
InitialRightEigenvector the initial guess u0 for the right eigenvector

Values for the ProjectionVectors option.

In most cases, the default setting ProjectionVectors −> {LeftEigenvector, RightEigenvector}


constitutes an appropriate choice. You will need to change the setting of this option only if you
encounter convergence problems.

Tolerance
Tolerance −> tol specifies the radius of the tolerance region around the initial guess theta0 in
which the sought eigenvalue Λ should lie. LREigenpair generates a warning if it converges to
an eigenvalue that lies outside the tolerance region. The Tolerance option allows you to check
whether LREigenpair has found the eigenvalue you wished to compute or whether the iterations
have converged to a completely different solution.
Tolerance uses a logarithmic measure for distances. For example, Tolerance −> 1.0 allows the
value of the solution Λ to lie within 10-1 and 101 times the value of the initial guess theta0.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define three square In[2]:= A = {{1, 2}, {−3, 1}};


real-valued matrices. B = {{1, 4}, { 2, 1}};
B2 = {{1, −1}, {0, 0}};
Solve the GEP (A, B2 ) In[5]:= LREigenpair[A, B2, −3.0]

88-3.5, 80.5547, 0.83205<,


iteratively using the initial
Out[5]=
guess theta0 = -3.
80.316228, 0.948683<, 7.02167 ´ 10-16 , 5.24195 ´ 10-16 , 5<<
3.8 Pole/Zero Analysis 319

Solve the GEP (A, B). In[6]:= LREigenpair[A, B, −1., InitialGuess −> {{0, 1}, {1, 0}}]

88-1.94319, 8-0.288369, 0.957519<,


Specify initial guesses for
Out[6]=

80.957519, -0.288369<, 5.05207 ´ 10-10 , 8.70217 ´ 10-10 , 4<<


the eigenvectors.

Use the default projection In[7]:= LREigenpair[A, B, 1., MaxResidual −> 1.*^−15]

880.514618, 8-0.992822, -0.1196<,


vectors.
Out[7]=

8-0.1196, -0.992822<, 1.24127 ´ 10-16 , 1.77722 ´ 10-16 , 4<<

Note that the following setting for ProjectionVectors increases the number of iterations.
Use right eigenvectors as In[8]:= LREigenpair[A, B, 1., MaxResidual −> 1.*^−15,
projection vectors. ProjectionVectors −>
{RightEigenvector, RightEigenvector}]

880.514618, 8-0.992822, -0.1196<,


Out[8]=

8-0.1196, -0.992822<, 1.24127 ´ 10-16 , 4.47545 ´ 10-16 , 5<<

The setting Tolerance −> 1.0 allows the value of the solution Λ to lie within 10-1 and 101 times the
value of the initial guess theta0.
Search for an eigenvalue In[9]:= LREigenpair[A, B, −100., Tolerance −> 1.]
in the interval [-1000, -10] LREigenpair::tolx:
Eigenvalue lies outside the specified tolerance region.

88-1.94319, 8-0.288369, 0.957519<,


Out[9]=

80.957519, -0.288369<, 2.70894 ´ 10-11 , 4.66522 ´ 10-11 , 6<<

With the default setting Tolerance −> Infinity , any solution of the GEP is accepted without a
warning.
Do not specify a tolerance In[10]:= LREigenpair[A, B, −100., Tolerance −> Infinity]

88-1.94319, 8-0.288369, 0.957519<,


region.
Out[10]=

80.957519, -0.288369<, 2.70894 ´ 10-11 , 4.66522 ´ 10-11 , 6<<

Read in a PSpice netlist In[11]:= buffer = ReadNetlist[


and small-signal data. "AnalogInsydes/DemoFiles/Buffer.cir",
"AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[11]= … Circuit …

Set up a system of In[12]:= mnabuffersym = CircuitEquations[buffer,


symbolic AC equations. AnalysisMode −> AC, ElementValues −> Symbolic]
Out[12]= … DAE@AC, †18 ´ 18‡D …
320 3. Reference Manual

Find the pole of the buffer In[13]:= lreigenpairs = LREigenpair[mnabuffersym, 3.0*^6 I]


circuit near
88-279586. + 2.89305 ´ 106 ä,
Out[13]=
theta0 = 3.0 ‰ 106 i and the
81.70056 ´ 10-18 - 2.18582 ´ 10-18 ä, 0.101704 - 0.218124 ä,
corresponding left and
right eigenvectors.
-0.0281952 - 0.414952 ä, -0.175266 - 0.0104981 ä,
-1.70111 ´ 10-18 + 2.18582 ´ 10-18 ä, 0.177763 - 0.0195432 ä,
-0.000145936 + 0.000121065 ä, 0.177854 - 0.0196025 ä,
-0.175419 - 0.0103065 ä, -0.175107 - 0.0106381 ä,
-0.0284306 - 0.414988 ä, -0.0281891 - 0.414953 ä,
-0.175267 - 0.0105033 ä, -0.0281827 - 0.414949 ä,
-0.175266 - 0.0104982 ä, 0.177756 - 0.019539 ä,

89.51282 ´ 10-19 + 4.50211 ´ 10-19 ä, -0.055128 + 0.256781 ä,


0.0000145936 - 0.0000121065 ä, -0.0000145936 + 0.0000121065 ä<,

0.108991 + 0.0369544 ä, -0.0952012 - 0.0116717 ä,


-9.51537 ´ 10-19 - 4.50194 ´ 10-19 ä, -0.109187 + 0.515199 ä,
-0.000239817 - 0.0000548798 ä, -0.108876 + 0.515278 ä,
-0.0952466 - 0.0115085 ä, -0.0952183 - 0.0115916 ä,
0.10892 + 0.0367968 ä, 0.108987 + 0.0369774 ä,
-0.0952038 - 0.0116972 ä, 0.109 + 0.0369492 ä,
-0.0951948 - 0.011671 ä, -0.109209 + 0.515193 ä,
0.0000239817 + 5.48798 ´ 10-6 ä, -0.0000239817 - 5.48798 ´ 10-6 ä<,
3.6194 ´ 10-13 , 6.0309 ´ 10-12 , 4<<

Show the eigenvalue. In[14]:= lreigenpairs[[1, 1]]


Out[14]= -279586. + 2.89305 ´ 106 ä

Compare the eigenvalue In[15]:= Cases[PolesByQZ[mnabuffersym], _Complex]


with the result of the QZ
8-279586. + 2.89305 ´ 106 ä, -279586. - 2.89305 ´ 106 ä<
Out[15]=
algorithm.

3.8.8 ApproximateDeterminant

ApproximateDeterminant[dae, lambda, error]


approximates the equations dae with respect to the pole
closest to the initial guess lambda where dae has to be an
AC DAEObject and error has to be a positive real value
ApproximateDeterminant[dae, zvar, lambda, error]
approximates the equations dae with respect to the zero of
the transfer function from the input signal to the output
zvar

Command structure of ApproximateDeterminant .

With ApproximateDeterminant you can approximate a linear symbolic matrix equation T(s) × x = b
directly with respect to a particular eigenvalue Λ (a pole or a zero). By discarding all terms which
have little or no influence on Λ, ApproximateDeterminant reduces both the complexity and the
degree of the characteristic polynomial P(s) = det T(s). Provided that the eigenvalue of interest is
located sufficiently far apart from other eigenvalues, the polynomial degree can be reduced to 1 if Λ
3.8 Pole/Zero Analysis 321

is real or 2 if Λ is complex. The argument dae must be an AC DAEObject written in matrix form (see
CircuitEquations in Section 3.5.1).
The following options can be used with ApproximateDeterminant :

option name default value

AccuracyGoal Round[0.5*$MachinePrecision]
the desired numerical accuracy of numerical
computations
DesignPoint Automatic the design-point values for the coefficients
of dae
ErrorFunction Automatic the function to be used for calculating the
approximation error
FrequencyVariable Automatic the symbol which denotes the complex
Laplace frequency
GEPSolver LREigenpair the GEP solver to be used for calculating
the initial reference solution
GEPSolverOptions Automatic options which are passed to the GEP solver

Options for ApproximateDeterminant , Part I.


322 3. Reference Manual

option name default value

InitialSolution Automatic the initial reference solution


MaxDivergentSteps 1 the maximum number of divergent
iterations allowed in the error tracking
process
MaxIterations 3 the maximum number of eigenvalue
correction iterations allowed in each error
tracking step
MaxResidual Automatic the convergence criterion for the error
tracking iterations
MaxShift 1.0 the maximum relative eigenvalue sensitivity
a matrix entry may have to be considered
as a candidate for removal
MinMAC 0.95 the minimum MAC value between the
original eigenvector and the corresponding
eigenvector of the approximated system

Options for ApproximateDeterminant , Part II.


3.8 Pole/Zero Analysis 323

option name default value

Prescaling True whether to prescale the rows of the matrix


pencil
ProjectionVectors {LeftEigenvector, RightEigenvector}
the projection vectors used by the Jacobi
orthogonal correction method
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
SingularityTest SingularityTestByLU
the function used to determine whether an
approximated matrix is singular
TestFrequency 1. the frequency or point in the complex plane
at which singularity tests are performed
Tolerance 0.05 the maximum logarithmic distance between
the initial guess and the calculated
eigenvalue Λ

Options for ApproximateDeterminant , Part III.

See also: GeneralizedEigensystem (Section 3.8.1), LREigenpair (Section 3.8.7).

Options Description
A detailed description of all ApproximateDeterminant options is given below in alphabetical order:

AccuracyGoal
AccuracyGoal −> n specifies the desired accuracy of the sought eigenvalue in terms of the number
of accurate significant digits. The value of AccuracyGoal is used to determine an appropriate setting
for the MaxResidual option if MaxResidual −> Automatic . See also LREigenpair (Section 3.8.7).

DesignPoint
With DesignPoint −> dp, you can specify a list of design-point values for the coefficients of
a symbolic system of circuit equations. The default setting DesignPoint −> Automatic causes
ApproximateDeterminant to use the design-point information stored in dae. You can use the
DesignPoint option to override design-point data stored in dae.
324 3. Reference Manual

ErrorFunction
ErrorFunction −> func specifies the function to be used for calculating the error of an approximated
eigenvalue with respect to the reference solution. The following values are allowed:

Automatic select the error function according to the properties of the


eigenvalue of interest: use LogError for real eigenvalues
and DirectedLogError for complex ones
LogError yields the logarithmic difference of the magnitudes of two
eigenvalues; most suitable for real eigenvalues
DirectedLogError similar to LogError , but takes into account the phases of
complex numbers; most suitable for complex eigenvalues

Values for the ErrorFunction option.

FrequencyVariable
ApproximateDeterminant needs to know the symbol which represents the complex frequency in
order to be able to decompose the system of circuit equations
dae into the matrices A and B. With FrequencyVariable −> Automatic , the symbol is determined
automatically from the status information stored in dae. You can specify the frequency variable
manually with FrequencyVariable −> var.

GEPSolver
With GEPSolver −> func, you can select the GEP solver ApproximateDeterminant uses to calculate
the initial reference solution. Possible option values are:

GeneralizedEigensystem use the QZ algorithm for computing the reference solution


LREigenpair use the Jacobi orthogonal correction method for computing
the reference solution

Values for the GEPSolver option.

GEPSolverOptions
With GEPSolverOptions −> opts, you can specify a list of option settings that will be passed to the
selected GEP solver, for example:
GEPSolverOptions −> {MaxResidual −> 1.*^−7,
MaxIterations −> 100}
3.8 Pole/Zero Analysis 325

Note that you may also change the option settings of the selected GEP solver directly with
SetOptions[gepsolver, opts]. However, with GEPSolverOptions , you can specify private option
settings which will only be used in conjunction with ApproximateDeterminant .

InitialSolution
With InitialSolution −> initsol, you can specify the initial reference solution for the GEP to be
approximated. The value of InitialSolution must be given in the same format as the return value
of LREigenpair (Section 3.8.7). Possible values are:

Automatic compute the initial reference solution using the GEP solver
specified with GEPSolver
{lambda0 , v0 , u0 , † † † } use the given initial reference solution

Values for the InitialSolution option.

MaxDivergentSteps
MaxDivergentSteps −> n specifies the maximum number of divergent iterations allowed in the
error tracking step following the elimination of a matrix entry. Iterates are considered divergent if
the residual of the numerical solution of the GEP becomes larger between two consecutive steps.
If the number of divergent steps exceeds the specified maximum in the error tracking process,
ApproximateDeterminant aborts the iterations, reinserts the current term into the matrix, and
continues with the next term.

MaxIterations
MaxIterations −> n specifies the maximum number of error tracking iterations performed after
removing a matrix entry. An approximation is considered valid if the iterations converge within
n steps, and if both the MaxResidual and MinMAC specifications are satisfied. See also LREigenpair
(Section 3.8.7).

If you set GEPSolver −> LREigenpair , note that the MaxIterations setting given for
ApproximateDeterminant is not passed to LREigenpair . To specify the maximum number
of iterations for the GEP solver, change the value of GEPSolverOptions .

MaxResidual
MaxResidual −> posreal specifies the convergence criterion for the error tracking iterations.
MaxResidual is one of the key options you should play with in order to obtain good results from
ApproximateDeterminant . You should choose the value as large as possible to allow for a reasonable
326 3. Reference Manual

error but small enough to prevent the iterations from “converging” to an arbitrary value. This may
require some experimentation. See also LREigenpair (Section 3.8.7).

The value of MaxResidual depends on the setting of the Prescaling option.


If you set GEPSolver −> LREigenpair , note that the MaxIterations setting given for
ApproximateDeterminant is not passed to LREigenpair . To specify the maximum residual
for the GEP solver, change the value of GEPSolverOptions .

MaxShift
MaxShift −> posreal restricts the list of matrix entries which are candidates for removal to those
entries with a eigenvalue sensitivity figure less than posreal. With MaxShift −> 1.0, a term will be
considered for removal if the eigenvalue shift caused by removing the term has been predicted to be
less than 100%. To restrict the list of matrix entries to terms with small eigenvalue sensitivities, use
a setting such as MaxShift −> 0.1.

MinMAC
MinMAC −> posreal specifies the minimum allowed value of the modal assurance criterion between the
right eigenvector of the original GEP, u, and the right eigenvector of the approximated GEP, u* .
The MAC between u and u* constitutes a measure for the correlation of the two eigenvectors. It is
defined as

ýýuH u* ýý2
ý ý
I u uM I u u* M
*
MAC (u, u ) = .
H *H

The value of the MAC ranges from 0 to 1. A value of 1 means that one eigenvector is a multiple of
the other. A value of 0 means that the two vectors are completely uncorrelated.
The use of the MAC helps to prevent ApproximateDeterminant from accidentally converging to
some other eigenvalue than the one of interest. For corresponding eigenpairs of the original and
approximated GEP, the value of the MAC should be close to 1, say MAC = 0.95, whereas the MAC
between the eigenvector of the original GEP and some other eigenvector of the approximated system
should be small. ApproximateDeterminant considers an approximation step as invalid if the MAC
between the two eigenvectors falls below the value of MinMAC.

Prescaling
With Prescaling −> True, ApproximateDeterminant scales the rows of the matrix pencil (A, B) such
that the absolute value of the largest coefficient in each row is 1. In general, prescaling improves the
numerical properties of ill-conditioned GEPs and helps to reduce the number of iterations. Prescaling
3.8 Pole/Zero Analysis 327

does not change the eigenvalues and eigenvectors of the matrix pencil. You can turn off prescaling
by setting Prescaling −> False.

The value of Prescaling has an influence on the required setting of the MaxResidual
option.
If you set GEPSolver −> LREigenpair , note that the Prescaling setting given for
ApproximateDeterminant is not passed to LREigenpair . To turn on prescaling for the GEP
solver, change the value of GEPSolverOptions .

ProjectionVectors
With the option ProjectionVectors −> {wt, yt}, you can choose the vectors
ApproximateDeterminant uses as projection vectors for the Jacobi orthogonal correction method
(JOCM) during error tracking operations:
Starting with a given initial guess (J0 , v0 , u0 ) for the sought eigenvalue and eigenvectors, the JOCM
repeatedly solves the correction equation

€ ƒ € ƒ € ƒ
 A - Ji B w̃ „„„„„ ×  z „„„„„ =  -r „„„„„
‚ ỹH 0 „„„… ‚ ¶ „„„… ‚ 0 „„„…

for updates z of u and v. The symbols w̃ and ỹ denote two arbitrary projection vectors, which
must be chosen appropriately in each step to ensure convergence of the iterates. Suitable choices
for w̃ and ỹ include combinations of the initial guesses and the most recent approximations of the
eigenvectors v and u.
Possible settings for the ProjectionVectors option are:

LeftEigenvector the most recent approximation of the left eigenvector v


RightEigenvector the most recent approximation of the right eigenvector u
InitialLeftEigenvector the initial guess v0 for the left eigenvector
InitialRightEigenvector the initial guess u0 for the right eigenvector

Values for the ProjectionVectors option.

In most cases, the default setting ProjectionVectors −> {LeftEigenvector, RightEigenvector}


constitutes an appropriate choice. You will need to change the setting of this option only if you
encounter convergence problems. See also Section 3.8.7.
328 3. Reference Manual

If you set GEPSolver −> LREigenpair , note that the ProjectionVectors setting given for
ApproximateDeterminant is not passed to LREigenpair . To choose the projection vectors
for the GEP solver, change the value of GEPSolverOptions .

SingularityTest
After each approximation step, ApproximateDeterminant applies a singularity test to the matrix
A - s × B to ensure that removing a matrix entry has not rendered the GEP singular. The singularity
test is performed by numerical computation of the rank of A - s × B for some s Î C which is not
an eigenvalue of the GEP. However, there is no guarantee that numerical rank computation always
yields a mathematically correct result. This may cause singularity to remain undetected in some
situations, particularly when the GEP is ill-conditioned. With the option SingularityTest , you
can select the function ApproximateDeterminant uses to determine whether the GEP is singular. If
you encounter singularity problems, i.e. if det(A - s × B) = 0 after approximating a system of circuit
equations, then you should change the value of SingularityTest and rerun the approximation.
The possible values for SingularityTest are:

SingularityTestByLU perform singularity tests by rank computation using


LUDecomposition
SingularityTestByQR perform singularity tests by rank computation using
QRDecomposition
Function[{M}, expr] specify a user-defined function which returns True if the
complex-valued floating-point matrix M is singular

Values for the SingularityTest option.

TestFrequency
With the option TestFrequency , you can specify the value of the complex frequency variable s
which is used for testing whether the numerical matrix A - s × B is singular. For best numerical
accuracy and computing performance, it is recommended that you choose a real value of the
same order of magnitude as the modulus of the target eigenvalue. For example, if you wish to
approximate a GEP with respect to an eigenvalue s = -1.5 ‰ 106 + j 8.2 ‰ 107 , then the option setting
TestFrequency −> 1.0*^8 constitutes an appropriate choice.

The point in the complex plane represented by the value of TestFrequency should not lie
in the neighborhood of any eigenvalue of the GEP to be approximated. An inappropriate
choice of the test frequency may result in ill-conditioned rank computation problems.
3.8 Pole/Zero Analysis 329

Tolerance
Tolerance −> tol specifies the radius of the tolerance region around the initial guess theta0 in which
the sought eigenvalue Λ should lie. ApproximateDeterminant generates a warning if it converges
to an eigenvalue that lies outside the tolerance region. The Tolerance option allows you to check
whether ApproximateDeterminant has found the eigenvalue you wished to compute or whether
the iterations have converged to a completely different solution.
Tolerance uses a logarithmic measure for distances. For example, Tolerance −> 1.0 allows the
value of the solution Λ to lie within 10-1 and 101 times the value of the initial guess theta0.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define an AC model for In[2]:= Circuit[


BJTs. Model[
Name −> BJT,
Selector −> AC,
Scope −> Global,
Ports −> {B, C, E},
Parameters −> {Rbe, Cbc, Cbe, beta, Ro,
RBE, CBC, CBE, BETA, RO},
Definition −> Netlist[
{CBE, {B, E}, Symbolic −> Cbe, Value −> CBE},
{RBE, {X, E}, Symbolic −> Rbe, Value −> RBE},
{CBC, {B, C}, Symbolic −> Cbc, Value −> CBC},
{CC, {B, X, C, E},
Symbolic −> beta, Value −> BETA},
{RO, {C, E}, Symbolic −> Ro, Value −> RO}
]
]
] // ExpandSubcircuits;

This netlist describes a In[3]:= ceamplifier =


common-emitter amplifier. Circuit[
Netlist[
{V1, {1, 0}, 1},
{V0, {6, 0}, 0},
{C1, {1, 2}, Symbolic −> C1, Value −> 1.0*^−7},
{R1, {2, 6}, Symbolic −> R1, Value −> 1.0*^5},
{R2, {2, 0}, Symbolic −> R2, Value −> 47000.},
{RC, {6, 3}, Symbolic −> RC, Value −> 2200.},
{RE, {4, 0}, Symbolic −> RE, Value −> 1000.},
{C2, {3, 5}, Symbolic −> C2, Value −> 1.0*^−6},
{RL, {5, 0}, Symbolic −> RL, Value −> 47000.},
{Q1, {2 −> B, 3 −> C, 4 −> E},
Model −> BJT, Selector −> AC,
CBE −> 30.*^−12, CBC −> 5.*^−12, RBE −> 1000.,
RO −> 10000., BETA −> 200.}
]
]
Out[3]= … Circuit …
330 3. Reference Manual

Set up system of symbolic In[4]:= eqs = CircuitEquations[ceamplifier,


AC equations. ElementValues −> Symbolic]
Out[4]= … DAE@AC, †10 ´ 10‡D …

Calculate poles and zeros In[5]:= pz = PolesAndZerosByQZ[eqs, V$5]


of the voltage transfer
8Poles ® 8-20.4778, -375.176, -9.50936 ´ 107 , -6.75675 ´ 109 <,
Out[5]=
function.
Zeros ® 80., -1.36139 ´ 10-27 ,
1.9179310389182471´ 108 , -6.94846 ´ 109 <<

Show the pole/zero In[6]:= RootLocusPlot[pz, LinearRegionLimit −> 100,


distribution. PlotRange −> 5.0*^10]

Im s

1.0E8

1.0E5

100.

Re s
-1.0E8-1.0E5 -100. 100. 1.0E5 1.0E8

-100.

-1.0E5

-1.0E8

Out[6]= … Graphics …

The numerical pole/zero analysis shows that the characteristic polynomial of the equations has a
degree of four because the amplifier has four poles. Although polynomial equations with a degree
up to four can be solved analytically, the resulting expressions are usually very complex if the degree
is greater than two. Therefore, we use ApproximateDeterminant to compute simplified formulas
for the poles.
We begin by computing an approximate expression for the pole near s = -400. The logarithmic error
bound specification 0.05 corresponds to a tolerance region from 10-0.05 = 89% to 100.05 = 112% of the
design-point value p2 = -375.
Approximate the equations In[7]:= sbgp2 = ApproximateDeterminant[eqs, −400, 0.05,
with respect to p2 using MaxIterations −> 4, GEPSolver −> GeneralizedEigensystem]
the QZ algorithm for
Out[7]= … DAE@AC, †10 ´ 10‡D …
computing the reference
solution.

To check if the algorithm has successfully isolated the pole of interest, we compute the poles of the
approximated system.

Out[8]= 80., -362.76595744680853<


Compute the remaining In[8]:= PolesByQZ[sbgp2]
poles numerically.
3.8 Pole/Zero Analysis 331

Estimate the number of In[9]:= ComplexityEstimate[sbgp2]


remaining terms. Out[9]= 4

Show complexity of In[10]:= ComplexityEstimate[eqs]


original system. Out[10]= 132

The result shows that the algorithm has eliminated the two high-frequency poles and has approximated
the low-frequency pole p1 near s = -20 by zero. On the contrary, the pole p2 has been preserved,
and its numerical value lies in the specified tolerance region. In addition, the complexity of
the characteristic polynomial has been greatly reduced. Therefore, we can expect to obtain an
interpretable formula for p2 .
Compute the In[11]:= detp2 = Det[GetMatrix[sbgp2]] // Together

H-C2 R1 R2 s - beta$Q1 C2 R1 RE s - beta$Q1 C2 R2 RE s -


approximated
Out[11]=

beta$Q1 C1 C2 R1 R2 RE s2 L  HR1 R2 Rbe$Q1 RC REL


characteristic polynomial.

Solve for the poles. In[12]:= sbgpoles = Solve[detp2 == 0, s]

98s ® 0<, 9s ® €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€ ==


Out[12]=
-R1 R2 - beta$Q1 R1 RE - beta$Q1 R2 RE
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
beta$Q1 C1 R1 R2 RE

Extract the pole of interest. In[13]:= p2 = s /. Last[sbgpoles] // Simplify


1 1 1
€€€€€
R1€ + €€€€€
R2€ + €€€€€€€€€€€€€€€€
beta$Q1 €€€€€ RE
Out[13]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€
C1

Next, we try to extract the right-half plane zero z3 near s = 2.0 ‰ 108 .
Approximate the equations In[14]:= sbgz3 = ApproximateDeterminant[eqs, V$5, 2.0*^8, 0.05,
with respect to z3 . GEPSolver −> GeneralizedEigensystem]
Out[14]= … DAE@AC, †10 ´ 10‡D …

Compute the remaining In[15]:= ZerosByQZ[sbgz3, V$5]


Out[15]= 80., 0., 2.0000000000000003´ 108 <
zeros numerically.

Compute the In[16]:= detz3 = Det[GetMatrix[sbgz3]] // Simplify


beta$Q1 C1 C2 s2 H1 - Cbc$Q1 RE sL
approximated polynomial.
Out[16]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€€
Rbe$Q1 RE

Solve for the zeros. In[17]:= sbgzeros = Solve[detz3 == 0, s]

Out[17]= 98s ® 0<, 8s ® 0<, 9s ® €€€€€€€€€€€€€€€€


€€€€€€€€€€ ==
1
Cbc$Q1 RE

Extract the zero of interest. In[18]:= z3 = s /. Last[sbgzeros]


1
Out[18]= €€€€€€€€€€€€€€€€
€€€€€€€€€€
Cbc$Q1 RE
332 3. Reference Manual

3.9 Graphics Functions


Analog Insydes extends Mathematica’s graphics functionality by several custom functions for producing
frequently used graphs in circuit design. The package provides special functionality for displaying
the following types of plots:

BodePlot (Section 3.9.1) Bode plot (frequency response: magnitude and phase vs.
frequency)
FourierPlot (Section 3.9.2) Fourier spectrum plot (frequency spectrum: spectral
magnitude vs. frequency)
NicholPlot (Section 3.9.3) Nichol plot (frequency response: gain vs. phase)
NyquistPlot (Section 3.9.4) Nyquist plot (frequency response: imaginary vs. real part)
RootLocusPlot (Section 3.9.5) pole/zero and root locus plot (parameter response:
imaginary vs. real part)
TransientPlot (Section 3.9.6) transient waveform plot (signal value vs. time)

3.9.1 BodePlot

BodePlot[func, {var, f1 , f2 }] displays a Bode plot of the transfer function func[var] as


the independent variable var is swept from f1 to f2
BodePlot[{func 1 , func2 , † † † }, {var, f1 , f2 }]
displays the transfer functions func1 , func2 , † † †
simultaneously in a Bode plot

Command structure of BodePlot .

BodePlot displays one or several transfer functions in a Bode plot. A Bode plot consists of two
separate charts in which the magnitude and phase of a transfer function are plotted vs. frequency.
Magnitude and phase are displayed, respectively, on logarithmic and linear scales. The frequency
axis is scaled logarithmically for both charts.
Note that BodePlot has attribute HoldFirst .
BodePlot supports additional patterns for displaying numerical data generated with the functions
ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4), or ReadSimulationData (Section 3.10.3):
3.9 Graphics Functions 333

BodePlot[traces, {var, f1 , f2 }] displays a list of AC traces computed with e.g.


ACAnalysis in a Bode plot
BodePlot[traces, expr, {var, f1 , f2 }]
displays the value of an expression in terms of AC traces
BodePlot[traces, {expr1 , expr2 , † † † }, {var, f1 , f2 }]
displays the values of several expressions

Displaying numerical data with BodePlot.

You can customize the appearance of Bode plots with the options listed below. In addition, BodePlot
inherits many options from LogLinearListPlot and Legend. Both the options which are specific to
BodePlot as well as the inherited options can be set with SetOptions[BodePlot, opts].

option name default value

AspectRatio 0.75 the aspect ratio of the whole plot


AspectFactor 0.8 a correction factor by which the aspect
ratios of the magnitude and phase plots are
multiplied so as to fill the individual plot
areas optimally
FrequencyScaling Exponential whether to distribute sampling points
exponentially or linearly along the
frequency axis
GraphicsSpacing 0.05 the distance between the magnitude and the
phase plot in percent of the total plot height
MagnitudeDisplay Decibels how to scale and display magnitude values

Options for BodePlot, Part I.


334 3. Reference Manual

option name default value

PhaseDisplay Degrees whether to display phase traces and which


unit to use for phase values
PlotPoints 25 the number of frequency sampling points
PlotRange Automatic the plot ranges for the magnitude and the
phase plot
ShowLegend True whether to display a plot legend
TraceNames Automatic the trace names displayed in the plot legend
UnwrapPhase True whether to unwrap phase traces
UnwrapTolerance 0.2 the maximum relative difference between
two successive phase values that triggers
phase unwrapping

Options for BodePlot, Part II.

See also: ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4),


ReadSimulationData (Section 3.10.3), NicholPlot (Section 3.9.3), NyquistPlot (Section 3.9.4).

Options Description
A detailed description of all options that are specific to BodePlot or are used in a non-standard way
is given below in alphabetical order:

FrequencyScaling
The option FrequencyScaling determines how sampling points are distributed over the frequency
axis. Possible values are:

Exponential use exponentially spaced sampling points


Linear use linearly spaced sampling points

Values for the FrequencyScaling option.

MagnitudeDisplay
With the option MagnitudeDisplay , you can specify how magnitude values are displayed in a Bode
plot. The following values are allowed:
3.9 Graphics Functions 335

Decibels convert magnitude values to decibels


AbsoluteValues show absolute magnitude values on a logarithmic scale
Linear show magnitude values on a linear scale

Values for the MagnitudeDisplay option.

PhaseDisplay
The option PhaseDisplay specifies whether and how to display phase values. Possible choices are:

Degrees display phase values in degrees


Radians display phase values in radians
None suppress the phase plot

Values for the PhaseDisplay option.

PlotRange
With the PlotRange option, you can set the plot ranges for the y-axes of the magnitude and phase
plots. Possible values are:

Automatic determine the plot ranges automatically


{magrng, phsrng} specify plot ranges for magnitude and phase plot; the
values of magrng and phsrng can be Automatic , All, or
{ymin, ymax}

Values for the PlotRange option.

TraceNames
The option TraceNames allows you to specify the labels that are shown in the plot legend for the
displayed traces if ShowLegend −> True. The following values are possible:
336 3. Reference Manual

Automatic use trace names from AC sweeps computed with e.g.


ACAnalysis
string or expr the name for a single trace
{string, † † † } or {expr, † † † } names for all traces; the number of names must equal the
number of traces

Values for the TraceNames option.

UnwrapPhase
With the option UnwrapPhase , you can specify whether BodePlot should restrict phase values to
the interval [0é , 360é ] or try to unwrap the phase values of a frequency response trace that wraps
around the origin of the complex plane more than once.

UnwrapTolerance
With UnwrapTolerance −> tol, you can specify the maximum percentage of a full 360é revolution by
which two successive phase values may differ such that phase unwrapping is triggered.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two transfer In[2]:= H1[s_] := 1/(s + 1);


functions. H2[s_] := 10/(s^2 + s + 10)

This produces a Bode plot In[4]:= BodePlot[H1[I w], {w, 0.01, 100}]
of H1 (jΩ).

0
Magnitude (dB)

-10

-20

-30

-40
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
Phase (deg)

-20

-40

-60

-80
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[4]= … Graphics …
3.9 Graphics Functions 337

This produces a Bode plot In[5]:= BodePlot[{H1[I w], H2[I w]}, {w, 0.01, 100}]
of H1 (jΩ) and H2 (jΩ).

10

Magnitude (dB)
0
-10
-20
-30
-40
-50
-60
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
-25
Phase (deg)

-50
-75
-100
-125
-150
-175
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[5]= … Graphics …

This defines an RLC filter In[6]:= rlcf = Netlist[


circuit. {V1, {1, 0}, Symbolic −> V, Value −> 1},
{R1, {1, 2}, Symbolic −> R1, Value −> 1000.},
{L1, {2, 3}, Symbolic −> L, Value −> 0.001},
{C1, {3, 0}, Symbolic −> C, Value −> 2.2*10^−6},
{R2, {3, 0}, Symbolic −> R2, Value −> 1000.}
];
Set up modified nodal In[7]:= eqsrlcf = CircuitEquations[rlcf]
equations. Out[7]= … DAE@AC, †4 ´ 4‡D …

Do an AC analysis from In[8]:= acsweep = ACAnalysis[eqsrlcf, {f, 10, 10^6}]


10 Hz to 1 MHz.
88V$1 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,
Out[8]=

V$2 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,


V$3 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,
I$V1 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D<<

Increase the number of In[9]:= SetOptions[BodePlot, PlotPoints −> 200];


plot points.
338 3. Reference Manual

Display all traces in a In[10]:= BodePlot[acsweep, {f, 10, 10^6}]


Bode plot.

Magnitude (dB)
0
-20
-40
-60
-80
-100
1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

0
Phase (deg)

-50
-100
-150
-200
-250
-300
-350
1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

V$1 V$2 V$3 I$V1

Out[10]= … Graphics …

Display only the traces In[11]:= BodePlot[acsweep, {V$2[f], V$3[f]}, {f, 10, 10^6}]
V$2[f] and V$3[f].
Magnitude (dB)

0
-20
-40
-60
-80
-100
1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

0
Phase (deg)

-50
-100
-150
-200
-250
-300
-350
1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

V$2[f] V$3[f]

Out[11]= … Graphics …
3.9 Graphics Functions 339

Display the traces V$2[f] In[12]:= BodePlot[acsweep, {V$2[f], V$2[f]−V$3[f]}, {f, 10, 10^6}]
and V$2[f]−V$3[f] .

Magnitude (dB)
0
-20
-40
-60
-80
1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

0
Phase (deg)

-50
-100
-150
-200
-250
-300
-350
1.0E1 1.0E2 1.0E3 1.0E4 1.0E5 1.0E6
Frequency

V$2[f] V$2[f] - V$3[f]

Out[12]= … Graphics …

Show absolute magnitude In[13]:= BodePlot[H1[I w], {w, 0.01, 100},


values instead of decibels. MagnitudeDisplay −> AbsoluteValues]

1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2


1.0E0
5.0E-1
Magnitude

2.0E-1
1.0E-1
5.0E-2
2.0E-2
1.0E-2
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
Phase (deg)

-20

-40

-60

-80
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[13]= … Graphics …
340 3. Reference Manual

Show magnitude values In[14]:= BodePlot[H1[I w], {w, 0.01, 100},


on a linear scale. MagnitudeDisplay −> Linear]

1
0.8
Magnitude

0.6
0.4
0.2
0
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
Phase (deg)

-20

-40

-60

-80
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[14]= … Graphics …

Do not show the phase In[15]:= BodePlot[acsweep, {V$2[f], V$2[f]−V$3[f]},


plot. {f, 100, 10^5}, PhaseDisplay −> None]

-10

-20
Magnitude (dB)

-30

-40

-50

-60

1.0E2 5.0E21.0E3 5.0E31.0E4 5.0E41.0E5


Frequency

V$2[f] V$2[f] - V$3[f]

Out[15]= … Graphics …
3.9 Graphics Functions 341

Restrict the phase to the In[16]:= BodePlot[H1[I w]^5, {w, 0.01, 100}, UnwrapPhase −> False]
interval [0é , 360é ].

Magnitude (dB)
-50

-100

-150

-200
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
-50
Phase (deg)

-100
-150
-200
-250
-300
-350
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[16]= … Graphics …

Unwrap the phase trace. In[17]:= BodePlot[H1[I w]^5, {w, 0.01, 100}, UnwrapPhase −> True]

0
Magnitude (dB)

-50

-100

-150

-200
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
Phase (deg)

-100
-200
-300
-400
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[17]= … Graphics …

In the following example, the number of plot points is reduced so that the differences between
successive phase values become too large for phase unwrapping.
342 3. Reference Manual

Reduce the number of plot In[18]:= BodePlot[H1[I w]^5, {w, 0.01, 100},
points. PlotPoints −> 10, PlotRange −> {Automatic, {−360, 0}}]

0
Magnitude (dB)

-50

-100

-150

-200
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
-50
Phase (deg)

-100
-150
-200
-250
-300
-350
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[18]= … Graphics …

To unwrap the phase trace, you can specify a larger number of plot points or increase the value of
UnwrapTolerance .
Increase the unwrap In[19]:= BodePlot[H1[I w]^5, {w, 0.01, 100},
tolerance to 30% of 360é . PlotPoints −> 10, UnwrapTolerance −> 0.3]

0
Magnitude (dB)

-50

-100

-150

-200
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

0
Phase (deg)

-100
-200
-300
-400
1.0E-2 1.0E-1 1.0E0 1.0E1 1.0E2
Frequency

Out[19]= … Graphics …
3.9 Graphics Functions 343

3.9.2 FourierPlot

FourierPlot[func, {t, t1 , t2 }] plots the frequency spectrum of the function func where
the independent variable t is swept from t1 to t2
FourierPlot[{func 1 , func2 , † † † }, {t, t1 , t2 }]
superimposes the Fourier plots of several functions

Command structure of FourierPlot .

FourierPlot performs a discrete fourier analysis by applying Fourier on the given functions.
FourierPlot inherits all options from ListPlot . Additionally the following option is available:

option name default value

PlotPoints 250 specifies the number of sample points

Options for FourierPlot .

PlotPoints
The option PlotPoints −> integer specifies the number of sample points. The maximum displayed
frequency is given by 0.5 × integer/(t2 - t1 ).
See also: Fourier.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Plot a spectrum of two In[2]:= FourierPlot[{0.5 Sin[2. Pi 20. t], 2. Cos[2. Pi 80. t]},
signals with 20 Hz and {t, 0, 1.}, PlotStyle −> {{Hue[0]}, {Hue[0.4]}}]
80 Hz.

1.5
1.25
Amplitude

1
0.75
0.5
0.25
0
0 20 40 60 80 100 120
Frequency

Out[2]= … Graphics …
344 3. Reference Manual

3.9.3 NicholPlot

NicholPlot[func, {var, f1 , f2 }] displays a Nichol plot of the transfer function func[var] as


the independent variable var is swept from f1 to f2
NicholPlot[{func 1 , func2 , † † † }, {var, f1 , f2 }]
displays the transfer functions func1 , func2 , † † †
simultaneously in a Nichol plot

Command structure of NicholPlot .

NicholPlot displays one or several transfer functions in a Nichol plot. A Nichol plot is similar to a
Nyquist plot but shows magnitude (in dB) vs. phase with the axis origin at the point (0 dB, -180é ).
Note that NicholPlot has attribute HoldFirst .
NicholPlot supports additional patterns for displaying numerical data generated with the functions
ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4), or ReadSimulationData (Section 3.10.3):

NicholPlot[traces, {var, f1 , f2 }]
displays a list of AC traces computed with e.g.
ACAnalysis in a Nichol plot
NicholPlot[traces, expr, {var, f1 , f2 }]
displays the value of an expression in terms of AC traces
NicholPlot[traces, {expr1 , expr2 , † † † }, {var, f1 , f2 }]
displays the values of several expressions

Displaying numerical data with NicholPlot.

You can customize the appearance of Nichol plots with the following options. In addition,
NicholPlot inherits many options from ListPlot and Legend. Both the options which are specific
to NicholPlot as well as the inherited options can be set with SetOptions[NicholPlot, opts].

option name default value

FrequencyScaling Exponential whether to distribute sampling points


exponentially or linearly along the
frequency axis
PhaseDisplay Degrees the unit for phase values
ShowLegend True whether to display trace names
TraceNames Automatic the trace names displayed in the plot legend

Options for NicholPlot.


3.9 Graphics Functions 345

See also: ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4),


ReadSimulationData (Section 3.10.3), BodePlot (Section 3.9.1), NyquistPlot (Section 3.9.4).

Options Description
A detailed description of all options that are specific to NicholPlot or are used in a non-standard
way is given below in alphabetical order:

FrequencyScaling
The option FrequencyScaling determines how sampling points are distributed over the frequency
axis. Possible values are:

Exponential use exponentially spaced sampling points


Linear use linearly spaced sampling points

Values for the FrequencyScaling option.

PhaseDisplay
The option PhaseDisplay specifies the unit for phase values. Possible values are:

Degrees display phase values in degrees


Radians display phase values in radians

Values for the PhaseDisplay option.

TraceNames
The option TraceNames allows you to specify the labels that are shown in the plot legend for the
displayed traces if ShowLegend −> True. The following values are possible:

Automatic use trace names from AC sweeps computed with e.g.


ACAnalysis
string or expr the name for a single trace
{string, † † † } or {expr, † † † } names for all traces; the number of names must equal the
number of traces

Values for the TraceNames option.


346 3. Reference Manual

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two transfer In[2]:= H1[s_] := (60 + 20*s)/(100*s + 45*s^2 + 15*s^3 + 2*s^4)
functions. H2[s_] := 10/(s^2 + s + 10)

Draw a Nichol plot of In[4]:= NicholPlot[H1[I w], {w, 0.1, 5}, AspectRatio −> 0.8]
H1 (jΩ).

dB
15
10
5
deg
-360 -300 -240 -120 -60 0
-5
-10
-15
-20

Out[4]= … Graphics …

Display two transfer In[5]:= NicholPlot[{H1[I w], H2[I w]}, {w, 0.1, 100},
functions in a Nichol plot. AspectRatio −> 0.7, PlotRange −> {{−300,0}, {−60,15}},
PlotPoints −> 100]

dB
10
deg
-300 -240 -120 -60 0
-10
-20
-30
-40
-50
-60

Out[5]= … Graphics …

This defines an RLC filter In[6]:= rlcf = Netlist[


circuit. {V1, {1, 0}, Symbolic −> V, Value −> 1},
{R1, {1, 2}, Symbolic −> R1, Value −> 1000.},
{L1, {2, 3}, Symbolic −> L, Value −> 0.001},
{C1, {3, 0}, Symbolic −> C, Value −> 2.2*10^−6},
{R2, {3, 0}, Symbolic −> R2, Value −> 1000.}
];
3.9 Graphics Functions 347

Set up modified nodal In[7]:= eqsrlcf = CircuitEquations[rlcf]


equations. Out[7]= … DAE@AC, †4 ´ 4‡D …

Do an AC analysis from In[8]:= acsweep = ACAnalysis[eqsrlcf, {f, 10, 10^6}]


10 Hz to 1 MHz.
88V$1 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,
Out[8]=

V$2 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,


V$3 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,
I$V1 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D<<

Display several In[9]:= NicholPlot[acsweep, {V$2[f], V$3[f]}, {f, 10, 10^6},


expressions in a Nichol AspectRatio −> 0.8]
plot.

dB
deg
-360-300-240 -120-60 0
-20

-40

-60

-80

-100
V$2[f] V$3[f]

Out[9]= … Graphics …

3.9.4 NyquistPlot

NyquistPlot[func, {var, f1 , f2 }]
displays a Nyquist plot of the transfer function func[var]
as the independent variable var is swept from f1 to f2
NyquistPlot[{func 1 , func2 , † † † }, {var, f1 , f2 }]
displays the transfer functions func1 , func2 , † † †
simultaneously in a Nyquist plot

Command structure of NyquistPlot .

NyquistPlot displays one or several transfer functions in a Nyquist plot. A Nyquist plot is a
parametric plot of the imaginary part vs. the real part of a frequency response as the frequency is
swept from f1 to f2 .
Note that NyquistPlot has attribute HoldFirst .
348 3. Reference Manual

NyquistPlot supports additional patterns for displaying numerical data generated with the functions
ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4), or ReadSimulationData (Section 3.10.3):

NyquistPlot[traces, {var, f1 , f2 }]
displays a list of AC traces computed with e.g.
ACAnalysis in a Nyquist plot
NyquistPlot[traces, expr, {var, f1 , f2 }]
displays the value of an expression in terms of AC traces
NyquistPlot[traces, {expr1 , expr2 , † † † }, {var, f1 , f2 }]
displays the values of several expressions

Displaying numerical data with NyquistPlot.

You can customize the appearance of Nyquist plots with the following options. In addition,
NyquistPlot inherits many options from ListPlot and Legend. Both the options which are specific
to NyquistPlot as well as the inherited options can be set with SetOptions[NyquistPlot, opts].

option name default value

FrequencyScaling Exponential whether to distribute sampling points


exponentially or linearly along the
frequency axis
ShowLegend True whether to display trace names
ShowUnitCircle False whether to draw the unit circle
TraceNames Automatic the trace names displayed in the plot legend
UnitCircleStyle RGBColor[0., 0., .5]
the plot style for the unit circle

Options for NyquistPlot .

See also: ACAnalysis (Section 3.7.3), NoiseAnalysis (Section 3.7.4),


ReadSimulationData (Section 3.10.3), BodePlot (Section 3.9.1), NicholPlot (Section 3.9.3).

Options Description
A detailed description of all options that are specific to NyquistPlot or are used in a non-standard
way is given below in alphabetical order:
3.9 Graphics Functions 349

FrequencyScaling
The option FrequencyScaling determines how sampling points are distributed over the frequency
axis. Possible values are:

Exponential use exponentially spaced sampling points


Linear use linearly spaced sampling points

Values for the FrequencyScaling option.

ShowUnitCircle
With ShowUnitCircle −> True, NyquistPlot adds the unit circle to a plot.

TraceNames
The option TraceNames allows you to specify the labels that are shown in the plot legend for the
displayed traces if ShowLegend −> True. The following values are possible:

Automatic use trace names from AC sweeps computed with e.g.


ACAnalysis
string or expr the name for a single trace
{string, † † † } or {expr, † † † } names for all traces; the number of names must equal the
number of traces

Values for the TraceNames option.

UnitCircleStyle
With UnitCircleStyle −> style, you can change the plot style for the unit circle.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define two transfer In[2]:= H1[s_] := 1/(s + 1);


functions. H2[s_] := 10/(s^2 + s + 10)

Increase the number of In[4]:= SetOptions[NyquistPlot, PlotPoints −> 200];


plot points.
350 3. Reference Manual

Draw a Nyquist plot of In[5]:= NyquistPlot[H2[I w], {w, 0.01, 100}, PlotRange −> All]
H2 (jΩ).

Im
Re
-1 -0.5 0.5 1 1.5
-0.5

-1

-1.5

-2

-2.5

-3

Out[5]= … Graphics …

This produces a Nyquist In[6]:= NyquistPlot[{H1[I w], H2[I w]}, {w, 0.01, 100},
plot of H1 (jΩ) and H2 (jΩ). PlotRange −> All]

Im
Re
-1 -0.5 0.5 1 1.5
-0.5

-1

-1.5

-2

-2.5

-3

Out[6]= … Graphics …

This defines an RLC filter In[7]:= rlcf = Netlist[


circuit. {V1, {1, 0}, Symbolic −> V, Value −> 1},
{R1, {1, 2}, Symbolic −> R1, Value −> 1000.},
{L1, {2, 3}, Symbolic −> L, Value −> 0.001},
{C1, {3, 0}, Symbolic −> C, Value −> 2.2*10^−6},
{R2, {3, 0}, Symbolic −> R2, Value −> 1000.}
];
Set up modified nodal In[8]:= eqsrlcf = CircuitEquations[rlcf]
equations. Out[8]= … DAE@AC, †4 ´ 4‡D …
3.9 Graphics Functions 351

Do an AC analysis from In[9]:= acsweep = ACAnalysis[eqsrlcf, {f, 10, 10^6}]


10 Hz to 1 MHz.
88V$1 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,
Out[9]=

V$2 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,


V$3 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D,
I$V1 ® InterpolatingFunction@8810., 1. ´ 106 <<, <>D<<

Display the trace of In[10]:= NyquistPlot[acsweep, {V$2[f]}, {f, 10, 10^6}]


V$2[f] .

Im
0.5
0.4
0.3
0.2
0.1
Re
0.2 0.4 0.6 0.8
-0.1
-0.2

V$2[f]

Out[10]= … Graphics …

Display several In[11]:= NyquistPlot[acsweep, {V$2[f]−0.5, 0.5−V$2[f]},


expressions in a Nyquist {f, 10, 10^6}, Frame −> True, ShowLegend −> False]
plot.

Im

0.4

0.2

0 Re

-0.2

-0.4

-0.4 -0.2 0 0.2 0.4

Out[11]= … Graphics …
352 3. Reference Manual

Display the unit circle. In[12]:= NyquistPlot[H2[I w], {w, 0.01, 100},
PlotRange −> {{−3, 3}, {−3.5, 1.5}},
ShowUnitCircle −> True]

Im

Re
-3 -2 -1 1 2 3

-1

-2

-3

Out[12]= … Graphics …

Display the unit circle In[13]:= NyquistPlot[H2[I w], {w, 0.01, 100},
using a different style. PlotRange −> {{−3, 3}, {−3.5, 1.5}},
ShowUnitCircle −> True,
UnitCircleStyle −>
{GrayLevel[0], Dashing[{0.04, 0.03}]}]

Im

Re
-3 -2 -1 1 2 3

-1

-2

-3

Out[13]= … Graphics …
3.9 Graphics Functions 353

3.9.5 RootLocusPlot

RootLocusPlot[func, {k, k0 , k1 }]
displays the root locus of func as k is swept from k0 to k1
RootLocusPlot[func] displays a pole/zero diagram of func
RootLocusPlot[rootloc] displays a root locus calculated with RootLocusByQZ

Command structure of RootLocusPlot .

RootLocusPlot displays a root locus plot of a transfer function H(s, k), where k denotes a real-
valued parameter. A root locus plot shows the trajectories of the poles and zeros of H(s, k) in the
complex plane as k varies from k0 to k1 . RootLocusPlot can also be used to produce a pole/zero
diagram of transfer function H(s) without parameters as well as to display root loci calculated with
RootLocusByQZ .
By default, RootLocusPlot chooses a logarithmic representation of the complex plane for better
visualization of widely separated poles and zeros. However, as logarithmic scaling is inappropriate
for coordinates near the axes, the regions around the axes are scaled semi-logarithmically, and the
region around the origin is scaled linearly. RootLocusPlot marks the linearly scaled region with a
gray background. The semi-logarithmic regions are the regions above and below as well as to the
left and the right of the linear region.
You can customize the appearance of root locus plots with the following options. In addition,
RootLocusPlot inherits many options from Graphics . Both the options which are specific to
RootLocusPlot as well as the inherited options can be set with SetOptions[RootLocusPlot, opts].
354 3. Reference Manual

option name default value

LinearRegionLimit 1.0 the extent of the linearly scaled plot region


LinearRegionSize 0.3 the relative size of the linearly scaled plot
region
LinearRegionStyle GrayLevel[0.9] the fill color used to mark the linear region
PlotPoints 5 the number of points between k0 and k1 at
which the poles and zeros are calculated
PlotRange Automatic the plot range
PoleStyle CrossMark[0.02, Hue[0.15 (1. − #1)] & , Thickness[0.007]]
the mark and plot style for poles
ShowLegend True whether to display a plot legend
ZeroStyle CircleMark[0.02, Hue[0.25 #1 + 0.3] & , Thickness[0.007]]
the mark and plot style for zeros

Options for RootLocusPlot .

See also: PolesAndZerosByQZ (Section 3.8.3), RootLocusByQZ (Section 3.8.6).

Options Description
A detailed description of all options that are specific to RootLocusPlot or are used in a non-standard
way is given below in alphabetical order:

LinearRegionLimit
With LinearRegionLimit −> value, you can specify the extent of the linearly scaled plot region
around the origin. For example, the setting LinearRegionLimit −> 100 causes the region where
-100 < x < 100 and -100 < y < 100 to be scaled linearly. LinearRegionLimit −> Infinity turns
off logarithmic scaling.

LinearRegionSize
LinearRegionSize −> size specifies the percentage of the total plot area occupied by the linear
region. The option value size must be a real number between 0 and 1.

LinearRegionStyle
With LinearRegionStyle −> style, you can specify the fill color RootLocusPlot uses for the linearly
scaled region.
3.9 Graphics Functions 355

PlotRange
The meaning of the PlotRange option is the same as for other Mathematica graphics functions, but
the option has slightly different formats.

{{xmin, xmax}, {ymin, ymax}} specify individual limits for all axes directions
{{xmin, xmax}} specify plot range for the x-axis.
value equivalent to {{−value, value}, {−value, value}}
Automatic or All determine plot range automatically

Values for the PlotRange option.

PoleStyle
With the option PoleStyle −> style, you can change the appearance of the symbol RootLocusPlot
uses to mark poles. The following styles are available:

CrossMark[size, colorfunc, grstyle]


marks a root with a cross
PlusMark[size, colorfunc, grstyle]
marks a root with a plus
CircleMark[size, colorfunc, grstyle]
marks a root with a circle
SquareMark[size, colorfunc, grstyle]
marks a root with a square
PointMark[size, colorfunc, grstyle]
marks a root with a point

Styles for the PoleStyle and ZeroStyle options.

In the above table, size denotes the size of a root marker in scaled coordinates, colorfunc a pure
function that returns a color value for an argument between 0 and 1, and grstyle an additional list of
graphics styles for the root marker. The color function is used to visualize the parameter dependency
of the root.

ZeroStyle
With the option ZeroStyle −> style, you can change the appearance of the symbol RootLocusPlot
uses to mark zeros. For a list of available styles see the description of the PoleStyle option.
356 3. Reference Manual

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define a transfer function In[2]:= Ha[s_, a_] := (a + 2*s + s^2)/(10 + 3*a*s + 4*s^2 + s^3)
Ha (s, a).

Display a root locus plot In[3]:= RootLocusPlot[Ha[s, a], {a, −4, 10}, PlotPoints −> 10]
of Ha (s, a) as a is swept
from -4 to 10.
a = -4.000e0 .. 1.000e1 (0% .. 100%)
Im s
Poles
5.0E0 0%

2.0E0

1.
100%
Re s
-5.0E0 -2.0E0 -1. 1.
Zeros
0%
-1.

-2.0E0

-5.0E0 100%

Out[3]= … Graphics …

Display the pole/zero In[4]:= RootLocusPlot[Ha[s, 0], PlotRange −> 6]


distribution of Ha (s, a) for
a = 0.
Im s

5.0E0

2.0E0

1.

Re s
-5.0E0 -2.0E0 -1. 1. 2.0E0 5.0E0

-1.

-2.0E0

-5.0E0

Out[4]= … Graphics …
3.9 Graphics Functions 357

Change boundaries, plot In[5]:= RootLocusPlot[Ha[s, a], {a, −4, 10},


size, and color of the PlotPoints −> 10, LinearRegionLimit −> 4.0,
linear region. LinearRegionSize −> 0.8,
LinearRegionStyle −> GrayLevel[0.95]]

a = -4.000e0 .. 1.000e1 (0% .. 100%)


Im s
Poles
0%
4.

2.

100%
Re s
-4. -3. -2. -1. 1.
Zeros
0%
-2.

-4.
100%

Out[5]= … Graphics …

Set equal plot limits for all In[6]:= RootLocusPlot[Ha[s, a], {a, −4, 10},
axes directions. PlotPoints −> 10, PlotRange −> 100, Frame −> True]

a = -4.000e0 .. 1.000e1 (0% .. 100%)


Im s
1.0E2 Poles
0%
1.0E1

1.
100%
0. Re s
Zeros
0%
-1.

-1.0E1

-1.0E2
100%
-1.0E2 -1.0E1 -1. 0. 1. 1.0E1 1.0E2

Out[6]= … Graphics …
358 3. Reference Manual

Change the style for pole In[7]:= RootLocusPlot[Ha[s, a], {a, −4, 10},
and zero markers. PlotPoints −> 10,
PoleStyle −> PlusMark[0.02,
GrayLevel[1−0.8*#]&, Thickness[0.005]],
ZeroStyle −> SquareMark[0.02,
GrayLevel[1−0.8*#]&, Thickness[0.005]]]

a = -4.000e0 .. 1.000e1 (0% .. 100%)


Im s
Poles
5.0E0 0%

2.0E0

1.
100%
Re s
-5.0E0 -2.0E0 -1. 1.
Zeros
0%
-1.

-2.0E0

-5.0E0 100%

Out[7]= … Graphics …

3.9.6 TransientPlot

TransientPlot[func, {tvar, t1 , t2 }]
displays the transient waveform func[tvar] as the
independent variable tvar is swept from t1 to t2
TransientPlot[{func 1 , func2 , † † † }, {tvar, t1 , t2 }]
displays the transient waveforms func1 , func2 , † † †
simultaneously in a single plot

Command structure of TransientPlot .

TransientPlot displays one or several transient waveforms in a single plot, where the signal values
are usually plotted versus time.
Note that TransientPlot has attribute HoldAll.
Additionally,
TransientPlot supports the multi-dimensional data format of Analog Insydes described in Section 3.7.1,
which consists of lists of rules, where the variables are assigned InterpolatingFunction objects.
Therefore, call TransientPlot where the first argument is compatible to the return value of the
numerical solver functions NDAESolve (Section 3.7.5) and NDSolve, or the data interface function
ReadSimulationData (Section 3.10.3):
3.9 Graphics Functions 359

TransientPlot[traces, expr, {tvar, t1 , t2 }]


displays the transient waveform of an expression in terms
of the computed traces as the independent variable tvar is
swept from t1 to t2
TransientPlot[traces, {expr1 , expr2 , † † † }, {tvar, t1 , t2 }]
displays the transient waveforms of several expressions
expr1 , expr2 , † † † simultaneously in a single plot

Displaying numerical data with TransientPlot .

TransientPlot inherits most of its options from Plot and GraphicsArray . Both the options which
are specific to TransientPlot as well as the inherited options can be set with
SetOptions[TransientPlot, opts].

option name default value

Parametric False whether to carry out a parametric plot


PlotRange Automatic the plot ranges for the different transient
waveforms
ShowLegend True whether to display a plot legend
ShowSamplePoints False generates a ListPlot of the simulation data

SingleDiagram True combines plots of several functions in a


single diagram
SweepParameters Automatic allows for filtering the multi-dimensional
data

Options for TransientPlot .

See also: NDSolve, NDAESolve (Section 3.7.5), ReadSimulationData (Section 3.10.3).

Options Description
A detailed description of all options that are specific to TransientPlot or are used in a non-standard
way is given below in alphabetical order:
360 3. Reference Manual

Parametric
Changing the default setting from False to True allows for carrying out parametric plots of transient
waveforms. Therefore, specify a list of two expressions, where the first one refers to the x-axis and
the second to the y-axis. The expressions are automatically added as labels to the x and y-axes.
Please note that this option also supports the multi-dimensional data format.

PlotRange
The usage of the option PlotRange is different as compared to Plot. The PlotRange of each transient
waveform can be separately modified for the setting SingleDiagram −> False. The default setting
is PlotRange −> Automatic . Possible option values are as follows:

Automatic or All determine PlotRange automatically


{ymin, ymax} specify same PlotRange for all waveforms
{Automatic | All | {ymin, ymax}, † † † }
specify individual PlotRange for each waveform

Values for the PlotRange option.

ShowLegend
The option ShowLegend allows for displaying a plot legend. The default setting is
ShowLegend −> True.

ShowSamplePoints
Changing the default setting from False to True allows for generating a ListPlot of the simulation
data.
Please note that this option also supports the multi-dimensional data format.

SingleDiagram
The option SingleDiagram combines plots of several transient waveforms in a single diagram.
Changing the default setting from True to False produces a GraphicsArray of separately plotted
transient waveforms.
Please note that this option also supports the multi-dimensional data format.
3.9 Graphics Functions 361

SweepParameters
The option SweepParameters allows for filtering the multi-dimensional data. The default setting is
SweepParameters −> Automatic . Possible option values are as follows:

Automatic leave the multi-dimensional data unchanged


{param1 −> value1 | param1 −> _, † † † }
specify explicit value or Blank[] for each valid sweep
parameter

Values for the SweepParameters option.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Plot two sinusoidal In[2]:= S[T_] := Sin[10.T];


functions. TransientPlot[{S[T], 2 S[T−1]}, {T, 0, 1}]

1 S[T]

T
0.2 0.4 0.6 0.8 1
2 S[T - 1]

-1

-2

Out[3]= … Graphics …

In the following, the transient solution of the diode rectifier circuit shown below is plotted
using TransientPlot .

D1
1 2

V0 C1 R1 Vout
362 3. Reference Manual

Define netlist description In[4]:= rectifier =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[4]= … Circuit …

Set up system of symbolic In[5]:= rectifiereqs = CircuitEquations[rectifier,


time-domain equations. AnalysisMode −> Transient, ElementValues −> Symbolic]
Out[5]= … DAE@Transient, †4 ´ 4‡D …

Perform numerical In[6]:= tran = NDAESolve[rectifiereqs, {t, 0., 2.*^−5}]

88V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


transient analysis.
Out[6]=

V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,


I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D<<

Display the simulation In[7]:= TransientPlot[tran, {V$1[t], V$2[t]}, {t, 0., 2.*^−5},
result with TransientPlot Axes −> False, Frame −> True, GridLines −> Automatic]
for the variables V$1[t]
and V$2[t].
2

1
V$1[t]
0

-1 V$2[t]

-2
0 -6 0.00001 0.000015 0.00002
5. 10
t

Out[7]= … Graphics …
3.9 Graphics Functions 363

View signals separately. In[8]:= Vd[t_] := V$1[t] − V$2[t];


TransientPlot[tran, {Vd[t], V$2[t]}, {t, 0., 2.*^−5},
PlotRange −> {{−4., 2.}, {0., 1.5}},
SingleDiagram −> False]

t
-6 0.00001 0.000015 0.00002

-1
5. 10
Vd[t]
-2

-3

-4

1.4

1.2

0.8

0.6
V$2[t]
0.4

0.2

t
-6 0.00001 0.000015 0.00002
5. 10

Out[9]= … GraphicsArray …

Display the simulation In[10]:= TransientPlot[tran, {V$1[t], V$2[t]}, {t, 0., 2.*^−5},
data. ShowSamplePoints −> True]

1 V$1[t]

t
-6 0.00001 0.000015 0.00002
5. 10 V$2[t]
-1

-2

Out[10]= … Graphics …
364 3. Reference Manual

Generate a parametric In[11]:= TransientPlot[tran, {V$1[t], V$2[t]},


plot. {t, 2.*^−6, 2.*^−5}, Parametric −> True]

V$2[t]

1.2

1.1

V$1[t]
-2 -1 1 2

0.9

0.8

Out[11]= … Graphics …

Perform parametric In[12]:= paramtran = NDAESolve[rectifiereqs, {t, 0., 2.*^−5},


transient analysis. {R1, Table[10^i, {i, 0, 3}]}]

88V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


Out[12]=

V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,


I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 1.<<,


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 10.<<,


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 100.<<,


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,

8V$2 ® InterpolatingFunction@880., 0.00002<<, <>D,


V$1 ® InterpolatingFunction@880., 0.00002<<, <>D,
I$V0 ® InterpolatingFunction@880., 0.00002<<, <>D,

SweepParameters ® 8R1 ® 1000.<<<


I$AC$D1 ® InterpolatingFunction@880., 0.00002<<, <>D,
3.9 Graphics Functions 365

Display the In[13]:= TransientPlot[paramtran, {V$2[t]}, {t, 0., 2.*^−5}]


multi-dimensional
simulation result: show all
traces of the parameter
1.2
sweep.
1
0.8
0.6 V$2[t]
0.4
0.2
t
-6 0.00001 0.000015 0.00002
5. 10

Out[13]= … Graphics …

Filter the In[14]:= TransientPlot[paramtran, {V$2[t]}, {t, 0., 2.*^−5},


multi-dimensional data: SweepParameters −> {R1 −> 1.}]
display only the trace
corresponding to the
parameter value R1=1.
1

0.8

0.6
V$2[t]
0.4

0.2

t
-6 0.00001 0.000015 0.00002
5. 10

Out[14]= … Graphics …
366 3. Reference Manual

3.10 Interfaces
In the following chapter the different import and export features of Analog Insydes are discussed.
Section 3.10.1 describes how to translate netlists from external simulators to the internal Analog
Insydes netlist format using ReadNetlist . The commands ReadSimulationData (Section 3.10.3)
and WriteSimulationData (Section 3.10.4) can be used to import or export numerical simulation
data. For behavioral model generation the command WriteModel (Section 3.10.5) can be used, which
translates a symbolic DAEObject to an external behavioral model description language such as
Saber MAST. For importing schematics stored in DXF format (Drawing Interchange File) as native
Mathematica graphic objects see DXFGraphics (Section 3.13.2).

3.10.1 ReadNetlist

ReadNetlist["netfile", Simulator−>sim]
reads a netlist file "netfile" from a simulator sim and
converts it into an Analog Insydes netlist
ReadNetlist["netfile", "outfile", Simulator−>sim]
additionally adds the operating-point information from the
simulator output file "outfile"

Command structure of ReadNetlist .

This function converts a simulator-specific netlist file netfile into an Analog Insydes netlist description.
Additionally, the operating-point information can be extracted from a given simulator-specific output
file outfile. ReadNetlist then returns a Circuit object which can be used for setting up circuit
equations by applying the function CircuitEquations (Section 3.5.1). For more information on the
simulator-specific features see Section 3.10.2.
ReadNetlist has the following options:
3.10 Interfaces 367

option name default value

CharacterMapping {"_" −> "$"} list of translation rules for character


mapping used while transforming simulator
parameters to Mathematica symbols
InstanceNameSeparator Inherited[AnalogInsydes]
specifies the character or string Analog
Insydes uses to separate name components
of reference designators and node
identifiers generated for instantiated
subcircuit objects (see Section 3.14.2)
KeepPrefix True if set to False the prefix of the reference
designator introduced by the PSpice
Schematics Editor and the Saber Designer
will be omitted
LevelSeparator "/" specifies the character or string Analog
Insydes uses to separate name components
of local models, parameters, and subcircuits
generated by ReadNetlist
LibraryPath {"."} specifies the directories which contain
device model libraries
ParseOnly False if set to True the data extraction step is
skipped and the raw data in Mathematica
format is returned, while reading a file
generated by the Spectre to Analog Insydes
interface for Analog Artist
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Simulator Inherited[AnalogInsydes]
standard Analog Insydes simulator
specification (see Section 3.14.6)
UserPDKMap None specifies a user-definable command for
making PDK-specific changes to a netlist
generated by the Spectre to Analog Insydes
interface for Analog Artist

Options for ReadNetlist .

See also: ReadSimulationData (Section 3.10.3), Simulator (Section 3.14.6), Section 3.10.2.
368 3. Reference Manual

Options Description
A detailed description of all ReadNetlist options is given below in alphabetical order:

CharacterMapping
With CharacterMapping −> {charactera −> characterb } the internal character mapping scheme can
be modifed. Use this option with caution, because this rule will be applied to each symbol
and expression in the netlist. For example CharacterMapping −> {"." −> "$"} will replace all
dots (".") into dollar signs ("$"), even if it is a decimal dot like in "1.234", which will lead
to a syntax error ("1$234"). This option is useful if your netlist contains e.g. element names
including "_" and "$" and which will be ambiguous if the "_" is mapped to a "$". You can use
CharacterMapping −> {"_" −> "x"} to avoid this ambiguity.

KeepPrefix
Some schematic capture tools add a prefix to all element names to make sure that the element type
is correct and independent from the actual element name. If KeepPrefix −> False is set, the prefix
will be removed. If a Saber netlist is read, the template name is removed.
Use this option with caution. It might cause ambiguous element names.

LevelSeparator
Locally defined subcircuits must be transformed to a top-level subcircuit with unique names. To
generate unique names the value of LevelSeparator −> string is used to separate the different levels
of subcircuits. Because these names are never converted to a Mathematica symbol it is possible to
specifiy a non-alphanumeric character.
The default is LevelSeparator −> "/".

LibraryPath
A netlist can contain calls to further files and libraries. With LibraryPath the search path for these
files can be specified.
The default is LibraryPath −> {"."}. The current working directory is set to the directory from the
file name specification for netfile (see also the Mathematica command DirectoryName ).

ParseOnly
Note that this option takes effect only if the option Simulator is set to "AnalogArtist" . If
ParseOnly −> True then ReadNetlist skips the data extraction step and returns the raw data in
Mathematica format, while reading a file generated by the Spectre to Analog Insydes interface for Analog
Artist.
3.10 Interfaces 369

Protocol
This option describes the standard Analog Insydes protocol specification (see Section 3.14.5). The
top-level function for the Protocol option is ReadNetlist . The second-level function is
ExpandSubcircuits .

Simulator
ReadNetlist supports the following simulators and file types:

simulator netlist file type output file type

"AnalogArtist" *.m file


"AnalogInsydes" *.m file
"Eldo" *.cir file *.chi file
"PSpice" *.cir file *.out file
"Saber" *.sin file saved ssparam output

Supported simulators and file types by ReadNetlist .

ReadNetlist appends Simulator −> simulator to the GlobalParameters field of the returned
Circuit object. This enables the Analog Insydes models to determine which simulator-specific
properties of the models have to be chosen. For more information on the simulator-specific features
see Section 3.10.2.

UserPDKMap
Note that this option is only supported by the Analog Artist interface. UserPDKMap specifies a
user-definable command for making changes with respect to a certain process design kit (PDK) to a
netlist before setting up circuit equations.
The function is called with the pattern fct["process", "pdkversion", netlistentry], where the strings
"process" and "pdkversion" correspond to the option values of the global circuit parameters Process
and PDKVersion respectively. In this context Process−>"process" denotes the name of the semi-
conductor fabrication process used to design a circuit, and PDKVersion−>"pdkversion" indicates the
version of the PDK used to create and simulate a circuit. If UserPDKMap−>None is used, no changes
are applied to netlist elements.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
370 3. Reference Manual

Read and convert a PSpice In[2]:= netdc = ReadNetlist[


netlist. "AnalogInsydes/DemoFiles/Multivibrator.cir",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Display the netlist. In[3]:= DisplayForm[netdc]


Out[3]//DisplayForm=

Netlist HRaw, 9 EntriesL:


Circuit:

8R1, 81, 2<, Type ® Resistor, Value ® 4700., Symbolic ® R1<


8R2, 82, 0<, Type ® Resistor, Value ® 4700., Symbolic ® R2<
8R3, 84, 0<, Type ® Resistor, Value ® 39000., Symbolic ® R3<
8R4, 85, 0<, Type ® Resistor, Value ® 82000., Symbolic ® R4<
8R5, 81, 3<, Type ® Resistor, Value ® 18000., Symbolic ® R5<
8IC, 84, 5<, Type ® CurrentSource, Value ® 8AC ® 0, DC È Transient ® 0<<
8Q1, 83 ® C, 2 ® B, 4 ® E<, Model ® Model@BJT, BC182, Q1D, Selector ® Selector@BJT
8Q2, 81 ® C, 3 ® B, 5 ® E<, Model ® Model@BJT, BC182, Q2D, Selector ® Selector@BJT
8VCC, 81, 0<, Type ® VoltageSource, Value ® 8AC ® 0, DC È Transient ® 9.<, Symboli
ModelParameters@Name ® BC182, Type ® NPN, CJC ® 1. ´ 10-12 D
GlobalParameters@Simulator ® PSpiceD

Read a PSpice netlist In[4]:= buffer = ReadNetlist[


including operating-point "AnalogInsydes/DemoFiles/Buffer.cir",
information. "AnalogInsydes/DemoFiles/Buffer.out",
Simulator −> "PSpice"]
Out[4]= … Circuit …

3.10.2 Simulator-Specific Remarks on ReadNetlist


The command ReadNetlist translates netlists from several external simulators to the Analog Insydes
netlist format. The following section describes the different features supported by ReadNetlist for
each simulator.

AnalogArtist
ReadNetlist["netfile", Simulator −> "AnalogArtist"] is basically a wrapper function which is
used to load a Mathematica compatible *.m file, generated by the Spectre to Analog Insydes Interface
for Analog Artist. Additionally, ReadNetlist skips the data extraction step and returns the raw data
in Mathematica format, if the options ParseOnly is set to True. For more information please refer to
the documentation of the Cadence/Analog Insydes interface.

AnalogInsydes
ReadNetlist["netfile", Simulator −> "AnalogInsydes"] is basically only a wrapper function for
the Mathematica command Get. Additionally, ReadNetlist checks if the netfile loaded contains a
Circuit object and appends Simulator −> "AnalogInsydes" to the GlobalParameters field.
3.10 Interfaces 371

PSpice
ReadNetlist["netfile", Simulator −> "PSpice"] supports the following devices:

PSpice reference designator Analog Insydes type

C Capacitor or model call


D model call
E VCVSource or model template
F CCCSource
G VCCSource or model template
H CCVSource
I CurrentSource
J model call
L Inductor or model call
M model call
Q model call
R Resistor or model call
V VoltageSource
X subcircuit call

PSpice reference designators supported by ReadNetlist .

All model calls have functions as references for Model, Selector, and Parameters were applicable:
{rd, {n1 −> p1 ,       },
Model −> Model[type, model, rd],
Selector −> Selector[type, model, rd],
Parameters −> Parameters[type, model, rd],       }
where type is one of "BJT", "CAP", "Diode", "IND", "JFET", "MOSFET", or "RES". The value model
is the model name, rd the reference designator of the device.
Linear resistors (R), capacitors (C), and inductors (L) are converted to their generic counterpart in
Analog Insydes. Model calls are generated if temperature dependencies are given or a model is
defined.
Linear controlled sources (E, F, G, H) are converted to their generic counterpart in Analog Insydes. In
case of current controlled sources (F, H) additional nodes are introduced. In case of nonlinear voltage
controlled sources (E, G) a behavioral model is generated and appended to the netlist. Supported
types are POLY, VALUE, and TABLE.
372 3. Reference Manual

Independent sources (I, V) of type EXP, PULSE, PWL, SFFM, and SIN are supported (see Chapter 4.1).
Parameterized subcircuits without optional nodes are also supported and may contain local model
cards.
The following cards are supported:

PSpice card action

.INCLUDE include the given file


.LIB search for missing models and subcircuits
.MODEL convert to ModelParameters
.PARAM convert to GlobalParameters
.OPTIONS scan for GMIN, DEFL, DEFW, DEFAD, DEFAS, DEFPD, DEFPS,
DEFNRD, DEFNRS, TNOM and convert to GlobalParameters
.SUBCKT convert to Subcircuit
.TEMP convert to GlobalParameters
.TRAN scan for tstep and tstop and convert to GlobalParameters
.TITLE print title according the setting of the Protocol option

PSpice cards supported by ReadNetlist .

The following cards are ignored:

.AC
.ALIASES
.DC
.NOISE
.PLOT
.PRINT
.PROBE
.OP
.WIDTH

PSpice cards ignored by ReadNetlist .

Note that all temperatures like TEMP are converted from é C to K.


3.10 Interfaces 373

ReadNetlist["netfile", "outfile", Simulator −> "PSpice"] additionally scans the operating-point


information section in the output file outfile. Afterwards the circuit is flattened via an internal call
to ExpandSubcircuits and the small-signal parameters are appended to the corresponding model
instance. The parameter names are postfixed with "$ac" to avoid ambiguities.

Eldo
ReadNetlist["netfile", Simulator −> "Eldo"] supports the following devices:

Eldo reference designator Analog Insydes type

C Capacitor or model call


D model call
E VCVSource or model template
F CCCSource or model template
G VCCSource
H CCVSource
I CurrentSource
J model call
L Inductor or model call
M model call
Q model call
R Resistor or model call
V VoltageSource
X subcircuit call
Y model call

Eldo reference designators supported by ReadNetlist .

All model calls have functions as references for Model, Selector, and Parameters were applicable:
{rd, {n1 −> p1 ,       },
Model −> Model[type, model, rd],
Selector −> Selector[type, model, rd],
Parameters −> Parameters[type, model, rd],       }
where type is one of "BJT", "CAP", "Diode", "IND", "JFET", "MOSFET", or "RES". The value model
is the model name, rd the reference designator of the device.
374 3. Reference Manual

Linear resistors (R), capacitors (C), and inductors (L) are converted to their generic counterpart in
Analog Insydes. Model calls are generated if temperature dependencies are given or a model is
defined.
Linear controlled sources (E, F, G, H) are converted to their generic counterpart in Analog Insydes. In
case of current controlled sources (F, H) additional nodes are introduced. In case of nonlinear voltage
controlled sources (E, G) a behavioral model is generated and appended to the netlist. Supported
types are POLY, VALUE, and TABLE.
Independent sources (I, V) of type EXP, PULSE, PWL, SFFM, and SIN are supported (see Chapter 4.1).
Parameterized subcircuits are also supported and may contain local model cards and local subcircuit
definitions.
For calls to HDLA models (Y), ReadNetlist reads the file "hdlaInfo" and scans the section
[HdlaPins] to set up the correct node to port mapping:
{rd, {n1 −> p1 ,       },
Model −> Model[entity, architecture, rd],
Selector −> architecture,       }
with the HDLA entity name entity and the HDLA architecture name architecture. If the file cannot
be found a generic port list is generated:
{rd, {n1 −> 1, n2 −> 2,       }
Model −> Model[entity, architecture, rd],
Selector −> architecture,       }
The environment variables HDLALIBPATH and HDLAWORKPATH are taken into account while searching
for the file "hdlaInfo" .
The following cards are supported:
3.10 Interfaces 375

Eldo card action

.ADDLIB search for missing models and subcircuits


.DC scan for TEMP and convert to GlobalParameters
.HDLALIB search for macro interface definitions of HDLA models
.INCLUDE include the given file
.LIB search for missing models and subcircuits
.MODEL convert to ModelParameters
.PARAM convert to GlobalParameters or subcircuit parameters
.OPTIONS scan for GMIN, DEFL, DEFW, DEFAD, DEFAS, DEFPD, DEFPS,
DEFNRD, DEFNRS, TNOM and convert to GlobalParameters
.SUBCKT convert to Subcircuit
.TEMP convert to GlobalParameters
.TRAN scan for tstep and tstop and convert to GlobalParameters
.TITLE print according the setting of the Protocol option

Eldo cards supported by ReadNetlist .

The following cards are ignored:

.AC
.ALIASES
.NOISE
.PLOT
.PRINT
.PROBE
.OP
.RAMP
.VIEW
.WIDTH

Eldo cards ignored by ReadNetlist .

Note that all temperatures like TEMP are converted from é C to K.


376 3. Reference Manual

ReadNetlist["netfile", "outfile", Simulator −> "Eldo"] additionally scans the operating-point information
section in the output file outfile. Afterwards the circuit is flattened via an internal call to
ExpandSubcircuits and the small-signal parameters are appended to the corresponding model
instance. The parameter names are postfixed with "$ac" to avoid ambiguities.

Saber
ReadNetlist["netfile", Simulator −> "Saber"] reads in Saber netlists. Due to the fact that all
elements in Saber MAST are calls to MAST templates, ReadNetlist replaces some template calls
with generic Analog Insydes elements:

MAST template name Analog Insydes type

C Capacitor
CL Capacitor
CAP Capacitor
L Inductor
R Resistor
RES Resistor
SPI_DC CurrentSource
I_DC CurrentSource
I_PULSE CurrentSource
I_SIN CurrentSource
I CurrentSource
SPV_DC VoltageSource
V_DC VoltageSource
V_PULSE VoltageSource
V_SIN VoltageSource
V VoltageSource

MAST templates replaced with generic Analog Insydes elements.

All other elements are converted to


{name, {n1 −> p1 ,       },
Model −> Model[model, model, name],
Selector −> Selector[model, model, name],
Parameters −> Parameters[model, model, name],       }
where name is the name of the element and model is the template name.
3.10 Interfaces 377

3.10.3 ReadSimulationData

ReadSimulationData["file", Simulator−>sim]
reads a data file "file" from a simulator sim and converts
its content to the Analog Insydes data format
ReadSimulationData["file", key, Simulator−>sim]
reads data sets marked with key

Command structure of ReadSimulationData .

ReadSimulationData returns the result according to the Analog Insydes numerical data format
described in Section 3.7.1. It consists of lists of rules, where the variables are assigned
InterpolatingFunction objects. Note that Analog Insydes supports a multi-dimensional data
format.
The return value of ReadSimulationData can be used as first argument to most Analog Insydes
graphics functions such as BodePlot (Section 3.9.1) or TransientPlot (Section 3.9.6) for visualizing
the simulation data.
ReadSimulationData has the following options:

option name default value

InterpolationOrder 1 specifies the interpolation order of the


resulting InterpolingFunction
MappingFiles None specifies the names of the Analog Artist
mapping files to be used to restore signal
names in Spectre PSF files
ParseOnly False if set to True the data extraction step is
skipped and the raw data in Mathematica
format is returned, while reading a Spectre
PSF file
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
ShowHeader False specifies whether HEADER data is displayed,
while parsing a Spectre PSF file
Simulator Inherited[AnalogInsydes]
standard Analog Insydes simulator
specification (see Section 3.14.6)

Options for ReadSimulationData .


378 3. Reference Manual

See also: WriteSimulationData (Section 3.10.4), ReadNetlist (Section 3.10.1),


BodePlot (Section 3.9.1), TransientPlot (Section 3.9.6), Simulator (Section 3.14.6), Section 3.7.1.

Options Description

InterpolationOrder
With InterpolationOrder −> integer, you can change the interpolation order of the resulting
interpolating functions. See the Mathematica object InterpolatingFunction .
The default setting is InterpolationOrder −> 1, which is linear interpolation.

MappingFiles
Note that this option takes effect only if the option
Simulator is set to "Spectre" . MappingFiles specifies the names of the Analog Artist mapping
files to be used to restore signal names in PSF files. If set to Automatic , the default mapping files
amap/top_level_map.i.net and amap/top_level_map.i.inst are used. Furthermore the setting
MappingFiles −> None switches the mapping mechanism off.

ParseOnly
Note that this option takes effect only if the option Simulator is set to "Spectre" . If ParseOnly
is set to True, ReadSimulationData skips the data extraction step and returns the raw data in
Mathematica format.

ShowHeader
Note that this option takes effect only if the option Simulator is set to "Spectre" . ShowHeader
specifies whether to display HEADER data while parsing a Spectre PSF file.

Simulator
To distinguish between different file formats used by different simulators it is necessary to specify
the simulator which generated the data file. Possible values for Simulator are:
3.10 Interfaces 379

simulator file type

"AnalogInsydes" Mathematica *.m file


"Eldo" Binary *.cou file
"PSpice" CSDF file, *.csd or *.txt
"Saber" SaberScope file
"Spectre" PSF file

Supported simulators and file types by ReadSimulationData .

If file contains multiple data sets like DC and AC analysis results, a key can be given as a second
argument to ReadSimulationData to distinguish between these sets ("Eldo" and "PSpice" only):

simulator possible keys

"Eldo" "HERTZ", "VOLT", "SEC"


"PSpice" "AC Sweep", "DC Sweep", "Transient"

Simulator-dependent keys for ReadSimulationData .

Please note that the keys may depend on the used simulator version.
The return value has the data format as described in Section 3.7.1. The labels are of type String.
Reading a CSDF file generated with PSpice which contains simulation data from various simulation
runs, results in misleading values for SweepParameters .
An Eldo "*.cou" file generated with the Eldo command line option "−dbp" (the default) contains
the complex data expressed as magnitude and phase, with "−ri" as real and imaginary values.
ReadSimulationData automatically adds the corresponding complex waveforms.
Only Eldo "*.cou" binary files written with big endian machines are supported.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
380 3. Reference Manual

Read simulation data from In[2]:= data = ReadSimulationData[


PSpice data file. "AnalogInsydes/DemoFiles/Multivibrator.txt",
Simulator −> "PSpice"]

88VH4L ® InterpolatingFunction@88-0.00018,
Out[2]=
0.00012<<, <>D,

SweepParameters ® 8VCC ® 0.<<,


VH5L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

8VH4L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

SweepParameters ® 8VCC ® 6.<<,


VH5L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

8VH4L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

SweepParameters ® 8VCC ® 12.<<<


VH5L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

The data can easily be In[3]:= TransientPlot[data, {"V(4)"[IC], "V(5)"[IC]},


plotted with {IC, −0.00018, 0.00012}]
TransientPlot .

10

8 V(4)[IC]
6

4 V(5)[IC]

IC
-0.00015
-0.0001
-0.00005 0.000050.0001

Out[3]= … Graphics …

3.10.4 WriteSimulationData

WriteSimulationData["file", exprs, {x, xmin, xmax}, Simulator−>sim]


writes sampled data of exprs to file for usage with
simulator sim
WriteSimulationData["file", traces, vars, {x, xmin, xmax}, Simulator−>sim]
writes sampled data of the variables vars as a function of x
from xmin to xmax where traces corresponds to the return
value of numerical equation solvers like NDSolve or
NDAESolve

Command structure of WriteSimulationData .

WriteSimulationData can be used for displaying Analog Insydes results in a post-processor of


an external design framework. Therefore WriteSimulationData writes different file formats which
are addressed by the option Simulator . WriteSimulationData does not support multi-dimensional
data.
3.10 Interfaces 381

WriteSimulationData has the following options:

option name default value

ComplexValues False whether the data should be written as


complex numbers
Compiled True if exprs should be compiled
DataLabels Automatic list of strings to give the traces a more
convenient name
InterpolationOrder 1 specifies the interpolation order of the
resulting interpolating functions
PlotPoints 100 number of sample points
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Sampling Linear whether to sample Linear or Exponential
Simulator Inherited[AnalogInsydes]
standard Analog Insydes simulator
specification (see Section 3.14.6)

Options for WriteSimulationData .

See also: ReadSimulationData (Section 3.10.3), Simulator (Section 3.14.6).

Options Description
A detailed description of all WriteSimulationData options is given below in alphabetical order:

ComplexValues
To generate complex-valued data from a small-signal analysis set ComplexValues −> True to write
the data as complex numbers.
The default ComplexValues −> False writes real numbers which can be used for DC and transient
analyses.

Compiled
With Compiled −> True the expression exprs is compiled with the Mathematica command Compile
before evaluation.
382 3. Reference Manual

DataLabels
With DataLabels −> {string1 , string2 , † † † } you can specifiy new labels for the return value of exprs
or for each variable in vars. This is necessary because post-processors often rely on a special name
scheme for trace names. Using a Mathematica expression may irritate the post-processor.

InterpolationOrder
With InterpolationOrder −> integer, you can change the interpolation order of the resulting
interpolating functions which are generated if the option Simulator is set to "AnalogInsydes" .
See the Mathematica object InterpolatingFunction .
The default setting is InterpolationOrder −> 1, which is linear interpolation.

PlotPoints
The option PlotPoints −> integer specifies the number of sample points. The default is 100.

Sampling
With Sampling −> Exponential the functions are sampled exponentially. The default is
Sampling −> Linear.

Simulator
The following file formats are supported:

simulator file type

"AnalogInsydes" Mathematica *.m file


"PSpice" CSDF file, *.csd or *.txt
"Saber" ASCII SaberScope file

Simulators and file types supported by WriteSimulationData .

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Write a SaberScope file. In[2]:= WriteSimulationData["Test.p1.dat",


{(1. − Exp[−t])*Cos[t]}, {t, 0., 10.},
DataLabels −> {"F"}, Simulator −> "Saber"]
3.10 Interfaces 383

View the file In[3]:= data = ReadSimulationData["Test.p1.dat",


"Test.p1.dat" with Simulator −> "Saber"]

88F ® InterpolatingFunction@880., 10.<<, <>D<<


SaberScope. Alternatively,
Out[3]=
read it again into
Mathematica with
ReadSimulationData .

Plot the data with In[4]:= TransientPlot[data, "F"[t], {t, 0., 10.}]
TransientPlot .

0.5

F[t]
t
2 4 6 8 10

-0.5

-1

Out[4]= … Graphics …

3.10.5 WriteModel

WriteModel["file", modelname, dae, ports, connections, Simulator−>sim]


converts a DAEObject dae into a simulator-specific model
with respect to the ports and the defined circuit interface
given by connections

Command structure of WriteModel .

The function WriteModel converts a DAEObject dae into a behavioral model for a given simulator.
An interface can be defined which connects the model with a circuit. The connections are then given
by a list of rules of the form:
{param1 −> Voltage[port1 , port2 ],
param2 −> Current[port3 , port4 ],
var1 −> Voltage[port5 , port6 ],
var2 −> Current[port7 , port8 ]}
This interface definition will generate two input port branches from port1 to port2 (voltage) and from
port3 to port4 (current) and two output branches from port5 to port6 (voltage) and from port7 to port8
(current).
WriteModel has the following options:
384 3. Reference Manual

option name default value

DesignPoint Automatic specifies a list of numerical reference values


for symbolic element values in a set of
circuit equations
InitialConditions Automatic specifies alternative initial conditions
InitialGuess Automatic specifies an alternative initial guess
Simulator Inherited[AnalogInsydes]
standard Analog Insydes simulator
specification (see Section 3.14.6)

Options for WriteModel.

Options Description
A detailed description of all WriteModel options is given below in alphabetical order:

DesignPoint
With DesignPoint −> {symbol1 −> value1 , † † † } you can overwrite the design point given in the
DAEObject (see also CircuitEquations in Section 3.5.1). The default setting is
DesignPoint −> Automatic , which means to use the design point given in the DAEObject.

InitialConditions
The option InitialConditions allows for explicitly specifying initial conditions. The default
setting is InitialConditions −> Automatic , which means to use the initial conditions given in
the DAEObject. Valid option values are as follows:

Automatic uses initial conditions given in the DAEObject


{var1 == value1 , † † † } uses specified equations as initial conditions

Values for the InitialConditions option.

InitialGuess
The option InitialGuess allows for explicitly specifying an initial guess for the Newton iteration
when computing the operating point. The default setting is InitialGuess −> Automatic , which
means to use the initial guess given in the DAEObject. Possible option values are as follows:
3.10 Interfaces 385

Automatic uses initial guess given in the DAEObject


{var1 −> value1 , † † † } uses specified values as initial guess

Values for the InitialGuess option.

Simulator
The following simulator-dependent modeling languages are supported:

simulator model type

"AnalogInsydes" Analog Insydes Model object


"PSpice" netlist model consisting of controlled sources
"Saber" Saber MAST model

Simulators and model types supported by WriteModel .

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read a netlist. In[2]:= net = ReadNetlist[


"AnalogInsydes/DemoFiles/Multivibrator.cir",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up a system of In[3]:= dae = CircuitEquations[net,


equations. ElementValues −> Symbolic, AnalysisMode −> DC]
Out[3]= … DAE@DC, †16 ´ 16‡D …

Display the variables of In[4]:= GetVariables[dae]

8V$1, V$2, V$3, V$4, V$5, I$BS$Q1, I$CS$Q1, I$ES$Q1,


dae. These variables can
Out[4]=
be used as outputs.
ib$Q1, ic$Q1, I$BS$Q2, I$CS$Q2, I$ES$Q2, ib$Q2, ic$Q2, I$VCC<

Display the parameters of In[5]:= GetParameters[dae]

8AREA$Q1, AREA$Q2, BF$Q1, BF$Q2, BR$Q1, BR$Q2, GMIN,


dae. These parameters can
Out[5]=
be used as inputs.
IS$Q1, IS$Q2, R1, R2, R3, R4, R5, TEMP, TNOM, VCC, $k, $q<
386 3. Reference Manual

Generate the Saber MAST In[6]:= WriteModel["test.sin", "test", dae,


model test. The first {"IP", "IN", "VP", "VN"},
branch ("IP" −> "IN") {IC −> Current["IP", "IN"], VCC −> Voltage["VP", "VN"],
defines IC as the I$VCC −> Current["VP", "VN"]},
corresponding input Simulator −> "Saber"]
current. The second
branch ("VP" −> "VN")
defines an input voltage
VCC and an output current
I$VCC.
3.11 Linear Simplification Techniques 387

3.11 Linear Simplification Techniques


A special feature of Analog Insydes is its capability of analyzing large analog circuits symbolically
by means of symbolic approximation techniques. Analog Insydes provides two different methods
for computing approximated transfer functions, namely a simplification-before-generation (SBG, see
function ApproximateMatrixEquation in Section 3.11.3) and a simplification-after-generation method
(SAG, see function ApproximateTransferFunction in Section 3.11.2). SBG refers to methods that
simplify a circuit analysis problem before a symbolic transfer function is generated from a system
of equations or a network graph. SAG algorithms approximate a transfer function by discarding
insignificant terms after the exact expression has been computed.
Furthermore, this section contains the function ComplexityEstimate (Section 3.11.1) for estimating
the number of product terms in a symbolic transfer function, and the function
CompressMatrixEquation (Section 3.11.4) for compressing a system of matrix equations.

3.11.1 ComplexityEstimate

ComplexityEstimate[dae] estimates the number of product terms in the expanded


determinant of dae, which must be a system of AC circuit
equations in matrix form
ComplexityEstimate[netlist] estimates the complexity of any transfer function calculated
from netlist, which must be a flat netlist

Command structure of ComplexityEstimate .

Before you try to solve a system of circuit equations symbolically with Solve (Section 3.5.4), you
should use the function ComplexityEstimate to check whether the computation is feasible at all.
ComplexityEstimate computes an estimate of the number of product terms in a transfer function
computed from a symbolic matrix equation A × x = b. More precisely, the function computes a lower
bound for the number of product terms in the determinant of A.
As a rule of thumb, solving a system of circuit equations symbolically is technically feasible if the
number returned by ComplexityEstimate is less than 10000. If you expect a symbolic expression
to be interpretable, its complexity should be in the range from 1 to 20.
See also: Statistics (Section 3.6.17).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
388 3. Reference Manual

Define an AC model for In[2]:= Circuit[


BJTs. Model[
Name −> BJT,
Selector −> AC,
Scope −> Global,
Ports −> {B, C, E},
Parameters −> {Rbe, Cbc, Cbe, beta, Ro,
RBE, CBC, CBE, BETA, RO},
Definition −> Netlist[
{CBE, {B, E}, Symbolic −> Cbe, Value −> CBE},
{RBE, {X, E}, Symbolic −> Rbe, Value −> RBE},
{CBC, {B, C}, Symbolic −> Cbc, Value −> CBC},
{CC, {B, X, C, E},
Symbolic −> beta, Value −> BETA},
{RO, {C, E}, Symbolic −> Ro, Value −> RO}
]
]
] // ExpandSubcircuits;

This netlist describes a In[3]:= ceamplifier =


common-emitter amplifier. Circuit[
Netlist[
{V1, {1, 0}, 1},
{V0, {6, 0}, 0},
{C1, {1, 2}, Symbolic −> C1, Value −> 1.0*^−7},
{R1, {2, 6}, Symbolic −> R1, Value −> 1.0*^5},
{R2, {2, 0}, Symbolic −> R2, Value −> 47000.},
{RC, {6, 3}, Symbolic −> RC, Value −> 2200.},
{RE, {4, 0}, Symbolic −> RE, Value −> 1000.},
{C2, {3, 5}, Symbolic −> C2, Value −> 1.0*^−6},
{RL, {5, 0}, Symbolic −> RL, Value −> 47000.},
{Q1, {2 −> B, 3 −> C, 4 −> E},
Model −> BJT, Selector −> AC,
CBE −> 30.*^−12, CBC −> 5.*^−12, RBE −> 1000.,
RO −> 10000., BETA −> 200.}
]
]
Out[3]= … Circuit …

Set up a system of In[4]:= eqs = CircuitEquations[ceamplifier,


symbolic AC equations. ElementValues −> Symbolic]
Out[4]= … DAE@AC, †10 ´ 10‡D …

Compute the complexity In[5]:= ComplexityEstimate[eqs]


estimate. Out[5]= 132

The number returned by ComplexityEstimate indicates that solving the equations for any transfer
function is feasible, but the result cannot be expected to yield much insight into circuit behavior.
3.11 Linear Simplification Techniques 389

Compute the voltage In[6]:= solution = Solve[eqs, V$5];


transfer function v5 = Together[V$5 /. First[solution]]
symbolically and expand
HC2 R1 R2 RC RL s HC1 RE s - beta$Q1 C1 Ro$Q1 s + C1 Cbc$Q1 Rbe$Q1 RE s2 +
the result. Out[7]=

C1 Cbe$Q1 Rbe$Q1 RE s2 + C1 Cbc$Q1 Rbe$Q1 Ro$Q1 s2 +

C1 Cbc$Q1 Cbe$Q1 Rbe$Q1 RE Ro$Q1 s3 LL 


C1 Cbc$Q1 RE Ro$Q1 s2 + beta$Q1 C1 Cbc$Q1 RE Ro$Q1 s2 +

HR1 R2 RC + R1 Rbe$Q1 RC + R2 Rbe$Q1 RC + R1 R2 RE + R1 Rbe$Q1 RE +


R2 Rbe$Q1 RE + R1 RC RE + R2 RC RE + R1 R2 Ro$Q1 + R1 Rbe$Q1 Ro$Q1 +
R2 Rbe$Q1 Ro$Q1 + R1 RE Ro$Q1 + beta$Q1 R1 RE Ro$Q1 +
R2 RE Ro$Q1 + beta$Q1 R2 RE Ro$Q1 + C1 R1 R2 Rbe$Q1 RC s +
Cbc$Q1 R1 R2 Rbe$Q1 RC s + Cbe$Q1 R1 R2 Rbe$Q1 RC s +
C1 R1 R2 Rbe$Q1 RE s + †94‡ + C2 Cbe$Q1 R2 Rbe$Q1 RE RL Ro$Q1 s2 +
C2 Cbc$Q1 R1 RC RE RL Ro$Q1 s2 + beta$Q1 C2 Cbc$Q1 R1 RC RE RL
Ro$Q1 s2 + C2 Cbc$Q1 R2 RC RE RL Ro$Q1 s2 + beta$Q1 C2 Cbc$Q1
R2 RC RE RL Ro$Q1 s2 + C1 C2 Cbc$Q1 R1 R2 Rbe$Q1 RC RE RL s3 +
C1 C2 Cbe$Q1 R1 R2 Rbe$Q1 RC RE RL s3 + C1 C2 Cbe$Q1 R1 R2 Rbe$Q1
RC RE Ro$Q1 s3 + C1 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE Ro$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE Ro$Q1 s3 +
C1 C2 Cbc$Q1 R1 R2 Rbe$Q1 RC RL Ro$Q1 s3 + C2 Cbc$Q1 Cbe$Q1 R1 R2
Rbe$Q1 RC RL Ro$Q1 s3 + C1 C2 Cbe$Q1 R1 R2 Rbe$Q1 RE RL Ro$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RE RL Ro$Q1 s3 +
C1 C2 Cbc$Q1 R1 R2 RC RE RL Ro$Q1 s3 + beta$Q1 C1 C2 Cbc$Q1 R1 R2
RC RE RL Ro$Q1 s3 + C2 Cbc$Q1 Cbe$Q1 R1 Rbe$Q1 RC RE RL Ro$Q1 s3 +

C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE RL Ro$Q1 s4 L


C2 Cbc$Q1 Cbe$Q1 R2 Rbe$Q1 RC RE RL Ro$Q1 s3 +

Here, the complexity estimate is identical to the true number of terms in the denominator of the
symbolic transfer function. In the general case, the estimate yields a lower bound for this number.
Determine number of In[8]:= Length[Denominator[v5]]
terms in the denominator Out[8]= 132
of the transfer function.

3.11.2 ApproximateTransferFunction

ApproximateTransferFunction[expr, fvar, dp, error]


approximates the transfer function expr by discarding
insignificant terms where fvar, dp, and error denote the
complex frequency variable, the design point, and the
bound for the coefficient error

Command structure of ApproximateTransferFunction .

ApproximateTransferFunction approximates a symbolic transfer function by discarding insignificant


terms from its coefficients (simplification after generation, SAG). The significance or insignificance of
a term is evaluated on the basis of numerical reference values for the symbols (the design point). For
each coefficient, the algorithm removes the numerically least significant terms until the maximum
coefficient error is reached.
390 3. Reference Manual

The fourth argument of ApproximateTransferFunction denotes the maximum coefficient


error. It does not constitute a bound on the absolute error of a transfer function. The
absolute error may be larger or lower than the maximum coefficient error.

See also: ApproximateMatrixEquation (Section 3.11.3).

Examples
Below, we approximate the transfer function of the common-emitter amplifier. We allow for a
maximum error of 20% in all coefficients of powers of the complex frequency s.
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define an AC model for In[2]:= Circuit[


BJTs. Model[
Name −> BJT,
Selector −> AC,
Scope −> Global,
Ports −> {B, C, E},
Parameters −> {Rbe, Cbc, Cbe, beta, Ro,
RBE, CBC, CBE, BETA, RO},
Definition −> Netlist[
{CBE, {B, E}, Symbolic −> Cbe, Value −> CBE},
{RBE, {X, E}, Symbolic −> Rbe, Value −> RBE},
{CBC, {B, C}, Symbolic −> Cbc, Value −> CBC},
{CC, {B, X, C, E},
Symbolic −> beta, Value −> BETA},
{RO, {C, E}, Symbolic −> Ro, Value −> RO}
]
]
] // ExpandSubcircuits;

This netlist describes a In[3]:= ceamplifier =


common-emitter amplifier. Circuit[
Netlist[
{V1, {1, 0}, 1},
{V0, {6, 0}, 0},
{C1, {1, 2}, Symbolic −> C1, Value −> 1.0*^−7},
{R1, {2, 6}, Symbolic −> R1, Value −> 1.0*^5},
{R2, {2, 0}, Symbolic −> R2, Value −> 47000.},
{RC, {6, 3}, Symbolic −> RC, Value −> 2200.},
{RE, {4, 0}, Symbolic −> RE, Value −> 1000.},
{C2, {3, 5}, Symbolic −> C2, Value −> 1.0*^−6},
{RL, {5, 0}, Symbolic −> RL, Value −> 47000.},
{Q1, {2 −> B, 3 −> C, 4 −> E},
Model −> BJT, Selector −> AC,
CBE −> 30.*^−12, CBC −> 5.*^−12, RBE −> 1000.,
RO −> 10000., BETA −> 200.}
]
]
Out[3]= … Circuit …
3.11 Linear Simplification Techniques 391

Set up a system of In[4]:= eqs = CircuitEquations[ceamplifier,


symbolic AC equations. ElementValues −> Symbolic]
Out[4]= … DAE@AC, †10 ´ 10‡D …

Compute the complexity In[5]:= ComplexityEstimate[eqs]


estimate. Out[5]= 132

Compute the voltage In[6]:= solution = Solve[eqs, V$5];


transfer function v5 = Together[V$5 /. First[solution]]
symbolically and extract
HC2 R1 R2 RC RL s HC1 RE s - beta$Q1 C1 Ro$Q1 s + C1 Cbc$Q1 Rbe$Q1 RE s2 +
the result from the Out[7]=
solution vector.
C1 Cbe$Q1 Rbe$Q1 RE s2 + C1 Cbc$Q1 Rbe$Q1 Ro$Q1 s2 +

C1 Cbc$Q1 Cbe$Q1 Rbe$Q1 RE Ro$Q1 s3 LL 


C1 Cbc$Q1 RE Ro$Q1 s2 + beta$Q1 C1 Cbc$Q1 RE Ro$Q1 s2 +

HR1 R2 RC + R1 Rbe$Q1 RC + R2 Rbe$Q1 RC + R1 R2 RE + R1 Rbe$Q1 RE +


R2 Rbe$Q1 RE + R1 RC RE + R2 RC RE + R1 R2 Ro$Q1 + R1 Rbe$Q1 Ro$Q1 +
R2 Rbe$Q1 Ro$Q1 + R1 RE Ro$Q1 + beta$Q1 R1 RE Ro$Q1 +
R2 RE Ro$Q1 + beta$Q1 R2 RE Ro$Q1 + C1 R1 R2 Rbe$Q1 RC s +
Cbc$Q1 R1 R2 Rbe$Q1 RC s + Cbe$Q1 R1 R2 Rbe$Q1 RC s +
C1 R1 R2 Rbe$Q1 RE s + †94‡ + C2 Cbe$Q1 R2 Rbe$Q1 RE RL Ro$Q1 s2 +
C2 Cbc$Q1 R1 RC RE RL Ro$Q1 s2 + beta$Q1 C2 Cbc$Q1 R1 RC RE RL
Ro$Q1 s2 + C2 Cbc$Q1 R2 RC RE RL Ro$Q1 s2 + beta$Q1 C2 Cbc$Q1
R2 RC RE RL Ro$Q1 s2 + C1 C2 Cbc$Q1 R1 R2 Rbe$Q1 RC RE RL s3 +
C1 C2 Cbe$Q1 R1 R2 Rbe$Q1 RC RE RL s3 + C1 C2 Cbe$Q1 R1 R2 Rbe$Q1
RC RE Ro$Q1 s3 + C1 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE Ro$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE Ro$Q1 s3 +
C1 C2 Cbc$Q1 R1 R2 Rbe$Q1 RC RL Ro$Q1 s3 + C2 Cbc$Q1 Cbe$Q1 R1 R2
Rbe$Q1 RC RL Ro$Q1 s3 + C1 C2 Cbe$Q1 R1 R2 Rbe$Q1 RE RL Ro$Q1 s3 +
C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RE RL Ro$Q1 s3 +
C1 C2 Cbc$Q1 R1 R2 RC RE RL Ro$Q1 s3 + beta$Q1 C1 C2 Cbc$Q1 R1 R2
RC RE RL Ro$Q1 s3 + C2 Cbc$Q1 Cbe$Q1 R1 Rbe$Q1 RC RE RL Ro$Q1 s3 +

C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE RL Ro$Q1 s4 L


C2 Cbc$Q1 Cbe$Q1 R2 Rbe$Q1 RC RE RL Ro$Q1 s3 +

Get the design-point In[8]:= dp = GetDesignPoint[eqs]

8C1 ® 1. ´ 10-7 , R1 ® 100000., R2 ® 47000., RC ® 2200.,


information from the
Out[8]=
DAEObject.
RE ® 1000., C2 ® 1. ´ 10-6 , RL ® 47000., Cbe$Q1 ® 3. ´ 10-11 ,
Rbe$Q1 ® 1000., Cbc$Q1 ® 5. ´ 10-12 , beta$Q1 ® 200., Ro$Q1 ® 10000.<

Discard insignificant terms In[9]:= sag = ApproximateTransferFunction[v5, s, dp, 0.2]

H-beta$Q1 C1 C2 R1 R2 RC RL Ro$Q1 s2 +
in the transfer function.
Out[9]=

C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE RL Ro$Q1 s4 L  HR1 R2 Ro$Q1 +


beta$Q1 C1 C2 Cbc$Q1 R1 R2 RC RE RL Ro$Q1 s3 +

beta$Q1 R1 RE Ro$Q1 + beta$Q1 R2 RE Ro$Q1 + HC2 R1 R2 RL Ro$Q1 +


beta$Q1 C2 R1 RE RL Ro$Q1 + beta$Q1 C2 R2 RE RL Ro$Q1L s +

RL Ro$Q1 s3 + C1 C2 Cbc$Q1 Cbe$Q1 R1 R2 Rbe$Q1 RC RE RL Ro$Q1 s4 L


beta$Q1 C1 C2 R1 R2 RE RL Ro$Q1 s2 + beta$Q1 C1 C2 Cbc$Q1 R1 R2 RC RE

Determine the complexity In[10]:= Length[Denominator[sag]]


of the approximated Out[10]= 7
expression.
392 3. Reference Manual

Simplify the result. In[11]:= Simplify[sag]

HC1 C2 R1 R2 RC RL s2
Out[11]=

HCbc$Q1 Cbe$Q1 Rbe$Q1 RE s2 + beta$Q1 H-1 + Cbc$Q1 RE sLLL 


Hbeta$Q1 R2 RE H1 + C2 RL sL + R1 Hbeta$Q1 RE H1 + C2 RL sL +
R2 H1 + C2 RL s H1 + C1 Cbc$Q1 Cbe$Q1 Rbe$Q1 RC RE s3 +
beta$Q1 C1 RE s H1 + Cbc$Q1 RC sLLLLL

To validate the result, we compute the frequency response of the original system numerically and
compare it graphically with the approximated result.
Compute the frequency In[12]:= acsweep = ACAnalysis[eqs, V$5, {f, 1, 1.0*^9}]
response numerically.
88V$5 ® InterpolatingFunction@881., 1. ´ 109 <<, <>D<<
Out[12]=

Evaluate the approximated In[13]:= sagn[s_] = sag /. dp


expression numerically.
I-9.7196 ´ 1010 s2 + 485.98 s3 + 7.2897 ´ 10-8 s4 M ‘ I3.41 ´ 1014 +
Out[13]=

1.6027 ´ 1013 s + 4.418 ´ 1010 s2 + 485.98 s3 + 7.2897 ´ 10-8 s4 M

Plot the exact and In[14]:= BodePlot[acsweep, {V$5[f], sagn[2 Pi I f]},


approximated functions {f, 1, 1.0*^9}, TraceNames −> {"Exact", "Approximated"}]
together.
Magnitude (dB)

5
2.5
0
-2.5
-5
-7.5
-10
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
Phase (deg)

-50
-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Exact Approximated

Out[14]= … Graphics …

3.11.3 ApproximateMatrixEquation

ApproximateMatrixEquation[dae, var, errspec]


approximates a symbolic matrix equation dae with respect
to the output variable var and the error specification errspec

Command structure of ApproximateMatrixEquation .


3.11 Linear Simplification Techniques 393

The function ApproximateMatrixEquation approximates a linear symbolic matrix equation by


discarding insignificant matrix entries before the system is solved (simplification before generation,
SBG). The significance of a symbolic matrix entry is determined by calculating its numerical influence
on the magnitude of the transfer function in one or several frequency sampling points. The
approximation process follows a term ranking obtained by computing the large-change sensitivities of
the output variable with respect to all matrix entries and sorting the resulting list by least influence.
The algorithm deletes all matrix entries whose cumulative influence is less than the user-specified
error bound. The error specification errspec has to be given in the following form:

{fvar−>freq, MaxError−>maxerr} error specification for a single frequency sampling point


{{fvar−>freq1 , MaxError−>maxerr 1 }, {fvar−>freq2 , MaxError−>maxerr 2 }, † † † }
error specification for several frequency sampling points

Format for sampling point and error specifications.

For a given errspec, the algorithm assures that the relative magnitude deviation of the output
variable var measured at the frequency points fvar = freqi is less than maxerri .

To approximate the frequency response of a dynamic circuit, sampling points must be


placed on the imaginary axis where s = jΩ, or equivalently s = 2Πj f . Therefore, you should
specify frequency sampling points in the form s −> 2. Pi I f.
By placing sampling points to the left and right of a corner in a frequency response, you can
use ApproximateMatrixEquation to extract poles and zeros symbolically.
For optimal approximation results, you should set up circuit equations in Sparse Tableau
formulation (Formulation −> SparseTableau , see Section 3.5.1).

ApproximateMatrixEquation has the following options:


394 3. Reference Manual

option name default value

AbsolutePivotThreshold
1.0*10^−8 the absolute pivot threshold for the sparse
matrix solver used in the MathLink binary
MSBG.exe
CompressEquations False whether to compress the matrix equation
after approximation
DesignPoint Automatic the numerical reference data for the symbols
NumericalAccuracy 1.0*10^−8 the numerical accuracy threshold for
ranking recomputations
PivotThreshold 0.01 the relative pivot threshold for the sparse
matrix solver used in the MathLink binary
MSBG.exe
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Options for ApproximateMatrixEquation , Part I.

option name default value

QuasiSingularity 1.0*10^−15 threshold for detecting numerical


singularities
RecomputationThreshold
2.0 threshold for triggering a ranking
recomputation
SortingMethod PrimaryDesignPoint
how to sort the list of matrix entry
influences to obtain a term ranking
StripIndependentBlocks
False whether to search for and discard
algebraically independent blocks from a
matrix equation after approximation
UseExternals Inherited[AnalogInsydes]
whether to use the MathLink binary
MSBG.exe (see Section 3.14.7)

Options for ApproximateMatrixEquation , Part II.


3.11 Linear Simplification Techniques 395

See also: ApproximateTransferFunction (Section 3.11.2).

Options Description
A detailed description of all ApproximateMatrixEquation options is given below in alphabetical
order:

AbsolutePivotThreshold
With AbsolutePivotThreshold −> posreal you can specify the minimum absolute value a matrix
entry must have to be considered as a pivot candidate during LU decomposition. There is no
need to change the value of this option unless ApproximateMatrixEquation reports problems with
ill-conditioned equations.

CompressEquations
The setting
CompressEquations −> True causes the matrix equation to be compressed after approximation. The
option is realized by an internal call of the function CompressMatrixEquation (Section 3.11.4). You
should turn matrix compression on whenever you are working with large matrices, i.e. when the
matrix dimensions are significantly larger than 10 ‰ 10.

DesignPoint
With DesignPoint −> {symbol1 −> value1 , † † † } you can overwrite the design point given in the
DAEObject. The default setting is DesignPoint −> Automatic , which means to use the design
point stored in the DAEObject.

NumericalAccuracy
The option NumericalAccuracy −> posreal specifies the minimum influence a matrix entry must have
to trigger a recomputation of the term ranking. This threshold is used to prevent frequent ranking
recomputations due to numerical inaccuracies in very small influence values.
If the ranking is recomputed too often at the beginning of the approximation process, you should
increase the value of NumericalAccuracy by an order of magnitude. Note that information about
ranking recomputations is available only if UseExternals −> False and Protocol −> Notebook.
See also the description of RecomputationThreshold .

PivotThreshold
With PivotThreshold −> posreal you can specify the minimum relative magnitude a matrix entry
must have to be considered as a pivot candidate during LU decomposition. The value posreal must
396 3. Reference Manual

be a number between 0 and 1. If it is 1, then the pivoting method becomes complete pivoting,
which is very slow and tends to fill up the matrix. If it is set close to zero, the pivoting method
becomes strict Markowitz with no threshold. There is no need to change the value of this option
unless ApproximateMatrixEquation reports problems with ill-conditioned equations.

Protocol
This option describes the standard Analog Insydes protocol specification (see Section 3.14.5). Note
that detailed protocol information is not available if UseExternals −> True.

QuasiSingularity
QuasiSingularity −> posreal specifies a threshold value for determining whether a matrix is
numerically singular. In case the matrix approximation function returns a singular matrix, increase
the value of QuasiSingularity by one or several orders of magnitude.

RecomputationThreshold
RecomputationThreshold −> posreal specifies a factor for determining whether the current term
ranking should be recomputed. For example, a value of 2 means that a ranking recomputation is
triggered if the true influence of a matrix entry at the current approximation step turns out to be two
times larger than predicted initially. Ranking recomputations are triggered only by influence values
greater than the value of NumericalAccuracy .

SortingMethod
The option SortingMethod specifies how the list of matrix entry influences is sorted to obtain a term
ranking.

PrimaryDesignPoint sort matrix entries by least influence on the primary


design-point solution
LeastMeanInfluence sort matrix entries by mean influence on all design-point
solutions

Values for the SortingMethod option.

With the default setting SortingMethod −> PrimaryDesignPoint , the influence list is sorted by
influence on the solution of the matrix equation at the first sampling point specified in errspec. The
setting SortingMethod −> LeastMeanInfluence causes the least to be sorted by average influence
on the solutions at all sampling points.
3.11 Linear Simplification Techniques 397

The setting of the SortingMethod option is relevant only if you specify more than one sampling
point. In general, SortingMethod −> LeastMeanInfluence is the preferred setting for multiple
sampling points.

StripIndependentBlocks
With StripIndependentBlocks −> True, clusters of equations which are decoupled from the variable
of interest, are searched for and discarded after approximation. This option is effective only in
conjunction with the setting CompressEquations −> True.

UseExternals
The setting UseExternals −> True causes the MathLink application MSBG.exe to be used for matrix
approximation. This is the recommended setting for all platforms for which native Analog Insydes
versions exist. You can set UseExternals −> False to run Analog Insydes on other platforms or
for debugging purposes in conjunction with the option Protocol . Alternatively, you can also load
and unload the module manually as described in Section 3.13.3. For more information refer to
UseExternals (Section 3.14.7).

Examples
In the following we approximate the system of nodal equations representing the small-signal
equivalent circuit of the common-emitter amplifier with respect to the output variable V$5. To
obtain an approximation of the amplifier’s passband voltage gain, we select a sampling frequency
of 10 kHz. At the sampling point we allow the magnitude of the solution of the approximated
equations to deviate from the original design-point value by 10%.
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define an AC model for In[2]:= Circuit[


BJTs. Model[
Name −> BJT,
Selector −> AC,
Scope −> Global,
Ports −> {B, C, E},
Parameters −> {Rbe, Cbc, Cbe, beta, Ro,
RBE, CBC, CBE, BETA, RO},
Definition −> Netlist[
{CBE, {B, E}, Symbolic −> Cbe, Value −> CBE},
{RBE, {X, E}, Symbolic −> Rbe, Value −> RBE},
{CBC, {B, C}, Symbolic −> Cbc, Value −> CBC},
{CC, {B, X, C, E},
Symbolic −> beta, Value −> BETA},
{RO, {C, E}, Symbolic −> Ro, Value −> RO}
]
]
] // ExpandSubcircuits;
398 3. Reference Manual

This netlist describes a In[3]:= ceamplifier =


common-emitter amplifier. Circuit[
Netlist[
{V1, {1, 0}, 1},
{V0, {6, 0}, 0},
{C1, {1, 2}, Symbolic −> C1, Value −> 1.0*^−7},
{R1, {2, 6}, Symbolic −> R1, Value −> 1.0*^5},
{R2, {2, 0}, Symbolic −> R2, Value −> 47000.},
{RC, {6, 3}, Symbolic −> RC, Value −> 2200.},
{RE, {4, 0}, Symbolic −> RE, Value −> 1000.},
{C2, {3, 5}, Symbolic −> C2, Value −> 1.0*^−6},
{RL, {5, 0}, Symbolic −> RL, Value −> 47000.},
{Q1, {2 −> B, 3 −> C, 4 −> E},
Model −> BJT, Selector −> AC,
CBE −> 30.*^−12, CBC −> 5.*^−12, RBE −> 1000.,
RO −> 10000., BETA −> 200.}
]
]
Out[3]= … Circuit …

Set up a system of In[4]:= eqs = CircuitEquations[ceamplifier,


symbolic AC equations. ElementValues −> Symbolic]
Out[4]= … DAE@AC, †10 ´ 10‡D …

Compute the complexity In[5]:= ComplexityEstimate[eqs]


estimate. Out[5]= 132

Allow for 10% magnitude


Out[6]= 8s ® 62831.9 ä, MaxError ® 0.1<
In[6]:= errspec = {s −> 2. Pi I 10^4, MaxError −> 0.1}
error at 10 kHz.

Approximate the system of In[7]:= sbg = ApproximateMatrixEquation[eqs, V$5, errspec]


circuit equations. Out[7]= … DAE@AC, †10 ´ 10‡D …

Estimate the number of In[8]:= ComplexityEstimate[sbg]


terms after approximation. Out[8]= 1

Compute the solution of In[9]:= sbgresult = Solve[sbg, V$5]

Out[9]= 99V$5 ® - €€€€€€€ ==


the approximated RC
equations. RE

To validate the result, we compute the frequency response of the original system numerically and
compare it graphically with the approximated result.
Compute the frequency In[10]:= acsweep = ACAnalysis[eqs, V$5, {f, 1, 1.0*^9}]
response numerically.
88V$5 ® InterpolatingFunction@881., 1. ´ 109 <<, <>D<<
Out[10]=

Evaluate the approximated In[11]:= sbgn = V$5 /. First[sbgresult] /. GetDesignPoint[eqs]


expression numerically. Out[11]= -2.2

Note that the approximated expression is valid only within the passband because we did not specify
sampling points at low or high frequencies.
3.11 Linear Simplification Techniques 399

Plot the exact and In[12]:= BodePlot[acsweep, {V$5[f], sbgn},


approximated functions {f, 1, 1.0*^9}, TraceNames −> {"Exact", "Approximated"}]
together.

Magnitude (dB)
10
5
0
-5
-10
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
Phase (deg)

-50
-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Exact Approximated

Out[12]= … Graphics …

Below, we specify a second sampling point at 1 Hz to extend the validity region of the approximation
to low frequencies. Note that you may use a different error bound for each sampling point.
Add a second sampling In[13]:= errspec2 = {errspec, {s −> 2. Pi I, MaxError −> 0.3}}

88s ® 62831.9 ä, MaxError ® 0.1<, 8s ® 6.28319 ä, MaxError ® 0.3<<


point at 1 Hz.
Out[13]=

Approximate the matrix In[14]:= sbg2 = ApproximateMatrixEquation[eqs, V$5, errspec2,


equation. SortingMethod −> LeastMeanInfluence]
Out[14]= … DAE@AC, †10 ´ 10‡D …

Estimate the number of In[15]:= ComplexityEstimate[sbg2]


terms after approximation. Out[15]= 9

Solve the approximated In[16]:= sbgresult2 = Solve[sbg2, V$5] // Simplify


equations.

99V$5 ® - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€ ==


Out[16]=

RE HR1 + R2 + C1 R1 R2 sL H1 + C2 HRC + RLL sL


C1 C2 R1 R2 RC RL s2
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€

Extract the solution for In[17]:= v52 = V$5 /. First[sbgresult2]


V$5.
RE HR1 + R2 + C1 R1 R2 sL H1 + C2 HRC + RLL sL
C1 C2 R1 R2 RC RL s2
Out[17]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€

Evaluate the approximated In[18]:= sbgn2[s_] = v52 /. GetDesignPoint[eqs]


expression numerically.
H1 + 0.0492 sL H147000. + 470. sL
48.598 s2
Out[18]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€€
400 3. Reference Manual

Plot the exact and In[19]:= BodePlot[acsweep, {V$5[f], sbgn2[2. Pi I f]},


approximated functions {f, 1, 1.0*^9}, TraceNames −> {"Exact", "Approximated"}]
together.

Magnitude (dB)
5
2.5
0
-2.5
-5
-7.5
-10
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

0
Phase (deg)

-50
-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency

Exact Approximated

Out[19]= … Graphics …

Note that matrix approximation has reduced the polynomial order of the transfer function from four
to two. Therefore, we can now solve the transfer function for the low-frequency poles.
Solve for the In[20]:= Solve[Denominator[v52] == 0, s]

Out[20]= 99s ® €€€€€€€€€€€€€€€€


€€€€€ =, 9s ® - €€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€ ==
C2 HRC + RLL
low-frequency poles. -R1 - R2 1
C1 R1 R2

3.11.4 CompressMatrixEquation

CompressMatrixEquation[dae, var]
compresses the matrix equation dae with respect to the
variable of interest var

Command structure of CompressMatrixEquation .

Computing a transfer function from a linear system of circuit equations A × x = b requires solving
the matrix equation for one single variable xk . The values of all other variables xj , j ¹ k, are of
no interest in this context. Systems of circuit equations usually contain a significant amount of
information which is only needed to determine the irrelevant variables, and the proportion of such
information increases during the approximation process as equations are algebraically decoupled by
removing negligible terms.
To reduce the computational effort needed for solving an approximated matrix, all unnecessary
information should be discarded from the equations prior to calling Solve (Section 3.5.4), using the
function CompressMatrixEquation . This function performs a recursive search on a matrix equation
to find and delete all rows and columns which are not needed to compute the variable of interest.
Note that compressing a matrix equation is a mathematically exact operation which does not change
the value of the output variable.
3.11 Linear Simplification Techniques 401

CompressMatrixEquation has the following option:

option name default value

StripIndependentBlocks
False whether to search for and discard
algebraically independent blocks which are
decoupled from the variable of interest

Option for CompressMatrixEquation .

See also: CompressNonlinearEquations (Section 3.12.2),


ApproximateMatrixEquation (Section 3.11.3).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define an AC model for In[2]:= Circuit[


BJTs. Model[
Name −> BJT,
Selector −> AC,
Scope −> Global,
Ports −> {B, C, E},
Parameters −> {Rbe, Cbc, Cbe, beta, Ro,
RBE, CBC, CBE, BETA, RO},
Definition −> Netlist[
{CBE, {B, E}, Symbolic −> Cbe, Value −> CBE},
{RBE, {X, E}, Symbolic −> Rbe, Value −> RBE},
{CBC, {B, C}, Symbolic −> Cbc, Value −> CBC},
{CC, {B, X, C, E},
Symbolic −> beta, Value −> BETA},
{RO, {C, E}, Symbolic −> Ro, Value −> RO}
]
]
] // ExpandSubcircuits;
402 3. Reference Manual

This netlist describes a In[3]:= ceamplifier =


common-emitter amplifier. Circuit[
Netlist[
{V1, {1, 0}, 1},
{V0, {6, 0}, 0},
{C1, {1, 2}, Symbolic −> C1, Value −> 1.0*^−7},
{R1, {2, 6}, Symbolic −> R1, Value −> 1.0*^5},
{R2, {2, 0}, Symbolic −> R2, Value −> 47000.},
{RC, {6, 3}, Symbolic −> RC, Value −> 2200.},
{RE, {4, 0}, Symbolic −> RE, Value −> 1000.},
{C2, {3, 5}, Symbolic −> C2, Value −> 1.0*^−6},
{RL, {5, 0}, Symbolic −> RL, Value −> 47000.},
{Q1, {2 −> B, 3 −> C, 4 −> E},
Model −> BJT, Selector −> AC,
CBE −> 30.*^−12, CBC −> 5.*^−12, RBE −> 1000.,
RO −> 10000., BETA −> 200.}
]
]
Out[3]= … Circuit …

Set up a system of In[4]:= eqs = CircuitEquations[ceamplifier,


symbolic AC equations. ElementValues −> Symbolic]
Out[4]= … DAE@AC, †10 ´ 10‡D …

Approximate the system of In[5]:= sbg = ApproximateMatrixEquation[eqs, V$5,


circuit equations. {s −> 2. Pi I 10^4, MaxError −> 0.1}]
Out[5]= … DAE@AC, †10 ´ 10‡D …

Inspect the list of In[6]:= GetVariables[sbg]

8V$1, V$2, V$3, V$4, V$5, V$6, V$X$Q1, I$V1, I$V0, IC$CC$Q1<
unknowns in the matrix
Out[6]=
equation.

Solve the equations for In[7]:= Solve[sbg, V$5]

Out[7]= 99V$5 ® - €€€€€€€ ==


V$5. RC
RE

Discard rows and columns In[8]:= cmat = CompressMatrixEquation[sbg, V$5]


which are not needed to Out[8]= … DAE@AC, †7 ´ 7‡D …
compute V$5.

Out[9]= 8V$1, V$2, V$3, V$4, V$5, V$X$Q1, IC$CC$Q1<


Inspect the list of In[9]:= GetVariables[cmat]
remaining unknowns.

Note that matrix compression does not change the solution of the equations.
Solve the compressed In[10]:= Solve[cmat, V$5]

Out[10]= 99V$5 ® - €€€€€€€ ==


equations for V$5. RC
RE
3.12 Nonlinear Simplification Techniques 403

3.12 Nonlinear Simplification Techniques


As of version 2, Analog Insydes provides completely new functionality for the simplification of
nonlinear circuits: Besides the main functions CompressNonlinearEquations and CancelTerms ,
there are a number of supporting procedures. The following table shows all commands which build
the simplification functionality for nonlinear circuits:

NonlinearSetup (Section 3.12.1) setting up the nonlinear approximation procedure


CompressNonlinearEquations (Section 3.12.2)
eliminating variables in a DAEObject
CancelTerms (Section 3.12.3) removing terms in different levels in a DAEObject
SimplifySamplePoints (Section 3.12.4)
generating sparsed sample-point grids
NonlinearSettings (Section 3.12.5)
showing nonlinear settings in a DAEObject
ShowLevel (Section 3.12.6) showing terms of a DAEObject in different levels
ShowCancellations (Section 3.12.7)
showing terms of a DAEObject which have been removed

3.12.1 NonlinearSetup

NonlinearSetup[dae, inputs, outputs, mode1 −>{settings1 }, † † † ]


initializes the nonlinear approximation routines

Command structure of NonlinearSetup .

Before applying the nonlinear simplification routines the DAEObject has to be set up using
NonlinearSetup . This function returns a DAEObject containing additional information which is
automatically used later on by the simplification functions. Furthermore, NonlinearSetup performs
the numerical reference simulations which are used for error calculation. Besides the input and output
variables you have to specify which analysis modes to consider during subsequent simplifications.
The DAEObject dae has to be a DC or Transient DAEObject. The argument inputs is a symbol or
a list of symbols denoting the input parameters to be swept. In this context input parameters are
parameters of the DAEObject (not variables). Use GetParameters (Section 3.6.9) to obtain a list of
valid parameters. Further, outputs is a symbol or a list of symbols denoting the output variables
which are used for error control. In this context output variables are variables of the DAEObject (not
parameters). Use GetVariables (Section 3.6.7) to obtain a list of valid variables.
404 3. Reference Manual

The rules modei −> {settingsi } specify the analysis modes to be used during error control and some
mode-specific settings for the simplification routines. Here, modei can be DT (DC-transfer analysis) or
AC. If the AC analysis is chosen, DT settings have to be specified, too. The mode settings settings i
are given by a sequence of rules. The format is described below.
Additionally, NonlinearSetup provides the following option:

option name default value

Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)

Options for NonlinearSetup .

You can use


NonlinearSettings (Section 3.12.5) to inspect the settings of the nonlinear simplifications currently
stored in a DAEObject. Use GetDAEOptions[dae, NonlinearOptions] to get a list of all nonlinear
simplification settings stored in the DAEObject.
See also: GetVariables (Section 3.6.7), GetParameters (Section 3.6.9),
NonlinearSettings (Section 3.12.5), Section 3.7.2.

DT mode specifications

Range−>paramsweep parameter sweep specification for all input variables


SimulationFunction−>simfct simulation function used for DT analysis; default value:
DefaultDTSimulation
ErrorFunction−>errfct error function used for DT analysis; default value:
DefaultDTError
MaxError−>errlist Maximum error specification for the output variables;
default value: {}

Settings for DT mode.

The range in which to sweep the input parameters during simplification is specified by the paramsweep
value of the Range option. The range specification has to be given in the standard format for Analog
Insydes parameter sweeps which is described in Section 3.7.2. Note that you have to specify a range
for each input parameter.
SimulationFunction , ErrorFunction , and MaxError are optional, whereas Range is a required
argument.
3.12 Nonlinear Simplification Techniques 405

If no SimulationFunction option is specified, the default function is used. The default DT


simulation function DefaultDTSimulation calls NDAESolve (Section 3.7.5) to calculate the DC
operating points. DefaultDTSimulation inherits almost all options from NDAESolve . The following
options have a special meaning when used with DefaultDTSimulation :

option name default value

MaxIterations Inherited[NDAESolve]
maximum number of iterations for
NDAESolve (only used if option
InitialGuess is set to Automatic )
InitialGuess None if set to Automatic , the values of the
reference simulation are used as initial
guess for NDAESolve

Options for DefaultDTSimulation .

Besides the default simulation function you can define your own DT simulation function and specify
it as SimulationFunction in the DT mode settings for NonlinearSetup . During the setup and the
nonlinear simplifications this function will be called with the following arguments:

simfct[dae_, refsim_List:{}, opts___]

Pattern for a user-defined DT simulation function.

Here, dae is a DC or Transient DAEObject, refsim is the list of numerical reference values and opts
are additional options.
The simulation function must return the DC operating points in the same format as NDAESolve
returns DC operating points of a parameter sweep (see Section 3.7.2).
Similarly, you can define your own DT error function instead of the default error function and
specify it as ErrorFunction in the DT mode settings for NonlinearSetup . During the simplification
routines this function is used to calculate the error with the following arguments:

errfct[newval_List, oldval_List, outputsymbols_List]

Pattern for a user-defined DT error function.

Here, newval and oldval are the numerical solutions of the simplified and the original DAE system,
outputsymbols is a list of all output symbols.
The error function must return a list of rules {symb1 −> err1 , † † † }, which specifies the numerical error
for each output symbol. The default DT error function calculates the maximum absolute error.
406 3. Reference Manual

An example for a user-defined simulation and error function and of the corresponding call to
NonlinearSetup is given in the example section below.
Instead of specifying the maximum allowed error for output variables for each call to the nonlinear
simplifications routines separately, you can specify global maximum errors for output variables using
the MaxError argument. These values are used if no error value is given in the call to the nonlinear
simplification routine. The value of this argument has to be a list of rules of the form outvar −> error.

AC mode specifications

Range−>{paramsweep, freqlist, sourceval}


paramsweep must be a subset of the sweep given in the DT
settings, freqlist is a list of frequency points and sourceval is
a list of replacement rules for all AC sources
SimulationFunction−>simfct simulation function used for AC analysis; default value:
DefaultACSimulation
ErrorFunction−>errfct error function used for AC analysis; default value:
DefaultACError
MaxError−>errlist Maximum error specification for the output variables;
default value: {}

Settings for AC mode.

SimulationFunction , ErrorFunction , and MaxError are optional, whereas Range is a required


argument.
If you specifiy AC settings you have to specify DT settings, too. The parameter sweep settings
paramsweep must be a subset of the parameter sweep given in the DT settings.
The default AC simulation function is called DefaultACSimulation . This function calls ACAnalysis
(Section 3.7.3) to perform the numerical calculation. DefaultACSimulation inherits almost all options
from ACAnalysis .
Besides the default simulation function you can define your own AC simulation function and specify
it as SimulationFunction in the AC mode settings for NonlinearSetup . During the setup and the
nonlinear simplifications this function will be called with the following arguments:

simfct[dae_, refsim_List:{}, opts___]

Pattern for a user-defined AC simulation function.

Here, dae is a Transient DAEObject, refsim is the list of numerical reference values and opts are
additional options.
3.12 Nonlinear Simplification Techniques 407

The simulation function must return a list of the AC solutions in the same format as ACAnalysis
returns the result (with the option setting InterpolateResult −> False).
Similarly, you can define your own AC error function instead of the default error function and
specify it as ErrorFunction in the AC mode settings for NonlinearSetup . During the simplification
routines this function is used to calculate the error with the following arguments:

errfct[newval_List, oldval_List, outputsymbols_List]

Pattern for a user-defined AC error function.

Here, newval and oldval are the numerical solutions of the simplified and the original dae system,
outputsymbols is a list of all output symbols.
The error function must return a list of rules {symb1 −> err1 , † † † } which specifies the numerical error
for each output symbol. The default AC error function calculates the maximum relative error.
Instead of specifying the maximum allowed error for output variables for each call to the nonlinear
simplifications routines separately, you can specify global maximum errors for output variables using
the MaxError argument. These values are used if no error value is given in the call to the nonlinear
simplification routine. The value of this argument has to be a list of rules of the form outvar −> error.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read PSpice netlist. In[2]:= net = ReadNetlist["AnalogInsydes/DemoFiles/Sqrt.cir",


Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[net,


AnalysisMode −> DC, ElementValues −> Symbolic]
Out[3]= … DAE@DC, †27 ´ 27‡D …

Get all valid symbols that In[4]:= GetParameters[dae]

8AREA$Q1, AREA$Q2, AREA$Q3, AREA$Q4, BF$Q1, BF$Q2,


can be used as inputs for
Out[4]=
NonlinearSetup .
BF$Q3, BF$Q4, BR$Q1, BR$Q2, BR$Q3, BR$Q4, GMIN, IB, II,
IS$Q1, IS$Q2, IS$Q3, IS$Q4, TEMP, TNOM, VDC, VLOAD, $k, $q<

Get all valid symbols that In[5]:= GetVariables[dae]

8V$1, V$3, V$4, V$5, V$OUT, I$BS$Q1, I$CS$Q1,


can be used as outputs for
Out[5]=
NonlinearSetup .
I$ES$Q1, ib$Q1, ic$Q1, I$BS$Q2, I$CS$Q2, I$ES$Q2,
ib$Q2, ic$Q2, I$BS$Q3, I$CS$Q3, I$ES$Q3, ib$Q3, ic$Q3,
I$BS$Q4, I$CS$Q4, I$ES$Q4, ib$Q4, ic$Q4, I$VLOAD, I$VDC<

In the following we choose VLOAD and II as inputs and V$5 and I$VLOAD as outputs, treating dae as
a multi-input/multi-output system. We want to control the DC behavior sweeping VLOAD between
408 3. Reference Manual

0 V and 3 V and II between 0 A and 0.003 A on a uniform two-dimensional grid with 16 points.
The following call to NonlinearSetup prepares a DAEObject with these settings.
Specify settings for In[6]:= step1=NonlinearSetup[dae, {VLOAD, II}, {V$5, I$VLOAD},
nonlinear simplifications. DT −> {Range −>
{{VLOAD, 0, 3, 1}, {II, 0, 0.003, 0.001}} }]
Out[6]= … DAE@DC, †27 ´ 27‡D …

Display settings stored in In[7]:= NonlinearSettings[step1]


step1.
Input symbols : {II, VLOAD}
Output symbols : {I$VLOAD, V$5}
Ranking−Cache : −not set−
DT range : {{VLOAD −> 0., II −> 0.}, <<15>>}
DTSimulation : DefaultDTSimulation
DTError : DefaultDTError
DTReference : {<<16>>}
OperatingPoints : {<<16>>}
The following code illustrates how to define your own simulation and error function and how to
call NonlinearSetup such that these functions are used during nonlinear simplifications.
Define a DT simulation In[8]:= MyDTSimulationFct[dae_, refsim_List:{}, opts___] :=
function. Block[
{nonlinopts, indepvar, inittime},

{indepvar, inittime, nonlinopts} = GetDAEOptions[


dae,
{IndependentVariable, InitialTime, NonlinearOptions}
];
NDAESolve[
dae,
{indepvar, inittime},
Range /. (DT /. nonlinopts),
opts
]
]
Define a DT error In[9]:= MyDTErrorFct[newval_, oldval_, outputsymbols_] :=
function. Map[
Rule[#, Max[Abs[(# /. newval) − (# /. oldval)]]] &,
outputsymbols
]
Set up nonlinear In[10]:= step1 = NonlinearSetup[dae, {VLOAD, II}, {V$5, I$VLOAD},
simplifications using new DT −> {
simulation and error Range −> {{VLOAD, 0, 3, 1}, {II, 0, 0.003, 0.001}},
function. SimulationFunction −> MyDTSimulationFct,
ErrorFunction −> MyDTErrorFct
}
]
Out[10]= … DAE@DC, †27 ´ 27‡D …
3.12 Nonlinear Simplification Techniques 409

Display settings stored in In[11]:= NonlinearSettings[step1]


step1.
Input symbols : {II, VLOAD}
Output symbols : {I$VLOAD, V$5}
Ranking−Cache : −not set−
DT range : {{VLOAD −> 0., II −> 0.}, <<15>>}
DTSimulation : MyDTSimulationFct
DTError : MyDTErrorFct
DTReference : {<<16>>}
OperatingPoints : {<<16>>}

3.12.2 CompressNonlinearEquations

CompressNonlinearEquations[dae, outvars]
removes equations and eliminates variables from a
nonlinear DAEObject dae which are irrelevant for solving
for the variables outvars
CompressNonlinearEquations[dae]
removes as many equations and variables as possible

Command structure of CompressNonlinearEquations .

This function contains a compression algorithm which allows for identification and elimination of
irrelevant equations and variables and the removal of decoupled clusters of equations and variables
in a system of symbolic nonlinear differential and algebraic circuit equations. The return value is
again a DAEObject.
Note that the argument outvars also supports string patterns. Additionally,
CompressNonlinearEquations automatically retrieves the settings made by NonlinearSetup , so
there is no need to specify the variables of interest as a second argument.
Note that CompressNonlinearEquations also supports the data format from Release 1, where
equations are given as {eqns, vars}, instead of a DAEObject:

CompressNonlinearEquations[{eqns, vars}, outvars]


removes equations and eliminates variables from a set of
nonlinear equations eqns formulated in the variables vars
which are irrelevant for solving for the variables outvars
CompressNonlinearEquations[{eqns, vars}]
removes as many equations and variables as possible

Additional patterns of CompressNonlinearEquations .

CompressNonlinearEquations has the following options:


410 3. Reference Manual

option name default value

EliminateVariables Automatic eliminates irrelevant variables


Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
StripIndependentBlocks
True removes irrelevant independent subsystems
of equations

Options for CompressNonlinearEquations .

See also: CompressMatrixEquation (Section 3.11.4).

Options Description

EliminateVariables
EliminateVariables allows for eliminating variables from a set of equations. Settings are Automatic
for eliminating variables occuring linear everywhere, All for eliminating variables occuring linear
somewhere, and None for no variable elimination, respectively. The default setting is
EliminateVariables −> Automatic .

StripIndependentBlocks
With StripIndependentBlocks −> True irrelevant independent subsystems of equations will be
searched for and removed. The default setting is StripIndependentBlocks −> True.

Examples

D1
1 2

V0 C1 R1 Vout

Load Analog Insydes. In[1]:= <<AnalogInsydes‘


3.12 Nonlinear Simplification Techniques 411

Define netlist description In[2]:= rectifier =


of a simple diode rectifier Circuit[
circuit. Netlist[
{V0, {1, 0}, Symbolic −> V0,
Value −> 2. Sin[10^6 Time]},
{R1, {2, 0}, Symbolic −> R1, Value −> 100.},
{C1, {2, 0}, Symbolic −> C1, Value −> 1.*^−7},
{D1, {1 −> A, 2 −> C},
Model −> "Diode", Selector −> "Spice"}
]
]
Out[2]= … Circuit …

Set up the system of In[3]:= rectifiereqs = CircuitEquations[rectifier,


symbolic time-domain AnalysisMode −> Transient,
equations. ElementValues −> Symbolic] // UpdateDesignPoint
Out[3]= … DAE@Transient, †4 ´ 4‡D …

Show equation system. In[4]:= DisplayForm[rectifiereqs]


Out[4]//DisplayForm=
99I$AC$D1@tD + I$V0@tD == 0, -I$AC$D1@tD + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢
R1
1.11 I-1.+ €€€€€€€€
€€€€€€€ M $q
TEMP

V$1@tD == V0, I$AC$D1@tD == AREA$D1 㠀€€€€€€€€€€€€€€€ €€€€€€€€


$k€€€€€€€€
€€€€€
TNOM
TEMP

I-1 + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€


€€€€€ N + GMIN HV$1@tD - V$2@tDL=,
1. $q HV$1@tD-V$2@tDL
3.
€€€€€€€€€€€€€€€€ TEMP

8V$1@tD, V$2@tD, I$V0@tD, I$AC$D1@tD<, DesignPoint ®


TEMP
TNOM

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 ,

TNOM ® 300.15, $k ® 1.38062 ´ 10-23 , $q ® 1.60219 ´ 10-19 <=


AREA$D1 ® 1., GMIN ® 1. ´ 10-12 , IS$D1 ® 1. ´ 10-14 , TEMP ® 300.15,

Eliminate variables which In[5]:= rectifiercomp = CompressNonlinearEquations[rectifiereqs,


occur linear everywhere. V$2[t], EliminateVariables −> Automatic]
Out[5]= … DAE@Transient, †2 ´ 2‡D …

Show compressed equation In[6]:= DisplayForm[rectifiercomp]


system.
Out[6]//DisplayForm=
99-1. AREA$D1 㠀€€€€€€€€€€€€€€€ I-1. + 㠀€€€€€€€€€€€€€€€ $k €€€€€€€€€ M IS$D1 J €€€€€€€€
€€€€€ N -
1.11 I-1.+ €€€€€€€€€€€€€€€ M $q 1. $q HV$1@tD-V$2@tDL TEMP 3.
TEMP
€€€€€€€€
TEMP $k€€€€€€€€
TNOM €€€€€ €€€€€€€€€€€€€€€€
TEMP
TNOM
1. GMIN HV$1@tD - 1. V$2@tDL + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0,
V$2@tD ¢

V$1@tD == V0=, 8V$1@tD, V$2@tD<, DesignPoint ®


R1

8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 ,

TNOM ® 300.15, $k ® 1.38062 ´ 10-23 , $q ® 1.60219 ´ 10-19 <=


AREA$D1 ® 1., GMIN ® 1. ´ 10-12 , IS$D1 ® 1. ´ 10-14 , TEMP ® 300.15,

Eliminate variables which In[7]:= rectifiercomp = CompressNonlinearEquations[rectifiereqs,


occur linear somewhere. V$2[t], EliminateVariables −> All]
Out[7]= … DAE@Transient, †1 ´ 1‡D …
412 3. Reference Manual

Show compressed equation In[8]:= DisplayForm[rectifiercomp]


system.
Out[8]//DisplayForm=
99-1. AREA$D1 㠀€€€€€€€€€€€€€€€ I-1. + 㠀€€€€€€€€€€€€€€€
$k €€€€€€€€€ M IS$D1 J €€€€€€€€
€€€€€ N -
1.11 I-1.+ €€€€€€€€€€€€€€€ M $q 1. $q HV0-V$2@tDL TEMP 3.
TEMP
€€€€€€€€
TEMP $k€€€€€€€€
TNOM €€€€€ TEMP €€€€€€€€
TNOM
1. GMIN HV0 - 1. V$2@tDL + €€€€€€€€€€€€€€€€€€ + C1 V$2 @tD == 0=, 8V$2@tD<,
V$2@tD ¢

DesignPoint ® 8V0 ® 2. Sin@1000000 tD, R1 ® 100., C1 ® 1. ´ 10-7 ,


R1

TNOM ® 300.15, $k ® 1.38062 ´ 10-23 , $q ® 1.60219 ´ 10-19 <=


AREA$D1 ® 1., GMIN ® 1. ´ 10-12 , IS$D1 ® 1. ´ 10-14 , TEMP ® 300.15,

Perform numerical In[9]:= orig = NDAESolve[rectifiereqs, {t, 0., 2.*^−5}];


transient analyses with comp = NDAESolve[rectifiercomp, {t, 0., 2.*^−5}];
NDAESolve .

Compare the simulation In[11]:= V$2Orig := V$2 /. First[orig];


results with TransientPlot[comp, {V$2[t], V$2Orig[t]},
TransientPlot . {t, 0., 2.*^−5}]

1.2
1
0.8 V$2[t]

0.6
0.4 V$2Orig[t]
0.2
t
-6 0.00001 0.000015 0.00002
5. 10

Out[12]= … Graphics …

3.12.3 CancelTerms

CancelTerms[dae, maxerrors] applies cancellation of terms in dae for a given error


specification maxerrors
CancelTerms[dae] applies cancellation of terms using error specification given
by NonlinearSetup

Command structure of CancelTerms .

CancelTerms simplifies the given DAEObject by successive removal of terms in the equation system.
It assures that the behavior of the simplified system differs not more than maxerrors from the behavior
of the original system. Before using CancelTerms , the DAEObject has to be prepared for nonlinear
simplification using NonlinearSetup (Section 3.12.1). CancelTerms performs the numerical analyses
set by the call to NonlinearSetup to calculate the error a simplification causes. The error list maxerrors
3.12 Nonlinear Simplification Techniques 413

must contain an error bound value for each analysis mode and each output variable, i.e. it has to be
a list of the form
{mode1 −> {var1 −> bound1 ,       },       }
Variables for which an error value has been specified in the call to NonlinearSetup can be omitted.
If error specifications have been given for each analysis mode and each output variable in the call
to NonlinearSetup , the maxerrors specification can be omitted completely. If the error caused by a
simplification exceeds any of the maximum errors given in the error list, the simplification is undone.
Note that the error is measured by the error function specified in the call to NonlinearSetup .
Removal of terms is done in the level given by the option Level (see below).
CancelTerms returns the simplified DAEObject. All settings for nonlinear simplifications stored in
the original system are added to the returned DAEObject, too. This means that you do not have to
call NonlinearSetup again on the new system in order to apply subsequent simplifications.
Note that CancelTerms reduces the number of terms only. Use CompressNonlinearEquations
(Section 3.12.2) to reduce the number of equations.
CancelTerms provides the following options:

option name default value

Clusterbound −1 logarithmic bound for cluster calculation


Errorbound 3 number of successive error-bound violations
before the algorithm terminates
Level 0 level in which to remove terms
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Ranking Automatic method to use for ranking
RecordCancellations True whether to record term cancellations

Options for CancelTerms .

After removal of one or more terms a numerical simulation is performed. Comparing the result to
a reference calculation yields the error on the output variables.
See also: NonlinearSetup (Section 3.12.1), ShowCancellations (Section 3.12.7),
ShowLevel (Section 3.12.6), Statistics (Section 3.6.17).

Options Description
A detailed description of all CancelTerms options is given below in alphabetical order:
414 3. Reference Manual

Clusterbound
Usually, CancelTerms deletes several terms at once before performing a numerical error calculation.
The computation of suitable term clusters for this is done automatically by CancelTerms . If the
precasted influence of a term exceeds a given threshold, calculation of clusters is stopped and
cancellation is done term by term. This threshold value is specified by the option Clusterbound .
The following values are allowed:

integer stop calculation of clusters if the logarithm (to base 10) of


the precasted term influence is bigger than integer
−Infinity do not cancel terms in clusters
Infinity always cancel terms in clusters

Values for the Clusterbound option.

The default setting is Clusterbound −> −1. Note that deletion of terms using clusters speeds up the
computation significantly.

Errorbound
If the computed error exceeds the given error bound maxerrors, then the term or terms are re-
inserted. The option Errorbound specifies the number of successive re-insertions before the algorithm
terminates. Use Errorbound −> Infinity to check all terms for cancellation. The default setting is
Errorbound −> 3.

Level
By default, CancelTerms removes terms from top-level sums (level 0). It is also possible to simplify
sums in deeper levels, i.e. sums occuring inside of expressions. The option Level determines which
level is affected by the simplification. Possible values are:

n apply cancellation in level n


{n 1 , n 2 , † † † } apply cancellation in levels n1 , n2 ,      
All apply cancellation in all levels, starting on top level

Level specifications for CancelTerms .

If given explicitly, level specifications have to be non-negative integers. The default setting is
Level −> 0.
3.12 Nonlinear Simplification Techniques 415

The level specification of CancelTerms does not correspond to the level of the internal
Mathematica representation of dae. Use ShowLevel (Section 3.12.6) or Statistics
(Section 3.6.17) to see which levels can be influenced by CancelTerms .

Ranking
Cancellation of terms is performed in a pre-calculated order which sorts the terms by increasing
influence. A method which estimates the influence of a cancellation on the output behavior is
called ranking. CancelTerms lets you choose which ranking method to use for each analysis mode
separately by means of the Ranking option. Possible values are:

{mode−>Automatic|Simulation, † † † }
set mode dependent ranking functions
Automatic equivalent to {_−>Automatic}
Simulation equivalent to {_−>Simulation}

Values for the Ranking option.

The ranking method can either be Automatic , which means to use the internal implemented ranking
function, or Simulation , which means to use the corresponding simulation function to calculate
the influence. The former is much more efficient while the latter is more accurate. If the option
value is the symbol Automatic or Simulation the corresponding ranking function is set for all
analysis modes simultaneously. If you want to set the ranking function for each mode separately,
you have to give a list of rules. The current analysis mode is then matched against the left hand
side of the rules and the corresponding right hand sides are chosen as ranking functions. Thus, mode
can either be one of the symbols DT or AC, or a pattern specification like _. The default setting is
Ranking −> Automatic .

RecordCancellations
The value of the RecordCancellations option determines whether term cancellations are recorded
during computation. If set to True, a cancellation history is written to the options section of the
DAEObject given as argument to CancelTerms . Note that it is not written to the returned DAEObject.
The command ShowCancellations (Section 3.12.7) can then be used to visualize the history list. If
set to False, no history list is recorded. The default setting is RecordCancellations −> True.

If you cancel terms in different levels, the history list of the first level will be recorded only.
416 3. Reference Manual

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read PSpice netlist. In[2]:= netlist = ReadNetlist[


"AnalogInsydes/DemoFiles/Sqrt.cir",
Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up symbolic circuit In[3]:= mnaFull = CircuitEquations[netlist,


equations. AnalysisMode −> DC, ElementValues −> Symbolic,
Value −> {"*" −> {TEMP, TNOM, $q, $k}}]
Out[3]= … DAE@DC, †27 ´ 27‡D …

Prepare DAE system for In[4]:= step1 = NonlinearSetup[mnaFull, {II, VLOAD}, {I$VLOAD},
nonlinear simplifications. DT −> {Range −>
{{VLOAD, 0., 3.5, 0.5}, {II, 0., 0.001, 0.0002}} }]
Out[4]= … DAE@DC, †27 ´ 27‡D …

Display complexity In[5]:= Statistics[step1]


information of the original
Number of equations : 27
system.
Number of variables : 27
Length of equations : {4, 4, 3, 3, 2, 3, 2, 3, 8, 8,
3, 2, 3, 9, 9, 3, 2, 3, 9, 9, 3, 2, 3, 4, 4, 3, 2}
Terms with derivatives : 0
Sums in levels : {113, 20}
Cancel top-level terms in In[6]:= step2 = CancelTerms[step1, {DT −> {I$VLOAD −> 25.*^−6}}]
the equations. Out[6]= … DAE@DC, †27 ´ 27‡D …

Display complexity In[7]:= Statistics[step2]


information of the
Number of equations : 27
simplified system. Note
that the number of terms Number of variables : 27
decreased, while the Length of equations : {1, 2, 2, 2, 2, 2, 1, 2, 2, 1,
number of equations
stayed the same. 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1}
Terms with derivatives : 0
Sums in levels : {32, 4}

3.12.4 SimplifySamplePoints

SimplifySamplePoints[func, range, tolerance]


reduces the number of points in range for a given tolerance
specification tolerance

Command structure of SimplifySamplePoints .


3.12 Nonlinear Simplification Techniques 417

SimplifySamplePoints returns a sparsed list of sample points such that the function values,
evaluated on adjacent points, do not exceed the given tolerance. The argument range must be a
valid parameter sweep specification as described in Section 3.7.2. If range is a n-dimensional sweep
range then func must be a function of n arguments which returns a single real number.
SimplifySamplePoints provides the following options:

option name default value

ReturnSymbols True whether to return a list of rules or a list of


numerical values
SearchDirections All specifies the direction in which to search for
adjacent points

Options for SimplifySamplePoints .

See also: Section 3.7.2.

Options Description

ReturnSymbols
If ReturnSymbols is set to True, the sparsed list is returned as a flat list of rules. If it is set
to False, the sparsed list is returned as a flat list of numerical values. In the former case the return
value is a valid parameter sweep specification and can be used as argument to NonlinearSetup
(Section 3.12.1). The default setting is ReturnSymbols −> True.

SearchDirections
The option SearchDirections specifies the direction in which to search for adjacent points. The
value can be All or a list of symbols which appear in the given parameter sweep. If the value is
a list of symbols, adjacent points are only searched for the given variables. The default setting is
SearchDirections −> All which means to search in all directions.

3.12.5 NonlinearSettings

NonlinearSettings[dae] prints all settings for nonlinear simplifications stored in dae

Command structure of NonlinearSettings .


418 3. Reference Manual

As mentioned in the description of NonlinearSetup (Section 3.12.1) additional data has to be


stored in a DAE system in order to apply the nonlinear simplification routines. The command
NonlinearSettings prints the according data currently stored in a DAEObject.
NonlinearSettings provides the following information:

list of input symbols


list of output symbols
value of the ranking cache
mode-specific settings (range, simulation function, error function, and reference values)

See also: NonlinearSetup (Section 3.12.1).

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read PSpice netlist. In[2]:= net = ReadNetlist["AnalogInsydes/DemoFiles/Sqrt.cir",


Simulator −> "PSpice"]
Out[2]= … Circuit …

Set up DAE system. In[3]:= dae = CircuitEquations[net,


AnalysisMode −> DC, ElementValues −> Symbolic]
Out[3]= … DAE@DC, †27 ´ 27‡D …

Specify settings for In[4]:= setup = NonlinearSetup[dae, {VLOAD, II}, {V$5, I$VLOAD},
nonlinear simplifications. DT −> {Range −>
{{VLOAD, 0, 3, 1}, {II, 0, 0.003, 0.001}} }]
Out[4]= … DAE@DC, †27 ´ 27‡D …

Display settings stored in In[5]:= NonlinearSettings[setup]


the DAEObject.
Input symbols : {II, VLOAD}
Output symbols : {I$VLOAD, V$5}
Ranking−Cache : −not set−
DT range : {{VLOAD −> 0., II −> 0.}, <<15>>}
DTSimulation : DefaultDTSimulation
DTError : DefaultDTError
DTReference : {<<16>>}
OperatingPoints : {<<16>>}
3.12 Nonlinear Simplification Techniques 419

3.12.6 ShowLevel

ShowLevel[dae] highlights parts of dae influenced by nonlinear


simplification routines for all levels
ShowLevel[dae, level] highlights parts in levels of dae given by level

Command structure of ShowLevel .

The command ShowLevel displays the equation system dae and highlights those parts of the equations
which are influenced by nonlinear simplification functions such as CancelTerms (Section 3.12.3).
The second argument level can either be a number or a list of numbers. If it is a number, then exactly
this level is highlighted. If it is a list of numbers {l1 , † † †, ln } then the levels l1 ,      , ln are highlighted.
The level argument corresponds to the level argument of CancelTerms and to the output of
Statistics (Section 3.6.17).

The level specification of ShowLevel does not correspond to the level of the internal
Mathematica representation of dae.

See also: ShowCancellations (Section 3.12.7), Statistics (Section 3.6.17),


CancelTerms (Section 3.12.3).

3.12.7 ShowCancellations

ShowCancellations[dae] highlights those parts of dae which have been removed by


nonlinear simplification routines

Command structure of ShowCancellations .

The command ShowCancellations displays the equation system dae and highlights those parts of
the equations which have been removed by nonlinear simplification functions such as CancelTerms
(Section 3.12.3). You have to set the value of the CancelTerms option RecordCancellations to True
to activate the history recording feature.
Note that dae is not the return value of a nonlinear simplification routine but its argument.
See also: ShowLevel (Section 3.12.6), CancelTerms (Section 3.12.3).
420 3. Reference Manual

3.13 Miscellaneous Functions

3.13.1 ConvertDataTo2D

ConvertDataTo2D[data] converts numerical simulation data into two-dimensional


interpolating functions

Command structure of ConvertDataTo2D .

All Analog Insydes functions which return numerical data, e. g. ACAnalysis (Section 3.7.3),
NoiseAnalysis (Section 3.7.4), NDAESolve (Section 3.7.5), or ReadSimulationData (Section 3.10.3)
use the data format described in Section 3.7.1. This format is suitable for representing one, two, and
multi-dimensional numerical data. As standard Mathematica graphic functions do not support the
multi-dimensional Analog Insydes data format, ConvertDataTo2D converts the data such that it can
be plotted with standard Mathematica graphic functions such as Plot3D.
The input data must be two-dimensional data as described in Section 3.7.1, for example:
Data format for {
two-dimensional numerical {
simulation data.
V$1 −> InterpolatingFunction[{{t1, t2}}, <>],
   ,
SweepParameters −> {VIN −> v1}
},
   ,
{
V$1 −> InterpolatingFunction[{{t1, t2}}, <>],
   ,
SweepParameters −> {VIN −> v2}
}
}
The data will then be converted to a set of two-dimensional interpolating functions:
Converted data format. {
V$1 −> InterpolatingFunction[{{v1, v2}, {t1, t2}}, <>],
   ,
}
Please note the order of the parameters for the two-dimensional interpolating function. The
interpolation order is set to {1, 1}.
See also: Section 3.7.1, Section 3.7.2.
3.13 Miscellaneous Functions 421

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Read the simulation data In[2]:= data = ReadSimulationData[


with ReadSimulationData . "AnalogInsydes/DemoFiles/Multivibrator.txt",
Simulator −> "PSpice"]

88VH4L ® InterpolatingFunction@88-0.00018,
Out[2]=
0.00012<<, <>D,

SweepParameters ® 8VCC ® 0.<<,


VH5L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

8VH4L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

SweepParameters ® 8VCC ® 6.<<,


VH5L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

8VH4L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

SweepParameters ® 8VCC ® 12.<<<


VH5L ® InterpolatingFunction@88-0.00018, 0.00012<<, <>D,

Convert it into In[3]:= data2d = ConvertDataTo2D[data]

8VH4L ® InterpolatingFunction@
two-dimensional
Out[3]=

880., 12.<, 8-0.00018, 0.00012<<, <>D, VH5L ®


interpolating functions.

InterpolatingFunction@880., 12.<, 8-0.00018, 0.00012<<, <>D<

Display simulation result In[4]:= Plot3D[


with Plot3D. Evaluate[("V(4)"[VCC, IC]−"V(5)"[VCC, IC]) /. data2d],
{IC, −0.00018, 0.00011}, {VCC, 0., 12.},
BoxRatios −> {1., 1., 1.},
AxesLabel −> {"IC", "VCC", "V(4)−V(5)"}]

VCC 10
7.5
5
2.5
0
5

V(4)-V(5) 0
-5
-10
-0.0001
IC 0
0.0001

Out[4]= … SurfaceGraphics …

3.13.2 DXFGraphics

DXFGraphics["file"] displays a DXF file as a native Mathematica graphic object

Command structure of DXFGraphics .


422 3. Reference Manual

The main purpose of importing DXF (Drawing Interchange File) is to include a schematics into a
Mathematica notebook for a better understanding and documentation of circuit analysis tasks. If your
schematic editor does not support the generation of DXF files it might be possible to use tools like
pstoedit and hpgl2ps to convert the graphic data to DXF.
The DXF file should only contain two-dimensional graphic objects. The following DXF entities are
supported by DXFGraphics :

ARC
CIRCLE
LINE
POINT
POLYLINE
SHAPE
SOLID
TEXT

DXF entities supported by DXFGraphics .

DXFGraphics inherits all options from Graphics. Additional options for DXFGraphics are:

option name default value

FillColors None specifies the colors to be filled


LayerColor False whether the layer color should be used
LineDashingScale 5000. the line dashing scale
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
ShowColors False whether to display the legend of used colors
TextSizing True whether to size the text
TextStyle {FontSize −> 12} the used TextStyle
ThicknessFunction AbsoluteThickness function translating the DXF line thickness
into a graphics primitive
ColorList {† † †} list which translates DXF colors into
Mathematica colors

Options for DXFGraphics .


3.13 Miscellaneous Functions 423

Options Description
A detailed description of all DXFGraphics options is given below in alphabetical order:

FillColors
Most DXF generators are not able to convert filled graphic objects into DXF correctly. The option
FillColors can be used to fill POLYLINE and CIRCLE entities by specifying a list of pairs of DXF
colors and Mathematica graphic primitives. For example, FillColor −> {1, RGBColor[0, 0, 0]}
will fill all converted POLYLINE and CIRCLE entities of color 1 with the Mathematica color directive
RGBColor[0, 0, 0]. More fill colors can be set as lists of pairs of a DXF color and a Mathematica
graphic primitive or a DXF color. If only a DXF color number is given the entity will be filled with
its original color.

LayerColor
Each DXF entity belongs to a layer having its own color property. DXFGraphics takes the color of
the entity if LayerColor −> False and the color of the layer otherwise.

LineDashingScale
The value given by the option LineDashingScale is directly multiplied with the DXF dashing value.
The result is the argument of AbsoluteDashing used by DXFGraphics .

ShowColors
ShowColors −> True displays a legend of used colors which allows for identifying the wanted DXF
colors easily.

TextSizing
If TextSizing is set to True, the text will be scaled according to the DXF data. The average size
of all text primitives in the resulting Mathematica graphics object is calculated. Afterwards the text
sizes are fitted such that the average equals the value of FontSize given by the option TextStyle
(see below).

TextStyle
The option TextStyle specifies the default style and font options used for displaying text. The
format is {opt1 −> val1 , † † † }. If TextStyle contains the rule TextStyle −> val, the value val denotes
the average size of the font sizes if TextSizing is True.
424 3. Reference Manual

ThicknessFunction
This option can be used for setting the line thickness. To generate a graphic using a ten times larger
line thickness and a minimum line thickness of five specify
ThicknessFunction −> (AbsoluteThickness[10.*#+5.]&) .

ColorList
The option ColorList can be used to modify the color translation table. For example, to set the
DXF color 7 to the Mathematica color white use the option
ColorList −> ReplacePart[Options[DXFColor, ColorList][[1,2]], GrayLevel[1], 7].

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Import a DXF file into In[2]:= DXFGraphics["AnalogInsydes/DemoFiles/Buffer.dxf"]


Mathematica.

Q2N2907a5
Q2N2907a
T4
T3
Q2N2907a
T5
3 4
1Q2N2222
2 VOUTVDD
T1
T2
Q2N2222 VDB
+
-
VIN
+
- I1
+ I2
+
- -
0
Out[2]= … Graphics …
3.13 Miscellaneous Functions 425

Use the option TextStyle In[3]:= DXFGraphics["AnalogInsydes/DemoFiles/Buffer.dxf",


to fit the font size. TextStyle −> {FontSize −> 4}]

5
Q2N2907a
Q2N2907a
T3 T4
Q2N2907a
T5

3 4

Q2N2222 VOUTVDB
1 T1T2 VDD
+
2Q2N2222 -

VIN
+
-
I1+ I2+
- -

Out[3]= … Graphics …

With the option In[4]:= DXFGraphics["AnalogInsydes/DemoFiles/colorcirc.dxf",


FillColors certain picture FillColors −> {{0}, {1}, {2}, {3}, {4}, {5}, {6},
elements can be filled. {7, −1}, {8}, {9}, {20}, {30}, {33}, {40}, {60},
{70}, {80}, {100}, {110}, {120}, {140}, {150},
{160}, {180}, {190}, {200}, {220}, {230}, {240},
{250}, {251}, {252}, {253}, {254}},
TextStyle −> {FontSize −> 4}]

Pink Cyan ’White’


Red GreenBlue Yellow

Out[4]= … Graphics …
426 3. Reference Manual

3.13.3 MathLink Module MSBG

LoadMSBG[] or LoadMSBG[False]
loads and installs the MathLink module if it is not installed
yet
LoadMSBG[True] loads and installs the MathLink module; forces unloading
and reinstallation if the module was already installed
UnloadMSBG[] uninstalls the MathLink module

Manually loading and unloading of the MathLink module MSBG.exe .

Analog Insydes loads the MathLink SBG module automatically when it is needed, but you can
also load and unload the module manually by applying one of the above functions. Note that
since the SBG module is a MathLink application, the global Analog Insydes option UseExternals
(Section 3.14.7) must be set to True to enable these functions.

3.13.4 MathLink Module QZ

LoadQZ[] or LoadQZ[False] loads and installs the MathLink module if it is not installed
yet
LoadQZ[True] loads and installs the MathLink module; forces unloading
and reinstallation if the module was already installed
UnloadQZ[] uninstalls the MathLink module

Manually loading and unloading of the MathLink module QZ.exe.

Analog Insydes loads the MathLink QZ module automatically when it is needed, but you can also load
and unload the module manually by applying one of the above functions. Note that since the QZ
module is a MathLink application, the global Analog Insydes option UseExternals (Section 3.14.7)
must be set to True to enable these functions.
3.14 Global Options 427

3.14 Global Options


Analog Insydes provides a number of global options for controlling some fundamental settings shared
by all program modules. An overview of the global options and their default settings (Section 3.14.1)
as well as a detailed description of each option (Section 3.14.2 – Section 3.14.7) are given below.
Section 3.14.8 describes the option inheritance scheme implemented in Analog Insydes.

3.14.1 Options[AnalogInsydes]
The current settings of the global Analog Insydes options can be inspected with
Options[AnalogInsydes] . You can change the value of a global option in a Mathematica session
with SetOptions[AnalogInsydes, optname −> value].
There are the following global Analog Insydes options available:

option name default value

InstanceNameSeparator "$" separator string for name components of


model variables and reference designators
LibraryPath Prepend[$Path, "aidir/AnalogInsydes/ModelLibrary"]
the search path for device model libraries
ModelLibrary "FullModels‘" the default device model library searched
by ExpandSubcircuits
Protocol StatusLine the amount and location of protocol
information generated by Analog Insydes
commands
Simulator "AnalogInsydes" the source/target simulator for data
import/export and circuit simulation
functions
UseExternals True whether to use external MathLink modules

Global options for Analog Insydes.

See also: Options, SetOptions .

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
428 3. Reference Manual

View global Analog In[2]:= Options[AnalogInsydes]

8InstanceNameSeparator ® $,
Insydes option settings.
Out[2]=

LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,


ModelLibrary ® FullModels‘, Protocol ® StatusLine,
Simulator ® AnalogInsydes, UseExternals ® True<

3.14.2 InstanceNameSeparator
The option InstanceNameSeparator −> "string" specifies the character or string Analog Insydes
uses to separate name components of variables, node identifiers, and reference designators generated
for device model or subcircuit instances.
For example, the default setting InstanceNameSeparator −> "$" causes the transconductance gm of
a transistor Q1 to be named gm$Q1 after model instantiation.

The value of InstanceNameSeparator must be a valid symbol name.


The given "string" may not contain characters which have a special meaning in Mathematica,
such as _ or ‘.

See also: CircuitEquations (Section 3.5.1).

3.14.3 LibraryPath
With the option LibraryPath , you can specify the paths to be searched for device model library
files. Possible values are:

"path" search for model libraries in "path"


{"path1 ", "path2 ", † † † } search paths "path1 ", "path2 ", † † † in the given order for
model libraries

Values for the LibraryPath option.

The default setting is LibraryPath :> Prepend[$Path, "aidir/AnalogInsydes/ModelLibrary"] ,


which adds the installation path of your Analog Insydes model library to the Mathematica variable
$Path.
See also: Info[AnalogInsydes] (Section 3.15.6), Chapter 3.3.
3.14 Global Options 429

3.14.4 ModelLibrary
With the option ModelLibrary , you can specify the names of the files or contexts searched by
ExpandSubcircuits for device model definitions during netlist expansion. Possible values are:

"lib" select file or context "lib" as default device model library


{"lib1 ", "lib2 ", † † † } select files or contexts "lib1 ", "lib2 ", † † † as default device
model libraries (files are searched in the given order)

Values for the ModelLibrary option.

Analog Insydes provides the following semiconductor device model libraries:

"FullModels‘" full-precision SPICE device models


"SimplifiedModels‘" medium-precision device models (some parasitic effects
excluded)
"BasicModels‘" low-precision device models (without parasitic effects)

Analog Insydes device model libraries.

The default setting is ModelLibrary −> "FullModels‘" , which applies the full-precision SPICE
device models.
See also: LibraryPath (Section 3.14.3), CircuitEquations (Section 3.5.1), Chapter 3.3, Chapter 4.3.

Examples
Load Analog Insydes. In[3]:= <<AnalogInsydes‘

Use basic models for all In[4]:= SetOptions[AnalogInsydes,


semiconductor devices. ModelLibrary −> "BasicModels‘"]

8InstanceNameSeparator ® $,
Out[4]=

LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,


ModelLibrary ® BasicModels‘, Protocol ® StatusLine,
Simulator ® AnalogInsydes, UseExternals ® True<

The fact that library files are searched in the given order and the way in which the Analog Insydes
model library is organized allow you to change the default model complexity setting for a particular
device type by using the ModelLibrary option as follows.
430 3. Reference Manual

Use full-precision models In[5]:= SetOptions[AnalogInsydes,


for diodes and basic ModelLibrary −> {"FullDiodeModels‘", "BasicModels‘"}]

8InstanceNameSeparator ® $,
models for all other
devices. Out[5]=

ModelLibrary ® 8FullDiodeModels‘, BasicModels‘<, Protocol ®


LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,

StatusLine, Simulator ® AnalogInsydes, UseExternals ® True<

3.14.5 Protocol
With the option setting Protocol −> levelspecs, you can control the amount of protocol information
generated by Analog Insydes commands and specify the location on the screen where protocol
messages are displayed. You can distinguish between top-level functions and lower-level functions
(i.e. functions called by top-level functions). Possible values are:

leveltop specify destination for protocol messages generated by


top-level function; do not show protocol messages from
lower levels
{leveltop , level2 , † † † } specify destinations for protocol messages generated by
top-level function and lower-level functions called by
top-level function

The format of levelspecs.

Protocol information can be printed in a notebook or displayed in a notebook’s status line. The
following values may be specified as destinations level for Protocol , where the default setting is
Protocol −> StatusLine .

Notebook display protocol information in notebook


StatusLine display protocol information in status line
All display protocol information in both notebook and status
line
None do not print protocol information

Destinations for protocol messages.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.14 Global Options 431

Turn off protocol display. In[2]:= SetOptions[AnalogInsydes, Protocol −> None]

8InstanceNameSeparator ® $,
Out[2]=

LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,


ModelLibrary ® FullModels‘, Protocol ® None,
Simulator ® AnalogInsydes, UseExternals ® True<

Display top-level In[3]:= SetOptions[AnalogInsydes,


information in status line, Protocol −> {StatusLine, Notebook}]

8InstanceNameSeparator ® $,
send messages from
Out[3]=
second level to notebook.

ModelLibrary ® FullModels‘, Protocol ® 8StatusLine, Notebook<,


LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,

Simulator ® AnalogInsydes, UseExternals ® True<

3.14.6 Simulator
The value of the option Simulator −> "string" determines the source or target simulator for Analog
Insydes’ simulator interfaces and circuit analysis functions. The following simulators are supported:

"AnalogArtist" Analog Artist


"AnalogInsydes" Analog Insydes
"Eldo" Eldo
"PSpice" PSpice
"Saber" Saber
"Spectre" Spectre

Supported circuit simulators.

The default setting is Simulator −> "AnalogInsydes" , which disables the usage of the external
simulator interface.
Note that the option value "AnalogArtist" corresponds to the handling of files generated by the
Spectre to Analog Insydes interface for Analog Artist, and "Spectre" to the treatment of Spectre PSF
files, respectively.
Although the Simulator option of ReadNetlist , ReadSimulationData , etc. is inherited from the
global Analog Insydes option Simulator , it is recommended to specify the Simulator option in
each call of the above mentioned commands rather than altering the global value.

3.14.7 UseExternals
The option UseExternals enables or disables the use of the external MathLink applications of Analog
Insydes. You can set UseExternals −> False if you prefer not to use MathLink programs or if you
432 3. Reference Manual

wish to run Analog Insydes on a platform for which no native support is provided. Possible values
are:

True use the MathLink extensions of Analog Insydes


False do not use the MathLink extensions; use internal algorithms
if available

Values for the UseExternals option.

The default setting is UseExternals −> True, which enables the usage of the MathLink applications.

If you set UseExternals −> False, some functions may not be available or run with
reduced performance.

Note that the external routines are called transparently for the user. There is no need to perform
any additional setup.

3.14.8 Option Inheritance


Analog Insydes employs an option inheritance scheme that allows you to change the values of shared
options both globally and locally in a convenient way. If the value of an option optname is specified
as Inherited[symbol] , then the actual value of optname will be retrieved from Options[symbol] as
soon as it is needed.
For example, the Analog Insydes functions ExpandSubcircuits and ReadNetlist both inherit the
options InstanceNameSeparator and Protocol from Options[AnalogInsydes] . You can change
the settings for both functions simultaneously by specifying new values for
Options[AnalogInsydes] . You can also change any of these options locally for either function in
Options[ExpandSubcircuits] or Options[ReadNetlist] . See example below.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Display the options of In[2]:= Options[ExpandSubcircuits]

8AutoloadModels ® True, DefaultSelector ® None, HoldModels ® None,


ExpandSubcircuits .
Out[2]=

InstanceNameSeparator ® Inherited@AnalogInsydesD,
KeepLocalModels ® False, LibraryPath ® Inherited@AnalogInsydesD,
ModelLibrary ® Inherited@AnalogInsydesD, Protocol ®
Inherited@AnalogInsydesD, Symbolic ® All, Value ® None<

Note that some of the option values are marked as Inherited[AnalogInsydes] . The values of these
options will be retrieved from Options[AnalogInsydes] when they are neeeded.
3.14 Global Options 433

Display the options of In[3]:= Options[ReadNetlist]

8CharacterMapping ® 8_ ® $<,
ReadNetlist .
Out[3]=

KeepPrefix ® True, LevelSeparator ® , LibraryPath ® 8.<,


InstanceNameSeparator ® Inherited@AnalogInsydesD,

ParseOnly ® False, Protocol ® Inherited@AnalogInsydesD,


Simulator ® Inherited@AnalogInsydesD, UserPDKMap ® None<

Change the value of In[4]:= SetOptions[AnalogInsydes, InstanceNameSeparator −> "$$"]

8InstanceNameSeparator ® $$,
InstanceNameSeparator
Out[4]=
globally.
LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,
ModelLibrary ® FullModels‘, Protocol ® StatusLine,
Simulator ® AnalogInsydes, UseExternals ® True<

Change the value of In[5]:= SetOptions[ExpandSubcircuits, Protocol −> None]

8AutoloadModels ® True, DefaultSelector ® None, HoldModels ® None,


Protocol locally for
Out[5]=
ExpandSubcircuits .
InstanceNameSeparator ® Inherited@AnalogInsydesD,
KeepLocalModels ® False, LibraryPath ® Inherited@AnalogInsydesD,
ModelLibrary ® Inherited@AnalogInsydesD,
Protocol ® None, Symbolic ® All, Value ® None<

Internally, Analog Insydes resolves inherited options by means of the function ResolveOptions .
We use ResolveOptions here for documentation purposes only. Option inheritance is taken care of
automatically by Analog Insydes. Below, ResolveOptions is used to determine the final values of
the options for ExpandSubcircuits . Note that the local value of the Protocol option overrides the
value from Options[AnalogInsydes] .
Get option settings for In[6]:= ResolveOptions[{}, ExpandSubcircuits,
ExpandSubcircuits . {InstanceNameSeparator, Protocol}] // InputForm
Out[6]//InputForm= {"$$", None}

For ReadNetlist , the values of both options are retrieved from Options[AnalogInsydes] .
Get option settings for In[7]:= ResolveOptions[{}, ReadNetlist,
ReadNetlist . {InstanceNameSeparator, Protocol}] // InputForm
Out[7]//InputForm= {"$$", StatusLine}
434 3. Reference Manual

3.15 The Analog Insydes Environment


The Analog Insydes loading procedure is completed by execution of several init files which allow for
adapting Analog Insydes to your local needs. Section 3.15.1 explains the details of the initialization
procedure.
Once Analog Insydes is started, there are several commands for obtaining detailed information
concerning your local Analog Insydes installation:

ReleaseInfo[AnalogInsydes] (Section 3.15.2)


Analog Insydes license type information
ReleaseNumber[AnalogInsydes] (Section 3.15.3)
Analog Insydes release number
License[AnalogInsydes] (Section 3.15.4)
Analog Insydes license number
Version[AnalogInsydes] (Section 3.15.5)
Analog Insydes version information
Info[AnalogInsydes] (Section 3.15.6)
Analog Insydes installation information

Obtaining Analog Insydes release information.

3.15.1 The Initialization Procedure


At the end of the Analog Insydes loading procedure, after setting up autoload declarations for all
Analog Insydes functions, three configurable init files are loaded (via the Mathematica function Get)
in the following order:
If a file called aiinit.m exists in the Analog Insydes installation directory, this file is loaded first.
If a file called .airc exists in the directory given by the Mathematica variable $HomeDirectory ,
this file is loaded next.
If a file called .airc exists in the current working directory (i.e. the directory returned by
Directory[] ; see the Mathematica command Directory ), this file is loaded last.
These files allow for adapting Analog Insydes to your local needs: Simply add the corresponding
Mathematica commands to one of the init files (see example below).
By setting the following environment variables you can suppress loading of init files:
3.15 The Analog Insydes Environment 435

AI_NO_SITE_INIT suppress loading of init file in Analog Insydes installation


directory
AI_NO_USER_INIT suppress loading of init file in home directory
AI_NO_WORKDIR_INIT suppress loading of init file in current working directory

Environment variables for suppressing init file loading.

Since the init files are loaded after installing the package autoload declarations, you can access all
Analog Insydes functions and options in the init files. For example, if you always want to produce
protocol output in your notebook, you can set the global Analog Insydes option Protocol by adding
the following line to your user init file:
Setting the default SetOptions[AnalogInsydes, Protocol −> Notebook];
protocol.

If you want to configure the location of an init file by an environment variable, add the following to
your user init file:
Loading an init file given If[ (file = Environment["MY_AI_INIT_FILE"]) =!= $Failed,
by an environment Get[file]];
variable.

This loads the init file given by the environment variable MY_AI_INIT_FILE if the variable is set.

3.15.2 ReleaseInfo

ReleaseInfo[AnalogInsydes] prints information on your local Analog Insydes


installation

Command structure of ReleaseInfo .

The command ReleaseInfo[AnalogInsydes] prints general information concerning your local


Analog Insydes installation such as the release number and a copyright notice.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Print information on In[2]:= ReleaseInfo[AnalogInsydes]


Analog Insydes release.
Analog Insydes for Mathematica, Release 2.1
Copyright (c) 1996−2005 by Fraunhofer ITWM
436 3. Reference Manual

3.15.3 ReleaseNumber

ReleaseNumber[AnalogInsydes]
returns the release number of your local Analog Insydes
installation

Command structure of ReleaseNumber .

The command ReleaseNumber[AnalogInsydes] returns the release number of your Analog Insydes
installation as a real number.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Get Analog Insydes In[2]:= ReleaseNumber[AnalogInsydes]


release number. Out[2]= 2.1

3.15.4 License

License[AnalogInsydes] returns the Analog Insydes license number currently used

Command structure of License.

The command License[AnalogInsydes] returns the license string used by your Analog Insydes
installation. As your license file might contain a list of licenses, License[AnalogInsydes] displays
the license actually used.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Get Analog Insydes license In[2]:= License[AnalogInsydes]


number.
Out[2]=
AIM1-200R-0100-0142-3859-2786-9924-4525-4318

3.15.5 Version

Version[AnalogInsydes] shows detailed information on the version of your local


Analog Insydes installation

Command structure of Version.


3.15 The Analog Insydes Environment 437

The command Version[AnalogInsydes] returns a list of version strings of your Analog Insydes
installation. Each loaded Analog Insydes package contributes a separate version string to this list,
thus the return value of this commands differs depending on the commands used during the current
session. Please always state Version[AnalogInsydes] when reporting problems or bugs.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Print detailed Analog In[2]:= Version[AnalogInsydes]

8Common: 2.157.4.8, Main: 2.96.4.6,


Insydes version
Out[2]=
information.
Master: 2.45.4.1, Miscellaneous: 2.70.4.4<

3.15.6 Info

Info[AnalogInsydes] prints general information of your running Analog Insydes


installation

Command structure of Info.

The command Info[AnalogInsydes] provides general information of the running Analog Insydes
installation. It prints:

path to the Analog Insydes installation directory


list of all init files loaded during startup

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Print general information In[2]:= Info[AnalogInsydes]


on Analog Insydes
Path to Analog Insydes:
installation.
/usr/local/Mathematica/4.0/AddOns/Applications/AnalogIns\
ydes
Init files loaded: {/usr/local/Mathematica/4.0/AddOns/App\
lications/AnalogInsydes/aiinit.m, /home/aiuser/.airc}
Appendix

4.1 Stimuli Sources . . . . . . . . . . . . . . . . . . . . . . . 440

4.2 Netlist Elements . . . . . . . . . . . . . . . . . . . . . . 448

4.3 Model Library . . . . . . . . . . . . . . . . . . . . . . . 462

4.3 Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . 500


440 4. Appendix

4.1 Stimuli Sources


This chapter describes time-dependent (HSPICE-compatible) sources which can be used for numerical
circuit simulations. The following table shows the supported time-dependent stimuli sources and
their corresponding Analog Insydes functions:

AMWave (Section 4.1.1) amplitude-modulated source


ExpWave (Section 4.1.2) exponential source
PulseWave (Section 4.1.3) pulse source
PWLWave (Section 4.1.4) piecewise linear source
SFFMWave (Section 4.1.5) frequency-modulated source
SinWave (Section 4.1.6) sinusoidal source

4.1.1 AMWave

AMWave[time, u1 , u0 , fm, fc, td]


describes a time-dependent amplitude modulation source

Command structure of AMWave.

AMWave returns a numerical value in case the first argument is numeric, otherwise a CheckedAMWave
is returned. CheckedAMWave is a data type which marks a AMWave description as being syntactically
correct. CheckedAMWave should not be defined directly.
A CheckedAMWave can be displayed with standard Mathematica graphic functions such as Plot or
with Analog Insydes graphic functions such as TransientPlot .
AMWave has the following optional arguments:
4.1 Stimuli Sources 441

argument name default value

u1 0 [V] or [A] voltage or current amplitude


u0 0 offset constant
fm 1 [Hz] modulation frequency
fc 1 [Hz] carrier frequency
td 0 [s] delay time

Arguments of AMWave.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define time-dependent In[2]:= Vam[t_] = AMWave[t, 10, 1, 100, 1.*^3, 1.*^−3]


amplitude modulated
Out[2]=
source. CheckedAMWave@t, 10., 1., 100., 1000., 0.001D

Display the signal. In[3]:= TransientPlot[Vam[t], {t, 0, 5.*^−3}]

20

10

Vam[t]
t
0.001 0.002 0.003 0.004 0.005

-10

-20

Out[3]= … Graphics …

4.1.2 ExpWave

ExpWave[time, u0 , u1 , tdr, taur, tdf, tauf]


describes a time-dependent exponential source

Command structure of ExpWave .

ExpWave returns a numerical value in case the first argument is numeric, otherwise a CheckedExpWave
is returned. CheckedExpWave is a data type which marks a ExpWave description as being syntactically
correct. CheckedExpWave should not be defined directly.
442 4. Appendix

A CheckedExpWave can be displayed with standard Mathematica graphic functions such as Plot or
with Analog Insydes graphic functions such as TransientPlot .
ExpWave has the following optional arguments:

argument name default value

u0 0 [V] or [A] initial value of voltage or current


u1 0 [V] or [A] pulsed value of voltage or current
tdr 0 [s] rise delay time
taur 1 [s] rise time constant
tdf 0 [s] fall delay time
tauf 1 [s] fall time constant

Arguments of ExpWave.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define time-dependent In[2]:= Vexp[t_] = ExpWave[t, 1, −1, 1, 0.1, 2]


exponential source. Out[2]= CheckedExpWave@t, 1., -1., 1., 0.1, 2., 1.D

Display the signal. In[3]:= TransientPlot[Vexp[t], {t, 0, 8}]

0.5

Vexp[t]
t
2 4 6 8

-0.5

-1

Out[3]= … Graphics …
4.1 Stimuli Sources 443

4.1.3 PulseWave

PulseWave[time, u0 , u1 , td, tr, tf, pw, per]


describes a time-dependent pulse source

Command structure of PulseWave .

PulseWave returns a numerical value in case the first argument is numeric, otherwise a
CheckedPulseWave is returned. CheckedPulseWave is a data type which marks a PulseWave
description as being syntactically correct. CheckedPulseWave should not be defined directly.
A CheckedPulseWave can be displayed with standard Mathematica graphic functions such as Plot
or with Analog Insydes graphic functions such as TransientPlot .
PulseWave has the following optional arguments:

argument name default value

u0 0 [V] or [A] initial value for voltage or current pulse


u1 0 [V] or [A] pulse value for voltage or current pulse
td 0 [s] delay time
tr 0 [s] rise time
tf 0 [s] fall time
pw 0 [s] pulse width
per $MaxMachineNumber [s] pulse period

Arguments of PulseWave .

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define time-dependent In[2]:= Vpulse[t_] =


pulse source. PulseWave[t, 0.5, 2, 0.2, 0.2, 0.3, 0.3, 0.9]
Out[2]=
CheckedPulseWave@t, 0.5, 2., 0.2, 0.2, 0.3, 0.3, 0.9D
444 4. Appendix

Display the signal. In[3]:= TransientPlot[Vpulse[t], {t, 0, 2}]

2
1.8
1.6
1.4
Vpulse[t]
1.2
t
0.5 1 1.5 2
0.8
0.6

Out[3]= … Graphics …

4.1.4 PWLWave

PWLWave[time, data, delay, repeat]


describes a time-dependent piecewise linear source

Command structure of PWLWave.

PWLWave returns a numerical value in case the first argument is numeric, otherwise a CheckedPWLWave
is returned. If the last argument is not specified PWLWave returns an interpolating function object.
CheckedPWLWave is a data type which marks a PWLWave description as being syntactically correct.
CheckedPWLWave should not be defined directly.
A CheckedPWLWave can be displayed with standard Mathematica graphic functions such as Plot or
with Analog Insydes graphic functions such as TransientPlot .
PWLWave has the following optional arguments:

argument name default value

data {{0, 0}} [s, V] or [s, A] data pairs {{t1 , v1 }, † † † } of time values
and voltage or current values
delay 0 [s] delay time
repeat Null [s] time point at which the waveform is to
be repeated

Arguments of PWLWave.
4.1 Stimuli Sources 445

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Select data pairs. In[2]:= data = {{0.1, 0}, {0.5, 0}, {1, 1}, {1.5, 1},
{2, 0.5}, {2.5, 0.5}, {3, 0}};
Define piecewise linear In[3]:= Vpwl1[t_] = PWLWave[t, data]
source.
InterpolatingFunction@88-1.79769 ´ 10308 , 1.79769 ´ 10308 <<, <>D@tD
Out[3]=

Define repeated piecewise In[4]:= Vpwl2[t_] = PWLWave[t, data, 0.5, 1]


linear source.
Out[4]=

88-1.79769 ´ 10308 , 1.79769 ´ 10308 <<, <>D, 0.5, 1., 3.D


CheckedPWLWave@t, InterpolatingFunction@

Display the signals. In[5]:= TransientPlot[{Vpwl1[t], Vpwl2[t]}, {t, −1, 7}]

0.8
Vpwl1[t]
0.6

0.4 Vpwl2[t]

0.2

t
2 4 6

Out[5]= … Graphics …

4.1.5 SFFMWave

SFFMWave[time, u0 , u1 , fc, mi, fs]


describes a time-dependent single-frequency frequency
modulation source

Command structure of SFFMWave .

SFFMWave returns a numerical value in case the first argument is numeric, otherwise a
CheckedSFFMWave is returned. CheckedSFFMWave is a data type which marks a SFFMWave description
as being syntactically correct. CheckedSFFMWave should not be defined directly.
A CheckedSFFMWave can be displayed with standard Mathematica graphic functions such as Plot or
with Analog Insydes graphic functions such as TransientPlot .
SFFMWave has the following optional arguments:
446 4. Appendix

argument name default value

u0 0 [V] or [A] voltage or current offset


u1 0 [V] or [A] voltage or current amplitude
fc 1 [Hz] carrier frequency
mi 0 modulation index
fs 1 [Hz] signal frequency

Arguments of SFFMWave.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define time-dependent In[2]:= Vfm[t_] = SFFMWave[t, 0, 1.*^6, 2.*^4, 10, 5.*^3]


frequency modulated
Out[2]=
source.
CheckedSFFMWave@t, 0., 1. ´ 106 , 20000., 10., 5000.D

Display the signal. In[3]:= TransientPlot[Vfm[t], {t, 0, 2.*^−4}]

6
1. 10

500000

Vfm[t]
t
0.00005 0.0001 0.00015 0.0002

-500000

6
-1. 10

Out[3]= … Graphics …

4.1.6 SinWave

SinWave[time, u0 , u1 , freq, td, alpha, phi]


describes a time-dependent sinusoidal source

Command structure of SinWave.

SinWave returns a numerical value in case the first argument is numeric, otherwise a CheckedSinWave
is returned. CheckedSinWave is a data type which marks a SinWave description as being syntactically
correct. CheckedSinWave should not be defined directly.
4.1 Stimuli Sources 447

A CheckedSinWave can be displayed with standard Mathematica graphic functions such as Plot or
with Analog Insydes graphic functions such as TransientPlot .
SinWave has the following optional arguments:

argument name default value

u0 0 [V] or [A] voltage or current offset


u1 0 [V] or [A] voltage or current amplitude
freq 1 [Hz] frequency
td 0 [s] delay time
alpha 0 [s-1 ] damping factor
é
phi 0 [] phase delay

Arguments of SinWave.

Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘

Define time-dependent In[2]:= Vsin[t_] = SinWave[t, 0.5, 1, 2, 0.2, 1.5, 180]


sinusoidal source.
Out[2]=
CheckedSinWave@t, 0.5, 1., 2., 0.2, 1.5, 180.D

Display the signal. In[3]:= TransientPlot[Vsin[t], {t, 0, 3}]

1
0.8
0.6
0.4 Vsin[t]

0.2
t
0.5 1 1.5 2 2.5 3
-0.2

Out[3]= … Graphics …
448 4. Appendix

4.2 Netlist Elements


Analog Insydes supports the following primitive electrical circuit and control network elements:

element type type tag

Resistor R Section 4.2.1


Conductance G Section 4.2.2
Admittance Y Section 4.2.3
Impedance Z Section 4.2.4
Capacitor C Section 4.2.5
Inductor L Section 4.2.6
OpenCircuit OC Section 4.2.7
ShortCircuit SC Section 4.2.8

Linear two-terminal elements.

element type type tag

CurrentSource I Section 4.2.9


VoltageSource V Section 4.2.10

Independent sources.

element type type tag

CCCSource CC Section 4.2.11


CCVSource CV Section 4.2.12
VCCSource VC Section 4.2.13
VCVSource VV Section 4.2.14
OpAmp OP Section 4.2.15
OTAmp OT Section 4.2.16

Controlled sources.
4.2 Netlist Elements 449

element type type tag

Nullator NUL Section 4.2.17


Norator NOR Section 4.2.18
Fixator FIX Section 4.2.19

Singular network elements.

element type type tag

SignalSource HS Section 4.2.20


Amplifier HP Section 4.2.21
Integrator HI Section 4.2.22
Differentiator HD Section 4.2.23
TransmissionLine HT Section 4.2.24
TransferFunction H Section 4.2.25

Control network elements.

4.2.1 Resistor

type name syntax

Resistor {Rname, {node1, node2}, valueR }


denotes a linear resistor

Circuit element type Resistor.

R
node1 node2

Modified nodal equation setup for admittances is influenced by the value-field option Pattern. Note
that the symbol Admittance is also a possible option value for the value-field option Pattern.
450 4. Appendix

4.2.2 Conductance

type name syntax

Conductance {Gname, {node1, node2}, valueG }


denotes a linear conductance

Circuit element type Conductance .

G
node1 node2

Modified nodal equation setup for conductances is influenced by the value-field option Pattern.

4.2.3 Admittance

type name syntax

Admittance {Yname, {node1, node2}, valueY }


denotes a linear (complex) admittance

Circuit element type Admittance .

Y
node1 node2

Modified nodal equation setup for admittances is influenced by the value-field option Pattern. Note
that the symbol Admittance is also a possible option value for the value-field option Pattern .

4.2.4 Impedance

type name syntax

Impedance {Zname, {node1, node2}, valueZ }


denotes a linear (complex) impedance

Circuit element type Impedance .

Z
node1 node2
4.2 Netlist Elements 451

Modified nodal equation setup for impedances is influenced by the value-field option Pattern . Note
that the symbol Impedance is also a possible option value for the value-field option Pattern .

4.2.5 Capacitor

type name syntax

Capacitor {Cname, {node1, node2}, valueC }


denotes a linear capacitor

Circuit element type Capacitor.

node1 node2

Modified nodal equation setup for capacitors is influenced by the value-field option Pattern .

4.2.6 Inductor

type name syntax

Inductor {Lname, {node1, node2}, valueL }


denotes a linear inductor

Circuit element type Inductor.

L
node1 node2

Modified nodal equation setup for inductors is influenced by the value-field option Pattern.

4.2.7 OpenCircuit

type name syntax

OpenCircuit {OCname, {node1, node2}, 0}


denotes an open-circuit branch

Circuit element type OpenCircuit .


452 4. Appendix

node1

V1
node2

An open-circuit branch is essentially the same as an independent current source with zero source
current. The value specification is ignored. However, it should be set to 0 (zero) to reflect the fact
that the source current is zero. Note that open circuits are mostly used implicitly as controlling
branches of voltage-controlled sources but they may also be used explicitly in a netlist when a
voltage meter is needed. In the latter case, modified nodal analysis employs a special matrix fill-in
pattern which augments the vector of unknown node voltages by the branch voltage across the open
circuit. This allows for directly computing the differential voltage between two nodes neither of
which is ground. Without the voltage sensor, two node voltages would have to be solved for and
then subtracted from one another, which would be computationally more expensive.

4.2.8 ShortCircuit

type name syntax

ShortCircuit {SCname, {node1, node2}, 0}


denotes a short-circuit branch

Circuit element type ShortCircuit .

node1

I1
node2

A short-circuit branch is essentially the same as a voltage source with zero source voltage. The
value specification is ignored. However, it should be set to 0 (zero) to reflect the fact that the
source voltage is zero. Note that short circuits are mostly used implicitly as controlling branches of
current-controlled sources. They may also be used explicitly as current meters in combination with
modified nodal analysis.
4.2 Netlist Elements 453

4.2.9 CurrentSource

type name syntax

CurrentSource {Iname, {node+, node−}, valueI0 }


denotes an independent current source

Circuit element type CurrentSource .

node+

I0
node-

The positive reference direction for the source current is from node+ to node−.

4.2.10 VoltageSource

type name syntax

VoltageSource {Vname, {node+, node−}, valueV0 }


denotes an independent voltage source

Circuit element type VoltageSource .

node+

V0

node-

The positive reference direction for the source voltage as well as the current through the source is
from node+ to node−.
454 4. Appendix

4.2.11 CCCSource

type name syntax

CCCSource {CCname, {cnode+, cnode−, node+, node−}, valuebeta }


denotes a linear current-controlled current
source (CCCS) with gain valuebeta

Circuit element type CCCSource .

cnode+ node+

I1
beta*I1
cnode- node-

The terminals of the controlling branch are denoted by cnode+ and cnode−. The positive reference
direction for the sensor current and the source current is from cnode+ to cnode− and from node+ to
node−, respectively. Note that Analog Insydes automatically inserts a short circuit in between cnode+
and cnode− as a current meter. As opposed to the SPICE netlist format there is no need to add a
sensor voltage source to the netlist.

4.2.12 CCVSource

type name syntax

CCVSource {CVname, {cnode+, cnode−, node+, node−}, valuer }


denotes a linear current-controlled voltage
source (CCVS) with transresistance valuer

Circuit element type CCVSource .

cnode+ node+

I1 r*I1

cnode- node-

The terminals of the controlling branch are denoted by cnode+ and cnode−. The positive reference
direction for the sensor current and the source voltage is from cnode+ to cnode− and from node+ to
4.2 Netlist Elements 455

node−, respectively. Note that Analog Insydes automatically inserts a short circuit in between cnode+
and cnode− as a current meter. As opposed to the SPICE netlist format there is no need to add a
sensor voltage source to the netlist.

4.2.13 VCCSource

type name syntax

VCCSource {VCname, {cnode+, cnode−, node+, node−}, valuegm }


denotes a linear voltage-controlled current
source (VCCS) with transconductance
valuegm

Circuit element type VCCSource.

cnode+ node+

V1
gm*V1
cnode- node-

The terminals of the controlling branch are denoted by cnode+ and cnode−. Note that as opposed to
the SPICE netlist format the controlling nodes are listed before the terminals of the controlled branch.

4.2.14 VCVSource

type name syntax

VCVSource {VVname, {cnode+, cnode−, node+, node−}, valuev }


denotes a linear voltage-controlled voltage
source (VCVS) with voltage gain valuev

Circuit element type VCVSource.

cnode+ node+

V1 v*V1

cnode- node-
456 4. Appendix

The terminals of the controlling branch are denoted by cnode+ and cnode−. Note that as opposed to
the SPICE netlist format the controlling nodes are listed before the terminals of the controlled branch.

4.2.15 OpAmp

type name syntax

OpAmp {OPname, {cnode+, cnode−, node+, node−}, valuev }


denotes an ideal operational amplifier with
finite or infinite gain valuev

Circuit element type OpAmp.

cnode+

V1 node+
v*V1
cnode- node-

For infinite gain, valuev must be Infinity . Note that, functionally, an OpAmp is the same as a
voltage-controlled voltage source. The difference to a VCVSource is that during circuit equation
setup another matrix fill-in pattern is used which makes limit calculations for large OpAmp gains
easier.

4.2.16 OTAmp

type name syntax

OTAmp {OTname, {cnode+, cnode−, node+, node−}, valuegm }


denotes an ideal operational
transconductance amplifier with finite or
infinite gain valuegm

Circuit element type OTAmp.

cnode+
gm*V1
V1 node+

cnode- node-
4.2 Netlist Elements 457

For infinite gain, valuegm must be Infinity . Note that, functionally, an OTAmp is the same as a
voltage-controlled current source. The difference to a VCCSource is that during circuit equation
setup another matrix fill-in pattern is used which makes limit calculations for large OTAmp gains
easier.

4.2.17 Nullator

type name syntax

Nullator {NULname, {node1, node2}, 0}


denotes a nullator

Circuit element type Nullator.

node1

V=0
I=0
node2

A nullator is an ideal two-terminal circuit element which enforces both a zero voltage and a zero
current between its terminals. It is thus neither a voltage nor a current source but rather both at
the same time. The value specification in the netlist entry of a nullator is irrelevant and should be
set to 0 (zero). Note that an element with a arbitrary but fixed branch current and branch voltage
is also known as a fixator. With a zero current and voltage, a nullator is a special case of a fixator.
A nullator usually appears paired with a norator, thus forming a nullor. A nullor represents a
controlled source of arbitrary type with infinite gain, such as an ideal operational amplifier.

4.2.18 Norator

type name syntax

Norator {NORname, {node1, node2}, 0}


denotes a norator

Circuit element type Norator.


458 4. Appendix

node1

node2

A Norator is an ideal two-terminal circuit element which imposes no constraints on its branch current
and voltage. The value specification is ignored and should be set to 0 (zero). Note that a norator
usually appears paired with a nullator, thus forming a nullor. A nullor represents a controlled source
of arbitrary type with infinite gain, such as an ideal operational amplifier.

4.2.19 Fixator

type name syntax

Fixator {FIXname, {node+, node−}, {valueI0 , valueV0 }}


denotes a fixator

Circuit element type Fixator .

node+

V0
I0
node-

A fixator is an ideal two-terminal circuit element which enforces both a fixed voltage and a fixed
current between its terminals. It is thus neither a voltage nor a current source but rather both at the
same time. Note that the netlist entry for fixators has a special form because two element values,
a source current and a source voltage, must be specified. Fixators are hardly ever used for circuit
analysis purposes. Their main application field is circuit sizing where they can be used to model
operating points of nonlinear devices such as transistors.
4.2 Netlist Elements 459

4.2.20 SignalSource

type name syntax

SignalSource {HSname, {output}, valueX }


denotes a signal source in a control network

Circuit element type SignalSource .

X(s) output

Signal sources do not have an input node. Therefore, the connectivity field contains only the node
identifier of the output node.

4.2.21 Amplifier

type name syntax

Amplifier {HPname, {input, output}, valueA }


denotes a proportional amplifier with
amplification valueA

Circuit element type Amplifier.

input A output
460 4. Appendix

4.2.22 Integrator

type name syntax

Integrator {HIname, {input, output}, valueTi }


denotes an integrator with an integration
time constant valueTi

Circuit element type Integrator .

input Ti output

4.2.23 Differentiator

type name syntax

Differentiator {HDname, {input, output}, valueTd }


denotes a differentiator with a
differentiation time constant valueTd

Circuit element type Differentiator .

input Td output

4.2.24 TransmissionLine

type name syntax

TransmissionLine {HTname, {input, output}, valueT }


denotes an ideal lossless transmission line
with a delay time constant valueT

Circuit element type TransmissionLine .


4.2 Netlist Elements 461

input T output

4.2.25 TransferFunction

type name syntax

TransferFunction {Hname, {input, output}, valuetfunc }


denotes a generic transfer function block

Circuit element type TransferFunction .

input H(s) output

The transfer function valuetfunc may be any function of the Laplace frequency variable s. To avoid
confusion with the other control network element types the block name must not begin with the
letters S, P, I, D, or T.
462 4. Appendix

4.3 Model Library


The Analog Insydes model library provides full-precision SPICE-compatible models for the most
important devices such as Diodes (Section 4.3.1), BJTs (Section 4.3.2), MOSFETs (Section 4.3.3), and
JFETs (Section 4.3.4).
Each section contains two subsections describing the large-signal as well as the small-signal model.
Following an equivalent circuit schematic the particular model parameters are introduced including
their default values and a short description. Note that the default values of the small-signal
parameters are given symbolically with the suffix "$ac" as they are automatically generated by
ReadNetlist (Section 3.10.1). Each model section concludes with a description of those parameters
which are influenced by the automatic model-complexity reduction controlled via the global Analog
Insydes option ModelLibrary (Section 3.14.4).

4.3.1 Diode

syntax
{Dname, {n1 −>A, n2 −>C}, Model−>Diode, Selector−>selector, parameters}
denotes a subcircuit reference for a Diode

Subcircuit reference for Diode.

A C

Valid values for selector are: Spice, SpiceDC , SpiceAC, and SpiceNoise . Possible parameters are
described below.

Large-Signal Model
The analog behavioral model included in the Analog Insydes model library has the following port
characteristics:

Voltage[A,C]
A C
Current[A,C]

where A denotes the Anode and C the Cathode, respectively. The port currents can be expressed in
the port variables as follows:
4.3 Model Library 463

Anode: iA (t) = Current[A,C](t)


Cathode: iC (t) = -Current[A,C](t)

RS

CJ

id

Equivalent schematic for the DC and transient analysis

RS

CJ GLEAK CD CJSW GLEAKSW


is isw

Equivalent schematic for the DC and transient analysis (simulator Spectre)

The large-signal model includes the following model parameters:


464 4. Appendix

parameter name default value

BV ¥ [V] reverse breakdown voltage


IBV 1.0 ‰ 10-3 [A] reverse breakdown current
IS 1.0 ‰ 10-14 [A] saturation current
N 1.0 emission coefficient
NBV (NZ) 1.0 reverse breakdown coefficient

DC related model parameters.

parameter name default value

GLEAK 0 [W-1 ] leakage conductance


RS 0 [W] ohmic resistance

Parasitic resistance related model parameters.

parameter name default value

CD 0 [F] depletion capacitance


CJO 0 [F] zero-bias junction capacitance
FC 0.5 forward-bias depletion capacitance
coefficient
M 0.5 grading coefficient
TT 0 [s] transit time
VJ (PB) 1.0 [V] junction potential

Capacitance related model parameters.


4.3 Model Library 465

parameter name default value

CJSW 0 [F] zero-bias junction sidewall capacity


GLEAKSW 0 [W-1 ] sidewall leakage conductance
ISW 0 [A] saturation current
MJSW 0.33 sidewall junction capacitance grading
coefficient
NS 1.0 emission coefficient
PERIM 0 perimeter
VJSW 1.0 [V] sidewall junction potential

Sidewall related model parameters.

parameter name default value

EG 1.11 [eV] energy gap


TBV 0 [K-1 ] linear temperature coefficient for BV (* )
TBV2 0 [K-2 ] quadratic temperature coefficient for BV (* )
TEMP 300.15 [K] model temperature
TGS 0 [K-1 ] linear temperature coefficient for GLEAK,
GLEAKSW (* )
TGS2 0 [K-2 ] quadratic temperature coefficient for GLEAK,
GLEAKSW (* )
TLEV 0 temperature model level (* )
TLEVC 0 temperature model level (* )
TNOM 300.15 [K] nominal temperature
TRS 0 [K-1 ] linear temperature coefficient for RS (* )
TRS2 0 [K-2 ] quadratic temperature coefficient for RS (* )
XTI 3.0 saturation current temperature exponent

Temperature related model parameters.


466 4. Appendix

parameter name default value

AF 1.0 flicker noise exponent


KF 0 flicker noise coefficient

Noise related model parameters.

parameter name default value

AREA 1.0 relative device area


GMIN 1.0 ‰ 10-12 [W-1 ] minimum conductance
LEVEL 1 model index

Miscellaneous model parameters.

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:

parameter name FullModels SimplifiedModels BasicModels

BV used used default


CD used default default
CJSW used default default
GLEAK used default default
GLEAKSW used default default
ISW used default default
RS used default default
TT used default default

Simplification related model parameters.

Furthermore several temperature parameters (marked as (* ) above) are set to default values for
SimplifiedModels and BasicModels.
4.3 Model Library 467

Small-Signal Model

Rs

Rd Cd

Equivalent schematic for the AC analysis

The small-signal model includes the following model parameters:

parameter name default value

Cd CAP$ac junction and diffusion capacitance


Rd REQ$ac small-signal resistance
Rs RS/AREA resistance

Small-signal model parameters.

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:

parameter name FullModels SimplifiedModels BasicModels

Rs used ignored ignored

Simplification related model parameters.


468 4. Appendix

4.3.2 Bipolar Junction Transistor

syntax
{Qname, {n1 −>C, n2 −>B, n3 −>E, n4 −>S}, Model−>BJT, Selector−>selector, parameters}
denotes a subcircuit reference for a BJT

Subcircuit reference for BJT.

C C

B B

E E

Valid values for selector are: GummelPoon , GummelPoonDC , Spice, SpiceDC, SpiceAC, and SpiceNoise .
Possible parameters are described below. Please note that the substrate port S is optional.

Large-Signal Model
The analog behavioral model included in the Analog Insydes model library has the following port
characteristics:

C Voltage[C,S]
Current[C,S]
Voltage[B,S]

B S

Current[B,S]
Voltage[E,S]
Current[E,S]
E

where B denotes the Base, C the Collector, E the Emitter, and S the Substrate, respectively. The port
currents can be expressed in the port variables as follows:
4.3 Model Library 469

Base: iB (t) = Current[B,S](t)


Collector: iC (t) = Current[C,S](t)
Emitter: iE (t) = Current[E,S](t)
Substrate: iS (t) = -ICurrent[B,S](t) + Current[C,S](t) + Current[E,S](t)M

RC

ics
CBX CBC CJS
RB
B S

CBE ic
ib

RE

Equivalent schematic for the DC and transient analysis for the vertical bipolar transistor (NPN, PNP)
470 4. Appendix

RC

CBX CBC
RB
B

CXS CJS CBE ic


ibs ib

S RE

Equivalent schematic for the DC and transient analysis for the lateral bipolar transistor (LPNP)

The large-signal model includes the following model parameters:


4.3 Model Library 471

parameter name default value

BF 100.0 ideal maximum forward current gain


BR 1.0 ideal maximum reverse current gain
IKF (IK) ¥ [A] corner current for forward-beta high-current
roll-off
IKR ¥ [A] corner current for reverse-beta high-current
roll-off
IS 1.0 ‰ 10-16 [A] transport saturation current
ISC (C4) 0 [A] base-collector leakage saturation current
ISE (C2) 0 [A] base-emitter leakage saturation current
ISS 0 [A] substrate junction saturation current
NC 2.0 base-collector leakage emission coefficient
NE 1.5 base-emitter leakage emission coefficient
NF 1.0 forward current emission coefficient
NK 0.5 high-current roll-off coefficient
NR 1.0 reverse current emission coefficient
NS (NSS) 1.0 substrate junction emission coefficient
VAF (VA) ¥ [V] forward early voltage
VAR (VB, VBAR) ¥ [V] reverse early voltage

DC related model parameters.

parameter name default value

IRB ¥ [A] current at which RB falls halfway to its


minimum value
RB 0 [W] zero-bias base ohmic resistance
RBM RB [W] minimum base ohmic resistance
RC 0 [W] collector ohmic resistance
RE 0 [W] emitter ohmic resistance

Parasitic resistance related model parameters.


472 4. Appendix

parameter name default value

CJC (CTC) 0 [F] zero-bias base-collector depletion


capacitance
CJE (CTE) 0 [F] zero-bias base-emitter depletion capacitance
CJS (CCS, CTS) 0 [F] zero-bias substrate capacitance
FC 0.5 forward-bias depletion capacitance
coefficient
MJC (MC) 0.33 base-collector junction grading factor
MJE (ME) 0.33 base-emitter junction grading factor
MJS (MS) 0 substrate junction grading factor
VJC (PC) 0.75 [V] base-collector built-in potential
VJE (PE) 0.75 [V] base-emitter built-in potential
VJS (PS) 0.75 [V] substrate junction built-in potential
XCJC 1.0 fraction of base-collector capacitance
connected to internal base node
XJBS 1.0 fraction of base-substrate capacitance
connected to internal base node (for lateral
devices only)

Junction capacitance related model parameters.

parameter name default value

ITF 0 [A] transit time dependency on collector current


PTF 0 [é ] excess phase at f = 1/(2Π TF) Hz
TF 0 [s] ideal forward transit time
TR 0 [s] ideal reverse transit time
VTF ¥ [V] transit time dependency on base-collector
voltage
XTF 0 transit time bias dependence coefficient

Dynamic model parameters.


4.3 Model Library 473

parameter name default value

EG 1.11 [eV] energy gap

GAP1 7.02 ‰ 10-4 [eV K-1 ]


first bandgap correction factor
GAP2 1108.0 [K] second bandgap correction factor
TEMP 300.15 [K] model temperature
TIKF1 0 [K-1 ] linear temperature coefficient for IKF (* )
TIKF2 0 [K-2 ] quadratic temperature coefficient for IKF (* )
TIKR1 0 [K-1 ] linear temperature coefficient for IKR (* )
TIKR2 0 [K-2 ] quadratic temperature coefficient for IKR (* )
TIRB1 0 [K-1 ] linear temperature coefficient for IRB (* )
TIRB2 0 [K-2 ] quadratic temperature coefficient for IRB (* )
TITF1 0 [K-1 ] linear temperature coefficient for ITF (* )
TITF2 0 [K-2 ] quadratic temperature coefficient for ITF (* )
TLEV 0 temperature modeling level (* )
TLEVC 0 temperature modeling level (* )

Temperature related model parameters.


474 4. Appendix

parameter name default value

TMJC1 0 [K-1 ] linear temperature coefficient for MJC (* )


TMJC2 0 [K-2 ] quadratic temperature coefficient for MJC (* )
TMJE1 0 [K-1 ] linear temperature coefficient for MJE (* )
TMJE2 0 [K-2 ] quadratic temperature coefficient for MJE (* )
TMJS1 0 [K-1 ] linear temperature coefficient for MJS (* )
TMJS2 0 [K-2 ] quadratic temperature coefficient for MJS (* )
TNC1 0 [K-1 ] linear temperature coefficient for NC (* )
TNC2 0 [K-2 ] quadratic temperature coefficient for NC (* )
TNE1 0 [K-1 ] linear temperature coefficient for NE (* )
TNE2 0 [K-2 ] quadratic temperature coefficient for NE (* )
TNF1 0 [K-1 ] linear temperature coefficient for NF (* )
TNF2 0 [K-2 ] quadratic temperature coefficient for NF (* )
TNOM 300.15 [K] nominal temperature
TNR1 0 [K-1 ] linear temperature coefficient for NR (* )
TNR2 0 [K-2 ] quadratic temperature coefficient for NR (* )
TNS1 0 [K-1 ] linear temperature coefficient for NS (* )
TNS2 0 [K-2 ] quadratic temperature coefficient for NS (* )
TRB1 0 [K-1 ] linear temperature coefficient for RB
TRB2 0 [K-2 ] quadratic temperature coefficient for RB

Temperature related model parameters.


4.3 Model Library 475

parameter name default value

TRC1 (TRC) 0 [K-1 ] linear temperature coefficient for RC


TRC2 0 [K-2 ] quadratic temperature coefficient for RC
TRE1 (TRE) 0 [K-1 ] linear temperature coefficient for RE
TRE2 0 [K-2 ] quadratic temperature coefficient for RE
TRM1 (TRBM1) 0 [K-1 ] linear temperature coefficient for RBM
TRM2 (TRBM2) 0 [K-2 ] quadratic temperature coefficient for RBM
TTF1 0 [K-1 ] linear temperature coefficient for TF (* )
TTF2 0 [K-2 ] quadratic temperature coefficient for TF (* )
TTR1 0 [K-1 ] linear temperature coefficient for TR (* )
TTR2 0 [K-2 ] quadratic temperature coefficient for TR (* )
TVAF1 0 [K-1 ] linear temperature coefficient for VAF (* )
TVAF2 0 [K-2 ] quadratic temperature coefficient for VAF (* )
TVAR1 0 [K-1 ] linear temperature coefficient for VAR (* )
TVAR2 0 [K-2 ] quadratic temperature coefficient for VAR (* )
TVTF1 0 [K-1 ] linear temperature coefficient for VTF (* )
TVTF2 0 [K-2 ] quadratic temperature coefficient for VTF (* )
TXTF1 0 [K-1 ] linear temperature coefficient for XTF (* )
TXTF2 0 [K-2 ] quadratic temperature coefficient for XTF (* )
XTB (TB, TCB) 0 forward and reverse beta temperature
exponent
XTI (PT) 3.0 IS temperature effect exponent

Temperature related model parameters.

parameter name default value

AF 1.0 flicker noise exponent


KF 0 flicker noise coefficient

Noise related model parameters.


476 4. Appendix

parameter name default value

AREA 1.0 relative device area


GMIN 1.0 ‰ 10-12 [W-1 ] minimum conductance
LEVEL 1 model index

Miscellaneous model parameters.

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
4.3 Model Library 477

parameter name FullModels SimplifiedModels BasicModels

CJS used default default


IKF used default default
IKR used default default
IRB used default default
ISC used default default
ISE used used default
ISS used default default
ITF used default default
PTF used default default
RB used used default
RBM used used default
RC used default default
RE used default default
TF used default default
TLEV used default default
TLEVC used default default
TR used default default
VAF used used default
VAR used used default
VTF used default default
XCJC used used default
XJBS used used default
XTF used default default

Simplification related model parameters.

Furthermore several temperature parameters (marked as (* ) above) are set to default values for
SimplifiedModels and BasicModels.
478 4. Appendix

Small-Signal Model

Rc Cjs
S

Cbx Gmu Cbc


Rx
B Ro

vpi Rpi Cbe gm*vpi

Re

Equivalent schematic for the AC analysis for the vertical bipolar transistor (NPN, PNP)

Rc

Cbx Gmu Cbc


Rx
B Ro

Cxs Cjs vpi Rpi Cbe gm*vpi

S Re

Equivalent schematic for the AC analysis for the lateral bipolar transistor (LPNP)

The small-signal model includes the following model parameters:


4.3 Model Library 479

parameter name default value

Cbc CBC$ac (CMU$ac) base collector capacitance


Cbe CBE$ac (CPI$ac) base emitter capacitance
Cbx CBX$ac external base collector capacitance
Cjs CJS$ac (CBS$ac, CCS$ac)
substrate capacitance
Cxs CXS$ac external base substrate capacitance (for
lateral devices only)
gm GM$ac transconductance
Gmu GMU$ac base collector conductance
Rc RC/AREA collector resistance
Re RE/AREA emitter resistance
Ro RO$ac collector emitter resistance
Rpi RPI$ac base emitter resistance
Rx RX$ac base resistance

Small-signal model parameters.

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:

parameter name FullModels SimplifiedModels BasicModels

Cjs used used ignored


Cxs used used ignored
Gmu used ignored ignored
Rc used ignored ignored
Re used ignored ignored
Rx used ignored ignored

Simplification related model parameters.


480 4. Appendix

4.3.3 MOS Field-Effect Transistor

syntax
{Mname, {n1 −>D, n2 −>G, n3 −>S, n4 −>B}, Model−>MOSFET, Selector−>selector, parameters}
denotes a subcircuit reference for a MOSFET

Subcircuit reference for MOSFET.

D D

G B G B

S S

Valid values for selector are: Spice, SpiceDC , SpiceAC, and SpiceNoise . Possible parameters are
described below.

Large-Signal Model
The analog behavioral model included in the Analog Insydes model library has the following port
characteristics:
D Voltage[D,B]
Current[D,B]

Voltage[G,B]
G B
Current[G,B]
Voltage[S,B]
Current[S,B]
S

where G denotes the Gate, D the Drain, S the Source, and B the Bulk, respectively. The port currents
can be expressed in the port variables as follows:

Gate: iG (t) = Current[G,B](t)


Drain: iD (t) = Current[D,B](t)
Source: iS (t) = Current[S,B](t)
Bulk: iB (t) = -ICurrent[G,B](t) + Current[D,B](t) + Current[S,B](t)M
4.3 Model Library 481

CGB RD

ibd
CGD CBD

G B

CGS ids CBS


ibs

RS

Equivalent schematic for the DC and transient analysis

The large-signal model includes the following model parameters:


482 4. Appendix

parameter name default value

GAMMA 0 [ V] bulk threshold parameter


IS 1.0 ‰ 10-14 [A] bulk junction saturation current
JS 0 [A m-2 ] bottom bulk junction saturation current
density

JSSW 0 [A m-1 ] sidewall bulk junction saturation current


density
KP 2.0 ‰ 10-5 [A V-2 ] transconductance parameter
2.0718 ‰ 10-5 [A V-2 ] Spectre only
LAMBDA 0 [V-1 ] channel length modulation
N 1.0 bulk junction emission coefficient
PHI 0.6 [V] surface potential
0.7 [V] Spectre only
VTO 0 [V] zero-bias threshold voltage

DC related model parameters.

parameter name default value

L DEFL [m] channel length


LD 0 [m] lateral diffusion length
W DEFW [m] channel width
WD 0 [m] lateral diffusion width

Area related model parameters.


4.3 Model Library 483

parameter name default value

NRD DEFNRD [square] number of squares for drain resistance


NRS DEFNRS [square] number of squares for source resistance
RD 0 [W] drain ohmic resistance
RDS ¥ [W] drain source shunt resistance
RS 0 [W] source ohmic resistance
RSH 0 [W / square] drain and source diffusion sheet resistance

Parasitic resistance related model parameters.

parameter name default value

CBD 0 [F] zero-bias bulk drain capacitance


CBS 0 [F] zero-bias bulk source capacitance
-2
CJ 0 [F m ] zero-bias bottom bulk capacitance

CJSW 0 [F m-1 ] zero-bias sidewall bulk capacitance


FC 0.5 forward-bias bulk junction capacitance
coefficient
MJ 0.5 bulk junction bottom grading coefficient
MJSW 0.33 bulk junction sidewall grading coefficient
PB 0.8 [V] bulk bottom junction potential
PBSW 0.8 [V] bulk sidewall junction potential

Junction capacitance related model parameters.

parameter name default value

CGBO 0 [F m-1 ] gate-bulk overlap capacitance

CGDO 0 [F m-1 ] gate-drain overlap capacitance

CGSO 0 [F m-1 ] gate-source overlap capacitance


TT 0 [s] transit time

Dynamic model parameters.


484 4. Appendix

parameter name default value

LAMEX 0 [K-1 ] temperature parameter for LAMBDA


TEMP 300.15 [K] model temperature
TLEV 0 temperature model level
TLEVC 0 temperature model level
TNOM 300.15 [K] nominal temperature
TRD 0 [K-1 ] temperature parameter for RD
TRS 0 [K-1 ] temperature parameter for RS
XTI 3.0 saturation current temperature exponent

Temperature related model parameters.

parameter name default value

AF 1.0 flicker noise exponent


KF 0 flicker noise coefficient

Noise related model parameters.

parameter name default value

AD DEFAD [m2 ] drain diffusion area


AS DEFAS [m2 ] source diffusion area
GMIN 1.0 ‰ 10-12 [W-1 ] minimum conductance
LEVEL 1 model index
M DEFM device multiplier
PD DEFPD [m] drain diffusion perimeter
PS DEFPS [m] source diffusion perimeter

Miscellaneous model parameters.


4.3 Model Library 485

parameter name default value

DEFAD 0 [m 2 ] default value for AD


DEFAS 0 [m 2 ] default value for AS
DEFL 1.0 ‰ 10-4 [m] default value for L
DEFM 1.0 default value for M
DEFNRD 1.0 [square] default value for NRD
0. [square] Spectre only
DEFNRS 1.0 [square] default value for NRS
0. [square] Spectre only
DEFPD 0 [m] default value for PD
DEFPS 0 [m] default value for PS
DEFW 1.0 ‰ 10-4 [m] default value for W

Parameter defaults set by global options.

parameter name default value

NSS 0 [cm-2 ] surface state density


NSUB 6.0 ‰ 1016 [cm-3 ] substrate doping density
1.13 ‰ 1016 [cm-3 ] Spectre only
TOX 1.0 ‰ 10-7 [m] oxide thickness
TPG 1 gate material type
UO 600.0 [cm2 V-1 s-1 ] surface mobility

Process related model parameters.

The DC related model parameters GAMMA, KP, PHI, and VTO are computed from process parameters in
case of given process parameters. Note that these values can always be overwritten by user-defined
parameter values.
GAMMA is computed using NSUB, if the latter is set explicitely.
KP is computed using UO, if the latter is set explicitely.
PHI is computed using NSUB, if the latter is set explicitely.
VTO is computed using NSS and TPG, if these are set explicitely.
486 4. Appendix

If TOX is set, the gate capacitances CGB, CGD, and CGS (Spice Meyer model) are included in the
dynamic MOSFET model in addition to the gate overlap capacitances CGBO, CGDO, and CGSO.
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:

parameter name FullModels SimplifiedModels BasicModels

CGBO used used default


CGDO used used default
CGSO used used default
CJSW used default default
GAMMA used used default
RD used default default
RDS used default default
RS used default default
RSH used default default
TT used default default

Simplification related model parameters.


4.3 Model Library 487

Small-Signal Model

Cgb Rd

Cgd Gbd Cbd

G Gds B
gm*vgs
Cgs gmb*vbs Gbs Cbs

vgs Rs vbs

Equivalent schematic for the AC analysis for the level 1-3 model
488 4. Appendix

s*DqdDvgb*vgb
s*DqdDvdb*vdb
s*DqdDvsb*vsb
D

Cgb vgd Rd vbd

s*DqbDvgb*vgb
Cgd Gbd Cbd s*DqbDvdb*vdb
s*DqbDvsb*vsb
G Gds B
gm*vgs
Cgs gmb*vbs Gbs Cbs

vgs Rs vbs

s*DqgDvgb*vgb s*DqsDvgb*vgb
S
s*DqgDvdb*vdb s*DqsDvdb*vdb
s*DqgDvsb*vsb s*DqsDvsb*vsb

Equivalent schematic for the AC analysis for the BSIM model (simulator PSpice)
4.3 Model Library 489

s*Cdd*vd
s*Cdg*vg
s*Cds*vs
s*Cdb*vb
D

Rd

vgd
Gbd vbd s*Cbd*vd
s*Cbg*vg
G Gds B s*Cbs*vs
gm*vgs s*Cbb*vb

vgs gmb*vbs Gbs vbs

Rs
s*Cgd*vd
s*Cgg*vg S s*Csd*vd
s*Cgs*vs s*Csg*vg
s*Cgb*vb s*Css*vs
s*Csb*vb

Equivalent schematic for the AC analysis for the BSIM model (simulator Eldo)

The small-signal model includes the following model parameters:


490 4. Appendix

parameter name default value

Cbd CBD$ac bulk drain capacitance


Cbs CBS$ac bulk source capacitance
Cgb CGB$ac+CGBOV$ac gate bulk capacitance
Cgd CGD$ac+CGDOV$ac gate drain capacitance
Cgs CGS$ac+CGSOV$ac gate source capacitance
Gbd GBD$ac bulk drain conductance
Gbs GBS$ac bulk source conductance
Gds GDS$ac drain source conductance
gm GM$ac transconductance
gmb GMB$ac bulk transconductance
Rd RD drain resistance
Rs RS source resistance

Level 1-3 small-signal model parameters.


4.3 Model Library 491

parameter name default value

Cbdb DQBDVDB$ac derivative of bulk charge w.r.t. drain bulk


voltage
Cbgb DQBDVGB$ac derivative of bulk charge w.r.t. gate bulk
voltage
Cbsb DQBDVSB$ac derivative of bulk charge w.r.t. source bulk
voltage
Cddb DQDDVDB$ac derivative of drain charge w.r.t. drain bulk
voltage
Cdgb DQDDVGB$ac derivative of drain charge w.r.t. gate bulk
voltage
Cdsb DQDDVSB$ac derivative of drain charge w.r.t. source bulk
voltage
Cgdb DQGDVDB$ac derivative of gate charge w.r.t. drain bulk
voltage
Cggb DQGDVGB$ac derivative of gate charge w.r.t. gate bulk
voltage
Cgsb DQGDVSB$ac derivative of gate charge w.r.t. source bulk
voltage
Csdb DQSDVDB$ac derivative of source charge w.r.t. drain bulk
voltage
Csgb DQSDVGB$ac derivative of source charge w.r.t. gate bulk
voltage
Cssb DQSDVSB$ac derivative of source charge w.r.t. source
bulk voltage

Additional small-signal model parameters for BSIM PSpice.


492 4. Appendix

parameter name default value

Cb Cbb$ac derivative of bulk charge w.r.t. bulk


potential
Cbd0 Cbd$ac derivative of bulk charge w.r.t. drain
potential
Cbg0 Cbg$ac derivative of bulk charge w.r.t. gate
potential
Cbs0 Cbs$ac derivative of bulk charge w.r.t. source
potential
Cdb0 Cdb$ac derivative of drain charge w.r.t. bulk
potential
Cd Cdd$ac derivative of drain charge w.r.t. drain
potential
Cdg0 Cdg$ac derivative of drain charge w.r.t. gate
potential
Cds0 Cds$ac derivative of drain charge w.r.t. source
potential
Cgb0 Cgb$ac derivative of gate charge w.r.t. bulk
potential
Cgd0 Cgd$ac derivative of gate charge w.r.t. drain
potential
Cg Cgg$ac derivative of gate charge w.r.t. gate potential
Cgs0 Cgs$ac derivative of gate charge w.r.t. source
potential
Csb0 Csb$ac derivative of source charge w.r.t. bulk
potential
Csd0 Csd$ac derivative of source charge w.r.t. drain
potential
Csg0 Csg$ac derivative of source charge w.r.t. gate
potential
Cs Css$ac derivative of source charge w.r.t. source
potential

Additional small-signal model parameters for BSIM Eldo.

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
4.3 Model Library 493

parameter name FullModels SimplifiedModels BasicModels

Cgb used ignored ignored


Gbd used used ignored
Gbs used used ignored
gmb used used ignored
Rd used ignored ignored
Rs used ignored ignored

Simplification related level 1-3 model parameters.

parameter name FullModels SimplifiedModels BasicModels

Cbd0 used used ignored


Cbg0 used used ignored
Cbs0 used used ignored
Cdb0 used used ignored
Cdg0 used used ignored
Cds0 used used ignored
Cgb0 used used ignored
Cgd0 used used ignored
Cgs0 used used ignored
Csb0 used used ignored
Csd0 used used ignored
Csg0 used used ignored

Simplification related BSIM Eldo model parameters.

4.3.4 Junction Field-Effect Transistor

syntax
{Jname, {n1 −>D, n2 −>G, n3 −>S}, Model−>JFET, Selector−>selector, parameters}
denotes a subcircuit reference for a JFET

Subcircuit reference for JFET.


494 4. Appendix

D D

G G

S S

Valid values for selector are: Spice, SpiceDC , SpiceAC, and SpiceNoise . Possible parameters are
described below.

Large-Signal Model
The analog behavioral model included in the Analog Insydes model library has the following port
characteristics:

D
Voltage[D,G]
Current[D,G]

Voltage[S,G]
Current[S,G]
S

where G denotes the Gate, D the Drain, and S the Source, respectively. The port currents can be
expressed in the port variables as follows:

Drain: iD (t) = Current[D,G](t)


Source: iS (t) = Current[S,G](t)
Gate: iG (t) = -ICurrent[D,G](t) + Current[S,G](t)M
4.3 Model Library 495

RD

igd
CGD

CGS ids
igs

RS

Equivalent schematic for the DC and transient analysis

The large-signal model includes the following model parameters:

parameter name default value

ALPHA 0 [V-1 ] ionization coefficient


BETA 1.0 ‰ 10-4 [A V-2 ] transconductance coefficient
IS 1.0 ‰ 10-14 [A] gate junction saturation current
ISR 0 [A] gate junction recombination current
parameter
LAMBDA 0 [V-1 ] channel length modulation
N 1.0 gate junction emission coefficient
NR 2.0 emission coefficient for ISR
VK 0 [V] ionization knee voltage
VTO -2.0 [V] threshold voltage

DC related model parameters.


496 4. Appendix

parameter name default value

RD 0 [W] drain ohmic resistance


RS 0 [W] source ohmic resistance

Parasitic resistance related model parameters.

parameter name default value

CGD 0 [F] zero-bias gate drain junction capacitance


CGS 0 [F] zero-bias gate source junction capacitance
FC 0.5 forward depletion capacitance coefficient
M 0.5 gate junction grading coefficient
PB 1.0 [V] gate junction potential

Capacitance related model parameters.


4.3 Model Library 497

parameter name default value

BETATCE (BETATC) 0 [K-1 ] BETA exponential temperature coefficient


BTE 0 [K] BETA temperature parameter
BTO 0 BETA temperature parameter
EG 1.11 [eV] energy gap
TC1 0 [K-1 ] RD, RS temperature coefficient
TC2 0 [K-2 ] RD, RS temperature coefficient
TEMP 300.15 [K] model temperature
TLEV 0 temperature model level
TLEVC 0 temperature model level
TNOM 300.15 [K] nominal temperature
TRD1 0 [K-1 ] RD temperature coefficient
TRS1 0 [K-1 ] RS temperature coefficient
VTOTC 0 [V K-1 ] VTO temperature coefficient
XTI 3.0 saturation current temperature exponent

Temperature related model parameters.

parameter name default value

AF 1.0 flicker noise exponent


KF 0 flicker noise coefficient

Noise related model parameters.

parameter name default value

AREA 1.0 relative device area


GMIN 1.0 ‰ 10-12 [W-1 ] minimum conductance
LEVEL 1 model index

Miscellaneous model parameters.


498 4. Appendix

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:

parameter name FullModels SimplifiedModels BasicModels

ALPHA used default default


ISR used used default
RD used default default
RS used default default
VK used default default

Simplification related model parameters.

Small-Signal Model

Rd

Ggd Cgd

G Gds

vgs Ggs Cgs gm*vgs

Rs

Equivalent schematic for the AC analysis

The small-signal model includes the following model parameters:


4.3 Model Library 499

parameter name default value

Cgd CGD$ac gate drain capacitance


Cgs CGS$ac gate source capacitance
Gds GDS$ac drain source conductance
Ggd GGD$ac gate drain conductance
Ggs GGS$ac gate source conductance
gm GM$ac transconductance
Rd RD/AREA drain resistance
Rs RS/AREA source resistance

Small-signal model parameters.

The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:

parameter name FullModels SimplifiedModels BasicModels

Ggd used used ignored


Ggs used used ignored
Rd used ignored ignored
Rs used ignored ignored

Simplification related model parameters.


Credits

Developers Director Fraunhofer ITWM


Dr. rer. nat. Jochen Broz Prof. Dr. Dieter Prätzel-Wolters
Dipl.-Math. Alexander Dreyer
Dipl.-Ing. Thomas Halfmann Head of Department Adaptive Systems

Dr.-Ing. Eckhard Hennig Dr. rer. nat. Patrick Lang

Dr.-Ing. Ralf Sommer


Dr.-Ing. Manfred Thole Design and Cover Art

Dr. rer. nat. Tim Wichmann Juliette Armbrecht


Dipl.-Math. Steffen Grützner

Contributions Dipl. BK Gertrud Schrenk

Michael Brickenstein
Dipl.-Math. Yves Drexlmeier
Stefan Feitig
Dipl.-Ing. Jutta Praetorius
Uldis Strautins
Dipl.-Math. Jan Mark Tweer
Dipl.-Math. Michael Wiese
Anton Winterfeld
Index

ABM (analog behavioral model), 92 options description for, 323


AbsolutePivotThreshold, option for ApproximateMatrixEquation, 137, 138, 392
ApproximateMatrixEquation, 395 examples for, 397
AbsoluteValues, option value for MagnitudeDisplay, options description for, 395
84, 335 ApproximateTransferFunction, 135, 389
AC, mode option for source value specification, 187 examples for, 390
mode specification for NonlinearSetup, 406 Approximation, design point specification, 138
option value for AnalysisMode, 232 methods, 135
AC analysis, 284 of expressions, 135
ACAnalysis, 284 of linear circuits, 130, 387
example application, 162 of linear equations, ApproximateMatrixEquation,
examples for, 286 137, 392
options description for, 285 of nonlinear circuits, 167, 403
AccuracyGoal, option for ApproximateDeterminant, 323 of nonlinear equations, CancelTerms, 168, 412
option for LREigenpair, 316 of transfer functions,
option for NDAESolve, 293 ApproximateTransferFunction, 389
ACEquations, 250 AspectFactor, option for BodePlot, 333
examples for, 251 AspectRatio, option for BodePlot, 333
options description for, 250 AutoloadModels, option for ExpandSubcircuits, 224
AddElements, 258
examples for, 258 BasicModels, option value for ModelLibrary, 429
Admittance, 450 Behavioral models, 92
option value for Pattern, 185 defining, 92
option value for Type, 45 referencing, 96
Admittance elements, 45 Bias point calculation, example for, 102
AI_NO_SITE_INIT, 435 Bipolar junction transistor (BJT), 468
AI_NO_USER_INIT, 435 BJT, 468
AI_NO_WORKDIR_INIT, 435 example implementation, 100
aiinit.m, 434 large-signal model, 468
airc, 434 small-signal model, 478
Amplifier, 459 Bode diagram, 83, 332
AMWave, 440 BodePlot, 83, 332
examples for, 441 examples for, 336
Analog behavioral models (ABM), 92 options description for, 334
AnalogArtist, option value for Simulator, 431 Branch currents, naming scheme for, 72
AnalogInsydes, option value for Simulator, 431 Branch voltages, naming scheme for, 72
AnalysisMode, option for CircuitEquations, 232 BranchCurrentPrefix, option for CircuitEquations,
option for NDAESolve, 295 72, 233
ApplyDesignPoint, 271 Branches, of controlled sources, 37, 40
examples for, 273 BranchVoltagePrefix, option for CircuitEquations,
options description for, 272 72, 233
ApproximateDeterminant, 320 BreakOnError, option for NDAESolve, 296
examples for, 329 Bug reports, 12
502 UnitCircleStyle — ZeroStyle Index

CancelTerms, 168, 412 Control system description, Circuit, 181


example application, 175 Controlled sources, 37, 40
examples for, 416 Controlling branch, of controlled sources, 40
options description for, 413 Controlling currents, naming scheme for, 72
Capacitor, 451 Controlling voltages, naming scheme for, 72
Capacitors, initial conditions for, 46 ControllingCurrentPrefix, option for
CCCSource, 454 CircuitEquations, 72, 233
CCVSource, 454 ControllingVoltagePrefix, option for
CharacterMapping, option for ReadNetlist, 368 CircuitEquations, 72, 234
CheckedAMWave, data type returned by AMWave, 440 ConvertDataTo2D, 420
CheckedExpWave, data type returned by ExpWave, 442 examples for, 421
CheckedPulseWave, data type returned by PulseWave, ConvertImmittances, option for CircuitEquations, 76,
443 234
CheckedPWLWave, data type returned by PWLWave, 444 CrossMark, marker style for options PoleStyle and
CheckedSFFMWave, data type returned by SFFMWave, 445 ZeroStyle, 89, 355
CheckedSinWave, data type returned by SinWave, 447 Current, into pin, 95
CircleMark, marker style for options PoleStyle and naming scheme for brach currents, 72
ZeroStyle, 89, 355 naming scheme for controlling currents, 72
Circuit, 48, 181 reference direction, 158
examples for, 181 Current, 94
Circuit equations, setting up and solving, 229 Current meter, 452
Circuit object, 180 Current-controlled sources, connection, 40
information on, Statistics, 279 CurrentSource, 453
manipulating, 257
showing contents, DisplayForm, 49 DAE (differential-algebraic equations), 106
Circuit-description language, 180 DAEObject, information on, Statistics, 279
CircuitEquations, 73, 229, 233, 236, 237, 238 manipulating, 257
examples for, 241 showing contents, DisplayForm, 42
options description for, 232 Data format, 282
Cleanup, option for ApplyDesignPoint, 272 Database, for subcircuits, 64
option for UpdateDesignPoint, 275 DataLabels, option for WriteSimulationData, 382
Clusterbound, option for CancelTerms, 414 DC, mode option for source value specification, 187
CMRR, 154 option value for AnalysisMode, 232, 295
ColorList, option for DXFGraphics, 424 DC analysis, 292
Common-mode gain, 152 DC-transfer analysis, 109, 113, 292
Common-mode rejection ratio, 154 DCEquations, 252
Compatibility to Version 1, 30 examples for, 254
Compiled, option for NDAESolve, 293 options description for, 253
option for WriteSimulationData, 381 Decibels, option value for MagnitudeDisplay, 335
Complex frequency, 81 DefaultACError, option value for ErrorFunction, 406
Complexity problem, 130 DefaultACSimulation, option value for
ComplexityEstimate, 132, 387 SimulationFunction, 406
examples for, 388 DefaultDTError, option value for ErrorFunction, 404
ComplexValues, option for WriteSimulationData, 381 DefaultDTSimulation, option value for
CompressEquations, option for SimulationFunction, 404
ApproximateMatrixEquation, 395 Defaults, parameter for Model, 198
option for NDAESolve, 296 DefaultSelector, option for CircuitEquations, 234
CompressMatrixEquation, 400 option for ExpandSubcircuits, 225
examples for, 401 Definition, parameter for Model, 50, 92, 94, 202
CompressNonlinearEquations, 97, 168, 409 Degrees, option value for PhaseDisplay, 335, 345
example application, 174 DeleteElements, 259
examples for, 411 examples for, 260
options description for, 410 Demo notebooks, 11
Conductance, 450 DerivativePostfix, option for ACEquations, 250, 251
Connectivity field, format for referencing subcircuits, 53 Design points, applying, ApplyDesignPoint, 271
Connectivity list, 36 extracting, GetDesignPoint, 270
Index Design points — GetDesignPoint 503

for matrix approximation, 138 ErrorFunction, AC mode option value for


generation of, 161 NonlinearSetup, 406
numerical reference values, 134 DT mode option value for NonlinearSetup, 404
updating, UpdateDesignPoint, 274 option for ApproximateDeterminant, 324
DesignPoint, option for ApproximateDeterminant, 323 ESTA (extended sparse tableau analysis), 78
option for ApproximateMatrixEquation, 395 ExpandSubcircuits, 55, 223
option for CircuitEquations, 235 examples for, 226
option for LREigenpair, 316 options description for, 224
option for MatchSymbols, 276 Expansion, of subcircuits, 55
option for NDAESolve, 296 Exponential, option value for FrequencyScaling, 87,
option for NoiseAnalysis, 289 334, 345, 349
option for WriteModel, 384 option value for Sampling, 382
Device mismatch, 152 Exporting, behavioral models, WriteModel, 383
Differential gain, 151 simulation data, WriteSimulationData, 380
Differential-algebraic equations (DAE), 106 ExpWave, 441
Differentiator, 460 examples for, 442
Diode, 462 Extended sparse tableau analysis (ESTA), 78
example model implementation, 93 ExtendedTableau, option value for Formulation, 78, 236
large-signal model, 462
small-signal model, 467 Features, new features in version 2.1, 25
DirectedLogError, option value for ErrorFunction, 324 detailed description of new features, 27
DisplayForm, 36, 42, 49 overview of new features, 26
Dominant pole, 162 Fill-in pattern, 45
DT analysis, 109, 113, 292 FillColors, option for DXFGraphics, 423
DXF, 421 FindModel, 215
DXFGraphics, 421 examples for, 215
examples for, 424 FindModelParameters, 216
options description for, 423 FindRoot, option value for NonlinearMethod, 299
Fixator, 458
Ebers-Moll transistor model, example for, 98 Flat netlist, 55
Eldo, option value for Simulator, 431 Formulation, option for CircuitEquations, 76, 236
Element types, 39 Four-terminal elements, 37
Element values, 38 FourierPlot, 343
numerical values, 43 examples for, 343
symbolic values, 43 Frequency, 188
Elements, admittance elements, 45 Frequency-domain analysis, 145
impedance elements, 45 FrequencyScaling, option for BodePlot, 334
ElementTypes, 39, 187 option for NicholPlot, 88, 345
examples for, 187 option for NyquistPlot, 87, 349
ElementValues, option for CircuitEquations, 81, 235 FrequencyVariable, option for ACAnalysis, 285
EliminateVariables, option for option for ACEquations, 250, 251
CompressNonlinearEquations, 410 option for ApproximateDeterminant, 324
Email address, 6 option for CircuitEquations, 81, 236
Environment variables, 435 option for LREigenpair, 316
Equations, compressing nonlinear equations, option for NoiseAnalysis, 289
CompressNonlinearEquations, 168, 409 FullModels, option value for ModelLibrary, 429
extracting, GetEquations, 262
for behavioral models, 94 GeneralizedEigensystem, 307
setting up, CircuitEquations, 229 examples for, 307
solving nonlinear equations, 97 option value for GEPSolver, 324
solving of, 74 GeneralizedEigenvalues, 308
Equations, parameter value for Definition, 92, 94 examples for, 308
Error, specification for equations, MaxError, 138 GEPSolver, option for ApproximateDeterminant, 324
specification for expressions, 136 GEPSolverOptions, option for
Errorbound, option for CancelTerms, 414 ApproximateDeterminant, 324
GetDAEOptions, 267
504 GetDAEOptions — Junction field-effect transistor (JFET) Index

examples for, 267 Independent sources, examples for value specification,


GetDesignPoint, 270 188
examples for, 271 value specification, 187
GetElements, 260 IndependentVariable, option for CircuitEquations,
examples for, 261 237
GetEquations, 262 Inductor, 451
examples for, 262 Inductors, initial conditions for, 46
GetMatrix, 263 Info, 437
examples for, 264 examples for, 437
GetParameters, 266 Init files, 434
examples for, 266 list of loaded init files, 437
GetRHS, 265 Initial conditions, for capacitors and inductors, 46
examples for, 265 transient analysis, 123
GetVariables, 264 InitialCondition, option for netlist entries, 46, 185
examples for, 264 InitialConditions, example application, 124, 125
Global, parameter specification, 198 option for CircuitEquations, 238
parameter value for Scope, 64, 93, 195 option for NDAESolve, 296
Global Options, 427 option for WriteModel, 384
Global subcircuit database, 64 parameter for Model, 205
examining content, GlobalSubcircuits, 64 InitialGuess, option for CircuitEquations, 231
Global subcircuits, 63 option for DefaultDTSimulation, 405
GlobalModelParameters, 217 option for LREigenpair, 317
examples for, 217 option for NDAESolve, 121, 297
GlobalParameters, 191 option for WriteModel, 384
GlobalSubcircuits, 64, 216 parameter for Model, 205
examples for, 217 Initialization procedure, 434
Graphics, Bode plot, 83, 332 InitialLeftEigenvector, option value for
Nichol plot, 87, 344 ProjectionVectors, 318, 327
Nyquist plot, 85, 347 InitialRightEigenvector, option value for
root locus plot, 88, 353 ProjectionVectors, 318, 327
transient waveform plot, 91, 108, 358 InitialSolution, option for ApproximateDeterminant,
GraphicsSpacing, option for BodePlot, 334 325
Ground node, 36, 52, 183 option for NDAESolve, 121, 297
missing, CircuitEquations, 237 InitialTime, option for CircuitEquations, 238
option for DCEquations, 253
Hierarchical circuit, keep local model data, Input impedance, 154
KeepLocalModels, 226 InputNoise, return value of NoiseAnalysis, 287
stop expansion, HoldModels, 225 InstanceNameSeparator, global Analog Insydes option,
History list, recording, 415 428
visualization of, ShowCancellations, 419 option for CircuitEquations, 73, 230
HoldModels, 225 option for ExpandSubcircuits, 224
option for ExpandSubcircuits, 225 option for ReadNetlist, 367
Home page, 6 option for ShortenSymbols, 279
Integrator, 460
IgnoreMissingGround, option for CircuitEquations, Interfaces, 366
237 InterpolateResult, option for ACAnalysis, 285
Impedance, input, 154 InterpolationOrder, option for ACAnalysis, 285
output, 154 option for NDAESolve, 297
Impedance, 450 option for NoiseAnalysis, 289
option value for Pattern, 185 option for ReadSimulationData, 378
option value for Type, 45 option for WriteSimulationData, 382
Impedance elements, 45
Importing, netlists, ReadNetlist, 366 Jacobian matrix, 160
schematics, DXFGraphics, 421 JFET, 493
simulation data, ReadSimulationData, 377 large-signal model, 494
small-signal model, 498
Index Junction field-effect transistor (JFET) — Model 505

Junction field-effect transistor (JFET), 493 LogError, option value for ErrorFunction, 324
LPNP, 468
KeepLocalModels, 226 LREigenpair, 314
option for ExpandSubcircuits, 226 examples for, 318
KeepPrefix, option for ReadNetlist, 368 option value for GEPSolver, 324
KeepSymbolic, option for ApplyDesignPoint, 272 options description for, 316

Laplace frequency, 81 MagnitudeDisplay, option for BodePlot, 84, 334


Laplace-domain, AC equation setup, 232 MappingFiles, option for ReadSimulationData, 378
Large-signal analysis, 292 MAST, modeling language supported by WriteModel,
introduction, 106 385
Large-signal model, BJT, 468 Matching, of devices, 152
Diode, 462 precision, 153
JFET, 494 MatchSymbols, 152, 276
MOSFET, 480 example application, 152
LayerColor, option for DXFGraphics, 423 examples for, 277
LeastMeanInfluence, option value for SortingMethod, options description for, 276
396 Mathlink applications, MSBG.exe, 426
LeftEigenvector, option value for ProjectionVectors, QZ.exe, 426
318, 327 Matrix formulation, CircuitEquations, 236
Level, option for CancelTerms, 414 MatrixEquation, option for CircuitEquations, 80, 231
Levels, for nonlinear approximations, ShowLevel, 419 MaxDelta, option for NDAESolve, 121, 298
LevelSeparator, option for ReadNetlist, 368 MaxDivergentSteps, option for
Library, list contents, ListLibrary, 213 ApproximateDeterminant, 325
searching models, FindModel, 215 MaxError, 138
LibraryPath, global Analog Insydes option, 428 AC mode option value for NonlinearSetup, 406
option for CircuitEquations, 231 DT mode option value for NonlinearSetup, 404
option for ExpandSubcircuits, 224 named parameter for error specifications in design
option for FindModel, 215 points, 393
option for FindModelParameters, 216 MaxIterations, 122
option for ListLibrary, 214 option for ApproximateDeterminant, 325
option for LoadModel, 218 option for DefaultDTSimulation, 405
option for LoadModelParameters, 220 option for LREigenpair, 317
option for ReadNetlist, 368 option for NDAESolve, 122, 298
License, 436 MaxResidual, option for ApproximateDeterminant, 325
examples for, 436 option for LREigenpair, 317
Linear, option value for FrequencyScaling, 87, 334, MaxShift, option for ApproximateDeterminant, 326
345, 349 MaxSteps, 122
option value for MagnitudeDisplay, 84, 335 option for NDAESolve, 122, 298
option value for Sampling, 382 MaxStepSize, option for NDAESolve, 122, 298
Linearization, of nonlinear DAEObjects, 250 MinMAC, option for ApproximateDeterminant, 326
LinearRegionLimit, option for RootLocusPlot, 354 MinStepSize, option for NDAESolve, 122, 298
LinearRegionSize, option for RootLocusPlot, 354 Mismatch of devices, 152
LinearRegionStyle, option for RootLocusPlot, 354 MNA (modified nodal analysis), 76
LineDashingScale, option for DXFGraphics, 423 Model, behavioral models, 92
ListLibrary, 213 definition of, 192
examples for, 214 exchanging device models, 189
Loading Analog Insydes, 11 expanding, 223
Loading procedure, 434 exporting, WriteModel, 383
LoadModel, 218 global model library, 64
examples for, 219 loading from library, LoadModel, 218
LoadModelParameters, 219 model library, 462
LoadMSBG, 426 parameter cards, 191
LoadQZ, 426 referencing, 52, 189
Local, parameter value for Scope, 64, 195 variables of behavioral models, 95
Local subcircuits, 63, 65 Model, 49, 190, 192
506 Model — OperatingPointPostfix Index

argument description, 193 NicholPlot, 87, 344


defining behavioral models, 92 examples for, 346
examples for model implementation, 206 options description for, 345
option for netlist entries, 47 NMOS, 480
Model library, 462 small-signal model, 145
defining global model library, 64 Node identifier, 36
library management, 213 Node voltages, naming scheme for, 72
ModelLibrary, examples for, 429 Nodes, 36, 183, 196
global Analog Insydes option, 429 NodeVoltagePrefix, option for CircuitEquations, 72,
option for CircuitEquations, 232 238
option for ExpandSubcircuits, 224 Noise analysis, 287
option for FindModel, 215 NoiseAnalysis, 287
option for FindModelParameters, 216 examples for, 290
option for ListLibrary, 214 options description for, 289
option for LoadModel, 218 Nonlinear approximation, CancelTerms, 168, 412
option for LoadModelParameters, 220 example application for, 169
ModelParameters, 191 setting up, NonlinearSetup, 403
ModeValues, option for DCEquations, 253 status of, NonlinearSettings, 417
Modified nodal analysis (MNA), 76 term levels, ShowLevel, 419
ModifiedNodal, option value for Formulation, 76, 236 Nonlinear equation solving, NDAESolve, 118
MOS field-effect transistor, 480 number of integration steps, MaxSteps, 122
MOSFET, 480 number of Newton iterations, MaxIterations, 122
advanced modeling, 160 Nonlinear equations, compressing,
large-signal model, 480 CompressNonlinearEquations, 168, 409
modeling examples, 146 setting up, 96
small-signal model, 145, 487 solving, 97
MSBG.exe, 426 NonlinearMethod, option for NDAESolve, 122, 298
NonlinearSettings, 417
Name, parameter for Model, 50, 193 examples for, 418
Name/selector specification, 51 NonlinearSetup, 403
Naming conventions, 72 AC mode specifications for, 406
NDAESolve, 107, 118, 292 DT mode specifications for, 404
examples for, 301 example application, 174
implemented algorithms, 118 examples for, 407
options description for, 121, 295 Norator, 457
Netlist, format of, 35, 180 Normalize, option for GeneralizedEigensystem, 307
importing, ReadNetlist, 366 Notebook, option value for Protocol, 430
Netlist, 180, 187 NPN, 468
examples for, 180 Nullator, 457
Netlist entries, examples for, 183 Numerical solving, ACAnalysis, 284
extended format, 43 NDAESolve, 292
format, 36, 182 NoiseAnalysis, 287
format for subcircuit references, 52, 62 NumericalAccuracy, option for
option examples for, 186 ApproximateMatrixEquation, 395
options, 184 Nyquist diagram, 85, 347
Netlist object, 180 NyquistPlot, 85, 347
information on, Statistics, 279 examples for, 349
manipulating, 257 options description for, 348
showing contents, DisplayForm, 36
New features in Analog Insydes Version 2, 26 Online help system, 23
New in Version 2.1, 25 OP analysis, 292
Newsletter, 6 OpAmp, 456
Newton-Raphson algorithm, 119 OpenCircuit, 451
NewtonIteration, example application, 113 Operating point, 121
option value for NonlinearMethod, 299 Operating-point analysis, 292
Nichol diagram, 87, 344
Index OperatingPointPostfix — ReadNetlist 507

OperatingPointPostfix, option for ACEquations, 250, PMOS, 480


251 small-signal model, 145
Option inheritance, 432 PNP, 468
examples for, 432 PointMark, marker style for options PoleStyle and
Optional, model port specification, 196 ZeroStyle, 89, 355
Options, global Analog Insydes options, 427 PointsPerDecade, option for ACAnalysis, 286
of netlist entries, 43 option for NoiseAnalysis, 289
retrieving DAEObject options, GetDAEOptions, 267 Pole/zero analysis, 306
setting DAEObject options, SetDAEOptions, 268 PolesAndZerosByQZ, 309
setting default options on startup, 435 examples for, 309
Options[AnalogInsydes], 427 PolesByQZ, 310
examples for, 428 examples for, 311
OTAmp, 456 PoleStyle, option for RootLocusPlot, 89
Output impedance, 154 Ports, of behavioral models, 94
example application, 155 optional port nodes, 196
OutputNoise, return value of NoiseAnalysis, 287 port currents, 94
OutputVariables, option for NDAESolve, 299 port voltages, 94
Ports, parameter for Model, 50, 196
Palette, 23 Prefix, customizing prefix settings, 72
Parameter sweep, 282 for branch voltages and currents, 72
examples for, 283 for controlling voltages and currents, 72
Parameters, declaration for subcircuits, 59 for node voltages, 72
implicit translation, 67 specification, CircuitEquations, 233, 238
inspecting parameter database, Prescaling, option for ApproximateDeterminant, 326
GlobalModelParameters, 217 option for LREigenpair, 317
loading from library, LoadModelParameters, 219 PrimaryDesignPoint, option value for SortingMethod,
of subcircuits, 58 396
removing, RemoveModelParameters, 221 Process, global circuit parameter, 369
Parameters, parameter for Model, 59, 62, 197 process design kit, UserPDKMap, 369
Parametric, option for TransientPlot, 127, 360 ProjectionVectors, option for
Parametric analysis, 292 ApproximateDeterminant, 327
example circuit, 116 option for LREigenpair, 317
ParseOnly, option for ReadNetlist, 368 Protocol, examples for, 431
option for ReadSimulationData, 378 global Analog Insydes option, 430
Pattern, option for netlist entries, 45, 185 PSpice, option value for Simulator, 431
PDK, UserPDKMap, 369 PulseWave, 443
PDKVersion, global circuit parameter, 369 examples for, 443
PhaseDisplay, option for BodePlot, 84, 335 PWLWave, 444
option for NicholPlot, 88, 345 examples for, 445
PivotThreshold, option for
ApproximateMatrixEquation, 395 QuasiSingularity, option for
PlotPoints, option for BodePlot, 334 ApproximateMatrixEquation, 396
option for FourierPlot, 343 QZ.exe, 426
option for RootLocusPlot, 354
option for WriteSimulationData, 382 Radians, option value for PhaseDisplay, 335, 345
PlotRange, option for BodePlot, 84, 335 RandomFunction, option for NDAESolve, 299
option for RootLocusPlot, 355 Range, AC mode option value for NonlinearSetup, 406
option for TransientPlot, 360 DT mode option value for NonlinearSetup, 404
Plots, Bode plot, 83, 332 Ranking, least mean influence, 144
Nichol plot, 87, 344 of terms, 143
Nyquist plot, 85, 347 Ranking, option for CancelTerms, 415
root locus plot, 88, 353 ReadNetlist, 366
transient waveform plot, 91, 108, 358 example application, 148
PlotStyle, option for RootLocusPlot, 355 examples for, 370
PlusMark, marker style for options PoleStyle and options description for, 368
ZeroStyle, 89, 355 supported features for AnalogArtist, 370
508 ReadNetlist — SinWave Index

supported features for AnalogInsydes, 370 Searching, model parameters, FindModelParameters, 216
supported features for Eldo, 373 models, FindModel, 215
supported features for PSpice, 371 Selector, parameter for Model, 50, 194
supported features for Saber, 376 SetDAEOptions, 268
ReadSimulationData, 377 examples for, 269
examples for, 380 SFFMWave, 445
options description for, 378 examples for, 446
RecomputationThreshold, option for ShortCircuit, 452
ApproximateMatrixEquation, 396 ShortenSymbols, 278
RecordCancellations, option for CancelTerms, 415 options for, 279
Reference designator, 36, 73, 182 ShowCancellations, 419
Reference directions, for currents and voltages, 37, 158 ShowColors, option for DXFGraphics, 423
for port branches, 94 ShowHeader, option for ReadSimulationData, 378
Referencing, behavioral models, 96 ShowLegend, option for BodePlot, 334
subcircuits, 52 option for NicholPlot, 345
ReleaseInfo, 435 option for NyquistPlot, 348
examples for, 435 option for RootLocusPlot, 354
ReleaseNumber, 436 option for TransientPlot, 360
examples for, 436 ShowLevel, 419
RemoveModelParameters, 221 ShowSamplePoints, option for TransientPlot, 128, 360
examples for, 221 ShowUnitCircle, option for NyquistPlot, 349
RemoveSubcircuit, 65, 220 SignalSource, 459
examples for, 221 Simplification, design point specification, 138
RemoveSubcircuits, 65, 220 methods, 135
RenameNodes, 261 of expressions, 135
examples for, 261 of linear circuits, 130, 387
Resistor, 449 of linear equations, ApproximateMatrixEquation,
ReturnDerivatives, option for NDAESolve, 299 137
ReturnSymbols, option for SimplifySamplePoints, 417 of nonlinear circuits, 167, 403
RightEigenvector, option value for of nonlinear equations, CancelTerms, 168, 412
ProjectionVectors, 318, 327 Simplification after generation (SAG), 135, 387
Root locus diagram, 88, 353 combination with SBG, 141
animated, 91 Simplification before generation (SBG), 135, 137, 387
of transfer functions without parameters, 90 combination with SAG, 141
RootLocusByQZ, 312 Simplification during generation (SDG), 135
examples for, 313 SimplifiedModels, option value for ModelLibrary, 429
RootLocusPlot, 88, 353 SimplifySamplePoints, 416
examples for, 356 Simulation data, exporting, WriteSimulationData, 380
options description for, 354 importing, ReadSimulationData, 377
SimulationFunction, AC mode option value for
Saber, option value for Simulator, 431 NonlinearSetup, 406
SAG (simplification after generation), 135, 387 DT mode option value for NonlinearSetup, 404
ApproximateTransferFunction, 389 Simulator, global Analog Insydes option, 431
combination with SBG, 141 option for NDAESolve, 299
Sampling, option for WriteSimulationData, 382 option for ReadNetlist, 369
SBG (simplification before generation), 135, 137, 387 option for ReadSimulationData, 378
ApproximateMatrixEquation, 392 option for WriteModel, 385
combination with SAG, 141 option for WriteSimulationData, 382
Schematic pictures, 421 SimulatorExecutable, option for NDAESolve, 300
Scope, of subcircuit definitions, 63 SingleDiagram, option for TransientPlot, 128, 360
Scope, option for LoadModel, 218 SingularityTest, option for ApproximateDeterminant,
option for LoadModelParameters, 220 328
parameter for Model, 64, 65, 195 SingularityTestByLU, option value for
SDG (simplification during generation), 135 SingularityTest, 328
SearchDirections, option for SimplifySamplePoints, SingularityTestByQR, option value for
417 SingularityTest, 328
Index SinWave — Transistor models 509

SinWave, 446 option for ExpandSubcircuits, 224


examples for, 447 option for netlist entries, 43, 185
Small-signal analysis, 284 option for source value specification, 187
Small-signal model, BJT, 478 option value for ElementValues, 81, 236
Diode, 467 parameter for Model, 200
JFET, 498 Symbolic approximation, complexity problem, 130
MOSFET, 145, 487 design point specification, 138
Solve, 74, 255 introduction, 130
examples for, 255 methods, 135
Solving, ACAnalysis, 284 of expressions, 135
NDAESolve, 292 of linear circuits, 130, 387
NoiseAnalysis, 287 of linear equations, ApproximateMatrixEquation,
Solve, 255 137
SortingMethod, option for of nonlinear circuits, 403
ApproximateMatrixEquation, 143, 396 of nonlinear equations, CancelTerms, 412
Sources, stimuli for two-port calculations, 158 Symbolic expressions, approximation of, 132
Sparse tableau analysis (STA), 77 Symbolic solving, Solve, 255
extended sparse tableau analysis (ESTA), 78
SparseTableau, option value for Formulation, 77, 236 TestFrequency, option for ApproximateDeterminant,
Spectre, option value for Simulator, 431 328
SquareMark, marker style for options PoleStyle and TextSizing, option for DXFGraphics, 423
ZeroStyle, 89, 355 TextStyle, option for DXFGraphics, 423
STA (sparse tableau analysis), 77 ThicknessFunction, option for DXFGraphics, 424
Stability analysis, 85 Time, 188
Starting Analog Insydes, 434 Time variable, 107
StartingStepSize, option for NDAESolve, 123, 300 Time-domain analysis, 106
Statistics, 279 TimeConstraint, option for Statistics, 280
examples for, 281 TimeVariable, option for CircuitEquations, 240
StatusLine, option value for Protocol, 430 Tolerance, option for ApproximateDeterminant, 329
StepSizeFactor, option for NDAESolve, 123, 300 option for LREigenpair, 318
Stimulus sources, 158 option for MatchSymbols, 277
StripIndependentBlocks, option for TraceNames, option for BodePlot, 335
ApproximateMatrixEquation, 397 option for NicholPlot, 345
option for CompressMatrixEquation, 401 option for NyquistPlot, 349
option for CompressNonlinearEquations, 410 Transfer function, approximation,
Subcircuit, definition of, 192 ApproximateTransferFunction, 135
expanding, 55, 223 complexity, ComplexityEstimate, 132
generic selectors, 54 example application, 165
global and local definitions, 63 plotting gain vs. phase, NicholPlot, 87, 344
global database for, 64 plotting magnitude and phase, BodePlot, 83, 332
inspecting subcircuit database, GlobalSubcircuits, plotting real vs. imaginary part, NyquistPlot, 85,
216 347
local overrides, 65 TransferFunction, 461
parameters, 58, 59 Transient, mode option for source value specification,
passing parameter values to, 62 187
redefining global subcircuits, 65 option value for AnalysisMode, 232, 295
referencing, 52 Transient analysis, 292
removing, RemoveSubcircuits, 65, 220 example circuit, 108, 110
translation of parameters, 67 initial conditions, 123
Subcircuit, 49, 190, 212 introduction, 106
option for netlist entries, 47 procedure, 118
SweepParameters, Analog Insydes data format, 282 Transient waveforms, 91, 358
option for TransientPlot, 361 TransientPlot, 108, 358
SweepPath, option for ACAnalysis, 286 examples for, 361
option for NoiseAnalysis, 289 options description for, 127, 359
Symbolic, option for CircuitEquations, 239 Transistor models, 145
510 ZeroStyle — ZeroStyle Index

advanced modeling, 160 Value field, 43


Translation, of subcircuit parameters, 67 Value specification, for different analysis modes,
Translation, parameter for Model, 67, 199 Netlist, 187
TransmissionLine, 460 Variables, independent, CircuitEquations, 237
Trapezoidal rule, 118 of behavioral model equations, 95
Two-port parameters, 157 Variables, parameter for Model, 95, 201
Two-port representation, admittance form, 157 VCCSource, 455
cascade form, 157 VCVSource, 455
hybrid form, 157 Version, 436
impedance form, 157 examples for, 437
Two-terminal elements, 37 Voltage, naming scheme for branch voltages, 72
Type, option for netlist entries, 44, 186 naming scheme for controlling voltages, 72
Type tag, 36 naming scheme for node voltages, 72
for controlled sources, 40 reference direction, 158
overriding default type, 44 Voltage, 94
Voltage gain, 149
UnitCircleStyle, option for NyquistPlot, 349 Voltage meter, 452
Units, 38 VoltageSource, 453
UnloadMSBG, 426
UnloadQZ, 426 Web page, 6
UnwrapPhase, option for BodePlot, 336 WorkingPrecision, option for NDAESolve, 293
UnwrapTolerance, option for BodePlot, 336 WriteModel, 383
UpdateDesignPoint, 274 examples for, 385
examples for, 275 options description for, 384
options description for, 275 WriteSimulationData, 380
UseExternals, global Analog Insydes option, 431 examples for, 382
option for ApproximateMatrixEquation, 397 options description for, 381
UserPDKMap, 369
option for ReadNetlist, 369 Y-parameters, 158

Value, option for CircuitEquations, 240 Zero node, 36, 52


option for ExpandSubcircuits, 224 Zero-state response, 43
option for netlist entries, 43, 183 ZerosByQZ, 311
option for source value specification, 187 examples for, 312
option value for ElementValues, 81, 236 ZeroStyle, option for RootLocusPlot, 89, 355

Das könnte Ihnen auch gefallen