Linear System Theory - Introduction to Simulink Prof. Robert X. Gao Electromechanical Systems Laboratory Department of Mechanical Engineering
Outline Block Diagram Introduction Launching Simulink Modeling Procedure System Modeling with Simulink - Example Summary Practice 2 /21
Block Diagram Definition: A block diagram is an interconnection of blocks representing basic mathematical operations in such a way that the overall diagram is equivalent to the system s mathematical model. Components: Summer Addition and subtraction Gain Multiplication Integrator Integration Constant No Input, Output Never Changes Base: Input Output Equation State Variable Equations 3 /21
An Example of Block Diagram For the given system, Block Diagram 4 /21
Introduction Definition: Simulink is a software package that enables you to model, simulate, and analyze systems whose outputs change over time. - Mathworks Features: Model based Design Graphical Programming Icon - Driven Build Systems by Drawing Block Diagrams Example Plane Take - Off Applications: Aerospace and Defense Automotive Communications Electronics and Signal Processing Medical Instrumentation Etc. 5 /21
Launching Simulink Launch MATLAB and Specify Work Directory Launch Simulink Type simulink in command window Click Start Simulink Library Browser Block Search Select Library Select Block Block Description 6 /21
Modeling Procedure Defining the Problem Identifying System Components OUTSIDE SIMULINK Modeling System with Equations Building the Simulink Block Diagrams Running the Simulation MODELING IN SIMULINK Validating the Simulation Results 7 /21
Example 4.7 A Parachute Jumper and a Mechanical Model Values: Mass of the Parachute M p Mass of the Jumper M j Drag Coefficient of Parachute B p Drag Coefficient of Jumper B j Spring Constant of Riser K R 10 kg 60 kg 100 N/(m/s) 10 N/(m/s) 400 N/m Conditions: t = 0 as the moment the parachute opens Risers fully extended, no deformation Velocity: v j = 20 m/s, v p = 20 m/s Constant = 9.807 m/s^2 8 /21
Free body Diagrams 9 /21
Equilibrium Equations Equilibrium Equations M x B x K ( x x ) M g p p p p R j p p M x B x K ( x x ) M g j j j j R j p j Re write 1 xp [ Bx p p KR ( xj xp ) M pg ] M p 1 x j [ Bx j j KR ( xj xp ) M jg ] M j 10 /21
Start a New Model From the Library Browser, File New Model Launch the Programming Interface Drag Block Components From Library into This Area 11 /21
Programming 12 /21
Modeling of Parachute 1 xp [ Bx p p KR ( xj xp ) M pg ] M p x p x p x p ( x x ) j p 13 /21
Modeling of Jumper 1 x j [ Bx j j KR ( xj xp ) M jg ] M j ( x x ) j p x j x j x j Time 14 /21
Output Ports Assignment Sequence Variable 1 Displacement of Parachute 2 Velocity of Parachute 3 Acceleration of Parachute 4 Displacement of Jumper 5 Velocity of Jumper 6 Acceleration of Jumper 7 Spring Elongation 8 Time 15 /21
Run the Simulation Script % DEMONSTRATION OF EXAMPLE 4.7 PARACHUTE % 1. Value Assignment Mp = 10; % mass of parachute 10 kg Mj = 60; % mass of jumper 60 kg Bp = 100; % drag coef. of parachute 100 N/(m/s) Bj = 10; % drag coef. of jumper 10 N/(m/s) KR = 400; % spring constant of riser 400 N/m % 2. Simulation Execution sim('parachute'); Run the Script (F5) 16 /21
Simulation Result Workspace Output Variables 17 /21
Visualization of Result % PLOT THE SIMULATION RESULT % OUTPUT VARIABLE : yout % TIME OUTPUT: tout figure; subplot(4,1,1); % 1ST PLOT plot(tout,yout(:,1),'b','linewidth',3); % PLOT DISP. OF PARACHUTE VS. TIME hold on;grid on; plot(tout,yout(:,4),'--r','linewidth',3); % PLOT DISP. OF JUMPER VS. TIME ylabel('meter','fontsize',22); % SET YLABLE set(gca,'fontsize',16); % SET FONT SIZE OF AXES subplot(4,1,2); % 2ND PLOT plot(tout,yout(:,2),'b','linewidth',3); % PLOT VELOCITY OF PARACHUTE VS. TIME hold on;grid on; plot(tout,yout(:,5),'--r','linewidth',3); % PLOT VELOCITY OF JUMPER VS. TIME ylabel('meter/sec.','fontsize',22); % SET YLABLE set(gca,'fontsize',16); % SET FONT SIZE OF AXES subplot(4,1,3); % 3RD PLOT plot(tout,yout(:,3),'b','linewidth',3); % PLOT ACCELERATION OF PARACHUTE VS. TIME hold on;grid on; plot(tout,yout(:,6),'--r','linewidth',3); % PLOT ACCELERATION OF JUMPER VS. TIME ylabel('meter/sec.^2','fontsize',22); % SET YLABLE set(gca,'fontsize',16); % SET FONT SIZE OF AXES subplot(4,1,4); % 4TH PLOT plot(tout,yout(:,7),'k','linewidth',3); % PLOT ELONGATION ylabel('meter','fontsize',22); % SET YLABLE xlabel('time/sec.','fontsize',22); % SET XLABLE set(gca,'fontsize',16); % SET FONT SIZE OF AXES grid on; 18 /21
Plot 40 meter 20 Parachute Jumper meter/sec. 0 0 0.5 1 1.5 2 2.5 3 3.5 4 30 20 10 0 0 0.5 1 1.5 2 2.5 3 3.5 4 meter/sec. 2 100 0-100 -200 0 0.5 1 1.5 2 2.5 3 3.5 4 meter/sec. 2 4 2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 Time/sec. Elongation 19 /21
Summary Introduction to Block Diagram Introduction to Simulink Demonstration of Model based Design Demonstration of Simulink Operation 20 /21
Practice Launch MATLAB Get Familiar with Matrix Operations Try to Solve a Simple Problem with MATLAB Try to Solve a Simple Problem with Simulink 21 /21