Skip to content
Snippets Groups Projects
Commit 5304707f authored by Gonca Guerses-Tran's avatar Gonca Guerses-Tran
Browse files

Merge branch 'develop' into 'develop'

Develop

See merge request acs/public/teaching/systemtheorie2/lecture-tutorials!5
parents c550577e 356af456
No related branches found
No related tags found
No related merge requests found
...@@ -443,7 +443,13 @@ class StateSpace(Block): ...@@ -443,7 +443,13 @@ class StateSpace(Block):
for i in range(0,self.noutput): for i in range(0,self.noutput):
self.y[i] = 0 self.y[i] = 0
for j in range(0,self.nstate): for j in range(0,self.nstate):
if self.C.ndim == 1:
self.y[i] = self.y[i] + self.C[j]*self.x[j] self.y[i] = self.y[i] + self.C[j]*self.x[j]
elif self.C.ndim == 2:
#prevent [ValueError: setting an array element with a sequence.] for 2 dimensional self.C:
self.y[i] = self.y[i] + self.C[i][j]*self.x[j]
else:
print("WARNING: Can not handle self.C with dimension "+str(self.C.ndim))
for j in range(0,self.ninput): for j in range(0,self.ninput):
self.y[i] = self.y[i] +self.D[j]*self.u[j] self.y[i] = self.y[i] +self.D[j]*self.u[j]
self.updatestate(t,dt) self.updatestate(t,dt)
......
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# <span style='color:OrangeRed'>V7 - Steuerbarkeit und Beobachtbarkeit</span> # <span style='color:OrangeRed'>V7 - Steuerbarkeit und Beobachtbarkeit</span>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import numpy as np import numpy as np
pi = np.pi pi = np.pi
sin = np.sin sin = np.sin
cos = np.cos cos = np.cos
sqrt = np.sqrt sqrt = np.sqrt
exp = np.exp exp = np.exp
atan2 = np.arctan2 atan2 = np.arctan2
log10 = np.log10 log10 = np.log10
def print_det(M): def print_det(M):
print("Determinante: "+str(np.around(np.linalg.det(M)))) print("Determinante: "+str(np.around(np.linalg.det(M))))
def print_rank(M): def print_rank(M):
print("Rang: "+str(np.linalg.matrix_rank(S_C))) print("Rang: "+str(np.linalg.matrix_rank(M)))
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## <span style='color:Gray'>Beispiel #1 </span> ## <span style='color:Gray'>Beispiel #1 </span>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Es wird das folgende Eingrößensystem betrachtet: Es wird das folgende Eingrößensystem betrachtet:
<br>$\dot{x}(t)$= $Ax(t)$ + $bu(t)$ <br>$\dot{x}(t)$= $Ax(t)$ + $bu(t)$
<br>$y(t)$=$c^Tx(t)$ <br>$y(t)$=$c^Tx(t)$
<br><br> $x$ = $\left[ \begin{array}{rrrr} <br><br> $x$ = $\left[ \begin{array}{rrrr}
x_1 \\ x_1 \\
x_2 \\ x_2 \\
x_3 \\ x_3 \\
\end{array}\right] $ \end{array}\right] $
<br><br> $A$ = $\left[ \begin{array}{rrrr} <br><br> $A$ = $\left[ \begin{array}{rrrr}
-1 & -2 & -2 \\ -1 & -2 & -2 \\
0 & -1 & 1 \\ 0 & -1 & 1 \\
1 & 0 & -1 \\ 1 & 0 & -1 \\
\end{array}\right] $ \end{array}\right] $
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
A = np.array([[-1,-1,-2],[0,-1,1],[1,0,-1]]); A = np.array([[-1,-1,-2],[0,-1,1],[1,0,-1]]);
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
$b$ = $\left[ \begin{array}{rrrr} $b$ = $\left[ \begin{array}{rrrr}
2 \\ 2 \\
0 \\ 0 \\
1 \\ 1 \\
\end{array}\right] $ \end{array}\right] $
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
b = np.array([[2],[0],[1]]); b = np.array([[2],[0],[1]]);
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
$c^T$ = $\left[ \begin{array}{rrrr} $c^T$ = $\left[ \begin{array}{rrrr}
1 & 1 & 0 \\ 1 & 1 & 0 \\
\end{array}\right] $ \end{array}\right] $
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
c = np.array([1,1,0]); c = np.array([1,1,0]);
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
<b>Zielsetzung</b>: Überprüfung der Steuerbarkeit und Beobachtbarkeit. <b>Zielsetzung</b>: Überprüfung der Steuerbarkeit und Beobachtbarkeit.
<br>Zuerst betrachten wir die <span style='color:red'>Steuerbarkeit</span>: <br>Zuerst betrachten wir die <span style='color:red'>Steuerbarkeit</span>:
<br>Ein System 3. Ordnung ist vollständig zustandssteuerbar, wenn gilt: <br>Ein System 3. Ordnung ist vollständig zustandssteuerbar, wenn gilt:
$Rang$[$B\,|\,AB\,|\,A^2B$]=$Rang$($S_C$) = $n$ = $3$ $Rang$[$B\,|\,AB\,|\,A^2B$]=$Rang$($S_C$) = $n$ = $3$
<br><b>Mit</b>: <br><b>Mit</b>:
<br><br> $A$ = $\left[ \begin{array}{rrrr} <br><br> $A$ = $\left[ \begin{array}{rrrr}
-1 & -2 & -2 \\ -1 & -2 & -2 \\
0 & -1 & 1 \\ 0 & -1 & 1 \\
1 & 0 & -1 \\ 1 & 0 & -1 \\
\end{array}\right] $ \end{array}\right] $
<br><br> $B$ = $b$ = $\left[ \begin{array}{rrrr} <br><br> $B$ = $b$ = $\left[ \begin{array}{rrrr}
2 \\ 2 \\
0 \\ 0 \\
1 \\ 1 \\
\end{array}\right] $ \end{array}\right] $
<br><b>Wird</b>: <br><b>Wird</b>:
<br><br> $Ab$ = $\left[ \begin{array}{rrrr} <br><br> $Ab$ = $\left[ \begin{array}{rrrr}
-4 \\ -4 \\
1 \\ 1 \\
1 \\ 1 \\
\end{array}\right] $ \end{array}\right] $
<br><br> $A^2b$ = $\left[ \begin{array}{rrrr} <br><br> $A^2b$ = $\left[ \begin{array}{rrrr}
0 \\ 0 \\
0 \\ 0 \\
-5 \\ -5 \\
\end{array}\right] $ \end{array}\right] $
<br>Damit erhalten wir die Steuerbarkeitsmatrix: <br>Damit erhalten wir die Steuerbarkeitsmatrix:
<br>$Rang$[$b\,|\,Ab\,|\,A^2b$] = $\left[ \begin{array}{rrrr} <br>$Rang$[$b\,|\,Ab\,|\,A^2b$] = $\left[ \begin{array}{rrrr}
2 & -4 & 0 \\ 2 & -4 & 0 \\
0 & 1 & 0 \\ 0 & 1 & 0 \\
1 & 1 & -5 \\ 1 & 1 & -5 \\
\end{array}\right] $ \end{array}\right] $
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
column1 = b column1 = b
column2 = np.matmul(A,b) column2 = np.matmul(A,b)
column3 = np.matmul(np.matmul(A,A),b) column3 = np.matmul(np.matmul(A,A),b)
S_C = np.c_[column1,column2,column3] S_C = np.c_[column1,column2,column3]
print("S_C:\n"+str(S_C)) print("S_C:\n"+str(S_C))
``` ```
%% Output %% Output
S_C: S_C:
[[ 2 -4 1] [[ 2 -4 1]
[ 0 1 0] [ 0 1 0]
[ 1 1 -5]] [ 1 1 -5]]
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
print_det(S_C) print_det(S_C)
``` ```
%% Output %% Output
Determinante: -11.0 Determinante: -11.0
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
print_rank(S_C) print_rank(S_C)
``` ```
%% Output %% Output
Rang: 3 Rang: 3
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
<code>det(S_C)</code> $\ne$ 0 und <code>rank(S_C)</code> = $n$ = $3$ <code>det(S_C)</code> $\ne$ 0 und <code>rank(S_C)</code> = $n$ = $3$
<br>Damit ist das gegebene System <span style='color:red'>vollständig steuerbar</span>! <br>Damit ist das gegebene System <span style='color:red'>vollständig steuerbar</span>!
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
<br>Jetzt betrachten wir die <span style='color:red'>Beobachtbarkeit</span>: <br>Jetzt betrachten wir die <span style='color:red'>Beobachtbarkeit</span>:
<br>Ein Eingrößensystem 3. Ordnung ist genau dann beobachtbar, wenn: $Rang$$\left[ \begin{array}{rrrr} <br>Ein Eingrößensystem 3. Ordnung ist genau dann beobachtbar, wenn: $Rang$$\left[ \begin{array}{rrrr}
c^T \\ c^T \\
c^TA\\ c^TA\\
c^TA^2\\ c^TA^2\\
\end{array}\right] $ =$Rang$($S_O$) = $n$ = $3$ \end{array}\right] $ =$Rang$($S_O$) = $n$ = $3$
<br>Im vorliegenden Fall erhält man mit: <br>Im vorliegenden Fall erhält man mit:
$c^T$ = [$1$ $1$ $0$], $c^TA$ = [$-1$ $-3$ $-1$], $c^TA^2$ = [$0$ $5$ $0$] $c^T$ = [$1$ $1$ $0$], $c^TA$ = [$-1$ $-3$ $-1$], $c^TA^2$ = [$0$ $5$ $0$]
<br> Damit erhalten wir die Beobachtbarkeitsmatrix: <br> Damit erhalten wir die Beobachtbarkeitsmatrix:
<br><br> $S_O$ = $\left[ \begin{array}{rrrr} <br><br> $S_O$ = $\left[ \begin{array}{rrrr}
1 & 1 & 0 \\ 1 & 1 & 0 \\
-1 & -3 & -1 \\ -1 & -3 & -1 \\
0 & 5 & 0 \\ 0 & 5 & 0 \\
\end{array}\right] $ \end{array}\right] $
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
S_O = np.c_[c, np.matmul(c,A), np.matmul(np.matmul(c,A),A)] S_O = np.c_[c, np.matmul(c,A), np.matmul(np.matmul(c,A),A)]
print("S_C:\n"+str(S_O)) print("S_C:\n"+str(S_O))
``` ```
%% Output %% Output
S_C: S_C:
[[ 1 -1 0] [[ 1 -1 0]
[ 1 -2 3] [ 1 -2 3]
[ 0 -1 1]] [ 0 -1 1]]
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
print_det(S_O) print_det(S_O)
``` ```
%% Output %% Output
Determinante: 2.0 Determinante: 2.0
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
print_rank(S_O) print_rank(S_O)
``` ```
%% Output %% Output
Rang: 3 Rang: 3
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify"> <div style="font-family: 'times'; font-size: 13pt; text-align: justify">
<code>det(S_O)</code> $\ne$ 0 und <code>rank(S_O)</code> = $n$ = $3$ <code>det(S_O)</code> $\ne$ 0 und <code>rank(S_O)</code> = $n$ = $3$
<br>Damit ist das gegebene System <span style='color:red'>vollständig beobachtbar</span>! <br>Damit ist das gegebene System <span style='color:red'>vollständig beobachtbar</span>!
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
......
This diff is collapsed.
notebooks/bilder/v08_A.png

32.5 KiB

notebooks/bilder/v08_B.png

33.6 KiB

notebooks/bilder/v08_beispiel2.png

23.9 KiB

notebooks/bilder/v08_beispiel6.png

42.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment