**2. The state-variable method for electrical circuits**

Medium voltage electric networks are in fact complex circuits mainly made of power sources, resistors, inductors, capacitors and, sometimes, other electric components. Analyzing transient regimes in such networks is the same as the analysis of any other complex electric circuit (Dessaint, et al. 1999; Mandache & Topan, 2009; SIMULINK, 1997).

442 Numerical Simulation – From Theory to Industry

simulation programms.

SPICE and EMTP (Blume, 1986).

system analyses are automated (Mathworks®).

parameters of these models is of high importance.

**2. The state-variable method for electrical circuits** 

Choosing one or other of the simulation programs depends on the previous experience of the user, as well as, on the manner the program responds to the specific demands (Chuco,

No mater what program is used, the numerical analysis of transients eventually must be able to solve a set of differential – algebraic equations that models the physical system. By accounting the stage the numerical integration takes place at, there are two main classes of

One class consists of those programs that make the integration at element level, meaning that for each step of time discretization the differential equations associated to dynamic elements are transformed in finite difference relations. Several ways of approximation can be used, more frequently the trapeze rule being used. All these algebraic relations are then assembled and as a result an algebraic system of equations is obtained and consequently solved using specific algorithms. This procedure is repeated at each iteration step, the parameters involved in the equations being modified by the results obtained at the previous step. Usually the integration step is fixed, but if this is required by a lack of convergence, the integration step can be split in half and the computation process is resumed. This method is known under the name of the implicit integration method and is used in programs such as

A second class of programs uses a two step procedure. In the first step the mathematic model is expressed as a system of first order differential equations, known as the system's state equations. During the next step this system of equations is integrated using algorithms with fixed step or with variable steps, depending on the systems particularities. The advantage of this method, called the state variables method, is to treat in the same way, in a unitary manner, electric networks, electric machines, drives, control devices or any other device that allows state equations. A representative of this method is SimPowerSystemsTM which is an extension of Simulink® with tools for modeling and simulating of electrical power systems. It provides models of many components used in these systems, including three-phase machines, electric drives, and libraries of application-specific models such as Flexible AC Transmission Systems (FACTS) and wind-power generation. Harmonic analysis, calculation of Total Harmonic Distortion (THD), load flow, and other key power

The precision of the results obtained by integration of the equations describing the simulated system is quite remarkably high. It is obvious that none of the simulation programs, no mater which of the methods is using, cannot be more precise than the mathematic models used for the simulated components. The accuracy of the values of the

Medium voltage electric networks are in fact complex circuits mainly made of power sources, resistors, inductors, capacitors and, sometimes, other electric components.

2005; Danyek et al., 2002; Foltin et al., 2006; Karlsson, 2005; Rashid & Rashid, 2006).

Generally, an electric circuit, no mater how complex it is, is described by an algebraic linear system of equations, obtained by applying the Kirchhoff's laws. This system of equations reflects the circuit's topology. To complete the model, the voltage-current equation at the terminals of each element of circuit (called also constitutive relations) must be added.

The inductors and the capacitors are described by constitutive relations in which are involved the derivatives of currents, respectively voltages. As a result, the mathematic model of an electric circuit consists of a system of algebraic and differential equations (DAE).

In the electric circuit theory it is demonstrated that each current or voltage can be expressed as function of inductors currents and capacitors voltages. By other words if the inductors currents and the capacitors voltages are known, all remaining currents and voltages are uniquely determined and because of this they are called state-variables.

The state-variable equations are obtained by elimination of the algebraic equations in the initial DAE.

The modelization of an electric circuit made using state-equations has several important advantages.

First of all, electric circuits can be integrated with other dynamic systems, of completely different physical nature, as long as the last ones are described also by state-equations.

By the other hand, the procedures for integrating state-equations have a well-established theoretic support, being the domain of interest for quite a long period of time for famous mathematicians.

Finally, but not last, the method can be applied to linear circuits, as well as, to nonlinear circuits.

Of course there is a price to be paid for all these advantages: a certain difficulty in the elimination of the algebraic equations from the system.

In order to give an example for the basics of the state-variable method, we will analyze the simple RLC series connection circuit supplied by an ideal voltage source *u*(*t*). The Kirchhoff equations and the constitutive relations for such a circuit are, respectivelly:

$$\begin{aligned} i\_R(t) &= i\_L(t) = i\_\subset(t), \\ u\left(t\right) &= u\_R\left(t\right) + u\_L\left(t\right) + u\_\subset(t), \\ u\_R\left(t\right) &= Ri\left(t\right), \\ u\_L\left(t\right) &= L\frac{di\_L\left(t\right)}{dt}, \\ i\_C\left(t\right) &= \mathcal{C}\frac{du\_\subset\left(t\right)}{dt}. \end{aligned} \tag{1}$$

It is customary to write the last two equation in the form

$$\begin{aligned} \frac{d i\_L(t)}{dt} &= \frac{1}{L} u\_L(t), \\ \frac{d u\_C(t)}{dt} &= \frac{1}{C} i\_C(t). \end{aligned} \tag{2}$$

Numerical Methods for Analyzing the Transients in Medium Voltage Networks 445

The total number of the state variables is equal with the sum of the number of the inductors

All the other unknown variables are represented by the column matrix *y*(*t*) (also called output vector) represented by a linear combination of the state-vector and the sources

**y Cx Du** ( ) ( ) ( ), *tt t* (7)

The equation given by (6) describes the model, in state-space, of a linear electric circuit.

It is possible, as the result of using ideal elements in the modelization, to occur capacitive

A capacitive loop (see Fig. 1a) is a loop consisting only from capacitors and, possibly,

In this case the voltages at the terminals of capacitors from the loop are no more linearly

One, arbitrarily selected, of the capacitor voltages can be expressed as a linear combination

An inductive section is represented in Fig.1b, being composed by the convergence in a node of ideal inductors and, possibly, independent current sources. In this case the first

<sup>123</sup> 0 *SC C C uu u u* . (8)

(b)

2 3 <sup>1</sup> <sup>0</sup> *SL L L ii i i* . (9)

and capacitors from the circuit, representing the order of the circuit.

*C* and *D* being matrix of the same origin as *A* and *B*.

**Figure 1.** Capacitive loop and, respectively, inductive section

(a)

Such a situation is present also for inductive sections.

independent variables, because the second Kirchhoff's law gives:

vector):

loops or inductive sections.

independent voltage sources.

of the other voltages.

Kirchhoff's law states that

With the remaining equations *uL(t)* and *iC(t)* are obtained as functions of *iL(t), uC(t)*:

$$\begin{aligned} \boldsymbol{u}\_{L}\left(t\right) &= \boldsymbol{u}\left(t\right) - \mathrm{Ri}\_{L}\left(t\right) - \boldsymbol{u}\_{\complement}\left(t\right), \\ \boldsymbol{i}\_{\complement}\left(t\right) &= \boldsymbol{i}\_{L}\left(t\right). \end{aligned} \tag{3}$$

By the substitution in (2) it follows

$$\begin{aligned} \frac{d\dot{i}\_L(t)}{dt} &= \frac{1}{L}\mu(t) - \frac{R}{L}\dot{i}\_L(t) - \frac{1}{L}\mu\_\mathbb{C}(t),\\ \frac{d\mu\_\mathbb{C}(t)}{dt} &= \frac{1}{\mathbb{C}}\dot{i}\_L(t), \end{aligned} \tag{4}$$

or, in matrix form,

$$
\frac{d}{dt} \begin{bmatrix} i\_L(t) \\ u\_C(t) \end{bmatrix} = \begin{bmatrix} -\frac{R}{L} & -\frac{1}{L} \\ \frac{1}{C} & 0 \end{bmatrix} \begin{bmatrix} i\_L(t) \\ u\_C(t) \end{bmatrix} + \begin{bmatrix} -\frac{1}{L} & 0 \\ \frac{1}{L} & 0 \end{bmatrix} \begin{bmatrix} u(t) \\ 0 \end{bmatrix}.\tag{5}
$$

This is a first order differential equations system, with the variables *i*L(*t*) and *u*C(*t*).

If the initial conditions *iL*(*0*) and *uC*(*0*) are known*,* then, according to the uniqueness theorem for the solution of a first order differential equation, the solution *i*L(*t*) and *u*C(*t*), *t*≥*0*, exists and is unique.

Once the solutions for the variables *iL*(*t*) and *uC*(*t*) are available, immediately all the other unknowns are solved. Therefore, *iL*(*t*) and *uC*(*t*) are the state-variables of the circuit, and (5) is the matrix state equation of the circuit.

Generally, for a linear electric circuit, the matrix state equation is of the type (6):

$$\frac{d\mathbf{x}(t)}{dt} = \mathbf{A}\,\mathbf{x}(t) + \mathbf{B}\,\mathbf{u}(t),\tag{6}$$

where *x*(*t*) is the column matrix of the inductor currents and of the capacitor voltages (statevector),

*u(t)* is the column matrix of independent supply sources (sources vector), and, *A* and *B* are matrix depending on the circuits topology and of its parameters.

The total number of the state variables is equal with the sum of the number of the inductors and capacitors from the circuit, representing the order of the circuit.

All the other unknown variables are represented by the column matrix *y*(*t*) (also called output vector) represented by a linear combination of the state-vector and the sources vector):

$$\mathbf{y}(t) = \mathbf{C}\,\mathbf{x}(t) + \mathbf{D}\,\mathbf{u}(t),\tag{7}$$

*C* and *D* being matrix of the same origin as *A* and *B*.

444 Numerical Simulation – From Theory to Industry

By the substitution in (2) it follows

or, in matrix form,

and is unique.

vector),

the matrix state equation of the circuit.

It is customary to write the last two equation in the form

*L*

  *L*

*di t*

*C*

With the remaining equations *uL(t)* and *iC(t)* are obtained as functions of *iL(t), uC(t)*:

*C*

*dt L du t*

*dt C*

 

*di t <sup>R</sup> ut i t u t dt L L L du t*

*dt C*

1

*d i t i t u t L L*

If the initial conditions *iL*(*0*) and *uC*(*0*) are known*,* then, according to the uniqueness theorem for the solution of a first order differential equation, the solution *i*L(*t*) and *u*C(*t*), *t*≥*0*, exists

Once the solutions for the variables *iL*(*t*) and *uC*(*t*) are available, immediately all the other unknowns are solved. Therefore, *iL*(*t*) and *uC*(*t*) are the state-variables of the circuit, and (5) is

( ) ( ) ( ), *d t t t*

where *x*(*t*) is the column matrix of the inductor currents and of the capacitor voltages (state-

*u(t)* is the column matrix of independent supply sources (sources vector), and, *A* and *B* are

*L L C C*

*C*

*dt u t u t L*

This is a first order differential equations system, with the variables *i*L(*t*) and *u*C(*t*).

Generally, for a linear electric circuit, the matrix state equation is of the type (6):

*dt*

matrix depending on the circuits topology and of its parameters.

*R*

1 1 ,

*L C*

<sup>1</sup> ,

*i t*

*L*

 

<sup>1</sup> <sup>0</sup> <sup>0</sup>

*L LC C L*

*u t u t Ri t u t it it* 

<sup>1</sup> ,

*u t*

*L*

<sup>1</sup> .

(2)

(4)

(5)

, (3)

<sup>1</sup> 0 .

**<sup>x</sup> Ax Bu** (6)

*i t*

.

,

*C*

The equation given by (6) describes the model, in state-space, of a linear electric circuit.

It is possible, as the result of using ideal elements in the modelization, to occur capacitive loops or inductive sections.

**Figure 1.** Capacitive loop and, respectively, inductive section

A capacitive loop (see Fig. 1a) is a loop consisting only from capacitors and, possibly, independent voltage sources.

In this case the voltages at the terminals of capacitors from the loop are no more linearly independent variables, because the second Kirchhoff's law gives:

$$
\mu - \mu\_S + \mu\_{C1} + \mu\_{C2} + \mu\_{C3} = 0 \,\, . \tag{8}
$$

One, arbitrarily selected, of the capacitor voltages can be expressed as a linear combination of the other voltages.

Such a situation is present also for inductive sections.

An inductive section is represented in Fig.1b, being composed by the convergence in a node of ideal inductors and, possibly, independent current sources. In this case the first Kirchhoff's law states that

$$\dot{i}\_s - \dot{i}\_S + \dot{i}\_{L1} + \dot{i}\_{L\_2} + \dot{i}\_{L\_3} = 0 \ . \tag{9}$$

Again anyone of the state variables can be expressed as a function of the others.

The order of an RLC circuit , meaning the number of linearly independent variables (and by consequence the number of state-equations) is equal to *n*LC - *n*bC - *n*sL:

*n*LC is the total number (sum) of inductors and capacitors

*n*bC is the number of the capacitive loops

*n*sL is the number of inductive sections.

The programs performing the analysis make the detection of capacitive loops and of the inductive sections presents in the electric circuit. Usually, it is recommended to introduce a very small value resistor in series connection with one of the elements of the capacitive loop, or to connect a high value resistor in parallel to one of the elements of the inductive section. By this the circuits differs from the original, but the difference in currents values and voltages values are insignificant

The method of state variables can be naturally extended for nonlinear circuits. In this case the circuit equations are of the form

$$f\_R\left(\mu\_R, i\_R\right) = 0,$$

$$\mu\_C = \frac{dq}{dt}; f\_C\left(\mu\_{C'}, q\right) = 0,\tag{10}$$

$$\dot{a}\_L = \frac{d\Phi}{dt}; f\_L\left(i\_{L'}\Phi\right) = 0,$$

Numerical Methods for Analyzing the Transients in Medium Voltage Networks 447

0,

1,

*f or node*

*f or node*

2,

(12)

3.

State equations for linear circuits have exact analytically determined solution, available in any book of college mathematics. If the order of the circuit is higher than three, analytic solution implies calculations so complicated that this method becomes inefficient. For this kind of situations a large offer of numeric integrations methods is available embedded in the

The levels of the analysis of electric circuits performed by PSPICE are, mainly, the following

For solving the electric circuit problems PSPICE uses the branch current method. Each element of the circuit is considered being placed between two nodes. The nodes are numbered from "0", the reference node, to N and the position of an element is given by the

numbers of its terminals. A very simple circuit example is given in Fig. 2.

*V V*

*V V*

2

1223 1 2 23 30

*VV VV*

*R R VV VV*

*R R*

*g*

*g*

*I for node <sup>R</sup>*

*<sup>I</sup> for node <sup>R</sup>*

commercial programs of numeric simulation.

(Radoi, 1994; Vladimirescu, 1999):

b. Solving a nonlinear electric circuit, c. Solving a time variable electric circuit.

**Figure 2.** Simple circuit for SPICE application

**3. Simulation of electric circuits using PSPICE** 

a. Solving a linear electric circuit, invariable with time,

with , , *RC L fff* being the characteristics of nonlinear elements and, *q* and Φ, the electric charge of the capacitor, respectively the magnetic flux trough the inductor.

The procedure for obtaining the state equations is similar as for linear circuits, with the difference that the state variables are *q* and Φ. These variables are present in the dynamic constitutive equations.

The variables *u*C and *i*L are obtained as functions of *q* and Φ and afterwards :

$$\frac{d\mathbf{x}}{dt} = F\left(\mathbf{x}, t\right),\tag{11}$$

In (11) *x* is the column matrix of state variables (state vector), and *F* is a matrix depending on the circuits topology and on the nonlinear characteristics.

If for linear circuits, the circuits equations can be always reduced to state equations, for certain nonlinear circuits it is not possible to allow state equations (Hasler & Neirynck, 1985).

Anyhow, for a modelization not excessively idealized and a reasonable choice of state variable it is possible to obtain always state equations. For nonlinear state equations even the problem of existing or not of a solution might occur.

State equations for linear circuits have exact analytically determined solution, available in any book of college mathematics. If the order of the circuit is higher than three, analytic solution implies calculations so complicated that this method becomes inefficient. For this kind of situations a large offer of numeric integrations methods is available embedded in the commercial programs of numeric simulation.
