Skip to content
Snippets Groups Projects
Commit 0d25a78d authored by Sebastian Schwarz's avatar Sebastian Schwarz
Browse files

Update DCMachine_Teil1.ipynb

parent 872f042c
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</h1> <h1>Gleichstrommaschine</h1>
<p>Betrachten wir eine Permanentmagnet-Gleichstrommaschine. Hier sind zunächst einmal die wichtigsten Parameter angegeben.</p> <p>Betrachten wir eine Permanentmagnet-Gleichstrommaschine. Hier sind zunächst einmal die wichtigsten Parameter angegeben.</p>
<p>Ziel ist es, verschiedene Implementierungen eines Drehzahlregelsystems zu prüfen.</p> <p>Ziel ist es, verschiedene Implementierungen eines Drehzahlregelsystems zu prüfen.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
pkg load control
clear all clear all
pkg load control
% Winding resistance % Winding resistance
R = 1; R = 1;
% Winding inductance % Winding inductance
L = 0.5; L = 0.5;
% EMF Constant % EMF Constant
Vn = 200 Vn = 200
K = 0.01 K = 0.01
% Mechanincal Inertia % Mechanincal Inertia
J = 0.01 J = 0.01
%Mechanical losses %Mechanical losses
Km = 0.1 Km = 0.1
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Wir werden drei verschiedene Modelle betrachten:<br> <p>Wir werden drei verschiedene Modelle betrachten:<br>
- Zustandsraum<br> - Zustandsraum<br>
- Übertragungsfunktion unter der Annahme, dass keine mechanischen Verluste auftreten<br> - Übertragungsfunktion unter der Annahme, dass keine mechanischen Verluste auftreten<br>
- Übertragungsfunktion mit der Annahme mechanischer Verluste</p> - Übertragungsfunktion mit der Annahme mechanischer Verluste</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Set the Octsim Engine to run the simulation % Set the Octsim Engine to run the simulation
addpath('../Octsim'); addpath('../Octsim');
% With mechanical losses % With mechanical losses
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]
% Without losses % Without losses
num = [K/(L*J)] num = [K/(L*J)]
den = [1 R/L K^2/(L*J)] den = [1 R/L K^2/(L*J)]
% With mechanical losses % With mechanical losses
num2 = [K/(L*J)] num2 = [K/(L*J)]
den2 = [1 (Km/J+R/L) (R*Km+K*K)/(L*J)] den2 = [1 (Km/J+R/L) (R*Km+K*K)/(L*J)]
eigs(A) eigs(A)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Hier führen wir den Ausgangsvektor zur Extraktion der Zustandsgeschwindigkeit und die Definition der beiden Übertragungsfunktionen ein.</p> <p>Hier führen wir den Ausgangsvektor zur Extraktion der Zustandsgeschwindigkeit und die Definition der beiden Übertragungsfunktionen ein.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Cd = [0 1] Cd = [0 1]
Gs = tf(num,den) Gs = tf(num,den)
Gs2 = tf(num2,den2) Gs2 = tf(num2,den2)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<img src="figures/speeddia1.png" alt="drawing" width="600" height="300"/> <img src="figures/speeddia1.png" alt="drawing" width="600" height="300"/>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Der erste Entwurf ist eine PID-Regelung. Wir können ihn im Fall einer verlustfreien Übertragungsfunktion verwenden, bei der wir zwei Pole und keine Nullstellen haben. Die PID-Regelung wird zunächst dazu verwendet, die beiden Pole des Nenners der Übertragungsfunktion zu löschen.</p> <p>Der erste Entwurf ist eine PID-Regelung. Wir können ihn im Fall einer verlustfreien Übertragungsfunktion verwenden, bei der wir zwei Pole und keine Nullstellen haben. Die PID-Regelung wird zunächst dazu verwendet, die beiden Pole des Nenners der Übertragungsfunktion zu löschen.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
omo = 100; omo = 100;
Kd1 = omo/(num/den(1)) Kd1 = omo/(num/den(1))
Kp1 = Kd1*den(2)/den(1) Kp1 = Kd1*den(2)/den(1)
Ki1 = Kd1*den(3)/den(1) Ki1 = Kd1*den(3)/den(1)
GrNum = [Kd1 Kp1 Ki1]; GrNum = [Kd1 Kp1 Ki1];
GrDen = [1 0]; GrDen = [1 0];
Gr = tf(GrNum,GrDen); Gr = tf(GrNum,GrDen);
``` ```
%% Output %% Output
Kd1 = 50 Kd1 = 50
Kp1 = 100 Kp1 = 100
Ki1 = 1 Ki1 = 1
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Nun zeichnen wir die Übertragungsfunktion der Regelstrecke auf.</p> <p>Nun zeichnen wir die Übertragungsfunktion der Regelstrecke auf.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
bode(Gs) bode(Gs)
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Hier gilt umgekehrt die Übertragungsfunktion des offenen Regelkreises einschließlich des Reglers:</p> <p>Hier gilt umgekehrt die Übertragungsfunktion des offenen Regelkreises einschließlich des Reglers:</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Go = Gs*Gr; Go = Gs*Gr;
bode(Go) bode(Go)
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Nun die Übertragungsfunktion des offenen Regelkreises mit demselben Regler, wobei für die Regelstrecke die Übertragungsfunktion unter der Annahme von mechanischen Verlusten verwendet wird. Es ist interessant zu sehen, dass der Regler auch in diesem Fall eine gute Lösung ist, da die Verluste gering sind.</p> <p>Nun die Übertragungsfunktion des offenen Regelkreises mit demselben Regler, wobei für die Regelstrecke die Übertragungsfunktion unter der Annahme von mechanischen Verlusten verwendet wird. Es ist interessant zu sehen, dass der Regler auch in diesem Fall eine gute Lösung ist, da die Verluste gering sind.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Go2 = Gs2*Gr; Go2 = Gs2*Gr;
bode(Go2) bode(Go2)
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die Ergebnisse werden mit einer Simulation einer Sprungantwort des geschlossenen Regelkreises verifiziert. Angesichts des hohen Wertes der Phasenreserve gibt es kein Überschwingen.</p> <p>Die Ergebnisse werden mit einer Simulation einer Sprungantwort des geschlossenen Regelkreises verifiziert. Angesichts des hohen Wertes der Phasenreserve gibt es kein Überschwingen.</p>
%% 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 = 3; tfinal = 3;
% Time Step % Time Step
dt = 0.001; dt = 0.001;
% Number of data flows in the schematic % Number of data flows in the schematic
nflows = 4; nflows = 4;
% Sampling time for discrete time % Sampling time for discrete time
Ts = 0.01; Ts = 0.01;
% 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} = StepSource(1,0,100,0.1); c1{1} = StepSource(1,0,100,0.1);
c1{2} = Sum(1,2,3,1,-1); c1{2} = Sum(1,2,3,1,-1);
c1{3} = PID(3,4,Kp1,Ki1,Kd1,0); c1{3} = PID(3,4,Kp1,Ki1,Kd1,0);
c1{4} = TransferFunction(4,2,num,den); c1{4} = TransferFunction(4,2,num,den);
sc1.AddListComponents(c1); sc1.AddListComponents(c1);
% Run the schematic and plot % Run the schematic and plot
out1 = sc1.Run([1 2]); out1 = sc1.Run([1 2]);
plot(out1(1,:),out1(2,:),out1(1,:),out1(3,:)); plot(out1(1,:),out1(2,:),out1(1,:),out1(3,:));
ylim([-5 105]); ylim([-5 105]);
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Als zweite Regelung entwerfen wir einen PI-Regler. In diesem Fall benötigen wir zwei Spezifikationen: Bandbreite und Phasenreserve</p> <p>Als zweite Regelung entwerfen wir einen PI-Regler. In diesem Fall benötigen wir zwei Spezifikationen: Bandbreite und Phasenreserve</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
omo = 1; omo = 1;
Fideg = 60; Fideg = 60;
Fi = Fideg*pi/180; Fi = Fideg*pi/180;
[Go Fo]= bode(Gs,omo) [Go Fo]= bode(Gs,omo)
Fo = Fo*pi/180; Fo = Fo*pi/180;
Kp2 = cos(-pi+Fi-Fo)/Go Kp2 = cos(-pi+Fi-Fo)/Go
Ki2 = -sin(-pi+Fi-Fo)*omo/Go Ki2 = -sin(-pi+Fi-Fo)*omo/Go
``` ```
%% Output %% Output
Go = 0.89799 Go = 0.89799
Fo = -116.10 Fo = -116.10
Kp2 = 1.1110 Kp2 = 1.1110
Ki2 = 0.075648 Ki2 = 0.075648
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
NumGr = [Kp2 Ki2]; NumGr = [Kp2 Ki2];
DenGr = [1 0]; DenGr = [1 0];
Gr2 = tf(NumGr,DenGr) Gr2 = tf(NumGr,DenGr)
Go = Gs*Gr2 Go = Gs*Gr2
margin(Go) margin(Go)
``` ```
%% Output %% Output
Transfer function 'Gr2' from input 'u1' to output ... Transfer function 'Gr2' from input 'u1' to output ...
1.111 s + 0.07565 1.111 s + 0.07565
y1: ----------------- y1: -----------------
s s
Continuous-time model. Continuous-time model.
Transfer function 'Go' from input 'u1' to output ... Transfer function 'Go' from input 'u1' to output ...
2.222 s + 0.1513 2.222 s + 0.1513
y1: -------------------- y1: --------------------
s^3 + 2 s^2 + 0.02 s s^3 + 2 s^2 + 0.02 s
Continuous-time model. Continuous-time model.
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Jetzt kommt es zu einem Überschwingen, da die Phasenreserve klein ist.</p> <p>Jetzt kommt es zu einem Überschwingen, da die Phasenreserve klein ist.</p>
%% 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 = 10; tfinal = 10;
% Time Step % Time Step
dt = 0.001; dt = 0.001;
% Number of data flows in the schematic % Number of data flows in the schematic
nflows = 4; nflows = 4;
% Instance of the simulation schematic % Instance of the simulation schematic
sc2 = Schema(tini,tfinal,dt,nflows); sc2 = Schema(tini,tfinal,dt,nflows);
% List of components % List of components
c2{1} = StepSource(1,0,100,0.1); c2{1} = StepSource(1,0,100,0.1);
c2{2} = Sum(1,2,3,1,-1); c2{2} = Sum(1,2,3,1,-1);
c2{3} = PI(3,4,Kp2,Ki2,0); c2{3} = PI(3,4,Kp2,Ki2,0);
c2{4} = TransferFunction(4,2,num,den); c2{4} = TransferFunction(4,2,num,den);
sc2.AddListComponents(c2); sc2.AddListComponents(c2);
% Run the schematic and plot % Run the schematic and plot
out2 = sc2.Run([1 2]); out2 = sc2.Run([1 2]);
plot(out2(1,:),out2(2,:),out2(1,:),out2(3,:)); plot(out2(1,:),out2(2,:),out2(1,:),out2(3,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Umgekehrt funktioniert der ohne Verluste entworfene PID erwartungsgemäß auch, aber nicht perfekt. Die Polauslöschung ist nicht perfekt, und dies ist sichtbar.</p> <p>Umgekehrt funktioniert der ohne Verluste entworfene PID erwartungsgemäß auch, aber nicht perfekt. Die Polauslöschung ist nicht perfekt, und dies ist sichtbar.</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
nflows2 = 4; nflows2 = 4;
tfinal2 = 5; tfinal2 = 5;
% Instance of the simulation schematic % Instance of the simulation schematic
sca = Schema(tini,tfinal2,dt,nflows2); sca = Schema(tini,tfinal2,dt,nflows2);
xo = [0; 0]; xo = [0; 0];
% List of components % List of components
ca{1} = StepSource(1,0,100,0.1); ca{1} = StepSource(1,0,100,0.1);
ca{2} = Sum(1,2,3,1,-1); ca{2} = Sum(1,2,3,1,-1);
ca{3} = PID(3,4,Kp1,Ki1,Kd1,0); ca{3} = PID(3,4,Kp1,Ki1,Kd1,0);
ca{4} = StateSpace(4,2,A,B,Cd,0,xo); ca{4} = StateSpace(4,2,A,B,Cd,0,xo);
sca.AddListComponents(ca); sca.AddListComponents(ca);
% Run the schematic and plot % Run the schematic and plot
out3 = sca.Run([1 2]); out3 = sca.Run([1 2]);
plot(out3(1,:),out3(2,:),out3(1,:),out3(3,:)); plot(out3(1,:),out3(2,:),out3(1,:),out3(3,:));
ylim([-5 105]); ylim([-5 105]);
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Wir betrachten nun die Implementierung eines digitalen Reglers. Zunächst einmal führen wir einfach den gleichen Entwurf wie bei einem analogen Regler aus. Zu Beginn wählen wir die Abtastzeit als Funktion der Eigenwerte der Regelstrecke.</p> <p>Wir betrachten nun die Implementierung eines digitalen Reglers. Zunächst einmal führen wir einfach den gleichen Entwurf wie bei einem analogen Regler aus. Zu Beginn wählen wir die Abtastzeit als Funktion der Eigenwerte der Regelstrecke.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
pa = roots(den) pa = roots(den)
``` ```
%% Output %% Output
pa = pa =
-1.989949 -1.989949
-0.010051 -0.010051
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
tau = min(-1./real(pa)) tau = min(-1./real(pa))
Ts = tau/10 Ts = tau/10
``` ```
%% Output %% Output
tau = 0.50253 tau = 0.50253
Ts = 0.050253 Ts = 0.050253
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Dann können wir die Koeffizienten für den digitalen PI-Regler berechnen:</p> <p>Dann können wir die Koeffizienten für den digitalen PI-Regler berechnen:</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Kr = Kp2; Kr = Kp2;
Ti = Kr/Ki2; Ti = Kr/Ki2;
Zn = 1/(1+Ts/Ti); Zn = 1/(1+Ts/Ti);
Numrz = [Kr/Zn -Kr]; Numrz = [Kr/Zn -Kr];
Denrz = [1 -1]; Denrz = [1 -1];
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Grz = tf(Numrz,Denrz,Ts) Grz = tf(Numrz,Denrz,Ts)
Gsz = c2d(Gs,Ts,'zoh') Gsz = c2d(Gs,Ts,'zoh')
Go3 = Grz*Gsz; Go3 = Grz*Gsz;
margin(Go3) margin(Go3)
``` ```
%% Output %% Output
Transfer function 'Grz' from input 'u1' to output ... Transfer function 'Grz' from input 'u1' to output ...
1.115 z - 1.111 1.115 z - 1.111
y1: --------------- y1: ---------------
z - 1 z - 1
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
Transfer function 'Gsz' from input 'u1' to output ... Transfer function 'Gsz' from input 'u1' to output ...
0.002443 z + 0.002362 0.002443 z + 0.002362
y1: ---------------------- y1: ----------------------
z^2 - 1.904 z + 0.9044 z^2 - 1.904 z + 0.9044
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Mit dieser Formel erhalten wir einen Näherungswert für den Verlust an Phasenreserve, der durch die Diskretisierung entsteht. Angesichts des erhaltenen Wertes können wir davon ausgehen, dass die Schwingung größer sein wird.</p> <p>Mit dieser Formel erhalten wir einen Näherungswert für den Verlust an Phasenreserve, der durch die Diskretisierung entsteht. Angesichts des erhaltenen Wertes können wir davon ausgehen, dass die Schwingung größer sein wird.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
DeltaFim = (omo*Ts/2)*180/pi DeltaFim = (omo*Ts/2)*180/pi
``` ```
%% Output %% Output
DeltaFim = 1.4396 DeltaFim = 1.4396
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die Simulation bestätigt das Ergebnis:</p> <p>Die Simulation bestätigt das Ergebnis:</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
nflows = 4; nflows = 4;
% Instance of the simulation schematic % Instance of the simulation schematic
sc3 = Schema(tini,tfinal,dt,nflows); sc3 = Schema(tini,tfinal,dt,nflows);
% List of components % List of components
c3{1} = StepSource(1,0,1,0.1); c3{1} = StepSource(1,0,1,0.1);
c3{2} = Sum(1,2,3,1,-1); c3{2} = Sum(1,2,3,1,-1);
c3{3} = DTTransferFunction(3,4,Numrz,Denrz,Ts); c3{3} = DTTransferFunction(3,4,Numrz,Denrz,Ts);
c3{4} = TransferFunction(4,2,num,den); c3{4} = TransferFunction(4,2,num,den);
sc3.AddListComponents(c3); sc3.AddListComponents(c3);
% Run the schematic and plot % Run the schematic and plot
out3 = sc3.Run([1 2]); out3 = sc3.Run([1 2]);
plot(out3(1,:),out3(2,:),out3(1,:),out3(3,:)); plot(out3(1,:),out3(2,:),out3(1,:),out3(3,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Eine direkte Auslegung in der Z-Ebene ist ebenfalls möglich.</p> <p>Eine direkte Auslegung in der Z-Ebene ist ebenfalls möglich.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
G1z = c2d(Gs,Ts,'zoh') G1z = c2d(Gs,Ts,'zoh')
omb = 1 omb = 1
fim = 60 fim = 60
[Gw fi] = bode(G1z,omb) [Gw fi] = bode(G1z,omb)
th = -180+fim-fi th = -180+fim-fi
Kp3 = cos(th*pi/180)/Gw Kp3 = cos(th*pi/180)/Gw
Ki3 = -sin(th*pi/180)*omb/Gw Ki3 = -sin(th*pi/180)*omb/Gw
``` ```
%% Output %% Output
Transfer function 'G1z' from input 'u1' to output ... Transfer function 'G1z' from input 'u1' to output ...
0.002443 z + 0.002362 0.002443 z + 0.002362
y1: ---------------------- y1: ----------------------
z^2 - 1.904 z + 0.9044 z^2 - 1.904 z + 0.9044
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
omb = 1 omb = 1
fim = 60 fim = 60
Gw = 0.89790 Gw = 0.89790
fi = -117.54 fi = -117.54
th = -2.4555 th = -2.4555
Kp3 = 1.1127 Kp3 = 1.1127
Ki3 = 0.047716 Ki3 = 0.047716
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
KiT = Ki3*Ts/2 KiT = Ki3*Ts/2
n1 = Kp3+KiT n1 = Kp3+KiT
n2 = KiT-Kp3 n2 = KiT-Kp3
Numrz2 = [n1 n2]; Numrz2 = [n1 n2];
Denrz2 = [1 -1]; Denrz2 = [1 -1];
Gr1 = tf(Numrz2,Denrz2,Ts) Gr1 = tf(Numrz2,Denrz2,Ts)
``` ```
%% Output %% Output
KiT = 0.0011989 KiT = 0.0011989
n1 = 1.1139 n1 = 1.1139
n2 = -1.1115 n2 = -1.1115
Transfer function 'Gr1' from input 'u1' to output ... Transfer function 'Gr1' from input 'u1' to output ...
1.114 z - 1.111 1.114 z - 1.111
y1: --------------- y1: ---------------
z - 1 z - 1
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
%% 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
nflows = 4; nflows = 4;
% Instance of the simulation schematic % Instance of the simulation schematic
sc4 = Schema(tini,tfinal,dt,nflows); sc4 = Schema(tini,tfinal,dt,nflows);
% List of components % List of components
c4{1} = StepSource(1,0,1,0.1); c4{1} = StepSource(1,0,1,0.1);
c4{2} = Sum(1,2,3,1,-1); c4{2} = Sum(1,2,3,1,-1);
c4{3} = DTTransferFunction(3,4,Numrz2,Denrz2,Ts); c4{3} = DTTransferFunction(3,4,Numrz2,Denrz2,Ts);
c4{4} = TransferFunction(4,2,num,den); c4{4} = TransferFunction(4,2,num,den);
sc4.AddListComponents(c4); sc4.AddListComponents(c4);
% Run the schematic and plot % Run the schematic and plot
out4 = sc4.Run([1 2]); out4 = sc4.Run([1 2]);
plot(out4(1,:),out4(2,:),out4(1,:),out4(3,:)); plot(out4(1,:),out4(2,:),out4(1,:),out4(3,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Eine weitere Möglichkeit, PI zu verwenden und gute Leistungen zu erzielen, besteht in der Definition einer kaskadierten Regelungsarchitektur: eine interne Stromregelung und eine externe Drehzahlregelung. Wir führen nun sowohl Strom als auch Geschwindigkeit zurück. Beachten Sie, dass durch die Messung beider Größen der Entwurf einfacher und effizienter wird.</p> Eine weitere Möglichkeit, PI zu verwenden und gute Leistungen zu erzielen, besteht in der Definition einer kaskadierten Regelungsarchitektur: eine interne Stromregelung und eine externe Drehzahlregelung. Wir führen nun sowohl Strom als auch Geschwindigkeit zurück. Beachten Sie, dass durch die Messung beider Größen der Entwurf einfacher und effizienter wird.</p>
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<img src="figures/speeddia2.png" alt="drawing" width="600" height="300"/><p> <img src="figures/speeddia2.png" alt="drawing" width="600" height="300"/><p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
%PI Current %PI Current
omc = 200 omc = 200
Kpc = omc/(1/L) Kpc = omc/(1/L)
Kic = Kpc*R/L Kic = Kpc*R/L
oms = 20 oms = 20
Kps = oms/(K/J) Kps = oms/(K/J)
Kis = Kps*Km/J Kis = Kps*Km/J
``` ```
%% Output %% Output
omc = 200 omc = 200
Kpc = 100 Kpc = 100
Kic = 200 Kic = 200
oms = 20 oms = 20
Kps = 20 Kps = 20
Kis = 200 Kis = 200
%% 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 = 9; nflows2 = 9;
% Instance of the simulation schematic % Instance of the simulation schematic
sc5 = Schema(tini,tfinal,dt,nflows2); sc5 = Schema(tini,tfinal,dt,nflows2);
% List of components % List of components
c5{1} = StepSource(1,0,100,0.1); c5{1} = StepSource(1,0,100,0.1);
c5{2} = Sum(1,2,3,1,-1); c5{2} = Sum(1,2,3,1,-1);
c5{3} = PI(3,4,Kps,Kis,0); c5{3} = PI(3,4,Kps,Kis,0);
c5{4} = Sum(4,5,6,1,-1); c5{4} = Sum(4,5,6,1,-1);
c5{5} = PI(6,7,Kpc,Kic,0); c5{5} = PI(6,7,Kpc,Kic,0);
c5{6} = Sum(7,8,9,1,1); c5{6} = Sum(7,8,9,1,1);
c5{7} = Gain(2,8,K); c5{7} = Gain(2,8,K);
c5{8} = StateSpace(9,[5, 2],A,B,C,D,xo); c5{8} = StateSpace(9,[5, 2],A,B,C,D,xo);
sc5.AddListComponents(c5); sc5.AddListComponents(c5);
% Run the schematic and plot % Run the schematic and plot
out5 = sc5.Run([1 2]); out5 = sc5.Run([1 2]);
plot(out5(1,:),out5(2,:),out5(1,:),out5(3,:)); plot(out5(1,:),out5(2,:),out5(1,:),out5(3,:));
ylim([-5 105]); ylim([-5 105]);
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Als letzte Option kommt auch ein Deadbeat-Regler vierter Ordnung in Betracht.</p> <p>Als letzte Option kommt auch ein Deadbeat-Regler vierter Ordnung in Betracht.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Ts2 = Ts; Ts2 = Ts;
G2z = c2d(Gs,Ts2,'zoh') G2z = c2d(Gs,Ts2,'zoh')
numG = cell2mat(G2z.num) numG = cell2mat(G2z.num)
denG = cell2mat(G2z.den) denG = cell2mat(G2z.den)
b1 = sum(numG) b1 = sum(numG)
numd = denG numd = denG
dend= conv(numG,[1 0 0 0 -1]) dend= conv(numG,[1 0 0 0 -1])
Gr2 = tf(numd,dend,Ts2) Gr2 = tf(numd,dend,Ts2)
``` ```
%% Output %% Output
Transfer function 'G2z' from input 'u1' to output ... Transfer function 'G2z' from input 'u1' to output ...
0.002443 z + 0.002362 0.002443 z + 0.002362
y1: ---------------------- y1: ----------------------
z^2 - 1.904 z + 0.9044 z^2 - 1.904 z + 0.9044
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
numG = numG =
0.0024428 0.0023623 0.0024428 0.0023623
denG = denG =
1.00000 -1.90433 0.90438 1.00000 -1.90433 0.90438
b1 = 0.0048051 b1 = 0.0048051
numd = numd =
1.00000 -1.90433 0.90438 1.00000 -1.90433 0.90438
dend = dend =
0.0024428 0.0023623 0.0000000 0.0000000 -0.0024428 -0.0023623 0.0024428 0.0023623 0.0000000 0.0000000 -0.0024428 -0.0023623
Transfer function 'Gr2' from input 'u1' to output ... Transfer function 'Gr2' from input 'u1' to output ...
z^2 - 1.904 z + 0.9044 z^2 - 1.904 z + 0.9044
y1: --------------------------------------------------- y1: ---------------------------------------------------
0.002443 z^5 + 0.002362 z^4 - 0.002443 z - 0.002362 0.002443 z^5 + 0.002362 z^4 - 0.002443 z - 0.002362
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Wir überprüfen dann per Simulation:</p> <p>Wir überprüfen dann per Simulation:</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
nflows = 4; nflows = 4;
tfinal3 = 0.8; tfinal3 = 0.8;
% Instance of the simulation schematic % Instance of the simulation schematic
sc6 = Schema(tini,tfinal3,dt,nflows); sc6 = Schema(tini,tfinal3,dt,nflows);
% List of components % List of components
c6{1} = StepSource(1,0,1,0.1); c6{1} = StepSource(1,0,1,0.1);
c6{2} = Sum(1,2,3,1,-1); c6{2} = Sum(1,2,3,1,-1);
c6{3} = DTTransferFunction(3,4,numd,dend,Ts2); c6{3} = DTTransferFunction(3,4,numd,dend,Ts2);
c6{4} = TransferFunction(4,2,num,den); c6{4} = TransferFunction(4,2,num,den);
sc6.AddListComponents(c6); sc6.AddListComponents(c6);
% Run the schematic and plot % Run the schematic and plot
out6 = sc6.Run([1 2 3]); out6 = sc6.Run([1 2 3]);
plot(out6(1,:),out6(2,:),out6(1,:),out6(3,:)); plot(out6(1,:),out6(2,:),out6(1,:),out6(3,:));
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Die Ergebnisse sind nicht gut und weisen eine zunehmende Schwankung auf. Dies ist ein Phänomen, das bei Deadbeat-Controllern auftreten kann. Es kann überprüft werden, dass der Fehler zum Zeitpunkt der Abtastung eigentlich 0 ist, aber dann kommt es zu einer Oszillation, die hier tatsächlich auch divergiert. <p>Die Ergebnisse sind nicht gut und weisen eine zunehmende Schwankung auf. Dies ist ein Phänomen, das bei Deadbeat-Controllern auftreten kann. Es kann überprüft werden, dass der Fehler zum Zeitpunkt der Abtastung eigentlich 0 ist, aber dann kommt es zu einer Oszillation, die hier tatsächlich auch divergiert.
Andererseits ist der Entwurf korrekt, wie die Berechnung der Übertragungsfunktion des geschlossenen Regelkreises zeigt. Andererseits ist der Entwurf korrekt, wie die Berechnung der Übertragungsfunktion des geschlossenen Regelkreises zeigt.
Es sind spezielle Lösungen erforderlich, um das Oszillationsproblem in dem System, in dem es auftritt, zu beseitigen.</p> Es sind spezielle Lösungen erforderlich, um das Oszillationsproblem in dem System, in dem es auftritt, zu beseitigen.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
Gl = Gr2*G1z; Gl = Gr2*G1z;
Gcl = Gl/(1+Gl); Gcl = Gl/(1+Gl);
Gcl = minreal(Gcl) Gcl = minreal(Gcl)
``` ```
%% Output %% Output
Transfer function 'Gcl' from input 'u1' to output ... Transfer function 'Gcl' from input 'u1' to output ...
1 1
y1: --- y1: ---
z^4 z^4
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<p>Mit mechanischen Verlusten ist die Situation aber schon besser.</p> <p>Mit mechanischen Verlusten ist die Situation aber schon besser.</p>
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
G3z = c2d(Gs2,Ts2,'zoh') G3z = c2d(Gs2,Ts2,'zoh')
numG2 = cell2mat(G3z.num) numG2 = cell2mat(G3z.num)
denG2 = cell2mat(G3z.den) denG2 = cell2mat(G3z.den)
b12 = sum(numG2) b12 = sum(numG2)
numd2 = denG2 numd2 = denG2
dend2= conv(numG2,[1 0 0 0 -1]) dend2= conv(numG2,[1 0 0 0 -1])
Gr3 = tf(numd2,dend2,Ts2) Gr3 = tf(numd2,dend2,Ts2)
``` ```
%% Output %% Output
Transfer function 'G3z' from input 'u1' to output ... Transfer function 'G3z' from input 'u1' to output ...
0.002077 z + 0.001699 0.002077 z + 0.001699
y1: ---------------------- y1: ----------------------
z^2 - 1.509 z + 0.5472 z^2 - 1.509 z + 0.5472
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
numG2 = numG2 =
0.0020774 0.0016995 0.0020774 0.0016995
denG2 = denG2 =
1.00000 -1.50934 0.54715 1.00000 -1.50934 0.54715
b12 = 0.0037769 b12 = 0.0037769
numd2 = numd2 =
1.00000 -1.50934 0.54715 1.00000 -1.50934 0.54715
dend2 = dend2 =
0.0020774 0.0016995 0.0000000 0.0000000 -0.0020774 -0.0016995 0.0020774 0.0016995 0.0000000 0.0000000 -0.0020774 -0.0016995
Transfer function 'Gr3' from input 'u1' to output ... Transfer function 'Gr3' from input 'u1' to output ...
z^2 - 1.509 z + 0.5472 z^2 - 1.509 z + 0.5472
y1: --------------------------------------------------- y1: ---------------------------------------------------
0.002077 z^5 + 0.001699 z^4 - 0.002077 z - 0.001699 0.002077 z^5 + 0.001699 z^4 - 0.002077 z - 0.001699
Sampling time: 0.0502525 s Sampling time: 0.0502525 s
Discrete-time model. Discrete-time model.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` octave ``` octave
% Instance of the simulation schematic % Instance of the simulation schematic
sc7 = Schema(tini,tfinal3,dt,nflows); sc7 = Schema(tini,tfinal3,dt,nflows);
% List of components % List of components
c7{1} = StepSource(1,0,1,0.1); c7{1} = StepSource(1,0,1,0.1);
c7{2} = Sum(1,2,3,1,-1); c7{2} = Sum(1,2,3,1,-1);
c7{3} = DTTransferFunction(3,4,numd2,dend2,Ts2); c7{3} = DTTransferFunction(3,4,numd2,dend2,Ts2);
c7{4} = TransferFunction(4,2,num2,den2); c7{4} = TransferFunction(4,2,num2,den2);
sc7.AddListComponents(c7); sc7.AddListComponents(c7);
% Run the schematic and plot % Run the schematic and plot
out7 = sc7.Run([1 2 3]); out7 = sc7.Run([1 2 3]);
plot(out7(1,:),out7(2,:),out7(1,:),out7(3,:)); plot(out7(1,:),out7(2,:),out7(1,:),out7(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