# ENGR 058 (Control Theory) Laboratory 2

## System Identification for a Thermal System

In this lab you will learn develop a mathematical model of a thermal system similar to that in your textbook (Fig 2.34, shown at right).   The system will be controlled in a subsequent lab.

## Apparatus

You will need a PC with data acquisition card and software, a signal generator, an oscilloscope, and assorted cables and connectors.  You will also need a hair dryer, a power modulator, a insulation-lined box with a vent cover, and a thermocouple with amplifier (the amplifier yields a signal that is 10mV/°C.  These are all in Hicks 310.  Connect the air hose from the hair dryer to one of the small metal insulation-lined boxes.  Also place a thermocouple into the box so it is away from the walls and plug in the amplifier through a "wall wart" power supply.  Plug the hair dryer into the power modulator (the white cubic box), and plug the modulator into the wall.

Important: the thermocouple amplifier has no "earth ground" and the DAQ system measures relative to earth ground.  The easiest way to fix this is to connect the amplifier output to an oscilloscope (which does have the earth ground) in addition to the DAQ system.  This also makes a convenient way to monitor the box temperature .

## Background

Connect an analog output from the DAQ system to the control terminals of the modulator (black is ground).  An input signal from 0 to 5 Volts will adjust the power supplied to the load plugged into the modulator from 0 to 100%.  Connect the thermocouple to a thermocouple amplifier and connect to an analog input of the DAQ system.  This is shown schematically below

The heater and mixer in the drawing are represented by the power modulator and hair dryer in the physical system.  Air goes into the dryer at room temperature and is heated as it passes through the box.  If we assume the box is well mixed, the output temperature is measured by the thermocouple.  If we take Ti=Ta=0, the transfer function of the system, or plant, from the input of the power modulator to the output of the thermocouple amplifier is given by

where τ is the time constant of the system, and K is the "DC Gain" of the system and is unitless.  As described in your text, τ depends on the flow rate into the box, the thermal capacitance of the system, and the thermal resistance of the box.

The goal of this lab is to find the values of K0 and τ.  This will be a purely empirical measurement - we will not try to relate these quantities to the actual components of the system being tested.  Don't worry about being overly precise, we are looking for ballpark (±10% or so) values.

## Collecting Data

Note: you may want to set the stop time on the data collection to fifteen seconds or so while debugging so you don't have to wait for several minutes between runs.  Also these test runs can be run with the heater set to "cool" so the box doesn't warm up.  Otherwise you should ensure that you let the system come to thermal equilibrium between runs (you can monitor the temperature with the oscilloscope as mentioned previously).  You may want to unscrew and remove the register between runs to cool the system more quickly, but please replace the screws before you leave the lab.

Important: I've found that to get the power amplifiers to work properly you need to have the dryer connected, and the input (control) voltage should be zero when you turn it (the power amplifier) on.

For the actual experiment set the hair dryer to "high".  Set up a Simulink model that sends a step of 3 Volts to the power controller (starting at t=10 seconds) and measures the output of the thermocouple once every second for 5 minutes (including the original 10 seconds).  During this time the register on the top of the box should be closed.  You should get something resembling a first order step response.  Call this the baseline case.  You can collect for less than 5 minutes, but make sure the system comes to equilibrium.

Repeat the baseline case, but open the register at 2.5 minutes.

## Analyzing Data

Modify the data from the baseline case so that the data is in °C.  The thermocouple amplifier has a gain of 10mV/°C.   Use MATLAB to find the values of K0 and τ in the transfer function.

The units of K should be °C/Volt, and τ should be in seconds.  If you are unfamiliar with curve fitting with MATLAB, you may want to refer to a page I wrote for E11 a few years ago, http://www.swarthmore.edu/NatSci/echeeve1/Ref/MatlabCurveFit/MatlabCftool.html, or refer to MATLAB's help documents, or come see me.

If you are interested, you can explore further.  For example for this lab you could look at the system transfer function for different levels of power (i.e., use a 5 Volt input instead of 3 volts..., or 2 Volts), ...or the change in system input with the grate opened and close, ...or try to measure the impulse response, ...or try to verify the frequency response of the system (this will take a long time), ...  what is the time constant of the system as it cools after the damper is opened...

## Report

Strive to be organized.  There is no strict format requirement for this lab and there is no need for a lot of prose (e.g., there is no real "theory" for this lab. Every graph should be numbered (i.e., graph 1, graph 2...) and labeled (with a title, an x-axis label with units, and a y-axis label with units) and should be explicitly referenced in the report; any tables should likewise be numbered and labeled.  There is no need for separate sections for "Introduction," "Theory," or "Procedure...."   (You can simply reference these laboratory instructions within your report (rather than merely repeating what I have already written in a "Procedure section), unless you deviated significantly from these instructions. )

### Include the following in your report:

1. Include any simulink diagrams, including code in code blocks.  Describe any deviations from the procedure described above (10 pts)
2. Show a graph for the baseline case. (10 pts).
3. Include a curve fit for the baseline case and state the values for K0 and τ.  Describe your fitting function and any modifications you had to make to the data. (10 pts)
4. Show a graph for the modified baseline case and note the temperature difference after the damper is opened. (10 pts)
5. Extras - up to 10 pts.

### To Turn In:

Turn in a pdf of your report on the course moodle page.