control system i

12

Upload: khawar-riaz

Post on 15-Apr-2016

217 views

Category:

Documents


1 download

DESCRIPTION

LDbkdbaksdb

TRANSCRIPT

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 1

The following exercises are supposed to be solved with MATLAB. Students who do nothave their own license of the software may use of the computers in the Retina Pool.If youdo not have a Retina account yet obtain one at the following link:

http://www.retina.e-technik.tu-dortmund.de/cms/de/Account/index.html

Hint: visit http://www.mathworks.de/products/matlab/examples.html to watch onlinedemos from di�erent MATLAB functions.

Reminder: all MANDATORY exercises have to be completed and PRESENTED duringthe class. It is your obligation to notify the teaching assistant once you completed thecode and to present it to him. The code has to shown during the class, later submissionsby email or in person are not accepted.

The Control System Toolbox provides algorithms and tools for the systematic analysis,design and tuning of linear control systems. It accepts models of linear time invariantsystems in terms of

� transfer functions

� state-space models

� pole-zero-gain models,

� frequency-response models

There are interactive tools and command-line functions for the visualization in both ti-me and frequency domains. You can tune compensator parameters using automatic PIDcontroller tuning, Bode loop shaping, root locus method, LQR/LQG design, and otherinteractive and automated techniques. You can validate your design by verifying rise time,overshoot, settling time, gain and phase margins, and other requirements.

It is assumed that you have a profound background in system theory, in particular know-ledge about representations of linear time invariant systems, feedback control design andanalysis in the time and frequency domain. This background knowledge is provided in thecourse control theory of the program.

Exercise 1 :

Representations of LTI systems

Linear time-invariant system is a branch of applied mathematics and provides the ma-thematical foundation for engineering applications such as signal processing and controlsystem design. It investigates the response of a linear and time-invariant system to anarbitrary input signal. Examples of LTI systems are electrical circuits composed of resis-tors, capacitors, and inductors or mechanical systems composed of inertia/mass, damping(friction) and springs.

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 2

The superposition principle (linearity property) means that the relationship between theinput and the output of the system is a linear map. If input x1(t), generates the responsey1(t), and input x2(t) generates y2(t) then the scaled and summed input a1x1(t)+a2x2(t),produces the scaled and summed response a1y1(t) + a2y2(t).

Time invariance refers to the fact that an input applied to the system at T = 0 or at alater instance T = ∆T produces the identical output merely delayed by ∆T . That is, ifthe output due to input x(t) is y(t), then the output due to input x(t− T ) is y(t− T ). Inother words the output does not depend on the particular time the input is applied.

Any LTI system is characterized completely by the systems impulse response. The outputof the system for an arbitrary input is obtained by the convolution of the input signal withthe systems impulse response. This type of analysis is denoted as the the time domainpoint-of-view. An LTI system can be analyzed in the frequency domain in terms of itstransfer function, which is the Laplace transform of the systems impulse response. Theoutput of the system in the frequency domain is given by the product of the transferfunction and the transform of the input. In other words, convolution in the time domainis equivalent to multiplication in the frequency domain.

The Control System Toolbox utilizes the following model representations in the time andfrequency domain for linear time invariant systems:

� state-space models

� transfer function

� zero pole gain models

� frequency response data models

State space models

A state-space representation models a dynamic system as a set of input, output and statevariables related by �rst-order di�erential equations. The term state space refers to thespace spanned by the state variables xi, merged into a state vector x = (x1, . . . , xn). Ifthe continuous dynamical system is linear, time-invariant, and �nite-dimensional, thenthe di�erential and algebraic equations that form the state space model may be writtenin matrix form:

x = Ax+Bu (1)

y = Cx+Du (2)

where the state matrix A, the input matrix B, the output matrix C, and the feedthroughD are matrices of appropriate dimensions, x is the state vector, and u and y are the input

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 3

Bild 1: State space model : http://commons.wikimedia.org/wiki/File:Typical_

State_Space_model.png

and output vectors. The �gure 1 shows the block diagram representation of the underlyinglinear state space di�erential and algebraic equations.

In case of SISO (single input, single output) systems the state space model becomes

x = Ax+ bu (3)

y = c′x+ du (4)

where A is the n× n-system matrix, b and c are n× 1 input and output vectors and d isa scalar. In the remainder of this tutorial we only consider SISO systems.

The following commands will be used in the next sections:

� ss: creates a state-space model, or converts other dynamic system models to state-space model: sys = ss(a,b,c,d) where a,b,c,d are the system, input, output andthe feed-through scalars respectively.

� step: generates the step response of a dynamic system. For the state space case,zero initial state is assumed. When it is invoked with no output arguments, stepplots the step response on the screen.

� lsim: simulates the (time) response of continuous or discrete linear systems to arbi-trary inputs. When invoked without left-hand arguments, lsim plots the responseon the screen.lsim(sys,u,t) produces a plot of the time response of the dynamic system modelsys to the input time history t,u. The vector t speci�es the N time samples forthe simulation. The vector u is NxM , where M is the number of system inputs.lsim(sys,u,t,x0) further speci�es an initial condition x0 for the system states.

� gensig: generates customized input signals for the system. it supports the signalforms sine wave ('sin'), square wave ('square') and periodic pulse ('pulse').

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 4

[u,t]=gensig(type,tau,Tf,Ts)

here, Tf:time duration of the signal, Ts: the spacing between the time samples t.

� linearSystemAnalyzer: linearSystemAnalyzer(sys1): interactive user interfacefor analyzing the time and frequency responses of linear systems and comparingsuch systems. The app linearSystemAnalyzer replaces the GUI ltiview in olderversions of Matlab.

1) mandatory: Generate a state space model for a �rst order linear system. A PT1element is a proportional transfer element with a �rst order delay described by thedi�erential equation.

T x+ x = Ku (5)

characterized by the static gain K and the delay time constant T . Transform theabove equation into state space form

x = ax+ bu (6)

y = x (7)

in that you compute a, b, c and d in 7 in terms of the parameters K and T fromEq. (5).

a b c d

Generate the corresponding LTI system syspt1 for the speci�c parameters K = 1and T = 2.

2) mandatory: Use linearSystemAnalyzer to analyze the LTI system syspt1 andplot its step response, impulse response and bode diagram.

3) mandatory: The step response of a system in a given initial state consists of thetime evolution of its outputs when its control inputs are Heaviside (unit) step functi-ons. In control theory, step response is the time behavior of the outputs of a generalsystem when its inputs change from zero to one in a very short time.Plot the step response of syspt1 from the command line with step.

4) mandatory: Generate an LTI system syspt2 for the second order state space modelde�ned by

A =

(−1 −21 −1

)(8)

b =

(10

)(9)

c = (0 1) (10)

d = 0 (11)

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 5

5) mandatory: Stability and natural response characteristics of a continuous-timeLTI system can be analyzed from the eigenvalues of the matrix A. The characteristicpolynomial is obtained from the determinant of the matrix sI−A. The poles coincidewith the eigenvalues of the matrix A and their location in the left or right halfcomplex plane determines whether the system is unstable, asymptotically stable ormarginally stable.Compute the eigenvalues si of the system matrix A.

s1 s2

What can you infer about the stability of the system?

6) mandatory: Plot the step response of the second order LTI system syspt2.

7) mandatory: Plot the system response for the LTI system syspt2 over the intervalt ∈ [0, 10] with a sample rate ∆t = 0.1 for the following initial states and inputsignals.

� x0 =

(10

), u(t) = 0 (eigen motion)

� x0 =

(00

), u(t) = sin(t)

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 6

Transfer functions and Zero-Pole-Gain models

A transfer function represents the relation between the input and output of a linear time-invariant system with zero initial conditions and zero-point equilibrium. For continuous-time input signals x(t) and output y(t), the transfer function H(s) is the linear mappingof the Laplace transform of the input, X(s) = L{x(t)}, to the Laplace transform of theoutput Y (s) = L{y(t)}:

Y (s) = H(s)X(s) (12)

or

H(s) =Y (s)

X(s)=L{y(t)}L{x(t)}

(13)

where the Laplace transform of x(t) is

X(s) = L{x(t)} =

∫ +∞

−∞x(t)e−stdt (14)

A transfer function is de�ned by the nominator and denominator polynomial, where theroots of the nominator correspond to the zeros of the LTI system and the roots of thedenominator to its poles. Example:

G(s) =s+ 2

s2 + s+ 10(15)

An alternative representation is the speci�cation in terms of zeros s0,i, poles sinf,i andstatic gain k.

