ELEC 4632 Lab Report
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ELEC 4653Computer Controlled System
Lab Report
Introduction
This series of experiments are inspired by the desire to control a water tank system which consists of two cylinders
connected in series. Water is pumped
from the water tank at the bottom into
Cylinder 1, which is the control input,
and allowed to flow into Cylinder 2, as
shown in Figure 1. The outflow of
water is controlled by the taps at the
bottom of both cylinders. Such system
can be commonly found in chemical
processes.
The aim of this experiment is to control
the inflow of water into Cylinder 1 and
outflow using digital control techniques,
such that the water level in Cylinder 2
is maintained at some set-point.
Figure 1– Water tank system In order to achieve the above aim, a model is obtained to relate the flow rates out of each cylinder and between both cylinders, to the water levels in each cylinder. A controller is then implemented using RTAI in C programming language.
The labs are designed in such a way to progressively develop the digital controller to accomplish the aim. The schedule of the labs issummarised in Table 1.
Labs Content
Lab 1 Introduction to system identification using least square
method
Lab 2 System identification of water tank system.
Lab 3 Simulation and control of water tank using pole placement
techniques
Lab 4 Experimental validation of designed controllers and observers
Lab 5 Design andimplement a PI controller
Table 1– Lab schedule.
Chapter 1Lab 1
This lab is designed to introduce the idea of system identification by performing least square method on a set of data provided to us. The simulated output is then compared with the actual output in order to verify the validity of the model. A good model should imitate the actual system as accurate as possible.
2.1 Experimental procedures
(1)Study the supporting materials on least square estimation method.
(2)Use the first half of the data set to perform least square estimation for a
second order system and verify it with the second half.
(3)Repeat Step (2) for a third order system.
(4)Comment on the recorded results and observation made during Step (2) and
(3).
2.2 Theory background
A parametric approach to system identification would be to obtain a transfer
functionfor a particular system which takes the following form:
H(z)=Y(z)
U(z)
=
a m z m+ a m−1z m−1+ …+a1z+a0
z n+ b n−1z n−1+ …+b1z+ b0
where a m and b n are parameters for the system being identified. The numbers of poles and zeros are specified by n and m respectively. The main objective for least square method is to obtain estimations for those parameters by minimisingthe sum of square errors (SSE). For a second order system that we need to model in this experiment, the difference equation takes the following form:
y(k+1)=a1y(k)+ a2y(k−1)+ b1u(k)+ b2u(k−1)
In matrix representation, the above equation can be rewritten as Y= Φp, where
Y=(y(3) y(4)⋮
y(N)
)
Φ=(
y(2)y(1)u(2)u(1)
y(3)y(2)u(3)u(2)
⋮
y(N−1)
⋮
y(N−2)
⋮
u(N−1)
⋮
u(N−2)
)
p=(
a1
a2
b1
b2
)
Since the estimation may not be exact,we need to include an error term ε in the estimation, that is Y = Φp + ε. Let us introduce a cost function J which is defined as the following:
J = εT ε=(Y − Φp )T (Y − Φp )= Y T Y −2p T ΦT Y +p T ΦT Φp
In order to find the minimum value of J , we let ðJ
ðp =0. We then have
−2ΦT Y +2ΦT Φp =0 p =(ΦT Φ)−1ΦT Y
2.3Experiment results
(1) First order system:
In the case of a first order system, the system parameters are obtained as shown in Figure 2.
Figure 4 shows the plot of both the actual and simulated outputs for a first order least square estimation.
Figure 2 – Parameters for first order system Figure 3 – MSE for first order estimation Figure 4 – Plot of first order least square estimation
The mean square error (MSE) of the simulation is illustrated in Figure 3. (2) Second order system:
For a second order system, the parameters are calculated as in Figure 5.
The graph (Figure 7) below shows the plot of a second order least square estimation.
The MSE in this case is indicated by Figure 6.
(3) Third order system:
The parameters for a third order transfer function is shown by the following figure (Figure 8
). Figure 5 – Parameters for second order system Figure 6 –MSE for second order estimation Figure 7 – Second order least square estimation
The results for the third order least square estimation are depicted in Figure 10.
Figure 9 shows the MSE of the estimation for the third order system.
2.4Comments
From the experiment results shown above, one can see that least square method provides us with a good way to estimate the parameters of an unknown system. Among the three estimations made during this experiment, the MSEs are all very small, particularly the case of third order system. This indicates that the accuracy of the estimation increases withincreasingsystem order, since there are more parameters to represent the unknown system more completely. However, the order of the estimated system should not be allowed to be too high because of the
fact that systems with higher orders are more difficult to be implemented and are
Figure 8 – Parameters for third order system Figure 9 – MSE for third order estimation Figure 10 – Third order least square estimation
to instability. There is a compromise between the order of the system and the accuracy of estimation. In this experiment, we suggest the second order model to be used to represent the unknown system since its error performance is good enough.
Chapter 2Lab 2
This lab is designated to model a real water tank system using data collected from it and least square method performed in Lab 1. The control input is the voltage applied to the pump which pours water into Tank 1, while the output is the water level in Tank 1.
3.1 Experimental procedures
(1)Find the linear range of the water tank system. The overall system is
non-linear. However, there exist some ranges where the behaviors of the
system can be approximated by a linear model. This is achieved in a
trial-and-error manner.
Start by applying a voltage V min=1.5V to the system and changing
thepositions of the taps and input voltage levels until a relatively stable water
level is obtained within the range of 30−50 mL. Then, apply V max=4V to
thesystem and progressively change this voltage until the water level stays
relatively constant within the range of 250−280 mL. Note that, try not to
change the position of the taps which are set previously since a change will
have to be verified again for whether the water level stays within the desire
range. The input to the system is binary which can be determined using the
following formulae:
V=D−2047.5 2047.5
D=2047.5V+2047.5
where V is the input voltage in volts and D is the equivalent binary value of the voltage level V.
(2)Modify the supplied code in the following way:
(a)Determine the input offset voltage using the formula
V o=V max−V min
2
+V min
(b)Select a range of reference voltage levels in such a way that
V min ≤ref[i]+V o≤V max∀ i ∈{1,2,…,6}.
(3)Compile the source files using theMakefile supplied and start recording data
for the water tank system. The data will be stored in a text file named Log.txt.
(4)Perform system identification similar to what we have done in Lab 1 using
MATLAB.
3.2 Experiment results
(1)First order system:
In the first order least square estimation, parameters for the transfer function are obtained as in Figure 1.
Figure 1–Parameters obtained from first order least square
estimation and the associated MSE
The results of the estimation are depicted in Figure 2.
Figure 2– Plot of both actual and estimated output of the water tank system The mean square error (MSE) of the estimation is then calculated as in Figure 1.
(2) Second order system:
The second order least square estimation yields the following parameters (Figure 3) for the system’s transfer function.
The following figure (Figure 4) shows the plot of the estimated results.
The MSE of this estimation is indicated by Figure 3.
(3)
Third order system:
Figure 3 – Parameters obtained from second order least square estimation and the associated MSE
Figure 4 –Plot of both actual and estimated output of the water tank system
For the third order least square estimation, the following set of parameters is obtained as in Figure 5.
Figure 5– Parameters obtained from third order least square estimation and the associated MSE
The following figure (Figure 6) shows the comparison between the actual and estimated outputs.
Figure 6–Plot of both actual and estimated output of the water tank system The MSE for this estimation is shown in Figure 5.
3.3 Comments
During this experiment, three least square estimations of different orders are performed in order to identify the water tank system. The above results again suggest the fact that least square with higher order produces more accurate estimation as there are more parameters to characterise the system. The third order system yields the least MSE amongst the three estimations performed. Although the third order system outperforms in terms of the MSE criteria, a second order system is good enough to represent the water tank system with small enough errors.
11。