mechanical 431 project

Upload: subramanian-chidambaram

Post on 03-Jun-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Mechanical 431 Project

    1/17

    Using Simulink to analyze two degrees of freedom system

    Nasser M. Abbasi, Spring 2009

    Abstract

    A two degrees of freedom system consisting of two masses connected by springs and subject to

    3 different type of input forces is analyzed and simulated using Simulink

    Contents

    1 Introduction and Theory 1

    2 Analytical solution 3

    2.1 Finding the homogenous solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Finding particular solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    2.2.1 Finding the particular solution for unit impulse input . . . . . . . . . . . . . . 62.2.2 Finding the particular solution for unit step input . . . . . . . . . . . . . . . . 62.2.3 Finding the particular solution forsin t . . . . . . . . . . . . . . . . . . . . . . 7

    3 Simulink simulation and block diagrams 8

    3.1 Unit step simulink diagram and output . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1.1 Verification of result from Simulink by Numerically solving the differential equations 10

    4 Unit impulse simulink diagram and output 12

    4.0.2 Verification of result from Simulink by Numerically solving the differential equations 124.1 sin(t)input simulink diagram and output . . . . . . . . . . . . . . . . . . . . . . . . 15

    5 Discussion 17

    1 Introduction and Theory

    The system that is being analyzed is show in the following diagram

    1

  • 8/12/2019 Mechanical 431 Project

    2/17

    In the above, F(t)is to be taken as each of the following

    1. Unit impulse force.

    2. Unit step force.

    3. sin t

    It is required to findx1(t)and x2(t)analytically and then to use Matlabs Simulink software for theanalysis.

    The mathematical model of the system is first developed and the equation of motions obtained usingLagrangian formulation then the analytical solution is found by solving the resulting coupled secondorder differential equations for m1 and m2. Next, a simulink model is developed to implement thedifferential equations and the output x1(t) and x2(t) from Simulink is shown and compared to the

    output from the analytical solution.

    2

  • 8/12/2019 Mechanical 431 Project

    3/17

    2 Analytical solution

    The following is the free body diagram of the above system

    Assuming positive is downwards and that x2 > x1, force-balance equations for m1 results in

    m1x1= F(t) + k1(x2 x1)

    And force-balance equations for m2 results in

    m2x2 = k1(x2 x1) k2x2

    Hence the EQM for the system become

    m1x1

    k1x2+ k1x1= F(t)m2x2+ (k1+ k2) x2 k1x1= 0

    Or in matrix form m1 00 m2

    x1x2

    +

    k1 k1k1 (k1+ k2)

    x1x2

    =

    F(t)

    0

    The above can be written in matrix form as

    Mx + Kx= F

    3

  • 8/12/2019 Mechanical 431 Project

    4/17

    Where x,x,F are 2 by 1 vectors and M and K are the mass and stiffness matrices. The solution tothe above is

    x= xh+ xp (1)

    2.1 Finding the homogenous solution

    We start by finding xh from the followingm1 00 m2

    x1x2

    +

    k1 k1k1 (k1+ k2)

    x1x2

    =

    00

    Now assume x1(t) =A1cos (t + )and x2(t) =A2cos (t + ), hence x1(t) = A1sin (t + )andx2(t) = A2sin (t + )and x1(t) =

    2A1cos (t + )and x2(t) = 2A2cos (t + ). Substitut-

    ing the above values in the above system results in

    m1 00 m2

    2A1cos (t + )2A2cos (t + )

    +

    k1 k1k1 (k1+ k2)

    A1cos (t + )A2cos (t + )

    =

    00

    Divide bycos (t + )since not zero (else no solution exist) we obtainm1 00 m2

    2A12A2

    +

    k1 k1k1 (k1+ k2)

    A1A2

    =

    00

    Rewrite the above as 2m1A12m2A2

    +

    k1A1 k1A2

    k1A1+ (k1+ k2) A2

    =

    00

    2m1A1+ k1A1 k1A22m2A2 k1A1+ (k1+ k2) A2

    =

    00

    (2m1+ k1) A1 k1A2

    2m2A2+ (k1+ k2) A2 k1A1

    =

    00

    2m1+ k1 k1

    k1 2m2+ (k1+ k2)

    A1A2

    =

    00

    (2)

    From the last equation above, we see that to obtain a solution we must have

    2m1+ k1 k1k1

    2m2+ (k1+ k2)

    = 0

    since if we had

    A1A2

    = 0 then no solution will exist. Therefore, taking the determinant and setting it

    to zero results in

    2m1+ k1

    2m2+ (k1+ k2)

    k21 = 0

    k21+ k1k2 2k1m1

    2k1m2 2k2m1+

    4m1m2 k21 = 0

    4m1m2+ 2 (k1m1 k2m1 k1m2) +

    k21+ k1k2 k

    21

    = 0

    4

  • 8/12/2019 Mechanical 431 Project

    5/17

    Let 4 =2, hence the above becomes

    2m1m2+ (k1m1 k2m1 k1m2) +

    k21+ k1k2 k21

    = 0

    Solving for gives

    1 = 12m1m2 k1m1+ k1m2+ k2m1+ k21m21+ k21m22+ k22m21+ 2k1k2m21+ 2k21m1m2 2k1k2m1m2

    2= 12m1m2

    k1m1+ k1m2+ k2m1

    k21m

    21+ k

    21m

    22+ k

    22m

    21+ 2k1k2m

    21+ 2k

    21m1m2 2k1k2m1m2

    (3)

    For each of the above solutions, we obtain a different

    A1A2

    from equation (2) as follows

    For 1, (2) becomes 1m1+ k1 k1

    k1 1m2+ (k1+ k2)

    A1A2

    =

    00

    (1m1+ k1) A1 k1A2

    k1A1

    1m2A2+ (k1+ k2) A2=

    0

    0

    From the first equation above, we have

    (1m1+ k1) A1 k1A2 = 0

    1m1+ k1k1

    =

    A2

    A1

    (1)

    Similarly for 2,2m1+ k1

    k1=

    A2

    A1

    (2)

    Let

    r1 =1m1+ k1

    k1=

    A2

    A1

    (1)(4)

    r2 =2m1+ k1

    k1=

    A2

    A1

    (2)

    Hence now xh can be written asx1x2

    h

    =

    A

    (1)1 cos(1t + 1) + A

    (2)1 cos(2t + 2)

    A(1)2 cos(1t + 1) + A

    (2)2 cos(2t + 2)

    But A(1)2 =r1A

    (1)1 and A

    (2)2 =r2A

    (2)1 , hence the above becomes

    x1x2

    h

    =

    A

    (1)1 cos(1t + 1) + A

    (2)1 cos(2t + 2)

    r1A(1)1 cos(1t + 1) + r2A

    (2)1 cos(2t + 2)

    (5)

    Now, given numerical values fork1, k2, m1, m2we can find1, 2from (3) above, and next find r1, r2from

    (4). Hence (5) contains 4 unknowns, A(1)1 , A

    (2)1 , 1, 2 which now can be found from initial conditions

    (after we find the particular solution) which we will now proceed to do.

    5

  • 8/12/2019 Mechanical 431 Project

    6/17

    2.2 Finding particular solutions

    There are 3 different F(t)which we are asked to consider

    1. Unit impulse force.

    2. Unit step force.

    3. sin t

    For each of the above, we find xp and then add it to xh found above in (5) to obtain (1).

    2.2.1 Finding the particular solution for unit impulse input

    Using the standard response for a unit impulse which for a single degree of freedom system is x (t) =1

    mnsin nt, then we write xp as

    xp=

    x1x2

    p

    =

    1m1

    sin 1t + 1m2

    sin 2t

    0

    Hence, the general solution becomesx1x2

    =

    A

    (1)1 cos(1t + 1) + A

    (2)1 cos(2t + 2)

    r1A(1)1 cos(1t + 1) + r2A

    (2)1 cos(2t + 2)

    +

    1m1

    sin 1t + 1m2

    sin 2t

    0

    (6)

    2.2.2 Finding the particular solution for unit step input

    Since unit step is1for t >0, then, using convolution we write

    xp(t) = t0

    f() h (t ) d

    = t0

    h (t

    ) d

    = t0

    1

    mnsin n(t ) d

    = 1

    mn

    cos(n(t ))

    n

    t0

    = 1

    m2n[cos(n(t ))]

    t

    0

    = 1

    m2n[1 cos(nt)]

    Then, since now we have 2 natural frequencies, we can write xp as

    xp=

    x1x2

    p

    =

    1m2

    1

    [1 cos(1t)] + 1m2

    2

    [1 cos(2t)]

    0

    Hence, the general solution becomesx1x2

    =

    A

    (1)1 cos(1t + 1) + A

    (2)1 cos(2t + 2)

    r1A(1)1 cos(1t + 1) + r2A

    (2)1 cos(2t + 2)

    +

    1m2

    1

    [1 cos(1t)] + 1m2

    2

    [1 cos(2t)]

    0

    6

  • 8/12/2019 Mechanical 431 Project

    7/17

    2.2.3 Finding the particular solution forsin t

    In this case, we guess that x1p= c1cos t + c2sin t, and since there is no forcing function being applieddirectly on m2 then x2p= 0hence

    xp=

    x1(t)x2(t)

    p

    =

    c1cos t + c2sin t

    0

    Then x1p(t) =c1sin t+c2cos t and x1p(t) =2c1cos t+

    2c2sin t and now we substitutethese into the original ODE for x1 which is

    m1x1 k1x2+ k1x1= F(t)

    m1x1p k1x2p+ k1x1p= sin t

    We obtain the following

    m12c1cos t +

    2c2sin t k1(0) + k1(c1cos t + c2sin t) = sin t

    cos t 2c1

    m1+ k

    1c1+ sin t m

    12c

    2+ k

    1c2= sin t

    Hence by comparing coefficients, we obtain

    2c1m1+ k1c1 = 0

    m12c2+ k1c2 = 1

    or

    c12m1+ k1

    = 0

    c2 m12 + k1= 1

    c1 must be zero since k1 2m1 = 0 only when = n and we assume that this is not the case here.

    Hence

    c1 = 0

    c2 = 1

    (m12 + k1)

    Therefore xp becomes

    xp=

    x1(t)x2(t)

    p

    =

    1

    (m12+k1)sin t

    0

    And the general solution becomes

    x1x2

    =

    A

    (1)1 cos(1t + 1) + A

    (2)1 cos(2t + 2)

    r1A(1)1 cos(1t + 1) + r2A

    (2)1 cos(2t + 2)

    +

    1

    (m12+k1)sin t

    0

    (8)

    7

  • 8/12/2019 Mechanical 431 Project

    8/17

    3 Simulink simulation and block diagrams

    In simulink, we will directly solve the system from the original formulation

    m1x1 k1x2+ k1x1= F(t)

    m2x2+ (k1+ k2) x2 k1x1= 0

    or

    x1 k1

    m1x2+

    k1

    m1x1 =

    F(t)

    m1

    x2+(k1+ k2)

    m2x2

    k1

    m2x1 = 0

    Hence

    x1=F(t)

    m1+

    k1

    m1x2

    k1

    m1x1

    x2=

    (k1+ k2)m2

    x2+ k1m2

    x1

    8

  • 8/12/2019 Mechanical 431 Project

    9/17

    3.1 Unit step simulink diagram and output

    The simulink block diagram will be as follows for the unit step input

    For an initial run with parameters m1= m2 = k1= k2= 1I get this warning below

    EDU>> simulink

    Warning: Using a default value of 0.2 for maximum step size. The simulation

    step size will be equal to or less than this value. You can disable this

    diagnostic by setting Automatic solver parameter selection diagnostic to

    none in the Diagnostics page of the configuration parameters dialog.

    And this is the output for x1(t)and x2(t)for the unit step response

    9

  • 8/12/2019 Mechanical 431 Project

    10/17

    3.1.1 Verification of result from Simulink by Numerically solving the differential equa-

    tions

    To verify the above output from Simulink, I solved the same coupled differential equations for zeroinitial conditions numerically (using a numerical differential equation solver) and plotted the solutionfor x1(t)and x2(t)and the result matches that shown above by simulink. Here is the code the plot asa result of this verification

    10

  • 8/12/2019 Mechanical 431 Project

    11/17

    11

  • 8/12/2019 Mechanical 431 Project

    12/17

    4 Unit impulse simulink diagram and output

    And the output for x1(t)and x2(t)is as follows

    4.0.2 Verification of result from Simulink by Numerically solving the differential equa-

    tions

    To verify the above output from Simulink, The same coupled differential equations were solved numer-ically for zero initial conditions numerically and the solution plotted for x1(t)and x2(t)and the resultwas found to match that shown above by simulink. Here is the code used to do the verification

    verification

    12

  • 8/12/2019 Mechanical 431 Project

    13/17

    13

  • 8/12/2019 Mechanical 431 Project

    14/17

    14

  • 8/12/2019 Mechanical 431 Project

    15/17

    4.1 sin(t) input simulink diagram and output

    The simulink block diagram will be as follows for the sin t input

    For an initial run with parameters m1 = m2 =k1 = k2 = 1 this is the output for x1(t) and x2(t) andshowing the input signal at the same time

    15

  • 8/12/2019 Mechanical 431 Project

    16/17

    16

  • 8/12/2019 Mechanical 431 Project

    17/17

    5 Discussion

    A coupled system of two masses and springs was analyzed using Simulink. The simulation was donefor one set of parameters (masses and stiffness). Simulink made the simulation of this system underdifferent loading conditions easy to do. The 2 masses response were recorded using simulink scope andthe signals captured on the same plot to make it easy to compare the response of the first mass to thesecond mass.

    The analytical analysis was more time consuming than actually making the simulation in simulink.The ability to easily change different sources to the system was useful as well as the ability to changethe frequency of the input and immediately see the effect on the response.

    This was my first project using Simulink, and I can see that this tool will be useful to learn more asit allows one to easily analyze engineering problems.

    17