To execute this notebook you need the add-on package Analog Insydes
by ITWM (see copyright message at end of document).
Transient Circuit Analysis
With Analog Insydes' behavioral modeling functionality and its numerical
solver for systems of nonlinear differential algebraic equations (DAE),
you can describe and simulate nonlinear dynamic circuits in Mathematica.
Here, we use the DAE solver to simulate the transient response of a differential
amplifier circuit.
Netlist and Models
Consider the following differential amplifier circuit consisting of four
bipolar junction transistors. We shall compute the transient response V (t)
to a sinusoidal voltage pulse applied at node 1.
Differential Amplifier Circuit
In[1]:= <<AnalogInsydes`
In[2]:= DifferentialAmplifier=
Circuit[
Netlist[
{RS1, {1, 2}, Symbolic -> RS1,Value-> 1.*^3},
{RS2, {3, 0}, Symbolic -> RS2,Value-> 1.*^3},
{RC1, {4, 8}, Symbolic -> RC1,Value-> 1.*^4},
{RC2, {5, 8}, Symbolic -> RC2,Value-> 1.*^4},
{RBIAS, {7, 8}, Symbolic -> RBIAS,Value-> 2.*^4},
{CLOAD, {4, 5}, Symbolic -> CLOAD,Value -> 5.*^-12},
{Q1, {4 -> C, 2 -> B, 6 -> E}, Model -> NPN,
Selector->View, betaf -> 255.9, betar
-> 6.092,
Is -> 14.34*^-15, Vt -> 0.026},
{Q2, {5 -> C, 3 -> B, 6 -> E}, Model -> NPN,
Selector -> View, betaf -> 255.9,
betar -> 6.092, Is -> 14.34*^-15, Vt -> 0.026},
{Q3, {6 -> C, 7 -> B, 9 -> E},
Model -> NPN, Selector -> View, betaf -> 255.9,
betar -> 6.092, Is -> 14.34*^-15,
Vt -> 0.026},{Q4, {7 -> C, 7 -> B, 9 -> E},
Model -> NPN, Selector -> View, betaf->255.9,
betar -> 6.092, Is -> 14.34*^-15, Vt -> 0.026},
{VCC, {8, 0}, Symbolic -> VCC, Type -> VoltageSource,
Value ->12.},
{VEE, {9, 0}, Symbolic -> VEE, Value -> -12.},
{V1, {1, 0}, Symbolic->V1,Value->V1}]];
The transistors are modeled by the nonlinear DC Ebers-Moll
equations which are loaded from the Analog Insydes model library.
In[3]:= LoadModel[NPN, EbersMoll,Scope->Global];
GlobalSubcircuits[]
Out[3]={{NPN,EbersMoll}}
Setting Up Circuit Equations
Now we set up a system of time domain circuit equations
from the netlist.
In[4]:= mna=CircuitEquations[DifferentialAmplifier/.
View->EbersMoll,
TimeDomain->True]
Transient Circuit Analysis
To simulate the transient behavior of the circuit, we apply a
sine wave stimulus to the input and call the transient solver.
In[5]:= Vpulse[t_]:= Sin[10^6 t]
In[6]:= TransientPlot[{Vpulse[t]}, {t,0,10^-5}]
Out[6]= -Graphics-
In[7]:= transient =
NDAESolve[mna /.V1-> Vpulse[t],{t,0.,1.5*10^-5},
Protocol->True,MaxStepSize->5.*10^-7]
![[Graphics:Images/AnalogInsydesNumeric_gr_6.gif]](AnalogInsydesNumeric_gr_6.gif)
10% successfully computed.
20% successfully computed.
30% successfully computed.
40% successfully computed.
50% successfully computed.
60% successfully computed.
70% successfully computed.
80% successfully computed.
90% successfully computed.
100% successfully computed.
Solutions are computed from tstart=0. to
tstop=0.0000150953 in 108 steps.
Out[7]= {{V$4->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$5->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$1->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$2->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$3->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$6->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$7->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$8->InterpolatingFunction[{{0.,0.0000150953}},<>],
V$9->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BC$Q1->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BE$Q1->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BC$Q2->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BE$Q2->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BC$Q3->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BE$Q3->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BC$Q4->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$BE$Q4->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$VCC->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$VEE->InterpolatingFunction[{{0.,0.0000150953}},<>],
I$V1->InterpolatingFunction[{{0.,0.0000150953}},<>]}}
Visualizing the Results
Then we plot the time domain response with Analog Insydes'
transient waveform viewer.
In[8]:= TransientPlot[transient,{V$1[t],V$5[t],I$BC$Q1[t]},
{t,0,1.5*10^-5},
SingleDiagram->False,PlotRange->All]
Out[8]= -GraphicsArray-
In[9]:= TransientPlot[transient,{V$1[t], V$5[t]},
{t,1.*10^-6,1.5*10^-5},Parametric->True]
Out[9]= -Graphics-
Numerical Parametric DC Circuit Analysis
Next, we will demonstrate a special application of Analog Insydes'
transient solver NDAESolve. Since
NDAESolve solves not only differential
equations but also purely algebraic systems of equations, and because the
function does not care about the physical meaning of the independent variable
(usually time ),
we can use NDAESolve for
parametric DC analysis. "Parametric DC analysis" means to calculate
DC currents and voltages as functions of a circuit element as the element
value is varied within a given interval. This method will be illustrated
in
the following example.
Netlist and Models
Consider the above differential amplifier circuit with a modified netlist
entry for the resistor RS2. The resistor value is now left symbolic (see
the netlist entry highlighted in red color).
In[10]:= DifferentialAmplifier2=
Circuit[
Netlist[
{RS1, {1, 2}, Symbolic -> RS1,Value-> 1.*^3},
{RS2, {3, 0}, Symbolic -> RS2, Value -> RS2,
Pattern -> Impedance},
{RC1, {4, 8}, Symbolic -> RC1,Value-> 1.*^4},
{RC2, {5, 8}, Symbolic -> RC2,Value-> 1.*^4},
{RBIAS, {7, 8}, Symbolic -> RBIAS,Value->
2.*^4},
{CLOAD, {4, 5}, Symbolic -> CLOAD, Value
-> 5.*^-12},
{Q1, {4 -> C, 2 -> B, 6 -> E}, Model -> NPN,
Selector ->View, betaf -> 255.9, betar -> 6.092,
Is -> 14.34*^-15, Vt -> 0.026},
{Q2, {5 -> C, 3 -> B, 6 -> E}, Model -> NPN,
Selector -> View, betaf -> 255.9, betar -> 6.092,
Is -> 14.34*^-15, Vt -> 0.026},
{Q3, {6 -> C, 7 -> B, 9 -> E},Model -> NPN,
Selector -> View, betaf -> 255.9, betar -> 6.092,
Is -> 14.34*^-15, Vt -> 0.026},
{Q4, {7 -> C, 7 -> B, 9 -> E}, Model -> NPN,
Selector -> View,
betaf -> 255.9, betar -> 6.092, Is
-> 14.34*^-15,
Vt -> 0.026},
{VCC, {8, 0}, Symbolic -> VCC, Type -> VoltageSource,
Value ->12.},
{VEE, {9, 0}, Symbolic -> VEE,Value -> -12.},
{V1, {1, 0},Symbolic->V1,Value->V1}
]
];
Setting Up Circuit Equations
First, we set up a system of "time-domain" circuit equations.
However, we use RS2 instead of time as the independent variable by
specifying the option TimeVariable -> RS2.
In[11]:= parDCeqs=
CircuitEquations[DifferentialAmplifier2/.View->EbersMoll,
TimeDomain->True, TimeVariable->RS2]
Parametric DC Analysis
Then we let NDAESolve compute the trajectories of the circuit's DC operating
point as the value of the parameter RS2 is swept from
to .
In[12]:= parDC=NDAESolve[parDCeqs/.V1-> 0,{RS2,1.*^3,5.*^4},
AnalysisMethod->DC,Protocol->True]
![[Graphics:Images/AnalogInsydesNumeric_gr_14.gif]](AnalogInsydesNumeric_gr_14.gif)
10% successfully computed.
20% successfully computed.
30% successfully computed.
40% successfully computed.
50% successfully computed.
60% successfully computed.
70% successfully computed.
80% successfully computed.
90% successfully computed.
100% successfully computed.
Solutions are computed from tstart=1000.
to tstop=50067.4 in 92 steps.
Out[12]= {{V$1->InterpolatingFunction[{{1000.,50067.4}},<>],
V$2->InterpolatingFunction[{{1000.,50067.4}},<>],
V$3->InterpolatingFunction[{{1000.,50067.4}},<>],
V$4->InterpolatingFunction[{{1000.,50067.4}},<>],
V$5->InterpolatingFunction[{{1000.,50067.4}},<>],
V$6->InterpolatingFunction[{{1000.,50067.4}},<>],
V$7->InterpolatingFunction[{{1000.,50067.4}},<>],
V$8->InterpolatingFunction[{{1000.,50067.4}},<>],
V$9->InterpolatingFunction[{{1000.,50067.4}},<>],
I$RS2->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BC$Q1->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BE$Q1->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BC$Q2->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BE$Q2->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BC$Q3->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BE$Q3->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BC$Q4->InterpolatingFunction[{{1000.,50067.4}},<>],
I$BE$Q4->InterpolatingFunction[{{1000.,50067.4}},<>],
I$VCC->InterpolatingFunction[{{1000.,50067.4}},<>],
I$VEE->InterpolatingFunction[{{1000.,50067.4}},<>],
I$V1->InterpolatingFunction[{{1000.,50067.4}},<>]}}
Visualizing the Results
The influence of the resistor RS2 on the circuit voltages and
currents can be visualized by Analog Insydes' transient waveform
viewer Transient Plot.
In[13]:= TransientPlot[parDC,{V$3[RS2],I$BC$Q2[RS2]},
{RS2,1.*^3,5.*^4},Frame->True,GridLines->Automatic,
Axes->False,PlotRange->All,SingleDiagram->False]
Out[13]= -GraphicsArray-
Copyright © 1998 by ITWM e.V.
Written by Thomas Halfmann
Analog
Insydes
ITWM
- Institut für Techno- und Wirtschaftsmathematik e.V.
Erwin-Schrödinger-Str.
D-67663 Kaiserslautern, Germany
Analog Insydes is a trademark of ITWM.
Mathematica is a registered trademark of Wolfram Research, Inc.
All other product names are trademarks of their respective owners.
Copying and redistribution of this notebook is welcomed
and encouraged, provided that the entire contents
of the document, in particular the above copyright notice, are left
unchanged and that the file is redistributed free of charge. |