Download Computation of a canonical form for linear - Automatic Control

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Virtual work wikipedia , lookup

Dynamic substructuring wikipedia , lookup

Linear least squares (mathematics) wikipedia , lookup

Singular-value decomposition wikipedia , lookup

System of polynomial equations wikipedia , lookup

Gaussian elimination wikipedia , lookup

Matrix multiplication wikipedia , lookup

System of linear equations wikipedia , lookup

Transcript
Computation of a canonical form for linear
differential-algebraic equations
Markus Gerdin
Division of Automatic Control
Department of Electrical Engineering
Linköpings universitet, SE-581 83 Linköping, Sweden
WWW: http://www.control.isy.liu.se
E-mail: [email protected]
April 7, 2004
OMATIC CONTROL
AU T
CO
M MU
NICATION SYSTE
MS
LINKÖPING
Report no.: LiTH-ISY-R-2602
Submitted to Reglermöte 2004
Technical reports from the Control & Communication group in Linköping are
available at http://www.control.isy.liu.se/publications.
Computation of a canonical form for linear
differential-algebraic equations
Markus Gerdin
April 7, 2004
Abstract
This paper describes how a commonly used canonical form for linear
differential-algebraic equations can be computed using numerical software
from the linear algebra package LAPACK. This makes it possible to automate for example observer construction and parameter estimation in
linear models generated by a modeling language like Modelica.
1
Introduction
In recent years object-oriented modeling languages have become increasingly
popular. An example of such a language is Modelica (Fritzson, 2004; Tiller,
2001). Modeling languages of this type make it possible to build models by
connecting submodels in a manner that parallels the physical construction. A
consequence of this viewpoint is that it is usually not possible to specify in
advance what variables are inputs or outputs from a given submodel. A further
consequence of this is that the resulting model is not in state space form. Instead
the model is a collection of equations, some of which contain derivatives and
some of which are static relations. A model of this form is sometimes referred
to as a DAE (differential algebraic equations) model. It can be noted that these
models are a special case of the so-called behavioral models discussed in, e.g.,
(Polderman and Willems, 1998). Consider a linear DAE,
˙ = Jξ(t) + Ku(t)
E ξ(t)
(1)
where ξ(t) is a vector of physical variables and u(t) is the input. E and J are
constant square matrices and K is a constant matrix. Linear DAE are also
known as descriptor systems, implicit systems and singular systems. For this
case it is possible to make a transformation into a canonical form,
I 0
˙ = A 0 Q−1 ξ(t) + B u(t)
(2)
Q−1 ξ(t)
D
0 I
0 N
where N is a nilpotent matrix. This canonical form has been used extensively in
the literature, for example to examine general system properties and obtain the
solution (e.g., Ljung and Glad, 2004; Dai, 1989; Brenan et al., 1996), to develop
control strategies (e.g., Dai, 1989), to estimate ξ(t) (e.g., Schön et al., 2003),
and to estimate parameters (e.g., Gerdin et al., 2003). The transformation itself
was treated in (Gantmacher, 1960).
1
However, as far as we know it has not been thoroughly studied how this
transformation can be computed numerically. The only reference we have found
is (Varga, 1992), where a method for computation of the transformation is
mentioned briefly. This contribution therefore discusses how the transformation
can be computed. The approach here will include pointers to implementations of
some algorithms in the linear algebra package LAPACK (Anderson et al., 1999).
LAPACK is a is a free collection of routines written in Fortran77 that can be
used for systems of linear equations, least-squares solutions of linear systems
of equations, eigenvalue problems, and singular value problems. LAPACK is
more or less the standard way to solve this kind of problems, and is used by
commercial software like Matlab.
2
The Canonical Form
In this section we provide a proof for the canonical form. We also use the
canonical form to show how the solution of a linear DAE can be calculated.
The transformations discussed in this section can be found in for example (Dai,
1989), but the proofs which are presented here have been constructed so that
the indicated calculations can be computed by numerical software in a reliable
manner. How the different steps of the proofs can be computed numerically is
studied in Section 4. It can be noted that the system must be regular for the
transformation to exist. A linear DAE (1) is regular if det(sE − J) 6≡ 0, that
is the determinant is not zero for all s. By Laplace transforming (1), it can be
realized that regularity is equivalent to the existence of a unique solution. This
is also discussed in for example (Dai, 1989).
The main result is presented in Lemma 3 and Theorem 1, but to derive these
results we use a series of lemmas as described below. The first lemma describes
how the system matrices E and J simultaneously can be written in triangular
form with the zero eigenvalues of E sorted to the lower right block.
Lemma 1 Consider a system
˙ = Jξ(t) + Ku(t)
E ξ(t)
(3)
If (3) is regular, then there exist non-singular matrices P1 and Q1 such that
E1 E2
J J2
and P1 JQ1 = 1
(4)
P1 EQ1 =
0 E3
0 J3
where E1 is non-singular, E3 is upper triangular with all diagonal elements zero
and J3 is non-singular and upper triangular.
Note that either the first or the second block row in (4) may be of size zero.
Proof. The Kronecker canonical form of a regular matrix pencil discussed
in, e.g., (Kailath, 1980, Chapter 6) directly shows that it is possible to perform
the transformation (4).
In the case when the matrix pencil is regular, the Kronecker canonical
form is also called the Weierstrass canonical form. The Kronecker and Weierstrass canonical forms are also discussed by (Gantmacher, 1960, Chapter 12).
The original works by Weierstrass and Kronecker are (Weierstrass, 1867) and
(Kronecker, 1890).
2
Note that the full Kronecker form is not computed by the numerical software
discussed in Section 4. The Kronecker form is here just a convenient way of
showing that the transformation (4) is possible.
The next two lemmas describe how the internal variables of the system can
be separated into two parts by making the systems matrices block diagonal.
Lemma 2 Consider (4). There exist matrices L and R such that
E1 0
I L E1 E2 I R
=
0 E3 0 I
0 E3
0 I
and
I
0
L J1
0
I
J2
J3
I
0
R
J
= 1
0
I
(5)
0
.
J3
(6)
See (Kågström, 1994) and references therein for a proof of this lemma.
Lemma 3 Consider a system
˙ = Jξ(t) + Ku(t)
E ξ(t)
(7)
If (7) is regular, there exist non-singular matrices P and Q such that the transformation
˙ = P JQQ−1 ξ(t) + P Ku(t)
(8)
P EQQ−1 ξ(t)
gives the system
I
0
B
A 0 −1
0
−1 ˙
u(t)
Q ξ(t) +
Q ξ(t) =
D
0 I
N
(9)
where N is a nilpotent matrix.
Proof. Let P1 and Q1 be the matrices in Lemma 1 and define
I L
P2 =
0 I
I R
Q2 =
0 I
−1
E1
0
P3 =
0
J3−1
(10a)
(10b)
(10c)
where L and R are from Lemma 2. Also let
Then
and
P = P3 P2 P1
(11a)
Q = Q1 Q2 .
(11b)
I
P EQ =
0
J3−1 E3
−1
E1 J1
P JQ =
0
3
0
0
I
(12)
(13)
Here N = J3−1 E3 is nilpotent since E3 is upper triangular with zero diagonal
elements and J3−1 is upper triangular. J3−1 is upper triangular since J3 is.
Defining A = E1−1 J1 finally gives us the desired form (9).
We are now ready to present the main result in this section, which shows
how a solution of the system equations can be obtained. We get this result by
observing that the first block row of (9) just is a normal state-space description
and showing that the solution of the second block row is a sum of the input and
some of its derivatives.
Theorem 1 Consider a system
˙ = Jξ(t) + Ku(t)
E ξ(t)
(14)
If (14) is regular, its solution can be described by
ẇ1 (t) = Aw1 (t) + Bu(t)
w2 (t) = −Du(t) −
w1 (t)
= Q−1 ξ(t).
w2 (t)
m−1
X
N i Du(i) (t)
(15a)
(15b)
i=1
(15c)
Proof. According to Lemma 3 we can without loss of generality assume that
the system is in the form
A 0 w1 (t)
B
I 0 ẇ1 (t)
=
+
u(t)
(16a)
0 I w2 (t)
D
0 N ẇ2 (t)
w1 (t)
= Q−1 ξ(t).
(16b)
w2 (t)
w1 (t)
w2 (t)
(17)
w2 (t) = −Du(t)
(18)
where
w(t) =
is partitioned according to the matrices.
Now, if N = 0 we have that
and we are done. If N 6= 0 we can multiply the second row of (16a) with N and
get
(19)
N 2 ẇ2 (t) = N w2 (t) + N Du(t).
We now differentiate (19) and insert the second row of (16a). This gives
w2 (t) = −Du(t) − N Du̇(t) + N 2 ẅ2 (t)
(20)
If N 2 = 0 we are done, otherwise we just continue until N m = 0 (this is true
for some m since N is nilpotent). We would then arrive at an expression like
w2 (t) = −Du(t) −
m−1
X
i=1
4
N i Du(i) (t)
(21)
I1 (t)
I2 (t)
u(t)
I3 (t)
L
R
Figure 1: A small electrical circuit.
and the proof is complete.
Note that the internal variables of the system may depend directly on derivatives of the input. However, it can be noted that the internal variables of physical
systems seldom depend directly on derivatives of the input since this would for
example lead to the internal variables taking infinite values for a step input. In
the common case of no dependence on the derivative of the input, we will have
N D = 0.
(22)
We conclude the section with an example which shows what the form (15)
is for a simple electrical system.
Example 1 (Canonical form) Consider the electrical circuit in Figure 1. With
u(t) as the input, the equations describing the systems are
  
 



1
0
0
0
I1 (t)
0 0 L I˙1 (t)
0 0 0  I˙2 (t) = 1 −1 −1 I2 (t) + 0 u(t)
(23)
1
0 −R 0
I3 (t)
0 0 0
I˙3 (t)
Transforming the system into the form (9) gives

1
0
0
0
0
0

0 0 0
0 0 1
0 1 0


I˙1 (t)
1
0  I˙2 (t) =
−1 I˙3 (t)


0 0 0
0 0
0 1 0 0 1
0 0 1
1 0
  1 

1
I1 (t)
L
0  I2 (t) + − R1  u(t)
−1 I3 (t)
− R1
(24)
Further transformation into the form (15) gives
1
u(t)
L
− R1
w2 (t) = −
u(t)
− R1



0 0 1
I1 (t)
w1 (t)
= 0 1 0  I2 (t) .
w2 (t)
1 0 −1 I3 (t)
ẇ1 (t) =
5
(25a)
(25b)
(25c)
We can here see how the state-space part has been singled out by the transformation. In (25c) we can see that the state-space variable w1 (t) is equal to I3 (t).
This is natural, since the only dynamic element in the circuit is the inductor.
The two variables in w2 (t) are I2 (t) and I1 (t) − I3 (t). These variables depend
directly on the input.
3
Generalized Eigenvalues
The computation of the canonical forms will be performed with tools that normally are used for computation of generalized eigenvalues. Therefore, some
theory for generalized eigenvalues will be presented in this section. The theory
presented here about generalized eigenvalues can be found in for example (Bai
et al., 2000). Another reference is (Golub and van Loan, 1996, Section 7.7).
Consider a matrix pencil
λE − J
(26)
where the matrices E and J are n × n with constant real elements and λ is a
scalar variable. We will assume that the pencil is regular, that is
det(λE − J) 6≡ 0 with respect to λ.
(27)
The generalized eigenvalues are defined as those λ for which
det(λE − J) = 0.
(28)
If the degree p of the polynomial det(λE − J) is less than n, the pencil also has
n − p infinite generalized eigenvalues. This happens when rank E < n (Golub
and van Loan, 1996, Section 7.7). We illustrate the concepts with an example.
Example 2 (Generalized eigenvalues) Consider the matrix pencil
1 0
−1 0
λ
−
.
0 0
1 −1
We have that
1
det λ
0
0
−1 0
−
=1+λ
0
1 −1
(29)
(30)
so the matrix pencil has two generalized eigenvalues, ∞ and −1.
Generalized eigenvectors will not be discussed here, the interested reader is
instead referred to for example (Bai et al., 2000).
Since it may be difficult to solve Equation (28) for the generalized eigenvalues, different transformations of the matrices that simplifies computation of the
generalized eigenvalues exist. The transformations are of the form
P (λE − J)Q
(31)
with invertible matrices P and Q. Such transformations do not change the
eigenvalues since
det(P (λE − J)Q) = det(P ) det(λE − J) det(Q).
6
(32)
One such form is the Kronecker canonical form. However, this form cannot in
general be computed numerically in a reliable manner (Bai et al., 2000). For
example it may change discontinuously with the elements of the matrices E and
J. The transformation which we will use here is therefore instead the generalized
Schur form which requires fewer operations and is more stable to compute (Bai
et al., 2000).
The generalized Schur form of a real matrix pencil is a transformation such
that
P (λE − J)Q
(33)
is upper quasi-triangular, that is it is upper triangular with some 2 by 2 blocks,
corresponding to complex eigenvalues, on the diagonal. P and Q are orthogonal
matrices. The generalized Schur form can be computed with the LAPACK
commands dgges or sgges. These commands also give the possibility to sort
certain generalized eigenvalues to the lower right. An algorithm for ordering of
the generalized eigenvalues is also discussed by (Sima, 1996). Here we will use
the possibility to sort the infinite generalized eigenvalues to the lower right.
The generalized Schur form discussed here is also called the generalized real
Schur form, since the original and transformed matrices only contain real elements.
4
Computation of the Canonical Forms
The discussion in this section is based on the steps of the proof of the form
in Theorem 1. We therefore begin by examining how the diagonalization in
Lemma 1 can be performed numerically.
The goal is to find matrices P and Q such that
J J2
E E2
+ 1
(34)
P (λE − J)Q = λ 1
0 E3
0 J3
where E1 is non-singular, E3 is upper triangular with all diagonal elements
zero and J3 is non-singular and upper triangular. This is exactly the form
we get if we compute the generalized Schur form with the infinite generalized
eigenvalues sorted to the lower right. This computation can be performed with
the LAPACK commands dgges or sgges. E1 corresponds to finite generalized
eigenvalues and is non-singular since it is upper quasi-triangular with non-zero
diagonal elements and E3 corresponds to infinite generalized eigenvalues and is
upper triangular with zero diagonal elements. J3 is non-singular, otherwise the
pencil would not be regular.
The next step is to compute the matrices R and L in Lemma 2, that is we
want to solve the system
E1 0
I L E 1 E2 I R
=
(35a)
0 E3 0 I
0 E3
0 I
0
J
I L J1 J2 I R
= 1
.
(35b)
0 J3 0 I
0 J3
0 I
Performing the matrix multiplication on the left hand side of the equations
7
yields
E1 0
E1 E1 R + E2 + LE3
=
0
E3
0 E3
0
J
J1 J1 R + J2 + LJ3
= 1
0
J3
0 J3
(36a)
(36b)
which is equivalent to the system
E1 R + LE3 = −E2
J1 R + LJ3 = −J2 .
(37a)
(37b)
Equation (37) is a generalized Sylvester equation (Kågström, 1994). The generalized Sylvester equation (37) can be solved from the linear system of equations
(Kågström, 1994)
− vec(E2 )
In ⊗ E1 E3T ⊗ Im vec(R)
.
(38)
=
− vec(J2 )
In ⊗ J1 J3T ⊗ Im vec(L)
Here In is an identity matrix with the same size as E3 and J3 , Im is an identity
matrix with the same size as E1 and J1 , ⊗ represents the Kronecker product
and vec(X) denotes an ordered stack of the columns of a matrix X from left to
right starting with the first column.
One way to solve the generalized Sylvester equation (37) is thus to use the
linear system of equations (38). This system can be quite large, so it may be a
better choice to use specialized software such as the LAPACK routines stgsyl
or dtgsyl.
The steps in the proof of Lemma 3 and Theorem 1 only contain standard
matrix manipulations, such as multiplication and inversion. They are straightforward to implement, and will not be discussed further here.
5
Summary of the computations
In this section a summary of the steps to compute the canonical forms is provided. It can be used to implement the computations without studying Section 4
in detail. The summary is provided as a numbered list with the necessary computations.
1. Start with a system
˙ = Jξ(t) + Ku(t)
E ξ(t)
that should be transformed into the form
I 0
˙ = A 0 Q−1 ξ(t) + B u(t)
Q−1 ξ(t)
D
0 I
0 N
(39)
(40)
or
ẇ1 (t) = Aw1 (t) + Bu(t)
w2 (t) = −Du(t) −
w1 (t)
= Q−1 ξ(t).
w2 (t)
8
m−1
X
N i Du(i) (t)
(41a)
(41b)
i=1
(41c)
2. Compute the generalized Schur form of the matrix pencil λE − J so that
E E2
J J2
P1 (λE − J)Q1 = λ 1
+ 1
.
(42)
0 E3
0 J3
The generalized eigenvalues should be sorted so that diagonal elements of
E1 contain only non-zero elements and the diagonal elements of E3 are
zero. This computation can be made with one of the LAPACK commands
dgges and sgges.
3. Solve the generalized Sylvester equation (43) to get the matrices L and R.
E1 R + LE3 = −E2
(43a)
J1 R + LJ3 = −J2 .
(43b)
The generalized Sylvester equation (43) can be solved from the linear
equation system (44) or with the LAPACK commands stgsyl or dtgsyl.
− vec(E2 )
In ⊗ E1 E3T ⊗ Im vec(R)
.
(44)
=
− vec(J2 )
In ⊗ J1 J3T ⊗ Im vec(L)
Here In is an identity matrix with the same size as E3 and J3 , Im is
an identity matrix with the same size as E1 and J1 , ⊗ represents the
Kronecker product and vec(X) denotes an ordered stack of the columns
of a matrix X from left to right starting with the first column.
4. We now get the form (40) and (41)
−1
E1
P =
0
I
Q = Q1
0
(45a)
(45b)
N = J3−1 E3
(45c)
E1−1 J1
(45d)
A=
B
= P K.
D
6
according to
0
I L
P
J3−1 0 I 1
R
I
(45e)
Conclusions
We have in this paper examined how a commonly used canonical form for linear
differential-algebraic equations can be computed using numerical software. As
discussed in the introduction, it is possible to for example estimate the states or
unknown parameters using this canonical form. Models generated by a modeling
language like Modelica are described as differential-algebraic equations. For
linear Modelica models it is therefore possible to automate the procedures of
for example observer construction and parameter estimation.
7
Acknowledgments
This work was supported by the Swedish Research Council and by the Foundation for Strategic Research (SSF).
9
References
Anderson, E., Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. Dongarra, J. Du
Croz, A. Greenbaum, S. Hammarling, A. McKenney and D. Sorensen
(1999). LAPACK Users’ Guide. 3. ed. Society for Industrial and Applied
Mathematics. Philadelphia.
Bai, Z., J. Demmel, J. Dongarra, A. Ruhe and H. van der Vorst (2000).
Templates for the Solution of Algebraic Eigenvalue Problems, A Practical
Guide. SIAM. Philadelphia.
Brenan, K.E., S.L. Campbell and L.R. Petzold (1996). Numerical Solution of
Initial-Value Problems in Differential-Algebraic Equations. Classics In Applied Mathematics. SIAM. Philadelphia.
Dai, L. (1989). Singular Control Systems. Lecture Notes in Control and Information Sciences. Springer-Verlag. Berlin, New York.
Fritzson, Peter (2004). Principles of Object-Oriented Modeling and Simulation
with Modelica 2.1. Wiley-IEEE. New York.
Gantmacher, F.R. (1960). The Theory of Matrices. Vol. 2. Chelsea Publishing
Company. New York.
Gerdin, M., T. Glad and L. Ljung (2003). Parameter estimation in linear
differential-algebraic equations. In: Proceedings of the 13th IFAC symposium on system identification. Rotterdam, the Netherlands. pp. 1530–1535.
Golub, G.H. and C.F. van Loan (1996). Matrix Computations. 3 ed. The John
Hopkins University Press. Baltimore and London.
Kågström, B. (1994). A perturbation analysis of the generalized sylvester equation. Siam Journal on Matrix Analysis and Applications 15(4), 1045–1060.
Kailath, T. (1980). Linear Systems. Information and Systems Sciences Series.
Prentice Hall. Englewood Cliffs, N.J.
Kronecker, L. (1890). Algebraische reduction der schaaren bilinearer formen.
S.-B. Akad. Berlin pp. 763–776.
Ljung, L. and T. Glad (2004). Modellbygge och simulering. Studentlitteratur. In
Swedish.
Polderman, J.W. and J.C. Willems (1998). Introduction to Mathematical Systems Theory: a behavioral approach. Number 26 in: Texts in Applied Mathematics. Springer-Verlag. New York.
Schön, T., M. Gerdin, T. Glad and F. Gustafsson (2003). A modeling and filtering framework for linear differential-algebraic equations. In: Proceedings of
the 42nd IEEE Conference on Decision and Control. Maui, Hawaii, USA.
pp. 892–897.
Sima, V. (1996). Algorithms for linear-quadratic optimization. Dekker. New
York.
10
Tiller, M. (2001). Introduction to Physical Modeling with Modelica. Kluwer.
Boston, Mass.
Varga, A. (1992). Numerical algorithms and software tools for analysis and
modelling of descriptor systems. In: Prepr. of 2nd IFAC Workshop on
System Structure and Control, Prague, Czechoslovakia. pp. 392–395.
Weierstrass, K. (1867). Zur theorie der bilinearen und quadratischen formen.
Monatsh. Akad. Wiss., Berlin pp. 310–338.
11