ES205 Analysis and Design of Engineering Systems: Lab 1: An Introductory Tutorial: Getting Started with SIMULINK

Similar documents
Lab 1: Dynamic Simulation Using Simulink and Matlab

Simulink Modeling Tutorial

LAB 2 - ONE DIMENSIONAL MOTION

Laboratory handouts, ME 340

Mathematical Modelling Using SimScape (Electrical Systems)

Computational Chemistry Lab Module: Conformational Analysis of Alkanes

PHYSICS 211 LAB #8: Periodic Motion

1 Overview of Simulink. 2 State-space equations

EE/ME/AE324: Dynamical Systems. Chapter 4: Block Diagrams

Updated 2013 (Mathematica Version) M1.1. Lab M1: The Simple Pendulum

Lecture 14 - Using the MATLAB Control System Toolbox and Simulink Friday, February 8, 2013

a. Follow the Start-Up Procedure in the laboratory manual. Note the safety rules.

Chem 1 Kinetics. Objectives. Concepts

Lab 1 Uniform Motion - Graphing and Analyzing Motion

Project IV Fourier Series

Name Class Date. RC Circuit Lab

ECE 320 Linear Control Systems Winter Lab 1 Time Domain Analysis of a 1DOF Rectilinear System

PHY 221 Lab 3 Vectors and Motion in 1 and 2 Dimensions

Calculating Bond Enthalpies of the Hydrides

You will return this handout to the instructor at the end of the lab period. Experimental verification of Ampere s Law.

Introduction. Pre-Lab Questions: Physics 1CL PERIODIC MOTION - PART II Fall 2009

Lab 4: Gauss Gun Conservation of Energy

Linear System Theory

2.004 Dynamics and Control II Spring 2008

August 7, 2007 NUMERICAL SOLUTION OF LAPLACE'S EQUATION

Force vs time. IMPULSE AND MOMENTUM Pre Lab Exercise: Turn in with your lab report

Laboratory handout 5 Mode shapes and resonance

PHYSICS 211 LAB #3: Frictional Forces

Electric Fields and Equipotentials

Unit 7: Oscillations

Chemistry 14CL. Worksheet for the Molecular Modeling Workshop. (Revised FULL Version 2012 J.W. Pang) (Modified A. A. Russell)

Coefficient of Friction Lab

Exercises for Windows

Center of Mass. Evaluation copy

Static and Kinetic Friction

Assignment 1: Molecular Mechanics (PART 1 25 points)

Introduction. Pre-Lab Questions: Physics 1CL PERIODIC MOTION - PART II Spring 2009

LABORATORY 1: KINEMATICS written by Melissa J. Wafer '95 June 1993

Evaluation copy. Ground Temperature Measurements. computer OBJECTIVES MATERIALS PRE-LAB QUESTIONS

The Phase Change Lab: Freezing and Melting of Water

Hooke s Law. Equipment. Introduction and Theory

Motion II. Goals and Introduction

Work and Energy. This sum can be determined graphically as the area under the plot of force vs. distance. 1

PHY221 Lab 2 - Experiencing Acceleration: Motion with constant acceleration; Logger Pro fits to displacement-time graphs

Double Inverted Pendulum (DBIP)

(THIS IS AN OPTIONAL BUT WORTHWHILE EXERCISE)

Chapter 1, Section 1.2, Example 9 (page 13) and Exercise 29 (page 15). Use the Uniqueness Tool. Select the option ẋ = x

Linear Motion with Constant Acceleration

Physics 103 Newton s 2 nd Law On Atwood s Machine with Computer Based Data Collection

Experiment: Oscillations of a Mass on a Spring

( ) ( ) = q o. T 12 = τ ln 2. RC Circuits. 1 e t τ. q t

SRV02-Series Rotary Experiment # 1. Position Control. Student Handout

POC via CHEMnetBASE for Identifying Unknowns

Lab Activity H4 It s Snow Big Deal

Dynamics. Newton s First Two Laws of Motion. A Core Learning Goals Activity for Science and Mathematics

LAB 4: FORCE AND MOTION

EEE 480 LAB EXPERIMENTS. K. Tsakalis. November 25, 2002

Measuring the time constant for an RC-Circuit

DC-motor modelling and parameter identification

Applications of Second-Order Differential Equations

University of TN Chattanooga Physics 1040L 8/18/2012 PHYSICS 1040L LAB LAB 4: R.C. TIME CONSTANT LAB

Feedback Control part 2

Lab 5: Harmonic Oscillations and Damping

Simulink Tutorial 1 CPE562

Experiment 15: Atomic Orbitals, Bond Length, and Molecular Orbitals

Driven Harmonic Oscillator

first name (print) last name (print) brock id (ab17cd) (lab date)

Computational Study of Chemical Kinetics (GIDES)

Using web-based Java pplane applet to graph solutions of systems of differential equations

A SHORT INTRODUCTION TO ADAMS

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

Investigation #2 TEMPERATURE VS. HEAT. Part I

PHY222 Lab 2 - Electric Fields Mapping the Potential Curves and Field Lines of an Electric Dipole

POC via CHEMnetBASE for Identifying Unknowns

Simple Harmonic Motion

Figure 1: Startup screen for Interactive Physics Getting Started The ærst simulation will be very simple. With the mouse, select the circle picture on

AMS 27L LAB #8 Winter 2009

Experiment 5. Simple Harmonic Motion

You w i ll f ol l ow these st eps : Before opening files, the S c e n e panel is active.

2: SIMPLE HARMONIC MOTION

Physics 4C Simple Harmonic Motion PhET Lab

Purpose: Materials: WARNING! Section: Partner 2: Partner 1:

VECTORS AND MATRICES

Analysis of Dynamic Systems Using Bond Graph Method Through SIMULINK

PHY 123 Lab 4 The Atwood Machine

Introduction to Simple Harmonic Motion

dy dt = ty, y(0) = 3. (1)

PHY 123 Lab 10-Simple Harmonic Motion

Lab 10: DC RC circuits

Electric Circuit Theory

Kinematics Lab. 1 Introduction. 2 Equipment. 3 Procedures

Motion with Constant Acceleration

WISE Regression/Correlation Interactive Lab. Introduction to the WISE Correlation/Regression Applet

Experiment 14 It s Snow Big Deal

Physics 401 Classical Physics Laboratory. Experiment 5. Transients and Oscillations in RLC Circuits. I. Introduction II. Theory...

Stoichiometric Reactor Simulation Robert P. Hesketh and Concetta LaMarca Chemical Engineering, Rowan University (Revised 4/8/09)

Signal Processing First Lab 11: PeZ - The z, n, and ˆω Domains

41. Sim Reactions Example

Finite Element Modules for Enhancing Undergraduate Transport Courses: Application to Fuel Cell Fundamentals

Chapter 2: Linear Constant Coefficient Higher Order Equations

Transcription:

ES205 Analysis and Design of Engineering Systems: Lab 1: An Introductory Tutorial: Getting Started with SIMULINK What is SIMULINK? SIMULINK is a software package for modeling, simulating, and analyzing dynamic systems. It supports linear and non-linear system modeling in continuous time, sampled time, or a combination of the two. It provides a graphical interface for building models as block diagrams using the mouse by click-and-drag operations. It also provides a variety of simulated output devices that can be attached to the system to monitor the output or state variables of the system. By defining the system graphically, the mathematical calculations required to simulate the differential equations that represent the models are hidden from your view. You only need to be able to supply the model structure and parameters, the simulation parameters, and the output variables and forms. You don't have to get bogged down in the math to determine the behavior of the system of interest. This tutorial will consist of 4 parts: A) Launching and becoming familiar with the SIMULINK environment B) Creating a simple 1st order model C) Creating a 2nd order model of a mass, spring, damper system D) Creating a model on your own of an electrical system. Part A: Launching Simulink: 1) SIMULINK is run from the MATLAB prompt, >>, so the first step is to get MATLAB running. -- Connect to the Network -- Launch MATLAB. ( if you have not already installed MATLAB you will need to do so at this time. Refer to the instructions handed out in Le 01.) 2) At the prompt, >>, in the MATLAB Command Window, type simulink and press Enter. ES205 Getting started with Simulink Page 1 of 16

