程序代写案例-EE472

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top








EE472 Control Principles
Semester 2 Project Assignment
Student’s Name: Zhiwang Feng
Registration Number: 201522397
Date: 24/03/2017





12



Table of Contents
1.INTRODUCTION ................................................................................................................................... - 1 -
2. SYSTEM MODEL CONSTRUCTION IN SIMULINK ........................................................................ - 1 -
2.1 IMPLEMENTATION OF VALVE 1AND VALVE 2 AND THEIR INPUT-OUTPUT CHARACTERISTICS ...................... - 1 -
2.2 IMPLEMENTATION OF TWO TANKS ............................................................................................................. - 4 -
2.3 IMPLEMENTATION OF PI CONTROLLERS AND VALVE LIFT CONSTRAINTS.................................................... - 5 -
2.4 CONSTRUCTION OF WHOLE CLOSED-LOOP SYSTEM. ................................................................................... - 6 -
3.TUNE THE TWO PI CLOSED-LOOP CONTROL SYSTEMS. ........................................................... - 7 -
3.1 TUNE THE PI CONTROLLERS TO GIVE SATISFACTORY STEP RESPONSES. ..................................................... - 7 -
3.2 VALVE LIFT SATURATING ANALYSIS ........................................................................................................ - 10 -
3.3 THE EFFECT OF NOISE ON SYSTEM PERFORMANCE ................................................................................... - 11 -
4. OBJECTIVE FUNCTION MINIMIZATION AND SYSTEM PERFORMANCE IMPROVEMENT. ... -
12 -
4.1 OBJECTIVE FUNCTION IMPLEMENTATION. ................................................................................................ - 12 -
4.2 TUNING PI CONTROLLER TO GET MINIMUM J FOR R=0.1 AND R=1.5. ....................................................... - 13 -
4.3 EFFECT OF WEIGHTING FACTOR R. ........................................................................................................... - 15 -
5. CONCLUSION ..................................................................................................................................... - 16 -
APPENDIX ............................................................................................................................................... - 16 -








EE472 S2 Project Report –Zhiwang Feng
- 1 -

1.Introduction
Slug catcher is an important part of oil platform to work as a buffer stage to separate the crude oil
from water and gas, which guarantee that the cleaned and pure oil flows into other downstream
installation. In this project, a Simulink model is implemented to simulate the slug catcher. As shown
in figure 1, the system was made up of two tanks (Slug catcher vessel and Free-water-knock-out
vessel). To achieve the slug catcher functions, the tank level has to stay in fixed range and the tank
level is also designed to supply continuous and stable outflow to the downstream part.

Figure 1. The schematic diagram of modelling system
For the desired control process, PI controllers are utilized to act on the valve to form closed control
loop to determine the valve lift. The valve lift controls the outflow rate of each tank, which is the key
factor to determine the tank level. The requirement of outflow limit and continuous outflow can be
maintained by tuning PI controllers. The modelling and control process can be achieved by tuning PI
controller to obtain desired system performance in Simulink.
2. System model construction in Simulink
2.1 Implementation of valve 1and valve 2 and their input-output characteristics
The implementation of valve 1:
Valve 1 is a proportional value with the expression:
12 = 1((1 − 1)1 + 1)√
ℎ1
ℎ1
− 1 ℎ 1 = 0.02, 1 = 1, ℎ1 = 0.4-------(1)
EE472 S2 Project Report –Zhiwang Feng
- 2 -

To plot the input-output characteristics(q vs L) for minimum, maximum and half of tank level h, the
following models can be built in Simulink:

Figure 2. Simulink model for valve 1.
Setting the valve lift L1 with a Ramp signal with its slope set in 1, the characteristic of valve 1 output
12 can be obtained:

Figure 3. The input-output characteristic of valve 1
The valve expression (1) can be expressed: 12 = 1 ∗ ((1 − 0.02)1 + 0.02)√
ℎ1
0.04
− 1, the input
signal L is a ramp signal with slope in 1.
For ℎ1 = ℎ1, 12 = 0, which corresponds to the purple line in figure 3.
For ℎ1 = ℎ1 or ℎ1 = ℎ1, the expression of valve 1 can be simplified :
12 = 1 + ,
EE472 S2 Project Report –Zhiwang Feng
- 3 -

The input signal L is a ramp signal with slope in 1, the output outflow rate 12 is linear with the input
L as indicted in figure 2 and it is evident that the valve 1 is a proportional valve from the blue and
orange line in figure 3.
The implementation of valve 2:
Valve 2 is an equal percentage valve with the expression:
2 = 2
2−1√
ℎ2
ℎ2
− 1 ℎ 2 = 0.7, ℎ2 = 0.2, = 25 ------------(2)
Setting ℎ2 in minimum, maximum and half of tank level and the input L with a ramp signal with slope
1, the modelling of valve 2 can be built in Simulink:

Figure 4. Simulink model for valve 2.
The simulation results can be obtained from scope:

Figure 5. The input-output characteristic of valve 2.
EE472 S2 Project Report –Zhiwang Feng
- 4 -

For ℎ2 = ℎ2, 2 = 0, which is corresponding to the purple line.
For ℎ2 = ℎ2ℎ ℎ2 , the expression (2) can be simplified in 2 = ×25
2−1,A is constant.
It is evident from blue and yellow lines that the output 2 is increasing in exponential form with the
variation of time for the input Ramp signal varies linearly with time, which prove that the valve 2 is
an equal percentage valve.
2.2 Implementation of two tanks
For tank 1: 1
ℎ1

= 1 − 12 ------------------------(3)
The expression (3) can be simplified into
ℎ1 =
1
1
∫(1 − 12) ℎ 1 = 1.324. -------------(4)
The tank 1 model can be built:

Figure6. Model for subsystem tank 1.
The input 1 is in expression: 1() = (0.5 + 0.1 sin (
2
50
) + ())
Where () is a band-limited white noise with noise power 0.02 and sampling time 10 seconds.
1 can be constructed as flowing:

Figure 7. Model for subsystem 1
For tank 2: 2
ℎ1

= 12 − 2 -------------------------(5)
The expression (5) can be simplified into
EE472 S2 Project Report –Zhiwang Feng
- 5 -

ℎ2 =
1
2
∫(12 − 2) ℎ 2 = 2.02. -----------(6)
The tank 2 model can be constructed:

Figure 8. Model of subsystem tank 2.
2.3 Implementation of PI controllers and valve lift constraints.
PI controllers with expression: () = ( +
1

) (ℎ() − ℎ()), = 1,2 ---------------(7)
According to expression (7), the subsystems for PI controllers can be built:

Figure 9. Model of subsystem PI controller 1.

Figure 10. Model of subsystem PI controller 2.
The reference tank level for two tanks are listed in following table:
Tank 1 Tank 2
Time(s) 0-200 200-800 800-1000 0-400 400-600 600-1000
ℎ() 0.8 0.96 0.8 0.5 0.45 0.5
Table 1. Reference height for two tanks.
Implement the reference tank level with Stair generator with following settings:
EE472 S2 Project Report –Zhiwang Feng
- 6 -


Figure 11. Reference tank level generation
The output of PI controller is the valve lift , which is subject to the following opening and
varying speed constraints. 0 ≤ ≤ 1 − 0.1 ≤


≤ 0.1 = 1,2
The valve constraints can be implemented by Rate limiter and saturation with settings:

Figure 12. Valve lift constraints setting

Figure 13. Model of subsystem valve constraints 1 and 2
2.4 Construction of whole closed-loop system.
For tank 1, the tank level ℎ1is determined by the inflow rate 1and the outflow rate 12 which is the
output of valve 1 and is directly controlled by the tank level ℎ1 and the valve lift 1 that is controlled
by tank level ℎ1via a PI controller and constraint. The ℎ1 − outflow rate 12 from valve
1 can work on the tank 1to determine tank level ℎ1, forming the level control closed loop for the whole
tank 1 system. So the closed-loop system for tank 1 can be built by connecting all the sub-systems
constructed in section 2.1 to 2.3 and is shown in figure 14.
For tank 2, the tank level ℎ2 is determined by the outflow rate 12 from valve 1 and the outflow rate
2 of tank 2. The outflow rate 2 is controlled directly by the tank level ℎ2 and the valve lift 2 which
is controlled by the tank level ℎ2 via a PI controller. The ℎ2 − outflow rate 2 from valve
2 can work on the tank 2 to determine tank level ℎ2 , forming a level control closed loop for the whole
tank 2 system. So the closed-loop system for tank 2 can be constructed by connecting all the sub-
systems constructed in section 2.1 to 2.3 and is shown in the following figure:
EE472 S2 Project Report –Zhiwang Feng
- 7 -


