You are on page 1of 74

MODELING, SIMULATION AND CONTROL

OF A DRUM BOILER
A Thesis Report
Submitted in partial fulfilment of the requirements of the degree of
MASTER OF ENGINEERING
By
DIPANKAR KALITA
(2012H132143P)
Under the supervision of
Dr. HARE KRISHNA MOHANTA
(Assistant Professor)

DEPARTMENT OF CHEMICAL ENGINEERING


BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI
May 2014

CERTIFICATE
1

This is to certify that the Dissertation work entitled Modeling, Simulation and
Control of a Drum Boiler by Dipankar Kalita (ID - 2012H132143P) in partial
fulfillment of requirement of BITS G629T Dissertation is a bonafide research work
carried by him under my supervision and guidance.

Date:

Dr. Hare Krishna Mohanta

Pilani.

Assistant Professor

ACKNOWLEDGEMENTS
I would like to take this opportunity to respectfully acknowledge the guidance and
support given by Dr. Hare Krishna Mohanta throughout this project work. I express my
sincere thanks and deep sense of gratitude for his valuable mentorship and
encouragement at every stage of this Dissertation work. Whenever I have approached him
to discuss ideas for my project or any problem, I have always found an eager listener.
I would like to express my gratitude to Mr. Ajaya Kumar Pani without whom this
project work would not have been completed within the time frame. With his deep insight
and knowledge in the field of process control, he has always been a constant support
throughout this work.
My thanks also goes to all my other batch mates who have made the atmosphere in my
classes lively and interesting. Last, but most importantly, Im grateful to my family for
their love, blessings and support throughout this endeavour.

ABSTRACT
Since boilers are so common there are many modelling efforts. There are complicated
models in the form of large simulation codes which are based on finite element
approximations to partial differential equations. Although such models are important for
plant design, simulators, and commissioning, they are of little interest for control design
because of their complexity.
The objective of this work is to obtain a simplified nonlinear dynamic model for natural
circulation drum-boiler system which can be used for control. The model should describe
the complicated dynamics of the drum, downcomer, and riser components. It is to be
derived from first principles, and is to be characterized by a few physical parameters.
The model should be validated using the available plant data.
This project involves modelling, simulation and control of a drum-boiler system using
MATLAB and SIMULINK. For efficient control of the process various advanced
controllers such as ANN- and Fuzzy Logic based controllers have been used along with
the traditional PID controllers.

Keywords: Drum-boiler, Drum, Downcomer, Riser, MATLAB , SIMULINK, ANN,


Fuzzy logic, PID

TABLE OF CONTENTS

ACKNOWLEDGEMENTS

(i)

ABSTRACT (ii)
1

Introduction 1

Modeling and Simulation


2.1

Global mass and energy balance

2.2

Distribution of steam in risers and drum

2.3

Mass and energy balance for riser section

2.4

Distribution of steam in drum

2.5

The Model

10

2.6

Summary

13

2.7

Steady state solution of the model

13

2.8

The solution14

2.9

Step response..14

Control schemes
3.1
3.2

Tuning methods

19
20

Optimization of membership functions

Neural Network Predictive Control 25

Results & Discussions


4.1

18

Fuzzy Logic Controller (FLC)


3.2.1

3.3

18

PID Controllers
3.1.1

31

PID Controller32
5

23

4.1

4.1.1

Regulatory Problem 32

4.1.1

Servo Problem

35

Fuzzy Logic Controller

37

4.1.1

Regulatory Problem 38

4.1.1

Servo Problem

40

Conclusions 42

References

43

Appendix A: MATLAB Code

44

Appendix A: Optimiztion Code

47

Chapter - 1
Introduction

There are dramatic changes in the power industry because of deregulation. One
consequence of this is that the demands for rapid changes in power generation is
increasing. This leads to more stringent requirements on the control systems for the
processes. It is required to keep the processes operating well for large changes in the
operating conditions. One way to achieve this is to incorporate more process knowledge
into the systems. The goal is to develop moderately complex nonlinear models that
capture the key dynamical properties over a wide operating range. The models are based
on physical principles and have a small number of parameters; most of which are
determined from construction data. Particular attention has been devoted to model drum
level dynamics well. Drum level control is an important problem for nuclear as well as
conventional plants. In Parry, Petetrot and Vivien (1995) it is stated that about 30% of the
emergency shutdowns in French PWR plants are caused by poor level control of the
steam water level. One reason is that the control problem is difficult because of the
complicated shrink and swell dynamics. This creates a nonminimum phase behaviour
which changes significantly with the operating conditions. Since boilers are so common
there are many modelling efforts. There are complicated models in the form of large
simulation codes which are based on finite element approximations to partial differential
equations. Although such models are important for plant design, simulators, and
commissioning, they are of little interest for control design because of their complexity.
The model presented here is adapted from K.J Astrom and R.D. Bell (1998). A nonlinear
dynamic model for natural circulation drum-boilers is adapted. The model describes the
complicated dynamics of the drum, downcomer, and riser components. It is derived from
first principles, and is characterized by a few physical parameters. A strong effort has
been made to strike a balance between fidelity and simplicity. Since the model is derived
from first principles it can describe the system for a wide operating range.
Simulation of the model is done using MATLAB R2010a and results have been verified
with plant data presented in K.J Astrom and R.D. Bell (1998). The conventional PID
controller is applied when the boiler is operating at medium load for both servo and
regulatory problems. Advanced controllers such as Fuzzy logic controllers(FLC) and
Neural Network(NN) predictive controllers have been also tried with satisfactory results.
The details of these controllers are discussed in the report within.
The drum boiler is a simple boiler which consist of a drum, downcomer and riser
components. A simple schematic of the drum boiler have been shown in Figure 1. The
heat Q, supplied to the risers causes boiling. Gravity forces the saturated steam to rise
causing a circulation in the riser-drum-downcomer loop. Feedwater q f , is supplied to the
drum and saturated steam, qs, is taken from the drum to the superheaters and turbine. The
presence of steam below the liquid level in the drum causes the shrink-and-swell
phenomenon which makes level control difficult. In reality the system is much more
complicated than shown in the figure. The system has a complicated geometry and there
are many downcomer and riser tubes. The outflow from the risers passes through a
separator to separate the steam from the water. In spite of the complexity of the system it
turns out that its gross behaviour is well captured by global mass and energy balances.

Fig 1: Schematic of a drum boiler[1].


The shrink and swell phenomena in a drum boiler makes the level control very
difficult. Under boiling conditions, steam supporting field products such as
bubbles exist below the water/steam level interface. These bubbles have volume
and therefore displace water to create a misrepresentation of the true water level in
the drum. Another effect upon drum level is pressure in the drum. Because steam
bubbles compress under pressure the steam bubbles expand or contract respective
to these pressure changes. A higher steam demand will cause the drum pressure to
drop, and the steam bubbles to expand to give the appearance of a water level
higher than it truly is.This fictitious higher water level causes the feedwater input
to be shut down at a time when more water is really required. A surge in water
level as a result of the drum pressure decreasing is called 'swell'. A water level
decrease due to drum pressure increase is called 'shrink'.

10

Chapter - 2
Modeling and Simulation
2.1 Global mass and energy balance equations
The global mass balance equation is
Rate of accumulation of mass in the system = Rate input of mass Rate output of mass.
d
[ V + V ]=q f q s .(1)
dt S st W wt
where
S= density of saturated steam (kg/m3)
Vst= total volume of steam in the boiler system (m3)
W= density of saturated water (kg/m3)
Vwt= total volume of water in the boiler system (m3)
qf= feed flowrate (kg/s)
qs=steam flowrate(kg/s)
The global energy balance is
Rate of accumulation of energy in the system = Rate input of energy Rate output of
energy.
d
[ u V + u V +m C t ]=Q+ qf h f q s h s ..(2)
dt S s st W w wt t p m
us= specific internal energy of steam (J/kg).
uw= specific internal energy of saturated water (J/kg).
mt= total mass of metal tubes and the drum.(kg)
Cp= specific heat of metal (J/kg 0C)
tm= temperature of the metal (oC)
Q= heat supplied to the risers (W)
hf= specific enthalpy of feedwater (J/kg)
hs= specific enthalpy of steam (J/kg)
11

From first law of thermodynamics


H=U+PV
which can be rearranged as
u = h - p/.
Now we write the global energy balance in terms of enthalpy instead of internal energy by
using the first law of thermodynamics.

d
p
p
S h s V st S V st + W hw V wt W
V +m C t =Q+ qf h f q s h s
.
dt
S
W wt t p m
d
[ h V + h V pV wt pV st +mt C p t m ]=Q+q f h f qs h s .
dt S s st W w wt
d
[ h V + h V pV t +mt C p t m ]=Q+q f h f qs h s .(3)
dt S s st W w wt
The total volume of the drum, downcomer and riser is
V t =V st +V wt .(4)
Equation (1), (3) and (4) combined with saturated steam tables yields a simple boiler
model. We will however make manipulations of the model to obtain a state model. There
are many possible choices of state variables. Since all parts are in thermal equilibrium it
is natural to choose drum pressure ,p as one state variable. This variable is also easy to
measure. Using saturated steam tables, the variables S , W , hS and hW can be expressed
as functions of steam pressure. The second state variable can be chosen as the total
volume of water in the system VWt. Using equation (4) VSt can be eliminated and replaced
by VWt.
Equation (1) can be written as
d
[ V + V ]=q f q s .
dt S st W wt
d
d (V V wt )
d
W V wt ]+V st S + s
=q f q s .
[
dt
dt
dt

d V wt
d
d
d
V wt ]s
+V wt w +V st S =q f q s .
[
dt
dt
dt
dt

12


d w
d dp
d
( W s ) [ V wt ] +(V wt
+V st S ) =q f q s .
dt
dp
dp dt

e 11

d
dp
V wt ] +e 12 =q f q s .
[
dt
dt

Equation (3) can be written as


d
[ h V + h V pV t +mt C p t m ]=Q+q f h f qs h s .
dt S s st W w wt
d
d
d
d
W hw V wt + S hs V st p V t + mt C p t s=Q+q f h f qs h s .
dt
dt
dt
dt
W hw

d
d
d
d
d
d
d
d
V wt S h s V wt +h s V st S+ V st S hs +h w V wt W +V wt W h w p V t + mt C p t s =Q+
dt
dt
dt
dt
dt
dt
dt
dt

h
( s V st

d
d
d
d
d
S +V st S
hs +h w V wt
W +V wt W
hw V t + mt C p t s ) dp =Q+ qf h f q s h s
dp
dp
dp
dp
dp dt
d V wt
( W hw S h s)
+
dt

.
e 21

d V wt
dp
+e 22 =Q+q f h f q s hs .
dt
dt

So
e 11

d
dp
[ V ] +e 12 dt =q f q s .
dt wt
(5)

e 21

d V wt
dp
+e 22 =Q+q f h f q s hs .
dt
dt

Where
13


( W s ) .
e11 =
e 12

d w
d S
= (V wt dp + V st dp )
(6)

W
h
(
w S h s)
.
e 21=
e 22=hs V st

d
d
d
d
d
S +V st S hs + hw V wt
W +V wt W
hw V t +mt C p t s .
dp
dp
dp
dp
dp

Steam tables are required to evaluate


d
t
h
, dp w , s

and

hs

hw

d S
d w
d
h
,
,
dp s
dp
dp

d
t
dp s . The results are based on approximations of steam tables

with quadratic functions.


h s=2.7254E6+ (1.8992E41160.0 ( p10 ) ) ( p10 ) .
hw =1.4035E6+ ( 4.9339E4880.0 ( p10 ) ) ( p10 ) .
s =53.1402+ ( 7.673+0.36 ( p10 ) ) ( p10 ) .
w =691.35+ (18.6720.0603 ( p10 ) ) ( p10 ) .
t s=310.6+ ( 8.5230.33 ( p10 ) ) ( p10 ) .
hs
=1.8992E41160.0 ( p10 ) .
p
hw
=4.9339E4880.0 ( p10 ) .
p

14

s
=7.673+0.36 ( p10 ) .
p
w
=18.6720.0603 ( p10 ) .
p
ts
=8.5230.33 ( p10 ) .
p

The condensation flow rate is given by a simple energy balance done within the system
q ct hc + ( h f hw ) q f = s V st

where

hc =hshw

dh s
dh
dt
dp
+ w V wt w + mt C p s V t
dt
dt
dt
dt .

Here the term on the left hand side of the equation

s V st

dhs
dh
dt
+ w V wt w +mt C p s
dt
dt
dt

accounts for the thermal energy change within the system and the term

Vt

dp
dt

accounts

for the pressure energy change within the system. The negative sign appears before
Vt

dp
dt since condensation is taking place.

The term on the right hand side accounts for the physical changes taking place within the
system due to total change in stored energy within the system.
So it can be rewritten as
s V st

dhs
dh
dt
dp
+ w V wt w +mt C p s V t
dt
dt
dt
dt
)..(8)
1
1
qct = ( hw h f ) q f +
hc
hc

2.2 Distribution of steam in risers and drum


Saturated mixture quality in a heated tube
Consider a vertical tube with uniform heating. Let be the density of the steam-water
mixture. Furthermore let q be the mass flow rate, A be the area of cross section of the
15

tube, V the volume, h the specific enthalpy, and Q the heat supplied to the tube. All
quantities are distributed in time, t and space, z. Assume for simplicity that all quantities
are same in a cross-section of the tube.
The mass balance for heated section of tube can be derived from the mass continuity
equation. The continuity equation can be stated as
u v w
+
+
+ =0 .
x y
z t
u,v and z are velocity in x,y and z directions respectively. Since mass is only entering and
leaving in z- direction. So we have
w
+ =0 .
z t
( Aw)
+ =0 .
A z
t
q

+A
=0 .(9)
z
t
The energy balance can be derived as follows. Let us consider a infinitesimally small
block of cube through which the fluid is flowing. The cube is a control volume. We will
do the energy balance around this cube. The cube has three coordinates x, y and z. So
Energy flow into the cube- Energy flow out of the cube= Rate of change of energy
Energy flow into the cube=

x u x hdydz + y u y hdxdz+ z u z hdxdy+ Q

Energy flow out of the cube=


x+dx u x+dx hdydz + y+dy u y+dy hdxdz + z+ dz u z+ dz hdxdy .
x u x hdydz + y u y hdxdz+ z u z hdxdy+ Q x+dx u x+d x hdydz y +dy u y +dy hdxdz z +dz u z +dz hdxdy =
.
Dividing both sides by dxdydz we get.

16

dh
dxd
dt

dh
.
dt
( x +dx ux +dx h/dx )( y+dy u y+dy h/dy )
( x u x h/dx )+( y u y h/dy)+( z u z h/dz )+(Q/dxdydz )

( z+ dz u z +dz h /dz )=

uh vh wh Q h

+ =
x
y
z
V
t .
wh h Q
=

z
t V .
wh h Q
+
=
z
t V .
qh h Q
+
=
A z t V (10)
The specific internal energy of mixture of steam and water is
h= m h s+ ( 1 m ) hw =hw + m hc .(11)
Where

denotes the mass fraction of steam in the flow i.e. the quality of the mixture.

In steady state we get


q
=0 .
z

qh
QA
=q hc m =
z
z
V ..from (10) and (11).
So
m=

QA
z
.
q hc V

Let be the normalized length coordinate along the risers and


at riser outlet. The steam fraction along the tube.
17

be the steam quality

m ( )= r

, 0 <= <= 1. ..(12)

f ( m)
The volume and mass fraction of steam are related through
where
v =

m
s
f ( m ) =
m
1 m
+
s
w

( )(

f ( m ) =

w m
s +( w s ) m . .(13)

To model drum level it is essential to describe the total amount of steam in the risers. This
is governed by the average volume fraction in the risers.
1

w
s
( ws ) r
1
V = V ( ) d= f ( m ) d=
(1
ln 1+
)
r 0
w s
s
( w s ) r
0
..(14)
2.3 Mass and energy balance for the riser section
The global mass balance for riser section is
1
( V )V r
S V V r + w =qdc q r (15)
d

dt
Where Vr = volume of the riser(m3).
qdc =flow rate in the downcomer section(kg/s)
qr=flow rate in the riser section(kg/s).
The global energy balance for the riser section is

18

( V )V r + mr C p t s
S u s V V r + w uw =Q+ qdc hw ( 1 r ) qr h w r qr h s .
d

dt
1

(V ) V r +m r C p t s
S u s V V r + w uw =Q+ qdc hw q r hw + r q r hw r q r hs .
d

dt

( V ) V r +mr C p t s
S u s V V r + w uw =Q+ qdc hw ( r hc + hw )q r .
d

dt
u=h

p
.

1
p
( V )V r + m r C p t s
s
( V )V r =Q+ q dc hw ( r hc + hw )q r .
p
S h s V V r s V r + w hw
s V
d

dt
s

( V )V r p V r +mr C p t s
S u s V V r + w uw =Q+ qdc hw ( r hc + hw )q r .(16)
d

dt
Circulation flow
The momentum balance for the downcomer riser loop is
19

2
d q dc
k qdc
( Lr + Ldc ) dt =( ws ) v V r g 2 A .
w
dc

Where Lr and Ldc are the length of riser and downcomer respectively, k is a dimensionless
friction coefficient and Adc is the area of the downcomer.
This is a first order system with time constant
T=

2 w Adc ( Lr + Ldc )
.
k qdc

With typical numerical values we find that the time constant is about a second. This is
short in comparison with the sampling period of the experimental data and we will
therefore use steady state relation.
1 2
k q = A ( ) g v V r .
2 dc w dc w s
q dc= 2 w A dc ( w s ) g v V r /k .(17)
2.4 Distribution of steam in the drum
Vsd volume of steam under liquid level
Vwd volume of water under liquid level
qsd steam flowrate under the liquid surface
qcd - condensation of steam below the liquid level
The mass balance for steam under the liquid level is
d
( V ) = r qr q sdq cd .(18)
dt s sd
qcd can be given by (8)
q cd =

dh
dh
dt
1
1
dp
hw hf ) q f + ( s V st s + w V wt w +md C p s (V sd +V wd ) )
(
hc
hc
dt
dt
dt
dt

..(19)
Flow qsd is driven by the density differences of water and steam, and momentum of flow
entering the drum.
Good fit to the experimental data have been obtained with the following empirical model.
20

q sd=

s
( V V sd 0 )+ r qdc + r (q dc qr ) .(20)
T d sd

Here Vsd0 denotes volume of steam in the drum in the hypothetical situation where there is
no condensation of steam in the drum and Td is the residence time of steam in the drum.
Drum level
The volume of water in the drum is
V wd =V wt V dc (1 v )V r .(21)
The deviation of the drum level l from normal operating level is
l=

V wd + V sd
=l w +l s (22)
Ad

The term lw represents level variations due to change in water in the drum and ls
represents level variations caused by steam in the drum.
2.5 The Model
Selection of state variables
The accumulation of water is represented by the total water volume Vwt. The total energy
is represented by drum pressure p and the distribution of steam and water is captured by
the steam mass fraction in the risers r and the steam volume in the drum Vsd.
Pressure and water dynamics.
These equations are represented by equation (5).
Riser dynamics
Eliminating the flow rate out of the risers, q r , by multiplying eq(13) by (h w + rhc) and
adding to eq (14) gives
( hw + r hc )

d
d
d
d
d
d
s V V r ) ( h w + r h c ) ( w ( 1 V ) V r ) + ( s h s V V r ) + ( w h w ( 1 V ) V r ) p V r +
(
dt
dt
dt
dt
dt
d

( hw + r hc )

d
d
d
d
d
d
s V V r ) ( h w + r h c ) ( w ( 1 V ) V r ) + ( s h s V V r ) + ( w h w ( 1 V ) V r ) p V r +
(
dt
dt
dt
dt
dt
d

21

( hw + r hc )

d
d
d
d
d
d
s V V r ) ( h w + r h c ) ( w ( 1 V ) V r ) + ( s h s V V r ) + ( w h w ( 1 V ) V r ) p V r +
(
dt
dt
dt
dt
dt
d

.
d
d
d
d
d
( h V ) ( hw + r hc ) dt ( s V V r )+ dt ( w hw ( 1 V ) V r ) ( h w+ r h c ) dt ( w ( 1 V ) V r )V r dt p+mr
dt s s V r
.
hc ( 1 r )

dh
dh
d
d
dp
d
s v V r ) + w ( 1 v ) V r w r h c ( w ( 1 V ) V r ) + s V V r s V r +mr C p t s=Q+
(
dt
dt
dt
dt
dt
dt

[(

hw

h
V
d
r hc w ( 1 V ) V r + ( 1 r ) hc s + s s V V r + ( s+ ( w s ) r ) hc V r
V t +mr C p
p
p
p
p
p
d

.
e 32

dr
dp
+ e33
=Q+q dc hc r .(23)
dt
dt

Where

[(

e 32= w

hw

h

r hc w ( 1 V ) V r + ( 1 r ) hc s + s s V V r + ( s + ( w s ) r ) hc V r V V t + mr
p
p
p
p
p

.
e 33=( ( 1 r ) s + r w ) hc V r

V
r .

If the state variables p and r are known the riser flow rate q r can be computed from
eq(13).
1
( V )V r
S V V r + w .
d
qr =q dc
dt

22

1
( V )
S V + w
.
d
q r=q dc V r
dt
1
( V )
S V + w
.
d
q r=q dc V r
dt
q r=q dc V r

d
( ( ))
dt w V w S .
1
( V )

d r
dp
+ V r ( w S ) V
dt
r dt ..(24)

q r=qdc V r

S V + w

Drum Dynamics
The dynamics for the steam in the drum is obtained from the mass balance (18).
Introducing (24) for qr , (19) for qcd and (20) for qsd we get
1
( V )

d r
dp
+V r ( w S ) V
dt
r dt

dh
dh
d

1
1
q dcV r
() s ( V sd V sd 0 ) + r q dc + r (q dcqr ) ( hw h f ) q f + (s V st s + w V wt w +md C p
p
Td
hc
hc
dt
dt
d
d
( V )= r
dt s sd
S V + w

23

( V )+ S V

s
h h
V sd V sd 0 )+ f w q f
(
Td
hc
dh
dh
dt
d
d
1
1
dp
s ( V sd ) +V sd ( s ) + ( hw hf ) qf +
s V st s + w V wt w + md C p s ( V sd +V wd )
+ r ( 1+ ) V r
dt
dt
hc
hc
dt
dt
dt
dt
w =

.
1

w

+( sw ) V
p
p
dh
dh
dt
s
d
1
1
dp
V sd ( s ) + ( hw h f ) q f +
s V st s + w V wt w +md C p s ( V sd +V wd ) + r ( 1+ ) V r V
+
dt
hc
hc
dp
dp
dp
p
dt

( V )

.
e 42

h h w
dp
d
+e 43 r +e 44 ( V sd ) = s ( V sdV sd 0 ) + f
q f (25)
dt
dt
dt
Td
hc

Where
1

w

+( s w ) V
p
p
dh
dh
dt
s
d
1
1
V sd ( s ) + ( hw h f ) q f +
s V st s + w V wt w +md C p s ( V sd +V wd ) + r ( 1+ ) V r V
+
dt
hc
hc
dp
dp
dp
p
e 42=
( V )

e 43= r ( 1+ ) (s w V r)

V
r

e 44= s .
2.6 Summary
The model can be written as
e 11

d
dp
V wt ] +e 12 =q f q s .
[
dt
dt

24

e 21

d V wt
dp
+e 22 =Q+q f h f q s hs .
dt
dt

e 32

dr
dp
+ e33
=Q+q dc hc r .
dt
dt

e 42

h h w
dp
d
+e 43 r +e 44 ( V sd ) = s ( V sdV sd 0 ) + f
qf .
dt
dt
dt
Td
hc

where

( W s ) .
e11 =
e 12

d w
d S
= (V wt dp + V st dp )

W
h
(
w S h s)
.
e 21=

e 22=hs V st

[(

e 32= w

d
d
d
d
d
+V
h +h V
+V wt W
h V t +mt C p t s .
dp S st S dp s w wt dp W
dp w
dp

hw

h

r hc w ( 1 V ) V r + ( 1 r ) hc s + s s V V r + ( s + ( w s ) r ) hc V r V V t + mr
p
p
p
p
p

.
e 33=( ( 1 r ) s + r w ) hc V r

V
r .
1

w

+( s w ) V
p
p
dh
dh
dt
s
d
1
1
V sd ( s ) + ( hw h f ) q f +
s V st s + w V wt w +md C p s ( V sd +V wd ) + r ( 1+ ) V r V
+
dt
hc
hc
dp
dp
dp
p
e 42=
( V )

25

e 43= r ( 1+ ) (s w V r)

V
r

e 44= s .
2.7 Steady state solution of the model
q f =qs .
Q=q s hs q f hf .
Q=q dc h c r .
h
T d ( f hw )
qf .
hc s
V sd =V sd 0
Where qdc is given by equation (15) i.e.
q dc= 2 w A dc ( w s ) g v V r /k .
A convenient way to find the initial values is to first specify steam flow rate q s and steam
pressure p. The feedwater flowrate qf and input power Q are given by the first two
equations and the steam volume in the drum is given by the last equation. The steam
quality is obtained by solving the nonlinear equations.
Q= r hc 2 w Adc ( w s ) g v V r /k .

V =

w
s
( w s ) r
(1
ln 1+
) .
w s
s
( w s ) r

The steam volume in the drum then can be computed directly.


2.8 The Solution
The solution of the third order non linear model developed can be given by
E

dx
=b (26)
dt

26

Where

e 11
e
E= 21
0
0

e12
0 0
0 0
e22
e 32 e33 0
e 42 e43 e 44

q f q s
Q+q f h f qs h s
b=
Q+q dc hc r
.
s
hf h w
( V V sd 0 ) + h q f
T d sd
c
d V wt
dt
dp
dx
dt
=
dt d r .
dt
d V sd
dt
This is an ordinary differential equation which can be solved by MATLAB using the ODE
function. Basically we use ODE 45 since it is nonstiff differential equations. The ODE 45
implements the fourth or fifth order Runge-Kutta method.
2.9 Step Responses
Fuel Flow changes at medium load
A step change increase of 10 MW is given to the fuel flow rate and the results are
discussed below
As the steam flow out from the drum is constant ,this in turn keeps the pressure of the
drum constantly increasing at the same rate.The constantly increasing pressure in the
drum causes condensation to take place inside the drum which is the reason for an
increase in the water volume, Vwt within the drum.Initially the steam quality at riser
outlet shows a rapid increase and then as time value increases,the quality of steam tends
to become more stable with gradual increase. The volume of steam inside the drum
initially shows an increases by a small volume and eventually decreases as time value
27

increases. As seen from Figure 2 we note a sharp initial increase in the steam volume and
then a steep fall in the curve, the sharp increases could be atrributed with the increasing
steam flowrate in the riser whereas the steep fall occurs due to the increase in pressure
within the drum causing condensation to take place.
At the onset of the step there is a rapid increase in the outlet flow rate of the steam from
the risers as the flowrate of steam from the outlet of the riser needs to match the
downcomer flowrate we observe a decrease in the outlet steam flow rate .These flow rates
equalize almost after 30 seconds. The condensation flow changes in an almost step like
manner. A combination of water and steam dynamics are responsible for the response in
drum level indication and is somewhat complicated .The initial increase in the water level
is due to the rapid initial response of steam. The response in level is a combination of two
competing mechanisms. The water volume in the drum increases due to increased
condensation caused by increasing pressure. The volume of steam in the drum first
increases a little and then it decreases because of the increasing pressure.

28

Fig 2: Response due to step change in fuel flow at medium load.

Steam flow changes at medium load


A step increase of 10 kg/s in steam flow at medium load is given and the results
are discussed below.
As observed in figure 3 there is a linear decrease in the pressure of the steam
because of an increased steam flow rate. As we note a decrease in the pressure of
steam , this causes an increase in the evaporation rate of the water within the
drum, in turn causing an overall decrease in the water volume within the drum
boiler system. As mentioned above the steam quality at the riser outlet first
increases rapidly due to pressure decrease and it then decreases due to an increase
in the water circulation flow rate. The drop in steam pressure within the boiler
29

system causes an increase in the steam volume .There is very rapid increase of
flow out of steam from the riser as a reason of high pressure drop within the
system. After this initial transient response of the riser flow rate it decreases to
match the downcomer flow rate.The decreased steam pressure causes both the
downcomer as well as riser flow rates to increase. The constant decrease in the
pressure happens to create an almost step like decrease in the condensation flow
rate response.
The shrink and swell effect is clearly visible. The contributions from the volumes
of steam and water have initially the same sign. There would however be a
decrease in the water volume because of steam flow rate alterations.

Fig 2: Response due to step change in steam flow rate at medium load.

30

Chapter 3
Control Schemes

The feedback control scheme will be implemented to control the water level with
the conventional PID controller and advanced controller fuzzy logic
controller(FLC). However we will try only feedwater flow rate as the
manipulated variable and both servo and regulatory testing will be done.
The feedback control scheme
3.1 PID controllers
The control implemented by the PID controller can be given as
u ( t ) =K C e ( t ) +

KC t
de(t )
e (t)+ K C D

(27)
I 0
dt

Where u(t) control action taken by the PID controller


e(t) error at time t .
Kc proportional gain of controller
I integral time constant (s)
D derivative time constant (s)

Fig 4: feedback PID control scheme.( r(t) disturbance)(14).

31

The salient features of the PID controllers are

Eliminates offset due to integral action


Better stability criteria due to derivative action
If error is constant then no derivative action.
For a very noisy response with almost zero error the derivative term leads
to large control action which is not needed and hence a drawback.

3.1.1 Tuning methods


Tuning of a controller is a very tedious task. Tuning basically means to set the
parameters (proportional band/gain, integral gain/reset, derivative gain/rate) to get
its optimum values for some desired response. The most basic requirement is that
both response of the system should be stable i.e. the system should not give
unbounded oscillations. It seems even though there are only three parameters in
PID controller tuning is a tedious problem. There are various online and offline
methods for tuning a PID controller. Some of the methods with their advantages
and disadvantages are tabulated below.
Method

Advantages

Disadvantages

Manual Tuning

No math required; online.

Requires experienced
personnel.

Zeigler-Nichols

Proven method; online.

Process upset, some trialand-error, very aggressive


tuning

Software tools

Consistent tuning; online or offline - Some cost or training


can employ computer-automated
involved.
control system design (CAutoD)
techniques; may include valve and
sensor analysis; allows simulation
before downloading; can support
non-steady-state (NSS) tuning.

Cohen-Coon

Good process models.

Some math; offline; only


good for first-order
processes.

Table 1: Choosing a tuning method(14).


Manual Tuning
Manual tuning is a online tuning method and it basically requires an experienced
personnel. Even though the tuning method is manual some rules can be followed
32

for improved response. First of all set KI and KD values to zero. Increase KP until
the loop starts to oscillate. For a quarter amplitude decay type response the KP
value should be set as half of the value at which the response starts to oscillate.
Next we have to increase KI until the offset is eliminated in sufficient time of the
process and at last increase KD, if required until loop is quick to reach its reference
after a load disturbance. But, too much increase in KD can cause excessive
response and overshoot. A fast PID loop usually overshoots a little bit to reach its
response reference point more quickly; however in some system overshoot is not
acceptable, in which case we require an overdamped response.

Parameter

Rise time

Overshoot

Settling
time

Steady-state Stability
error

Kp

Decrease

Increase

Small
change

Decrease

Degrade

KI

Decrease

Increase

Increase

Eliminate

Degrade

KD

Minor
change

Decrease

Decrease

No effect in
theory

Improve in
Kd small

Table 2: Effects of increasing a parameter independently(14).


In our process we will try the manual tuning method only to tune the PID
controller.

33

Fig 5: Simulink model to control the level in feedback control scheme using the
PID controller.

3.2 Fuzzy Logic Controller


The basic and key concept of fuzziness is that it allows a gradual and continuous
transition rather than a sudden and abrupt change in values. For example in a
fuzzy set a member does not either or neither belongs to a group. Each and every
member have some membership in that group whereas in a normal set it either
belongs to a group or it neither belongs to a group[ either 0 or 1]. In fuzzy logic a
member can take any value between 0 to 1 depending on its membership of the
group i.e. how much it belongs to the group.The membership function of a set
maps each element to its degree i.e. it gives the degree of membership for each
element under consideration.
Fuzzy control is a control technique based on fuzzy logic. The basic idea of fuzzy
control is to apply fuzzy inference to control problems. In fuzzy control, the
control box includes fuzzification, fuzzy inference using fuzzy if-then rules, and
defuzzification procedures. Fuzzy rules can include human descriptive
judgements.
Commonly used fuzzy variables and their membership functions
We define fuzzy variables that can represent values of the input and output
variables.
A commonly used set of seven fuzzy variables follows:
NB = Negative Big
NM = Negative Medium
NS = Negative Small
ZO = Zero
PS = Positive Small
PM = Positive Medium
PB = Positive Big
Or, the two mediums, NM and PM, may be omitted, resulting in the following set
of five fuzzy variables. This smaller set of fuzzy variables is simpler, but it would
result less fine or delicate control. For simplicity, we will use this five fuzzy
variable version hereafter.
NB = Negative Big
NS = Negative Small
ZO = Zero
PS = Positive Small
PB = Positive Big
The next step is to define membership functions for these fuzzy variables.
Defining a membership function is up to us, and the selection of membership
functions affects the control performance. What membership function we choose
depends on many factors, such as the type of application, how much fine control
is required, how fast the control must be performed, and so on. A rule of thumb is
that simpler membership function causes lesser computation time but reduces fine
34

control. There are two categories of membership functions. One is continuous and
the other discrete

Fig 6: Graphical representations of continuous triangular membership functions for seven


fuzzy variables.
The membership functions can be of various shapes such as triangular, trapezoidal
Gaussian etc.
Typical fuzzy control setup
At each time interval our fuzzy control system receives specific values for two
inputs, E and E and yields one output, W.
Where En = ln-lsp : the level difference at time period n
E = En En-1 : changing rate of E at time period n
Just as E is the difference between the current and target values, rather than the
current control value itself, W is a deviation from the current output value. For
example, suppose that level is controlled by a feedwater flow rate, and the amount
of feedwater at time period n is qfn; then
qf n+1 = qf n +W.
Fuzzy if-then rules that derive W from E and E
The fuzzy if then rules described for our system for level control is
Rule 1: If E is ZO and E is NB then W is PB.
Rule 2: If E is ZO and E is NS then W is PS
.
.
.
.

35

Rule 25: If E is PB and E is PB then W is NB.

The rules are tabulated below.

NB

NS

ZO

PS

PB

NB

PB

PB

PM

PS

ZO

NS

PB

PB

PS

ZO

NS

ZO

PB

PS

ZO

NS

NB

PS

PM

ZO

NS

NB

NB

PB

ZO

NS

NB

NB

NB

Table 3: If then rules for our system for level control.


3.2.1 Optimization of the membership functions
The optimization of the membership functions to obtain the best response is done
by using a non-traditional optimization technique called the genetic algorithm
(GA).
Genetic Algorithm(GA)
Genetic algorithm is a non-traditional optimization technique developed by Prof.
John Holland and his colleagues and students at University of Michigan at around
1975 based on process of evolution. It is basically a search algorithm based on
mechanics of natural selection and natural genetics. It is based on the survival of
the fittest concept (darwanian theory) and simulates the process of evolution.
The key idea behind GA is that evolution is an optimizing process. The central
theme of research in GA is robustness.
Why GA?

36

Fig 7: A comparison between GA and traditional techniques.


As we can see from the figure 7 that F(x) is a function with of x over a region of x
with one global optimum and three local optimum for min(F(x)).
The table below clearly describes why we are using GA.
Initial guess

Traditional optimization

Genetic Algorithm

Region I

Converges to 1

Converges to 2

Region II

Converges to 2

Converges to 2

Region III

Converges to 3

Converges to 2

Table 4: A comparison between GA and traditional techniques


As we can see that in traditional optimization the solution approaches the local
optimum value whereas in GA the solution will always approach the global
optimum value.
However there is a disadvantage that GA is slow compared to other general
optimization technique.
The differences between GA and traditional methods of optimization can be stated
as:

GA work with coding of parameter set ,not the parameter themselves


GA search for population of point not a single point.
GA use the objective function information and not the derivative or second
derivative.
GA use stochastic transition rates , not deterministic rates.
37

In our case the objective function is to minimize the integral of square error(ISE)
and the variables are k1, k2 and k3. k1 , k2 , k3 are the values which need to be
multiplied with the ranges of the functions E, E and W. The optimum values of
k1,k2 and k3 are obtained by using GA inthe optimization toolbox in MATLAB.

Fig 8:Simulink model for feedback fuzzy logic controller(FLC)


3.3 Neural Network (NN) predictive control
Neural Networks as function approximators

As shown in Figure 9, we have some unknown function that we wish to approximate.We


want to adjust the parameters of the network so that it will produce the same response as
the unknown function, if the same input is applied to both systems.

Fig 9: Neural networks as function approximator(7).


Neuron Model

38

The scalar input p is multiplied by the scalar weight w to form wp , one of the
terms that is sent to the summer. The other input,1 , is multiplied by a bias b and then
passed to the summer. The summer input often referred to as net input , goes into a
transfer function, f which produces the scalar neuron output a.

Fig 10: Single Input neuron(7).


The neuron output is calculated as
a=f (+b) .(28)
w and b are both adjustable scalar quantities of the neuron.
The transfer function may be linear or non-linear function of n. One of the most
commonly used is the log-sigmoid transfer function.

Fig 11: log sigmoid transfer function(7).


This transfer function takes the input and squashes the output in the range of 0 to 1.
a=

1
1+en ..(29)

39

Fig 12: A multiple input neuron[7].

Typically a neuron has more than one input . A multiple input neuron is shown in figure
12.
The neuron has a bias b, which is summed with the weighted inputs to form the net input
n.
n=w1,1 p1 +w1,2 p2 ++ w1, R p R +b .
which can be written in matrix form as
n=+b ..(30)
Where the matrix W from the single neuron case has only one row.

Fig 13: Neuron with R inputs, Matrix notation[7].


Commonly one neuron, even with many inputs, is not sufficient. We might need five or
ten, operating in parallel, in what is called a layer. A single-layer network of S neurons.

40

Fig 14: Layer of S neurons[7].


The S- neuron R-input layer can also be shown in matrix notation as

Fig 15: Layer of S- neurons. Matrix notation [7]


Consider a network with several layers . Each layer has its own weight matrix W, its own
bias vector b a net input vector n, and an output vector a. We need to introduce some
additional notation to distinguish between these layers. We will use superscripts to
identify the layers. Thus, the weight matrix for the first layer is written as W1, and the
weight matrix for the second layer is written as W2. This notation is used in the threelayer network shown in Figure 16. As shown, there are R inputs, S1 neurons in first layer,
S2 neurons in second layer etc. A layer whose output is the network output is called an
output layer. The other layers are called hidden layers.

41

Fig 16: Three- Layer Network[7].


The first stage of model predictive control is to train a neural network to represent the
forward dynamics of the plant. The prediction error between the plant output and the
neural network output is used as the neural network training signal. The process is
represented by Figure 17.
One standard model that has been used for nonlinear identification is the Nonlinear
Autoregressive-Moving Average (NARMA) model:
y ( k +d )=h[ y ( k ) , y ( k1 ) , , y ( kn+ 1 ) , u ( k ) , u ( k1 ) , , u ( km+1 ) ] ..(31)
where u(k) is the system input , y(k) is the system output and d is the system delay (we
will use a delay of 1 for the predictive controller).

Fig 17: Plant Identification[7].


For the identification phase, we train a neural network to approximate the nonlinear
function . The structure of the neural network plant model is given in Figure 14, where
the blocks labelled TDL are tapped delay lines that store previous values of the input
signal.

42

Fig 18: Neural network plant model[7].


We have modified our previous notation here, to allow more than one input into the
network. IWi,j is a weight matrix from input number j to network number i.
The equation for the plant model is given by

^ y p ( k ) , , y p ( kn+1 ) ,u ( k ) , , u ( km+1 ) ; x ]
y m ( k +1 )= h[
.(32)
^
where h[. , x ] is a function implemented by the neural network, and x is a vector

containing all the network weight and biases.


The model predictive control method is based on the receding horizon technique. The
neural network model predicts the plant response over a specified time horizon. The
predictions are used by a numerical optimization program to determine the control signal
that minimizes the following performance criterion over the specified horizon.
y r (k + j)

'
'
2
u ( k + j1 )u (k + j2)

..(33)

N2

J=
j =N 1

where N1 , N2 and Nu define the horizons over which the tracking error and the control
increments are evaluated. The u variable is the tentative control signal , yr is the desired
response and ym is the network model response. The value determines the contribution
that the sum of the squares of the control increments has on the performance index..
The following block diagram illustrates the model predictive control process. The
controller consists of the neural network plant model and the optimization block. The
optimization block determines the values of u that minimize J and then the optimal u is
the output to the plant.

43

Fig 19: Neural network predictive control[7].

Fig 20: The Simulink model for neural network predictive control.

44

Chapter 4
Results and Discussions
4.1 PID controller
4.1.1 Regulatory Problem
In the first regulatory problem we are giving a step change in fuel flow as 10 MW.
The PID parameters obtained by manual tuning are
KC = 500
I = 1 , D = 1.
The response of the system can be seen as follows

Fig 20: PID response for a step change in fuel flow.


The response obtained is a under damped response and the charecteristic of the
response are
Rise time, tr = 0 s
Peak time , tp= 5 s
Time period, T= 30 s
45

Response time , ts = 100 s


Decay ratio = 0.33.
Overshoot = 0.58
The manipulated variable i.e. feedwater flow rate changes are given by

Fig 21 : Changes in feed water flow rate to control the level.


The changes in the feed water flow rate at the beginning drops to almost 26 kg/s
and then rises to almost 55 kg/s and after about 160 s it settles to a constant value
of 51 kg/s.
In the second regulatory problem we are giving a step change in steam flow as 10
kg/s.
The PID parameters obtained by manual tuning are
KC = 500
I = 1 , D = 1.
The response of the system can be seen as follows

46

Fig 22: PID response for a step change in steam flow.


The response obtained is a under damped response and the charecteristic of the
response are
Rise time, tr = 0 s
Peak time , tp= 4 s
Time period, T= 30 s
Response time , ts = 110 s
Decay ratio = 0.5.
Overshoot = 0.707
The manipulated variable i.e. feedwater flow rate changes are given by

47

Fig 23 : Changes in feed water flow rate to control the level.


The changes in the feed water flow rate at the beginning drops to almost 40 kg/s
and then rises to almost 65 kg/s and after about 200 s it settles to a constant value
of 59 kg/s. The water level increases at last to compensate to the losses in steam
due to increase in steam flow rate.
4.1.2 Servo problem
In the servo problem we are giving a step change of 0.1 m in the level set point.
The PID parameters obtained by manual tuning are
KC = 700
I = 3 , D = 1.
The response of the system can be seen as follows

48

Fig 24: PID response for a step change in steam flow.


The response obtained is a under damped response and the charecteristic of the
response are
Rise time, tr = 11 s
Peak time , tp= 21 s
Time period, T=62 s
Response time , ts = 90 s
Decay ratio = 0.146.
Overshoot = 0.38
The manipulated variable i.e. feedwater flow rate changes are given by

49

Fig 25 : Changes in feed water flow rate to control the level.(servo problem)
The changes in the feed water flow rate at the beginning rises to almost 180 kg/s
and then drops to almost 15 kg/s and after about 150 s it settles to a constant
value of 50 kg/s.
4.2 Fuzzy Logic Controller
4.2.1 Regulatory Problem

Step Change in fuel flow rate by 10 MW

The membership function of the fuzzy logic controller before optimization are shown
below

50

Fig 26 : membership function for input variable E. Range [-0.1 0.1]

Fig 27: membership function for input variable E. Range [-0.1 0.1]

Fig 28: membership function for output variable W . Range [-20 20]

The responses before and after optimization of the membership functions are compared
below. As can be seen from the figure that the integral of square error (ISE) before and
after optimization have a difference of almost 26. The three values k1,k2 and k3 which
are multiplied with the membership functions of E,E and W respectively to minimize
ISE are 0.109,0.814 and 0.302 respectively.

51

Fig 27: response before optimization of membership functions (change in fuel


flow)

Fig 28: results after optimization of membership functions (change in fuel flow)
ISE=122.0842

Final results for step change in fuel flow

As we see from the response that in fuzzy control the response obtained is more
steady as obtained in PID controller. The response rises a peak of about 0.1 m
above set point and then eventually decreases to the set point. The response
obtained after 90 seconds.

52

Fig 29: response of FLC due to step change in fuel flow rate.

Fig 30: changes in feedwater flow rate to control the level for FLC for a step in fuel flow.
As we can see from figure 20 that the changes in feedwater flow rate can be limited
within a range ,in or case it is +- 20 kg/s but in PID controller it is not possible if the
disturbance by somehow increases to a great extent.

53

4.2.2 Servo Problem

The membership function of the fuzzy logic controller before optimization are shown
below

Fig 31 : membership function for input variable E. Range [-0.1 0.1]

Fig 32: membership function for input variable E. Range [-0.1 0.1]

54

Fig 33: membership function for output variable W . Range [-20 20]

The responses before and after optimization of the membership functions are compared
below. As can be seen from the figure that the integral of square error (ISE) before and
after optimization have a difference of almost 0.3 which is low but the response time
decreases by an extent of almost 5 s. The three values k1,k2 and k3 which are multiplied
with the membership functions of E,E and W respectively to minimize ISE are
1.981,1.593 and 1.34 respectively.

Fig 34: response before optimization of membership functions (change in set point )
ISE=156.6541

Fig 35: response after optimization of membership functions (change in set point )
ISE=156.333

55

Final results for step change in set point.

Fig 36: response of FLC due to step change in set point.

Again we can change from the response that it is more smooth than the response obtained
by PID controller and nonoscillatory. The response time is about 105 seconds.

The feed water flow rate is shown below

56

57

58

Fig 37: changes in feedwater flowrate to control the level.(servo problem)

4.3 Comparison between PID and FLC


Step
PID
FLC
PID
FLC
PID
FLC
Change
ISE
ISE
Response
Response
Type of
Type of
59

in

time
time
response
response

Fuel flow
147.57
122.08
100 s
90 s
Oscillatory
Smooth
Steam
147.55
-------110 s
-------Oscillatory

60

Smooth
Flow

Set Point
160.95
156.33
90 s
105 s
Oscillatory
Smooth

Table 4: Comparison between PID and FLC response

Chapter 5

Conclusion
After analyzing the results we can conclude as:

The model obtained clearly takes the shrink and swell effect in the drum
The water level contribution(lw) to the water level(l) actually is the water
in the drum and hence we can distinguish it from the model.
Both servo and regulatory problems are taken into account to control the
water level.
The feed water flow rate is very efficient in controlling the level of water.
PID gives an oscillatory response whereas FLC gives a smooth response.
We can restrict the manipulated variable, in our case the feed water flow
rate to a certain range in FLC but it is not possible in PID controllers.
61

References:
1) K.J.Astrom, R.D.Bell, Drum-boiler dynamics, Automatica,2000,vol 36,pg 363378.
2) A.Parry, J.F. Petotrot and W.J.Vivier. Recent progress in sg level control in
French pwr plants. In Proc. Int. Conf on Boiler Dynamics and Control in
Nuclear Powerstations, pg 81-88. British Nuclear Energy Society ,1995
3) H.H. Hacene Habbi, M.Zelmat, B.O. Bouamama,A dynamic fuzzy model for
drum boiler turbine system,Automatica,2002,vol 39,pg 1213-1219.

62

4) E.J.Adam, J.L.Maarchetti (1997) ,Dynamic Simulation of large boilers with


natural circulation, Computers and Chemical Engineering,1999,vol 23,pg 10311040.
5) M.E. Flynn, M.J.O.Malley(1999), A drum boiler model for long term power
system dynamic simulation, IEEE transactions on Power Systems,1999, Vol. 14,
pg .
6) H.Kim, S.Choi(2005), A model on water level dynamics in natural circulation
drum-type boilers, International Communications in Heat and Mass
Transfer,2005,vol 32,pg 786-796.
7) M.T.Hagan,H.B.Demuth,O.D.Jesus, An introduction to use of neural networks in
control system, International journal of robust and non linear control,2002, Vol
12 ,pg 959-985.
8) M. Hudson Beale, M. T. Hagan, H. B. Demuth,Neural Network Toolbox 7,
Users Guide MATLAB.
9) D.M. Himmelblau,Applications of Artificial Neural Networks in Chemical
Engineering, Korean Journal. Chemical Engineering.2000,vol 17,pg 373-392.
10) Toshinori Munakata, Fundamentals of the New Artificial Intelligence, SpringerVerlag London Limited, 2008, ISBN- 978-1-84628-839-5.
11) Fuzzy Logic Toolbox, Users Guide, MATLAB ,R2014a.
12) Basics of S-functions retrieved march 5, 2014 from the world wide web
http://www.mathworks.in/help/simulink/s-function-basics.html
13) Fuzzy Logic toolbox retrieved april 5, 2014 from the world wide web
http://www.mathworks.in/products/fuzzy-logic/
14) PID Controller retrieved may 9, 2014 from the world wide web
http://en.wikipedia.org/wiki/PID_controller.
15) Neural Network toolbox retrieved may 5, 2014 from the world wide web
http://www.mathworks.in/products/neural-network/

63

Appendix A
MATLAB CODE
function[sys,x0,str,ts]=sfd302_sfcn(t,x,u,flag,x_init)
%sfd302 S-function version of the four state model
%compatible with simulink block diagrams.
global qr qdc qct;
%plant parameters------------------------------mt=300000;mr=100000;md=20000;Cp=650;
Cfw=4.18;Ad=23;Vd=37;Vr=37;Vdc=11;
Vt=Vd+Vr+Vdc;
ke=200;Vsd0=8;beta=0.3;
%properties of steam and water in saturated table
a01=2.7254E6;a11=-1.8992E4;a21=-1160.0;
a02=53.1402;a12=7.673;a22=0.36;
a03=1.4035E6;a13=4.9339E4;a23=-880.0;
a04=691.35;a14=-18.672;a24=-0.0603;
a05=310.6;a15=8.523;a25=-0.33;
%------------------------------------------------if abs(flag) ==1, %compute state derivatives
%state initial conditions
Vwt=x(1);
p=x(2);
64

ar=x(3);
Vsd=x(4);
%controls or inputs
Q=u(1)*1e6; %conversion to watts
qf=u(2);
tf=u(3);
qs=u(4)+4.8*(p-8.5); %correction for steam transducer
% properties of steam and water in saturated state
hs=a01+(a11+a21*(p-10))*(p-10);
dhsdp=a11+2*a21*(p-10);
rs=a02+(a12+a22*(p-10))*(p-10);
drsdp=a12+2*a22*(p-10);
hw=a03+(a13+a23*(p-10))*(p-10);
dhwdp=a13+2*a23*(p-10);
rw=a04+(a14+a24*(p-10))*(p-10);
drwdp=a14+2*a24*(p-10);
ts=a05+(a15+a25*(p-10))*(p-10);
dtsdp=a15+2*a25*(p-10);
%properties of water in subcritical state
hf=(Cfw*tf+p*1e3/rw)*1e3;
%the model equations-------------------hc=hs-hw;
hr=ar*hs+(1-ar)*hw;
%average steam quality volume rati and partial derivatives
z=ar*(rw-rs)/rs;
av=rw/(rw-rs)*(1-(1/z)*log(1+z));
davdar=rw/rs*((1/z)*log(1+z)-1/(z+1))/z;
zp=(rs*drwdp-rw*drsdp)*ar/rs/rs;
z1=(rw*drsdp-rs*drwdp)/(rw-rs)/(rw-rs);
z2=rw/(rw-rs)*((1/z)*log(1+z)-1/(1+z))/z*zp;
davdp=z1*(1-(1/z)*log(1+z))+z2;
%circulation flow
s1=ke*(rw-rs)*Vr*av;
qdc=sqrt(s1);
%equations for coefficents of derivatives of state variables
Td=600/qs;
Vst=Vt-Vwt;
Vwd=Vwt-Vdc-(1-av)*Vr;
e11=rw-rs;
e12=Vst*drsdp+Vwt*drwdp;
e21=hw*rw-hs*rs;
e22x=-Vt*1e6+mt*Cp*dtsdp;
e22=Vst*(hs*drsdp+rs*dhsdp)+Vwt*(hw*drwdp+rw*dhwdp)+e22x;
e3w=(rw*dhwdp-ar*hc*drwdp)*(1-av)*Vr;
e3x=(rs+(rw-rs)*ar)*hc*Vr*davdp-Vr*1e6+mr*Cp*dtsdp;
e32=((1-ar)*hc*drsdp+rs*dhsdp)*av*Vr+e3w+e3x;
e33=(rs+(rw-rs)*ar)*hc*Vr*davdar;
e42y=(1+beta)*ar*Vr;
e42x=e42y*((1-av)*drwdp+av*drsdp+(rs-rw)*davdp)+Vsd*drsdp;
e42=(rs*Vsd*dhsdp+rw*Vwd*dhwdp-Vsd*1e6+md*Cp*dtsdp)/hc+e42x;
65

e43=(1+beta)*(ar*Vr*(rs-rw)*davdar);
e44=rs;
e=[e11,e12,0,0
e21,e22,0,0
0,e32,e33,0
0,e42,e43,e44];
%the right hand side of state equations
b4=(hf-hw)*qf/hc+rs*(Vsd0-Vsd)/Td;
b=[qf-qs; Q+qf*hf-qs*hs; Q-qdc*ar*hc; b4];
%solve linear equation for derivatives
dx=e\b;
qx=(rw-rs)*Vr*davdp*dx(2)+(rw-rs)*Vr*davdar*dx(3);
%two important flows for understanding behaviour
qr=qdc-(av*drsdp+(1-av)*drwdp)*Vr*dx(2)+qx;
qctx=rs*Vst*dhsdp+rw*Vwt*dhwdp-Vt*1e6+mt*Cp*dtsdp;
qct=((hw-hf)*qf+qctx*dx(2))/hc;
%step the derivatives, dx is a 4X1 vector
sys = [dx];
%------------------------------------------------------------elseif flag==3, %Compute outputs
%extract state variables
Vwt=x(1);
p=x(2);
ar=x(3);
Vsd=x(4);
%drum level
rs=a02+(a12+a22*(p-10))*(p-10);
rw=a04+(a14+a24*(p-10))*(p-10);
z=ar*(rw-rs)/rs;
av=rw/(rw-rs)*(1-(1/z)*log(1+z));
Vwd=Vwt-Vdc-(1-av)*Vr;
ls=Vsd/Ad;
lw=Vwd/Ad;
l=lw+ls;
sys=[l,p,lw,ls,qr,av,qdc,ar,Vwt,Vsd,qct];
%-------------------------------------------------------------elseif flag==0, %INITIALIZATIONS
str=[];
sizes(1)=4; %4 continious states
sizes(2)=0; %0 discrete states
sizes(3)=11; % 11 outputs
sizes(4)=4; %4 inputs
sizes(5)=0; % no discontinious roots
sizes(6)=0; % no direct term
sizes(7)=1; ts=[0,0]; %efficency fix(see[1])
sys=sizes';
x0(1)=x_init(1);
x0(2)=x_init(2);
66

x0(3)=x_init(3);
x0(4)=x_init(4);
else
sys=[]; %flags 2 or 4 , not considered since we have no discrete states.
end;
% Also flag 5 is of no interest.

Appendix B

Optimization Code

The code for the fuzzy logic file is: d=newfis('boiler','mamdani');

d=addvar(d,'input','err',[-0.1 0.1]*k1); d=addmf(d,'input',1,'nb','trimf',[-0.19 -0.1


-0.01]*k1); d=addmf(d,'input',1,'ns','trimf',[-0.03 -0.015 0]*k1);
d=addmf(d,'input',1,'z0','trimf',[-0.0004 0 0.0004]*k1); d=addmf(d,'input',1,'ps','trimf',[0
0.015 0.03]*k1); d=addmf(d,'input',1,'pb','trimf',[0.01 0.1 0.19]*k1);

d=addvar(d,'input','dele',[-0.1 0.1]*k2); d=addmf(d,'input',2,'nb','trimf',[-0.15 -0.1


-0.05]*k2); d=addmf(d,'input',2,'ns','trimf',[-0.1 -0.05 0]*k2);
d=addmf(d,'input',2,'z0','trimf',[-0.0004 0 0.0004]*k2); d=addmf(d,'input',2,'ps','trimf',[0
0.05 0.1]*k2); d=addmf(d,'input',2,'pb','trimf',[0.05 0.1 0.15]*k2);
67

d=addvar(d,'output','w',[-20 20]*k3); d=addmf(d,'output',1,'nb','trimf',[-27.5 -20


-12.5]*k3); d=addmf(d,'output',1,'nm','trimf',[-15 -10 -5]*k3);
d=addmf(d,'output',1,'ns','trimf',[-10 -5 0]*k3); d=addmf(d,'output',1,'z0','trimf',[-2.5 0
2.5]*k3); d=addmf(d,'output',1,'ps','trimf',[0 5 10]*k3); d=addmf(d,'output',1,'pm','trimf',
[5 10 15]*k3); d=addmf(d,'output',1,'pb','trimf',[12.5 20 27.5]*k3); ruleList=[ ...

11711
12711
13611
14511
15411
21711
22711
23511
24411
25311
31711
32511

33411
34311
35111

41611
42411
43311
44111
45111
68

51411

52311
53111
54111

5 5 1 1 1]; d=addrule(d,ruleList);

The code for the process file is:

mt=300000;mr=100000;md=20000;Cp=650;
Cfw=4.18;Ad=23;Vd=37;Vr=37;Vdc=11;
Vt=Vd+Vr+Vdc;
ke=200;Vsd0=8;beta=0.3;

%properties of steam and water in saturated table a01=2.7254E6;a11=-1.8992E4;a21=1160.0; a02=53.1402;a12=7.673;a22=0.36; a03=1.4035E6;a13=4.9339E4;a23=-880.0;


a04=691.35;a14=-18.672;a24=-0.0603; a05=310.6;a15=8.523;a25=-0.33;

dt=1;

69

% t(1)=0; ise=zeros(1,200); err=zeros(1,200); qf=zeros(1,200); p=zeros(1,200);


ar=zeros(1,200); t=zeros(1,200);t=1:1:200; Vwt=zeros(1,200); Vsd=zeros(1,200);

l=zeros(1,200);lw=zeros(1,200);ls=zeros(1,200);Q=zeros(1,200);qs=zeros(1,200); for
i=1:200

Vwt(1)=57.2;
p(1)=8.5;
ar(1)=0.0511;

Vsd(1)=4.8971; Q(1:50)=86.813*1e6;%conversion to watts

Q(51:200)=96.813*1e6;
qf(1)=50;

tf=240; qs(1:200)=50+4.8*(p(i)-8.5); %qs(51:200)=60+4.8*(p(i)-8.5);

% properties of steam and water in saturated state hs=a01+(a11+a21*(p(i)-10))*(p(i)-10);


dhsdp=a11+2*a21*(p(i)-10); rs=a02+(a12+a22*(p(i)-10))*(p(i)-10);
drsdp=a12+2*a22*(p(i)-10);

hw=a03+(a13+a23*(p(i)-10))*(p(i)-10); dhwdp=a13+2*a23*(p(i)-10); rw=a04+


(a14+a24*(p(i)-10))*(p(i)-10); drwdp=a14+2*a24*(p(i)-10); ts=a05+(a15+a25*(p(i)10))*(p(i)-10); dtsdp=a15+2*a25*(p(i)-10); %properties of water in subcritical state
hf=(Cfw*tf+p(i)*1e3/rw)*1e3;
70

%the model equations--------------------

hc=hs-hw; hr=ar(i)*hs+(1-ar(i))*hw;

%average steam quality volume rati and partial derivatives z=ar(i)*(rw-rs)/rs;

av=rw/(rw-rs)*(1-(1/z)*log(1+z)); davdar=rw/rs*((1/z)*log(1+z)-1/(z+1))/z;
zp=(rs*drwdp-rw*drsdp)*ar(i)/rs/rs; z1=(rw*drsdp-rs*drwdp)/(rw-rs)/(rw-rs); z2=rw/(rwrs)*((1/z)*log(1+z)-1/(1+z))/z*zp; davdp=z1*(1-(1/z)*log(1+z))+z2; %circulation flow

s1=ke*(rw-rs)*Vr*av; qdc=sqrt(s1);

%equations for coefficents of derivatives of state variables Td=600/qs(i);

Vst=Vt-Vwt(i); Vwd=Vwt(i)-Vdc-(1-av)*Vr; e11=rw-rs; e12=Vst*drsdp+Vwt(i)*drwdp;


e21=hw*rw-hs*rs; e22x=-Vt*1e6+mt*Cp*dtsdp;

e22=Vst*(hs*drsdp+rs*dhsdp)+Vwt(i)*(hw*drwdp+rw*dhwdp)+e22x; e3w=(rw*dhwdpar(i)*hc*drwdp)*(1-av)*Vr; e3x=(rs+(rw-rs)*ar(i))*hc*Vr*davdp-Vr*1e6+mr*Cp*dtsdp;


e32=((1-ar(i))*hc*drsdp+rs*dhsdp)*av*Vr+e3w+e3x; e33=(rs+(rwrs)*ar(i))*hc*Vr*davdar;

e42y=(1+beta)*ar(i)*Vr; e42x=e42y*((1-av)*drwdp+av*drsdp+(rs-rw)*davdp)
+Vsd(i)*drsdp; e42=(rs*Vsd(i)*dhsdp+rw*Vwd*dhwdpVsd(i)*1e6+md*Cp*dtsdp)/hc+e42x; e43=(1+beta)*(ar(i)*Vr*(rs-rw)*davdar);

e44=rs;
e=[e11,e12,0,0
e21,e22,0,0

71

0,e32,e33,0
0,e42,e43,e44];

%the right hand side of state equations b4=(hf-hw)*qf(i)/hc+rs*(Vsd0-Vsd(i))/Td;

b=[qf(i)-qs(i); Q(i)+qf(i)*hf-qs(i)*hs; Q(i)-qdc*ar(i)*hc; b4]; %solve linear equation for


derivatives

dx=e\b; qx=(rw-rs)*Vr*davdp*dx(2)+(rw-rs)*Vr*davdar*dx(3);
%two important flows for understanding behaviour qr=qdc-(av*drsdp+(1av)*drwdp)*Vr*dx(2)+qx; qctx=rs*Vst*dhsdp+rw*Vwt(i)*dhwdpVt*1e6+mt*Cp*dtsdp; qct=((hw-hf)*qf(i)+qctx*dx(2))/hc; Vwt(i+1)=(Vwt(i)+dx(1)*dt);

p(i+1)=(p(i)+dx(2)*dt);
ar(i+1)=ar(i)+dx(3)*dt;
Vsd(i+1)=Vsd(i)+dx(4)*dt;
ls(i)=Vsd(i)/Ad;
lw(i)=Vwd/Ad;
l(i)=lw(i)+ls(i);

lwsp(1:50)=0.859;

%lwsp(51:200)=0.909; err(i)=lw(i)-lwsp(i);

if(err(i)>=0.00001 || err(i)<=-0.00001) if i==1;

ise(i)=err(i)*(err(i)); else

ise(i)=ise(i-1)+err(i)*(err(i)); end
72

end

if i==1 dele=0;

else dele=err(i)-err(i-1);

end

w=evalfis([err(i) dele], d); qf(i+1)=50+w;

end iseplot=ise(200);

The objective function is


:

function [iseplot]=objective(par) k1=par(1);

k2=par(2);

k3=par(3);
fuzzyboils;

drumboilerdynamics; end

73

74

You might also like