Module 2 Introduction to SIMULINK



Similar documents
Introduction to LabVIEW for Control Design & Simulation Ricardo Dunia (NI), Eric Dean (NI), and Dr. Thomas Edgar (UT)

Introduction to Simulink

Matlab and Simulink. Matlab and Simulink for Control

Práctica 1: PL 1a: Entorno de programación MathWorks: Simulink

An Introduction to Using Simulink

Setting up a Local Interconnect Network (LIN) using dspace MicroAutoBox 1401/1501 Simulink Blocks

Department of Chemical Engineering ChE-101: Approaches to Chemical Engineering Problem Solving MATLAB Tutorial VI

MATLAB Control System Toolbox Root Locus Design GUI

How to program a Zumo Robot with Simulink

6.094 Introduction to Programming in MATLAB

Scicos is a Scilab toolbox included in the Scilab package. The Scicos editor can be opened by the scicos command

EE289 Lab Fall LAB 4. Ambient Noise Reduction. 1 Introduction. 2 Simulation in Matlab Simulink

Introduction. Chapter 1

CATIA V5 Tutorials. Mechanism Design & Animation. Release 18. Nader G. Zamani. University of Windsor. Jonathan M. Weaver. University of Detroit Mercy

C-more Remote Access, Data Log, FTP File Transfer, and Tutorial

Once we have provided you with an ftp username and password, you may use the following instructions to upload content:

Work with Arduino Hardware

Beginner s Matlab Tutorial

Jump Start: Aspen HYSYS Dynamics V7.3

EXCEL SOLVER TUTORIAL

Installing (1.8.7) 9/2/ Installing jgrasp

Jump-Start Tutorial For ProcessModel

DAQ in MATLAB HANS-PETTER HALVORSEN,

Control System Definition

Preface of Excel Guide

PROCESS CONTROL SYSTEM DESIGN Process Control System Design. LECTURE 6: SIMO and MISO CONTROL

MATLAB on EC2 Instructions Guide

WA Manager Alarming System Management Software Windows 98, NT, XP, 2000 User Guide

Tutorial on Using Excel Solver to Analyze Spin-Lattice Relaxation Time Data

Design-Simulation-Optimization Package for a Generic 6-DOF Manipulator with a Spherical Wrist

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz

Simulink Getting Started Guide

Control and Simulation. in LabVIEW

Controller Design using the Maple Professional Math Toolbox for LabVIEW

A Tutorial Introduction to Control Systems Development and Implementation with dspace

Adobe Acrobat Professional DC Tutorial

1 Topic. 2 Scilab. 2.1 What is Scilab?

Excel Tutorial. Bio 150B Excel Tutorial 1

Installing the Virtual Desktop Application (MAC)

Dials & Gauges Blockset

Introduction to Windows

QUICK START GUIDE. SG2 Client - Programming Software SG2 Series Programmable Logic Relay

Set up and Blink - Simulink with Arduino

MODELING FIRST AND SECOND ORDER SYSTEMS IN SIMULINK

PID Control. Chapter 10

Quick Start Using DASYLab with your Measurement Computing USB device

EET 310 Programming Tools

Installing the VMware Horizon View Client to Access Hoag Virtual Desktops

Design of a TL431-Based Controller for a Flyback Converter

Auto Clicker Tutorial

dspace DSP DS-1104 based State Observer Design for Position Control of DC Servo Motor

mybullard Personal Control Panel User Guide

Table of Contents. 1.1 Description of DFM... 5

Installing Microsoft Outlook on a Macintosh. This document explains how to download, install and configure Microsoft Outlook on a Macintosh.

1 ImageBrowser Software Guide

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

stable response to load disturbances, e.g., an exothermic reaction.

Nodal and Loop Analysis

QNET Experiment #06: HVAC Proportional- Integral (PI) Temperature Control Heating, Ventilation, and Air Conditioning Trainer (HVACT)

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford

Installation Guidelines (MySQL database & Archivists Toolkit client)

Cadence Verilog Tutorial Windows Vista with Cygwin X Emulation

Lab View with crio Tutorial. Control System Design Feb. 14, 2006

Building a Simulink model for real-time analysis V Copyright g.tec medical engineering GmbH

2014 EOCT Online Test Site Readiness Guide and Software Installation Instructions

Introduction to Microsoft Access 2003

Installation of ADS SiMKit startup script and designkit on Windows for SiMKit version 4.4

OVERVIEW. Toolbox for Thermodynamic Modeling and Simulation with MATLAB /Simulink. Key Features:

Lab 1: Full Adder 0.0

Instructions for Use. CyAn ADP. High-speed Analyzer. Summit G June Beckman Coulter, Inc N. Harbor Blvd. Fullerton, CA 92835

Essay 5 Tutorial for a Three-Dimensional Heat Conduction Problem Using ANSYS Workbench

Video in Logger Pro. There are many ways to create and use video clips and still images in Logger Pro.

Piston Ring. Problem:

Using GitHub for Rally Apps (Mac Version)

EDUMECH Mechatronic Instructional Systems. Ball on Beam System

9.2 User s Guide SAS/STAT. Introduction. (Book Excerpt) SAS Documentation

Practical Work DELMIA V5 R20 Lecture 1. D. Chablat / S. Caro Damien.Chablat@irccyn.ec-nantes.fr Stephane.Caro@irccyn.ec-nantes.fr

Device configurator DRC200

INTERACTIVE LEARNING MODULES FOR PID CONTROL

Using MS Excel to Analyze Data: A Tutorial

Operation Count; Numerical Linear Algebra

Tutorial for Tracker and Supporting Software By David Chandler

1 ImageBrowser Software User Guide

Data Mining. SPSS Clementine Clementine Overview. Spring 2010 Instructor: Dr. Masoud Yaghini. Clementine

Two's Complement Adder/Subtractor Lab L03

Adding A Student Course Survey Link For Fully Online Courses Into A Canvas Course

Capture One Pro 9. Quick start guide. Capture One Pro 9. Quick Start Guide 1

Project 1: Rectangular Waveguide (HFSS)

Net Services: File System Monitor

User Manual Network connection and Mobics Dashboard (MIS) software for Dryer Controller M720

Ovation Operator Workstation for Microsoft Windows Operating System Data Sheet

Transmitter Interface Program

How to use Wireframe in Visio

Topography of an Origin Project and Workspace

Process Control Primer

Excel Guide for Finite Mathematics and Applied Calculus

CS 326e F2002 Lab 1. Basic Network Setup & Ethereal Time: 2 hrs

Download and Installation Instructions. Java JDK Software for Windows

Transcription:

Module 2 Introduction to SIMULINK Although the standard MATLAB package is useful for linear systems analysis, SIMULINK is far more useful for control system simulation. SIMULINK enables the rapid construction and simulation of control block diagrams. The goal of the tutorial is to introduce the use of SIMULINK for control system simulation. The version available at the time of writing of this textbook is SIMULINK 4, part of Release 2 (including MATLAB 6) from MATHWORKS. The version that you are using can be obtained by entering ver in the MATLAB Command Window. The easiest way to learn how to use SIMULINK is to implement each step of the tutorial, rather than simply reading it. The basic steps to using SIMULINK are independent of the platform (PC, MAC, UNIX, LINUX ). M2. Background M2.2 Open-loop Simulations M2.3 Closed-loop Simulations M2.4 Developing Alternative Controller Icons 4 July 200 B.W. Bequette

2 SIMULINK Tutorial M2. Background The first step is to startup MATLAB on the machine you are using. In the Launch Pad window of the MATLAB desktop, select SIMULINK and then the SIMULINK Library Browser. A number of options are listed, as shown in Figure M2.. Notice that Continuous has been highlighted; this will provide a list of continuous function blocks available. Selecting Continuous will provide the list of blocks shown in Figure M2.2. The ones that we often use are Transfer Fcn and State- Space. Figure M2. SIMULINK Library Browser.

3 Figure M2.2 SIMULINK Continuous Blocks. Selecting the Sources icon yields the library shown in Figure M2.3. The most commonly used sources are Clock (which is used to generate a time vector), and Step (which generates a step input).

4 SIMULINK Tutorial Figure M2.3 SIMULINK Sources. The Sinks icon from Figure M2. can be selected to reveal the set of sinks icons shown in Figure M2.4. The one that we use most often is the To Workspace icon. A variable passed to this

5 icon is written to a vector in the MATLAB workspace. The default data method shoulb be changed from structure to matrix in order to save data in an appropriate form for plotting. Figure M2.4 SIMULINK Sinks. M2.2 Open-Loop Simulation You now have enough information to generate an open-loop simulation. The Clock, simout, step and Transfer function blocks can be dragged to a model (.mdl) workspace, as shown in Figure M2.5a. Renaming the blocks and variables, and connecting the blocks, results in the model shown in Figure M2.5b. The transfer function studied is the Van de Vusse reactor (Module 5). The s-polynomials in the process transfer function were entered by double-clicking on the transfer function icon and entering the coefficients for the numerator and denominator

6 SIMULINK Tutorial polynomials. Notice also that the default step (used for the step input change) is to step from a value of 0 to a value of at t =. These default values can be changed by double-clicking the step icon. The simulation parameters can be changed by going to the Simulation pull-down menu and modifying the stop time (default = 0) or the integration solver method (default = ode45). Clock simout To Workspace simout To Workspace s+ simout Step Transfer Fcn To Workspace2 a. Placement of function blocks Clock t time u manipulated input step input -.7s+3.472 s 2 +4.6429s+5.382 Transfer Fcn b. Renaming and connection of blocks y measured output Figure M2.5 Development of an Open-loop Simulation. The reader should generate simulations and observe the inverse response behavior of the output with respect to a step input change. Use the subplot command to place the process output (y) on the top plot, and the manipulated input (u) on the bottom plot. Perform this now. If desired, change the default simulation stop time by selecting the parameters pull down menu. M2.3 Feedback Control Simulation The Math icon from Figure M2.2 can be selected, resulting in the functions shown in Figure M2.6. Additional icons can be found by selecting the Simulink Extras icon in Figure M2.. Selecting the Additional Linear icon from this group yields the set of icons in Figure M2.7. The most useful icon here is the PID Controller. Any icon can be dragged into the untitled model workspace. In Figure M2.8 we show the preliminary stage of the construction of a control block diagram, where icons have been dragged from their respective libraries into the untitled model workspace.

Figure M2.6 SIMULINK Math. 7

8 SIMULINK Tutorial Figure M2.7 SIMULINK Additional Linear. The labels (names below each icon) can easily be changed. The default parameters for each icon are changed by double clicking the icon and entering new parameter values. Also, connections can be made between the outputs of one icon and inputs of another. Figure M2.8b shows how the icons from Figure M2.8a have been changed and linked together to form a feedback control block diagram. It should be noted that the form of the PID control law used by the SIMULINK PID Controller icon is not the typical form that we use as process control engineers. The form can be found by double-clicking the icon to reveal the following controller transfer function representation g c ( s) = P+ I s + Ds while we normally deal with the following PID structure

9 g c ( s) = k c + s + s D I so the following values must be entered in the SIMULINK PID Controller P = k c I = k c I D = k c D Clock simout To Workspace simout To Workspace3 simout To Workspace2 Step Sum s+ Transfer Fcn simout To Workspace a. Preliminary Block Diagram Clock t time r setpoint u manipulated step setpoint Sum PID PID Controller -.7s+3.472 s 2 +4.6429s+5.382 Process y output b. Completed Block Diagram, with Name and Parameter Changes Figure M2.8. Block Diagram for Feedback Control of the Van de Vusse CSTR The s-polynomials in the process transfer function were entered by double-clicking on the transfer function and entering the coefficients for the numerator and denominator polynomials. Notice also that the default step (used for the step setpoint change) is to step from a value of 0 to

0 SIMULINK Tutorial a value of at t =. These default values can be changed by double-clicking the step icon. The simulation parameters can be changed by going to the Simulation pull-down menu and modifying the stop time (default = 0) or the integration solver method (default = ode45). The controller tuning parameters of k c =.89 and τ I =.23 are used by entering P =.89 and I =.89/.23 in the default PID Controller block. The following plot commands were used to generate Figure M2.9.» subplot(2,,),plot(t,r,'--',t,y)» xlabel('t (min)')» ylabel('y (mol/l)')» subplot(2,,2),plot(t,u)» xlabel('t (min)')» ylabel('u (min^-)') Figure M2.9. Measured Output and Manipuated Input Responses to a Unit Step Setpoint Change.

This brief tutorial has gotten you started in the world of SIMULINK-based control block diagram simulation. You may now easily compare the effect of different tuning parameters, or different formulations of a PID controller ( ideal vs. real, for example). Let s say you generated responses for a set of tuning parameters that we call case for convenience. You could generate time, input and output vectors for this case by setting:» t = t;» y = y;» u = u; after running the case values. You could then enter case 2 values, run another simulation, and create new vectors» t2 = t;» y2 = y;» u2 = u; then, compare the case and case 2 results by:» subplot(2,,),plot(t,y,t2,y2,'--')» xlabel('t (min)')» ylabel('y (mol/l)')» subplot(2,,2),plot(t,u,t2,u2,'--')» xlabel('t (min)')» ylabel('u (min^-)') which automatically plots case as a solid line and case 2 as a dashed line. Similarly, you could modify the controller type by placing a transfer function block for the controller and using a real PID transfer function (this only differs when there is derivative action). Other Commonly Used Icons Often you will want to simulate the behavior of systems that have time delays. The Transport Delay icon can be selected from the Continuous library shown in Figure M2.2. The transport delay icon is shown in Figure M2.0. Our experience is that simulations can become somewhat flaky if 0 is entered for a transport delay. We recommend that you remove the transport delay block for simulations where no time-delay is involved. Transport Delay

2 SIMULINK Tutorial Figure M2.0. Transport Delay Icon Manipulated variables are often constrained to between minimum (0 flow, for example) and maximum (fully open valve) values. A saturation icon from the Nonlinear library can be used to simulate this behavior. The saturation icon is shown in Figure M2.. Saturation Figure M2.. Saturation Element Actuators (valves) and sensors (measurement devices) often have additional dynamic lags that can be simulated by transfer functions. These can be placed on the block diagram in the same fashion that a transfer function was used to represent the process earlier. It should be noted that icons can be flipped or rotated by selecting the icon and going to the format pull-down menu and selecting Flip Block or Rotate Block. The block diagram of Figure M2.8 has been extended to include the saturation element and transport delay, as shown in Figure M2.2. Clock t time r setpoint u manipulated step setpoint Sum PID PID Controller Saturation -.7s+3.472 s 2 +4.6429s+5.382 Process y output Transport Delay Figure M2.2. Block Diagram with Saturation and Time-Delay Elements The default data method for the to workspace blocks (r,t,u,y in Figure M2.2) must be changed from structure to matrix in order to save data in an appropriate form for plotting.

3 M2.4 Developing Alternative Controller Icons It was noted earlier that the default SIMULINK PID controller block uses a different form than that used by most process engineers. It is easy to generate new PID controller blocks as shown below. The default PID controller icon is shown in Figure M2.3a. This is unmasked to yield the diagram shown in Figure M2.3b. Again, this has the form g c ( s) = P+ I s + Ds while we normally prefer the following PID structure g c ( s) = k c + s + s D I Of course, the two algorithms are related by P = k c I = k c I D = k c D but it would be much less confusing to work with our standard form. PID PID Controller a. Block P Proportional In_ I s Integral Sum Out_ D D du/dt Derivative b. Unmasked Figure M2.3 Default Ideal PID Controller We have generated a new ideal analog PID, as shown in Figure M2.4a. Notice that there are two inputs to the controller, the setpoint and the measured output, rather than just the error signal

4 SIMULINK Tutorial that is the input to the default SIMULINK PID controller. Our new implementation is unmasked in Figure M2.4b to reveal that g c ( s) = k c + s + s D I is the algorithm used. r y PID u Ideal analog PID a. Block r Sum kc kc /taui /taui s Integral Sum u 2 y taud taud du/dt Derivative b. Unmasked Block Figure M2.4 Preferred Implementation of Ideal PID Controller Summary SIMULINK is a very powerful block diagram simulation language. Simple simulations, including the majority of those used as examples in this textbook, can be set-up rapidly (in a matter of minutes). The goal of this module was to provide enough of an introduction to get you started on the development of open- and closed-loop simulations. With experience, the development of these simulations will become second-nature. It is recommended that you perform the simulations shown in this module, as well as the practice exercises, to rapidly acquire these simulation skills. Practice Exercises. Compare step responses of the transfer function and state space models for the Van de Vusse Reactor.

5 a. Transfer function: Perform the open-loop simulation for a step input change from 0 to at t = in Figure M2.5. b. State space: Replace the transfer function block of Figure M2.5 with a state space block. Enter the following matrices in the MATLAB command window. A = 2.4048 0 7 0.574 B = 0.83333 2.238.7 0 [ ] D = [ 0 0] C = 0 Show that the resulting step responses of the transfer function and state space models are identical. 2. Consider the closed-loop SIMULINK diagram for the Van de Vusse reactor (Figure M2.8). Replace the default PID controller with a Real PID controller, as shown below in both the masked and unmasked versions. How do your results compare with ones obtained using the default PID controller? r y Real PID u Real analog PID r 2 y Sum kc kc taui.s+ taui.s Integral taud.s+ alpha*taud.s+ derivative u