Lab 1: First Order CT Systems, Blockdiagrams, Introduction

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

Introduction to Simulink Assignment Companion Document

Experiments #6. Convolution and Linear Time Invariant Systems

Lab 4: First/Second Order DT Systems and a Communications Example (Second Draft)

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

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

Introduction to Simulink

ES442 Final Project AM & FM De/Modulation Using SIMULINK

Use of the LTI Viewer and MUX Block in Simulink

Problem Set 1 (Solutions are due Mon )

Experiment 1 Introduction to Simulink

Final Exam. EE313 Signals and Systems. Fall 1999, Prof. Brian L. Evans, Unique No

ECE 203 LAB 2 PRACTICAL FILTER DESIGN & IMPLEMENTATION

EECS 216 Winter 2008 Lab 2: FM Detector Part I: Intro & Pre-lab Assignment

ET 304A Laboratory Tutorial-Circuitmaker For Transient and Frequency Analysis

Lab 2: Introduction to Real Time Workshop

The University of Texas at Austin Dept. of Electrical and Computer Engineering Midterm #2

1. In the command window, type "help conv" and press [enter]. Read the information displayed.

Experiment 1 Introduction to MATLAB and Simulink

Chapter 1 INTRODUCTION TO DIGITAL SIGNAL PROCESSING 1.6 Analog Filters 1.7 Applications of Analog Filters

Class #16: Experiment Matlab and Data Analysis

The University of Texas at Austin Dept. of Electrical and Computer Engineering Final Exam

Chapter 2 Simple Electro-Magnetic Circuits

Operational Amplifiers: Part II

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

Lab 12 Laboratory 12 Data Acquisition Required Special Equipment: 12.1 Objectives 12.2 Introduction 12.3 A/D basics

Lab 3: RC Circuits. Construct circuit 2 in EveryCircuit. Set values for the capacitor and resistor to match those in figure 2 and set the frequency to

LABORATORY 4. Palomar College ENGR210 Spring 2017 ASSIGNED: 3/21/17

Open Loop Frequency Response

C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Circuits & Electronics Spring 2005

Experiment Number 2. Revised: Summer 2013 PLECS RC, RL, and RLC Simulations

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

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

Lecture 2 Review of Signals and Systems: Part 1. EE4900/EE6720 Digital Communications

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

4 Experiment 4: DC Motor Voltage to Speed Transfer Function Estimation by Step Response and Frequency Response (Part 2)

Engineering 3821 Fall Pspice TUTORIAL 1. Prepared by: J. Tobin (Class of 2005) B. Jeyasurya E. Gill

PYKC 13 Feb 2017 EA2.3 Electronics 2 Lecture 8-1

Wireless Communication

332:223 Principles of Electrical Engineering I Laboratory Experiment #2 Title: Function Generators and Oscilloscopes Suggested Equipment:

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

Experiment Number 2. Revised: Fall 2018 PLECS RC, RL, and RLC Simulations

10. Introduction and Chapter Objectives

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

Instruction Manual for Concept Simulators. Signals and Systems. M. J. Roberts

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Lecture 9. Lab 16 System Identification (2 nd or 2 sessions) Lab 17 Proportional Control

2.1 BASIC CONCEPTS Basic Operations on Signals Time Shifting. Figure 2.2 Time shifting of a signal. Time Reversal.

EXPERIMENT 8: LRC CIRCUITS

Experiment 6: Multirate Signal Processing

George Mason University Signals and Systems I Spring 2016

Lab 7 PSpice: Time Domain Analysis

Experiment 8: Sampling

EE 2274 RC and Op Amp Circuit Completed Prior to Coming to Lab. Prelab Part I: RC Circuit

E x p e r i m e n t 3 Characterization of DC Motor: Part 1

COMMUNICATION LABORATORY

ECE503: Digital Filter Design Lecture 9

H represents the value of the transfer function (frequency response) at

Lab 3: Very Brief Introduction to Micro-Cap SPICE

LECTURER NOTE SMJE3163 DSP

EE 470 BIOMEDICAL SIGNALS AND SYSTEMS. Active Learning Exercises Part 2

Motor Control. Suppose we wish to use a microprocessor to control a motor - (or to control the load attached to the motor!) Power supply.

MATLAB Assignment. The Fourier Series

Modelling and Simulation of a DC Motor Drive

EE 422G - Signals and Systems Laboratory

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

Chapter 6 CONTINUOUS-TIME, IMPULSE-MODULATED, AND DISCRETE-TIME SIGNALS. 6.6 Sampling Theorem 6.7 Aliasing 6.8 Interrelations

Midterm 1. Total. Name of Student on Your Left: Name of Student on Your Right: EE 20N: Structure and Interpretation of Signals and Systems

Grid-Connected Full-Bridge Inverter Based on a Novel ZVS SPWM Scheme

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

Laboratory Assignment 1 Sampling Phenomena

Class #8: Experiment Diodes Part I

Experiment 9 AC Circuits

ECE 205 Dynamical Systems Spring

An Interactive Tool for Teaching Transmission Line Concepts. by Keaton Scheible A THESIS. submitted to. Oregon State University.

LAB 1: Familiarity with Laboratory Equipment (_/10)

ENGR 210 Lab 12: Sampling and Aliasing

Filters. Phani Chavali

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

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

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

Lab 8 - INTRODUCTION TO AC CURRENTS AND VOLTAGES

Brief Introduction to Signals & Systems. Phani Chavali

Filter Design, Active Filters & Review. EGR 220, Chapter 14.7, December 14, 2017

Experiment P45: LRC Circuit (Power Amplifier, Voltage Sensor)

Numerical Oscillations in EMTP-Like Programs

Department of Electrical & Computer Engineering Technology. EET 3086C Circuit Analysis Laboratory Experiments. Masood Ejaz

EECS 216 Winter 2008 Lab 2: FM Detector Part II: In-Lab & Post-Lab Assignment

Signals and Systems Using MATLAB

Name: First-Order Response: RC Networks Objective: To gain experience with first-order response of RC circuits

Continuous time and Discrete time Signals and Systems

Basic Signals and Systems

Series and Parallel Resonance

Lab #2 First Order RC Circuits Week of 27 January 2015

A time shift delay or advances the signal in time by a time interval +t 0 or t 0, without changing its shape.

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

ECEGR Lab #8: Introduction to Simulink

ECE 301, final exam of the session of Prof. Chih-Chun Wang Saturday 10:20am 12:20pm, December 20, 2008, STEW 130,

CHAPTER 6 INTRODUCTION TO SYSTEM IDENTIFICATION

Transcription:

ECEN 3300 Linear Systems Spring 2010 1-18-10 P. Mathys Lab 1: First Order CT Systems, Blockdiagrams, Introduction to Simulink 1 Introduction Many continuous time (CT) systems of practical interest can be described in the form of differential equations. One way to represent such systems is in the form of block diagrams. Originally, differential equations were often solved using analog computers that implemented these block diagrams. Nowadays tools, such as Simulink, are used to obtain numerical solutions to differential equations on digital computers, but still based on block diagram descriptions. Thus, it is important to learn how to represent analog circuits in the abstract form of block diagrams and how to obtain results for different CT input signals. 1.1 First Order RC Circuit Consider the following first order RC circuit with input voltage x(t): i(t) R y R (t) x(t) C y C (t) The voltage across the capacitor is y C (t) and the voltage across the resistor is y R (t). From x(t) = y C (t) y R (t) it follows that y R (t) = x(t) y C (t). The current i(t) can be computed as i(t) = x(t) y C(t) = C y (1) C (t), where y(1) C R (t) = dy C(t). dt Thus, the circuit is characterized by the linear differential equation RC y (1) C (t) y C(t) = x(t), with time constant T c = RC, and initial condition y C (0). A convenient way to represent differential equations is in the form of block diagrams that use addition, subtraction, gains (i.e., multiplication by a constant), and integrators. The symbol for an integrator with input x(t), output y(t), and initial condition y(0) at t = 0 is shown in the following figure. 1

x(t) y(t) t y(t) = x(τ) dτ y(0) 0 y(0) To use this as a building block for the representation of differential equations, note that if the output of the integrator is y C (t), then its input (for t > 0) must be y (1) C (t) as shown below. y (1) C (t) y C(t) y(0) But the differential equation RC y (1) C (t) y C(t) = x(t) can be rewritten as y (1) C (t) = 1 RC [x(t) y C(t)]. Using this together with the integral block yields the block diagram x(t) 1 RC y (1) C (t) y C (t) y C (0) This is the block diagram of an analog computer with input x(t) and output y C (t) that can be used to simulate the RC circuit for different values of RC and different initial conditions y C (0). Another way to express this is to say that the analog computer defined by the block diagram solves the differential equation RC y (1) C (t) y C(t) = x(t) for the output variable y C (t). A second variable of interest in the RC circuit is the resistor voltage y R (t). Note that from i(t) = y R(t) R = C y(1) C (t) = y R(t) = RC y (1) C (t). Thus, the same analog computer can be used to simultaneously compute y R (t) and y C (t) as shown in the following block diagram. 2

RC y (1) C (t) y R (t) x(t) 1 RC y (1) C (t) y C (t) y C (0) 1.2 Simulink Simulink is a software package that simulates the bevaior of a dynamic system at successive time instants within a given range. The dynamic system is typically described in the form of a blockdiagram that graphically depicts the relationships between system inputs, outputs, and states. Simulink is closely integrated with Matlab and system parameters, as well as input, output and state sequences, can be easily imported from and exported to Matlab, e.g., to use Matlab s powerful graphing capabilities. Simulink can be used to simulate both continuous time (CT) and discrete time (DT) systems and combinations thereof. The process of solving a model involves computing successive system states depending on the initial state and the input signals, and then to use this data to compute the output signals, all in accordance with the blockdiagram description of the system. For CT systems approximations, such as y((n 1)T s ) = (n1)ts 0 x(τ) dτ y(nt s ) T s x(nt s ), which is based on Euler s forward approximation, need to be used to update the outputs or states y(t) of all integration blocks in a model a time instants spaced T s seconds apart. More sophisticated methods use better approximations for the area under x(t) than the rectangular stripes that Euler s method uses. In this way more precise results can be obtained with the same step size T s, or the simulation time can be reduced by increasing T s and/or choosing it adaptively. To start Simulink click on this icon or type simulink at the Matlab command prompt. This brings up the Simulink Library Browser shown below from which you select and then drag and drop individual blocks to your model window. 3

Most of the blocks needed for ECEN 3300 are in the Commonly Used Blocks library shown in the next figure. Note that the label for the integrator block is 1 s rather than, because of the Laplace transform property t 0 x(τ)dτ 1 s X(s). 4

1.3 Simulink Simulation of a First Order System Start Simulink (type simulink in the Matlab workspace or click on ) to open the Simulink Library Browser. Click on File, then select New and Model and drag the following blocks from the Library Browser into the model window. The Step block is from the Sources library and all other blocks are from the Commonly Used Blocks library. The Sum block is set up for addition of two input signals when it comes from the library. To make it into a subtractor, select the block by clicking on it. Then right-click on it and select Sum Parameters... as shown next. Change the List of signs entry from to - as shown below. 5

To interconnect two blocks, click on the first block to select it, then hold down the Ctrl key and click on the second block. Alternatively, drag a wire from one block to another by holding down the left mouse key while moving the cursor from one connection to the other. The feedforward connections for the first order model are shown in the following figure. To make the feedback connection from the output of the integrator to the subtractor, start a wire from the - input of the subtractor as shown next. 6

Then connect the end of this wire to the wire that runs from the integrator to the scope block. The finished first order block diagram looks like this: Save the model by clicking on File and selecting Save. To run a simulation click on Simulation and select Start as shown in the next figure. 7

Double click on the Scope block to see the result of the simulation as displayed in the following screen snapshot. As expected, the step response at the output of the integrator of a first order system with zero intial conditions is of the form g(t) = A (1 e t/tc, where A is the amplitude and T c is the time constant of the system. To obtain a better Scope picture, right-click on the Scope graph and select Axes Properties.... Change the Y-min and the Y-max values and enter a graph title as shown below. Now the Scope graph looks like this: 8

One thing that is missing in this graph is the input signal from the Step source. To show more than one signal on the Scope, use a Mux (multiplexer) block as shown in the new model below. If necessary, the number of inputs for the Mux block can be increased under Mux Parameters... (select the block, then right click on it). If the model above is simulated with the default parameters, then the result displays as follows on the Scope. 9

To look at the (default) parameters that were actually used in the simulation, click on Simulation and then choose Configuration Parameters. This brings up the window shown below. The default start and stop times are 0.0 and 10.0. The default solver is a variable-step solver that attempts to optimize the tradeoff between speed and accuracy of the solution. The alternative choice is a fixed-step solver which needs to be used for instance to produce results with a specified fixed sampling rate. In either case a numerical integration technique needs to be specified if the system to be modeled contains CT components. The default variable-step solver is ode45 as shown in the above solver window. For fixed-step simulations the default solver is ode3. Both of these work well for most of the systems that will be simulated in ecen3300. 1.4 Displaying Simulation Results in MATLAB One of the problems when working directly in Simulink is that the graphing capabilities of the Scope block are fairly limited. There is a good reason for this, namely the fact that data can be passed very easily from Simulink to MATLAB and therefore any postprocessing and graphing of data from a simuation can make use of the power of MATLAB. To export data from a Simulink model output ports are used like the Out1 block shown in the following augmented version of the first order CT system model. 10

Before running the simulation of this model (with default parameters), check the Data Import/Export settings under Simulation, Configuration Parameters... and make sure the boxes next to Time: tout and Output: yout are checked and the box next to Limit data points to last: 1000 is unchecked (red circle), as shown in the screen snapshot below. Then, after runnung the simulation in Simulink, use the MATLAB commands 11

plot(tout,yout(:,1),.-b,tout,yout(:,2), o-r ) %tout and yout are column vectors %yout has two columns here grid title( Step Response of 1 st order circuit, Gain=1 ) ylim([-0.2,1.2]) xlabel( Time t [sec] ) ylabel( x(t), y(t) ) legend( x(t), y(t),4) to produce the following more informative graph. Step Response of 1 st order circuit, Gain=1 1 0.8 x(t), y(t) 0.6 0.4 0.2 0 x(t) y(t) 0.2 0 1 2 3 4 5 6 7 8 9 10 Time t [sec] Type help plot at the MATLAB command prompt to learn more about making plots in MATLAB and labeling them. As can be seen from the graph, the points (red circles) for which the output was computed by Simulink are quite evenly spaced. If you look at the variables tout and yout in the MATLAB workspace, then you can see that at t = 1 where the step in the input signal occurs there are three samples very close together, one just before and two just after the step. 2 Prelab Questions P1. First Order Step Response. For the differential equation RC y (1) C (t) y C(t) = x(t), with initial condition y C (0), determine y C (t) and y R (t) = RC y (1) C (t) in response to x(t) = A x u(t). Sketch and label y C (t) and y R (t). 12

P2. Block Diagram Using Differentiator. Show how to implement the differential equation RC y (1) C (t) y C(t) = x(t), y R (t) = RC y (1) C (t), in the form of a block diagram that uses only adders, subtractors, gains, and differentiators (d/dt blocks). Show the input x(t) and both outputs, y C (t) and y R (t), in your block diagram. P3. Approximate Differentiator Using Integrator. Show how the following block diagram which uses an integrator can be used as an approximate differentiator (for bandlimited signals). x(t) 1 RC y (1) C (t) y C (t) y C (0) = 0 How does RC have to be chosen and which signal would be used as output? How would you test that the system indeed acts as a differentiator? 3 Lab Experiments E1. Step/Impulse Response in Simulink. The goal of this experiment is to simulate the RC circuit i(t) R y R (t) x(t) C y C (t) for different values of RC and to make plots of the unit step responses of y C (t) and y R (t), and the unit impulse response of y C (t). (a) Build the following model in Simulink: 13

Run this model for RC = 0.1, 1, 10 and make labeled plots of x(t), y C (t), and y R (t) using the MATLAB plot command. The default variable-step solver (ode45) should work fine for this. You may have to change the stop time of the simulation and the time at which the unit step occurs to obtain characteristic graphs. Also make sure to uncheck the Limit data points to last: 1000 option under Simulation, Configuration Parameters... in the Data Import/Export window. From the plots of y C (t) determine the system rise time t r, defined as the time it takes for the unit step response to go from 10% to 90% of its final value. From your observations, can you tell how t r and RC are related? (b) To obtain the unit impulse response h C (t) of the voltage y C (t) across the capacitor, the derivative of the step response can be taken since δ(t) = du(t)/dt and the RC circuit is linear and time-invariant (LTI). The corresponding Simulink model looks as follows. To run a simulation for this model use a fixed-step solver with fixed-step size of 0.01 as shown in the figure below. 14

Note that if RC = 1 then the unit impulse response of y C (t) is the same as the unit step response of y R (t), so the result obtained from this Simulink model can be checked easily. Before you run the simulation, make sure to uncheck the Limit data points to last: 1000 option under Simulation, Configuration Parameters... in the Data Import/Export window. Then plot and label the result of the simulation in Matlab. You may have to adjust the scaling of the graph to obtain meaningful results or use two separate graphs for yout(:,1) and yout(:,2). Try changing the fixed-step size to 0.1 and observe if and how that changes the result. (c) It is tempting to think that it is better to obtain the unit impulse response h C (t) of y C (t) by actually using a unit impulse as input for the simulation. Try the following Simulink model and run it with the same parameters that you used in part(b). Don t be surprised if the result is not quite right. To obtain the correct result, try other fixed-step solvers (e.g., ode5, ode4, etc). Which ones do work, which ones don t? Does 15

the model that you used in (b) show the same sensitivity when you use different fixed-step solvers? What conclusions can you draw? E2. Sinusoidal Response in Simulink. The intent of this experiment is to characterize the RC circuit shown in E1 in terms of its frequency selective behavior. Use the following Simulink model: This is the same model as the one used in E1a, except that the source is now a sinusoidal signal ( Sine Wave from the Sources library). If you run this model with the default settings (variable-step ode45 solver) and the Stop time set to 20.0, then you should obtain a graph in MATLAB (use plot(tout,yout), grid) similar to the one shown below. 16

Note that, for the settings and frequencies used here, it takes about 3-4 seconds before the sinusoidal outputs (especially the one from y R (t)) reach their steady-state values. Thus, when you need to measure the (steady-state) amplitude and phase of y R (t) and y C (t) in response to a sinusoidal input, you need to look at the waveforms after the initial transients have died out. Another thing to observe from the graph above is that even in steady-state the sinusoids don t look very smooth. This is a consequence of the fact that Simulink tries to obtain accurate solution points as quickly as possible and the variable-step solver uses larger time increments between solution points when nothing big happens. To obtain smoother looking plots you can increase the Refine factor (under Simulation, Configuration Parameters... in the Data Import/Export window), e.g., from 1 to 10 as shown in the screen snapshot below. Now, after adding labels and a legend, the graph looks like this: 17

(a) The input signal for the Simulink model shown above is x(t) = sin(ωt). Determine the amplitude and the phase of the sinusoidal steady-state response of y C (t) and y R (t) for RC = 1 and ω = 0.1, 1, 10 rad/sec. To change the frequency of the Sine Wave source, doubleclick on it and then enter the value (in rad/sec) in the dialog box under Parameters and Frequency. To measure the phase shift of y C (t) and y R (t) with respect to x(t), determine the fraction of a whole period by which the output signal is delayed or advanced. You may have to adjust the Stop time of the simulation to obtain characteristic plots of the steady-state response. Based on your measurements, which of the outputs acts as highpass filter (HPF) and which acts as lowpass filter (LPF)? How can you tell from your sinusoidal steady-state response measurements that this is a first order system? (b) The Simulink model shown below was used to obtain the responses y C (t) and y R (t) of the RC circuit to a composite input signal x(t). 18

The results of the simulation are shown in the following plot. 1.5 Simulation of RC Circuit with Composite Input Signal 1 0.5 y R (t) 0 0.5 1 1.5 0 1 2 3 4 5 6 7 8 9 10 t [sec] 1.5 1 0.5 y C (t) 0 0.5 1 1.5 0 1 2 3 4 5 6 7 8 9 10 t [sec] Determine the source and the gain K that was used for the simulation. Recreate the simulation and make a labeled plot of the signal x(t). Is the solution unique? Explain your approach! E3. Approximate Differentiator from Integrator. Use the following blockdiagram and your solution from prelab problem 3 to set up the Simulink model of an approximate differentiator made from an integrator block. 19

x(t) 1 RC y (1) C (t) y C (t) y C (0) = 0 Your differentiator has to be essentially perfect for signals with frequencies of 10 rad/sec or less and the gain at 10 rad/sec must be equal to 1. Show your Simulink model and explain your design methodology. Explain how you tested your model and how you made sure that it satisfies the design requirements. What is the largest frequency for which your differentiator makes an error of no more than about 10%? Specify the criteria that you used. c 2002 2010, P. Mathys. Last revised: 01-20-10, PM. 20