A method for deriving the state space equations for degenerate linear time invariant circuits

A procedure for writing the state space equations for linear time invariant circuits is proposed. With this method the state equations for both degenerate and nondegenerate circuits can be derived in a systematic and unified manner. Capacitors' voltages and inductors' currents are chosen as state variables. First all the capacitors and inductors are replaced with voltage and current sources, respectively, and the modified nodal analysis is applied to this new circuit. By inspecting the system of equations obtained in this way and identifying the dependent equations among them, it is possible to detect any degeneracy, that is, dependency among the capacitors' voltages and inductors' currents, and subsequently refine the list of state variables. No knowledge of the circuits' graph is required and only its netlist description is needed in order to derive the equations, which makes it suitable for implementation as a computer program. Several examples are presented in which application of the method is demonstrated.


NASEH
the above two conditions are mathematically stated as: (1) in which X(t) is a vector with n rows containing all the state variables, with n being the number of the state variables and Ẋ(t) is the vector of time derivative of the state variables.A and B are matrices with constant elements of n × n and n × p dimensions, respectively, with p being the number of inputs.y(t) is a desired output in the circuit (e.g., the voltage or current of a branch), U(t) is a p × 1 vector, containing all the inputs, and C and D are 1 × n and 1 × p matrices, respectively, with constant elements.Sometimes derivatives of inputs may also appear in these equations.The relation (1) is called state equation in normal form and ( 2) is called output equation. 1 Different approaches for derivation of state equations have been proposed over the years. 10-26The first step in derivation of the state equation is selection of the state variables.As mentioned, the choice of the state variables is not unique, 15,20  but usually textbooks of circuit theory begin this topic with choosing the capacitors' voltages and inductors' currents as the state variables.One advantage of this choice is that it is compatible with students' intuition, as they are familiar to it as "initial conditions" of circuits.The number of state variables in a circuit is at most equal to the total number of capacitors and inductors in that circuit.The circuits in which the number of state variables is less than this, are called degenerate circuit, and is the focus of this work.
For the second step, the researchers pioneering in this field have proposed the circuit's topology by choosing a tree in its graph which includes all the capacitors and excludes all the inductors. 10-19Finding such a tree, called proper tree, however, is not always possible.This happens when the circuit has loops comprised of capacitors and voltage sources, and/or cutsets comprised of inductors and current sources, and are a cause of degeneracy condition (in examples in Section 3 it is shown that degeneracy can arise from dependent sources and elements with negative value as well).In Reference 12, the authors propose a method for deriving state equations in the case of degeneracy caused by loops of capacitors or cutsets of inductors.For loops of capacitors, the method involves selecting one capacitor and incorporating its current into the circuit equations in terms of the voltages of the other capacitors in the loop (a similar procedure is used for cutsets of inductors).However, this method does not provide a solution for degeneracy caused by dependent sources or negative value elements.In Reference 13, a general method is proposed for deriving the state equations which is helpful for theoretical studies, however the method is not practical for the purpose of state equation derivation for circuit analysis.In Reference 14 an extensive discussion of the state equations for the circuits is given but it does not provide a systematic procedure for the degenerate cases, Authors in Reference 15 have left the degenerate circuits out of their discussions entirely.Reference 16 introduces a technique that identifies a tree capable of utilizing the capacitors within it and the inductors in its cotree as state variables.However, this method for identifying the tree structure is complex and is not effective when dealing with components that have negative values.The study discussed in Reference 17 is confined to circuits that are nondegenerate, whereas References 18 and 19 do not account for degeneracy arising from negative value elements or dependent sources.
More recently, methods are proposed which do not utilize circuit's graph for state equations derivation. 20-25The methods suggested in References 20 and 21 use the node potentials and possibly currents of some branches as state variables, and through a repetitive elimination process, it reduces the number of variables to a minimum amount.Using node potentials as state variable is not an intuitive choice, and the state variables are not completely known until the end of the elimination process.
In References 22-25 methods for state equation development based on replacing capacitors and inductors in the circuit with independent voltage and current sources, respectively, are suggested.The idea is that at each moment t = t o , every capacitor can be replaced with a constant voltage source v C (t o ), and every inductor with a constant current source i L (t o ), and solving the resistive circuit obtained in this way using the conventional methods (e.g., nodal or mesh analysis) readily produces the equations ( 1) and (2), which are easily understood by students too.This is because the currents through voltage sources substituted for capacitors (i C = Cdv C ∕dt), and voltages across the current sources substituted for inductors (v L = Ldi L ∕dt) are essentially the state equations in (1).The method is straightforward and leads to a system of first order differential equations (i.e., state equations (1)) simply by solving a resistive circuit with DC sources.Regarding the degenerate circuits, however, these methods have some limitations.In References 22 and 23 degeneracy due to capacitive loops or inductive cutsets are treated as special cases, but they offer no solution for degeneracy caused F I G U R E 1 (A) Circuit used to demonstrate the proposed method.(B) Resultant circuit after replacing the capacitors and inductors with independent voltage and current sources, respectively.
by dependent sources or negative value elements.Similar methods are presented in References 24 and 25 but degenerate circuits are left out of their discussions altogether.None of these methods 22-25 consider the cases in which inductors have mutual inductance.In a more recent work 26 authors present examples of deriving state equations which is essentially based on mesh or node analysis developed by inspection of the circuit schematic, but they do not offer a systematic procedure for the general cases.So still remains the need for a general method which can be used for all cases of degenerate circuits.
Another issue common among most of the literatures and pedagogical materials that discuss the circuit analysis using state variables is that they rely on visual inspection of a circuit's schematic in their examples to introduce the concept of degeneracy, or to detect degeneracy in a circuit, that is, circuit's graph is implicitly used by highlighting capacitive loops or inductive cutsets in a circuit's schematic.While this is sufficient for introducing the subject to students, it is not adequate for circuits of larger size, or degeneracies caused by dependent sources and negative value elements.When a circuit is analyzed for the first time, presumably there is no a priori knowledge of its degeneracy condition.Therefore, it will be helpful to student's learning if a general and rigorous procedure of state equation derivation is available that treats degenerate and nondegenerate circuits in a systematic and unified manner, detect any degeneracy in the process, and handles it duly.
The method proposed in this work satisfies these conditions: it only needs a netlist description of the circuit (similar to what is used in SPICE-like simulators), detects any dependencies among capacitors' voltages and inductors' currents, and generates a system of equations which readily leads to state equations.It is shown that by adding two extra steps to the procedure in References 22-25, which are straightforward and easy to understand, a general method of derivation of state equations is obtained.In Section 2 this method is illustrated by applying it to a typical degenerate circuit, and based on that example the steps of the procedure are determined.Next, in Section 3 application of the method to some more examples are presented, and the conclusion is given in Section 4.

DERIVATION OF STATE SPACE EQUATIONS FOR A DEGENERATE CIRCUIT
The circuit in Figure 1A is used to illustrate the application of the proposed method.Inspecting the circuit's schematic reveals that the three capacitors form a loop, and the two inductors form a cutset, and thus the circuit is degenerate, that is, knowledge of initial voltages of only two of the three capacitors, and initial current of one of the inductors at each moment is sufficient to calculate voltage and current in any other branches of the circuit at that moment.It is emphasized, however, that prior knowledge of degeneracy of a circuit is not necessary for the state-equation derivation here.
In the first step, as done in References 22-25, the capacitors in the circuit are replaced with independent voltage sources, and all the inductors with independent current sources, resulting the circuit in Figure 1B.Before proceeding any further, it is important to note that this circuit has a loop of independent voltage sources and a cutset of independent current sources.This types of circuit configuration are uncommon, and conventional circuit analysis do not result in a unique answer (i.e., the circuit is indeterminate).For this reason the previous works have either excluded these configurations from their discussion 17,24,25 or considered them as special or irregular cases. 22,23Nevertheless, as will be shown shortly the analysis of these configurations can be performed in exactly the same way as that of any other common configuration, and since the substitute sources are not real sources, after writing the circuit equations some additional information that was initially obscured could be extracted which is then used to check whether the circuit is really indeterminate, or it actually is determinate.
The modified nodal analysis (MNA) 27 is now applied to the circuit in Figure 1B.The result is the system of equation (3) below.In MNA, like conventional nodal analysis, 15 node potentials (the nodes denoted with encircled number in Figure 1B), e 1-4 , are taken as unknowns, and KCL equations for each of these nodes form part of the system of equations.These are the rows 1 to 4 in (3).Additionally, in MNA, the currents through inductors and voltage sources are also taken as unknowns, and the equations associated with the potential difference across them are incorporated into the system of equations.In Figure 1B the currents through the voltage sources, i C1-3 , are introduced as new unknowns, and their associated equations appear in rows 5 to 7 in (3).Since in the proposed method inductors are replaced with current sources, obviously no inductor's current appears as unknown, but they are considered as inputs of the circuit and appear on the right side of (3).
Equation ( 3) is denoted by M⋅E = S, with M being the q × q matrix of coefficients (q being the number of unknowns), E being the vector of unknowns, and the vector S containing the inputs, or sources, which includes both the actual sources originally present in the circuit (i s in Figure 1A,B) and the new sources added to the circuit as substitute for capacitors and inductors (v C1-3 and i L1-2 ).
At this point it can be determined whether or not the circuit is degenerate: if the system of linear equations in (3) has a unique answer, the circuit is nondegenerate, that is, for any arbitrary values of capacitors' voltages v C1-3 and inductors' currents i L1,2 , and the independent current source i S , all the branches' currents and voltages in the circuit in Figure 1A are determined unambiguously and equations (1) and (2) for this circuit can be derived from solution of E in (3).In linear algebra this condition is stated as the matrix M having full rank, that is, all the rows in M being independent of each other, in which case the procedure in References 22-25 can be effectively used to derive the state equations.
On the other hand, if M is not of full rank, (3) does not have a unique answer or any answer at all.But as will be shown this is not an obstacle towards derivation of the state equations.M not being of full rank indicates that there are at least two equations in (3) that are dependent, and this can be used advantageously for the derivation.
To identify the dependent rows in M, the dependence relation for all the rows in the matrix is written which results in: in which k i , (i = 1,2, … , 7) are the constant coefficients to be found, and is the ith row of M. If k i s with nonzero values can be found that hold in (4), the corresponding rows of M will be dependent on each other, as will be shown next.By rearranging (4) in matrix format, a homogeneous system of linear equations can be formed: Equation ( 5) can be denoted by M T K = 0, in which M T is the transpose of M and K is the column vector of unknown k i s.M T is a sparse matrix and can be solved readily with the following answer: k 3-7 can have arbitrary values, with the constraints (7) and (8).From (7) and (8) it is seen that two separate groups of dependent equations in (3) can be identified: one comprised of equations in third and fourth rows, and the other one comprised of equations in fifth, sixth, and seventh rows.Writing the dependency relation for the left and right side of the equations in each group results in: and Equations ( 9) and ( 10) can be used for two purposes.First, they uncover and clearly display dependency among the inductor currents, and among the capacitor voltages.(9) indicates that knowing current through one of the inductors is sufficient to determine the current through the other one, and (10) indicates that with knowledge of two of the capacitors' voltages, the other capacitor voltage can be determined.Therefore in the rest of the analysis only one inductor's current and two of the capacitors' voltages are used as state variables.
The second use of ( 9) and ( 10) is that they are utilized to turn the incomplete set of system of linear equations in (3) into a complete one.Since the equations in third and fourth rows of (3) are dependent, one of them is redundant, and must be replaced with another equation.Similarly, equations in fifth, sixth, and seventh rows are dependent and one of them is redundant and must be replaced with a new equation.This can be achieved by derivation of ( 9) and (10) versus time.Differentiating (9) results in: and differentiating (10) leads to: Substituting (11) and (12) for the redundant equations in (3) results in the following system of equations: As in the case of system of equations in (3), it should be checked whether (13) has a unique answer or not.Following the same method which was used to identify the dependent equations in (3), a homogeneous system of equations can be formed, as shown in (14).Solution of ( 14) is shown in (15), ( 16) and (17): It can be seen that as long as the sums (1∕L 1 + 1∕L 2 ) and (1∕C 1 + 1∕C 2 + 1∕C 3 ) are not zero, then k 4 and k 7 must be zero and thus all the coefficients in (17) are zero.This means that all the equations in (13) are independent from each other and therefore (13) has a unique solution, which means that the circuit has three state variables i L1 , v C1 , and v C2 and the state equations ( 1) and ( 2) can be derived from solving (13).Equation (1) for the circuit in Figure 1A is as following: Thus by solving (13) to obtain e 2 , e 3 , i C1 and i C2 , (18) will be: To write equation ( 2) for the circuit of Figure 1A first the intended output should be specified.As a typical example the current flowing through resistor R 3 is chosen, which makes equation (2) for Figure 1A as: which indicates that for this circuit the matrix D = 0.
If the sums (1∕L 1 + 1∕L 2 ) and/or (1∕C 1 + 1∕C 2 + 1∕C 3 ) are zero, k 4 and/or k 7 can have arbitrary values.Thus from ( 17), one or two groups of dependent equations in (13) can be recognized: one comprised of rows 3, 4, 5, and 6, and the other group comprised of rows 1, 2, 5, 6, and 7. Again the same process by which the relations (4)-( 13) were derived, would be performed.This process can be repeated as many times as needed, until a complete system of equations is arrived at (i.e., the system has a unique solution), or until at one iteration, when the dependency relation for the dependent equations (similar to ( 9) and ( 10)) is written, none of the "substitute sources" appear on the right side of the dependent equations.This is a key observation in this method: if this happens in a circuit, no new equation (such as (11) and ( 12)) can be extracted and thus, the incomplete system of equations cannot be turned into a complete system.As will be shown in Example 3 in the next section, such circuits have infinite number of solution (refer to section 7 of chapter 13 in Reference 15) which usually occurs as a result of inadequate modeling of the real physical situations.

