Introduction to Simulink Dr. Mohammed F. Alsayed.

Slides:



Advertisements
Similar presentations
1 Application Software Course Simulink By: Mahdi Akbari 2010.
Advertisements

1 1 Mechanical Design and Production Dept, Faculty of Engineering, Zagazig University, Egypt. Mechanical Design and Production Dept, Faculty of Engineering,
For System Dynamics & Control
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
ENGR-25_Lec-25_SimuLink-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
Getting started with Simulink An introductory tutorial ES205 Analysis and Design of Engineering Systems Rose-Hulman Institute of Technology © R. Layton.
Microsoft Access A Hands-On Introduction Chapter 4.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTION Lesson 1 – Microsoft Office XP Basics and the Internet.
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
1 A Tool for System Simulation: SIMULINK Can be used for simulation of various systems: – Linear, nonlinear; Input signals can be arbitrarily generated:
SIMULINK Dr. Samir Al-Amer. SIMULINK SIMULINK is a power simulation program that comes with MATLAB Used to simulate wide range of dynamical systems To.
HossamTalaat - MATLAB Course - KSU - 21/1/24 1 IEEE Student Branch - College of Engineering - KSU Getting started with Simulink By Prof. Hossam Talaat.
The sequence of folders to a file or folder is called a(n) ________.
Simulink ® From Simulink® 7 Getting Started Guide.
ExitTOC Run & Route Directions 2003 Editing Run and Route Directions Edulog.nt v9.2 Use the buttons to navigate the training package First PagePreviousNextLast.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
InDesign CS3 Lessons 1 and 2. Work Area When First Opened.
Microsoft Office Illustrated Fundamentals Unit B: Understanding File Management.
Digital Image Processing Lecture3: Introduction to MATLAB.
EPSII 59:006 Spring Topics Using TextPad If Statements Relational Operators Nested If Statements Else and Elseif Clauses Logical Functions For Loops.
Advanced Forms Lesson 10.
XP New Perspectives on Introducing Microsoft Office XP Tutorial 1 1 Introducing Microsoft Office XP Tutorial 1.
LAB 1 MATLAB, dSPACE and Simulink
IE 411/511: Visual Programming for Industrial Applications
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Simulink ® Interface Course 13 Active-HDL Interfaces.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
Simulink SubSystems and Masking April 22, Copyright , Andy Packard. This work is licensed under the.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
Getting Started With AutoCAD ENGR 2 Week #1 Laboratory.
Control Theory Lab 4 Modeling of Physical-SİMULİNK.
Key Applications Module Lesson 21 — Access Essentials
ECEN/MAE 3723 – Systems I MATLAB Lecture 2. Lecture Overview What is Simulink? How to use Simulink  Getting Start with Simulink  Building a model Example.
Regensburg, 24. – Introduction to Simulink Pavel Karban University of West Bohemia, Faculty of Electrical Engineering, Department of Theory.
Introduction to Matlab Module #9 Page 1 Introduction to Matlab Module #9 – Simulink Topics 1.Simulink Textbook Reading Assignments Practice Problems.
Working in FreeHand – Lesson 21 Working in FreeHand Lesson 2.
Introduction to MATLAB for Engineers Third Edition William J. Palm III Chapter 10 Simulink PowerPoint to accompany Copyright © The McGraw-Hill Companies,
Chapter 23. Copyright 2003, Paradigm Publishing Inc. CHAPTER 23 BACKNEXTEND 23-2 LINKS TO OBJECTIVES Record, Run, Pause, and Delete Macros Record, Run,
SIMULINK-Tutorial 1 Class ECES-304 Presented by : Shubham Bhat.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VII Introduction to SIMULINK Rajeev Madazhy
DC Motor Speed Modeling in Simulink
EE3417 – Introduction to Simulink
Getting Started with Word & Saving Guided Lesson.
Modeling of Power Converters using Matlab and Simulink
Simulink Simulink is a graphical extension to MATLAB for modeling and simulation of systems. In Simulink, systems are drawn on screen as block diagrams.
INTRODUCTION TO SIMULINK by Yasmin Hanum Md Thayoob & Aidil Azwin Zainul Abidin.
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 12”
Simulink by Dr. Amin Danial Asham. References  MATLAB Help  Telemark University College - Department of Electrical Engineering, Information Technology.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Simulink  ? 1 Simulink  ( Simu lation and Link ) is an extension of Matlab Offers modeling, simulation, and analysis of dynamical systems; i.e., a system.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
1 Microsoft Office 2010 Basics and the Internet Microsoft Office 2010 Introductory Pasewark & Pasewark.
Modeling First Order Systems in Simulink And Analyzing Step, Pulse and Ramp Responses SOEN385 Control Systems and Applications.
HossamTalaat - MATLAB Course - KSU - 17/08/14231 IEEE Student Branch - College of Engineering - KSU Getting started with Simulink (part 2) By Prof. Hossam.
Getting started with Simulink
Simulink Modelling Tutorial In Simulink, it is very straightforward to represent a physical system or a model. In general, a dynamic system can be constructed.
Getting started with Simulink An introductory tutorial.
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Dive Into® Visual Basic 2010 Express
- Graphical extension to MATLAB for modeling and simulation of systems
ECEN/MAE 3723 – Systems I MATLAB Lecture 2.
Simulink Basics Reijo Vuohelainen
An Introduction to Computers and Visual Basic
Getting Started With Simulink
An Introduction to Computers and Visual Basic
Microsoft Office Illustrated Fundamentals
Presentation transcript:

Introduction to Simulink Dr. Mohammed F. Alsayed

Introduction In the last few years, Simulink has become the most widely used software package in academia and industry for modeling and simulating dynamical systems. Simulink environment encourages you to pose a question, model it, and see what happens. You can move beyond idealized linear models to explore more realistic nonlinear models. Thus, describing real-world phenomena. It turns your computer into a lab for modeling and analyzing systems.

It is a software package for modeling, simulating, and analyzing dynamical systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two. Systems can also be multirate, i.e., have different parts that are sampled or updated at different rates. What is Simulink?

For modeling, Simulink provides a graphical user interface (GUI) for building models as block diagrams, using click-and-drag mouse operations. With this interface, you can draw the models just as you would with pencil and paper. You can also customize and create your own blocks (S-Functions). Models are hierarchical, so you can build models using both top-down and bottom-up approaches. What is Simulink?

After you define a model, you can simulate it, using a choice of integration methods, either from the Simulink menus or by entering commands in MATLAB’s command window. You can change parameters and immediately see what happens, for “what if” exploration. The simulation results can be put in the MATLAB workspace for postprocessing and visualization What is Simulink?

Running a Demo model An interesting demo program provided with Simulink models the thermodynamics of a house. To run this demo, type thermo in the MATLAB command window. This command starts up Simulink and creates a model window that contains this model. or >> demo ‘simulink’ Quick Start

When you open the model, Simulink opens a Scope block containing two plots labeled Indoor vs. Outdoor Temp and Heat Cost ($), respectively. To start the simulation, pull down the Simulation menu and choose the Start command (or, on Microsoft Windows, press the Start button on the Simulink toolbar). As the simulation runs, the indoor and outdoor temperatures appear in the Indoor vs. Outdoor Temp plot and the cumulative heating cost appears in the Heat Cost ($) plot. Quick Start

To stop the simulation, choose the Stop command from the Simulation menu (or press the Pause button on the toolbar). When you’re finished running the simulation, close the model by choosing Close from the File menu. Quick Start

Description of the Demo The demo models the thermodynamics of a house using a simple model. The thermostat is set to 70 degrees Fahrenheit and is affected by the outside temperature, which varies by applying a sine wave with amplitude of 15 degrees to a base temperature of 50 degrees. This simulates daily temperature fluctuations. Quick Start

The model uses subsystems to simplify the model diagram and create reusable systems. A subsystem is a group of blocks that is represented by a Subsystem block. This model contains five subsystems: Thermostat, House, and three Temp Convert subsystems (two convert Fahrenheit to Celsius, one converts Celsius to Fahrenheit). Quick Start

The internal and external temperatures are fed into the House subsystem, which updates the internal temperature. Double-click on the House block to see the underlying blocks in that subsystem. Quick Start

The Thermostat subsystem models the operation of a thermostat, determining when the heating system is turned on and off. Quick Start

Both the outside and inside temperatures are converted from Fahrenheit to Celsius by identical subsystems. When the heat is on, the heating costs are computed and displayed on the Heat Cost ($) plot on the Thermo Plots Scope. The internal temperature is displayed on the Indoor Temp Scope. Quick Start

