ECE411 - Laboratory Exercise #1

Similar documents
Lab 1: Simulating Control Systems with Simulink and MATLAB

Experiment 1 Introduction to MATLAB and Simulink

EEL 4350 Principles of Communication Project 2 Due Tuesday, February 10 at the Beginning of Class

Introduction to Simulink Assignment Companion Document

Experiment 1 Introduction to Simulink

ELG3311: EXPERIMENT 2 Simulation of a Transformer Performance

Memorial University of Newfoundland Faculty of Engineering and Applied Science. Lab Manual

ENSC327 Communication Systems Fall 2011 Assignment #1 Due Wednesday, Sept. 28, 4:00 pm

Tutorial on IMCTUNE Software

Introduction to Modeling of Switched Mode Power Converters Using MATLAB and Simulink

Figure C-1 (p. 907) MATLAB window showing how to access Simulink. The Simulink Library Browser button is shown circled.

Introduction to Simulink

Modelling and Simulation of a DC Motor Drive

E x p e r i m e n t 2 S i m u l a t i o n a n d R e a l - t i m e I m p l e m e n t a t i o n o f a S w i t c h - m o d e D C C o n v e r t e r

Root Locus Design. by Martin Hagan revised by Trevor Eckert 1 OBJECTIVE

Here are some of Matlab s complex number operators: conj Complex conjugate abs Magnitude. Angle (or phase) in radians

1 Introduction and Overview

Lab 2: Introduction to Real Time Workshop

Rotary Motion Servo Plant: SRV02. Rotary Experiment #02: Position Control. SRV02 Position Control using QuaRC. Student Manual

DSP First. Laboratory Exercise #2. Introduction to Complex Exponentials

SIGNALS AND SYSTEMS: 3C1 LABORATORY 1. 1 Dr. David Corrigan Electronic and Electrical Engineering Dept.

Signal Processing First Lab 02: Introduction to Complex Exponentials Multipath. x(t) = A cos(ωt + φ) = Re{Ae jφ e jωt }

Rotary Motion Servo Plant: SRV02. Rotary Experiment #03: Speed Control. SRV02 Speed Control using QuaRC. Student Manual

Designing PID for Disturbance Rejection

Signal Processing First Lab 02: Introduction to Complex Exponentials Direction Finding. x(t) = A cos(ωt + φ) = Re{Ae jφ e jωt }

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering. EIE2106 Signal and System Analysis Lab 2 Fourier series

SIMULINK for Process Control

SRV02-Series Rotary Experiment # 3. Ball & Beam. Student Handout

Nonlinear Control(FRTN05)

Matlab for CS6320 Beginners

1 PeZ: Introduction. 1.1 Controls for PeZ using pezdemo. Lab 15b: FIR Filter Design and PeZ: The z, n, and O! Domains

GE420 Laboratory Assignment 8 Positioning Control of a Motor Using PD, PID, and Hybrid Control

Signal Processing Blockset

Laboratory set-up for Real-Time study of Electric Drives with Integrated Interfaces for Test and Measurement

Fourier Signal Analysis

Lab 1: Steady State Error and Step Response MAE 433, Spring 2012

C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

Equipment and materials from stockroom:! DC Permanent-magnet Motor (If you can, get the same motor you used last time.)! Dual Power Amp!

MTE 360 Automatic Control Systems University of Waterloo, Department of Mechanical & Mechatronics Engineering

1 Introduction and Overview

UNIVERSITY OF UTAH ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT

Virtual Measurement System MATLAB GUI Documentation

GE U111 HTT&TL, Lab 1: The Speed of Sound in Air, Acoustic Distance Measurement & Basic Concepts in MATLAB

COMMUNICATION LABORATORY

Problem Set 1 (Solutions are due Mon )

Wireless Communication Systems Laboratory Lab#1: An introduction to basic digital baseband communication through MATLAB simulation Objective

EE 482 : CONTROL SYSTEMS Lab Manual

ISET Selecting a Color Conversion Matrix

Design of a Simulink-Based Control Workstation for Mobile Wheeled Vehicles with Variable-Velocity Differential Motor Drives

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Lab P-3: Introduction to Complex Exponentials Direction Finding. zvect( [ 1+j, j, 3-4*j, exp(j*pi), exp(2j*pi/3) ] )

ECE 2713 Homework 7 DUE: 05/1/2018, 11:59 PM

A Guide to Design MIMO Controllers for Architectures

EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID Controller Fall Lab Information

Lab 3 SPECTRUM ANALYSIS OF THE PERIODIC RECTANGULAR AND TRIANGULAR SIGNALS 3.A. OBJECTIVES 3.B. THEORY

Use of the LTI Viewer and MUX Block in Simulink

Lab 2, Analysis and Design of PID

Introduction to MATLAB and the DIPimage toolbox 1

MATLAB Assignment. The Fourier Series

RF Blockset For Use with Simulink

Linear Motion Servo Plants: IP01 or IP02. Linear Experiment #0: Integration with WinCon. IP01 and IP02. Student Handout

MATLAB 6.5 Image Processing Toolbox Tutorial

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Lab 8: Frequency Response and Filtering

Lab S-4: Convolution & FIR Filters. Please read through the information below prior to attending your lab.

Answers to Problems of Chapter 4

######################################################################

Ohm s Law. Air Washington Electronics ~ Direct Current Lab

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

DSP First Lab 08: Frequency Response: Bandpass and Nulling Filters

SIGNALS AND SYSTEMS LABORATORY 3: Construction of Signals in MATLAB

LABREG SOFTWARE FOR IDENTIFICATION AND CONTROL OF REAL PROCESSES IN MATLAB

Digital Control of MS-150 Modular Position Servo System

CHAPTER 6 UNIT VECTOR GENERATION FOR DETECTING VOLTAGE ANGLE

The Formula for Sinusoidal Signals

Experiment 1.A. Working with Lab Equipment. ECEN 2270 Electronics Design Laboratory 1

DFT: Discrete Fourier Transform & Linear Signal Processing

EE 461 Experiment #1 Digital Control of DC Servomotor

Tech Note #3: Setting up a Servo Axis For Closed Loop Position Control Application note by Tim McIntosh September 10, 2001

LAB II. INTRODUCTION TO LABVIEW

Lab 8. Signal Analysis Using Matlab Simulink

ES442 Final Project AM & FM De/Modulation Using SIMULINK

ME 360: FUNDAMENTALS OF SIGNAL PROCESSING, INSTRUMENTATION AND CONTROL Speed Control of a DC Electric Motor

SMS045 - DSP Systems in Practice. Lab 1 - Filter Design and Evaluation in MATLAB Due date: Thursday Nov 13, 2003

Compulsory Exercise no. 1 Deadline: 1 May 2014

Notes on Experiment #1

Digital Signal Processing Laboratory 1: Discrete Time Signals with MATLAB

Basic Signals and Systems

Instruction Manual. Mark Deimund, Zuyi (Jacky) Huang, Juergen Hahn

Reference Manual SPECTRUM. Signal Processing for Experimental Chemistry Teaching and Research / University of Maryland

1. An Introduction to Transient Stability

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, February 8

CHAPTER 3 WAVELET TRANSFORM BASED CONTROLLER FOR INDUCTION MOTOR DRIVES

Design of Compensator for Dynamical System

Practical Assignment 1: Arduino interface with Simulink

MATLAB: SIGNAL PROCESSING

Class #16: Experiment Matlab and Data Analysis

5 Lab 5: Position Control Systems - Week 2

Digital Video and Audio Processing. Winter term 2002/ 2003 Computer-based exercises

EE477 Digital Signal Processing Laboratory Exercise #13

Transcription:

ECE411 - Laboratory Exercise #1 Introduction to Matlab/Simulink This laboratory exercise is intended to provide a tutorial introduction to Matlab/Simulink. Simulink is a Matlab toolbox for analysis/simulation of interconnections of dynamic systems. The model building environment is GUI based, and it will be used heavily throughout the rest of the course/laboratory. All the exercises in this assignment can be done entirely in Matlab/Simulink. 1) Running, Plotting, Printing: In order to see a demonstration Simulink diagram type sldemo househeat at the Matlab prompt. Open the scope block, labeled PlotResults by double clicking, and then run the simulation using the buttons or pull down menus provided. Print the plot of the simulation output (scope block) and print the simulation model itself. 2) Model Building: Figure 1 shows a Simulink model which represents the motor gear system in the Controls Laboratory, with a PID controller implemented in feedback around it. Launch the simulink library browser from within Matlab by using the button or typing simulink. Then open a new model (using button or pull down menus), and build a copy of the above model. This is achieved by dragging components from the library to the model and connecting them using the mouse. Double clicking a box then allows you to edit the contents, such as entering values for the transfer function (as shown). For the PID block set the proportional gain to 0.05, and the integral and derivative gains to zero. Look around at the (many) available blocks in Simulink. You will certainly need to look in Sources, Sinks, Continuous, Math Operations and Signal Routing. Note that there is no block for Pulse Input, but I made that myself from basic components using the Create Subsystem from Selection command after selecting a section of the diagram and right-clicking. The contents of the box are shown in figure 2. You can even use the Mask/Create Mask command (again select and right-click) to take a subsystem and use it to make your own custom library blocks (with GUI interfaces for the parameters). When you have built a copy of the model save it with the name gear (it will actually be saved as gear.slx). You can then launch this model later from Matlab simply by typing gear at the command line. Go under Simulation to Model Configuration Parameters and set the simulation time to 8 seconds. Then run the simulation and print the results from the scope block. You should get a plot like figure 3 which shows the commanded response and the actual system response (note the autoscale and zoom buttons on the scope). Of course note that in order to get the correct commanded response you will need to enter appropriate values for the two step input blocks that make up your pulse input.

Out1 Pulse Input Sum PID PID Controller 1710 s 2+2.2s Transfer Fcn Mux Scope Figure 1: Simulink model of motor gear drive system Step1 Sum1 1 Out1 Step2 Figure 2: Simulink pulse input subsystem Having completed this exercise you should have a model and a simulation run that essentially reproduce the figures shown here. Now try varying the parameters of the PID controller and see how they affect the closed-loop control system (note that you can enter variable names in Simulink Blocks if you like, and it will read them from the Matlab workspace). In particular carry out the following simulation studies: i) Vary the Proportional gain up and down and note the effect. ii) Now try adding in the Integral and/or Derivative gains. You do not need to generate large numbers of plots but plot a few of the results and discuss how the different controller parameters (Proportional, Integral, and Derivative) affect the closed loop performance. iii) See if you can manually tune the PID controller to get a good step response. iv) See how well your controller rejects disturbances by adding a disturbance signal between the controller and the plant (just use a summing junction to add your disturbance signal to the output of the PID controller). v) See how sensitive your closed loop system is to modeling errors by perturbing the open loop plant model (i.e., change the Transfer Function parameters).

7000 6000 5000 4000 3000 2000 1000 0 1000 2000 3000 0 1 2 3 4 5 6 7 8 Time offset: 0 Figure 3: Scope block output from simulation These trial-and-error simulation studies should give you some ideas about how the closedloop control is working. Later in the semester we will revisit this problem with the systematic analysis and design tools we have learned in class, and try them out both in simulation (as here) and on the actual hardware system in the laboratory. In addition to the above studies you can find more Matlab/Simulink examples by typing demo. Further information is also available at the following Websites: https://www.mathworks.com/help/index.html http://ctms.engin.umich.edu/ctms/index.php?aux=home The Mathworks Website is a general reference site for Matlab/Simulink and their various toolboxes. The second Website is specifically designed as a tutorial introduction to Control System analysis and design using Matlab and Simulink.

APPENDIX: Introduction to Matlab This material is NOT required Included only as an OPTIONAL tutorial This material is intended to provide a tutorial review of Matlab, which will be used throughout the rest of the course. It will NOT be graded. 1) Vectors and Matrices: Data entry in Matlab is achieved by separating columns of matrices by spaces, and rows of matrices by semi colons. Thus in order to enter the matrix [ ] 1 3 7 a = 2 5 6 one would type a = [1 3 7; 2 5 6] Having defined matrices then one can compute algebraic manipulations of them easily in Matlab. Matlab provides a wealth of matrix functions, each of which has online help to describe their operation. Type the following commands to learn about the functions and then carry out the exercises below: help arith help inv help eig You can also browse the available help by typing helpwin. Look around in the directories general, ops, lang, elmat, elfun, and matfun to familiarize yourself with what is available in Matlab. Of course we will not be using all of the available tools, but some we will use heavily, and you will build your understanding of Matlab as the course progresses. Enter the following matrices (the imaginary number j = 1 is recognized in Matlab): [ ] 1 3 7 a = 2 5 6 c = b = 4 7 9 8 1 3 1 1 1 1 j 1 + j 3 2 4j 8 + 3j 6j 0 0 7

Now compute the following quantities: i) bc ii) b 1 c iii) ab iv) b + c v) ba T (where a T denotes the transpose of a) vi) The eigenvalues of b vii) The eigenvalues of c You may find the following commands useful help diary help save help load 2) Polynomials: Matlab facilitates easy manipulation of polynomials, by storing the coefficients as vectors. The polynomial would be stored as the vector s 3 + 3s 2 7s + 8 p = [1 3 7 8] Evaluating the polynomial and calculating the roots is then straightforward in Matlab. Type the commands help polyval help roots and look in helpwin under polyfun. Then carry out the following exercises: i) Evaluate s 3 + 2s 2 + 4s 8 for s = 1 ii) Evaluate s 3 + 2s 2 + 4s 8 for s = 2 4j iii) Evaluate s 3 + 4s for s = 2j iv) Compute the roots of 2s 3 3s 2 + 6s + 7 iv) Compute the roots of s 3 12s 2 v) Compute all the cube roots of 1

3) Plotting and Printing: Matlab has an array of commands for plotting, labeling/editing plots, and printing. Type the following commands: help plot help print Note that there are See also commands suggested at the end of every help menu. You can also look in helpwin under graph2d (and others). As a simple example the following series of commands generates a plot of a cosine wave: t = 0:0.01:2*pi; y = cos(t); plot(t,y); title( Plot of a cosine wave ); Note the first line is used to automatically generate a time vector (see also linspace and logspace). The semicolons keep the commands silent. Generate and print plots of the following functions. Please include titles and axis labels. i) sin 2 (t) cos(3t) for 0 t 2π ii) t 3 3t 2 2t for 0 t 5 4) Scripts and Functions: Any collection of Matlab commands can be gathered together as a script, saved in an m-file. For instance save the following commands in a text file called plotit.m numhar = 5; numpoints = 300; t = linspace(0,2*pi,numpoints); y = zeros(1,numpoints); for ii = 1:numhar y = y + ((-1) (ii+1))*(1/(2*ii-1))*cos((2*ii-1)*t); end plot(t,y) title( Harmonic decomposition of a square wave )

You can then run this straight from Matlab (just type plotit) to build a square wave from its harmonics and plot it. The formulae for the harmonic series coefficients comes from the Fourier Series expansion (verify that). Note that this is a script in that all the variables exist in the workspace. You can also write subroutines, which use local variables. Type help function to see the syntax for doing this. Carry out the following programming tasks: i) Write a function from the above script to generate and plot a square wave from its harmonics. The inputs should include the number of harmonics and number of points. The outputs should include the time and amplitude vectors for the square wave. Plot the wave for various values. Can you see Gibb s phenomenon when the number of harmonics is large? ii) Write a function which gives back the sum of the squares of the absolute values of the elements of a matrix, i.e., it evaluates the function f = n m a ij 2 i=1 j=1 for any n m matrix a. Test your routine on the matrices a, b, c from question 1).