Documentos de Académico
Documentos de Profesional
Documentos de Cultura
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
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.5 Graphics....................................................................................................................................................83
Bode Plots Nyquist Plots Nichol Plots Root Locus Plots Transient Waveforms
3.10 Interfaces.................................................................................................................................................366
ReadNetlist Simulator-Specific Remarks on ReadNetlist ReadSimulationData WriteSimulationData
WriteModel
Part 4. Appendix
4.1 Stimuli Sources........................................................................................................................................440
AMWave ExpWave PulseWave PWLWave SFFMWave SinWave
Credits..............................................................................................................................................................500
Index................................................................................................................................................................501
A Short Introduction
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
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.
(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.
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.
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:
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.
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.
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
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 ´ 33D
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
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.
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
Out[9]= Graphics
Analog Insydes provides several standard graphic functions for visualizing numerical analysis results,
see Chapter 2.5 and Chapter 3.9.
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
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.
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.
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[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.
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
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
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
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
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
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]
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.
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
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
Graphics Functions
New and improved graphics functions
Improved command interfaces for a more comfortable use
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
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.
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
2.1 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.2 Netlists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.1 Preface
2.2 Netlists
R1
V0 2
R2
In[2]:= voltageDivider =
Netlist[
{V0, {1, 0}, 10},
{R1, {1, 2}, R1},
{R2, {2, 0}, R2}
]
Out[2]=
Netlist@Raw, 3D
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 :
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.
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}
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
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, 3D
2.2 Netlists 39
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
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
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
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
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]
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]
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.
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
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, 5D
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
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]
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]
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, 3D
2.2 Netlists 47
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
RC
R1 3
1 VCC
Q1
4
Vout
V1 R2 RE
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 .
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.
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
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.
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
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.
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]
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
1
Q1 Iload
I1 Q2
3 RL
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
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
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
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{
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.
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.
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
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.
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[]
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
B C
RB
gm*VBE
E E
Figure 3.4: Transistor model with voltage-controlled current source
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[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
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.
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.
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.
1
RA 2
L1 3
V0 C1 C2 RB
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, 6D
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 ´ 4D
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
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}]
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]
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.
HC1 L1 RA + C2 L1 RBL s2 + C1 C2 L1 RA RB s3 L
76 2. Tutorial
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
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
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
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
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]=
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
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.
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
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)
80
Magnitude (dB)
60
40
20
0
-20
-40
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
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 .
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
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).
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}]
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
1.
100%
Re s
-2.0E0 -1. -0.5
Zeros
-1. 0%
-2.0E0
100%
Out[14]= Graphics
Im s
2.0E0
1.
Re s
-5.0E0 -2.0E0 -1. -0.5
-1.
-2.0E0
Out[15]=
Graphics
2.5 Graphics 91
a = 5.000e0 Im s
2.0E0
1.
Re s
-5.0E0 -2.0E0 -1. 1.
-1.
-2.0E0
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.
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
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‘
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]},
]
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.
R1
V0 2
D1
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
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,
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
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
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.
VBC C
B
IB VCE
VBE E
IE
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 .
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]},
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[]
RB RC
IB IC
3 VCC
2 Q1 VCE
VBE
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
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}]
From the result we can immediately read off the operating point. We have
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}]
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
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}]
We finally obtain:
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
D1
1 2
V0 C1 R1 Vout
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=
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.
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}]
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]]
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
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
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]
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
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
4 5
Vout
Cload
1
RS1 3
Q1 Q2
2
V1 RS2
6
Q3 Q4
9
VEE
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 ´ 32D
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
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
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
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) 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 }]
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
set up time-domain
circuit equations
no
convergence Y
AND i<imax
N
step size control
i==imax
Y h = StepSizeFactor
or
N h *= StepSizeFactor
Y
t<tmax
N
interpolation of data
output of solutions as
interpolated functions
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]
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.
Vic
1 2
L1 C1 R1
Iout
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, 3D
Following, we distinguish two alternatives for considering initial conditions of dynamic circuit
elements.
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:
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}]
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
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 .
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
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,
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
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
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‘
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 ´ 32D
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]=
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.
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
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, 5D
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
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]
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.
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
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.
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]
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
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]
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
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
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.
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]
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.
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 ´ 32D
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
2.5
2
Magnitude
1.5
1
0.5
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.
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
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]
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]
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
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
0
-50
Phase (deg)
-100
-150
-200
-250
-300
-350
1.0E0 1.0E2 1.0E4 1.0E6 1.0E8
Frequency
Out[38]= Graphics
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 ´ 19D
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
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
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
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];
6 VDD
M3 M4
5
4
1 2
M1 M2
3
CL
V1 V2
IBIAS
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.
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
Hence, the Laplace transform of the output signal, Y(s), is identical to the transfer function if we let
X(s) = 1:
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 ´ 9D
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]]
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
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.
From this formula, the DC gain can be obtained by setting the complex Laplace frequency s = 0:
In[11]:= diffgainDC = diffgain /. s −> 0
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}]
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
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.
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.
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 ´ 9D
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"}}]
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
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 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
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
I$V1 I$V2
V1 Y V2
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
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
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
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, 6D
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
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
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]
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
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[]
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 ´ 9D
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]
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
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 ´ 50D
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}]
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
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 ´ 50D
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]]]
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];
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
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
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
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.
VLOAD VCC
I0
Q3
Q2
Q4
Q1 5
II
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.
As a first step we import the numerical simulation data calculated with PSpice into Mathematica
using ReadSimulationData (Section 3.10.3).
In[1]:= <<AnalogInsydes‘
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=
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[9]:= GetVariables[mnaFull]
In[10]:= GetParameters[mnaFull]
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
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 ´ 6D
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}
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 ´ 6D
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 ´ 6D
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.
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 ´ 4D
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.
In[29]:= Plot3D[ivloadSimp[II],
{VLOAD, 0., 3.5}, {II, 0., 0.001},
AxesLabel −> {"VLOAD", "II", ""},
PlotLabel −> "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];
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
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.1 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‘
3.1.2 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],
]
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
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
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.
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.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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, 3D
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:
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, 4D
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
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‘
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
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‘
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
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.
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
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.10 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
With GlobalParameters you can specify settings for global parameters used in a Circuit object, as
for instance TEMP or GMIN.
3.2.1 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.
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
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
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
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
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
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.
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}
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
With the Parameters keyword, you can specify the set of symbols which represent the parameters
of a model definition. Possible values are:
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
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
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
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
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:
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
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]
InitialGuess
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.
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
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;
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
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
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
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
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
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.1 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
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)
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‘
8BasicResistorModels‘ ®
Out[3]=
3.3.2 FindModel
FindModel[name, selector] searches the default library for the model definition
name/selector
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:
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)
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.3.3 FindModelParameters
FindModelParameters[name] searches the default library for the parameter set name
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:
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)
3.3.4 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‘
3.3.5 GlobalModelParameters
GlobalModelParameters[] lists the names of the model parameter sets stored in the
global model parameter database
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‘
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 , † † †
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:
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 .
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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 , † † †
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
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
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
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[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
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‘
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.1 ExpandSubcircuits
ExpandSubcircuits[netlist, opts]
expands and instantiates all subcircuit and model
references in netlist
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:
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 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:
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:
With the setting DefaultSelector −> None, ExpandSubcircuits will print an error
message and abort upon encountering a generic Selector specification.
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:
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:
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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, 55D
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;
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, 55D
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, 37D
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
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
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
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:
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:
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.
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
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:
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
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:
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:
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:
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:
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:
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:
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.
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:
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‘
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
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
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
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
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
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
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
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
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
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}.
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,
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,
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
¢
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
You can also tell CircuitEquations to treat all device parameters as numeric quantities.
248 3. Reference Manual
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=
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
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=
3.5.2 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:
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‘
3.5.3 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
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
3.5.4 Solve
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
3.6.1 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
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‘
Add a load resistance to In[3]:= netload = AddElements[net, {Rload, {2, 0}, Rload}]
the voltage divider. Out[3]=
Netlist@Raw, 4D
3.6 Circuit and DAEObject Manipulation 259
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
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
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‘
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
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
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
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‘
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, 3D
262 3. Reference Manual
3.6.5 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‘
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
3.6.6 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
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
Given a DAEObject dae, GetVariables returns the list of variables stored in the object. For AC
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‘
3.6.8 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‘
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
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‘
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
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‘
8AnalysisMode ® Transient,
options stored in dae.
Out[4]=
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
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‘
8AnalysisMode ® Transient,
InitialTime option.
Out[5]=
8AnalysisMode ® Transient,
values.
Out[7]=
3.6.12 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
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
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:
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‘
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,
3.6.14 UpdateDesignPoint
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‘
3.6.15 MatchSymbols
MatchSymbols[expr, matchgroups]
matches symbols in an expression expr
MatchSymbols[dae, matchgroups]
matches symbols in a system of equations dae
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:
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‘
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
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
-
-
R
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
Modify values of resistors In[10]:= daenew = UpdateDesignPoint[dae, {R2 −> 15., R3 −> 20.}]
R2 and R3. Out[10]=
DAE@AC, 5 ´ 5D
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
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
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)
3.6.17 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:
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
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)
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
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‘
88I$AC$D1@tD + I$V0@tD == 0,
Out[5]//DisplayForm=
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.
format description
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‘
88V1 ® 1.<, 8V1 ® 2.<, 8V1 ® 3.<, 8V1 ® 4.<, 8V1 ® 5.<<
with values given by an
Out[3]=
interval.
284 3. Reference Manual
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
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
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
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‘
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
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.
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
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:
CurrentSource A/ Hz Sqrt[4 k T / R]
VoltageSource V/ Hz Sqrt[4 k T R]
While specifying the value of a noise source it is also assumed that the bandwidth is 1 Hz.
NoiseAnalysis has the following options:
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
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 ´ 18D
-140
-150
Magnitude (dB)
-160
-170
-180
noise(out) noise(in)
Out[7]=
Graphics
292 3. Reference Manual
3.7.5 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:
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:
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
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:
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:
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
MaxStepSize
MinStepSize
The option MinStepSize specifies the lower limit of the integration step size. The computation will
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
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:
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:
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:
StartingStepSize
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
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
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
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
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
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
(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:
3.8.1 GeneralizedEigensystem
GeneralizedEigensystem[A, B]
computes the eigenvalues and the corresponding left and
right eigenvectors of the matrix pencil (A, B)
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:
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‘
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
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
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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}};
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
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‘
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
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‘
3.8.5 ZerosByQZ
ZerosByQZ[dae, var] calculates the zeros of the transfer function from the AC
DAEObject dae to the output variable var
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
3.8.6 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
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
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:
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 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
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:
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‘
Solve the GEP (A, B). In[6]:= LREigenpair[A, B, −1., InitialGuess −> {{0, 1}, {1, 0}}]
Use the default projection In[7]:= LREigenpair[A, B, 1., MaxResidual −> 1.*^−15]
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}]
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.
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]
3.8.8 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 :
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 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:
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:
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
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).
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:
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:
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‘
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 ´ 10D
computing the reference
solution.
To check if the algorithm has successfully isolated the pole of interest, we compute the poles of the
approximated system.
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
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 ´ 10D
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 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
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].
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:
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
PhaseDisplay
The option PhaseDisplay specifies whether and how to display phase values. Possible choices are:
PlotRange
With the PlotRange option, you can set the plot ranges for the y-axes of the magnitude and phase
plots. Possible values are:
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
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‘
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
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
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
Out[12]= Graphics
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
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
-10
-20
Magnitude (dB)
-30
-40
-50
-60
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
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:
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 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
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].
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:
PhaseDisplay
The option PhaseDisplay specifies the unit for phase values. Possible values are:
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:
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
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
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
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].
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:
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:
UnitCircleStyle
With UnitCircleStyle −> style, you can change the plot style for the unit circle.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
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
Im
0.4
0.2
0 Re
-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
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
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
PoleStyle
With the option PoleStyle −> style, you can change the appearance of the symbol RootLocusPlot
uses to mark poles. The following styles are available:
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
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
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]
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]]]
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
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 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].
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:
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:
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
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
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
V$2[t]
1.2
1.1
V$1[t]
-2 -1 1 2
0.9
0.8
Out[11]= Graphics
Out[13]= Graphics
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"
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
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:
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
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:
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:
.AC
.ALIASES
.DC
.NOISE
.PLOT
.PRINT
.PROBE
.OP
.WIDTH
Eldo
ReadNetlist["netfile", Simulator −> "Eldo"] supports the following devices:
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
.AC
.ALIASES
.NOISE
.PLOT
.PRINT
.PROBE
.OP
.RAMP
.VIEW
.WIDTH
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:
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
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
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:
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
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):
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
88VH4L ® InterpolatingFunction@88-0.00018,
Out[2]=
0.00012<<, <>D,
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
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:
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
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
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:
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
Simulator
The following simulator-dependent modeling languages are supported:
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.11.1 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
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
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
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‘
H-beta$Q1 C1 C2 R1 R2 RC RL Ro$Q1 s2 +
in the transfer function.
Out[9]=
HC1 C2 R1 R2 RC RL s2
Out[11]=
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]=
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
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 .
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 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.
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‘
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]=
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
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}}
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]
3.11.4 CompressMatrixEquation
CompressMatrixEquation[dae, var]
compresses the matrix equation dae with respect to the
variable of interest var
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
StripIndependentBlocks
False whether to search for and discard
algebraically independent blocks which are
decoupled from the variable of interest
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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.
Note that matrix compression does not change the solution of the equations.
Solve the compressed In[10]:= Solve[cmat, V$5]
3.12.1 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:
Protocol Inherited[AnalogInsydes]
standard Analog Insydes protocol
specification (see Section 3.14.5)
DT mode specifications
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
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
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:
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:
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
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:
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‘
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 ´ 27D
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
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:
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
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 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:
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:
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:
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}
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‘
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 ´ 27D
3.12.4 SimplifySamplePoints
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:
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
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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 ´ 27D
3.12.6 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.
3.12.7 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.1 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‘
88VH4L ® InterpolatingFunction@88-0.00018,
Out[2]=
0.00012<<, <>D,
8VH4L ® InterpolatingFunction@
two-dimensional
Out[3]=
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
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
DXFGraphics inherits all options from Graphics. Additional options for DXFGraphics are:
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‘
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
5
Q2N2907a
Q2N2907a
T3 T4
Q2N2907a
T5
3 4
Q2N2222 VOUTVDB
1 T1T2 VDD
+
2Q2N2222 -
VIN
+
-
I1+ I2+
- -
Out[3]= Graphics
Out[4]=
Graphics
426 3. Reference Manual
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
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.
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
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.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:
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
428 3. Reference Manual
8InstanceNameSeparator ® $,
Insydes option settings.
Out[2]=
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.
3.14.3 LibraryPath
With the option LibraryPath , you can specify the paths to be searched for device model library
files. Possible values are:
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:
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‘
8InstanceNameSeparator ® $,
Out[4]=
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
8InstanceNameSeparator ® $,
models for all other
devices. Out[5]=
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:
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 .
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.14 Global Options 431
8InstanceNameSeparator ® $,
Out[2]=
8InstanceNameSeparator ® $,
send messages from
Out[3]=
second level to notebook.
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:
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:
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.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
8CharacterMapping ® 8_ ® $<,
ReadNetlist .
Out[3]=
8InstanceNameSeparator ® $$,
InstanceNameSeparator
Out[4]=
globally.
LibraryPath ¦ Prepend@$Path, aidirAnalogInsydesModelLibraryD,
ModelLibrary ® FullModels‘, Protocol ® StatusLine,
Simulator ® AnalogInsydes, UseExternals ® True<
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
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
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.15.3 ReleaseNumber
ReleaseNumber[AnalogInsydes]
returns the release number of your local Analog Insydes
installation
The command ReleaseNumber[AnalogInsydes] returns the release number of your Analog Insydes
installation as a real number.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
3.15.4 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‘
3.15.5 Version
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‘
3.15.6 Info
The command Info[AnalogInsydes] provides general information of the running Analog Insydes
installation. It prints:
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
4.1.1 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
Arguments of AMWave.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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 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:
Arguments of ExpWave.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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 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:
Arguments of PulseWave .
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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 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:
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]=
0.8
Vpwl1[t]
0.6
0.4 Vpwl2[t]
0.2
t
2 4 6
Out[5]= Graphics
4.1.5 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
Arguments of SFFMWave.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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 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:
Arguments of SinWave.
Examples
Load Analog Insydes. In[1]:= <<AnalogInsydes‘
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
Independent sources.
Controlled sources.
4.2 Netlist Elements 449
4.2.1 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
G
node1 node2
Modified nodal equation setup for conductances is influenced by the value-field option Pattern.
4.2.3 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
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
node1 node2
Modified nodal equation setup for capacitors is influenced by the value-field option Pattern .
4.2.6 Inductor
L
node1 node2
Modified nodal equation setup for inductors is influenced by the value-field option Pattern.
4.2.7 OpenCircuit
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
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
node+
I0
node-
The positive reference direction for the source current is from node+ to node−.
4.2.10 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
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
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
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
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
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
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
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
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
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
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
input A output
460 4. Appendix
4.2.22 Integrator
input Ti output
4.2.23 Differentiator
input Td output
4.2.24 TransmissionLine
input T output
4.2.25 TransferFunction
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.1 Diode
syntax
{Dname, {n1 −>A, n2 −>C}, Model−>Diode, Selector−>selector, parameters}
denotes a subcircuit reference for a 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
RS
CJ
id
RS
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following 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
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
syntax
{Qname, {n1 −>C, n2 −>B, n3 −>E, n4 −>S}, Model−>BJT, Selector−>selector, parameters}
denotes a subcircuit reference for a 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
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
S RE
Equivalent schematic for the DC and transient analysis for the lateral bipolar transistor (LPNP)
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
4.3 Model Library 477
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
Re
Equivalent schematic for the AC analysis for the vertical bipolar transistor (NPN, PNP)
Rc
S Re
Equivalent schematic for the AC analysis for the lateral bipolar transistor (LPNP)
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
syntax
{Mname, {n1 −>D, n2 −>G, n3 −>S, n4 −>B}, Model−>MOSFET, Selector−>selector, parameters}
denotes a subcircuit reference for a 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:
CGB RD
ibd
CGD CBD
G B
RS
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:
Small-Signal Model
Cgb Rd
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
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
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 automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
4.3 Model Library 493
syntax
{Jname, {n1 −>D, n2 −>G, n3 −>S}, Model−>JFET, Selector−>selector, parameters}
denotes a subcircuit reference for a JFET
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:
RD
igd
CGD
CGS ids
igs
RS
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
Small-Signal Model
Rd
Ggd Cgd
G Gds
Rs
The automatic reduction of the model complexity controlled via the global Analog Insydes option
ModelLibrary influences the following parameters:
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
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
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