Skip to content
Snippets Groups Projects
Commit 2b240848 authored by zhiyupan's avatar zhiyupan
Browse files

fix the figure path

parent 0e6f0ff7
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<h1>Gleichstrommaschine im Zustandsraum</h1> <h1>Gleichstrommaschine im Zustandsraum</h1>
<p>In diesem Notebook werden verschiedene Aspekte des Entwurfs der Steuerung einer Gleichstrommaschine im Zustandsraum vorgestellt. <p>In diesem Notebook werden verschiedene Aspekte des Entwurfs der Steuerung einer Gleichstrommaschine im Zustandsraum vorgestellt.
Die Analyse wird zunächst ohne externe Störung durchgeführt und dann wird ein Widerstandsmoment hinzugefügt. Die Analyse wird zunächst ohne externe Störung durchgeführt und dann wird ein Widerstandsmoment hinzugefügt.
Zunächst stellen wir das Modell der Gleichstrommaschine vor</p> Zunächst stellen wir das Modell der Gleichstrommaschine vor</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
clear all clear all
% Winding resistance % Winding resistance
R = 1; R = 1;
% Winding inductance % Winding inductance
L = 0.01; L = 0.01;
% EMF Constant % EMF Constant
Vn = 300 Vn = 300
Wn = 500 Wn = 500
K = Vn/Wn K = Vn/Wn
% Mechanincal Inertia % Mechanincal Inertia
J = 0.001 J = 0.001
%Mechanical losses %Mechanical losses
Km = 0.001 Km = 0.001
``` ```
%% Output %% Output
Vn = 300 Vn = 300
Wn = 500 Wn = 500
K = 0.60000 K = 0.60000
J = 0.0010000 J = 0.0010000
Km = 0.0010000 Km = 0.0010000
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Dann bilden wir die Zustandsraumdarstellung mit Strom und Geschwindigkeit als Zustandsvariablen</p> <p>Dann bilden wir die Zustandsraumdarstellung mit Strom und Geschwindigkeit als Zustandsvariablen</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Set the Octave Engine to run the simulation % Set the Octave Engine to run the simulation
SetSimulationEnvironment; SetSimulationEnvironment;
A = [-R/L -K/L; K/J -Km/J] A = [-R/L -K/L; K/J -Km/J]
B = [1/L; 0] B = [1/L; 0]
C = [1 0; 0 1] C = [1 0; 0 1]
D = [0; 0] D = [0; 0]
``` ```
%% Output %% Output
A = A =
-100 -60 -100 -60
600 -1 600 -1
B = B =
100 100
0 0
C = C =
1 0 1 0
0 1 0 1
D = D =
0 0
0 0
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<h2>Zeitkontinuierlicher Entwurf</h2> <h2>Zeitkontinuierlicher Entwurf</h2>
<p>Als ersten Schritt müssen wir die Kontrollierbarkeit des Systems überprüfen<br> <p>Als ersten Schritt müssen wir die Kontrollierbarkeit des Systems überprüfen<br>
Zu diesem Zweck ist es wichtig, dass der Rang der Matrix gleich der Ordnung des Systems ist</p> Zu diesem Zweck ist es wichtig, dass der Rang der Matrix gleich der Ordnung des Systems ist</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Sc = [B A*B] Sc = [B A*B]
rank(Sc) rank(Sc)
``` ```
%% Output %% Output
Sc = Sc =
100 -10000 100 -10000
0 60000 0 60000
ans = 2 ans = 2
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Eine weitere wichtige Information ist die Auswertung der Eigenwerte im offenen Regelkreis</p> <p>Eine weitere wichtige Information ist die Auswertung der Eigenwerte im offenen Regelkreis</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
eigs(A) eigs(A)
``` ```
%% Output %% Output
ans = ans =
-50.50 + 183.17i -50.50 + 183.17i
-50.50 - 183.17i -50.50 - 183.17i
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Lassen Sie uns zunächst einige Spezifikationen definieren Lassen Sie uns zunächst einige Spezifikationen definieren
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Raise time % Raise time
Ts = 5e-3 Ts = 5e-3
% Overshoot % Overshoot
M = 0.1 M = 0.1
om = pi/(2*Ts) om = pi/(2*Ts)
alfa = (log(M)/pi)^2 alfa = (log(M)/pi)^2
csi= sqrt(alfa/(1+alfa)) csi= sqrt(alfa/(1+alfa))
p1 = -csi*om+1j*om*sqrt(1-csi*csi) p1 = -csi*om+1j*om*sqrt(1-csi*csi)
p2 = -csi*om-1j*om*sqrt(1-csi*csi) p2 = -csi*om-1j*om*sqrt(1-csi*csi)
``` ```
%% Output %% Output
Ts = 0.0050000 Ts = 0.0050000
M = 0.10000 M = 0.10000
om = 314.16 om = 314.16
alfa = 0.53719 alfa = 0.53719
csi = 0.59116 csi = 0.59116
p1 = -185.72 + 253.39i p1 = -185.72 + 253.39i
p2 = -185.72 - 253.39i p2 = -185.72 - 253.39i
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Um die Regelkreis zu schließen, geben wir die Polposition an und berechnen die Verstärkung der Rückkopplung</p> <p>Um die Regelkreis zu schließen, geben wir die Polposition an und berechnen die Verstärkung der Rückkopplung</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
pt = [p1 p2]; pt = [p1 p2];
Kf = place(A,B,pt) Kf = place(A,B,pt)
``` ```
%% Output %% Output
Kf = Kf =
2.7043 1.0388 2.7043 1.0388
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die Simulation kann zur Überprüfung des Systemverhaltens verwendet werden.<br> <p>Die Simulation kann zur Überprüfung des Systemverhaltens verwendet werden.<br>
Zunächst simulieren wir die freie Entwicklung des Systems im offenen Kreislauf</p> Zunächst simulieren wir die freie Entwicklung des Systems im offenen Kreislauf</p>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<img src="DCOpenLoop.svg" alt="drawing" width="600" height="300"/> <img src="Bilder/DCOpenLoop.svg" alt="drawing" width="600" height="300"/>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Simulation Parameters % Simulation Parameters
% Start time % Start time
tini = 0; tini = 0;
% End time % End time
tfinal = 0.4; tfinal = 0.4;
% Time Step % Time Step
dt = 0.00005; dt = 0.00005;
% Number of data flows in the schematic % Number of data flows in the schematic
nflows = 3; nflows = 3;
xo = [0; 0]; xo = [0; 0];
% Instance of the simulation schematic % Instance of the simulation schematic
sc1 = Schema(tini,tfinal,dt,nflows); sc1 = Schema(tini,tfinal,dt,nflows);
% List of components % List of components
c1{1} = Constant(1,100); c1{1} = Constant(1,100);
c1{2} = StateSpace(1,[2, 3],A,B,C,D,xo); c1{2} = StateSpace(1,[2, 3],A,B,C,D,xo);
sc1.AddListComponents(c1); sc1.AddListComponents(c1);
% Run the schematic and plot % Run the schematic and plot
out1 = sc1.Run([1,3]); out1 = sc1.Run([1,3]);
plot(out1(1,:),out1(3,:)); plot(out1(1,:),out1(3,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die vorherige Simulation wurde im offenen Regelkreis durchgeführt.<br> <p>Die vorherige Simulation wurde im offenen Regelkreis durchgeführt.<br>
Ein weiterer Aspekt ist die Untersuchung von Systemen, für die wir einen bestimmten Sollwert festlegen wollen<br> Ein weiterer Aspekt ist die Untersuchung von Systemen, für die wir einen bestimmten Sollwert festlegen wollen<br>
Zunächst muss die Verstärkung der Referenz neu skaliert werden, um die Gesamtverstärkung zu vereinheitlichen</p> Zunächst muss die Verstärkung der Referenz neu skaliert werden, um die Gesamtverstärkung zu vereinheitlichen</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% We assume the speed as variable of interest % We assume the speed as variable of interest
C3 = [0 1]; C3 = [0 1];
V = inv(C3*inv(B*Kf-A)*B) V = inv(C3*inv(B*Kf-A)*B)
``` ```
%% Output %% Output
V = 1.6449 V = 1.6449
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die nächste Simulation analysiert das Verhalten des geschlossenen Regelkreises bei einem Sprung zum Sollwert<br> <p>Die nächste Simulation analysiert das Verhalten des geschlossenen Regelkreises bei einem Sprung zum Sollwert<br>
Wir erwarten dann einen modifizierten stationären Zustand, der dem Schrittwert des Eingangs entsprich</p> Wir erwarten dann einen modifizierten stationären Zustand, der dem Schrittwert des Eingangs entsprich</p>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<img src="DCClosedLoop.svg" alt="drawing" width="600" height="300"/> <img src="Bilder/DCClosedLoop.svg" alt="drawing" width="600" height="300"/>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Number of data flows in the schematic % Number of data flows in the schematic
nflows2 = 6; nflows2 = 6;
% Instance of the simulation schematic % Instance of the simulation schematic
sc3 = Schema(tini,tfinal,dt,nflows2); sc3 = Schema(tini,tfinal,dt,nflows2);
% List of components % List of components
c3{1} = StepSource(1,0,200,0.1); c3{1} = StepSource(1,0,200,0.1);
c3{2} = Gain(1,2,V); c3{2} = Gain(1,2,V);
c3{3} = Sum(2,3,4,1,-1); c3{3} = Sum(2,3,4,1,-1);
c3{4} = StateSpace(4,[5 6],A,B,C,D,xo); c3{4} = StateSpace(4,[5 6],A,B,C,D,xo);
c3{5} = Gain([5 6],3,Kf); c3{5} = Gain([5 6],3,Kf);
sc3.AddListComponents(c3); sc3.AddListComponents(c3);
% Run the schematic and plot % Run the schematic and plot
out3 = sc3.Run([6 4]); out3 = sc3.Run([6 4]);
plot(out3(1,:),out3(2,:)); plot(out3(1,:),out3(2,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Das System erreicht korrekt den Referenzwert<br> <p>Das System erreicht korrekt den Referenzwert<br>
Ein weiterer Aspekt ist auch die Analyse der Leistung des Eingangskanals (Spannung) Ein weiterer Aspekt ist auch die Analyse der Leistung des Eingangskanals (Spannung)
</p> </p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
plot(out3(1,:),out3(3,:)); plot(out3(1,:),out3(3,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Fügen wir nun eine Störung hinzu, d. h. ein Widerstandsmoment</p> <p>Fügen wir nun eine Störung hinzu, d. h. ein Widerstandsmoment</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Number of data flows in the schematic % Number of data flows in the schematic
nflows3 = 7; nflows3 = 7;
% Instance of the simulation schematic % Instance of the simulation schematic
sc4 = Schema(tini,tfinal,dt,nflows3); sc4 = Schema(tini,tfinal,dt,nflows3);
% Adding as input the resistive torque % Adding as input the resistive torque
B2 = [1/L 0; 0 -1/J] B2 = [1/L 0; 0 -1/J]
D2 = [0 0; 0 0] D2 = [0 0; 0 0]
% List of components % List of components
c4{1} = StepSource(1,0,200,0.1); c4{1} = StepSource(1,0,200,0.1);
c4{2} = Gain(1,2,V); c4{2} = Gain(1,2,V);
c4{3} = Sum(2,3,4,1,1); c4{3} = Sum(2,3,4,1,1);
c4{4} = StepSource(7,0,10,0.3); c4{4} = StepSource(7,0,10,0.3);
c4{5} = StateSpace([4 7],[5 6],A,B2,C,D2,xo); c4{5} = StateSpace([4 7],[5 6],A,B2,C,D2,xo);
c4{6} = Gain([5 6],3,-Kf); c4{6} = Gain([5 6],3,-Kf);
sc4.AddListComponents(c4); sc4.AddListComponents(c4);
% Run the schematic and plot % Run the schematic and plot
out4 = sc4.Run([6]); out4 = sc4.Run([6]);
plot(out4(1,:),out4(2,:)); plot(out4(1,:),out4(2,:));
``` ```
%% Output %% Output
B2 = B2 =
100 0 100 0
0 -1000 0 -1000
D2 = D2 =
0 0 0 0
0 0 0 0
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die Steuerung kann die Störung nicht kompensieren. Wir müssen eine Integrationsmaßnahme hinzufügen.<br> <p>Die Steuerung kann die Störung nicht kompensieren. Wir müssen eine Integrationsmaßnahme hinzufügen.<br>
Aus diesem Grund benötigen wir eine neue Zustandsvariable und müssen den Entwurf erneut durchführen<br> Aus diesem Grund benötigen wir eine neue Zustandsvariable und müssen den Entwurf erneut durchführen<br>
Wir beginnen mit der Definition des neuen Systems</p> Wir beginnen mit der Definition des neuen Systems</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Ae = [-R/L -K/L 0; K/J -Km/J 0; 0 1 0] Ae = [-R/L -K/L 0; K/J -Km/J 0; 0 1 0]
Be = [1/L; 0; 0] Be = [1/L; 0; 0]
``` ```
%% Output %% Output
Ae = Ae =
-100 -60 0 -100 -60 0
600 -1 0 600 -1 0
0 1 0 0 1 0
Be = Be =
100 100
0 0
0 0
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Wir müssen die Kontrollierbarkeit erneut überprüfen</p> <p>Wir müssen die Kontrollierbarkeit erneut überprüfen</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Sce = [Be Ae*Be Ae*Ae*Be] Sce = [Be Ae*Be Ae*Ae*Be]
rank(Sce) rank(Sce)
``` ```
%% Output %% Output
Sce = Sce =
100 -10000 -2600000 100 -10000 -2600000
0 60000 -6060000 0 60000 -6060000
0 0 60000 0 0 60000
ans = 3 ans = 3
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Wir wiederholen dann den Entwurf für das neue System und einen weiteren Pol in der Spezifikation</p> <p>Wir wiederholen dann den Entwurf für das neue System und einen weiteren Pol in der Spezifikation</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
p3 = -1000 p3 = -1000
pte = [p1 p2 p3]; pte = [p1 p2 p3];
Kfe = acker(Ae,Be,pte) Kfe = acker(Ae,Be,pte)
``` ```
%% Output %% Output
p3 = -1000 p3 = -1000
Kfe = Kfe =
12.7043 7.2127 1644.9341 12.7043 7.2127 1644.9341
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Nun wiederholen wir die Simulation im geschlossenen Regelkreis mit dem Integrator</p> <p>Nun wiederholen wir die Simulation im geschlossenen Regelkreis mit dem Integrator</p>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<img src="DCClosedLoopIntegral.svg" alt="drawing" width="600" height="300"/> <img src="Bilder/DCClosedLoopIntegral.svg" alt="drawing" width="600" height="300"/>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Number of data flows in the schematic % Number of data flows in the schematic
nflows4 = 10; nflows4 = 10;
% Instance of the simulation schematic % Instance of the simulation schematic
sc5 = Schema(tini,tfinal,dt,nflows4); sc5 = Schema(tini,tfinal,dt,nflows4);
% Adding as input the resistive torque % Adding as input the resistive torque
B2 = [1/L 0; 0 -1/J] B2 = [1/L 0; 0 -1/J]
D2 = [0 0; 0 0] D2 = [0 0; 0 0]
% List of components % List of components
c5{1} = StepSource(1,0,200,0.1); c5{1} = StepSource(1,0,200,0.1);
c5{2} = Sum(1,9,2,-1,1); c5{2} = Sum(1,9,2,-1,1);
c5{3} = Integrator(2,3,0); c5{3} = Integrator(2,3,0);
c5{4} = Gain(3,5,-Kfe(3)); c5{4} = Gain(3,5,-Kfe(3));
c5{5} = Sum(10,5,7,1,1); c5{5} = Sum(10,5,7,1,1);
c5{6} = StepSource(6,0,10,0.3); c5{6} = StepSource(6,0,10,0.3);
c5{7} = StateSpace([7 6],[8 9],A,B2,C,D2,xo); c5{7} = StateSpace([7 6],[8 9],A,B2,C,D2,xo);
c5{8} = Gain([8 9],10,[-Kfe(1) -Kfe(2)]); c5{8} = Gain([8 9],10,[-Kfe(1) -Kfe(2)]);
sc5.AddListComponents(c5); sc5.AddListComponents(c5);
% Run the schematic and plot % Run the schematic and plot
out5 = sc5.Run([9]); out5 = sc5.Run([9]);
plot(out5(1,:),out5(2,:)); plot(out5(1,:),out5(2,:));
``` ```
%% Output %% Output
B2 = B2 =
100 0 100 0
0 -1000 0 -1000
D2 = D2 =
0 0 0 0
0 0 0 0
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die Simulationsergebnisse bestätigen die theoretischen Annahmen</p> <p>Die Simulationsergebnisse bestätigen die theoretischen Annahmen</p>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<h2>Regler mit Beobachter</h2> <h2>Regler mit Beobachter</h2>
<p>Wir gehen nun davon aus, dass nur die Geschwindigkeit gemessen wird. <p>Wir gehen nun davon aus, dass nur die Geschwindigkeit gemessen wird.
Dann ist es notwendig, einen Beobachter hinzuzufügen, und wir müssen die Beobachtbarkeit überprüfen</p> Dann ist es notwendig, einen Beobachter hinzuzufügen, und wir müssen die Beobachtbarkeit überprüfen</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Cm = [0 1] Cm = [0 1]
So = [Cm; Cm*A] So = [Cm; Cm*A]
det(So) det(So)
``` ```
%% Output %% Output
Cm = Cm =
0 1 0 1
So = So =
0 1 0 1
600 -1 600 -1
ans = -600 ans = -600
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Wir definieren die Beobachterpole und berechnen dann die Beobachterverstärkung Wir definieren die Beobachterpole und berechnen dann die Beobachterverstärkung
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
pobs = [-500 -1000] pobs = [-500 -1000]
G = place(A',Cm',pobs) G = place(A',Cm',pobs)
``` ```
%% Output %% Output
pobs = pobs =
-500 -1000 -500 -1000
G = G =
540.00 1399.00 540.00 1399.00
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Schließlich testen wir das Gesamtsystem in der Simulation Schließlich testen wir das Gesamtsystem in der Simulation
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Number of data flows in the schematic % Number of data flows in the schematic
nflows6 = 7; nflows6 = 7;
% Instance of the simulation schematic % Instance of the simulation schematic
sc6 = Schema(tini,tfinal,dt,nflows6); sc6 = Schema(tini,tfinal,dt,nflows6);
xb = [0; 0]; xb = [0; 0];
% List of components % List of components
c6{1} = StepSource(1,0,200,0.1); c6{1} = StepSource(1,0,200,0.1);
c6{2} = Gain(1,2,V); c6{2} = Gain(1,2,V);
c6{3} = Sum(2,3,4,1,-1); c6{3} = Sum(2,3,4,1,-1);
c6{4} = StateSpace(4,5,A,B,Cm,D,xo); c6{4} = StateSpace(4,5,A,B,Cm,D,xo);
c6{5} = StateSpace([4 5],[6 7],A-G'*Cm,[B G'],eye(2),zeros(2,2),xb); c6{5} = StateSpace([4 5],[6 7],A-G'*Cm,[B G'],eye(2),zeros(2,2),xb);
c6{6} = Gain([6 7],3,Kf); c6{6} = Gain([6 7],3,Kf);
sc6.AddListComponents(c6); sc6.AddListComponents(c6);
% Run the schematic and plot % Run the schematic and plot
out6 = sc6.Run([1 5]); out6 = sc6.Run([1 5]);
plot(out6(1,:),out6(2,:),out6(1,:),out6(3,:)); plot(out6(1,:),out6(2,:),out6(1,:),out6(3,:));
``` ```
%% Output %% Output
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment