EE/ME/AE324: Dynamical Systems - Clarkson...

29
EE/ME/AE324: Dynamical Systems Chapter 4: Block Diagrams and Computer Simulation and Computer Simulation

Transcript of EE/ME/AE324: Dynamical Systems - Clarkson...

Page 1: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

EE/ME/AE324:Dynamical Systems

Chapter 4: Block Diagrams

and Computer Simulationand Computer Simulation

Page 2: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Block Diagrams• A block diagram is an interconnection of:• A block diagram is an interconnection of:

Blocks representing math operations

Wires representing signals (info.) and their flow

Commonly used to analyze/simulate systemsy y y

• Common elements include:

SummersSummers

Gains blocks

Integrators

• Given the simple system:p y( )ax Ax f t= − +

Page 3: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Diagrams for Input‐Output Eqns.• Assuming a system in I/O Eqn form with a single• Assuming a system in I/O Eqn. form with a single

output and no input derivatives:

1 S l f hi h t t t d i ti (HOD)1. Solve eqn. for highest output derivative (HOD)

2. Connect integrators in series to generate the output signal from the HOD

3. Generate the HOD from 1. using a summer block and scaled versions (gain blocks) of the integrator outputs and the input.

• Given the simple MSD system of Ex. 3.1:( )Mx Bx Kx f t+ + = ( )aMx Bx Kx f t+ + =

Page 4: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Ex. 3.11 Solving for yields:x1. Solving for yields:

1 ( )

x

x Bx Kx f t = − − +

2. Create a chain of two integrators, and 3. Use the

( )aMx Bx Kx f t

+

result of 1. above to complete the diagram:

Page 5: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Ex. 3.2 Revisited

• EoM with 0:B =

1 1 1 1 2 2 1

2 2 2 2 1

( )( ) ( )a

M x K x K x xM x K x x f t

+ = −+ − =

2 2 2 2 1( ) ( )af

Resulting I/O eqn :•( )4

2 1 1 1 2 1 1 2

Resulting I/O eqn.:

( )aM M x Ax K K x K f t+ + =2 1 1 1 2 1 1 2

2 1 2 1 2where ( )a

A M K K M K= + +

Page 6: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Ex. 3.2 Revisited1 Solving for the HOD:1.

( ) [ ]4 1

Solving for the HOD:

( )x Ax K K x K f t− − +

= [ ]2 1

1 1 2 1 1 2 ( )aM Mx Ax K K x K f t+

2. Create a chain of four integrators, and 3. Use the result of 1. above to complete the diagram:p g

Page 7: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Diagrams for State‐Variable Models• If the system is written in state-space form:If the system is written in state space form:q = Aq+Buy =Cq+Du

• The block diagram follows naturally:

q q∫

u yq qdt∫

u y

Page 8: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Diagrams for State‐Variable Models (Ex. 4.4)• If the system is written in terms of n state eqnsIf the system is written in terms of n state eqns.,

but is not written in Matrix form:

1 Draw an integrator for each state variable1. Draw an integrator for each state variable

2. Build the terms needed to form the derivative f h i bl ( ifi d b h E M)of each state variable (as specified by the EoM)

using the states, inputs, gains and summers

3. Build the terms needed to form the outputs

Page 9: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Ex. 4.4 If the state variables are defined as:•

1 1

e s a e va ab es a e de ed as:x xx x 1 1

2 2

x xx x ⇒ =

= =q q

2 2

1

x x

x

[ ]1 1 1 1 3 1 2 3 1 21

1 ( ) ( ) ( )af t K x B x B x x K x xM

− − − − − −

1

2

1

Mx

[ ]2 2 2 2 3 1 2 3 1 22

1 ( ) ( )K x B x B x x K x xM

− − + − + −

Page 10: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Ex. 4.4 • The blockThe block

diagram consists of twostrings of integrators, i.e.,

f 1 done for x1 and one for x2, with all signals beingall signals being fed into the summerssummers corresponding to forces acting gon the free‐body diagrams

Page 11: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Running Simulink with Matlab• Simulink is a companion package to MatlabSimulink is a companion package to Matlab

provides a graphical user interface (GUI)‐based method of programming based on signal flowmethod of programming based on signal flow

similar to modeling using block diagrams

Matlab can be used to set‐up Simulink models and Simulink data can be passed to Matlab for further analysis and visualization

models can be used for real‐time, hardware‐in‐,the‐loop system testing using DAQ hardware

• See recommended text for more details:See recommended text for more details:Steven Karris, Introduction to Simulink with Engineering Applicationshttp://www.orchardpublications.com

Page 12: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Running Simulink with Matlab• Simulink provides a pre‐defined library of blocksSimulink provides a pre defined library of blocks

that can be used to quickly model systems

• Commonly used libraries/blocks include:• Commonly used libraries/blocks include:

Continuous – Integrator (click to set ICs)

Math Operations – Sum (click to change shape and input signs), Gain

Sources – Clock, Constant, Step, Fun. generator

Sinks – Scope, (save) To workspaceSinks Scope, (save) To workspace

Page 13: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Running Simulink Simulations • Follow these steps to create a Simulink simulation:Follow these steps to create a Simulink simulation:

1. Start Matlab and type “Simulink” at prompt

2 Click “blank page” icon in upper left of Simulink2. Click blank page icon in upper left of SimulinkLibrary Browser to open new model

3 Drag blocks from library folders into the model3. Drag blocks from library folders into the model window, e.g., integrator, sum, gain, step, etc.

4. Arrange blocks so that they represent the system4. Arrange blocks so that they represent the system model in an orderly way, connecting them by dragging using wires, etc.

5. Double click on blocks with parameters to change them as needed

6. Setup simulation, e.g., stop time, using Simulation > Configuration Parameters menu in model window

Page 14: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Create the Simulink Model Below • Questions:

What does this model represent?How does increasing B change the system response?

Page 15: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Associated Matlab Script

Page 16: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx
Page 17: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

In‐class Design Challenge• Our next class will meet in 163 CAMPOur next class will meet in 163 CAMP– You will form groups of no more than three students

You will simulate Example 4 7 and try to solve a design– You will simulate Example 4.7 and try to solve a design challenge posed at the start of class

– Students in groups that successfully solve theStudents in groups that successfully solve the challenge and submit printouts of their work will be awarded a 2% bonus toward their project gradesp j g

– You are encouraged to get a head start on the challenge if desired by reviewing Example 4.7, etc.

Page 18: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Questions?Questions?

Page 19: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

In‐class Design Challenge• Form groups of no more than three studentsForm groups of no more than three students

• Simulate Example 4.7 and try to solve a design challengechallenge

• Students in groups that successfully solve the h ll d b i i f h i kchallenge and submit printouts of their work,

e.g., Matlab and Simulink files with clearly l b l d l h i h i l ill blabeled plots showing their results, will be awarded a 2% bonus toward their final grades

Page 20: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Ex. 4.7: Problem Statement• A skydiver jumps from an airplane.A skydiver jumps from an airplane.

Assume: no wind, the parachute opens at t=0 with the risers fully extended (no “stretch”) and provides viscous damping relative to a fixed

f i i i l d f h jreference, initial speed of the jumper and parachute are 20 m/sCh ll Fi d l f B d K• Challenge: Find values for Bp and KRthat ensure a steady‐state velocity of 5 m/s or less with max jumper5 m/s or less with max. jumper deceleration limited to one g or less using the following parameters:using the following parameters:

10 kg, 60 kg, 10 N s/mp j jM M B= = = ⋅

Page 21: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Computer Lab Assignment• Assume references are selectedAssume references are selected

such that displacement of jumper and parachute are zero when t=0,i.e., system at EQ when xp=xj=0

• EoM:

( )1p p p R j p p

p

x B x K x x M gM

= − + − +

( )1

p

j j j R j p jx B x K x x M gM

= − − − +

• Now model this system in Matlab

( )j j j R j p jj

gM

yand Simulink

Page 22: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

You have approx.pp40 minutes to worksolve the Challenge g

Solution on Next Page!g

Page 23: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Solution• Assume references are selectedAssume references are selected

such that displacement of jumper and parachute are zero when t=0,i.e., system at EQ when xp=xj=0

• In steady-state, 0 p j p j tvx x x x x= = ⇒ = =

( )(terminal velocity). Sub. into EoM yields:

jM M g+( )

( )

5 m/sp jtv

p j

M M gx

B B+

= ≤+

( )p jp j

tv

M M gB B

x+

⇒ = −

( )10 60 1010 130 N m/s

5+

≅ − = ⋅

Page 24: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Solution for KR=40, Bp=130 • Run simulation varying KR until specifications met:Run simulation varying KR until specifications met:

Page 25: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

• Is this a practical solution (explain your answer)?

Page 26: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

% Matlab script to simulate Ex. 4.7 using a state‐space modelp g pclear% Define system parametersg=9.81; Mp= 10; Mj= 60; Bj= 10; xpdot_ss= 5;Bp= (Mp+Mj)*g/xpdot_ss‐Bj; % Solved from EoM in steady‐stateKR= 40; t stop= 20;% Selected by trial and errorKR= 40; t_stop= 20;% Selected by trial and error % State matricesA= [0 1 0 0;‐KR/Mp ‐Bp/Mp KR/Mp 0;0 0 0 1;KR/Mj 0 ‐KR/Mj ‐Bj/Mj];B= [0;1;0;1];C= [eye(4);KR/Mj 0 ‐KR/Mj ‐Bj/Mj]; % Last row specifies accel. of jumperD [zeros(4 1);1];D= [zeros(4,1);1];IC=[0;20;0;20]; % Initial conditions as per problem statementsim('EX4 7') % Calls the Simulink modelsim( EX4_7 ) % Calls the Simulink model

Page 27: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

figure(); subplot(2 1 1); plot(tout y(: 1) tout y(: 3))figure(); subplot(2,1,1); plot(tout,y(:,1),tout,y(:,3))title('Displacement of parachute (blue) and jumper (green)')xlabel('Time [s]'); ylabel('Displacement [m]')( [ ] ); y ( p [ ] )subplot(2,1,2); plot(tout,y(:,3)‐y(:,1))title('Relative displacement of risers')xlabel('Time [s]'); ylabel('Displacement [m]')figure();subplot(2,1,1); plot(tout,y(:,2),tout,y(:,4))title('Velocity of parachute (blue) and jumper (green)')title( Velocity of parachute (blue) and jumper (green) )xlabel('Time [s]'); ylabel('Velocity [m/s]')subplot(2,1,2); plot(tout,y(:,5))subplot(2,1,2); plot(tout,y(:,5))title('Acceleration of jumper')xlabel('Time [s]'); ylabel('Acceleration [m/s^2]')

Page 28: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Simulink Model of Ex. 4.7

Page 29: EE/ME/AE324: Dynamical Systems - Clarkson Universityweb2.clarkson.edu/class/ee324/Notes/EE324_Chapter4_Notes_S10_Po… · EE/ME/AE324: Dynamical Systems Chapter 4: ... ft Kx Bx Bx

Questions?Questions?