24
EP 314 LAB 4 – Introduction to MATLAB Open Loop Analysis

computer lab for pdc( chemical engineering)

Embed Size (px)

DESCRIPTION

PDC

Citation preview

  • EP 314LAB 4 Introduction to MATLAB

    Open Loop Analysis

  • EP314 Lab Timeline

    LAB 1 & 2 -Introduction to MATLAB

    Interface, code, function, graph, Simulink, etc.

    LAB 3, 4 & 5 - Modelling of Chemical Process

    ODE, Transfer Function, Open Loop Analysis, Sensitivity analysis, etc.

    LAB 6 ,7,8 & 9 - Closed Loop and Controller Design

    Block diagram, controller design, Performance Analysis, Criteria of Good controller, Stability Analysis, etc.

    NO LAB

    LAB 10 - Advanced Control System

    Feedforward, Cascade and Ratio controls.

    we

    ek

    2 3 4 5 6 7 8 9 10 11 12

  • =

    1

    + 1

    Q1. Illustrate the y(s) profile if unity input step is applied for u.

  • =

    1

    2 + + 1

    Q2. Illustrate the y(s) profile if unity input step is applied for u.

  • 1 =

    1

    + 1;

    Q3. Illustrate the y(s) profile if unity input step is applied for u.

    1

    =

    0.5

    0.5 + 1

  • 1 =

    1

    + 1;

    Q3. Illustrate the y(s) profile if unity input step is applied for u.

    1

    =

    0.5

    0.5 + 1

    %Create NEW m-file and run the code as follows;

    %Transfer Fcn1

    Kp1 = 0.5;

    Tau1 = 0.5;

    %Transfer Fcn2

    Kp2 = 1;

    Tau2 = 1;

    sim('exq3',10)

    plot(t,y)

    Save Simulink model as: exq3.mdl

    Alternative Solution

  • 1

    =

    1

    2 + 0.7 + 1;

    Challenge: Illustrate and compare the y1, y2 and y3 profiles if unity input step is applied for u.

    2

    =

    1

    2 + 2 + 1;

    3

    =

    1

    2 + 3 + 1

  • Contents:

    1. Block Diagram

    2. Transfer Function

  • Case Study 1: Two-Tank Liquid System

    =2

    1

    Find transfer function, G(s):

  • 1

    = 1

    111 +

    1

    11

    Laplace Transformation for Tank 1

    Step 2: Take Laplace transform on both sides

    {1

    } = {1

    111 +

    1

    11}

    11 + 1

    111() =

    1

    11()

    Step 1: Take deviation from steady state

    1

    = 1

    111 +

    1

    11

    Step 3: Rearranges to standard form

    Solution Case Study No. 1

    1

    1()=

    111 + 1

  • Laplace Transformation for Tank 2

    Step 2: Take Laplace transform on both sides

    {2

    } = {1

    121

    1

    222}

    Step 1: Take deviation from steady state

    Step 3: Rearranges to standard form

    Solution Case Study No. 1

    2

    =1

    121 +

    1

    22

    1

    222

    2

    =1

    121

    1

    222; 2

    22 + 1

    222() =

    1

    121()

    2

    1()=

    2/122 + 1

  • 1 =1

    1()=

    111 + 1

    2 =2

    1()=

    2/122 + 1

    1 2 1 1 2

    TF Tank 1 TF Tank 2

    Overall Transfer function

    Transfer function for tank 1

    Transfer function for tank 2

    By applying chain rule, the TF for G(s) can be written as:

    =2

    1()=

    1(11 + 1)

    2/1(22 + 1) final answer

    Solution Case Study No. 1

  • MATLAB/Simulink Block Diagram

    Solution Case Study No. 1

    %Create NEW m-file and run

    the code as follows:

    U1 = 1; U2 = 0; R1 = 0.5;

    R2 = 2/3; A1 = 1; A2 = 0.5;

    sim('casestudy1',5)

    plot(t,h1,'b',t,h2,'r')

    casestudy1.mdl

  • Solution Case Study No. 1

  • Case Study 2: Two-Tank Liquid System

    =2

    1

    Find transfer function, G(s):

    1 =1 21

    3 =22

    1 = ( 1)

  • 1

    = 1 211

    +1

    11

    Laplace Transformation for Tank 1

    Step 2: Take Laplace transform on both sides

    {1

    } = {2 111

    +1

    11}

    11 + 1

    111 =

    1

    112 +

    1

    11

    Step 1: Take deviation from steady state

    1

    = 1 211

    +1

    11

    Step 3: Rearranges to standard form

    Solution Case Study No. 2

    1 =1

    11 + 12 +

    111 + 1

    1

  • Laplace Transformation for Tank 2

    Step 2: Take Laplace transform on both sides

    Step 1: Take deviation from steady state

    Step 3: Rearranges to standard form

    Solution Case Study No. 2

    2

    =1 212

    2

    22

    2

    1()=

    /

    1 + 1

    2

    =1 212

    222

    {2

    } = {112

    212

    222

    } 2 =112

    1

    11+

    1

    222()

    2

    1 =

    +

    =1

    12; =

    1

    11+

    1

    22

  • Overall Transfer function

    Transfer function for tank 1

    Transfer function for tank 2

    By applying chain rule, the TF for G(s) can be written as:

    Solution Case Study No. 2

    1 =1

    11 + 12 +

    111 + 1

    1

    2

    1()=

    /

    1 + 1

    1 = 1 2 + 1 11

    2 = 2()1()

    11

    2 1

    1

    2

    TF Tank 1

    1 2

    +

    +

    TF Tank 1

    TF Tank 2

    2 = 2 1 2 + 1 11

    2 = 1 2 2 + 1 2 11

    (1 1 2 )2 = 1 2 11

    2

    1()=

    1 2 11 1 2

    2 = 2()1()

    Answer:

  • MATLAB/Simulink Block Diagram

    Solution Case Study No. 2

    %Create NEW m-file and run the

    code as follows:

    U1 = 1; R1 = 2; R2 = 2; A1 = 1;

    A2 = 1;

    %G1

    num1 = [1];

    den1 = [R1*A1 1];

    %G2

    alpha = [1/(R1*A2)];

    betta = 1/(R1*A1) + 1/(A2*R2);

    num2 = alpha/betta;

    den2 = [1/betta 1];

    sim('casestudy2',35)

    subplot(2,1,1)

    plot(t,H1,'b'),hold on

    plot(t,H2,'r'),hold off,grid

    legend('H1','H2')

    subplot(2,1,2)

    plot(t,U1),grid

    casestudy2.mdl

  • Sample on block diagram setting

  • LAB 4 (Group 1): Multiple Tanks Process

    1 2

    3

    Given;

    1 0 = 2 0 = 3 0 = 0

    1 =(12)

    1; 2 =

    2

    2; 3 =

    3

    3

    = 0.5 1

    Q1. Illustrate profile for H1, H2 and H3.

  • LAB 4 (Group 2) : Multiple Tanks Process

    1

    2 3

    Given;

    1 0 = 2 0 = 3 0 = 0

    1 =1

    1; 2 =

    23

    2; 3 =

    3

    3

    = 1.5 2

    Q1. Illustrate profile for H1, H2 and H3.

  • Individual Assignment (5%)Due: 1 week (From 1 June to 8 June, 2015 5:00PM)

    Method: Printed report

    RubricIn the report: 1 2 3 4 5

    Show Transfer Function derivation

    NO transfer function OR Wrong Transfer function

    Only Overall Transfer Function

    Complete derivation with appropriate step and order

    Show FigureNO Figure OR Wrong Figure

    Only H1, H2 and H3 profile

    Complete with labels, lagend, all signals shown in good representation

    MATLAB/Simulink code

    NO Code OR Similar code

    Only Simulink Code

    Provided mfile code with simulink diagram. The signals are labeled at every line and mfile is written in good order

    Description NO descriptionDescribe in moderate manner

    Describe the observation of the height profiles in concise manner