control systems lab 01

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

Upload: nalan-karunanayake

Post on 30-Sep-2015

25 views

Category:

Documents


0 download

DESCRIPTION

introduction to transfer functions

TRANSCRIPT

  • 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

  • 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:

  • 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

    22+9

    2. = 1

    2 + 1

    3. = 1

    ( 6)( 4)

  • 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.

  • 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:

    % =

    12 100

  • 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 + 2nS + 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

  • 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".

  • 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

  • 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)

  • 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

    22 + 16 + 21

    2. = 2

    32 + 4 + 6

    3. = 6

    2+8+ 6

  • 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.

  • 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

  • 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.

  • 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

  • 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?

  • 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 ast tends to

    infinity, and is defined as: