Numerical Circuit Analysis with Analog Insydes

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\(TraditionalForm\`\_out\)(t) to a sinusoidal voltage pulse applied at node 1.

Differential Amplifier Circuit

\(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}, 

          \ \ \ \ \ \ {VCC, \ {8, \ 0}, \ Symbolic\  -> \ VCC, \ 
            Type\  -> \ VoltageSource, \ Value\  -> 12. }, 

          \ \ \ \ \ \ {VEE, \ {9, \ 0}, \ Symbolic\  -> \ VEE, 
            Value\  -> \ \(-12. \)}, 

          \ \ \ \ \ \ {V1, \ {1, \ 0}, Symbolic -> V1, 
            Value -> Vin}, 

          \ \ \ \ \ \ {Q1, 
            \ {4\  -> \ "C", \ 2\  -> \ "B", \ 
              6\  -> \ "E"}, Model\  -> \ "BJT", 
            Selector\  -> \ "Spice", Parameters -> "QNPN"}, 
          
\ \ \ \ \ \ {Q2, 
            \ {5\  -> \ "C", \ 3\  -> \ "B", \ 
              6\  -> \ "E"}, Model\  -> \ "BJT", 
            Selector\  -> \ "Spice", Parameters -> "QNPN"}, 
          
\ \ \ \ \ \ {Q3, 
            \ {6\  -> \ "C", \ 7\  -> \ "B", \ 
              9\  -> \ "E"}, Model\  -> \ "BJT", 
            Selector\  -> \ "Spice", Parameters -> "QNPN"}, 
          
\ \ \ \ \ \ {Q4, 
            \ {7\  -> \ "C", \ 7\  -> \ "B", \ 
              9\  -> \ "E"}, Model\  -> \ "BJT", 
            Selector\  -> \ "Spice", Parameters -> "QNPN"}
            
], 
        
ModelParameters[Name -> "QNPN", 
          Type -> "NPN", 
BF\  -> \ 255.9, \ 
          BR\  -> \ 6.092, \ 
          IS\  -> \ 14.34*^-15
]
]; 

    DisplayForm@DifferentialAmplifier\)

Setting Up Circuit Equations

Now we set up a system of time-domain circuit equations from the netlist. The transistors are modeled by the nonlinear Ebers-Moll equations which are autoloaded from the Analog Insydes model library.

\(mna = 
      CircuitEquations[DifferentialAmplifier, 
        AnalysisMode -> Transient]; 
DisplayForm@mna\)

Transient Circuit Analysis

To simulate the transient behavior of the circuit we apply a 159  kHz sine wave stimulus to the input and call the transient solver.

Vpulse[t_] :=  Sin[1.*^6 t]

TransientPlot[Vpulse[t],  {t, 0, 1.*^-5}];

\(transient = 
	
      NDAESolve[mna\  /. Vin -> \ Vpulse[t], {t, 0. , 2.*^-5}, 
        MaxStepSize -> 1.*^-7, Protocol -> All]\)

Visualizing the Results

Then we plot the time-domain response with Analog Insydes' transient waveform viewer.

TransientPlot[
      transient, {V$1[t], V$5[t], I$CS$Q1[t]}, {t, 0, 2.*^-5}, 
      SingleDiagram -> False];

TransientPlot[transient, {V$1[t],  V$5[t]}, {t, 1.*^-6, 2.*^-5}, 
      Parametric -> True];

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 t) 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 will be illustrated by the following example.

Setting Up Circuit Equations

First, we set up a system of DC circuit equations. However, we use RS2 instead of time as the independent variable by specifying the option IndependentVariable -> RS2. Setting the option ElementValues -> Symbolic yields a system of symbolic circuit equations.

\(parDCeqs = 
      CircuitEquations[DifferentialAmplifier, \ AnalysisMode -> DC, \ 
        IndependentVariable -> RS2, ElementValues -> Symbolic]; 

    DisplayForm@parDCeqs\)

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 1  kΩ to 50  kΩ.

parDC = 
      NDAESolve[parDCeqs /. Vin ->  0, {RS2, 1.*^3, 5.*^4}, 
        Protocol -> All]

Visualizing the Results

The influence of the resistor RS2 on the circuit voltages and currents can be visualized by Analog Insydes' transient waveform viewer TransientPlot.

TransientPlot[parDC, {V$3[RS2], I$CS$Q2[RS2]}, {RS2, 1.*^3, 5.*^4}, 
      Frame -> True, GridLines -> Automatic, Axes -> False, 
      PlotRange -> All, SingleDiagram -> False];

Initialization Cells

Read Mathematica package Analog Insydes:

Off[General::spell,  General::spell1];

\($NotebookDirectory = 
      ToFileName@
        First["FileName" /. NotebookInformation[EvaluationNotebook[]]]; 

    PrependTo[$Path, $NotebookDirectory]; \)

<< AnalogInsydes`;

SetDirectory[$NotebookDirectory];

\(SetOptions[TransientPlot, Background -> RGBColor[1, 1, 1]]; 

    SetOptions[NDAESolve, AccuracyGoal -> 8]; \)

Copyright © 1998-2000 by ITWM e.V.

Analog Insydes
ITWM - Institut für Techno- und Wirtschaftsmathematik e.V.
Gottlieb-Daimler-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.