Está en la página 1de 4

Symbolic Circuit Analysis in the Classroom

Franciszek Balik1, Benedykt Rodanski2, Ryszard arko1 Institute of Telecommunication and Acoustics, Wrocaw University of Technology (WUT), Wrocaw, Poland 2 Faculty of Engineering, University of Technology, Sydney (UTS), Sydney, Australia Abstract plots, etc. This approach has been found very useful in teaching analogue electronics, as it adds another dimension to the standard analysis and design process, performed with a numerical simulator. The well known limitation of symbolic circuit analysis is the exponential growth of the number of terms in a network function with the circuit size. This limitation can be overcame by generating a sequence of expressions (SoE) rather than a single expression. The sequence of expressions grows quasi linearly with the circuit size and is manageable even for large analogue circuits. Of course, the price we have to pay for this complexity reduction is the loss of interpretability (at least for large circuits; for the smaller ones symbolic mathematical software is capable of flattening a SoE to produce an interpretable formula). One advantage of the SoE approach is the ability to generate formulae for first- and second-order sensitivities at almost no extra cost. The programme that can generate SoE for network functions and their sensitivities to circuit parameters is STAINS [3], written in Visual Basic for Applications (VBA) under Microsoft Excel. Circuit data can be either generated automatically from the output file of OrCad PSpice or entered manually onto an input spreadsheet in the familiar Spice-like format. The user then selects the required network function and the circuit component(s) with respect to which the sensitivity is to be calculated. The node admittance matrix (NAM) and the calculated expressions are displayed on another spreadsheet. Three text files may also be created. They are: component values (if any), nonzero NAM elements and the sequence of expressions. These files are used for further processing by mathematical software. STAINS has several features, especially useful in an educational environment: $ compact symbolic expression generated even for large circuits (max. number of nodes: 255), $ calculation of two-port parameters and their first- and second-order sensitivities to circuit component variations, $ universality and flexibility: any linear circuit can be analysed; a small-signal equivalent may either be entered manually by the user or extracted from PSpice output (by specially written programme, Extract, available from benr@eng.uts.edu.au) $ use of very popular software platform: MS Excel under Windows, $ demo mode that enables students to view the NAM formulation process in slow motion, $ choice of an output format (MATLAB, Mathematica, Maple, C++). Moreover, combining STAINS with commercial mathemati-

In this paper we present our experiences in using symbolic circuit analysis in teaching analogue electronics at WUT and UTS. Symbolic methods in conjunction with mathematical software are used in addition to numerical simulators. This adds another dimension to standard analysis and design process, gives students greater flexibility and encourages creativeness. We chose sequential symbolic formulae for they are exact, compact and well suited for further processing by general-purpose mathematical software.

I. INTRODUCTION
Despite their many advantages, symbolic methods have not yet found their way into teaching of analysis and design of analogue electronic circuits. Most textbooks in this area deal with simple discrete and/or integrated building blocks. For small circuits the symbolic expressions are always calculated by hand, while for the larger ones some engineering approximations are first made to obtain a simplified equivalent circuit for which the desired formula is then derived. For the more complex circuits only the results of numerical simulation with programs like SPICE (or its various personal computer versions) are usually given. Although very powerful and versatile, the purely numerical simulators should not be seen as the ultimate design tool. Being purpose-built, such software often lacks flexibility; certain functions are either not available or very cumbersome to implement (try, for example, to obtain from PSpice a 3D plot of a second-order sensitivity of voltage transmittance to two circuit components as a function of their value). General-purpose mathematical software (e.g., Mathematica, Maple, MathCad, MATLAB), is increasingly being used for symbolic circuit analysis. Mathematica appears to be the most popular, with some commercial packages (toolboxes) already available [1]. It is also important that engineering students are now introduced to mathematical software early in their courses. There are very few symbolic circuit analysis programmes that could be easily utilised in an undergraduate electrical/electronics engineering course. One package that stands out is SAPWin [2]. Its beta version has been available for some time and we use it extensively in teaching electronics and circuit theory. It has, however, severe circuit size limitations. Moreover, the network function outputted by SAPWin does not lend itself easily to further processing. Our idea was to generate a compact symbolic expression for a desired network function and then use one of the mathematical programmes to manipulate this expression , study the behaviour of the network function, create various

