## Modelica_LinearSystems2.WorkInProgress.StateSpace.Design

### Package Content

Name | Description
--- | ---
assignPolesMI2 | Pole assigment design algorithm for multi input systems
assignPolesMI | Pole assigment design algorithm for multi input systems

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Design.assignPolesMI2

Pole assigment design algorithm for multi input systems

### Information

#### Syntax

(K, S, po, nfp, nap, nup) | = | StateSpace.Design.assignPolesMI(ss, gamma, np, alpha, tol)

#### Description

The purpose of this function is to determine the state feedback matrix K for a given time invariant multi input state system (A,B) such that the closed-loop state matrix A-B*K has specified eigenvalues. The feedback matrix K is calculated by factorization following [1]. The algorithm modifies the eigenvalues sequentially and also allows partial eigenvalue assignment.
At the beginning of the algorithm, the feedback matrix K is set to zero (K = 0) and the matrix A is reduced to an ordered real Schur form by separating its spectrum in two parts

>                   | F1  F3|
>      F = Q*A*Q' = |       |
>                   | 0   F2|

in such a way, that F1 contains the eigenvalues that will be retained and F3 contains the eigenvalues going to be modified. On the suggestion of [1] the eigenvalues evr to be retained are chosen as

>       evr = {s in C: Re(s) < -alpha, alpha > =0}

but other specification are conceivable of course.
Let

>       G = [G1;G2] = Q*B

with an appropriate partition according to F2. (F2, G2) has to be controllable.
If the feedback matrix K is taken in a form

>      K = [0, K2]

the special structure of F and K results in a closed loop state matrix

>               |F1 F3 - G1*K2|
>     F - G*K = |             |
>               |0  F2 - G2*K2|

with only the eigenvalues of F2 are modified. This approach to modify separated eigenvalues is used to sequentially shift one real eigenvalue ore two complex conjugated eigenvalues stepwise until all assigned eigenvalues are placed. Therefore, at each step i always the (two) lower right eingenvalue(s) are modified by an appropriate feedback matrix Ki. The matrix F - G*Ki remains in real Schur form. The assigned eigenvalue(s) is (are) then moved to another diagonal position of the real Schur form using reordering techniques F < -- Qi*F*Qi' and a new block is transferred to the lower right diagonal position. The transformations are accumulated in Qi and are also applicated to the matrices

>      G < - Qi*G Q < - Qi*Q

The eigenvalue(s) to be assigned at each step is (are) chosen such that the norm of each Ki is minimized [1].

#### Example

>        Modelica_LinearSystems2.StateSpace ss=Modelica_LinearSystems2.StateSpace(
>           A=[-1, 1, 1;0, 1, 1;0, 0, 1],
>           B=[0; 0; 1],
>           C=[0, 1, 0],
>           D=[0]);

>        Real Q[3,3];

>     algorithm
>       Q := Modelica_LinearSystems2.StateSpace.Analysis.observabilityMatrix(ss);
>     // Q = [0, 1, 0; 0, 1, 1; 1, 1, 2]

#### References

[1] | Varga A. | "A Schur method for pole assignment" | IEEE Trans. Autom. Control, Vol. AC-26, pp. 517-519, 1981

### Inputs

Name | Description
--- | ---
ss | state space system
gamma[:] | Designed Poles
np | number of given eigenvalues to assign
giveEigenvalues | Boolean parameter to display the order of the eigenvalues
alpha | maximum admissible value for real parts(continuous) or for moduli (discrete) of the eigenvalues of A which will not be modified by the eigenvalue assignment algorithm
tolerance | The tolerance to be used in determining the controllability of (A,B)

### Outputs

Name | Description
--- | ---
K[size(ss.B, 2), size(ss.A, 1)] | State feedback matrix assigning the desired poles
S[:, :] | Closed loop System matrix
po[size(ss.A, 1)] | poles of the closed loop system
nfp | number of eigenvalues that are not modified with respect to alpha
nap | number of assigned eigenvalues
nup | number of uncontrollable eigenvalues
X[size(ss.A, 1), size(ss.A, 1)] | eigenvectors of the closed loop system

## Modelica_LinearSystems2.WorkInProgress.StateSpace.Design.assignPolesMI

Pole assigment design algorithm for multi input systems

### Information

#### Syntax

(K, S, po, nfp, nap, nup) | = | StateSpace.Design.assignPolesMI(ss, gamma, np, tol, calculateEigenvectors)

#### Description

The purpose of this function is to determine the state feedback matrix K for a given time invariant multi input state system (A,B) such that the closed-loop state matrix A-B*K has specified eigenvalues. The feedback matrix K is calculated by factorization following [1]. The algorithm modifies the eigenvalues sequentially and also allows partial eigenvalue assignment.
At the beginning of the algorithm, the feedback matrix K is set to zero (K = 0) and the matrix A is reduced to an ordered real Schur form by separating its spectrum in two parts

>                   | F1  F3|
>      F = Q*A*Q' = |       |
>                   | 0   F2|

in such a way, that F1 contains the eigenvalues that will be retained and F3 contains the eigenvalues going to be modified. On the suggestion of [1] the eigenvalues evr to be retained are chosen as

>       evr = {s in C: Re(s) < -alpha, alpha > =0}

but other specification are conceivable of course.
Let

>       G = [G1;G2] = Q*B

with an appropriate partition according to F2. (F2, G2) has to be controllable.
If the feedback matrix K is taken in a form

>      K = [0, K2]

the special structure of F and K results in a closed loop state matrix

>               |F1 F3 - G1*K2|
>     F - G*K = |             |
>               |0  F2 - G2*K2|

with only the eigenvalues of F2 are modified. This approach to modify separated eigenvalues is used to sequentially shift one real eigenvalue ore two complex conjugated eigenvalues stepwise until all assigned eigenvalues are placed. Therefore, at each step i always the (two) lower right eigenvalue(s) are modified by an appropriate feedback matrix Ki. The matrix F - G*Ki remains in real Schur form. The assigned eigenvalue(s) is (are) then moved to another diagonal position of the real Schur form using reordering techniques F < -- Qi*F*Qi' and a new block is transferred to the lower right diagonal position. The transformations are accumulated in Qi and are also applicated to the matrices

>      G < - Qi*G Q < - Qi*Q

The eigenvalue(s) to be assigned at each step is (are) chosen such that the norm of each Ki is minimized [1].

#### Example

>        Modelica_LinearSystems2.StateSpace ss=Modelica_LinearSystems2.StateSpace(
>           A=[-1, 1, 1;0, 1, 1;0, 0, 1],
>           B=[0; 0; 1],
>           C=[0, 1, 0],
>           D=[0]);

>        Real Q[3,3];

>     algorithm
>       Q := Modelica_LinearSystems2.StateSpace.Analysis.observabilityMatrix(ss);
>     // Q = [0, 1, 0; 0, 1, 1; 1, 1, 2]

#### References

[1] | Varga A. | "A Schur method for pole assignment" | IEEE Trans. Autom. Control, Vol. AC-26, pp. 517-519, 1981

### Inputs

Name | Description
--- | ---
ss | state space system
gamma[:] | Designed Poles
alpha | maximum admissible value for real parts(continuous) or for moduli (discrete) of the eigenvalues of A which will not be modified by the eigenvalue assignment algorithm
tolerance | The tolerance to be used in determining the controllability of (A,B)
calculateEigenvectors | Calculate the eigenvectors X of the closed loop system when true

### Outputs

Name | Description
--- | ---
K[size(ss.B, 2), size(ss.A, 1)] | State feedback matrix assigning the desired poles
S[:, :] | Closed loop System matrix
po[size(ss.A, 1)] | poles of the closed loop system
nfp | number of eigenvalues that are not modified with respect to alpha
nap | number of assigned eigenvalues
nup | number of uncontrollable eigenvalues
X[size(ss.A, 1), size(ss.A, 1)] | eigenvectors of the closed loop system