G(s) = k(s− s0,1) . . . (s− s0,m)

(s− s∞,1) . . . (s− s∞,n)(16)

The above transfer function has a unit gain k = 1, a zero at s0,1 = −2 and two conjugatecomplex poles at sinf,{1,2} = −0.5± 3.12i with a zero pole gain representation

G(s) =(s− 2)

(s+ 0.5− 3.12i)(s+ 0.5 + 3.12i)(17)

The following commands will be used:

� tf : sys = tf(num,den) creates a continuous-time transfer function with numera-tor(s) and denominator(s) speci�ed by num and den. The coe�cients of the nume-rator and denominator polynomial are provided as a vector, e.g. the polynomials3 + 3s+ 2 is de�ned by the vector [1 3 2].

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 7

� zpk: sys = zpk(Z,P,K) creates a continuous-time zero-pole-gain (zpk) model syswith zeros Z, poles P, and gains K. SYS is an object of class @zpk.

8) mandatory: Generate an LTI system with the Matlab function tf for the secondorder SISO transfer function

G(s) =K

s2

ω20

+ 2ξω0s+ 1

(18)

with parameters K = 1, ξ = 0.25 and ω0 = 1.

9) mandatory: note: in case of transfer function models you can not provide an initialstate x0 for the simulation with lsim.Plot the system response for the LTI system over the interval t ∈ [0, 10] with asample rate ∆t = 0.1 for the input signals u(t) = cos(t)

10) mandatory:

- Convert the second order system described by the transfer function in Eq. (18)to a state space representation with ss.

- Denote the system matrix A, input vector b and output vector c.

Note: the state-space representation is better suited for numerical computations,such as simulation of the system, in particular it allows the speci�cation of an initi-al state x0.

11) mandatory: Convert the state space model in Eq. (11) into a zero-pole-gain repre-sentation with zpk. Denote the poles s∞,1, s∞,2.

s∞,1 = (19)

s∞,2 = (20)

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 8

Frequency response modelsFrequency response models (frd) store, manipulate, and analyze frequency response da-ta. An frd model stores a vector of frequency points with the corresponding complexfrequency response data you obtain either through simulations or experimentally.

� frd: sys = frd(R,Freqs) creates an frd model SYS with response data R speci�edat the frequency points in Freqs. The output sys is an object of class @frd.

� bode:bode(sys) creates a Bode plot of the frequency response of a dynamic systemmodel sys.

12) optional: the frequency response data in AnalyzerData.mat provided from Mat-lab. The variables freq and resp contain 256 test frequencies and the correspondingcomplex-valued frequency response points, respectively.Generate a frequency response model from the data with and generate its Bode plot

System identi�cation

System identi�cation uses statistical methods to estimate mathematical models of dyna-mical systems from experimental data. The purpose of system identi�cation is to generatemodels of dynamic systems which structure and/or parameters are di�cult to derive from�rst principles. Parameter identi�cation employs time-domain and/or frequency-domaininput-output data to identify transfer functions and state-space models.

The system identi�cation toolbox enables you to identify the parameters and structureof linear and nonlinear models from experimental data in the time or frequency domain.A complete coverage of the system identi�cation toolbox is beyond the scope of thisassignment.

The following commands will be utilized:

� ssest: sys = ssest(data,nx), estimates a state-space model using time or frequen-cy domain data.data is either an iddata object containing input and output signals in the timedomain or a frequency response model (frd) containing recorded frequency data.The optional parameter nx denotes the order of the state space model.

13) optional: Identify a third order state space model from the frequency responsemodel in the previous assignment with ssest.

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 9

14) optional: Generate the step response for the identi�ed model.

15) optional: Superimpose the Bode plot of the identi�ed model with the originalfrequency response of the frd model.

Model characteristics

The Control System Toolbox provides commands to query model characteristics such asthe I/O dimensions, poles, zeros, and DC gain. A pole zero plot is a graphical represen-tation of a rational transfer function in the complex plane which conveys fundamentalproperties of an LTI system such as stability, causal system / anticausal system, regionof convergence (ROC), minimum phase / non minimum phase.

16) mandatory: Determine the poles pole, zeros zero and static gain dcgain of theLTI system described by the transfer function

H(s) =4s+ 2

s2 + 5.5s+ 9(21)

.

17) mandatory: Plot the pole zero map of the system with pzmap.

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 10

Exercise 2 :

Interconnecting linear systems

You can perform arithmetics on LTI models, such as addition, multiplication or concate-nation. Addition performs a parallel interconnection in terms of superposition of parallelsignals, multiplication performs a serial interconnection in that the output of the �rst LTIbecomes the input to the second LTI.

The following command enable interconnections of LTI systems:

� series: sys = series(sys1,sys2), connects two model objects in series.

� parallel: sys = parallel(sys1,sys2), connects two model objects in parallel.

� feedback: sys = feedback(sys1,sys2), generates a model object sys for the ne-gative feedback interconnection of model objects sys1 and sys2.

For an open loop system with transfer function G(s) the closed-loop transfer function

with unit feedback becomes C(s) = G(s)1+G(s)

For an open loop system with transfer function G(s) the closed-loop transfer function

with unit feedback transfer function H(s) becomes C(s) = G(s)1+G(s)H(s)

.

1) mandatory: Assume an integrator with the transfer function

G1(s) =1

s(1)

and a �rst order system with

G2(s) =s+ 1

s+ 2(2)

Compute the transfer function of the parallel and serial connection of the two sys-tems.

2) mandatory: Assume an integrator with the transfer function

G(s) =1

s(3)

Compute the closed-loop transfer function for unit feedback.

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 11

3) mandatory: Assume an integrator with the transfer function

G(s) =1

s(4)

Compute the closed-loop transfer function for a feedback transfer function

H(s) =s+ 1

s+ 2(5)

Exercise 3 :

Analyzing Models

The Control System Toolbox allows you to analyze the time- and frequency-domain re-sponses of one or more linear models using the LTI Viewer GUI. The LTI Viewer is a GUIfor viewing and manipulating the response plots of linear models. It displays the followingplot types for linear models:

� Step and impulse responses (step, impulse)

� Bode and Nyquist plots (bode, nyquist)

� Nichols plots (nichols)

� Singular values of the frequency response

� Pole/zero plots (pzmap)

� Response to a general input signal (lsim)

� Unforced response starting from given initial states (only for state-space models)(lsim)

The frequency response represents the response of a system to a stimulus. It is de�nedin terms of the magnitude and phase of the output signal as a function of the frequencyof the input signal. In other words, if the system is stimulated with a sinusoidal inputsignal the response of a linear system is a sinusoidal signal at that very same frequencybut with a modulated magnitude and phase relative to the stimulus. The magnitude ofthe frequency response is measured on a logarithmic scale in decibels (dB) and the phasemeasured in radians or degrees, versus the frequency in radians/sec or Hertz (Hz) of thestimulus. The frequency response is plotted either as:

� Bode (bode) : two separate plots of magnitude and phase versus input frequency

WiSe 2015/2016

Exercises fromScienti�c Pr.: Control System Toolbox I Page 12

� Nyquist (nyquist) : magnitude and phase are visualized in a single polar plot withfrequency as a parameter

� Nichols (nichols) : magnitude and phase are visualized in a single Cartesian plotwith frequency as a parameter

1) mandatory: Analyze the closed loop model of the second order system from theprevious assignment with the LTI viewer linearSystemAnalyzer.

G(s) =1

s2 + s+ 1(1)

Determine the following characteristic in the time domain by inspecting step re-sponse.

� overshoot O =

� settling time ts =

� rise time tr =

� steady state yinf =

Determine the following characteristics in the frequency domain by inspecting thebode diagram

� peak response Kpeak =

� phase margin φ =

� delay margin td =

What is the phase of the second order system for ω →∞?

2) mandatory: Convert the transfer function model

G(s) =1

s2 + s+ 1(2)

into state space form with ss.

The Matlab function lsim provides the same functionality regarding the simulationof LTI systems as the LTI viewer. lsim not only plots the signals but also returns theoutput signal y and the state signal x as arguments. With gensig you can generatecustomized input signals for the system.

� Analyze the response of the system to an initial displacement x0 = [0 2] foru = 0 using lsim for t ∈ [0 25].

� Analyze the response of the system for an initial state x0 = [0 0] and a sinewave signal of period τ = 5s (generate the signal with gensig) using lsim.

� Analyze the response of the system for an initial state x0 = [0 0] and a squaresignal with period τ = 2s (generate the signal with gensig) using lsim.