cal software gives extended capabilities, such as: $ a rational function in s can be obtained by flattening of the SoE (admittedly, for small circuits only), $ location of poles and zeroes of a network function can be observed, $ network functions and their sensitivities can be graphed as 3D plots vs component values and/or frequency, allowing optimal selection of components. The technique used in STAINS is based on symbolic reduction of the NAM (formulated using the element stamp approach) and application of the two-port transimpedances to calculate network functions and their sensitivities to circuit component variations. The method has been described elsewhere [4]. A brief outline also appears in these Proceedings [5]. To avoid repetition, we direct readers to the literature and proceed directly to the description of the student project (Section II) and an example, where the results of STAINS are combined with mathematical software (Section III).

II. THE STUDENT PROJECT


In the undergraduate subject Electronic Circuit Design, thought at WUT and a similar subject, Advanced Electronics, at UTS, a circuit design project plays a very important role in the educational process. It brings together the theoretical knowledge and practical skills, acquired through the course, allows students to test their understanding of circuit operation, device models and limitations and, most importantly, gives them a very satisfying sense of achievement when the prototype performs (eventually) to the specification. We chose several cut-down versions of op amps for the project circuits. They are not trivial but also not too difficult to design and build; they contains all major basic integrated circuits (IC) building blocks (differential amplifiers, current sources, buffers, etc.) and require the use of feedback to meet the specified parameters. Each group of students is given a topology and a set of performance parameters to meet (gain, input/output impedances, i/o signal levels, power consumption, etc.). The project consists of three major tasks: hand analysis and initial design, computer simulation, prototyping and measurement. It is at the computer simulation stage when we introduce symbolic analysis. One if the important tasks performed with the aid of symbolic expressions and mathematical software (MATLAB or Mathematica, for example) is stability analysis and phase compensation in amplifier design. Very often a student-designed feedback amplifier turns out to be unstable. It becomes necessary to introduce some compensation of amplifiers characteristics, usually by adding (external) circuits. There are several well-known methods of phase compensation [6,7]. The most commonly used are: Miller-effect compensation, lag-compensation, lead-compensation, and compensation by changing the input impedance. Theoretical selection of corrective circuits components is very difficult because it would require the knowledge of

the exact impedance between the nodes to which the circuit is going to be connected. In engineering practice this selection is usually done empirically (using a trial and error technique) with the aim of minimising the compensating capacitance, while maintaining the required stability margins (gain and phase). Fixed capacitances smaller than, say, 100pF, can be realised in the IC. The amplifier is then said to be internally compensated. This paper describes a new method of compensating element selection based on the combination of numerical and symbolic analyses and utilising mathematical software. The analysis is performed as follows. a) PSpice simulation gives the DC operating point; the small-signal model parameters are extracted from the PSpice output file (by a specially written software, Extract), b) The small-signal equivalent circuit data is processed by our symbolic software STAINS to generate the sequence of expressions for the desired network function and (if required) their sensitivities, c) The circuit data and the SoE are then incorporated into a Mathematica script with additional commands to perform specific tasks like: factoring out the numerator and denominator of the network function, calculation of roots of polynomials (zeroes and poles), obtaining 2D and 3D parameter plots, contour plots, etc. d) The Mathematica notebook is then evaluated. Basic steps in the compensation element selection are as follows: 1. Stability analysis of the closed-loop amplifier; at this point the magnitude and phase of the transfer function are plotted and positions of zeroes and poles are evaluated. 2. If the closed-loop amplifier is unstable (i.e., there are poles in the right-hand half of the complex plane), the position of the compensating capacitance is determined and the open-loop circuit is analysed (the loop should be broken in accordance with the known rules [6]): With Mathematica the 3D plots of magnitude, MagT(C,f), and phase, ArgT(C,f), of the loop gain as functions of frequency and compensating capacitance are obtained. The contour plots of MagT(C,f) and ArgT(C,f) are next calculated. On the contour plot MagT(C,f) a zero level is marked as well as a positive level, corresponding to the desired gain margin, e.g., 10 dB. On the contour plot ArgT(C,f) a zero level is also marked as well as the required phase margin, e.g., 45o. Both contour plots are superimposed. The point of intersection of zero contours gives the minimum value of the compensating capacitance. The value of compensating capacitance, corresponding to the desired gain and/or phase margin is read at the intersection of appropriate contour lines. The gain and phase margins (with chosen compensating capacitance) are then checked using classical Bode plots.

Fig. 1. Topology of the amplifier in the student project. The feedback path is shown by the broken line.

Fig. 2. Pole location plot obtained with Mathematica for the amplifier in Fig. 1 (closed-loop transfer function).

3. Finally, the amplifier is analysed again with the feedback loop closed to check if the transfer function poles lie in the right-hand-side of the s-plane. This approach to amplifier compensation is illustrated on an example taken from one of our student projects.

x1=GL+G9+G8+Gf+GpiQ6+GoQ6+GmQ6+ s*CpiQ6+(G8+GpiQ6+GmQ6+s*CpiQ6)*d1;

III. ILLUSTRATIVE EXAMPLE


We will focus on the Miller-effect compensation of the amplifier circuit shown in Fig. 1. This project specification was to establish DC currents I3 = 0.5 mA, I5 = 1.5 mA, total power consumption approx. 30 mW, closed-loop gain 10 dB (artificially low, but making the circuit unstable) and bandwidth 50 MHz. It was to be prototyped with a CA3046N transistor array. Following the procedure outlined in Section II, the circuit components were first calculated manually and then adjusted using PSpice to obtain the desired DC operating point. The high-frequency small-signal model was extracted from the output of PSpice and fed into STAINS which created two ASCII files: the SoE for the voltage gain and the circuit data file in suitable format. These files were incorporated into a Mathematica script. (It is interesting to note that for greater accuracy, component values are entered into Mathematica in either integer or rational form. If the data is given in k$ and pF, for example, then a 2.2k$ resistor is entered as Rx = 22/10 and a 12 pF capacitor as Cy = 12.) Adding Mathematica commands to the script generates required results, like pole/zero plots, 2D and 3D plots, contour plots and other forms of output not available in numerical simulators. Some of these possibilities will be illustrated in the following example. Example 1: The circuit in Fig. 1 was designed according to the specification given above. To obtain the pole positions of its voltage transfer function the following Mathematica 2.2 script can be used (to conserve space, only the relevant lines of the script will be given; readers wishing to obtain a full copy of the scripts should contact one of the authors via e-mail: benr@eng.uts.edu.au):
(* SoE *) d1=-(G8+GpiQ6+s*CpiQ6)/ (G7+G8+GpiQ6+s*(CpiQ6+CmuQ6));

x60 = -x56*d23; Zoi=-x60; Zii=x58; Tv=Zoi/Zii; (* Circuit Data [kohm, pF] *) RL=1; GL=1/RL;

GmQ6=341/10; (* Poles *) Tvf[s_]=Factor[Tv]; den[s_]=Denominator[Tvf[s]]//N; poles=Solve[den[s]==0,s]//N pos=Map[(s/.#)&,poles]; loc=Flatten[{pos}]; fig2=ListPlot[Map[{Re[#],Im[#]}&,N[loc]], AxesLabel->{"sigma","jw"}, PlotLabel->"Pole Locations", PlotRange->{{-2,0.1},{-0.3,0.3}}]

The ListPlot command creates a plot of pole location (only the poles close to the imaginary axis are shown in Fig. 2.). The exact pole positions are printed by the Solve command. It turns out that a pair of complex-conjugate poles, seen in Fig. 2 as imaginary, lie in the right-hand half of the complex plane: the amplifier is clearly unstable. Before attempting Miller-effect compensation by adding a capacitance between the base and the collector of Q2 (effectively increasing the value of C2), we can observe the influence of C2 on the magnitude of transfer function. To obtain a 3D plot of MagT(C2,f), we comment out the value of CmuQ2 in the circuit data section of the script and add the commands as follows:
(* Circuit Data [kohm, pF] *)

 

(*CmuQ2=629/1000;*) GmQ6=341/10; (* 3D Graphics *) Tvf=Factor[Tv]//N; s=I*2*Pi*f; MagT=20*Log[10,Abs[Tvf]]//N; fig3=Plot3D[MagT,{CmuQ2,0,4},{f,0,0.1}, AxesLabel->{CmuQ2[pF],f[GHz],|Tv|[dB]}, PlotPoints->60]

Fig. 3. A 3D plot of gain as a function of frequency and the base-collector capacitance of Q2.

This script produces a surface plot, shown in Fig. 3. It suggests the possibility of Miller compensation by adding a few pF capacitor Ck in parallel with C2. According to p. 2 of our procedure, the feedback loop was broken at a suitable point and a SoE for a loop gain was obtained from STAINS. This SoE was then used in Mathematica script to obtain the contour plots of the magnitude and phase of the loop gain as a function of frequency and the compensating capacitance, Ck. From the plots, shown in Fig. 4, it can be seen that with no compensation (Ck = 0) the amplifier is unstable (|T| =0 dB, Arg(T)=0o). To achieve the gain margin of 10 dB we need Ck 0.7 pF (intersection of contour lines -10 dB and 0o). For a phase margin of 45o Ck is found to be approximately 1.2 pF (intersection of contour lines 0 dB and 45o). Recalculating the transfer function poles for the closed-loop amplifier with Ck = 1.5 pF confirms that all poles lie now in the left-hand half of the complex plane and the amplifier is stable.

Fig. 4. Contour plot of magnitude (solid line) and phase (broken line) of the loop gain as a function of frequency and the compensating capacitance.

circuit designers as well as electronic engineering students can both benefit from such approach. Combining symbolic techniques with powerful mathematical software is especially attractive in an educational environment. It adds another dimension to standard analysis and design process, gives greater flexibility and encourages creativeness. The learning curve is very steep as students are already familiar with MS Excel and have been using Mathematica in other courses (at UTS, for example, Mathematica is used extensively in math courses).

REFERENCES
[1] [2] E. Henning, T. Halfman, Analog Insydes Tutorial, ITWM, Kaiserslautern, 1998. A. Liberatore et al., A new symbolic program package for the interactive design of analog circuits, Proc. IEEE ISCAS, pp. 2209-2212, 1995. M. Pierzchaa, B. Rodanski, Efficient generation of symbolic network functions for large-scale circuits, Proc. MWSCAS96, pp. 425-428, 1997. F. Balik, B. Rodanski, Calculation of first-order symbolic sensitivities in sequential form via the transimpedance method, Proc. SMACD98, Kaiserslautern, Germany, October 1998, pp. 169-172. F. Balik, B. Rodanski, Symbolic dimensional sensitivities in hybrid thick-film circuits, Proc. SMACD 2000, Lisbon, Portugal, October 2000. A. Sedra, K.C. Smith, Microelectronic Circuits, 4th ed., Oxford University Press: New York, 1998. M.S. Ghaussi, Electronic Devices and Circuits, HRW: New York, 1985.

IV. CONCLUSION
In the context of an undergraduate student project we have illustrated how the results of symbolic circuit analysis with our programme STAINS can be processed by mathematical software to produce results that cannot be obtained with numerical simulators. Sequential formulae, generated by STAINS, are very suitable for further processing by mathematical software like Mathematica or MATLAB. The sequences are accurate yet compact (their complexity grows linearly with circuit size). The main abilities afforded by combining STAINS results with Mathematica are: obtaining 3D and contour plots of many network functions and their sensitivities, investigating relationships between network functions and component parameters, calculating zero and pole positions and root loci. The SoE approach allows additional flexibility: sequences can be incorporated into custom-designed software, written in C/C++, Fortran, Visual Basic, etc., to perform specialised calculations. Professional

[3]

[4]

[5]

[6] [7]

También podría gustarte