Post on 06-Apr-2015
Hochschule Harz FB Automatisierung und Informatik 1 - 29
Regelungstechnik I Anhang MP. Kußmann
Teil 1: Einführung Matlab/Simulink
Inhaltsübersicht
Einführung (Matlab)• Lizenzen, Versionen (Labor,- Übungsräume)• Programmstart, Orientierung• Variablen, Grundrechenoperationen• Transferfunktionen (am Beispiel PT1)• figure, step, bode,rlocus, nyquist
Einführung (Simulink)• Programstart, Orientierung• Bibliotheken (Step, Scope, Gain, Transferfunction, Summe)• Symbolauswahl, Formatierung, Parametrierung• Variablen, Funktionen von Matlab nach Simulink• Systembeispiel - PT1• Anzeigeoptimierung – Scope• Datenübernahme (Simulink – Matlab)
Paramerübergabe (Matlab-Simulink-Matlab)• Variablen von Simulink nach Matlab• Darstellung export.Simulink-Daten in Matlab
M-File
Initial Release: 19.April 2011
Hochschule Harz FB Automatisierung und Informatik 2 - 29
Regelungstechnik I Anhang MP. Kußmann
Lizenzen, Versionen (Labor,- Übungsräume)• RT - Labor (9.105)
- Classroom license (alle PC)- Version 7.5.0.342 (R2007b) – Stand: April 2011
• AI - Labor (5.203)- Classroom license (alle PC)- Version 6.5.0.18913a (R2002-13) – Stand: April 2011- Software in virtueller Maschine (Oracle VM Virtual Box/WinXP)
Programmstart, Orientierung• Programmstart
- Start/Alle Programme/R2007b/MATLAB R2007b (oder über Desktop)
- Ansicht „Default“ (in Matlab: Desktop/Desktop Layout/Default)
• Orientierung (siehe nächste Folie)- Current Directory- Workspace- Command History- Command Window
Teil 1a: Einführung Matlab
Hochschule Harz FB Automatisierung und Informatik 3 - 29
Regelungstechnik I Anhang MP. Kußmann
Orientierung• „Current Directory“, „Workspace“, „Command Window“, „Command History“
A B C D
A2
A1
C
D
B
Hochschule Harz FB Automatisierung und Informatik 4 - 29
Regelungstechnik I Anhang MP. Kußmann
Variablen, Grundrechenoperationen•Definition im „Command Window“ -> Variablen im Workspace
(10k
(10k
(1F
(10ms
Hochschule Harz FB Automatisierung und Informatik 5 - 29
Regelungstechnik I Anhang MP. Kußmann
Transferfunktionen (am Beispiel PT1)•Bisher aus Vorlesung bekannt:
Hinweis: für Berechnung relevante Übertragungsfunktion
Hochschule Harz FB Automatisierung und Informatik 6 - 29
Regelungstechnik I Anhang MP. Kußmann
Transferfunktionen (2)• Zerlegung der Übertragungsfunktion (Zähler = num / Nenner = den)
1pτ*1
1pτ*0
pτ1
1G(p)
B CA
CA
B
Hochschule Harz FB Automatisierung und Informatik 7 - 29
Regelungstechnik I Anhang MP. Kußmann
figure• figure('Name','PT1-Glied')• grid
A1
A
A2
Hochschule Harz FB Automatisierung und Informatik 8 - 29
Regelungstechnik I Anhang MP. Kußmann
step• step(sys)• grid
Hochschule Harz FB Automatisierung und Informatik 9 - 29
Regelungstechnik I Anhang MP. Kußmann
bode• bode(sys)• grid
Hochschule Harz FB Automatisierung und Informatik 10 - 29
Regelungstechnik I Anhang MP. Kußmann
rlocus• rlocus(sys)• grid
Hochschule Harz FB Automatisierung und Informatik 11 - 29
Regelungstechnik I Anhang MP. Kußmann
nyquist• nyquist(sys)• grid
Hochschule Harz FB Automatisierung und Informatik 12 - 29
Regelungstechnik I Anhang MP. Kußmann
Teil 1b: Einführung SimulinkProgramstart (aus Matlab)• simulink (oder Symbol)
Hochschule Harz FB Automatisierung und Informatik 13 - 29
Regelungstechnik I Anhang MP. Kußmann
Orientierung• Filemanager (A)• Bibliotheken (B)
A
B1
B2
Hochschule Harz FB Automatisierung und Informatik 14 - 29
Regelungstechnik I Anhang MP. Kußmann
Bibliotheken (eine Auswahl)• Step Simulink / Sources / Step
• Scope Simulink / Commonly Used Blocks / Scope
• Gain Simulink / Commonly Used Blocks / Gain
• Transferfunction Simulink / Continuous / Transfer Fcn
• Summe Simulink / Commonly Used Blocks / Sum(Hinweis: Pipe-Operator z.B. |++ , ++|, +|- , +-|-+ , etc.)
Hochschule Harz FB Automatisierung und Informatik 15 - 29
Regelungstechnik I Anhang MP. Kußmann
Symbolauswahl• File / new / Model neuer Model-Arbeitsbereich• Symbole aus Bibliothek per Drag&Drop in Model-Arbeitsbereich ziehen
Hochschule Harz FB Automatisierung und Informatik 16 - 29
Regelungstechnik I Anhang MP. Kußmann
Symbolformatierung• Symbole drehen Symbol im Model-Arbeitsbereich auswählen und „STRG+R“• Symbole verbinden „Ausgangspfeil >“ zum „Eingangspfeil >“ ziehen
Hochschule Harz FB Automatisierung und Informatik 17 - 29
Regelungstechnik I Anhang MP. Kußmann
Symbolparametrierung• Symbol im Model-Arbeitsbereich auswählen und „Doppelklick“
Hochschule Harz FB Automatisierung und Informatik 18 - 29
Regelungstechnik I Anhang MP. Kußmann
Symbolparametrierung (2)• Variante – I (numerische Parameter in Matlab-Notation)
Bsp.: [0.01 1]
• Variante – II (Übernahme Variablen aus Matlab)
Bsp.: [num]
Hochschule Harz FB Automatisierung und Informatik 19 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1• Eingangs-Parametrierung – step (Initial value, Final value, Step time)
Hochschule Harz FB Automatisierung und Informatik 20 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1 (2)• Start der Simulation (über Play-Button, Simulationszeit 10s)
Hochschule Harz FB Automatisierung und Informatik 21 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1 (3)• Ausgangs-Parametrierung – Scope (Doppelklick Scope)• Sprung bei t=1s erkennbar• PT1-Verhalten nicht erkennbar
• Anpassen der Simulationszeit (2s) -> neu Simulieren
Hochschule Harz FB Automatisierung und Informatik 22 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1 (3a)• Ausgangs-Parametrierung – Autoscale
• Ausgangs-Parametrierung – Zoom
• Neues Problem Interpolation bei Abtastung
Hochschule Harz FB Automatisierung und Informatik 23 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1 (4)• Anpassung – Abtastzeit (in aktivem Simulink-Model -> Simulation / Configuration Parameters / Solver)• Max step size auf typische Werte ändern z.B. 1e-3, 1e-6, etc.
Hochschule Harz FB Automatisierung und Informatik 24 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1 (4a)• neu Simulieren
• Ergebnis: leeres Scope (Wertebereich überschritten)
A1
B1
B2
C1
A2
C2
Hochschule Harz FB Automatisierung und Informatik 25 - 29
Regelungstechnik I Anhang MP. Kußmann
Systembeispiel - PT1 (4a)• Anpassung Wertebereich Scope (Deaktivierung im Scope: Parameters / Data history / Limit datapoints to last 5000)
• Ergebis: Scope mit Werten(im Zoom keine Interpolationen)
Gegenüberstellung (Interpolation) Sichtbar / nicht sichtbar
A
B
A1
Hochschule Harz FB Automatisierung und Informatik 26 - 29
Regelungstechnik I Anhang MP. Kußmann
Datenübernahme (Simulink – Matlab)• Problem: Screenshot Scope (für Dokumentationen) schwarzer Hintergrund• im Scope: Parameters / Data history / Save data to Workspace (von Matlab))• neu Simulieren !!!
• Ergebnis (Matlab): Variable 2000004 Werten in 2 Vektoren
• Hinweise: - 10^6 Abtastungen pro Sekunde - 2s – Simulationszeit - 2 Start- und 2 End-Werte
Hochschule Harz FB Automatisierung und Informatik 27 - 29
Regelungstechnik I Anhang MP. Kußmann
Datenübernahme (Simulink – Matlab) (2)• Doppelklick auf Variable „SprungantwortPT1“ Array Editor
Hochschule Harz FB Automatisierung und Informatik 28 - 29
Regelungstechnik I Anhang MP. Kußmann
Darstellung export.Simulink-Daten in Matlab• figure('Name','PT1-Simulink-Export') • plot(SprungantwortPT1(1:2000004,1),SprungantwortPT1(1:2000004,2));grid
Hinweis: Notation ––> „Startwert 1 “ : „Endwert 2000004 “ , „Spalte 1“
AB
A1 B1
B2
Hochschule Harz FB Automatisierung und Informatik 29 - 29
Regelungstechnik I Anhang MP. Kußmann
M-File• in Matlab: File/new/M-File