Description of the procedure for deriving the state equations
All the steps taken above to derive the state equations for the circuit in Figure 1A can be applied to any other linear time invariant circuit.They can be formulated as steps of a formal procedure as follows: 1.All the capacitors and inductors in the circuit are replaced with DC voltage and current sources, respectively, with their values being the voltage and current of those elements at each moment.In order to distinguish these new independent sources from those originally in the circuit, they will be referred to as "substitute sources".This replacement results in a resistive circuit, that is, the resultant circuit is made of resistors and independent sources, and possibly some dependent sources.2. The modified nodal analysis (MNA) 27 is applied to the new resistive circuit obtained in the first step, and equations are written in the matrix format: with M, E and S being the same as those in (3). 3. Next, following the same steps as in ( 4) and ( 5), or as ( 14), the homogenous system of equations is formed, in which M T is the transpose of matrix M in (21).If (22) has only a trivial solution for K (i.e., the only solution is K = 0), then M is of full rank, that is, M has no dependent rows, and the system (21) has a unique solution for any arbitrary value of S, which means that for any arbitrary values of capacitors' voltage and inductors' current, (21) has a unique solution.This implies that the number of state variables is equal to the total number of capacitors and inductors in the circuit, and the circuit is nondegenerate.In this case the state equations ( 1) and ( 2) are obtained by solving (21), as was done for circuit in Figure 1A, and also will be shown in the examples of the next section.4. If, on the other hand, ( 22) has a nontrivial solution for K, it means there are some dependent rows in M, and they are identified by the nonzero components of K (similar to how ( 7) and ( 8) determined the two groups of dependent rows: (third and fourth), and (fifth, sixth, and seventh) in ( 3)).For each group of dependent rows in (21) there is one redundant equation, which can be eliminated.If replacement equations could be found to replenish the system of equations in (21) so that it becomes complete, the state equations can be developed for the circuit.5. To check whether a replacement for the redundant equations can or cannot be found, the linear dependence relation is written for each group of the dependent equations identified in step 4, which leads to the following relation: in which (m i1 m i2 … m iq ) is the ith row of M with q being the number of columns in M, s i is the ith row of S, with index i spanning over the dependent rows of M. The terms s i are comprised of the original and/or the substitute sources in the circuit.For instance for the circuit in Figure 1A, (23) was written twice: once for third and fourth rows of (3) which resulted (9), and once for fifth, sixth, and seventh rows of (3) which led to (10).Relation ( 23) is combination of two equations.The 0 in (23) denotes a row vector for the left side, and a scalar for the right side of the equation.6.As was seen for the circuit in Figure 1A, and also is explained next, whether new equations can, or cannot, be found, is determined by inspecting the equation on the right side of (23), ∑ i k i s i = 0.It will be argued that the "presence" or "absence" of any of the "substitute" sources among the s i terms in this equation, is the key to determining whether the state equations can, or cannot, be developed, respectively.Each case is considered separately: a.At least one substitute sources is present among s i terms in the equation This equation is used for two purposes.One is that it shows which of the sources, whether original or substitute, are dependent on each other, indicating which of the capacitors' voltages and inductors' currents can be eliminated from the list of the state variables.The other purpose is that the new equation to replace the aforementioned redundant equation in ( 21) is obtained simply by taking the time derivative of ∑ i k i s i = 0, that is, the sought new equation is: This is because the time derivative of the "substitute" sources in the s i terms are essentially the capacitors' currents or inductors' voltages, which are already among the unknowns in the vector E in (21).Incorporating (24) into the system of equations in (21), is in essence equivalent to incorporating the current-voltage relation of those capacitors and inductors whose initial conditions are dependent on each other (or possibly on some of the original sources in the circuit) into the system of equations in (21).b.There is not any of the substitute sources among the s i terms in the equation This means that some of the "original" sources in the circuit are dependent on each other.Usually this condition arises as a result of inadequate modeling of the real physical situation, as the inputs to the circuit, that is, the original sources in the circuit, ought to be independent.∑ i k i s i = 0 merely imposes a constraint on the values of the original sources in the circuit, but unlike the previous case it cannot be utilized to find any new equation to make the system in (21) complete.Therefore, in this case the circuit is indeterminate and can have infinite number of solutions no matter what the initial conditions of the capacitors and inductors in the circuit are, as is the case of Example 3 in the next section.
In the next section some examples are presented which further illustrate how the method is applied to the degenerate circuits.In each example it will be shown how a system of equations such as (13) is found, and the state equations ( 1) and (2) for each case is derived from solving that system of equations.Also, in the Appendix an example of applying the proposed method to a typical circuit is presented in which it is shown how the procedure can be implemented in the form of a computer program.

SOME EXAMPLES
Example 1.For the circuit shown in Figure 2A it will be shown how a dependent source or an elements with negative value can cause degeneracy.Following the first and the second steps of the procedure, the circuit in Figure 2B and the system of equations ( 25) are obtained.Modified circuit with capacitors replaced by independent voltage sources.
Following the step 3 of the procedure, dependency coefficients for the rows of matrix in (25) are determined as: By inspecting ( 27) and ( 28) it becomes clear that if the factor A of the dependent voltage source has any value other than 1, then the only value the coefficients k 5-8 can have is zero, indicating that there will not be any dependent rows in (25), and thus the circuit is not degenerate.If A = 1, however, rows 5, 6, 7, and 8 in the matrix of coefficient in (25) will be linearly dependent, with the coefficients k 5-8 being any nonzero values that hold in (27).Therefore the case A = 1 is considered here.Applying the linear dependency of these rows to the right side of the rows leads to: which means that the voltage on one of the capacitors in the circuit is dependent on the other two capacitors' voltage.
Taking derivative of both sides of (29) results in: The last row of (25) (arbitrarily chosen among rows 5, 6, 7, and 8) is replaced with the equation in (30), which leads to the system of equations in (31).As long as the rows in matrix of coefficients in (31) are independent, the system of equation has a unique solution for any values of v C1 and v C2 , which means the circuit has two state variables.
To find the state equation (1) for this circuit, it is seen that: Obtaining i C1 and i C2 from solving (31) gives the state equations: Choosing the current flowing through R 3 as a typical output, the equation ( 2) for this circuit is: To further examine the applicability of the proposed method for deriving the state equations, the case which there are dependent rows in (31) is investigated next.Following the same steps explained before, the dependency coefficients are obtained as in (35), and with the constraint in (36).The relation (36) indicates that k 8 can have nonzero values only if the circuit has some elements with negative values.In that case the coefficients k 2-8 in (35) can have nonzero values and thus these rows are dependent.Applying the dependency relation to the right side of these rows in (31) will lead to (37), which indicates that only one of v C1 and v C2 can be chosen arbitrarily, and therefore the circuit has only one state variable.Differentiation of both sides of (37) versus time results in another equation in terms of i C1 and i C2 , which can replace one of the dependent rows in (31), which in turn leads to the system of equations (38) for this circuit (the eighth row in (31) was replaced with the new equation).
Again, as long as there are no dependent rows in the coefficient matrix in (38), it has a unique solution for any value of V C1 , and state equation (1) can be derived from solving (38), as shown below: Selecting i C3 once again as a typical output, equation (2) for this case is obtained by solving equation (38), which can be expressed as follows: Example 2. In the circuit shown in Figure 3A, two separate inductive cutsets can be recognized: one consists of L 2 , L 3 , and L 5 and the other one consists of L 5 , L 7 , and L 8 .There is also mutual inductance between L 5 and L 7 , and it will be shown how it affects the derivation of the equations.Following the steps 1 and 2 of the procedure, the system of equations in (41) can be written for the circuit in Figure 3B.
The dependency among the equations in (41) is found as before (i.e., similar to equations ( 4)-( 8)) with the following dependency coefficients: In (42) k 2 and k 4 can have any arbitrary values, indicating that two groups of dependent rows in (41) can be recognized: one comprised of rows 2 and 3, and the other one comprised of rows 4 and 5. Writing the linear dependence relation for the right side of each of these two groups, the following two equations are obtained: (43) and (44) form a system of homogeneous equations which has two equations and five unknowns.This system has infinite number of solutions, in which three of the five unknowns can have arbitrary values, and the remaining two are expressed in terms of the former three.The choice of the three unknowns that can be chosen arbitrarily is not unique; for example either of (i L2 , i L3 , i L8 ) or (i L2 , i L5 , i L7 ) can be chosen as state variables.
Before applying the sixth step, the mutual inductance for L 5 and L 7 is considered.It is described as follows: Performing time differentiation on the left and right side of the (45) it follows: Using the inverse of the matrix of inductance in (46), the following can be written: Now applying the sixth step of the procedure to (43) and ( 44) and taking into account (47), the following two new equations are obtained: and After replacing the third and fifth rows in (41) with ( 48) and (49), respectively, the following system of equations is obtained: If the coefficient matrix in (50) has full rank, the node potentials in the circuit can be determined uniquely with the knowledge of i L2 and i L3 .The current in L 7 , i L7 , can also be calculated using ( 43) and (44) and knowledge of i L8 , which indicates that (i L2 , i L3 , i L8 ) are the state variables in this circuit.
The state equation ( 1) for this circuit is obtained by considering the node potentials in Figure 3, and: Thus solving (50) to obtain node potentials e 1 , e 2 , and e 5 , the state equation (1) will be in the form of: Denoting inverse of L 2 , L 3 , and L 8 with Γ 2 , Γ 3 , and Γ 8 respectively, the elements a ij s are obtained as: and elements b i s are: The current through L 7 is chosen as a typical output, which can be expressed in terms of i L2 , i L3 , and i L8 : which means matrix D in (2) for this variable is zero.
It should be mentioned that if the inductance matrix in ( 45) and ( 46) does not have an inverse, the equation in (47) cannot be written.In that case each of the inductance L 5 and L 7 can be replaced with a self-inductance in series with a dependent voltage source which models the mutual inductance, with value of each element according to (45), and the procedure can be applied to this circuit to derive the state equations.4A has a loop made of the three independent voltage sources v s1 , v s2 , and v s3 .Applying the first step of the procedure results in the circuit in Figure 4B, and applying MNA to this circuit results in the system of equations in (63).

Example 3. The circuit shown in Figure
Following the third step of the procedure, the dependent rows in the coefficient matrix in (63) are identified as rows 5, 6, and 7, which leads to: which means that one of the three voltage sources v S1-3 cannot have an arbitrary value and is dependent on the other two.
As discussed in the last section during the explanation of the procedure, since none of the substitute sources appears in (64), unlike the last examples no extra equation can be found to replace any of the three dependent equations in (63).This arises from the fact that no functional relation exists between the current and voltage of sources, and as such no new information can be extracted from (64) to incorporate into (63) to turn it into a complete system of equations.Therefore the circuit is indeterminate and does not have a unique solution.The solution to the system in ( 63) is: In (65), i S2 can have any arbitrary value, meaning that the circuit has infinite number of solutions.Also, v S2 was eliminated from the equations, as it can be expressed in terms of v S1 and v S3 , which as inputs can have any arbitrary values.

CONCLUSIONS
In teaching the state space analysis in the circuit theory courses and the related literatures, degenerate circuits and nondegenerate circuits are considered separately, causing the impression on students' mind that derivation of the state space equations of degenerate circuits require fundamentally different methods from that of nondegenerate circuits.It will be helpful to students' learning to rectify the situation and provide an analysis method that deals with these two types of circuits in a unified manner.
A method of deriving the state space equations for linear time invariant circuits was proposed that handles degenerate and nondegenerate circuits in the same way.First, the voltage of all the capacitors and the current of all the inductors are considered as state variables, and if necessary (i.e., if the circuit is degenerate) the list is narrowed down in due process.
It starts with transforming the circuit into another circuit by replacing all its capacitors and inductors with independent voltage and current sources, respectively.The modified nodal analysis is then applied to this new circuit, resulting in a system of linear equations.By inspecting this system of equations it can be determined whether or not the circuit is degenerate, and if so, it is also determined which of the capacitors' voltage and inductors' current can be eliminated from the list.In other words, if some of the (presumed) state variables are dependent, this dependency will emerge in a natural way as a result of applying the basic circuit equations (KVL and KCL) to the circuit under investigation.
In the proposed method there is no need to use the graph of the circuit and only a netlist description of the circuit, similar to what is used in the SPICE-like simulators, is used, which makes it amenable for implementation as a computer program.The procedure was applied to several examples in which presence of capacitive loops, inductive cutsets, dependent sources and elements with negative values caused degeneracy condition in the circuit.
The input file for this circuit, which can be verified by comparing it to the circuit schematic, is as follows: The equation representing this circuit using the modified nodal analysis (MNA) method, as explained earlier, is given by M⋅E = S: ] .

