Quanser Lab Model Ident
Quanser Lab Model Ident
1 Objective
Perform system identification on the heatflow experiment and design a controller in the frequency
domain to control the air temperature at selected points in a duct using a heating element and a
blower.
This heat-flow experiment (HFE) system consist of a duct equipped with a heater and a blower at
one end and three temperature sensors located along the duct. The power delivered to the heater is
controlled using an analog signal. The fan speed can also be controlled using an analog signal. Fast
settling platinum temperature transducers are used to measure the temperature. Fan speed is
measured using a tachometer and can be used to design speed controllers.
A complete thermodynamic model of the system is difficult to derive. In principle however the following equation applies:
Where
Tn Temperature at Sensor n
Ta Ambient temperature
This experiment is aimed at introducing you to the system in order to gain insight into the salient issues. You will develop a
very simple first order model and an associated controller. In subsequent experiments you will investigate system
identification techniques and control of systems with time delay.
In the first experiment, we developed an open loop model by examining the step response of the system. In this
experiment, we shall investigate the use of system identification techniques to develop a higher order model and use it to
design feedback controller. Note that we have 5Hz low pass filters to remove some of the noise in the sensors.
ADC T1
Heat
Select Quanser Consulting 2*pi*5
20
MQ3 ADC s+2*pi*5
Subsystem Temp/Volts2 Transfer Fcn1 T1
1200
VF1
Multiport
VF -K- Switch1
VF Speed
In1 Out1
Min
Start Matlab
Change the directory where you have the FHE models
In Matlab type random_input - This opens the simulink model shown in Figure 2
In random_input.mdl Click WinCon / Set WinCon Options - This sets the compile for the OS you have.
In random_input.mdl Click WinCon / Set WinCon Options - This sets the compile for the OS you have.
In Matlab run setup_random - This initializes parameters so you can compile the diagram- It also sets up the
random sequence to be applied to the heater
In the diagram click WinCon/ Build - this will build the realtime code and download to WinCon
In WinCon click on Plot / New / Scope and select T0, T1 T2
In the WinCon plot, select Update/ Buffer and enter 60
Click run - this will run the controller for 240 seconds. (4 minutes!)
When the run is complete , you will see the last 60 seconds of data in the WinCon plot. Click File/ save and save
as a mat file in the file named : data_rand1.mat
Now that the data is saved you can load into Matlab
60
50
40 Temp S1
VQ
30
20
10
0
0 20 40 60
Figure 3 Response of T1 to random input VQ. Note that the data
is collected after running the experiment for 4 minutes in order to
remove trends.
3.2 Model estimation
Now that the data is saved, you can run the script id_freq.m - This script loads the data that was collected and uses pem (
Prediction error estimate - See Matlab System Identification toolbox) to create a best fit linear model of the system.
1
Temperature - S1
-1
-2
-3
30 35 40 45 50 55 60 65
Figure 4 shows the actual data versus data from the estimated model parameters.
6
Amplitude
0 5 10 15
Time (sec)
The estimated open loop transfer function ( for S1) is obtained as:
4 Control System Design
We design controller in the frequency domain. Clearly we require an integrator in the loop in order to obtain zero steady
state error.
The design file d_freq uses the estimated parameters and prompts the user for gain and phase lead values to design an
appropriate compensator. (The values in parentheses are the recommended values to enter)
5 Setting up
Wire up the system as described below. Use single RCA cables for each connection.
Vb - Voltage to blower MultiQ D/A # 1 - Control fan speed ( open loop) 0 - 5 VDC
The controller is implemented using WinCon and Simulink. The Simulink controller is in the file q_hfe_freq.mdl The
controller measures the voltages from the three sensors and calibrates them to degrees. The feedback controller
implements the equation.
Note that we have also added a feedforward component Vff which pre-computes the steady state voltage required for the
desired heat. The value of Vff is obtained as follows:
The steady state gain is G_ss = 1.7/ 0.2 = 8.5 deg/volt. That means that in the steady state, in order to maintain 8.5 deg
change from the nominal value we need 1 volt applied to the heater. We can use this gain to predict the steady state value
required to maintain the desired temperature.
Depending on the value of the selector (Constant named Sensor in the diagram), we will control one of the three points
along the duct. Note that we are also running a realtime simulation of the system modeled as obtained from the PEM
estimator.
By setting Sensor = 1, we control T1 and make it track a square wave of 5 deg p-p centered about 40 degrees. The
response is shown in Figure 7.
1 The output tracks the desired temperature command with zero steady state error
2 The transient response matches the simulation closely
40
Constant -K-
TCmd
FeedForward
Signal
Generator 1 -n
s d(s)
Integrator Transfer Fcn1
1
Saturation2
COMPENSATOR
Sensor
T1
T1
Heater T2
T3 T2
Quanser Consulting
VFS
MQ3 DAC
Heater and Sensors Multiport
Fan Speed Saturation1
Switch
T3
Analog Output1
COMPENSATOR
1 -n
s d(s)
Integrator1 Transfer Fcn2
n_ol(s) Saturation3
d_ol(s)
Transfer Fcn TSim
SIMULATION OF SYSTEM
Figure 6 Feedback controller with frequency domain designed compensator. Note a simulation of the system is running in
tandem.
45
Command Deg.
44 S1 - Deg
Simulation Deg.
43
42
41
40
39
38
37
36
0 10 20 30 40 50 60
We can easily examine the system response if we try to control the temperature at S3. We do this by setting Sensor = 3 in
the diagram and running it again. In this case the response is shown in Figure 8. We note that the performance
deteriorates, primarily due to the transport delay in the system.
45
Command
44 S3
Simulation
43
42
TEMP - DEG C
41
40
39
38
37
36
0 10 20 30 40 50 60
TIME
3 Conclusions
The system identification technique results in a good model that can be used to design a frequency domain compensator.
The actual system response closely matches the predicted response from the estimated model. Closing the loop at S3
using the controller designed for S1, although inferior, still has acceptable performance.
4 System Parameters
Analog inputs 4 0 - 5 V DC
Analog outputs 2 0 - 5 V DC
5 Calibration
Occasionally you may need to calibrate the sensor measurements. You will need a measurement of ambient temperature
and a DC Voltmeter. (Or you can use WinCon)
The table below shows the voltages you should obtain at various temperatures:
Temp 19 20 21 22 23 24 25 26 27 28 29 30
Vs 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50