Some Things to Try The Constant block labeled Set Point (at the top left of the model) sets the desired internal temperature. Open this block and reset the value to 80 degrees while the simulation is running. See how the indoor temperature and heating costs change. Also, adjust the outside temperature (the Avg Outdoor Temp block) and see how it affects the simulation. Quick Start

Adjust the daily temperature variation by opening the Sine Wave block labeled Daily Temp Variation and changing the Amplitude parameter. Quick Start

Running the simulation involves specifying parameters and starting the simulation with the Start command. You can encapsulate complex groups of related blocks in a single block, called a subsystem. You can create a customized icon and design a dialog box for a block by using the masking feature. Scope blocks display graphic output much as an actual oscilloscope does. What this Demo Illustrates?

Other demos illustrate useful modeling concepts. Type simulink3 in the MATLAB command window. The Simulink block library window appears. Double-click on the Demos icon. Other Useful Demos

The model integrates a sine wave and displays the result, along with the sine wave. To create the model, first type simulink in the MATLAB command window. Note: The window might differ based on the operating system you are using. Building a Simple Model

To create a new model, select the New Model button on the Library Browser’s toolbar. Building a Simple Model

To create this model, you will need to copy blocks into the model from the following Simulink block libraries: – Sources library (the Sine Wave block) – Sinks library (the Scope block) – Continuous library (the Integrator block) – Signals & Systems library (the Mux block) Building a Simple Model

To copy the Sine Wave block from the Library Browser, first expand the Library Browser tree to display the blocks in the Sources library. Do this by clicking first on the Simulink node to display the Sources node, then on the Sources node to display the Sources library blocks. Finally click on the Sine Wave node to select the Sine Wave block. Building a Simple Model

Now drag the Sine Wave node from the browser and drop it in the model window. Copy the rest of the blocks in a similar manner from their respective libraries into the model window. Building a Simple Model

Now it’s time to connect the blocks. Connect the Sine Wave block to the top input port of the Mux block. Position the pointer over the output port on the right side of the Sine Wave block. Building a Simple Model

Drawing a branch line is slightly different. To weld a connection to an existing line, follow these steps: First, position the pointer on the line between the Sine Wave and the Mux block. Second, Press and hold down the Ctrl key. Press the mouse button, then drag the pointer to the Integrator block’s input port or over the Integrator block itself. Building a Simple Model

Finish making block connections. When you’re done, your model should look something like this. Building a Simple Model

Now, open the Scope block to view the simulation output. Keeping the Scope window open, set up Simulink to run the simulation for 10 seconds. First, set the simulation parameters by choosing Parameters from the Simulation menu. On the dialog box that appears, notice that the Stop time is set to 10.0 (its default value). Building a Simple Model

Close the Simulation Parameters dialog box by clicking on the Ok button. Simulink applies the parameters and closes the dialog box. Choose Start from the Simulation menu and watch the traces of the Scope block’s input. Building a Simple Model

Creating a Model

You can start Simulink in two ways: 1.Click on the Simulink icon on the MATLAB toolbar. 2.Enter the simulink command at the MATLAB prompt. Starting Simulink

To create a new model, click the New button on the Library Browser’s toolbar (Windows only) or choose New from the library window’s File menu and select Model. Creating a New Model

To edit an existing model diagram, either: Choose the Open button on the Library Browser’s toolbar (Windows only) or the Open command from the Simulink library window’s File menu and then choose or enter the model filename for the model you want to edit. Enter the name of the model (without the.mdl extension) in the MATLAB command window. The model must be in the current directory or on the path. Editing an Existing Model

Summary of Mouse and Keyboard Actions

As your model increases in size and complexity, you can simplify it by grouping blocks into subsystems. Using subsystems has these advantages: 1.It helps reduce the number of blocks displayed in your model window. 2.It allows you to keep functionally related blocks together. 3.It enables you to establish a hierarchical block diagram, where a Subsystem block is on one layer and the blocks that make up the subsystem are on another. Creating Subsystems

You can create a subsystem in two ways: 1.Add a Subsystem block to your model, then open that block and add the blocks it contains to the subsystem window. 2.Add the blocks that make up the subsystem, then group those blocks into a subsystem. Creating Subsystems