(A1)
The above equation can be verified to be equivalent to equation (3) (with the effect of the current source i S2 included).The righ side vector S, apart from its single column format, is expressed as the sum of two terms.The first term accounts for the impact of substitute current sources (inductors and capacitors), while the second term incorporates the influence of independent current sources in the circuit.Hence, equation (A1) can be written as follows: In this relation SLC (representing the substitute for inductor current and capacitor voltage) refers to the 7 × 5 matrix on the right.SV (denoting the state variables) represents the vector of 5 initial state variables.SIV0 (indicating its relation to current and voltage sources) corresponds to the 7 × 2 matrix on the right.Lastly, IV (representing current and voltage input sources) stands for the vector of independent sources in the circuit.The inclusion of the digit 0 in the name SIV0 signifies that it is multiplied by the "zero" order derivative of the independent sources.This differentiation is necessary because the equation may involve first or higher order derivatives of input sources later in the process.Splitting S into two parts proves advantageous as it facilitates the separation of original sources from substitute sources (i.e., state variables) right from the start.This division enhances the convenience of writing the program, as will be explained later on.
If the determinant of matrix M in equation (A1) is nonzero, the system of equations has a unique solution, and the circuit consists of five state variables.However, if det(M) equals zero, the dependent rows in matrix M need to be identified.This can be achieved by finding the reduced row echelon form of the transpose of matrix M. 28 The reduced row echelon form is obtained by performing basic row operations on the matrix. 28It ensures that certain columns have a single element equal to 1, with all other elements in those columns set to zero.The remaining columns can be expressed in terms of these basic columns.
MATLAB provides a built-in function, rref(), which can be used to generate the reduced row echelon form of a matrix.Applying this function to the numerical values provided in the input file for the circuit shown in Figure 1, the reduced row echelon form of M T in equation (A1) is obtained as follows: By examining equation (A3), it is observed that in matrix M, row 4 is dependent on row 3 (i.e., row 4 equals the negation of row 3), and row 7 is dependent on rows 5 and 6 (i.e., row 7 equals row 5 minus row 6). 28These dependency relations also hold true for the corresponding rows on the right side of equation (A1).Consequently, we can express the following relations: and: As outlined in the procedure steps, equations (A4) and (A5) are utilized to eliminate redundant state variables.The program's code responsible for performing the elimination can extract the indices of the dependent rows from the previous step, that is, equation (A3).Subsequently, the program can be designed to display the state variables involved in each equation and interactively prompt the user to select a variable for elimination.
Once a variable is selected, the program can replace its occurrences on the right side of equation (A1) in terms of the remaining state variables (and potentially some independent sources).Referring to equation (A4), we observe that: Based on equation (A6), either i L1 or i L2 can be chosen for elimination.Let us consider the scenario where i L1 is selected for elimination.In this case, any occurrence of i L1 on the right side of equation (A1) needs to be replaced with i L2 − i S2 .
To identify the locations where i L1 appears in equation (A1), it is observed that i L1 corresponds to the fourth variable in the vector SV.Therefore, all nonzero elements in the fourth column of SLC indicate where i L1 is present, and these elements should be replaced with i L2 -i S2 .Consequently, the corresponding elements in the fourth column of SLC will become zero.Simultaneously, the corresponding elements in the fifth column of SLC and the second column of SIV will be adjusted accordingly.
Similarly, equation (A5) identifies dependencies among other state variables: Referring to equation (A7), one variable, v C1 for example, can be expressed in terms of the other two variables.Similar to the elimination of i L1 in equation (A1), v C1 can be eliminated and replaced with v C2 + v C3 .This elimination process involves modifying the corresponding element for v C1 .
To eliminate v C1 , the 1 in the first column and fifth row of SLC is replaced with zero, and at the same time the zeros in the second and third columns of the fifth row of SLC are replaced with 1, reflecting the new expression of v C1 as v C2 + v C3 .
As explained in the procedure steps, equations (A4) and (A5) can also be used to generate new independent equations by taking their time derivatives.By deriving equation (A4) with respect to time and considering the voltage across each inductor, we obtain: and deriving (A5) results in: To facilitate future manipulations, the derivatives of the current through each inductor and the voltage across each capacitor in the circuit can be expressed as a row vector multiplied by the vector of unknowns, E, in equation (A1).By consolidating these equations, they can be expressed in the following format: Equation (A10) is denoted as (SV) ′ = DLC ⋅ E which represents the derivative of inductors' currents and capacitors' voltages.The 5 × 7 matrix on the right is aptly named DLC, hinting at its connection to the concept of differentiation.
By substituting the dependent equations in rows 4 and 7 of equation (A1) with equations (A8) and (A9) respectively, the new system of equations M⋅E = S is obtained: (A11) can be denoted with: where SIV1 represents the second 5 × 2 matrix on the right side, and (IV)' denotes the derivative of the input sources.
Notably, the columns one and four in the SLC matrix are zero, implying that the variables v C1 and i L1 are excluded from the calculations.This exclusion is a direct consequence of eliminating these two variables at an earlier stage of the process.
If the determinant of matrix M is nonzero, both sides of equation (A12) can be multiplied by the inverse of M, yielding the following result: Now, focusing on equation (A10) and narrowing our attention to the second, third, and fifth rows of matrix DLC (which correspond to the variables of interest), the following relationship can be established: Taking into account equations (A13) and (A14), and noting that columns 1 and 3 in matrix SLC (from equation A11) are zero, we can eliminate variables i L1 and v C1 from the SV vector.Rewriting the state equation ( 1) in the following form: With these considerations, the matrices A, B0, and B1 can be obtained as follows: and: and: Based on the calculations and explanations provided above, it should be evident that matrices C and D can be derived in a similar manner.Therefore, the derivation of matrices C and D is left as an exercise for the reader.
If det(M) is equal to zero, the process of finding the echelon form of M, which led to equation (A3), can be repeated.This repetition continues until either a matrix M is discovered where det(M) is not zero, or it is established that the circuit is indeterminate.
The explanations provided above can be presented in the form of instructions or pseudo-code for a program.Below is a possible representation.The initial phase of the program involves reading the input file and constructing matrices M, SLC, DLC, and SIV0.The file is read twice: first to extract the number of nodes and elements, and then, during the second scan, this information is used to determine the elements of the matrices in (A1). 1.To keep track of the number of elements in the circuit, the variables ngn, nC, nL, nV, nI, nE, and nH are defined.Here, ngn represents the number of nonground nodes, and the meanings of the other variables are explained in step 5. 2. Create an empty vector called SV_symbols to store the symbols of the state variables.3. Iterate through the input text file, scanning it line by line, with the delimiter set as a blank space.4. Determine the element type based on the first letter of each line in the file.Then, using the second and third parts of each line, identify the node numbers across the element and store them.a.If a resistor between nodes i and j is encountered, perform the following actions: i.If i is not the ground node, in matrix M add the inverse of the resistor's value to elements m(i, i).ii.If j is not the ground node, in matrix M add the inverse of the resistor's value to elements m(j, j).iii.Additionally, if neither node i or j is the ground node, add the negative of the inverse of the resistor's value to elements m(i, j) and m(j, i) in the matrix M.
b.If a capacitor between nodes i and j is encountered, perform the following steps: iii.If node j is not the ground node, in matrix SIV0 change the element SIV0(j, nI + nV) to 1.
f.If a voltage-dependent voltage source is detected between nodes i and j, that its voltage is A times the potential difference of nodes p and q: i. Increment nE by 1. ii.If node i is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, i) and (i, ngn + nC + nV + nE + nH) to 1. iii.If node j is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, j) and (j, ngn + nC + nV + nE + nH) to −1. iv.If node p is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, p) to −A. v.If node q is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, q) to A.
g.If a voltage-dependent current source is detected between nodes i and j, with a current equal to G times the potential difference of nodes p and q, the following actions are taken: i. Update nG by incrementing it by 1. ii.If neither i nor p are the ground node, add G to the elements m(i, p).iii.If neither i nor q are the ground node, add -G to the elements m(i, q).iv.If neither j nor p are the ground node, add -G to the elements m(j, p).v.If neither j nor q are the ground node, add G to the elements m(j, q).h.If a current-dependent voltage source is detected between nodes i and j, where the voltage is dependent on the current of another element in the circuit, the following actions are taken: i.If a current-dependent current source is detected between nodes i and j, where the current is F times the current of another element in the circuit, the following actions are taken: i. Increment nF by 1. ii.If i is not the ground node, in matrix M adjust the element corresponding to the row i and the appropriate column determined by the controlling element.iii.If j is not the ground node, in matrix M adjust the element corresponding to the row j and the appropriate column determined by the controlling element.
j.If there are mutual inductances indicated between certain inductors in the circuit, the corresponding effects should be incorporated into the matrix DLC, similar to the procedure described in (47) of Example 2.
Up to this point, the matrices M, SLC, DLC, and SIV0 have been generated.From here until the end of step 13, the focus is on identifying the dependent rows in M and possibly any rows in M that consist entirely of zeros.The goal is to determine the dependency of these rows on the independent rows in M and utilize these dependencies to eliminate redundant state variables.
8. If det(M) = 0, determine the reduced row echelon form of M T .9. Examine the columns of the reduced row echelon form of M T , denoted as rref(M T ), to identify its basic columns, which are equivalent to the pivot rows of M. If a column in rref(M T ) contains only a leading 1 (i.e., all other elements in the same row to the left of this 1 are zero), it is considered a basic column of M T .Record the indices of all basic columns of M T .10. Also store the indices of all nonbasic columns: if there are columns in M T which are totally zero, store their indices in a vector like zerorows.Store the indices of all nonzero nonbasic column of M T in a vector named such as nnzerodepenrows (standing for nonzero dependent rows).These indices will be utilized for subsequent processing.11.Determine the coefficients of the linear combination of each nonzero nonbasic column in rref(M T ) with respect to the basic columns to its left.These coefficients can be obtained by performing an inner vector product between each nonzero nonbasic column and the basic columns to its left in M T .Store these coefficients and associate them with their respective nonzero nonbasic columns.12. Utilize the coefficients determined in the last step to compute the linear combination of the dependent rows of matrix M.This calculation involves applying the coefficients to the corresponding rows of SLC, and SIV0, SIV1, … , for the right side of (A1).Notably, the rows on the left side will naturally become zero due to this operation.13.Combine the indices of the zero rows and the dependent rows in step 10 (zerorows and nnzerodepenrows) into a single vector, referred to as dependentrows.From this point onward, these two types of rows can be treated uniformly, simplifying the handling process.
The previous step concludes with the generation of equations in terms of the inductors' current and the capacitors' voltages, along with potential input sources.These equations resemble the ones depicted in ( 9) and (10) for the circuit in Figure 1.The subsequent three steps aim to refine the state variables by eliminating the redundant variables.Furthermore, these steps result in the generation of fresh equations that replace the dependent equations in the system, following a similar approach as demonstrated in equations ( 11)-(13).
14. Proceed with an iteration through all the dependent rows in (A1) as follows: Multiply each dependent row from the SLC obtained in the previous step by DLC, denoted as SLC(dependentrows(i),:)⋅DLC.In this process, where i ranges from 1 to the length of dependentrows, substitute the result of each multiplication for the corresponding zero row in matrix M (this operation is essentially equivalent to taking the derivative of the row on the right side of (A1)).15.Display all the associated state variables in the row obtained in the previous step (i.e., iL* and vC*) that correspond to the nonzero elements in that row of the SLC.Prompt the user to select the state variable they wish to eliminate.Store the chosen variable using a name such as v2beliminated, and store the remaining state variables in another vector.If, after finding the linear combination in the previous step, the corresponding row in the SLC is zero, it indicates that the circuit is indeterminate.16.In the SLC matrix, for rows other than the one under consideration, replace any occurrence of the variable chosen in step 15 to be eliminated, with the remaining state variables in that row.Update the elements in those rows within the SLC matrix and the corresponding rows in SIV0, SIV1, and so on, to reflect the necessary changes.If higher-order derivatives of input sources are generated during this step, create the corresponding higher-degree SIV*, such as SIV1 if it did not exist prior to this step.
At this point equation ( A1) is updated and it should be checked again if the system in the updated (A1) has answer or not.In the given relationships, DLC and SLC refer to specific subsets of rows and columns from the state variables, obtained after eliminating redundant variables in step 15.To clarify, DLC in equations (A19-A21) corresponds to the 3 × 7 matrix described in (A14).Similarly, SLC in these equations represents the 7 × 3 matrix mentioned in (A16), which is derived from SLC in (A11) with the exclusion of columns 1 and 4, corresponding to eliminated variables v C1 and i L1 .
Matrices D and C in (2) can be calculated in a similar way.
Example 1 showing degeneracy condition caused by dependent sources or elements with negative values.(B) Circuit of Example 2 with two independent inductive cutsets and mutual inductance.(B) Modified circuit with inductors replaced by independent current sources.
Circuit of Example 3 demonstrating a circuit with an infinite number of solutions.(B) Modified circuit with the capacitor and inductor replaced by independent voltage and current sources, respectively. b

