SIMULINK Lineare und nichtlineare Systeme Dipl.-Ing. U. Wohlfarth
Inhalt SIMULINK Bibliothek Continuous Linearisierung, Ermittlung eines Gleichgewichtspunkts SIMULINK Bibliothek Nonlinear SIMULINK Bibliothek Functions&Tables Algebraische Schleifen S Funktionen Dipl.-Ing. U. Wohlfarth
SIMULINK Bibliothek Continuous Elemente zur Modellierung zeitkontinuierlicher Systeme Totzeiten 1 s Integrator x = Ax+Bu y = Cx+Du (s 1) s(s+1) Zero Pole Transport Delay du/dt State Space 1 Memory Derivative s+1 Transfer Fcn Variable Transport Delay Dipl.-Ing. U. Wohlfarth 1
Von der DGL zum Continuous Block Beispiel: Feder Masse Schwinger DGL: m ẍ(t) + k x(t) = 0 Lösung im Zeitbereich: x(t) = x 0 cos (ω 0 t) + v 0 ω 0 sin (ω 0 t) L 0 k Übergang in den Frequenzbereich: Übertragungsfunktion X(s) = 1 s 2 + ω 2 0 x m in SIMULINK: 0 Constant 1 s 2+2 Transfer Fcn (with initial outputs) Scope1 Dipl.-Ing. U. Wohlfarth 2
Beispiel zu Continuous Rücksetzen des Simulink Integrator-Blocks: 0.5 Constant 1 s xo Integrator 2 >= Relational Operator Scope Anfangswert Constant1 Dipl.-Ing. U. Wohlfarth 3
Linearisierung Linearisierung von Simulationsmodellen an beliebigem Arbeitspunkt Befehlsaufruf: [A,B,C,D] = linmod( sys, x, u, para, xpert, upert) [Ad,Bd,Cd,Dd] = dlinmod( sys, T s, x, u) Weitere Matlab Befehle aus der Control System Toolbox zur Analyse anwendbar (ss, tf, zpk, bode, lsim) Dipl.-Ing. U. Wohlfarth 4
Bestimmung eines Gleichgewichtspunkts Gleichgewichtspunkt entspricht dem eingeschwungenem Zustand des Systems, d.h. ẋ = 0 Befehlsaufruf: [x,u,y] = trim( sys, x0, u0, y0) weitere Optionen help trim Dipl.-Ing. U. Wohlfarth 5
SIMULINK Bibliothek Nonlinear Elemente zur Modellierung physikalischer Nichtlinearitäten Schalter Manual Switch Rate Limiter Quantizer Dead Zone Saturation Backlash Relay Coulomb & Viscous Friction Switch Multiport Switch Dipl.-Ing. U. Wohlfarth 6
Beispiele zu Nonlinear Beispiel zu Quantizer Clock f(u) (u(1) 5)^2 + 3 Quantizer Parabel quantisierte Parabel ausgabe To Workspace Beispiel zu Backlash Signal Generator 1 Constant u y Rate LimiterBacklash ausgabe To Workspace Dipl.-Ing. U. Wohlfarth 7
SIMULINK Bibliothek Functions&Tables Nachschlagetabellen programmierbare Funktionen Look Up Table Look Up Table (2 D) f(u) Fcn MATLAB Function MATLAB Fcn system S Function uvm. Dipl.-Ing. U. Wohlfarth 8
Beispiel zu Function&Tables Beispiel zu Look Up Table auslese Ramp Look Up Table To Workspace Dipl.-Ing. U. Wohlfarth 9
Algebraische Schleifen direct f eedthrough: Ausgang hängt vom Eingang zum gleichen Zeitpunkt ab u Sum y Blöcke mit direct f eedthrough: Sum, Gain, Product (State Space, Integrator, Transfer Function, Zero Pole) Lösung mit Algebraic Constraint: f(z) Solve f(z) = 0 Algebraic Constraint z Dipl.-Ing. U. Wohlfarth 10
Beispiel zu algebraischen Schleifen f(z) = 1 7 z3 1 28 sin z z 5 = 0 (1/7)* u^3 Fcn (1/28)* sin(u) Fcn1 f(z) Solve f(z) = 0 z z 3.9708653342418 5 Algebraic Constraint Display Constant z Sum Dipl.-Ing. U. Wohlfarth 11
S Funktionen selbst programmierbare Funktionen Ausführung innerhalb eines SIMULINK Modells durch S Function Block programmierbar in Matlab (M Files) C, C ++, Fortran, Ada (MEX Files) Einbringen bereits vorhandenen Programm Codes Dipl.-Ing. U. Wohlfarth 12
Beispiel zu S Funktionen P T 1 : Übertragungsfunktion: Y (s) = 1 1 + st U(s) oder Zustandsdarstellung: ẋ = 1 T x + 1 T u y = x Step pt1sfun S Function y To Workspace Dipl.-Ing. U. Wohlfarth 13
Beispiel zu S Funktionen function [sys,x0,str,ts] = pt1sfun(t,x,u,flag,t) A = [-1/T]; % Zustandsmatrix % Unexpected flags % B = [ 1/T]; % Eingangsmatrix otherwise % Fehlerbehandlung C = [ 1 ]; % Ausgangsmatrix error([ Unhandled flag =,num2str(flag)]); D = [ 0 ]; % Durchschaltmatrix=0 end switch flag, % end pt1sfun % Initialization % case 0, %===================== [sys,x0,str,ts]=mdlinitializesizes(a,b,c,d); % mdlinitializesizes %===================== % Derivatives % % case 1, function [sys,x0,str,ts]=... sys=mdlderivatives(t,x,u,a,b,c,d); mdlinitializesizes(a,b,c,d) % Outputs % sizes = simsizes; case 3, sys=mdloutputs(t,x,u,a,b,c,d); sizes.numcontstates = size(a,1); sizes.numdiscstates = 0; % Nicht verwendete Flags sizes.numoutputs = size(c,1); case {2, 4, 9}, sys=[]; sizes.numinputs = size(b,1); Dipl.-Ing. U. Wohlfarth 14
Beispiel zu S Funktionen sizes.dirfeedthrough = 0; sizes.numsampletimes = 1; sys = simsizes(sizes); %==================== % mdloutputs %==================== x0 = zeros(size(a,1),1); % function sys=mdloutputs(t,x,u,a,b,c,d) str = []; sys = C*x + D*u; ts = [0 0]; % end mdlinitializesizes % end mdloutputs %=================== % mdlderivatives %=================== % function sys=mdlderivatives(t,x,u,a,b,c,d) sys = A*x + B*u; % end mdlderivatives Dipl.-Ing. U. Wohlfarth 15