AC Network Analysis Program

Total Page:16

File Type:pdf, Size:1020Kb

AC Network Analysis Program

AC Network Analysis Program Vernon R. Baker Table of Contents Introduction...... 3 Detailed Description...... 3 Justifying Matrix Construction...... 5 Getting Down to Cases...... 6 Active Devices...... 7 Transmission Lines...... 10 References...... 11 Introduction This is a simple AC analysis program that first appeared in EDN in February of 1981 which ran on a HP9825 desktop computer. The original program was written in HPL, a BASIC-like language. It has since been written in BASIC to run on a TRS-80, Turbo Pascal to run on a PC and finally translated and modified to "C" allowing it to run on Unix and MS windows platforms. What is truly unique about this program is its size and simplicity. Other AC circuit analysis programs are available which can model many more types of active elements and are quite detailed in their modeling of a circuit. This program, on the other hand, is fairly simplistic and provides rapid analysis. The purpose of this program is to provide a little insight into how one might develop an analysis program as well as provide a detailed view of the inner workings of a circuit analysis model. The original model used a rather simplistic input interface, which did not provide a method to store the circuit description in a data file. This version uses either the simplistic interactive menu or an input file to describe the circuit. The input file method has the advantage of saving the circuit description for use at a later time or to explore multiple circuit configurations. The program models three passive elements; resistor, capacitor and inductor; three active elements; npn bipolar junction transistor, field effect transistor and operational amplifier; and transmission lines: open stub, shorted stub and transmission line.

Detailed Description This program is based on Schnider's algorithm (ref. 2), which uses an indefinite admittance matrix to solve network problems. The program is capable of solving both passive and active network elements and will accommodate transmission line analysis. When the program is invoked, the display is cleared and the main menu is displayed. The main menu lists the 9 types of elements that the program accommodates along with the FINISH and ANALYZE options. To illustrate the program syntax and internal software functions, consider a simple RLC analysis problem as shown below. As a first step in this analysis, each node in the P MATRIX (REAL) NODE 1 2 3 4 1 0 0 0 0 2 0 1/R -1/R 0 3 0 -1/R 1/R 0 4 0 0 0 0 2 180 ohms 3

R Q MATRIX (CAPACTIVE) C 3.3F NODE 1 2 3 4 1 1 V 1 C 0 -C 0 2 0 0 0 0 L 4.7 mH 3 -C 0 C 0 4 4 0 0 0 0

R MATRIX (INDUCTIVE) NODE 1 2 3 4 1 1/L 0 0 -1/L 2 0 0 0 0 3 0 0 0 0 4 -1/L 0 0 1/L network must be consecutively numbered starting from 1, ensuring that at least one element connects to each node. The program interprets the highest node number as network common which allows assignment of any number value to the input and output node. The network excitation, an ideal voltage source of unit magnitude, is always between input and common. Likewise, output readings are presented in relation to the common terminal. Order of network element is not critical because the analysis does not begin until the ANALYSIS command is selected. To initiate program data entry for this example, enter a number from the main menu and press 'ENTER'. The program displays the selected network element and then branches to one of the input subroutine. As the program accesses each subroutine, it places each element value and related topology information into the appropriate P - resistive, Q - capacitive, or R - inductive matrix. The process is repeated until all the data describing the complete network is entered. The final state of the P, Q, and R matrices, respectively, for this example is shown.

Justifying Matrix Construction Note that each passive element appears, in a perfect symmetric manner, at the corners of a square in the appropriate matrix. Furthermore, this data is centered on a diagonal, with the node numbers defining both row and column positions. To show why this appearance results, write the current equations in terms of the node voltages. For nodes 1 through 4,

sC(V1 - V3)+(1/sL)(V1-V4) = 0 NODE 1 (1/R)(V2-V3) = I NODE 2 (1/R)(V3-V2) + sC(V3-V1) = 0 NODE 3 (1/sL)(V4-V1) = -I NODE 4 (NOTE: +I is current circulating in a clockwise direction) Collecting the terms by the various node voltages gives all of the coefficients for each respective nodal expression the dimensions of admittance: (sC + 1/sL)V1 + (0)V2 + (-sC)V3 + (-1/sL)V4 = 0 (0)V1 + (1/R)V2 + (-1/R)V3 + (0)V4 = I (-sC)V1 + (-1/R)V2 + (sC + 1/R)V3 + (0)V4 = 0 (-1/sL)V1 + (0)V2 + (0)V3 + (-1/sL)V4 = -I

Then, separating these coefficients into resistive, capacitive and inductive components shows that the complex frequency terms containing s and 1/s represent the only difference between those components and the P, Q, R matrices. The frequency term factors out because they are scalar multipliers in both the Q and R matrices.

Getting Down to Cases With this justification of the program's data entry phase, network analysis can be performed. For analysis, the program requires the following: 1) Input node, 2) output node, 3) start frequency, 4) stop frequency, 5) number of points, and 6) Linear or logarithmic sweep. At every frequency, each element of the P matrix passes through its corresponding position in the numerator block-out mask to form the real part of the matrix's complex determinant as shown.

NUMERATOR MASK COMPLEX DETERMINATE 1 REAL |A| IMG |B|

P INPUT 1