3) When SIMULINK opens you will see the box called the SIMULINK Library Browser. The Library consist of a number of different SIMULINK blocks with which a system model may be built. To build a model, you first need to create a space to make the model. Click the new model icon in the upper left corner to open a new SIMULINK file workspace. Next, select the SIMULINK icon to expand the list of the available elements that are used to create a system model. 4) After making the selections in Step 3, the SIMULINK Library Browser will show folders that contain the most commonly used elements you will be using for model creation. Click on each of the following folders and quickly note the elements that are contained in each. -- Continuous -- Discontinuous -- Discrete -- Look-up Tables -- Math Operations -- Sinks -- Sources When needed, these elements may simply be clicked, dragged, and dropped into the model workspace. ES205 Getting started with Simulink Page 2 of 16

During Step 3 you also opened a window called Untitled, which is the model workspace where the models will be created. 5) You have not yet created a model, but if you had, you would want to be able to save the model. To save a model, pull down the File menu and select Save_As or Click on the File Save Button While we won't save a file right now, we will have you create a new folder to save any models you will create. Create a new folder called, simulink_files by clicking on on the new folder button. and supply the correct name. ES205 Getting started with Simulink Page 3 of 16

Part B) Example 1: A Simple Model 1) The first model you are going to build will solve a simple 1st order differential equation given by dx = 3 sin( 2 t ) dt with an initial condition x(0) = -1. 2) To create a model of this equation, we first sketch a simulation diagram of the mathematical model. The simulation diagram will consist of: an input --> the forcing function, 3 sin(2t) an output --> the solution, dx/dt a parameter --> the initial condition, x(0) = -1 an operator --> integration block I.C.: x(0) = -1 input: 3sin(2t) dx dt 1 s x output: x(t) 3) To construct this model in Simulink, will require three elements: -- a Sine Wave Block --an Integrator Block -- a Scope Block Locate the Sine Wave under the Sources folder and Click, Drag, and Drop it in the model workspace window to create the Input Block ES205 Getting started with Simulink Page 4 of 16

4) Locate the Integrator under the Continuous folder and Click, Drag, and Drop it in the model workspace window to create the Operator Block. 5) Locate the Scope under the Sinks folder and Click, Drag, and Drop it in the model workspace window to create the Output Block ES205 Getting started with Simulink Page 5 of 16

6) Connecting the blocks. Blocks can be connected by dragging a line from the output of one block to the input of another block. Make the following connections: Output of the Sine Wave --> Input of the Integrator Output of the Integrator --> Input of the Scope The arrows indicate the direction of the signal flow. 7) Selecting Simulation Parameters. Most blocks have different parameters that are associated with them. To access the parameters, simply double-click on the block of interest. This will bring up a dialog box which allows the parameters to be changed. Double click on the Sine Wave and set the following parameters: Amplitude = 3 Frequency = 2 ES205 Getting started with Simulink Page 6 of 16

Double click on the Integrator Block and set the parameter for the initial condition. x(0) = -1 Double Click on the Scope Block. This does not have any parameters which need setting, but instead displays the scope display screen. 8) Now that the model has been defined and created, the model simulation is ready to run. To Start a simulation, pull down the Simulation menu, and select Start. View the output of the simulation on the Scope window. 9) Simulation Results ES205 Getting started with Simulink Page 7 of 16

Your results should look like the figure. Measure the magnitude of peaks and valleys and the period of the signal. Peak = Valley = Period = 10) Simulation Verification: To verify that this plot represents the solution to the problem, let's solve the equation another way. Either manually, or using Maple, obtain the solution x(t) of the ODE with the initial condition dx = 3sin(2t) with x(0) = -1 dt Show solution here: The result should be: ( t ) x ( t ) = 1 2 3 cos 2 2 This is the function that was plotted in the SIMULINK Scope window. Save this SIMULINK model in the simulink_files folder as as Example1.mdl ES205 Getting started with Simulink Page 8 of 16

Part C: Example 2, a mass, spring, damper system 1) The second model will use SIMULINK to create a model of a mass-springdamper system which may be modeled with a 2nd order differential equation. Other parameters of the system include: -- initial conditions: x(0) = 0 and dx/dt(0) = 0 -- the input f(t) is a step function with magnitude 3 at t=0 -- mass, m = 0.25 -- damping coefficient, c = 0.5 -- spring constant, k = 1 The model equation: 2 d x dx m + c + kx = 2 dt dt f ( t) Assume all units are consistent for the model. You will work through the following steps: a) Draw the simulation diagram b) Create and save the SIMULINK Model c) Run the Simulation. 2) In the space below attempt to draw the simulation diagram for this model: ES205 Getting started with Simulink Page 9 of 16

3) Let's walk through the steps. For comparison, start by solving the model equation for the highest order derivative term. m 2 d x 2 dt = f ( t) dx c dt k x The first block you create should be a Sum block, where the output of the Sum block is the left-hand term of the equation above. m d2 x dt 2 sum block Now using SIMULINK, Create a new workspace... File... New...Model Locate the Sum Block in the library and Click, Drag and Drop it into your new workspace. The Sum block is to have 3 inputs. Double click on the Block and set the parameters to rectangular and + - -. ES205 Getting started with Simulink Page 10 of 16

4) Gain Block. Add a gain (multiplier) block to normalize the coefficient, m, to modify the signal so it is equal to the highest order derivative term alone. m d2 x dt 2 1 m d 2 x dt 2 sum block gain Click, Drag, and Drop a Gain Block from the library into the SIMULINK workspace. Double-click on the Gain block to change the block parameters. Use a Gain of Add a title to the Gain Block. ES205 Getting started with Simulink Page 11 of 16

5) Add two integrators to your Simulation diagram. m d2 x dt 2 1 m d 2 x dt 2 1 s dx dt 1 s x sum block gain Integrator Integrator Click, Drop, and Drag two Integrator Blocks into your SIMULINK workspace from the library. Also: Set the initial condition parameters to zero for both integrators. Add a scope block to the output of the second integrator Connect the output ports to the input port as shown Label each of the signals by double clicking on the leader line. ES205 Getting started with Simulink Page 12 of 16

6) Return Branch Gain Blocks In the Simulation Diagram, connect the integrated signals with gain blocks to create the terms on the right-hand side of the model equation. m d2 x dt 2 1 m d 2 x dt 2 1 s dx dt 1 s x sum block c dx dt c k x k In SIMULINK, Drag in two additional Gain blocks from the Math library to the workspace. --Flip these blocks by selecting each block and using... Format...Flip Block --Double click on each of the blocks and set the appropriate parameters c = 0.5 k = 1.0 --Connect the signal lines: Either Click the gain block input and drag to each of the branch points. or Ctrl-Click to select the branch point first and drag to the gain inputs. --Add appropriate titles to the gain blocks c = 0.5 k = 1.0 ES205 Getting started with Simulink Page 13 of 16

7) Connect all Input Signals. In the Simulation Diagram, connect all the input signals to the appropriate inputs of the Sum Block. Input: f(t) + - - m d2 x dt 2 1 m d 2 x dt 2 1 s dx dt 1 s x Output: x(t) c dx dt c k x k In the SIMULINK workspace: -- Add a Step Block from the Source library and set its parameters. Step time = 0 Initial value = 0 Final value = 3 -- Connect the signal lines to the sum Block, paying attention to the signs of the inputs. ES205 Getting started with Simulink Page 14 of 16

8) Your completed SIMULINK model should look like the following. Complete any missing titles or labels. Save your model as Example2.mdl 9) Running your simulation Double click on the Scope to make its output visible. Run your simulation. What is it maximum value of x reached? What is its final value of x reached? Is this behavior underdamped, overdamped, or critically damped? ES205 Getting started with Simulink Page 15 of 16

This concludes the SIMULINK Tutorial Module. You are now to complete Part D: Lab 1 Worksheet. To complete the worksheet you are expected to understand and use the terms below. Terms used on the worksheet: Steady State Value is the final value of the system settles at after transient behavior has dissipated. Overshoot is characterized as the maximum response swing past the steady state value. Rise time is time required for the system to rise from ten to ninety percent of the steady state value. Settling time is the amount of time the system takes to value settle close to the steady state condition (to within approximately 2% of the step size). Overshoot Settling Time +/- 2% of step Steady State Value Rise Time ES205 Getting started with Simulink Page 16 of 16

Name Section C M Lab Partners: Part D: Lab 1 Worksheet ES205 Analysis and Design of Engineering Systems 1) Mass-Spring-Damper Model: Below you will explore how changing each of the three parameters, m, c, and k, affect the system response of the spring-mass-damper model created in Part C. Varying the mass, m: In the space below, make a prediction. How do you think changing the mass, m, of the system will affect its dynamic behavior? Now using your SIMULINK model, vary the value of the mass, m, using the multipliers given below, while keeping k and c constant. Then on the graph below sketch and label each response. If you prefer, you can make this figure in Matlab rather than sketching. Attach the figure to this worksheet. Use Mass values: m/5 m/2 1.0*m 2.0*m and 5*m 5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0 0 1 2 3 4 5 6 7 8 9 10 Summary: Give a short summary which qualitatively describes how changing the mass affected the system response. Include qualitative reference to the overshoot, settling time, and steady state value. ES205 Lab 1 Worksheet Page 1 of 6

Varying the damping constant, c: Make another prediction. How will changing the damping constant, c, of the system affect its dynamic behavior? Now using your SIMULINK model, vary the value of the mass, c, using the multipliers given below, while keeping k and m constant. Then on the graph below sketch and label each response. If you prefer, you can make this figure in Matlab rather than sketching. Attach the figure to this worksheet. Use Damping Constants: c/5 c/2 1.0*c 2.0*c and 5*c 5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0 0 1 2 3 4 5 6 7 8 9 10 Summary: Give a short summary which qualitatively describes how changing the damping constant affects the system response. Include qualitative reference to the overshoot, settling time, and steady state value. ES205 Lab 1 Worksheet Page 2 of 6

Varying the elastic coefficient, k: Make a prediction: How will changing the elastic coefficient, k, of the system affect its dynamic behavior? Now using your SIMULINK model, vary the value of the elastic coefficient, k, using the multipliers given below, while keeping m and c constant. Then on the graph below sketch and label each response. If you prefer, you can make this figure in Matlab rather than sketching. Attach the figure to this worksheet. Use Elastic Coef. values: k/5 k/2 1.0*k 2.0*k and 5*k 16 14 12 10 8 6 4 2 0 0 1 2 3 4 5 6 7 8 9 10 Summary: Give a short summary which qualitatively describes how changing the elastic coefficient affected the system response. Include qualitative reference to the overshoot, settling time, and steady state value. ES205 Lab 1 Worksheet Page 3 of 6

2) Modeling a Simple Electrical RLC Circuit. A simple electrical circuit consists of a Resistor, Coil, and Capacitor in series with a variable voltage source, E(t). R L e + E(t) - i C The circuit may be modeled using two 1st order DE's given as di R 1 1 de 1 + i + e = E() t and i = 0 dt L L L dt C with i(0) = 0 with e(0) = 0 where i is the current in the circuit and e is the electric potential at the node between the coil and capacitor. Draw the Simulation Diagram that represents these DEs below. ES205 Lab 1 Worksheet Page 4 of 6

Now using your Simulation diagram, create the SIMULINK model for this electrical system using the values: R = 3 L = 1 C =0.5 and E(t), which is a pulse defined from t = 1 to t = 5 as shown to the right. E(t) 1 5 2 t Add Scope Blocks to display both outputs, i and e, as well as the input voltage, E(t). Make sure you include appropriate labeling of the blocks, signals, and I/O. Run the simulation for 0< t < 10 Sketch the shape of the output signals below or, if you prefer, you can make these figures in Matlab. Attach the figures to this worksheet. e i t t Now experiment with your model by varying each of the component parameters, R, L, and C. Describe the effect each has on the system response. Be sure to run you simulation with larger and smaller values of these parameters. Effect of Varying R: Effect of Varying L: Effect of Varying C: ES205 Lab 1 Worksheet Page 5 of 6

Using trial and error, try to select an appropriate set of values for R, L, and C that produce a system response (voltage) such that the system has -- a rise time of less than 1 s -- a settling time less than 4 s -- an overshoot of less than 0.25 V? Document the variations you tried to produce this response on the table below. One you have determined values that satisfy the specifications create a figure of the time history and attach to this worksheet. Trial R L C Settling Time 1 2 3 4 5 6 7 8 Overshoot Meet Constraints? Upon completion of this Worksheet, hand in the following: 1) This handout, Part D with all graphs, tables, and questions completed. 2) A printed copy of your spring-mass-damper system SIMULINK model. 3) A printed copy of your electrical system SIMULINK model. 4) All other Matlab figure you may have created. ES205 Lab 1 Worksheet Page 6 of 6