Here are some model-building hints you might find useful: Memory issues: In general, the more memory, the better Simulink performs. Using hierarchy: More complex models often benefit from adding the hierarchy of subsystems to the model. Grouping blocks simplifies the top level of the model and can make it easier to read and understand the model. Tips for Building Models

Cleaning up models: Well organized and documented models are easier to read and understand. Modeling strategies: If several of your models tend to use the same blocks, you might find it easier to save these blocks in a model. Then, when you build new models, just open this model and copy the commonly used blocks from it. You can create a block library by placing a collection of blocks into a system and saving the system. You can then access the system by typing its name in the MATLAB command window. Tips for Building Models

One of the most confusing issues for new Simulink users is how to model equations. Here are some examples that may improve your understanding of how to model equations. Modeling Equations

Converting Celsius to Fahrenheit To model the equation that converts Celsius temperature to Fahrenheit: T F = 9/5(T C ) + 32 First, consider the blocks needed to build the model: A Ramp block to input the temperature signal, from the Sources library A Constant block, to define a constant of 32, also from the Sources library A Gain block, to multiply the input signal by 9/5, from the Math library Modeling Equations

A Sum block, to add the two quantities, also from the Math library A Scope block to display the output, from the Sinks library Next, gather the blocks into your model window. Modeling Equations

The Ramp block inputs Celsius temperature. Open that block and change the Initial output parameter to 0. The Gain block multiplies that temperature by the constant 9/5. The Sum block adds the value 32 to the result and outputs the Fahrenheit temperature. Open the Scope block to view the output. Now, choose Start from the Simulation menu to run the simulation. The simulation will run for 10 seconds. Modeling Equations

Modeling a Simple Continuous System To model the differential equation where u(t) is a square wave with an amplitude of 1 and a frequency of 1 rad/sec. The Integrator block integrates its input, x’, to produce x. Other blocks needed in this model include a Gain block and a Sum block. Modeling Equations

To generate a square wave, use a Signal Generator block and select the Square Wave form but change the default units to radians/sec. Again, view the output using a Scope block. Gather the blocks and define the gain. Modeling Equations

In this model, to reverse the direction of the Gain block, select the block, then use the Flip Block command from the Format menu. Also, to create the branch line from the output of the Integrator block to the Gain block, hold down the Ctrl key while drawing the line. Modeling Equations

An important concept in this model is the loop that includes the Sum block, the Integrator block, and the Gain block. In this equation, x is the output of the Integrator block. It is also the input to the blocks that compute x’, on which it is based. This relationship is implemented using a loop. Modeling Equations

A Math Example The figure below shows a bouncing ball. Lets Get Familiar

The ball is dropped from a meters above a flat surface, and each time the ball hits the ground after falling a distance h it rebounds a distance rh, where r is a positive number less than one. We will derive an expression for the computation of the total distance that the ball travels and we will create a Simulink model. Lets Get Familiar

The distance is computed with the geometric series We can obtain a closed form for this series we begin with the infinite series The sum of the n+1 terms is Lets Get Familiar

Multiplication both sides by r yields Subtracting the last equation from the one before results in cancellation of many terms And for r ≠ 1 Lets Get Familiar

and since in our example r < 1, as n→∞, the term r n approaches zero, that is, Therefore for our example, the total distance traveled by the ball is Lets Get Familiar

Now, we can use Simulink to model the relation with three Constant blocks and one each Add, Subtract, Multiply, and Divide blocks. The result can be displayed in a Display block. Enter: a = 6; r = 0.1:0.1:0.9; Lets Get Familiar

Some modifications Lets Get Familiar

Chemical solutions example Let us consider a tank with 1000 gal capacity initially holding 100 gal. of a salt solution in which 50 lbs of salt are dissolved. Suppose that 3 gal. of brine, each containing 2 lbs of dissolved salt, are added to the tank per minute, and that the mixture, kept uniform by stirring, leaves the tank at the rate of 2 gal. per minute. We wish to compute the amount of salt in the tank at any time t. Lets Get Familiar

Let Q be the number of lbs of salt present at the end of minutes t. Lets Get Familiar

Modeling a second order ODE. Consider the following model Lets Get Familiar

Preparation Lets Get Familiar

Class work Build a Simulink model that solves the differential equation Initial condition Lets Get Familiar

Class work Lets Get Familiar