Figure 14. The model for whole closed-loop system
3.Tune the two PI closed-loop control systems.
3.1 Tune the PI controllers to give satisfactory step responses.
In section 2.3, the reference signal for tank levels have been implemented by setting the stair generator
signal. The parameters of PI controllers are written in a Matlab script to tune the PI controllers.
For PI controller 1, with expression: 1() = (1 +
1
1
) (ℎ1() − ℎ1()).
The proportional gain results in the change in the output for a given error. Small value of proportional
gain will make the system less sensitive to system disturbances. With the increment of proportional
gain P(1), the system can response faster but the steady-state error decrease significantly and the
overshoot will increase, which have a huge influence on reference tracking performance. So
proportional gain is supposed to be controlled in a proper value.
And with the increasing of integral gain I, the system steady-state error can be eliminated, however
the overshoot will increase and the system become more instable with more oscillations, which shapes
both the reference tracking performance and disturbance rejection performance.
At the beginning, set 1 = 1,
1
1
= 1, and initial setting in 0.8.
EE472 S2 Project Report –Zhiwang Feng
- 8 -


Figure 15. The step response of tank 1.
It is evident that the step response represents large overshoot and the system has significant
oscillations. The disturbance peak values are relatively large and the reference tracking performance
as well as the disturbance rejection performance are not as participated.
To recede the oscillations and overshoot to make the step response more stable , tune the PI controller
by increasing the proportional gain 1and decreasing integral gain
1
1
to degrade the disturbance peak
value and maintain stable oscillation.
When 1 increases to 4 and
1
1
decreses to 0.8, the tank 1 system response is shown in figure16, the
disturbance peak values have been receded significatly to desired level and the system’s response has
relatively small overshoot, the reference tracking performance and disturbance rejection performance
are much better as shown in this satisfactory response.

Figure 16. The step response of tank 1 after PI controller tuning.
EE472 S2 Project Report –Zhiwang Feng
- 9 -

For PI controller 2, with expression: 2() = (2 +
1
2
) (ℎ2() − ℎ2()).
Use the same way to tune PI controller 2, setting 2 = 1 and
1
2
= 1, the system response:

Figure 17. The step response of tank 1.
It is evident that this response has relatively disturbance peak value and the system oscillation is
relatively stable. To get more satisfactory response with small disturbance peak value, tune the PI
controller by increasing the proportional gain 2and decreasing integral gain
1
2
.
When 2 = 4,
1
2
= 0.8, the system response represent much smaller disturbance peak values which
are acceptable, this system operate with satisfactory reference tracking performance and disturbance
rejection performance.

Figure 18. The step response of tank 1 after PI controller tuning
EE472 S2 Project Report –Zhiwang Feng
- 10 -

3.2 Valve lift saturating analysis
Setting 1 = 4,
1
1
=0.8, 2 = 4,
1
2
=0.8, the unconstrained and constrained control signal of valve
lift can be plotted:

Figure 19. The unconstrained and constrained control signal of valve 1.

Figure 20. The unconstrained and constrained control signal of valve 2.
It is clear form figure 19 and figure 20, the evident valve lift saturations happen at the time when the
reference tank level changes. Due to the changes of reference tank level, an obvious difference
between the measured tank level and reference tank level will represent, generating a disturbance in
the operating system. The valve lift will be tripped to degrade the disturbance to maintain the stability.
The lift has limited opening magnitude constraint and varying speed constrain, the lift saturation will
occur when the disturbance is beyond the limitation. Apart from the point when reference tank level
EE472 S2 Project Report –Zhiwang Feng
- 11 -

changes, there still exist some slight lift saturations for the existence of disturbance signals resulted
from the noise, which are also beyond the lift constraints.
3.3 The effect of noise on system performance
The input 1 is expressed in 1() = (0.5 + 0.1 sin (
2
50
) + ()), to investigate the effect of noise on
system performance, firstly remove the noise signal from inflow 1 :

Figure 21. The step response of tank 1 and tank 2.

Figure 22. The unconstrained and constrained control signal of valve 1 & 2.
Then increase the power of noise to 0.25:

Figure 23. The step response of tank 1 and tank 2.
EE472 S2 Project Report –Zhiwang Feng
- 12 -


Figure 24. The unconstrained and constrained control signal of valve 1 & 2.
By comparing the system performance and valve saturation levels under the condition that no noise
inflows and stronger noise signal inflows, it is evident that when system with noise inflows, the
disturbance peak value is much large than that no noise inflows, and the system has much more valve
lift saturations. With the increment of power of noise, the disturbance peak value become much larger
and more valve lift saturations occur, the control system stability decrease significantly. The noise in
the inflow weakens both the reference tracking performance and disturbance rejection performance.

4. Objective function minimization and system performance improvement.
4.1 Objective function implementation.
The objective function is shown below:
J = √∫ [(ℎ1() − ℎ1())
2
+ (ℎ2() − ℎ2())
2
]

0
+ ∫ [|
1()

| + |
2()

|]

0
ℎ = 1000
According to the expression of objective function, the Simulink sub-system model can de designed:

Figure 25. Model of the sub-system of objective function J.
EE472 S2 Project Report –Zhiwang Feng
- 13 -

Connect the sub-system to the closed loop system constructed in section 2. And use display to show
the value of J.

Figure 26. The model for whole closed-loop system
4.2 Tuning PI controller to get minimum J for r=0.1 and r=1.5.
Tune the parameters of PI controller to minimize J by following steps:
1) Fix three parameters and tune one parameter to record the value of J shown in Display.
2) When J commence to increase, narrow the range of tuning parameter and tune again until get local
minimization of J.
3) Fix the tuned parameter and repeat the first step again to tune other parameters.
For r=0.1, the tuning process is shown below:
Setting 1 = 1,
1
1
= 1, 2 = 1,
1
2
= 1
Tuning 1 with
1
1
= 1, 2 = 1,
1
2
= 1
1: 0.5 1.0 1.5 2.0 2.5 2.4 2.3 2.2 2.1
J 2.8643 2.6880 2.6576 2.6342 2.6645 2.6513 2.6334 2.6354 2.6336
Table 2. The value of J when tuning the value of 1
The local minimization of J is 2.6334 when 1 = 2.3.
Tuning
1
1
with 1 = 2.3, 2 = 1,
1
2
= 1

EE472 S2 Project Report –Zhiwang Feng
- 14 -

1
1
0.5 0.7 0.8 1.0 1.2 0.6 0.73 0.75
J 2.6448 2.6234 2.6229 2.6334 2.6941 2.6308 2.6201 2.6178
Table 3. The value of J when tuning the value of
1
1

The local minimization of J is 2.6178 when
1
1
= 0.75.
Tuning 2 with 1 = 2.3,
1
1
= 0.75, ,
1
2
= 1
2 0.5 1.0 1.5 2.0 2.5 3.0 2.8 2.2
J 2.6243 2.6178 2.5972 2.5956 2.5915 2.6123 2.6007 2.5926
Table 4. The value of J when tuning the value of 2
The local minimization of J is 2.5915 when 2 = 2.5.
Tuning
1
2
with 1 = 2.3,
1
1
= 0.75 2 = 2.5
1
2
1.5 1.2 1.0 0.9 0.8 0.7 0.85 0.95
J 2.6087 2.6089 2.5915 2.5895 2.5913 2.5976 2.6021 2.5888
Table 5. The value of J when tuning the value of
1
2

The local minimization of J is 2.5888 when
1
2
= 0.95.
For the first tuning, the local minimization of J is 2.5888, when 1 = 2.3,
1
1
= 0.75, 2 = 2.5,
1
2
= 0.95.
1
1
1
2
1
2
J 1
1
1
2
1
2
J
2.3 0.75 2.5 0.95 2.5888 1.8 0.6 2.5 0.95 2.5898
2.5 0.75 2.5 0.95 2.6000 1.8 0.75 2.7 0.95 2.5718
2.1 0.75 2.5 0.95 2.5828 1.8 0.75 2.3 0.95 2.5681
1.9 0.75 2.5 0.95 2.5717 1.8 0.75 2.1 0.95 2.5743
1.7 0.75 2.5 0.95 2.5772 1.8 0.75 2.2 0.95 2.5703
1.8 0.75 2.5 0.95 2.5696 1.8 0.75 2.3 1.0 2.5690
1.8 0.8 2.5 0.95 2.5748 1.8 0.75 2.3 0.85 2.5702
1.8 0.9 2.5 0.95 2.5806 1.8 0.75 2.3 0.75 2.5746
1.8 0.7 2.5 0.95 2.5722 1.8 0.75 2.3 0.95 2.5681
Table 6. The value of J when tuning the value of 1,
1
1
, 2,
1
2

As shown in table 6. Tuning the parameter of PI controller again by the above steps. After further tuning, the
minimization of J is 2.5681, when 1 = 1.8,
1
1
= 0.75, 2 = 2.3,
1
2
= 0.95.
EE472 S2 Project Report –Zhiwang Feng
- 15 -

Setting r=1.5, repeat above steps to tune PI controller parameters to find minimization of J.
1
1
1
2
1
2
J 1
1
1
2
1
2
J
0.6 1 1 1 32.99 1.2 0.1 0.8 1 26.1469
0.8 1 1 1 32.1365 1.2 0.1 1.2 1 26.0824
1.0 1 1 1 31.7723 1.2 0.1 1.4 1 26.1179
1.2 1 1 1 31.5147 1.2 0.1 1.3 1 26.0368
1.4 1 1 1 31.6345 1.2 0.1 1.35 1 26.0175
1.3 1 1 1 31.6307 1.2 0.1 1.38 1 26.0235
1.1 1 1 1 31.607 1.2 0.1 1.35 1.2 26.2246
1.2 1.2 1 1 32.7628 1.2 0.1 1.35 0.8 25.7876
1.2 1.4 1 1 34.2355 1.2 0.1 1.35 0.6 25.5063
1.2 0.8 1 1 30.6026 1.2 0.1 1.35 0.3 24.6438
1.2 0.6 1 1 29.8118 1.2 0.1 1.35 0.1 23.4330
1.2 0.4 1 1 28.8735 1.3 0.1 1.35 0.1 23.6704
1.2 0.2 1 1 27.3908 1.1 0.1 1.35 0.1 24.1023
1.2 0.1 1 1 26.1368 1.2 0.1 1.4 0.1 23.5022
1.2 0.1 0.6 1 26.3584 1.2 0.1 1.3 0.1 23.6082
Table 7. The value of J when tuning the value of 1,
1
1
, 2,
1
2

= 23.4330 when 1 = 1.2,
1
1
= 0.1, 2 = 1.35,
1
2
= 0.1 .
4.3 Effect of weighting factor r.

Figure 27.The system response for weighting factor r=0.1 and r=1.5.
EE472 S2 Project Report –Zhiwang Feng
- 16 -


Figure 28. The constrained and unconstrained valve lift for weighting factor r=0.1 and r=1.5.
It is evident from figure 27 and 28 that with the increasing of weighting factor, the system response slower and
has larger disturbance peak value, the disturbance rejection performance and the reference tracking
performance are both regraded. The valve lift saturation level decreases with the increment of r.
5. Conclusion
In this project, a closed loop control model with two tanks, two valves and two PI controllers was implemented
in Simulink to simulate the control process of slug catcher in section 2. By tuning the PI controller parameter,
the tank level can be constrained into certain range and guarantee continuous and constant outflow to
downstream sections in this module.
In section 3, the reference tracking performance and disturbance rejection performance were tuned to
satisfactory level by tuning the PI controller parameters. The constrained and unconstrained valve lift was
plotted to insect the saturations of valve lift. At the end of this part, by adjusting the noise inflowing the system,
the effects of noise were represented in the graphs and analysed.
In section 4, using the trail-and-error method to tune the parameters of two PI controllers to minimize the
objective function for different weighting factor (r). by comparing the two designs in section 4.2, the effects of
weighting factor on control performance were analysed in section 4.3.
Appendix


欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468