Skip to content
Snippets Groups Projects
Commit 093e20e4 authored by zhiyupan's avatar zhiyupan
Browse files

ADD DCMachine_Teil1

parent 22c30915
Branches
No related tags found
No related merge requests found
notebooks/exam example/Bilder/speeddia1.png

6.17 KiB

notebooks/exam example/Bilder/speeddia2.png

14.1 KiB

This diff is collapsed.
%% Cell type:markdown id:f0c1ae5c-58ce-4849-a802-8c0f07564e74 tags:
# <span style='color:OrangeRed'>V4 REGELALGORITHMEN FÜR DIE DIGITALE REGELUNG: TEIL 2</span>
%% Cell type:markdown id:89fa67fe-464b-4205-8bf2-b5f3e6af9cf8 tags:
<p>Gegeben ist ein System mit der Verstärkung 2 und zwei Zeitkonstanten: 1 und 2s. Entwerfen Sie einen Deadbeat-Regler für das System. Verwenden Sie eine Abtastzeit von 5s</p>
%% Cell type:markdown id:3d088845-789d-4a9f-8c69-7d89099a37a8 tags:
<p>Zunächst müssen wir die Übertragungsfunktion des Systems definieren</p>
%% Cell type:code id:3eba9469-4c8c-4e7a-ac53-9de59b0d075f tags:
``` octave
clear all
% Set the Octave Engine to run the simulation
SetSimulationEnvironment;
tau1 = 1
tau2 = 2
K = 2
num = K
den = conv([tau1 1],[tau2 1])
Gs = tf(num,den)
```
%% Output
tau1 = 1
tau2 = 2
K = 2
num = 2
den =
2 3 1
Transfer function 'Gs' from input 'u1' to output ...
2
y1: ---------------
2 s^2 + 3 s + 1
Continuous-time model.
%% Cell type:markdown id:e32155c4-417f-422d-8b9d-9838d865f26a tags:
<p>Dann müssen wir das System diskretisieren</p>
%% Cell type:code id:036534da-c817-459b-8698-6e1584b0392c tags:
``` octave
Ts = 5
Gz = c2d(Gs,Ts,'zoh')
```
%% Output
Ts = 5
Transfer function 'Gz' from input 'u1' to output ...
1.685 z + 0.1383
y1: ---------------------------
z^2 - 0.08882 z + 0.0005531
Sampling time: 5 s
Discrete-time model.
%% Cell type:markdown id:6950b9f5-4756-4a1b-8ae7-0adf3b82fef7 tags:
<p>Jetzt können wir endlich den Controller entwerfen</p>
%% Cell type:code id:39e06d42-b904-485b-a313-d08081c7a7d6 tags:
``` octave
numGz = cell2mat(Gz.num)
denGz = cell2mat(Gz.den)
numd = denGz
dend = conv(numGz,[1 0 -1])
Grz = tf(numd,dend,Ts)
```
%% Output
numGz =
1.68514 0.13832
denGz =
1.00000000 -0.08882295 0.00055308
numd =
1.00000000 -0.08882295 0.00055308
dend =
1.68514 0.13832 -1.68514 -0.13832
Transfer function 'Grz' from input 'u1' to output ...
z^2 - 0.08882 z + 0.0005531
y1: -----------------------------------------
1.685 z^3 + 0.1383 z^2 - 1.685 z - 0.1383
Sampling time: 5 s
Discrete-time model.
%% Cell type:markdown id:69da6df5-60b6-4c59-9b7a-3af40162c538 tags:
<p>Wir können die Ergebnisse in der Simulation überprüfen</p>
%% Cell type:code id:a7c5a5cb-05f8-4bcd-8d02-f26e7dcfe99c tags:
``` octave
% Number of data flows in the schematic
nflows = 4;
tini = 0;
tfinal = 40;
dt = 0.01;
% Instance of the simulation schematic
sc1 = Schema(tini,tfinal,dt,nflows);
% List of components
c1{1} = StepSource(1,0,1,0.1);
c1{2} = Sum(1,2,3,1,-1);
c1{3} = DTTransferFunction(3,4,numd,dend,Ts);
c1{4} = TransferFunction(4,2,num,den);
sc1.AddListComponents(c1);
% Run the schematic and plot
out1 = sc1.Run([1 2 3]);
plot(out1(1,:),out1(2,:),out1(1,:),out1(3,:));
```
%% Output
%% Cell type:markdown id:0e75d661-7134-41c8-8d18-b9476f0156b8 tags:
<p>Wir können die Übertragungsfunktion des geschlossenen Regelkreises auch analytisch überprüfen</p>
%% Cell type:code id:1a716cbf-5658-4b12-8e82-7cfa759aa937 tags:
``` octave
Gl = Grz*Gz;
Gcl = Gl/(1+Gl);
Gcl = minreal(Gcl)
```
%% Output
Transfer function 'Gcl' from input 'u1' to output ...
1
y1: ---
z^2
Sampling time: 5 s
Discrete-time model.
%% Cell type:code id:64727330-a47f-4e7c-a202-4a3283c9a552 tags:
``` octave
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment