control system Lab 01-introduction to transfer functions

16
Nalan Karunanayake 16/03/2015 1 EC - Control Systems Laboratory 01 Transfer Functions Objective The main purpose of this lab session is to be familiar with characteristics of transfer functions using MATLAB software TASK 1 To construct a transfer function as bellow (System variable conversions) G(S) = 3(+7) 2 +2+2 In MATLAB command window, type (Assigning the numerator and denominator coefficient vectors) >> num = [3 21]; >> den = [1 2 2]; >> G = tf(num,den) OR >>s = tf(‘s’); >>G = ((3*s+21)/(s^2+2*s+2)) Try to obtain the following transfer functions: G(S) = 5(+2) (+1)( 2 +−6) G(S) = 2(s+3)(s+5) 2 (s+2)(s 2 +4) 2 Time response of a system

Transcript of control system Lab 01-introduction to transfer functions

Page 1: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 1

EC - Control Systems

Laboratory 01 – Transfer Functions

Objective

The main purpose of this lab session is to be familiar with characteristics of transfer functions using

MATLAB software

TASK 1

To construct a transfer function as bellow (System variable conversions)

G(S) = 3(𝑠+7)

𝑠2+2𝑠+2

In MATLAB command window, type

(Assigning the numerator and denominator coefficient vectors)

>> num = [3 21];

>> den = [1 2 2];

>> G = tf(num,den)

OR

>>s = tf(‘s’);

>>G = ((3*s+21)/(s^2+2*s+2))

Try to obtain the following transfer functions:

G(S) = 5(𝑠+2)

(𝑠+1)(𝑠2+𝑠−6)

G(S) = 2(s+3)(s+5)2

(s+2)(s2+4)2

Time response of a system

Page 2: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 2

The time response represents how the state of a dynamic system changes in time when subjected to a

particular input. The time response of a linear dynamic system consists of the sum of the transient

response which depends on the initial conditions and the steady-state response which depends on the

system input.

Frequency response of a system

In linear time invariant (LTI) systems have the extremely important property that if the input to the

system is sinusoidal, then the steady-state output will also be sinusoidal at the same frequency but in

general with different magnitude and phase. These magnitude and phase differences as a function of

frequency comprise the frequency response of the system.

The frequency response of a system can be found from the transfer function in the following way: create

a vector of frequencies (varying between zero or "DC" to infinity) and compute the value of the plant

transfer function at those frequencies. If 𝐺(𝑠) is the open-loop transfer function of a system and is the

frequency vector, we then plot 𝐺(𝑗𝜔) versus 𝜔. Since 𝐺(𝑗𝜔)is a complex number, we can plot both its

magnitude and phase (the Bode Plot) or its position in the complex plane (the Nyquist Diagram). Both

methods display the same information in different ways.

Stability of a system

The transfer function representation is especially useful when analyzing system stability. If all poles of

the transfer function (values of s at which the denominator equals zero) have negative real parts, then

the system is stable. If any pole has a positive real part, then the system is unstable. If we view the poles

on the complex s-plane, then all poles must be in the left half plane (LHP) to ensure stability. If any

pair of poles is on the imaginary axis, then the system is marginally stable and the system will oscillate.

The poles of a LTI system model can easily be found in MATLAB using the pole command.

>>s = tf(‘s’);

>>G = 1/(s^2 + 2*s + 5)

>>pole(G)

ans =

-1.0000 + 2.0000i

-1.0000 - 2.0000i

If we use pole-zero map using the pzmap command on MATLAB:

Page 3: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 3

>>pzmap(G)

Thus this system is stable since the real parts of the poles are both negative.

Exercise 1

Check the following transfer functions stability

1. 𝐺𝑠 = 1

𝑠2−2𝑠+9

2. 𝐺𝑠 = 1

𝑠2 + 1

3. 𝐺𝑠 = 1

(𝑠 − 6)(𝑠 − 4)

Page 4: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 4

System Order

The order of a dynamic system is the order of the highest derivative of its governing differential

equation. Equivalently, it is the highest power of s in the denominator of its transfer function.

First Order System

The first order system can take the general form

𝐺(𝑆) = 𝑏

(𝑠 + 𝑎)+

𝐾𝑑𝑐

(𝑡. 𝑠 + 1)

DC gain:𝑲𝒅𝒄 , is the ratio of the magnitude of the steady-state step response to the magnitude of the

step input. From the Final Value Theorem, for stable transfer functions the DC gain is the value of the

transfer function when s=0. For first order systems equal to 𝐾𝑑𝑐 = 𝑏

𝑎 .

Time constant t: is the time to reach 63% of the steady state value for a step input or to decrease to

37% of the initial value and 𝑡 = 1

𝑎 is found. It is special for the first order system only.

Rise Time (Tr): 𝑻𝒓 = 𝟐.𝟐

𝒂

Settling Time (Ts): 𝑻𝒔 = 𝟒

𝒂

The first order system has no overshooting but can be stable or not depending on the location of its pole.

The first order system has a single pole at -a. If the pole is on the negative real axis (LHP), then the

system is stable. If the pole is on the positive real axis (RHP), then the system is not stable. The zeros

of a first order system are the values of s which makes the numerator of the transfer function equal to

zero.

Page 5: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 5

Second Order System

Second order systems are commonly encountered in practice, and are the simplest type of dynamic

system to exhibit oscillations. In fact many real higher order systems are modeled as second order to

facilitate analysis.

The general form of second order system is:

𝐺(𝑠) = 𝑎

(𝑠2 + 𝑏𝑠 + 𝑐)=

𝐾𝑑𝑐 . 𝜔𝑛2

(𝑠2 + 2𝜀𝜉𝜔𝑛𝑠 + 𝜔𝑛2)

Natural frequency 𝝎𝒏 is the frequency of oscillation of the system without damping.

Damping Ratio

The damping ratio is a dimensionless quantity characterizing the energy losses in the system due to

such effects as viscous friction or electrical resistance.

𝝃 = 𝒃

𝟐𝝎𝒏

Poles and zeros

Note that the system has a pair of complex conjugate poles at:

𝑆 = −𝝃𝝎𝒏 ± 𝒋𝝎𝒏√𝟏 − 𝝃𝟐 = −𝝈 ± 𝒋𝝎

𝝎 : damped frequency of oscillation.

DC gain

The DC gain,𝐾𝑑𝑐 = 𝑎

𝑐 , again is the ratio of the magnitude of the steady-state step response to the

magnitude of the step input, and for stable systems it is the value of the transfer function when s = 0.

For second order systems

𝐾𝑑𝑐 = 𝑎

𝑐

Percent Overshoot

The percent overshoot is the percent by which a system exceeds its final steady-state value. For a second

order under damped system, the percent overshoot is diretly related to the damping ratio by the

following equation:

𝑂𝑆% = 𝑒−

𝜋𝜉

√1−𝜉2∗ 100

Page 6: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 6

Settling Time

The settling time, , is the time required for the system ouput to fall within a certain percentage of the

steady state value for a step input or equivalently to decrease to a certain percentage of the initial value

for an impulse input. For a second order, underdamped system, the settling time can be approximated

by the following equation:

𝑻𝒔 = 𝟒

𝝃𝝎𝒏=

𝟒

𝝈

Rise Time: 𝑻𝒓 = 𝟏 − 𝟎.𝟒𝟏𝟔𝟕𝝃 +𝟐.𝟗𝟏𝟕𝝃𝟐

𝝎𝒏

General Form of a Denominator: S2 + 2ςωnS + ωn2 (Second order system)

Then, S = -ςωn ± √(ςωn)2 − ωn2

∆ = (ςωn)2 − ωn2

Step time response:

If the input is step function then the output or the response is called step time response. The system can

be represented by a transfer function which has poles (values make the denominator equal to zero),

depending on these poles the step response divided into four cases:

1. Underdamped response:

In this case the response has an overshooting with a small oscillation which results from complex poles

in the transfer function of the system. i.e. ∆ < 0 or ς < 1

2. Critically response:

In this case the response has no overshooting and reaches the steady state value (final value) in the

fastest time. In other words it is the fastest response without overshooting and is resulted from the

existence of real & repeated poles in the transfer function of the system. i.e. ∆ = 0 or ς =1

3. Overdamped response:

In this case no overshooting will appear and reach the final value in a time larger than critically case.

This response is resulted from the existence of real & distinct poles in the transfer function of the system.

i.e. ∆ > 0 or ς > 1

Page 7: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 7

4. Undamped response:

In this case a large oscillation will appear at the output and will not reach a final value and this because

of the existence of imaginary poles in the transfer function of the system and the system in this case is

called "Marginally stable".

Page 8: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 8

MATLAB Work

Step and Impulse Responses of a Transfer Function

To get the step response of a transfer function: use,

1 . 𝐺𝑠 = 2

𝑠 + 3

>> G = tf ([2], [1 3])

>> step (G)

To obtain impulse response: use,

>> impulse (G)

stepinfo(sys): this command is used to Compute

step response characteristics.

For the following transfer functions we will find

the settling time, rise time, overshoot and steady

state error:

>> stepinfo(G)

Result

Page 9: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 9

Underdamped Response

𝐺𝑠 = 12

(𝑠2 + 2𝑠 + 9)

>> G = tf ([12], [1 2 9])

>> step (G)

>> figure, impulse (G)

>> stepinfo(G)

Critically – damped Response

𝐺𝑠 = 12

(𝑠2 + 6𝑠 + 9)

>> G = tf ([12], [1 6 9])

>> step (G)

>> figure, impulse (G)

>>stepinfo(G)

Over – damped Response

𝐺𝑠 = 15

(𝑠2 + 7𝑠 + 12)

>> G = tf ([15], [1 7 12])

>> step (G)

>> figure, impulse (G)

>>stepinfo(G)

Page 10: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 10

Undamped Response

𝐺𝑠 = 9

𝑠2 + 3

>> G = tf ([9], [1 0 3])

>> step (G)

>> figure, impulse (G)

>>stepinfo(G)

Exercise 2

Obtain the step response of the following transfer functions given below and find the step info using

MATLAB and calculations

1. 𝐺𝑠 = 21

2𝑠2 + 16𝑠 + 21

2. 𝐺𝑠 = 2

3𝑠2 + 4𝑠 + 6

3. 𝐺𝑠 = √6

𝑠2+8𝑠+ √6

Page 11: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 11

Step Response using Matlab Simulink

Starting Simulink

Simulink is started from the MATLAB command prompt by entering the following command:

>>Simulink

Alternatively, you can hit the Simulink button at the top of the MATLAB window as shown here

When it starts, Simulink brings up a single window, entitled Simulink Library Browser which can be

seen here.

Page 12: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 12

Then goto NewSimulink Model

Construct the following Simulink model using Simulink library components as follows

The simple model consists of three blocks: Step, Transfer Function, and Scope. The Step is

a Source block from which a step input signal originates. This signal is transferred through the line in

the direction indicated by the arrow to the Transfer Function Continuous block. The Transfer

Function block modifies its input signal and outputs a new signal on a line to the Scope. The Scope is

a Sink block used to display a signal much like an oscilloscope.

Modifying blocks

A block can be modified by double-clicking on it. For example, if you double-click on the Transfer

Function block in the Simple model, you will see the following dialog box.

Modify the transfer function block as follows

Page 13: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 13

Running simulation

To run the simulation hit the play button

The simulation should run very quickly and the scope window will appear as shown below.

Note that the simulation output (shown in yellow) is at a very low level relative to the axes of the scope.

To fix this, hit the auto scale button (binoculars), which will rescale the axes as shown below.

Page 14: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 14

Exercise 3

1. Obtain the step response of the following transfer functions using Simulink.

1. 𝐺𝑠 = 12

(𝑠2+6𝑠+9)

2. 𝐺𝑠 = 15

(𝑠2+7𝑠+12)

3. 𝐺𝑠 = 9

𝑠2+3

The effect of varying damping ratio on a second-order system

Page 15: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 15

Exercise 4

Review Questions

1. What is the different between steady state response and transient response of a control

system?

2. The pole-zero plot for the two transfer functions are given below, obtain their unit step

response and comment on it.

3. How damping ratio (zeta) affects the time response of a second order system?

Page 16: control system Lab 01-introduction to transfer functions

Nalan Karunanayake 16/03/2015 16

NOTE

What is time response?

It is an equation or a plot that describes the behavior of a system and contains much information about

it with respect to time response specification as overshooting setting time, peak time, rise time and

steady state error. Time response is formed by the transient response and the steady state response.

𝑻𝒊𝒎𝒆 𝒓𝒆𝒔𝒑𝒐𝒏𝒔𝒆 = 𝑻𝒓𝒂𝒏𝒔𝒊𝒆𝒏𝒕 𝒓𝒆𝒔𝒑𝒐𝒏𝒔𝒆 + 𝑺𝒕𝒆𝒂𝒅𝒚 𝒔𝒕𝒂𝒕𝒆 𝒓𝒆𝒔𝒑𝒐𝒏𝒔𝒆

Transient time response describes the behavior of the system in its first short time until arrives the

steady state value and this response will be our study focus.

If the input is step function then the output or the response is called step time response and if the input

is ramp, the response is called ramp time response … etc.

Delay Time (Td): is the time required for the response to reach 50% of the final value.

Rise Time (Tr): is the time required for the response to rise from 0 to 90% of the final value.

Settling Time (Ts): is the time required for the response to reach and stay within a specified tolerance

band (2% or 5%) of its final value.

Peak Time (Tp): is the time required for the underdamped step response to reach the peak of time

response (Yp) or the peak overshoot.

Percent Overshoot (OS%): is the normalized difference between the response peak value and the

steady value This characteristic is not found in a first order system and found in higher one for the

underdamped step response.

Steady State Error (ess): indicates the error between the actual output and desired output as‘t’ tends to

infinity, and is defined as: