Professional Documents
Culture Documents
Matlab Assignment
Matlab Assignment
Advance Control
Methods
Course Work.
27+32+33=92%
Advance Control Methods: Course Work
Contents
0 Introduction..............................................................................................................................................4
0.1 Types of Faults...................................................................................................................................4
0.2 Fault Detection..................................................................................................................................5
1 Task 1........................................................................................................................................................6
1.1 Solution.................................................................................................................................................6
1.1.1 System Identification......................................................................................................................6
1.1.2 Validation........................................................................................................................................8
2 Task 2......................................................................................................................................................11
2.1 Solution...............................................................................................................................................11
2.1.1 Input Fault (fu)..............................................................................................................................13
2.1.2 Output Fault (fy1).........................................................................................................................15
2.1.3 Output Fault (fy2).........................................................................................................................17
2.1.4 Fault Isolation Properties of This System......................................................................................19
2.1.5 Thresholding.................................................................................................................................19
2.1.6 Simulink Thresholding Function....................................................................................................20
2.1.7 Input Fault with thresholding.......................................................................................................20
2.1.8 Output Fault with thresholding....................................................................................................20
3 Task 3......................................................................................................................................................22
3.1 Solution (a)..........................................................................................................................................22
3.1.1 Implementation in Simulink:.........................................................................................................23
3.1.2 Input and output Fault (fu, fy1 and fy2):.......................................................................................24
3.1.3 Fault Isolation Properties of This System......................................................................................25
3.1.4 Thresholding.................................................................................................................................25
3.1.5 Simulink Thresholding Function....................................................................................................27
3.1.6 Input Fault with thresholding.......................................................................................................27
3.1.7 Output Fault with thresholding....................................................................................................28
3.2 Solution (b):.........................................................................................................................................30
3.2.1 Applying Faults both input and output.........................................................................................31
3.2.2 Fault Isolation Properties of This System......................................................................................32
3.2.3 Thresholding.................................................................................................................................33
3.2.4 Simulink Th_Limits Function.........................................................................................................33
Appendix:..................................................................................................................................................34
2 of 35
Advance Control Methods: Course Work
3 of 35
Advance Control Methods: Course Work
0 Introduction:
Increasing demands on reliability and safety of technical plants require early detection of process faults.
Methods are developed that enable earlier detection of process faults than conventional limit and trend
checking based on single process variable. These methods encompass information from not just one
process variable but also include non-measurable variables as process state, parameters and
characteristics quantities. Some methods require accurate process models while others rely primarily on
available historical process data (Miljković, 2011).
It is important to familiarize our self with terminology of the field: fault, failure and malfunction, types of
faults and fault detection (Miljković, 2011).
Faults: A fault is an undesired deviation of at least one characteristics property of the system
from the acceptable, usual or standard condition.
Failure: A failure is a permanent interruption of a system’s ability to perform a require function
under specified operating conditions.
Malfunction: A malfunction is an intermittent irregularity in the fulfilment of a system’s desired
function. Development of events “failure” or “malfunction” from a “fault” is shown in diagram
below.
4 of 35
Advance Control Methods: Course Work
𝑌(𝑡) = (𝑎 + 𝑓(𝑡))𝑈(𝑡)
Additive faults often is a result of offsets of sensors, on the other hand multiplicative faults are most
likely a parameter change within a process.
In this course work we will concentrate on “Output Error Method” to obtain the estimated model of the
plant or process (System Identification). After obtaining the model we will relate the errors (difference
between the plant output and the model output) to various faults and to conclude that the system is
operating in normal mode or not. Afterwards structured residuals have to be obtained to identify and
isolate the faults i.e. fault diagnosis.
5 of 35
Advance Control Methods: Course Work
1 Task 1.
Use the “oe” function to estimate the parameters of the following single-input single-output models of
the plant from “recorded” input-output data.
Validate your obtained models by developing Simulink models using the parameters you obtained and
applying the same 'step' input to your models to compare the models' response with the response of
the “real” plant. Fully discuss result of your models validation.
1.1 Solution:
We are using model based fault detection technique. Which means that a model of the plant is
constructed and run in parallel with the plant the same input is fed to the plant and its estimated model
and the output is compared. They cannot match exactly but the error should be within a certain range.
So the main idea is if the plant output deviate from that of the model outside the permitted range then
there is something wrong.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1st Step System Identification
% (data given and consider the given model as real system)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 of 35
Advance Control Methods: Course Work
% data = iddata(y,u,Ts);
data1 = iddata(Y1,Uout,Ts);
data2 = iddata(Y2,Uout,Ts);
sys2B = sys2.B;
sys2F = sys2.F;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
After running this code these are the two estimated models of the plant.
𝑦1(𝑧) 2.1691 𝑧−1
𝑠𝑦𝑠1 = = − − − − − − − − − − − (𝑠𝑦𝑠1)
𝑢(𝑧) 1 − 0.9829 𝑧−1
𝑦2(𝑧) 3.5551 𝑧−1
𝑠𝑦𝑠2 = = − − − − − − − − − − − (𝑠𝑦𝑠2)
𝑢(𝑧) 1 − 0.9824 𝑧−1
7 of 35
Advance Control Methods: Course Work
The parameters of the models are directly taken from the Matlab environment without manually
entering their data into Simulink models.
1.1.2 Validation:
From the estimated models of the plant another model was constructed in Simulink and the same input
was applied to it to check whether our estimated models are good enough as an estimates to be used
for fault detection. Which can be seen from the following response curves.
Graph no. 1a (Real Plant Y1 and estimated model MY1 without noise)
8 of 35
Advance Control Methods: Course Work
Graph no. 2a (Real Plant Y2 and estimated model MY2 without noise)
Graph no. 1b (Real Plant Y1 and estimated model MY1 with noise)
9 of 35
Advance Control Methods: Course Work
Graph no. 2b (Real Plant Y2 and estimated model MY2 with noise)
The first set of response curves i.e. 1a and 2a are without noise and the estimated models follows the
actuals plant output very closely. The second set of response curves i.e. 1b and 2b are with noise and
still the estimated models closely follow their counterparts. The noise power level is 0.01 for input and
0.1 for both outputs and kept the same as given to mimic the real plant or process scenario. From this
tasks onwards the same noise levels will be used. Also, it is worth mentioning that Y1 and Y2 are the real
plant outputs and MY1 and MY2 are their estimates.
It is quite clear from the response of the two outputs i.e. Y1 and Y2 and their respective models i.e. MY1
and MY2 that it is quite a good approximation of the real plant. Also, it is clear from the two graphs that
there is some error but it is quite small and hence the estimated models can be used for fault detection
and isolation purposes i.e. fault diagnosis.
Note: Both real plant output (Y1 and Y2) and its model (MY1 and MY2) are plotted on the same graph to
show that the model follows and matches closely its real plant output response.
10 of 35
Advance Control Methods: Course Work
2 Task 2.
Create a parity relations scheme using your obtained models from Task 1 for the residuals generation.
Apply abrupt faults of various magnitude to the “real” plant input, and then to the “real” plant output to
observe changes in the residuals. Discuss fault isolation properties of this scheme.
2.1 Solution:
The residuals generated from comparing the output of the real plant and estimated plant models are
shown as in the following diagram. Signals tags are used in order to reduce clutter as much as possible.
Following are the graph of the residuals R1 and R2 with and without filtering and weightage with no
input or output faults. As can be seen from the graphs that without filtering it will be very difficult to
process the residual data. With filtering it is very easy to make a decision whether the plant is operating
normally or not even a small deviation can be detected easily. A simple 2nd order low-pass filter is used
to filter out the noise.
11 of 35
Advance Control Methods: Course Work
12 of 35
Advance Control Methods: Course Work
Graph no. 5 (In 1, 2 fault fu magnitude is 0.05, in 3, 4 its magnitude is 0.1 and in 5, 6 its magnitude is 0.5)
13 of 35
Advance Control Methods: Course Work
It is quite clear from the graph no. 6 that both positive and negative fault magnitudes can be
differentiated and detected.
14 of 35
Advance Control Methods: Course Work
Graph no. 7 (In 1, 2 fault fy1 magnitude is 1, in 3, 4 its magnitude is 5 and in 5, 6 its magnitude is 10)
15 of 35
Advance Control Methods: Course Work
Graph no. 8 (In 1, 2 fault fy1 magnitude is -1, in 3, 4 its magnitude is -5 and in 5, 6 its magnitude is -10)
16 of 35
Advance Control Methods: Course Work
Graph no. 9 (In 1, 2 fault fy2 magnitude is 1, in 3, 4 its magnitude is 5 and in 5, 6 its magnitude is 10)
17 of 35
Advance Control Methods: Course Work
Graph no. 10 (In 1, 2 fault fy2 magnitude is -1, in 3, 4 its magnitude is -5 and in 5, 6 its magnitude is -10)
18 of 35
Advance Control Methods: Course Work
As clear from all the simulations above that the magnitude of the residual is directly proportional to the
magnitude of the fault. Also if the change or to be specific fault is negative the residuals reflect that
change in its behaviour. Residual “R1” is sensitive to the input “fu” fault and output “fy1” fault. Residual
“R2” is sensitive to the input “fu” fault and output “fy2” fault.
As can be seen from the tables that we can isolate the input and output faults if and only if one fault
occur at a time. For example if “fy1” and “fy2” occur at the same point it may appear as it is input fault
on the contrary there will be no input fault “fu”. In short it is weakly isolating even if “fy1” and “fy2”
don’t occur at the same time.
2.1.5 Thresholding:
To generate a warning or alarm if fault occurs we have to check the residuals values against thresholds
whether their values are within the set threshold values or not. If the values are not within the set or
given threshold values then we should generate warning or an alarm. For this system the threshold
values are -
0.5 to +0.4. After setting an appropriate value (-0.5 to +0.4) for the normal operating range the isolating
matrix will become as shown below. Are these thresholds for filtered residuals?
19 of 35
Advance Control Methods: Course Work
Graph no. 11 (In 1, 2 fault fu magnitude is 0.05 and in 3, 4 its magnitude is -0.05)
Is filtering makes your fault detection
2.1.8 Output Fault with thresholding: slower?
Applying output fault (fy1 and fy2) of 1.1 and -1.1 magnitude with thresholding values of 0.4 to -0.5. The
output fault was applied after 5 sec and the fault was detected at 6.9 sec and 5.6 sec for fy1 and fy2
respectively.
20 of 35
Advance Control Methods: Course Work
Graph no. 12 (In 1, fault fy1 magnitude is 1.1 and in 2 its magnitude is -1.1)
Graph no. 13 (In 1, fault fy2 magnitude is 1.1 and in 2 its magnitude is -1.1)
As clear from the graphs that with filtering it is possible to detect a small deviation in input or output
and without filtering it will be very hard to detect the deviation of the plant from its normal values by
simple means.
32/35
21 of 35
Advance Control Methods: Course Work
3 Task 3.
Explore the scheme's fault-isolation features employing organized residuals. Develop organized residual and also
models of Simulink for the development of structured residuals. To recognize alteration in the residuals, add rapid
defects of the same degree to the "true “input of plant, and afterwards to the real production of plant.
Now, let’s derive the structured residuals for the given system.
From sys1:
From sys2:
𝑤𝑇 = [0 1] − − − − − − − − − −(𝑏)
𝑦1
𝑦2 = [1 0] − − − − − − − − − −(𝑐)
𝑤𝑇
𝑢 = [3.5551
𝑤𝑇 −2.1691] − − − − − (𝑑)
(R1), (R2) and (R3) are the structured residuals. “R1” is insensitive to “fy1”, “R2” is insensitive to “fy2”
and “R3” is insensitive to “fu”.
22 of 35
Advance Control Methods: Course Work
Why 0.2?
23 of 35
Advance Control Methods: Course Work
Graph no. 15 (Structured residuals r1, r2 and r3 with input fault fu magnitude ±0.05)
Graph no. 16 (Structured residuals r1, r2 and r3 with output fault fy1 magnitude ±2)
24 of 35
Advance Control Methods: Course Work
Graph no. 17 (Structured residuals r1, r2 and r3 with output fault fy2 magnitude ±2)
As can be seen from the tables that we can isolate the input and output faults even if the magnitude is
positive or negative. This is strongly isolating matrix as clear from the table above.
3.1.4 Thresholding:
To raise a warning or alarm if fault occurs we have to check the structured residuals values against
thresholds whether their values are within the set threshold values or not. If the values are not within
the set or given threshold values then we should raise warning or an alarm. After setting appropriate
values for the normal operating range the isolating matrix will become as shown below.
25 of 35
Advance Control Methods: Course Work
26 of 35
Advance Control Methods: Course Work
Graph no. 18 (Structured residuals r1, r2 and r3 with input fault fu magnitude +0.05)
Graph no. 19 (Structured residuals r1, r2 and r3 with input fault fu magnitude -0.05)
27 of 35
Advance Control Methods: Course Work
Graph no. 20 (Structured residuals r1, r2 and r3 with output fault fy1 magnitude 1)
Graph no. 21 (Structured residuals r1, r2 and r3 with output fault fy1 magnitude -5)
28 of 35
Advance Control Methods: Course Work
Graph no. 22 (Structured residuals r1, r2 and r3 with output fault fy2 magnitude 1.1)
Graph no. 23 (Structured residuals r1, r2 and r3 with output fault fy2 magnitude -5)
Note:
Alarms should not be generated according to studies very often and should be avoided if possible. So
within a certain range it is better to generate a warning signal and if the values keep on increasing and
cross the 2nd threshold then an alarm should be generated.
29 of 35
Advance Control Methods: Course Work
As u(s) for our system is unit step so for simplicity I replace it by one.
𝑦1(𝑠) = 𝐺1(𝑠)
As u(s) for our system is unit step so for simplicity I replace it by one.
𝑦2(𝑠) = 𝐺2(𝑠)
𝑦1(𝑠) 𝐺1(𝑠)
𝑦2(𝑠) = 𝐺2(𝑠)
𝑦1(𝑠)𝐺2(𝑠) = 𝑦2(𝑠)𝐺1(𝑠)
𝑟∗ = 𝑦1(𝑠)𝐺2(𝑠)
3 − 𝑦2(𝑠)𝐺1(𝑠) − − − − − −(3)
Figure no. 14 (Limit checking and thresholding used for enhanced structured residuals)
Figure no. 15 (Fault Isolation logic used for Lamp Indicator and its setting)
31 of 35
Advance Control Methods: Course Work
Graph no. 23 (Structured residuals esr1, esr2 and esr3 with output fault fu magnitude ±0.05)
Graph no. 23 (Structured residuals esr1, esr2 and esr3 with output fault fy1 magnitude ±1)
Graph no. 23 (Structured residuals esr1, esr2 and esr3 with output fault fy2 magnitude ±1)
32 of 35
Advance Control Methods: Course Work
As can be seen from the tables that we can isolate the input and output faults even if the magnitude is
positive or negative. This is strongly isolating matrix as clear from the tables above.
3.2.3 Thresholding:
To raise a warning or alarm if fault occurs we have to check the structured residuals values against
thresholds whether their values are within the set threshold values or not. If the values are not within
the set or given threshold values then we should raise warning or an alarm. After setting an appropriate
value for the normal operating range the isolating matrix will become as shown below.
33/35
33 of 35
Advance Control Methods: Course Work
Appendix:
function y = Thresholding(u)
Up_Lmt = u(1);
Value = u(2);
Lw_Lmt = u(3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y = Th_Limits(u)
Up_Lmt = u(1);
Value = u(2);
Lw_Lmt = u(3);
prValue = u(4);
if (prValue == 0)
Vave = Value;
y(1) = Vave;
else
Vave = (Value + prValue)/2;
y(1) = Vave;
end
prValue = Value;
y(3) = prValue;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 of 35
Advance Control Methods: Course Work
References
Isermann, R. (2011). Fault diagnosis applications model based condition monitoring: actuators, drives,
machinery, plants, sensors, and fault-tolerant systems. Berlin: Springer.
Miljković, D. (2011). Fault Detection Methods: A Literature Survey., (pp. 750-755). Croatia.
35 of 35