17 .
If det(M) = 0, repeat through step 8, otherwise (i.e., if det(M) ≠ 0) calculate the matrices A, B0, B1, … as follows:A = DLC ⋅ inv(M) ⋅ SLC, (A19) B0 = DLC ⋅ inv(M) ⋅ SIV0, (A20)andB1 = DLC ⋅ inv(M) ⋅ SIV1, (A21) 5. When a new circuit element is read in a new line, update the total number of that element based on the following rules: a.For capacitors: Increment nC by 1. Create a symbol vC* for each capacitor, where * represents the other letters in the capacitor's name.Add this symbol to the end of the SV_symbols vector.b.For inductors: Increment nL by 1. Create a symbol iL* for each inductor, where * represents the other letters in the inductor's name.Add this symbol to the end of the SV_symbols vector.c.For independent voltage sources: Increment nV by 1. d.For independent current sources: Increment nI by 1. e.For voltage-dependent voltage sources: Increment nE by 1.f.For voltage-dependent current sources: Increment nG by 1. g.For current-dependent voltage sources: Increment nH by 1. h.For current-dependent current sources: Increment nF by 1. 6. Based on the node numbers scanned in the previous step, determine the total number of nonground nodes in the circuit and assign it to the variable ngn.Also: .Reset the variables nC, nV, nE, nH and nI to zero in order to prepare them for the second round of scanning the file in the next step.7. Perform a second round of scanning the input file, reading it line by line: a. Create a square matrix named M with dimensions n = ngn + nC + nE + nV + nH, filled with zeros.b.Create a matrix called SLC with dimensions n × (nC + nL), consisting of all zeros.c.Create a matrix called DLC with dimensions (nC + nL) × n, consisting of all zeros.d.Create a matrix called SIV0 with dimensions n × (nV + nI), consisting of all zeros.e i. Update nC by incrementing it by 1. ii.If node i is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, i) and (i, ngn + nC + nV + nE + nH) to 1. iii.Also, If node j is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, j) and (j, ngn + nC + nV + nE + nH) to −1. iv.In matrix DLC, change the element at row nC + nL and column ngn + nC + nV + nE + nH to 1 divided by the value of the capacitor.c.If an inductor between nodes i and j is encountered, follow these steps: i. Update nL by incrementing it by 1. ii.If node i is not the ground node, in matrix SLC change the element at row i and column nL + nC to −1, and in matrix DLC change the element at row nC + nL and columns i to 1 divided by the value of the inductor.iii.If node j is not the ground node, in matrix SLC change the element at row j and column nL + nC to 1, and in matrix DLC change the element at row nC + nL and column j to −1 divided by the value of the inductor.d.If an independent voltage source between nodes i and j is encountered, perform the following steps: i. Update nV by incrementing it by 1. ii.If node i is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, i) and (i, ngn + nC + nV + nE + nH) to 1. iii.If node j is not the ground node, in matrix M change the elements (ngn + nC + nV + nE + nH, j) and (j, ngn + nC + nV + nE + nH) to −1. iv.In matrix SIV0, change the element SIV0(ngn + nC + nV + nE + nH, nI + nV) 1. e.If an independent current source between nodes i and j is encountered, follow these steps: i. Update nI by incrementing it by 1. ii.If node i is not the ground node, in matrix SIV0 change the element SIV0(i, nI + nV) to −1.
. In the row ngn + nC + nV + nE + nH of matrix M, update any other elements determined by the controlling element.
i. Increment nH by 1. ii.Update matrix M as follows: iii.If i is not the ground node, in matrix M set the elements m(i, ngn + nC + nV + nE + nH) and m(ngn + nC + nV + nE + nH, i) to 1. iv.If j is not the ground node, in matrix M set the elements m(j, ngn + nC + nV + nE + nH) and m(ngn + nC + nV + nE + nH, j) to −1. v