j COMMMON Rel[N] + Im[N] Q j OUTPUT MAG< N INPUT MAG< 1/j MAG< R D 1/j Rel[D] + Im[D] INPUT j

S j COMMMON REAL |A| IMG |B| DENOMINATOR  = 2f MASK

With appropriate frequency adjustments, the Q, R, and S matrices receive similar treatment of the denominator, the program then evaluates the determinate and converts the information into polar coordinates to present as final output data. The numerator mask suppresses the rows representing the input and common node and the columns representing the output and common nodes. Suppression of rows and columns representing the input and common nodes occurs in the denominator mask. The figure above illustrates the details of this function. Reference 3 offers the underlying theory and treatment of the analysis method. When the computer finishes displaying the frequency analysis data, the program displays an option to either stop or continue. If the continue option is selected, the program returns to the main menu which allows the user the ability to analyze the original circuit over a different frequency range or additional elements may be added. If necessary, negative passive elements can be used to remove and replace various network values for further analysis.

Active Devices The approach to active device modeling is similar to that for passive devices. Because a FET's first order AC model is merely a transconductance, this type of device is the simplest for analysis in an admittance matrix. Note that the inter-electrode components (such as capacitance) between existing nodes require no additional memory space because those elements are modeled as would any other passive component.

Circuit Model Network Model

+VDD 5

2.7K

4 1K 2 3 3 + V 4 1K 2 + gs gmVgs gm = 35  mhos 2.7K - 1 1 V

+ 51 1 1 V 5

51

5

FET model Any other type of transistor can be modeled as a simple extension of the FET model. The small signal NPN Bipolar Junction Transistor is modeled by calculating the equivalent input voltage from the values of input current, Ib and base-emitter resistance,

Rbe. The base-emitter resistance is calculated from the dynamic resistance that is calculated in the following equations.

kT e 0.026V Rd   ohms I E I E Where :

Rd  Dynamic Resistance 23 Joules k  Boltzman' s Constant(1.38 10 K ) T  Temperature( Kelvin  room temperature  300K) e  Electron volt(1.602 1019 Joules)

I E  Bias current

Equation 1 Dynamic Resistance For this circuit model, P matrix loading requires two separates steps: First the program loads the resistive component Rbe; then it calculates the transconductance (using

Circuit Model Network Model

+VCC 5

26mV R =  = 120 d 2.7K IE 1K IE = 3.25 mA 4 2 3  Rbe = Rd( +1)

Ib 3 + R = 960 Ib be 1 2.7K 4 1K 2 1 V

51 + 1 5 1 V

51

5 the transistor's base-emitter resistance and current gain, Beta) and loads that value into the P matrix. Bipolar Junction Transistor Model Op-Amp modeling utilizes a differential voltage gain block with defined output impedance. With the same subroutines used or the transistor, the program calculates the block's low frequency Norton output equivalent and loads it into the P matrix as a resistance and transconductance.

Transmission Lines The program also accommodates transmission line analysis, but this type of passive network element presents a unique problem and must be modeled as an active device.

Circuit Model Network Model

1 50 4 2 25 Z = 50; Length = 3X1010 meters 0 + + Y E 1 4 12 2 I I 1 E2 Y 2 E1 22 50 2 Y + 11 Y E 5 3 + 21 1 - - 1 V 25 25 1 V 3 25

Circuit Model Network Model 5 - j - j R = 50 OUT Y11 = Y22 = 1.8K 1 Y12 = Y21 =4 Z 0 tanq Z 0 sinq + 5 + 3 1.8K 1 3 5.6K 50 + 4 VIN A = 100K + + - + - 2 1 V 5.6K AV 5 1 V IN - - 2 2.7K

2.7K 5 5 5

Transmission line starts with the following equation (ref. 4):

E1  E 2 coshx  I 2Z 0 sinhx Limiting the model to loss-less lines and assuming implied reciprocity, applying hyperbolic-to-circular identities yields:   j   j  I 1   E1   E 2  Z 0 tan   Z 0 sin    j   j  I 2   E 2   E1  Z 0 tan   Z 0 sin  In each of these equations, the first and second voltage coefficients are admittance and transadmittance components, respectively. A significant difference exists between this transmission line model and the model cited earlier. The complex frequency can no longer be factored out of the matrix, thus requiring an additional N x N matrix and network list for transmission lines. Execution time also increases, because the program must load a new matrix at each new frequency. However, the use of an IF statement saves the execution time when the transmission line list is empty by bypassing the transmission line subprogram. The open and shorted transmission line stub conditions can be derived by opening

(I2=0) or shorting (E2) the transmission line model's output and solving for the input admittance. Both exercises yield a circular function 2 - terminal admittance for loading into the S matrix like the transmission line data at each new frequency. To minimize memory requirements, these elements use a subset of the data acquisition and transmission line matrix loader routines.

References 1. Niemeyer, E., "Network-analysis program runs on small computer system," EDN, Feb. 4,1981, pg 126. 2. Schnider, W.A., "Verify network frequency response with this simple BASIC program," EDN, Oct.5,1977, pg. 87. 3. Mason, S., and Zimmerman, H., Electronic Circuits, Signals and Systems, John Whiley and Sons Inc., New York, 1960. 4. ITT Editorial Board, Reference Data for Radio Engineers (fifth edition), Howard W. Sams and Co., Indianapolis, IN., March 1970

Recommended publications