Professional Documents
Culture Documents
ENG325 Lab2 s232953 Report
ENG325 Lab2 s232953 Report
Mark Cruickshank
Student ID
S232953
Lab2 Modelling of a liquid level control system in the frequency domain
Assessment Title
Unit Number and Title
Lecturer/Tutor
Damien Hill
Date Submitted
14/5/2015
Date Received
Office use only
KEEP A COPY
Please be sure to make a copy of your work. If you have submitted assessment work electronically make
sure you have a backup copy.
PLAGIARISM
Plagiarism is the presentation of the work of another without acknowledgement. Students may use a limited
amount of information and ideas expressed by others but this use must be identified by appropriate
referencing.
CONSEQUENCES OF PLAGIARISM
Plagiarism is misconduct as defined under the Student Conduct By-Laws. The penalties associated with
plagiarism are designed to impose sanctions on offenders that reflect the seriousness of the Universitys
commitment to academic integrity.
I declare that all material in this assessment is my own work except where there is a clear
acknowledgement and reference to the work of others. I have read the Universitys
Academic and Scientific Misconduct Policy and understand its implications.*
http://www.cdu.edu.au/governance/documents/3.3academicandscientificmisconduct.doc.
Date: 14/5/2015
* By submitting this assignment and cover sheet electronically, in whatever form you are deemed to have made the declaration set out
above.
Mark Cruickshank
S232953
!
Table!of!Contents!
1.!Task!1!!Data!Acquisition ..................................................................................................... 4!
2.!Task!2!!Matlab!Analysis ...................................................................................................... 4!
2.1!Input!and!output!to!the!system!at!0.05!rad/sec. .................................................................................................... 4!
2.2!Input!and!output!to!the!system!at!0.1!rad/sec........................................................................................................ 5!
2.3!Input!and!output!to!the!system!at!0.2!rad/sec........................................................................................................ 5!
2.4!Input!and!output!to!the!system!at!0.5!rad/sec........................................................................................................ 6!
2.5!Input!and!output!to!the!system!at!1!rad/sec. .......................................................................................................... 6!
2.6!Input!and!output!to!the!system!at!2!rad/sec. .......................................................................................................... 7!
2.7!Input!and!output!to!the!system!at!5!rad/sec. .......................................................................................................... 7!
2.8!Input!and!output!to!the!system!at!10!rad/sec......................................................................................................... 8!
Table!2.9!@!Time!periods!between!peaks .......................................................................................................................... 8!
Table!2.10!!Results!of!task!2................................................................................................................................................. 9!
3.!Task!3!!Bode!Plot ................................................................................................................ 9!
3.1!Bode!plot!!magnitude!and!phase................................................................................................................................. 9!
4.!Task!4!!System!Identification ............................................................................................ 10!
Table!4.1!!Results!of!task!4................................................................................................................................................. 11!
4.2!!Plot!of!the!model!of!the!system ............................................................................................................................... 12!
4.3!!Plot!of!model!of!the!system!with!Matlab............................................................................................................. 12!
4.4!Residuals!from!Matlabs!model!fitting ..................................................................................................................... 13!
5.!Task!5!!Comparison!of!models!derived!in!time!&!frequency!domains................................ 13!
5.1!Model!of!the!system!in!the!time!domain................................................................................................................. 15!
7.!Task!6!!Conclusion ............................................................................................................ 15!
!
!
1.!Task!1!!Data!Acquisition!
This did not apply to external students.
2.!Task!2!!Matlab!Analysis!
For a given frequency, as given in the data, we can determine the input and response
amplitudes as well as the phase shift. In this experiment all graphs have been loaded
into Matlab to obtain the response for a given frequency, these can be seen in the
following figures:
2.1!Input!and!output!to!the!system!at!0.05!rad/sec.!
2.2!Input!and!output!to!the!system!at!0.1!rad/sec.!
2.3!Input!and!output!to!the!system!at!0.2!rad/sec.!
2.4!Input!and!output!to!the!system!at!0.5!rad/sec.!
2.5!Input!and!output!to!the!system!at!1!rad/sec.!
2.6!Input!and!output!to!the!system!at!2!rad/sec.!
2.7!Input!and!output!to!the!system!at!5!rad/sec.!
2.8!Input!and!output!to!the!system!at!10!rad/sec.!
The phase shift is determined by physically measuring the time differences between
each peak of the input and response amplitudes. In this experiment I have use the
zoom-in and data cursor tool in Matlab to precisely obtain these time intervals. Therefore
the difference between these signals allows us to determine the phase shift. The results
for all these for all frequencies are displayed in the below table:
Table!2.9!N!Time!periods!between!peaks!
Determining the phase shift
Frequency
Input [t]
Response [t]
Difference
between peaks [t]
0.05
0.10
0.20
0.50
1.00
2.00
5.00
10.00
49.87
48.81
25.05
10.62
17.07
10.54
5.09
3.96
59.26
56.86
30.52
13.68
18.77
11.44
5.57
4.22
-9.39
-8.05
-5.47
-3.06
-1.7
-0.9
-0.48
-0.26
Phase shift
[deg]
-26.90
-46.12
-62.68
-87.66
-97.40
-103.13
-137.51
-148.97
As displayed in the above table, we can se that the difference in peaks has a negative
component, this is because the system experiences a time delay thus the response of
the system lags the input to the system.
We can determine the period of both signals to calculate the associated phase shift.
The bottom table displays all the values for the range of frequencies that were used in
this experiment. The absolute magnitude is displayed in decibels; the transfer function
has been multiplied by 20log to obtain the value.
Table!2.10!!Results!of!task!2!
RESULTS TABLE TASK 2
HU(t)
[rad/sec]
[V]
[V]
[v]
0.050
0.100
0.200
0.500
1.000
2.000
5.000
10.000
3.200
3.200
3.200
3.200
3.200
3.200
3.200
3.200
1.000
1.000
1.000
1.000
1.000
1.000
2.000
2.000
0.562
0.474
0.287
0.136
0.064
0.037
0.035
0.014
H(j)|
|H(j)|
()
0.562
0.474
0.287
0.136
0.064
0.037
0.018
0.007
-5.005
-6.484
-10.842
-17.329
-23.876
-28.589
-35.139
-43.098
-26.900
-46.123
-62.682
-87.663
-97.403
-103.132
-137.510
-148.969
[deg]
3.!Task!3!!Bode!Plot!
The Bode from the results of the previous table can be seen in the below figure, the top
graph in the magnitude of the transfer function and the bottom plot is that of the phase.
Both these graphs are plotted against frequency.
3.1!Bode!plot!!magnitude!and!phase.!
4.!Task!4!!System!Identification!
There are numerous methods in determining the best-fit model for task three. For this
task I will demonstrate two methods that could be used using Matlabs inbuilt graph
fitting and an additional method by knowing the amplitudes for a set of given
frequencies:
By definition a first order system transfer function can be represented by the following
equation, for our system, this is also a first order system:
H( j ) =
k
j + p
Where k is the gain of the system and p is the pole of the system, we notice that there
is a positive sign in the equation as our system is stable, therefore the pole must be
located to the left hand side of the imaginary axis. Consequently if the sign were
negative the system would say to be unstable, also worth noting is we are not
considering a zero in the system; the numerator on contains a K term.
Therefore by knowing several values of the transfer function for a given frequency we
can simultaneously solve for the gain and the pole. This can be seen as per the below
equations, where I have picked the third set of values and the second last set of values
to ensure the equation is to the best approximation.
k
j + p
Equation _1:
k
0.287 =
0.2 + p
Equation _ 2 :
k
0.018 =
5+ p
H( j ) =
k = 0.0922
p = 0.1212
From the previous equation we can also determine the static gain of the system, this
occurs when the frequency is equal to zero, this can be seen as per below equation:
H( j ) =
H(0) =
k
0.0922
=
j + p j + 0.1212
0.0922
= 0.7606
0 + 0.1212
ks = 0.7606
By previously calculating the equation for the line of best fit through the data, we can
then use the range of frequencies used in the experiment to determine the magnitude,
the results can be seen in the below table, these theoretical results are in the yellow
column, calculations can be seen in the attached Microsoft Excel spreadsheet:
Table!4.1!!Results!of!task!4!
RESULTS TASK 4
[rad/sec]
0.050
0.100
0.200
0.500
1.000
2.000
5.000
10.000
H(jw)
0.5385
0.4168
0.2870
0.1484
0.0822
0.0434
0.01807
0.00910
THEO.
EXP.
|H(j)|
|H(j)|
THEO/EXP.
[%]
-5.3754
-7.601
-10.840
-16.570
-21.699
-27.237
-34.892
-40.810
-5.005
-6.484
-10.842
-17.329
-23.876
-28.589
-35.139
-43.098
-7.40%
-17.22%
0.01%
4.38%
9.12%
4.73%
0.70%
5.31%
In the column furthers to the right hand side I have compared these results to the
experimental results (actual results); we can see theoretical results are within reason to
model this system.
In the below figure I have modeled the results in Matlab and graphically compared these
results to the experimental data. We can see that besides the second frequency, the
results are within 0-10% comparison.
4.2!!Plot!of!the!model!of!the!system!
The second method in completing this part of the experiment can be determined by
using the graph fitting tools within Matlab, I have used this to fit a linear and quadratic
lines through the data, this can be seen in the below figure, the advantage of this is we
can obtain an equation from the models:
4.3!!Plot!of!model!of!the!system!with!Matlab!
We could use these equations to determine the magnitude per given frequency, and
then converting the answer to the log inverse to determine the response, I decided not to
use this method as there is a higher amount of error associated with this. As we can see,
the residuals of this method can be seen in the below figure:
4.4!Residuals!from!Matlabs!model!fitting!
5.!Task!5!!Comparison!of!models!derived!in!time!&!frequency!
domains!
From the model we have derived in Task 4, we use this transfer function to derive an
experimental model in the time domain. This can be achieved by taking the inverse
Laplace Transform of this model.
Given our modeled transfer function:
H( j ) =
And then moving from the Fourier Transform to the Laplace Transofrm; substituting the
j for s:
H(s) =
0.0922
j + 0.1212
0.0922
s + 0.1212
Because this is the transfer function of the system and we want to find the output of the
system, and given the input to the system is the unit step function, the output of the
system becomes, where G(s) is the output of the system in the frequency domain:
1 " 0.0922 %
G(s) = $
'
s # s + 0.1212 &
And by taking partial fraction of the above equation, the output of the system in the
frequency domain becomes:
1 " 0.0922 %
G(s) = $
'
s # s + 0.1212 &
0.761
0.761
G(s) =
s
s + 0.1212
We have determined the partial fractions so that we can easily convert these two above
fractions into the time domain using the inverse Laplace Transfer, this can be seen as
follows:
0.761
0.761
s
s + 0.1212
# 0.761 & 1 # 0.761 &
1[G(s)] = 1 %
%
$ s ('
$ s + 0.1212 ('
where :
G(s) =
1[G(s)] = g(t)
g(t) = 0.761u(t) 0.761e 0.1212t
g(t) = 0.761[1u(t) e 0.1212t ]
The output of the system is represented by g(t) in the time domain can be seen in the
above equation. To compare this to the model in the first Assignment we need to
compensate for the 50% offset. I have determined this by plotting the results of
Assignment 1 and using the initial voltage at time was equal to zero. To effectively model
this system to the results of laboratory 1, the equation to best simulate this is as per
below equation:
5.1!Model!of!the!system!in!the!time!domain!
As seen in the above lot, the green line is the model of the system developed in task 4,
the blue graph is of the results of the first laboratory. Although both lines reach around
the same amplitude the modeled response appears to raise faster then the results of
laboratory 1, this would mean that the actual response of the system experiences a
longer time delay. The discrepancy may have arisen in obtaining the modeled response.
7.!Task!6!!Conclusion!
The experiment has allowed us to further understand how important the Fourier and
Laplace Transforms are in signal systems analysis by using mathematics to convert
signals from the frequency domain to the time domain and vice versa.
We also observed through the results of this laboratory how increasing the frequency
affects the systems phase shift, as demonstrated in Task 2. Also observed was as the
frequency was increased the amplitude of the output signal became smaller in
amplitude.
Distortion was noticed as the frequency was increased; specifically this was when the
frequency was increased from around 2 rad/sec to 10 rad/sec, it became more difficult to
determine where the actual peak occurred for calculating the phase shift, we can see
this in the last tow results on the bode plot where they appear to differ in comparison to
the other results. Therefore we could conclude that due to the distortion of the signal
could have possibly contributed to the small amount of error associated with the systems
modeled response.
In task 5 our modeled response in the time domain resembled that of the experimental
data obtained in laboratory one, what is clearly evident is that the time constant of the
modeled system is not within comparison with the physical model.
Mark Cruickshank S232953 Charles Darwin University 2015
ENG325 Systems Modeling Prac2: Modelling of a liquid level control system in the frequency domain
And it takes approximately 4 tau to reach its final value, and from the physical results we
can say that it takes approximately 110 seconds to reach to final value (as approximated
of the plot) we can determine tau:
110
= 27.5
4
p=
1
= 0.0364
27.5
As we know the pole of the system, we can then conclude that the equation that best
approximates the physical model is:
" 1 %"
%
k
G(s) = $ '$
'
# s &# s + 0.0364 &
Concluding, the response of the system differed to the physical model due to pole of the
system being of a too higher value, ideally this should have been within the vicinity of the
previous equations pole, the pole we determined for the model was around 333% of a
higher value then that determined as per above.
ENG325_LAB2_2015
14/05/2015 10:43 pm
Contents
Task 2 - Input & response voltages versus time
Task 3 - Bode plt
Task 4 - Fitting a model to task 3
Task 5 - Time domain
clear all
close all
clc
AA
BB
CC
DD
EE
FF
GG
HH
=
=
=
=
=
=
0.05 rad//sec
0.1 rad/sec
0.2 rad/sec
0.5 rad/sec
1.0 rad/sec
2.0 rad/sec
5.0 rad/sec
10 rad/sec
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
Page 1 of 10
ENG325_LAB2_2015
14/05/2015 10:43 pm
Page 2 of 10
ENG325_LAB2_2015
14/05/2015 10:43 pm
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
Page 3 of 10
ENG325_LAB2_2015
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
14/05/2015 10:43 pm
Page 4 of 10
ENG325_LAB2_2015
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
14/05/2015 10:43 pm
Page 5 of 10
ENG325_LAB2_2015
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
14/05/2015 10:43 pm
Page 6 of 10
ENG325_LAB2_2015
14/05/2015 10:43 pm
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
Page 7 of 10
ENG325_LAB2_2015
14/05/2015 10:43 pm
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
Page 8 of 10
ENG325_LAB2_2015
14/05/2015 10:43 pm
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
Page 9 of 10
ENG325_LAB2_2015
14/05/2015 10:43 pm
file:///Users/Master%20Cruickshank/Documents/MATLAB/html/ENG325_LAB2_2015.html
Page 10 of 10