Main Document
Main Document
TKP5900
Master Thesis
Control structure design for two
distillation columns in sequence
Written by:
MTKJ
ii
Abstract
Even for simple distillation systems with only two columns, the control problem
can be significant. This project provides an initial outline of a systematic pro-
cedure for finding the optimal control structure, through identification of active
constraint regions and self-optimizing variables.
The procedure is used to study a system of two distillation columns in sequence
in order to find the optimal control structure. To achieve optimal control, the
active constraints have to be identified and controlled tightly. Which constraints
that are active depend on the external conditions. This project has mapped how
the active constraints change following variations in the steam price and feed
flow.
Two of the active constraint regions were studied further. A rigorous steady
state analysis was conducted to find variables, which when controlled to constant
value, keep the operation close to optimal. Variables with such properties are said
to be self-optimizing. Controlled variables consisting of single measurements
and measurement combinations have been investigated. In a constraint region
with low energy price, controlling a tray temperature in the top part of the second
column was found to be optimal. In a second region studied, where only the
product specification of the valuable product is active, three tray temperatures
that would keep the system close to optimum were identified.
iii
iv
iv
Sammendrag
v
vi
vi
Acknowledgments
This master thesis was completed during the autumn semester of 2013, and is the
final part of my integrated Master of Science degree in Chemical Engineering at
the Norwegian University of Science and Technology.
It has been a rewarding semester, sometimes with moments of great frustration,
for instance when the Matlab scripts did not work, and sometimes very exiting
when everything ran very smoothly.
I would like to express sincere gratitude to my supervisor professor Sigurd Sko-
gestad at NTNU, for giving me the opportunity to work on this project and his
excellent guidance and encouragement. It has been interesting, exciting and chal-
lenging.
I would also give great thanks to my two co-supervisors, Johannes Jäschke and
Vladimiros Minasidis for many valuable and stimulating discussions.
I would also like to thank my fellow students for good friendship, as well as many
enjoyable and refreshing lunch break conversations, and the coffee machine at
the institute, keeping me agile into the small hours.
vii
viii
Declaration of compliance
————————————————
viii
Contents
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Sammendrag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
1 Introduction 1
1.1 Aim of the thesis . . . . . . . . . . . . . . . . . . . . . . . . . 2
List of symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Theoretical background 3
2.1 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Distillation theory . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Constraint curve and and active constraint regions . . . . . . . . 5
2.4 Plantwide control by time scale separation . . . . . . . . . . . . 6
2.4.1 Self-optimizing variables . . . . . . . . . . . . . . . . . 6
2.4.2 Exact local method . . . . . . . . . . . . . . . . . . . . 10
2.5 Degrees of freedom . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Mathematical tools . . . . . . . . . . . . . . . . . . . . . . . . 13
2.7 The "branch and bound" algorithm . . . . . . . . . . . . . . . . 14
ix
x Contents
6 Discussion 59
6.1 Systematic procedure . . . . . . . . . . . . . . . . . . . . . . . 59
x
Contents xi
7 Conclusion 65
7.1 Suggestions for future work . . . . . . . . . . . . . . . . . . . . 66
Appendices 71
C Matlab scripts 81
C.1 Search for the active constraint region active constraint region . 82
C.2 Self optimizing variables . . . . . . . . . . . . . . . . . . . . . 87
C.2.1 Direct evaluation . . . . . . . . . . . . . . . . . . . . . 87
C.2.2 Global direct evaluation of loss . . . . . . . . . . . . . 91
C.2.3 The "exact local method" . . . . . . . . . . . . . . . . . 95
C.3 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
C.3.1 Steady state model of column A . . . . . . . . . . . . . 98
C.3.2 Temperature estimator . . . . . . . . . . . . . . . . . . 101
C.3.3 The nonlinear constraints . . . . . . . . . . . . . . . . . 102
C.3.4 Initial condition for a nominal point . . . . . . . . . . . 105
xi
xii Contents
xii
List of Figures
xiii
xiv List of Figures
xiv
List of Figures xv
6.2.1 Active constraint region map for two columns found by Ja-
cobsen [3]. The colors of the border lines refer to the different
constraints. . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.3.1 Proposed control structure for controlling a tray temperature
in the top part of the second column by manipulating the re-
flux in column 1. The temperature in the second column is
arranged in cascade with a local temperature loop in column 1. 62
xv
xvi List of Figures
xvi
List of Tables
xvii
xviii List of Tables
xviii
List of symbols
xix
xx
xx
xxi
xxi
xxii
xxii
Chapter 1
Introduction
The control structure of a system is highly important for optimal plant operation.
A control structure problem deals with selecting the appropriate controlled vari-
ables and pairing them with variables that can be manipulated. Numerous studies
have been done in this field, but few have approached the problem in a systematic
fashion. The plantwide control procedure by Skogestad [2] gives a mathematical
framework to the problem, and a mathematical approach is necessary in order to
1
2 1.1. Aim of the thesis
identify the optimal structure in every case. Based on the mathematical frame-
work one searches for the controlled variables that drive the system to the new
optimal state when the system is exposed to disturbances. The loss is calculated
by minimizing the change of a cost function. This approach to control design is
well described by Larson and Skogestad [2].
To separate three components, two distillation columns are needed. The optimal
control of two distillation columns in sequence with the use of self-optimizing
control, was discussed by Magnus Jacobsen as part of his PhD thesis [3]. In the
present project the work of Jacobsen has been used as a basis for further studying
the optimal control of two distillation column in sequence.
The aim of this thesis has been to formulate the outline of a procedure to find
the primary controlled variables, and use this to study control for a system of
two distillations column in sequence. Key questions are, i) how to identify active
constraint regions and ii) how to find self-optimizing controlled variables. The
first task was to identify a map of how the set of active constraints change as
a function of feed flow and steam price. Two of the constraint regions were
studied further in order to find variables that when kept constant, maintain the
system close to the optimal point. In addition to study controlled variables based
on single measurements, the benefit of using multiple measurement has been
considered.
2
Chapter 2
Theoretical background
This chapter presents the theoretical background for work done in this thesis. Op-
timization problems are first defined mathematically, followed by a brief intro-
duction to distillation. The principles behind active constraints, self-optimizing
control and plant-wide control are explained. Methods for finding self-optimizing
variables, including the "exact local method", are described towards the end.
2.1 Optimization
The problem of finding the optimal operation of a chemical plant can be struc-
tured mathematically as a constraint optimization problem. The aim is to mini-
mize the cost function, J, within the boundaries of the system. From a practical
point of view, the constraints can be product specifications, safety standards or
physical limitations. This is mathematically expressed as:
3
4 2.2. Distillation theory
min J(x, u, d)
x,u
ci (x, u, d) = 0, i ∈ ε
Where J denotes the cost function and c denotes the constraints. Usually, the
set of equality constraints includes the process model while the set of inequality
constraints includes the operational constraints.
The relationship between the vapor composition, y, and the liquid composition,
x, is given by the equilibrium curve. The equilibrium curve in a multicomponent
system with constant relative volatility, α, is given by equation 2.2.1, where i
is the component number, and k refers to component with the highest boiling
point [5].
αik xi
yi = k−1
(2.2.1)
1 + ∑ j=1 (α jk − 1)x j
4
2.3. Constraint curve and and active constraint regions 5
5
6 2.4. Plantwide control by time scale separation
6
2.4. Plantwide control by time scale separation 7
Figure 2.4.1: Typical control hierarchy of a chemical plant by time scale deviation [6].
see section 2.3). After controlling all the active constraints, the question be-
comes; what more to control? The preferred solution would be to find variables
or combination of variables that, when held constant, maintains the systems at
its most profitable state. These "magic" variables is by Skogestad et al. called
7
8 2.4. Plantwide control by time scale separation
Essentially, the task is to find controlled variables, that minimizes the loss when
the system is exposed disturbances. The loss is here defined as the difference
between the cost when the system is controlled and the cost at its optimal state:
The simplest search for self-optimizing variables is trial and error, i.e. picking
a controlled variable and looking at the loss when the system is exposed to a
disturbance. This method is called direct evaluation of loss. Figure 2.4.2 gives
an illustration of the loss, while keeping the input, u, constant at u = uopt,d ∗ , for
a typical cost function.
Figure 2.4.2: Illustration of loss while keeping the input, u, constant at u = uopt,d ∗ and
exposing the system to a disturbance, d, [7].
8
2.4. Plantwide control by time scale separation 9
c = Hy (2.4.2)
Figure 2.4.3: Control structure diagram, when selection the controlled variables, c, from
the measurements, y, with a selection matrix, H. d denotes disturbances
and n denotes the implementation error.
In a controlled system the input values, u, are regulated in order to keep the
controlled variables, c, constant at there set-points, cs . The magnitude of the loss
depends on the controlled variables selected. Figure 2.4.4 illustrates the loss as
a consequence of a disturbance, where either of the two controlled variables, c1 ,
or, c2 , are kept constant.
9
10 2.4. Plantwide control by time scale separation
A more practical approach to search for the controlled variables is given by the
"exact local method" as it includes measurements and implementation errors [8].
The objective is here to find the linear combination of measurements that would
give the smallest loss. The exact local method is based on applying the following
assumptions:
• A linear model
10
2.4. Plantwide control by time scale separation 11
A linear steady state model of the effect of the input, u, and disturbances, d, and
the measurements, y, is assumed. The linear relationship becomes:
y = Gy u + Gyd d (2.4.4)
Here Gy and Gyd are transfer functions from the input variables, u, and the distur-
bances, d, to the measurement, y. At steady state the transfer function is reduced
to the steady state gain.
As for direct evaluation the goal of the "exact local method" is to find the se-
lection matrix, H, that would minimize the loss. Usually, there are more than
one disturbance. As the various disturbances might move the system in different
directions, the magnitude of the disturbance and measurement errors, when cal-
culating the loss, needs to be further defined. Two possibilities are considered,
called "worst case" and "average loss".
• Worst case loss is the loss when the combined normalization vectors for
disturbances and measurement errors have 2-norm less than 1.
" #
d
≤1 (2.4.5)
ny 2
• Average loss is the loss when the disturbance and the measurement errors
11
12 2.4. Plantwide control by time scale separation
Based on these definitions, expressions for the worst case and average loss can
be derived. The expressions are given below as a function of H:
1
Lwc = σ̄ (M)2 (2.4.7)
2
1
Lavg = ||M||2F (2.4.8)
2
Where
1/2
M(H) = Juu (HGy )−1 HY (2.4.9)
and
h i
Y = FWd Wny (2.4.10)
Here σ̄ denotes the maximum singular value of the matrix, M, and ||M||F denotes
the Frobenius norm. The matrix, F, is the optimal sensitivity, defined as:
∂ yopt
F= (2.4.11)
∂d
F = −Gy Juu
y
Jud + Gyd (2.4.12)
12
2.5. Degrees of freedom 13
For a full H, meaning that there are no restrictions on the structure of H, there
exists an analytical expression for H that minimizes J [7]. The expression is
given in equation 2.4.13.
T 1/2
H T = (YY T )−1 Gy (Gy (YY T )−1 GY )−1 Juu (2.4.13)
The degrees of freedom in a system is the number of variables that can vary
independently [9]. A distillation column has a total of 3 degrees of freedom if the
feed is fixed. Usually, pressure is controlled to a constant value, leaving 2 degrees
of freedom. Connecting two distillation columns with pressure controlled, would
give 2 degrees of freedom from each column, leaving the system with a total of
4 degrees of freedom.
All the coding in this thesis has been done in Matlab. The built-in solver for non-
linear constraint problems "fmincon.m" was used to optimize the model. "fmin-
con.m" attempts to find the constraint minimum of a scalar function using an
iterative solver. There are 4 possible solvers integrated in Matlab.
• trust-region-reflective
• active-set
• interior-point
• sqp
13
14 2.7. The "branch and bound" algorithm
The "sqp" algorithm was found to work well, and it is used in all the optimiza-
tions in the present project. ’sqp’ satisfies bounds at all iterations and has the
ability to recover from infeasible results. A selection the script developed in this
project is presented in Appendix C.
The selection of controlled variables from possible measurements, using the "ex-
act local method", has been implemented in a branch and bound algorithm by
Kariwala and Cao [10]. In their work scripts developed in Matlab were used to
search for optimal controlled variables by minimizing the average loss or worst
case loss. The average loss calculated in the algorithm is different from the av-
erage loss using equation 2.4.8.
1
Lavg,uni f orm = ||M||2F (2.7.1)
6(ny + nd )
Kariwala and Cao assumes a uniform distribution of disturbances ,d, and input
variables, u, resulting in the following expression for average loss. Compared to
the average loss in equation 2.4.8, the loss in equation 2.7.1 is scaled by a factor
of 1/(3 ∗ (ny + nd )). As it is only a scaling factor separating the two equations,
the optimal controlled variables would be the same for the two methods. In the
present project the average loss from the "branch and bound" algorithm is scaled
such that it matches the average loss in equation 2.4.8.
14
Chapter 3
Finding good primary controlled variables is an important step in the search for
optimal plant operation, and it is one of the main steps in plantwide design, as
described in section 2.4. In this chapter a systematic procedure for finding the
primary controlled variables in a chemical plant is outlined. The procedure is
based on the plantwide control method by Skogestad [11], and attempts to find
the primary controlled variables, that from a steady state point of view, would
give the smallest loss.
The procedure can be divided into two main parts. The first part it to find the
active constraint regions. According to Skogestad [6] it is always best to control
the active constrains. The second part is to find good self-optimizing variables for
the remaining degrees of freedom. Active constraint regions and self-optimizing
variables are described in section 2.3 and section 2.4.1, respectively.
15
16 3.1. Initial steps
The main steps in the procedure are illustrated in a flow diagram in figure 3.0.1.
There are four main initial steps that need to be carried out before the search for
the active constraint regions can begin. These are:
The sequence of these four initial steps are irrelevant is not important.
16
3.1. Initial steps 17
Figure 3.0.1: Main steps in a general procedure to search for the optimal primary con-
trolled variables.
In an ideal approach the cost of the whole plant should be included. However, in
17
18 3.1. Initial steps
most cases this would be to complex, and the task should be divided into smaller
subproblems.
The degrees of freedom are the number of variables that can be specified or con-
trolled independently. For the system to be fully defined, the number of primary
controlled variables has to be equal to the number of degrees of freedom.
Disturbances are uncontrolled variables that effect the state of the system. The
control structure should be developed such that the system is kept at optimum
when exposed to disturbances. Usually the disturbances are associated to the
feed into the system, but also changes in active constraints should be handled
as disturbances. When searching for the primary controlled variables, all distur-
bances that affect the cost function should be considered.
18
3.2. Finding the active constraint regions 19
In order to control the process at optimum, the active constraints have to be iden-
tified and controlled tightly at the constraint value. To achieve this it is necessary
to know when the active constraints change, such that the control structure can
be adjusted to the new constraint region. A map of how the active constraint
regions change should be found. For a full understanding of the system, the ac-
tive constraint regions would have to be explored for all possible disturbances.
Each different disturbance would add another dimension to the active constraint
region map.
When the active constraint regions have been found, the system should be studied
to identify additional controlled variables that would keep the state of the system
close to optimum. In general, each point in the disturbance space should be
studied individually. A point in the disturbance space studied is here referred to
as a nominal point.
The goal of this part is to find the set of controlled variables that gives the least
loss when exposed to disturbances. The simplest approach is to iterate through all
available sets of controlled variables. The user would specify a set of controlled
variables and evaluate the loss when the system is exposed to disturbances. Each
controlled variable consists of either a single measurement or a combination of
measurements at there optimum value in the normal point.
There are several possible methods to evaluated loss [12]. The loss could for
instance be evaluated using "local direct evaluation", "global direct evaluation"
or the "exact local method". While the global direct evaluation need a rigorous
model, the "local direct evaluation" can be applied to either a rigorous model or
19
20 3.3. Searching for self-optimizing variables
a linearized model. For the "exact local method" on the other hand, a linearized
model is a prerequisite. Figure 3.3.1 shows the various methods to calculate loss
when a set of controlled variables are specified.
Figure 3.3.1: Methods to calculate loss when controlling a set of variables and exposing
the system to disturbances. The controlled variables are selected from
available measurements, either single measurement or a combination of
measurements.
Even in small systems the number of possible controlled variables could be very
large. This is especially pronounced if measurement combinations are used. To
20
3.4. Other considerations 21
If the model is linearized, each evaluation of loss would use very little compu-
tational power. This would enable the user to search through a large number
of possible controlled variables in a short time. Kariwala and Cao [10] have
shown that the computational time could be further reduced using a "branch and
bound" algorithm. The algorithm speeds up the process by reducing the number
of evaluations needed to find the controlled variable that results in the smallest
loss when exposed to disturbances.
In cases with more than one controlled variable should the selected variables not
be closely related [6], i.e. not control two tray temperatures next to each other
in a distillation column. Indirectly would this requirement usually imply that
the controlled variables are spread out in the process. Spreading the controlled
variables may have positive effects as avoiding drift, and stabilizing all part of
the process.
21
22 3.4. Other considerations
22
Chapter 4
4.1 Model
23
24 4.1. Model
model [13]. Both columns have 41 trays (stages) with feed entering at tray 21.
The relative volatility, α, is assumed to be constant. The column uses a total
condenser, meaning that all the vapor leaving the top tray is condensed. The bot-
tom flow from column 1 is used as feed for the second column. A sketch of the
model is shown in figure 4.1.1.
Where Tb,A , Tb,B , Tb,C are the boiling points of the pure components. Their values
are given in table 4.1.1
24
4.2. The optimization problem 25
Table 4.1.1: Boiling point of the pure components in the modeled system.
Tb,A 100◦C
Tb,B 70◦C
Tb,C 30◦C
The system is studied to find how the optimal operation varies with disturbance.
The optimal point is defined by the state of the system that minimizes the cost
function within the constraints. The cost function in this case comprises the sum
of the feed, the re-boiled power and the condenser power, subtracted the income
from the three product flows. The condenser power is assumed to be cost free.
It is also assumed that the vapor flows are restricted by a maximum value, as a
real column has an finite diameter. The respective concentrations of the three
product flows are being restricted to a minimum purity of 95%. A mathematical
description of the optimization problem is given in equation 4.2.1.
subject to xA ≥ xA,min
xB ≥ xB,min
(4.2.1)
xC ≥ xC,min
V1 ≤ V1,max
V2 ≤ V2,max
The system has a total of 4 degrees of freedom when feed is regarded as a dis-
turbance. With 4 independent system variables specified, all other variables are
given by the chemical properties, the component mass balances and the energy
25
26 4.2. The optimization problem
balances.
The parameter values used in the optimization are presented in table 4.2.1. The
values are the same as those used by Jacobsen [3].
26
4.2. The optimization problem 27
If the constraints are independent, the number of active constraints could never
exceed the degrees of freedom. As the system has 4 degrees of freedom, a con-
straint region where all 5 constraints are active would never occur (number 32
in table 4.2.2). In addition, the product specification of the valuable product is
nearly always active. The valuable product in this case is the distillate from col-
umn 2, having the specification xB,min . With this in mind, there are 32-16-1=15
possible active constraint regions left. This mean that there are 15 regions that
are both feasible and have xb active.
2nc
if nc ≤ nd.o. f .
nregions = n
nc
nc
(4.2.2)
2 c −
∑ i if nc > nd.o. f .
i=ndo f +1
nc
In equation 4.2.2, i denotes the binomial coefficient.
The system is studied to identify how the set of active constraints changes as a
function of the feed, F, and steam price, pV , at optimum. The constraint region
27
28 4.2. The optimization problem
map is found by systematically changing the feed and the steam price and opti-
mizing the system at each point. A grid of 150 points in each direction is used.
The constraint region map is presented in figure 4.2.1.
28
4.2. The optimization problem 29
0.18 V II : XA XB
IV : XA XB XC
XC V1
0.16
0.14
I
V : XA XB V1 n
0.12 f
P r ice steam
e
a
0.1 II : XA XB
s
i
0.08 b
l
e
0.06
III : XB V1
0.04
I : XB
V III :
0.02
XA XB
V I : XB V1 V2
V1 V2
0
1.35 1.4 1.45 1.5
F eed r ate
Figure 4.2.1: Active constraint regions map of two columns in sequence. The colored
lines mark the border between the case when the constraint is optimally
active or optimally inactive, respectively.
Numerical values for one optimization in each region are given in table 4.2.3.
Most values are in accordance with Jacobsen [3]. In region VI, however, there is
a discrepancy for the simulation value of XA,D1 and XB,D1 , respectively, when the
feed is set to 1.4 mol/s and the steam price is set to 0.01 $/s. Their values are
written in red text.
29
30
Table 4.2.3: Optimal values for selected data
XB,B1 0.311 0.306 0.311 0.311 0.306 0.312 0.306 0.306 0.306
XC,B1 0.678 0.683 0.677 0.677 0.682 0.676 0.683 0.682 0.683
Column 2
V2 2.205 2.015 2.345 2.345 2.218 2.405 2.006 2.405 1.911
L2 1.952 1.771 2.081 2.081 1.959 2.140 1.764 2.137 1.678
The constraint region map was found by optimizing the system in a grid over the
whole disturbance space. This approach to mapping the active constraint regions
requires substantial computational power, and is correspondingly time consum-
ing. However, the time needed, is substantially reduced if one uses the solution
in one point as initial guess for the neighboring point. This procedure will also
increase the robustness and ensure that the algorithm would find a solution for
every feasible point. Even with this procedure, however, the computational time
would be long.
The computer used approximately six hours to calculate the active constraint
map in figure 4.2.1. The calculation was conducted on a Dell, Latitude E6400
with Windows 7, Intelr Core™2 Duo P9500 processor (2.53GHz). The number
of points evaluated when creating the map was 150 · 150 = 22500. This give
an average of approximately 1 second per evaluation. For large systems it is
expected that each evaluation would take substantially more time. If the active
constraint region should be mapped in 3 disturbance dimensions, the number of
evaluations needed with a grid of 150 would be 1503 = 3.4 · 106 , translating into
a computational time of approximately 6 houres · 150 = 37.5 days. With this
extensive time consumption this method is probable impractical, calling for the
development of smarter algorithms that would reduce the time for each evalua-
tion and the number of evaluations needed. The use of faster computer languages
might of course also be considered.
31
32 4.3. Discussion of the constraint region map
32
Chapter 5
In each active constraint region there is a unique set of constraints which are
active at optimum [3] . To keep the system at optimum, all the active constraints
have to be controlled tightly. Two columns in sequence have a total of 4 degrees
of freedom (assuming that the pressure is controlled to a constant value and thus
not included). When the active constraints are controlled, the degrees of freedom
are reduced by the number of active constraints. In this chapter, region I and VI
are studied to find what further variables to control, using the remaining degrees
of freedom, in order to keep the process operation close to optimal.
According to Skogestad [6], the controlled variables should have the following
characteristics:
33
34 5.1. Potential variables to control
• For cases with two or more controlled variables, the selected variables
should not be closely correlated.
The goal is to find variables, that when kept constant, maintain the system at its
optimum state when exposed to disturbances.
In this modeled system there are over a hundred potential variables which might
be controlled, either as single variable or as a combination of variables. These
include:
34
5.3. Case 1: Selection of controlled variables in constraint region VI 35
feed flow, feed concentration and liquid vapor fraction. Variations in a tightly
controlled active constraint could also be regarded as a disturbance. To reduce
the complexity of the optimization problem, only three disturbances have been
considered:
Table 5.2.1: Disturbances considered
Disturbance
Feed flow
Feed composition: zFA at the expence of zFB
Feed composition: zFB at the expence of zFC
In region VI, both vapor constraints V1 and V2 are active. In addition the concen-
tration constraint on the valuable product xb is active. The system has 4 degrees
of freedom. As 3 of these are active, and therefore being controlled, there are
1 degree of freedom left. The region is first studied in order to find the bound-
aries to infeasibility. This calculation is done to better understand the behavior
of the region. Assessment of the region boundaries is followed by a direct evalu-
ation of the loss, focusing on the variables in table 5.2.1. Finally, the system was
linearized and studied further using the "exact local method".
When V1 , V2 and XB are controlled to there constraint values, there is only 1 de-
gree of freedom left. The value of this last degree of freedom has to be such that
it is possible to keep the system within the boundaries of the allowed values of
35
36 5.3. Case 1: Selection of controlled variables in constraint region VI
the two non-active constraints. Within the set of possibly manipulated variables,
only L1 and D1 are realistic choices to eliminate the last degree of freedom. From
the mass balance it follows that V +(1-q)F=D1 +L1 . As V1 is fixed and active and
q=1 (liquid feed only), the change in V1 has to be negative to the change in L1 ,
hence dL=−dV . Thus, if the limitation of one variable is found, the other is
given by the mass balance.
By increasing and decreasing the reflux L1 it is found that the system is limited at
both ends. When L1 is reduced, the top product get less pure. If L1 is reduced too
far, however, the composition constraint on the top product of column 1 would
be breached. On the other hand, if L1 is increased too much, it would not be pos-
sible to keep the bottom product of column 2 within the product specifications:
When the reflux L1 increases, the amount of component A (the most volatile)
in the bottom product increases. To satisfy the specification of the top product
of column 2, the reflux of this column must increase. At one point the reflux
has increase so much that is no longer possible to keep both the top and the bot-
tom products simultaneously within the desired product specifications. In figure
5.3.1, the values of the constraint variables XA and XC are plotted as a function
of the reflux L1 .
Furthermore, the highest and the lowest possible reflux, L1 , was plotted as a
function of the feed flow. Here, the highest and lowest value correspond to a
situation where either the constraint on xC or xA is active, respectively. The
graph is shown in figure 5.3.2 together with the optimal reflux L1 .
36
5.3. Case 1: Selection of controlled variables in constraint region VI 37
0.98
Consentration
0.97
0.96
0.95
0.94
3.428 3.43 3.432 3.434 3.436 3.438 3.44 3.442
Reflux L 1
3.45
3.44
L1
3.43
3.42
3.41
3.4
1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48
F eed
Figure 5.3.2: The highest and lowest possible values of L1 before a constraint is
breached at different feed rates.
37
38 5.3. Case 1: Selection of controlled variables in constraint region VI
3.43
3.42
3.41
3.4
1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48
F eed
Figure 5.3.3: The value of L1 when selected tray temperatures are kept constant.
3.43
3.42
3.41
3.4
1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48
F eed
Figure 5.3.4: The value of L1 when flow related variables are kept constant.
The value, L1 , when controlling the temperature at tray 10, is reasonably close
38
5.3. Case 1: Selection of controlled variables in constraint region VI 39
to the optimal line, indicating that this would be a good controlled variable for
disturbances in feed, see figure 5.3.3. Figure 5.3.4 shows that keeping, L1 , or the
ratio, L1 /F, constant, would lead to large loss and quickly move the system into
the infeasible area.
The loss when the system is exposed to a disturbance can be readily evaluated
when a single variable is controlled to a constant value. Several possible candi-
dates were held constant at their optimal values at the nominal point. The result-
ing loss when the system is exposed to selected disturbances is shown in table
5.3.1. The re-optimized value of the controlled variable candidates are presented
in table 5.3.2.
39
40
Table 5.3.1: Table of loss for selected controlled variable candidates
CV Nominal F= F= zF = zF = zF = zF =
candidates 1.41 1.39 0.39] 0.41] 0.40] 0.40]
0.21, 0.19, 0.19, 0.21,
0.40] 0.40] 0.41] 0.39]
L1 3.437 3.432 3.442 3.451 3.423 3.438 3.435
D1 0.5714 0.5765 0.5664 0.5575 0.5854 0.5703 0.5727
xA,b1 0.01255 0.01249 0.01261 0.01269 0.01234 0.01192 0.01318
xA,d1 0.9618 0.9603 0.9633 0.9602 0.9633 0.9646 0.9588
Tbtm , col1 89.77 89.80 89.75 89.43 90.13 90.28 89.27
T10 , col1 72.57 72.66 72.48 72.65 72.51 72.90 72.25
T20 , col1 59.96 60.09 59.82 60.44 59.49 59.97 59.94
T30 , col1 39.96 40.18 39.74 40.41 39.53 39.46 40.47
Ttop , col1 31.53 31.59 31.47 31.59 31.47 31.42 31.65
D1 /F 0.4082 0.4089 0.4075 0.3982 0.4182 0.4074 0.4090
L1 /F 2.455 2.434 2.476 2.465 2.445 2.456 2.454
L1 /D1 6.014 5.952 6.076 6.189 5.846 6.028 5.999
Tbtm , col2 99.68 99.67 99.69 99.64 99.71 99.69 99.66
T10 , col2 97.23 97.16 97.30 96.95 97.49 97.41 97.04
T20 , col2 90.71 90.68 90.74 90.32 91.10 91.22 90.19
T30 , col2 77.78 77.79 77.77 77.91 77.67 78.08 77.50
Ttop , col2 68.76 68.76 68.75 68.82 68.70 68.76 68.76
The direct evaluation of loss indicates that the bottom composition of column
1, XA,b1 , or a tray temperature in the top part of column 2, would be both be
good variables to control. The loss is small when exposed to the disturbances
considered and the re-optimized value remains close to the nominal value.
The table of loss shows clearly that controlling any of the flows, L1 or D1 directly,
should be avoided. This is also the case for controlling a ratio between the flows,
D1 /F, L1 /F or L1 /D1 . The loss is large and the system would quickly become
infeasible. In the infeasible region there is no solution to the system that would
satisfy all constrains.
41
42 5.3. Case 1: Selection of controlled variables in constraint region VI
Distillation is not a linear process, thus the loss when a system is exposed to a
disturbance would not vary linearly. To better understand the behavior of the
modeled system in this project, the loss when exposed to disturbances in feed
flow or feed concentration was calculated over a wide span of the disturbance.
The loss when varying the feed flow, and controlling each tray temperature in-
dividually at their nominal optimum is shown in figure 5.3.6. Correspondingly,
the loss when varying feed composition (of either component A over B, or com-
ponent B over C), while controlling tray temperature , is plotted in figure 5.3.7
and 5.3.6, respectively. In all cases the nominal point refers to a feed flow of 1.4
mol/s and a steam price of 0.01 $/mol.
0.009
35
0.008
30
Tray with tempature control control
0.007
25 0.006 Loss
0.005
20
0.004
15
0.003
10
0.002
5 0.001
0
1.36 1.38 1.4 1.42 1.44 1.46
Feed
Figure 5.3.5: Loss when controlling a tray temperature and varying the feed flow to the
first column. The white area outside the "red line" is infeasible [$/s].
42
5.3. Case 1: Selection of controlled variables in constraint region VI 43
0.009
35
0.008
30
0.007
Tray with temp control
25 0.006
Loss
0.005
20
0.004
15
0.003
10
0.002
5 0.001
0
0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24
Consentration zFB on the expense of zFC
Figure 5.3.6: Loss when controlling a tray temperature and varying the feed concen-
tration of component A at the expense of component B. The white area
outside the "red line" is infeasible[$/s].
The global direct evaluation of loss reveals that for disturbances in the feed flow
it is less important which tray temperature being controlled (figure 5.3.5). Tray
10 gives the smallest loss, but its value is not significantly worse than the loss
when controlling the least optimal tray temperature. To respond correctly to a
disturbance in feed composition, on the other hand, the tray should be selected
with care. For a disturbance in feed concentration of component A at the expense
of component B, controlling the temperature around tray 9, would give close to
zero loss. All other tray temperatures lead to significant loss and quickly brings
the system into the infeasible region when the disturbance increases. Disturbance
43
44 5.3. Case 1: Selection of controlled variables in constraint region VI
0.009
35
0.008
30
0.007
Tray with temp control
25 0.006
Loss
0.005
20
0.004
15
0.003
10
0.002
5 0.001
0
0.34 0.36 0.38 0.4 0.42 0.44
Consentration zFA on the expense of zFB
Figure 5.3.7: Loss when controlling a tray temperature and varying the feed concen-
tration of component B at the expense of component C. The white area
outside the "red line" is infeasible. The solver had convergence problems
at the right side of the plot [$/s].
The loss when controlling the variable candidates from table 5.3.2 was plotted
over a wide range of the feed flow disturbance. This provides a more visual
44
5.3. Case 1: Selection of controlled variables in constraint region VI 45
picture of which controlled variables that give a small loss. The loss following
disturbance in feed flow for column 1 and column 2, respectively, is plotted in
figure 5.3.8 and figure 5.3.9.
0
1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48
Feed flow [mol/s]
Figure 5.3.8: The loss as a function of the feed flow when controlling a variable in
column 1 at its nominal optimum. The nominal feed value is 1.4 mol/s
45
46 5.3. Case 1: Selection of controlled variables in constraint region VI
0
1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48
Feed flow [mol/s]
Figure 5.3.9: The loss as a function of the feed flow when controlling a variable in
column 2 at its nominal optimum. The nominal feed value is 1.4 mol/s.
46
5.3. Case 1: Selection of controlled variables in constraint region VI 47
Gyu=dTcol1/du Gyu=dTcol2/du
0 0
dT/dL1 dT/dL1
−100
−50
−200
−100 −300
dTcol /du
dTcol2/du
1
−400
−150 −500
−600
−200
−700
−250 −800
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Gd=dTcol1/dd Gd=dTcol2/dd
50 0
0
−200
−50
−400
−100
dTcol /dd
dTcol2/dd
1
−150 −600
−200
−800
dT/dFeed dT/dFeed
−250
dT/dzFa dT/dzFA
−1000
−300 dT/dzFa dT/dzFB
−350 −1200
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Figure 5.3.10: Process and disturbance gain in the point when feed= 1.4 mol/s and
steam price= 0.01 $/mol. The top figures show the process gain with
respect to tray temperature for column 1 (left) and column 2 (right). The
bottom figures show the disturbance gain with respect tray temperature
in either column 1 (left) or column 2 (right).
47
48 5.3. Case 1: Selection of controlled variables in constraint region VI
20 20
F=dyopt/dd
F=dyopt/dd
0 0
−20 −20
dTopt/dFeed
−40 dTopt/dzF −40
A
dTopt/dzFB
−60 −60
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Figure 5.3.11: The optimal sensitivity in the nominal point, feed= 1.4 mol/s and steam
price 0.01 $/mol.
48
5.3. Case 1: Selection of controlled variables in constraint region VI 49
The model was linearized using finite differences (Appendix A) and the "exact
local method" 2.4.2 was used to find the single tray temperature that, when ex-
posed to disturbance, would give ether the smallest average loss or worst case
loss. Measurement and implementation errors have been included. To speed up
the process a "branch and bound" algorithm developed by Kariwala and Cao [10],
was used to search for the optimal tray temperature. The magnitude of the ex-
pected disturbance and the noise in the measured variables used in the optimiza-
tion, are given in table 5.3.3.
Expected disturbance
Feed 0.01 mol/s
zFA at the expense of zFB 0.01
zFA at the expense of zFC 0.01
Noise in measured variable
Tray temperature 0.5◦C
Tray concentration 0.01◦C
The "exact local method" was used to find the single tray temperature that, when
controlled, would give the minimum worst case loss. The predominating distur-
bances are assumed to be changes in feed flow or feed composition. Changes
in the feed concentration ratio between either component A and B or B and C,
49
50 5.3. Case 1: Selection of controlled variables in constraint region VI
were considered. The loss from the "exact local method", when controlling a
temperature in column 1 or column 2, are presented in figure 5.3.12 and 5.3.13,
respectively.
2.5
2
Loss [$/s]
1.5
1
Combination of all disturbances
Disturbance in feed
0.5 Disturbance in zFA on the expense of zFB
Disturbance in zFB on the expense of zFC
0
0 5 10 15 20 25 30 35 40
Contolled tray in column 1
Figure 5.3.12: Loss when controlling a tray temperature in column 1, based on "exact
local method".
Table 5.3.4: Optimally controlled tray when calculating average- and worst case loss
50
5.3. Case 1: Selection of controlled variables in constraint region VI 51
2
Loss [$/s]
1.5
0.5
0
0 5 10 15 20 25 30 35 40
Contolled tray column 2
Figure 5.3.13: Loss when controlling a tray temperature in column 2, based on "exact
local method".
51
52 5.3. Case 1: Selection of controlled variables in constraint region VI
loss are presented in table 5.3.5, when only trays from column 1 are selected,
and in table 5.3.5, when only trays from column 2 are selected.
0.8
Loss [$/s]
0.6
0.4
0.2
0
1 2 3 4 5 6 7 8 9 10
Number of controlled variables
Figure 5.3.14: Lowest loss when controlling a specified numbers of tray temperatures
for either column 1 or column 2, respectively.
The "exact local method" shows that the use of combination of measurements
would give a substantial reduction of loss in the case when only temperatures
from the first column were selected. Controlling a combination of the three best
tray temperatures would reduce the loss by approximately 50% of the loss when
controlling the temperature in the single best tray. However, even with a com-
bination of 10 measurements, using a single tray in the top part of the second
column would be substantially better.
52
5.3. Case 1: Selection of controlled variables in constraint region VI 53
Table 5.3.5: Optimal tray combinations selected from column 1, based on exact local
method
Table 5.3.6: Optimal tray combinations selected from column 2, based on exact local
method
The loss was calculated when controlling the optimal combination of tray tem-
peratures from table 5.3.5 and table 5.3.6, and exposing the system to the three
53
54 5.3. Case 1: Selection of controlled variables in constraint region VI
disturbances in table 5.2.1 individuality. The results for either column 1 or col-
umn 2, are presented in table 5.3.7 and table 5.3.8, respectively.
Table 5.3.7: Table of loss when controlling the optimal combination of tray tempera-
tures from table 5.3.5
Table 5.3.8: Table of loss when controlling the optimal combination of tray tempera-
tures from from table 5.3.6
54
5.3. Case 1: Selection of controlled variables in constraint region VI 55
Table 5.3.7 and table 5.3.8 present the loss when exposing the system to the
disturbances individually and controlling a tray temperature combination. This
shows how much the loss is reduced, for the individual disturbances, when
adding extra measurements. In addition it can be seen that a disturbance in zFA
at the expense of zFB , is the major source of loss, when controlling a combina-
tion of temperatures from the first column. Disturbance in zFB at the expense of
zFC is the major source of loss when controlling a combination of trays from the
second column.
55
56 5.4. Case 2: Selection of controlled variables in constraint region I
The "exact local method" implemented in a "branch and bound" algorithm, de-
scribed in section 2.7 was used to search for the temperature measurements that
would give the least loss when exposed to a disturbance in the feed flow of 0.01
mol/s and a disturbance in the feed composition of 0.01 mol f raction. The mea-
surement error for the tray temperatures was assumed to be ± 0.5◦C. The input
values were presented previously in table 5.3.3. The set of tray temperatures that
in this case gives the smallest loss is presented in table 5.4.1.
Table 5.4.1: Tray numbers for optimal control of the system in region I according to
average loss and worst case loss calculations
56
5.4. Case 2: Selection of controlled variables in constraint region I 57
y y
Gu=dTcol1/du Gu=dTcol2/du
300 800
dT/dL dT/dL
1 1
dT/dV 600 dT/dV1
200 1
dT/dV2 400 dT/dV2
100
200
dTcol1/du
dTcol2/du
0 0
−200
−100
−400
−200
−600
−300 −800
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Gd=dTcol1/dd Gd=dTcol2/dd
50 0
0
−200
−50
−100 −400
dTcol1/dd
dTcol2/dd
−150
−200 −600
dT/dFeed dT/dFeed
−250
dT/dzFa −800 dT/dzFA
−300 dT/dzFB
dT/dzFa
−350 −1000
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Figure 5.4.1: Process and disturbance gain in the point when feed= 1.35 mol/s and
the steam price= 0.03 $/mol. The top figures shows the process gain
with respect to tray temperature for either column 1 (left) and column 2
(right). The bottom figures show the disturbance gain with respect tray
temperature in column 1 (left) and column 2 (right)
In section I it was found to be optimal to control one tray in the top part of
the first column and simultaneously two trays in the section column. The trays
found were all located approximately halfway between the feed tray and the top
or bottom of the column, respectively. By comparing the location of the trays
in figure 5.4.1 and figure 5.4.2, the optimal tray seem to be located in areas
that has a good trade-off between high gain and low optimal sensitivity. This is
57
58 5.4. Case 2: Selection of controlled variables in constraint region I
dT opt
/dzF 20 dTopt/dzF
B B
20 10
0
/dd
F=dyopt/dd
0
opt
−10
F=dy
−20
−20
−40 −30
−40
−60
−50
−80 −60
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Figure 5.4.2: The optimal sensitivity with respect all temperature for either of the two
columns. The three considered disturbances are i) feed flow, ii) feed com-
position change between component A and B and iii) feed composition
change between composition B and C
.
accordance with Skogestad [1], suggesting that the gain of the optimal controlled
variable should be high and the optimal sensitivity small.
58
Chapter 6
Discussion
In this section the results described chapter 3, chapter 4 and chapter 5 are ex-
plained and discussed. The discussion follows the natural progression of the
work , starting with the systematic procedure used to find the primary controlled
variables (chapter 3). This is followed by a discussion of the active constraint
region (chapter 4) map and two case studies (5).
The systematic procedure outlined in chapter 3, presents the major steps in the
process of finding the optimal control structure. I should be possible to imple-
ment the procedure in an atomized computer program. The scripts developed in
this project cover the core part of such a program, although some of the scripts
are case specific. The scrips are presented in appendix C. The code developed
to find the active constraint region map and the code concerning the "exact lo-
cal model" can handle any model, but the script used to linearize the model is
unfortunately limited to the three disturbances presented in table 5.2.1.
59
60 6.2. Active constraint regions
The active constraint region map was found by optimizing the system over a grid
covering the whole disturbance space. As previously stated, this is very com-
putationally demanding. A major advantage is that it is independent of human
intervention. In addition the algorithm can run of the problem in parallel, thus
take advantage of an increasing number of cores in modern CPU’s.
Jacobsen proposed a method for finding a constraint region map but required
manual considerations to reduce the number of optimization calculations. For
example, he argues that if the region border (which is part of the constraint curve)
is independent of one of the disturbances considered, that part of the line would
be straight, and can be defined by two points only. Such assumptions reduce the
number of optimization calculations, but requires substantial human intervention
and is vulnerable to human error.
The active constrain region map found in the present project, figure 4.2.1, was
compared to the map found by Jacobsen. The two maps are identical except for
the border between region V and VII, and between II and V. Jacobsen approx-
imates these borders with straight lines, while the analyses done in the present
project has found the borders to be curved. The constraint map found by Ja-
cobsen are presented in figure 6.2.1. The colors on the border lines refer to the
different constraints.
It should be noted that the system considered in the present thesis is fairy simple.
For larger systems the number of constraints and the computational time for each
optimizations would be substantially higher. As previously mentioned, the grid
algorithm used in this thesis would be to slow to be used in practice for more
complex systems. This calls for the development of faster algorithms.
60
6.3. Case studies 61
Figure 6.2.1: Active constraint region map for two columns found by Jacobsen [3]. The
colors of the border lines refer to the different constraints.
In section VI, only reflux, L1 , and distillate flow, D2 , in the first column, are
61
62 6.3. Case studies
Figure 6.3.1: Proposed control structure for controlling a tray temperature in the top
part of the second column by manipulating the reflux in column 1. The
temperature in the second column is arranged in cascade with a local tem-
perature loop in column 1.
Furthermore, the direct evaluation of loss indicated that also the concentration
of component A in the bottom of the first column would be a good controlled
variable.
As both steam flows are controlled at their maximum value, the steam cost would
be constant. Thus the cost function can be reduced too the income from the three
product flows. The price of the flows D1 and B1 , are both 1 $/mol, and the price
of the valuable product D2 is 2 $/mol. When the product specification of the
valuable product is fixed, and the price of D1 and B1 is identical, the optimum
62
6.3. Case studies 63
The "exact local method" shows that the use of combination of measurements
would give a substantial reduction of loss in the case where only temperatures
from the first column were selected. Controlling a combination of the three best
tray temperatures would reduce the loss by 50 % as compared to controlling the
temperature in the single best tray. However, even when a combination of 10
measurements in the first column, a single tray measurement in the top part of
the second column would be substantially better.
63
64 6.3. Case studies
64
Chapter 7
Conclusion
Two distillation columns in sequence were studied in order to identify the op-
timal control structure. A map of how the active constraint regions changes to
variations in the steam price and the feed flow was found. The resulting map was
close to the map found by Jacobsen [3], but showed some differences associated
with constraint region borders.
Two of the regions were studied further in order to find self-optimizing variables.
Both "direct evaluation of loss" and the "exact local method" were used to search
for the controlled variables the would give the least loss. In the region with low
energy cost, region VI, both methods found that controlling a tray in the top
part of the second column would be the best choice if a single tray temperature
should be controlled. Alternatively, the "direct evaluation of loss" indicated that
the bottom concentration of component A would would be a good controlled
variable.
In the other region considered (region I), the "exact local method" was used to
find the best set of three tray temperatures, selected from both columns, with
respect to loss. The tray temperatures seemed to be located in areas with a good
65
66 7.1. Suggestions for future work
trade-off between high gain and low optimal sensitivity, figure 5.4.1 and 5.4.2.
The present thesis address two topics. One concerns the optimization of two dis-
tillation columns in sequence and the other how to design a systematic procedure
to find the optimal control structure.
The study of two distillation column has been limited to certain aspect of the
problem. First, the active constraint region map has been found for only two dis-
turbances. For a full understanding of the system, the active constraint regions
should be found in all disturbance dimensions. Second, only three disturbances
have been considered in the search for primary controlled variables. More distur-
bances should be considered. It should also be explored how the optimal primary
controlled variables change within a constraint region and identify the optimal
structure in other constraint regions.
In the thesis the active constraint regions are found by optimizing over a grid
in the disturbance space. This approach needs substantial computational power.
More efficient algorithms have to be developed before the active constraint re-
gion map can be found for a more complex system. An effort should also be
made to develop algorithms for finding the primary controlled variables that
gives the least loss within the boundaries of acceptable controllability.
66
7.1. Suggestions for future work 67
67
68 7.1. Suggestions for future work
68
Bibliography
[1] Skogestad S. The dos and don’ts of distillation column control. Chemical
Engineering Research and Design. 2007;85(1 A):13–23.
[3] Jacobsen MG. Active constraint regions for optimal operation of chemical
processes [dissertation]. NTNU. Trondheim; 2011.
[5] Stichlmair J, J F. Distillation, Principles and practice. 1st ed. New York
(USA): Wiley-VCH; 1998. p.36.
[6] Skogestad S. Plantwide control: The search for the self-optimizing control
structure. Journal of Process Control. 2000;10(5):487–507.
69
70 Bibliography
[9] Skogestad S. Chemical and energy process engineering. 1st ed. CRC Press
(Taylor & Francis Group); 2008. p.235.
[10] Kariwala V, Cao Y. Bidirectional branch and bound for controlled variable
selection. Part II: Exact local method for self-optimizing control. Comput-
ers and Chemical Engineering. 2009;33(8):1402–1412.
[11] Skogestad S. Control structure design for complete chemical plants. Com-
puters and Chemical Engineering. 2004;28(1-2):219–234.
70
Appendices
71
Appendix A
The model was linearized around a nominal point. The linear relationship be-
tween the input, u, and output, y, is given by the matrix:
∂ y1 ∂ y1 ∂ y1
∂ u1 ∂ u2 ··· ∂ un
∂ y2 ∂ y2 ∂ y2
dy ∂ u2 ∂ u2 ··· ∂ un
G= = .. .. .. .. (A.0.1)
du . . . .
∂ ym ∂ ym ∂ ym
∂ u1 ∂ u2 ··· ∂ un
Similarly, the linear relationship between the disturbance, d, and the output, y, is
given by the matrix:
73
74
∂ y1 ∂ y1 ∂ y1
∂ d1 ∂ d2 ··· ∂ dn
∂ y2 ∂ y2 ∂ y2
dy ∂ d2 ∂ d2 ··· ∂ dn
Gd = = .. .. .. .. (A.0.2)
dd . . . .
∂ ym ∂ ym ∂ ym
∂ d1 ∂ d2 ··· ∂ dn
The second derivative of the cost function with respect to inputs ,Juu (given by
equation A.0.3) and the second derivative of the cost function with respect to
input and disturbance, Jud (given by A.0.4) where found by calculating either
forward or backward differences. The general expressions for approximating the
second derivative using forward and backward differences are given in equation
A.0.5 and equation A.0.6, respectively [14].
∂ 2J ∂ 2J ∂ 2J
∂ u1 ∂ u2 ∂ u1 ∂ u2 ··· ∂ u1 ∂ un
∂ 2J ∂ 2J ∂ 2J
∂ u2 ∂ u2 ∂ u2 ∂ u2 ··· ∂ u2 ∂ un
∂ 2J .. .. .. ..
Juu = = . . . . (A.0.3)
∂ u∂ u
∂ 2J ∂ 2J ∂ 2J
∂ un ∂ u2 ∂ un ∂ u2 ··· ∂ um ∂ un
∂ 2J ∂ 2J ∂ 2J
∂ u1 ∂ d2 ∂ u1 ∂ d2 ··· ∂ u1 ∂ dn
∂ 2J ∂ 2J ∂ 2J
∂ u2 ∂ d2 ∂ u2 ∂ d2 ··· ∂ u2 ∂ dn
∂ 2J .. .. .. ..
Jud = = . . . . (A.0.4)
∂ u∂ d
∂ 2J ∂ 2J ∂ 2J
∂ un ∂ d2 ∂ un ∂ d2 ··· ∂ um ∂ dn
∂2 f f (x + hi ei + h j e j ) − f (x + hi ei ) − f (x + h j e j ) + f (x)
= (A.0.5)
∂ xi ∂ x j hi h j
74
75
∂2 f f (x − hi ei − h j e j ) − f (x − hi ei ) − f (x − h j e j ) + f (x)
= (A.0.6)
∂ xi ∂ x j hi h j
It turned out to difficult to find accurate values for the second derivatives Juu and
Jud , see section B.2.
75
76
76
Appendix B
The optimal sensitivity of the output with respect to the disturbance, F, may be
found directly by perturbing the disturbance or using equation B.1.1.
−1
F = −F y Juu Jud + Gyd (B.1.1)
The optimal sensitivity found by linearizing the model by finite differences and
using equation B.1.1, was compared to the optimal sensitivity found by perturb-
ing the system directly. The comparison was done in order to validate the nu-
merical accuracy of the linearizion. The optimal sensitivity in the nominal point
studied in region VI and I are given in figure B.1.1 and B.1.2, respectively. The
individual points marked by dots were calculated using equation B.1.1, and the
solid lines were calculated directly by perturbing the disturbances.
77
78 B.2. Validating Juu and Jud in region I
20 20
F=dyopt/dd
F=dyopt/dd
0 0
−20 −20
dTopt/dFeed
opt
−40 dT /dzFA −40
dTopt/dzFB
−60 −60
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Figure B.1.1: The optimal sensitivity of the temperature with respect to three distur-
bances in contraint region IV. The individual points marked by dots were
calculated using equation B.1.1, and the solid lines were calculated di-
rectly by perturbing the disturbances
0
F=dyopt/dd
F=dyopt/dd
0
−10
−20
−20
−40 −30
−40
−60
−50
−80 −60
0 10 20 30 40 50 0 10 20 30 40 50
Tray Tray
Figure B.1.2: The optimal sensitivity of the temperature with respect to three distur-
bances in contraint region I. The individual points marked by dots were
calculated using equation B.1.1, and the solid lines were calculated di-
rectly by perturbing the disturbances
Numerical values for the derivatives Juu and Jud turned out to be difficult. For-
ward and backward differences were compared to validate the values. Numeric
78
B.2. Validating Juu and Jud in region I 79
values for Juu and Jud calculated using forward and backward differences, in the
nominal point in region I, are given below.
−256.9479 −4.0768
251.4575
Juu f orward = −256.9479 262.6072 4.1746 (B.2.1)
−256.9845 −4.0602
248.8970
Juubackwards = −256.9845 265.3887 4.1928 (B.2.2)
128.9938 332.2961 33.8723
Jud f orward = −131.9673 −339.4311 −34.8896 (B.2.3)
128.0086 328.2654 33.6873
Judbackwards = −132.3138 −338.8721 −35.0375 (B.2.4)
79
80 B.2. Validating Juu and Jud in region I
80
Appendix C
Matlab scripts
This chapter present the most relevant Matlab scripts used in the project. An
overview of the scripts used in the thesis shown in table C.0.1. All scripts pre-
sented in the table are given in the subsequent sections except "linerize.m" and
"Fmat.m"
81
82 C.1. Search for the active constraint region active constraint region
The script "constraintplot.m" attempts to find the active constraint region map
by optimizing in a grid over the specified disturbance space. The function "bi-
nary.m" mark the active set as a binary number.
82
C.1. Search for the active constraint region active constraint region 83
constraintplot.m
1 %% constraintplot.m
2 % Summary: Finds the active contraint regions in a
3 % userspesified disturbance space. Defalt is
4 % Feed vs price of steam.
5 %
6 % The disturbance space is found by optimise
7 % in all point i a grid of the disturace space.
8 % The active set each point is marked by a
9 % binary number.
10 %
11 % author: Tor Anders Marvik
12 % organization: Department of Chemical Engineering, NTNU, Norway
13 % contact: [email protected]
14 % started Oktober 2012
15
16 clc
17 clear all
18
19 %Intial values
20 init_nominal % Initial values
21 load('xopt_F14_pV001') % Load nominal optimum
22 x0=xopt; % Initial guess
23
24 %Nominal point
25 par.F=1.4;
26 price.steam=0.01;
27
32 [x_opt,fval_opt,exitflag]=fmincon(@(x) costfunction(...
33 x,price,par),x0,[],[],[],[],lb,ub,@(X)nonlcon(...
34 X, par),options);
83
84 C.1. Search for the active constraint region active constraint region
35 [Toptcol1,Toptcol2] = Temp(x_opt,par);
36 Topt=[Toptcol1;Toptcol2]; % Optimal temperatures
37
38 % Solver options
39 options = optimset('TolFun',10e−6,'TolCon',10e−6,...
40 'MaxFunEvals',5e3,'Display','off','Algorithm',...
41 'sqp','Diagnostics','off');
42
43 %constraints
44 tol=1e−6; % Tolerance from constraint
45
54 %Solver conditions
55 par.flag=0; % No control=0, Xcont=1,...
56 par.actset=[]; % No controlled active const.
57
58 %Init matrices
59 val=zeros(n_x*n_y,9); % Init [bin exitflag fval,x,y]
60 fval_mat=zeros(n_x*n_y,2); % Init const value matrix
61 x_mat=zeros(n_x*n_y,2*par.NV+8);% init x data matrix
62
84
C.1. Search for the active constraint region active constraint region 85
76 %run fmincon
77 [x,fval,exitflag]=fmincon(@(x)costfunction(...
78 x,price,par),x0,[],[],[],[],lb,ub,...
79 @(X)nonlcon(X,par),options);
80
91 val(k,:)=[bin,exitflag,fval,y_grid(1,j),x_grid(i)];
92
93 % Monitor progression
94 disp([k , val(k,:),toc])
95 time=time+toc;
96
102 end
103 end
104
85
86 C.1. Search for the active constraint region active constraint region
109 data.x_mat=x_mat;
110 data.fval_mat=x_mat;
111
118 contour(x_grid,y_grid(1,:),reshape(val(:,1),n_x,n_y),[1],...
119 'Color', rbg('Orange'),'LineWidth',2);
120 contour(x_grid,y_grid(1,:),reshape(val(:,2),n_x,n_y),[1],...
121 'Color', rbg('Blue'),'LineWidth',1);
122 contour(x_grid,y_grid(1,:),reshape(val(:,3),n_x,n_y),[1],...
123 'Color', rbg('Red'),'LineWidth',2);
124 contour(x_grid,y_grid(1,:),reshape(val(:,4),n_x,n_y),[1],...
125 'Color', rbg('Purple'),'LineWidth',2);
126 contour(x_grid,y_grid(1,:),reshape(val(:,5),n_x,n_y),[1],...
127 'Color', rbg('Green'),'LineWidth',2);
binary.m
86
C.2. Self optimizing variables 87
13
14
15 bin=zeros(1,5);
16
17 for i=1:5
18 if abs(c(i)−c_s(i))<tol
19 bin(i)=1;
20 end
21 end
22
23 end
brute_force.m
1 %% brute_force.m
2 % Summary: Direct evalutaion of loss for a selection of
3 % variables held
4 % constant
5 % author: Tor Anders Marvik
6 % organization: Department of Chemical Engineering, NTNU, Norway
7 % contact: [email protected]
8 % requires: matlab
9 % version: 1.0
10 % todo 1.0: Debugging "There is allways a second bug"
11 % started Oktober 2013
12 %%
13
14
87
88 C.2. Self optimizing variables
41 %−−−−−−−−−−−−−−−− Reoptimize−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
42 par.actset=[]; % no active constraints
43 par.flag=0;
44 [x_reopt,fval_reopt,exitflag]=fmincon(@(x)...
45 costfunction(x,price,par),x0,[],[],[],[],...
46 lb,ub,@(X)nonlcon(X,par),options);
47
48 [Treoptcol1,Treoptcol2] = Temp(x_reopt,par);
49
88
C.2. Self optimizing variables 89
64 for i=1:length(index_x)
65 par.index_u=index_x(i);
66 par.dof=x_opt(par.index_u); % s.p. for the CV
67 [x,fval,exitflag]=fmincon(@(x)costfunction(x,price,par),...
68 x0,[],[],[],[],lb,ub,@(X)nonlcon(X,par),options);
69 if exitflag<0 % no solutions found?
70 Loss_x(k,i)=inf
71 else
72 Loss_x(k,i)=fval−fval_reopt(k,:) % The loss
73 end
74 end
75
79 index_T=1:41;
80 for i=[1,10,20,30,41]
81 par.index_u=index_T(i);
82 par.dof=T_opt(par.index_u); % s.p. for the CV
83 [x,fval,exitflag]=fmincon(@(x)costfunction(x,price,par),...
84 x0,[],[],[],[],lb,ub,@(X)nonlcon(X,par),options);
85 if exitflag<0 % no solutions found
86 Loss_T(k,i)=inf
87 else
88 Loss_T(k,i)=fval−fval_reopt(k,:) % The loss
89
90 C.2. Self optimizing variables
89 end
90 end
91
96 for i=1:size(index_comb,1)
97 par.index_u=index_comb(i,:);
98 par.dof=x_opt(par.index_u(1))/x_opt(par.index_u(2));
99 [x,fval,exitflag]=fmincon(@(x)costfunction(x,price,par),...
100 x0,[],[],[],[],lb,ub,@(X)nonlcon(X,par),options);
101 if exitflag<0 % no solutions found?
102 Loss_comb(k,i)=inf
103 else
104 Loss_comb(k,i)=fval−fval_reopt(k,:) % The loss
105 end
106 end
107
90
C.2. Self optimizing variables 91
129 index_T=1:41;
130 for i=1:41
131 par.index_u=index_T(i)+41;
132 par.dof=T_opt(par.index_u);
133 [x,fval,exitflag]=fmincon(@(x)costfunction(x,price,par),...
134 x0,[],[],[],[],lb,ub,@(X)nonlcon(X,par),options);
135 if exitflag<0 % no solutions found
136 Loss_T_col2(k,i)=inf
137 else
138 Loss_T_col2(k,i)=fval−fval_reopt(k,:) % The loss
139 end
140 end
141
142
controlled_line.m
1 %% controlled_line.m
2 % Summary: The script calcualtes a loss when controlling
3 % the system and increasing and decreasing a
91
92 C.2. Self optimizing variables
9 clc
10 clear all
11
14 %Nominal point
15 par.F=1.4;
16 price.steam=0.01;
17
22 [x_opt,fval_opt,exitflag]=fmincon(@(x) costfunction(...
23 x,price,par),x0,[],[],[],[],lb,ub,@(...
24 X)nonlcon(X, par),options);
25 [Toptcol1,Toptcol2] = Temp(x_opt,par);
26 T_opt=[Toptcol1;Toptcol2]; % Temperature at optimum
27
31
37 i=1;
38 exitflag=1;
39 while par.F>1.35 && exitflag>=0
40 par.F=par.F−0.001; % disturbance step
92
C.2. Self optimizing variables 93
41
42 %calculate optimum
43 par.actset=[];
44 par.flag=0; % No control
45 [x_reopt(:,i),fval_reopt(i),exitflag]=fmincon(@(x)...
46 costfunction(x,price,par), x0,[],[],[],[],...
47 lb,ub,@(X)nonlcon(X, par),options);
48
49 %calculate controlled
50 par.actset=[1;2;4]; % index of active constraints
51 par.flag=2;
52 [x(:,i),fval(i),exitflag]=fmincon(@(x) ...
53 costfunction(x,price,par),x0,[],[],[],[],...
54 lb,ub,@(X)nonlcon(X, par),options);
55 exitflag
56
57 zF(:,i)=par.zF;
58 F(i)=par.F
59 steam(i)=price.steam;
60 x0=x(:,i);
61 i=i+1;
62 end
63
64 F=fliplr(F);
65 zF=fliplr(zF);
66 x=fliplr(x);
67 fval=fliplr(fval);
68 steam=fliplr(steam);
69 x_reopt=fliplr(x_reopt);
70 fval_reopt=fliplr(fval_reopt);
71
93
94 C.2. Self optimizing variables
78
82 %calculate optimum
83 par.flag=0; % no control
84 par.actset=[];
85 [x_reopt(:,i),fval_reopt(i),exitflag]=fmincon(@(x)...
86 costfunction(x,price,par),x0,[],[],[],[],...
87 lb,ub,@(X)nonlcon(X, par),options);
88
89 %calculate controlled
90 par.flag=2;
91 par.actset=[1;2;4]; % index of active constraints
92 [x(:,i),fval(i),exitflag]=fmincon(@(x)...
93 costfunction(x,price,par), x0,[],[],[],[],...
94 lb,ub,@(X)nonlcon(X, par),options);
95
96 zF(:,i)=par.zF;
97 F(i)=par.F
98 steam(i)=price.steam;
99 x0=x(:,i);
100 i=i+1;
101 end
102
103
113
114 %save()
94
C.2. Self optimizing variables 95
Run_exact_local_metod.m
10 % Initial point
11 Feed=1.35; % Nominal feed
12 steam=0.03; % Nominal steam price
13
14 % Active set
15 actset=[4]; % set of active constraints [V1,V2, x_A, x_B, X_C]
16 index_u=[par.NV+1;par.NV+2;2*par.NV+6]; % Index of MV's in x
17
21 % Linerize model
22 [G1,Gd,Juu,Jud,exitflag]=linerize(...
23 index_u,actset,du,dd,Feed,steam);
24
95
96 C.2. Self optimizing variables
32
37 [B,sset,ops,ctime,flag]=b3av(G_comb,Gd1,Wd,Wn,...
38 Juu.av,Jud.av,inf,200);
39 % An error in the algotithm causes infeasible
40 % values with loss −inf to be sorted fist in B
41 % and sset: Fist feasible values given by:
42 k=1;
43 while B(k)<0
44 k=k+1;
45 end
46 B=B(k:end,:);
47 sset=sset(k:end,:);
48
51 [H,loss_av,loss_wc,loss_av_cao,loss_wc_cao]=...
52 exact_local_method(sset(1,:),G_comb,Gd1,Wd,Wn,Juu.av,Jud.av);
exact_local_method.m
1 %% exact_local_methode.m
2 % Summary: The script calculate H matrix and loss using
3 % the analytic soultion to the exact local methode.
4 % The H matrixgives the optimal combinations of
5 % mesurement to be controlled with the measurement
6 % and implementation error considered.
7 %
8 % author: Tor Anders Marvik
9 % org.: Department of Chemical Engineering, NTNU, Norway
10 % contact: [email protected]
96
C.2. Self optimizing variables 97
13
14 function [H,loss_av,loss_wc,loss_av_cao,loss_wc_cao]=...
15 exact_local_method(sset,G_comb,Gd1,Wd,Wn,Juu,Jud)
16
28 H=(inv(Y*Y')*G1_ss*inv(G1_ss'*inv(Y*Y')*G1_ss)*sqrtm(Juu))';
29
30 %Loss
31 M=sqrtm(Juu)*inv(H*G1_ss)*H*Y;
32 loss_wc=0.5*svds(M,1)^2 ;
33 loss_av=0.5*norm(M,'fro')^2;
34
97
98 C.3. The model
48
49 G2=G*G';
50 [R,f]=chol(G2);
51 X=R'\Y;
52 lambda=sum(sum(X.*X));
53 loss_av_cao=sort(lambda/(6*(size(Wd,2)+1)));
54
55 end
The model is a steady state version of column A [15], handling multiple compo-
nents.
multiCP_ColumnA_ext.m
98
C.3. The model 99
9 %
10 % Two components (binary separation);
11 % Constant relative volatility;
12 % No vapor holdup;
13 % One feed and two products;
14 % Constant molar flows (same vapor flow on all
15 % stages);
16 % Total condenser
17 %
18 % The model is based on column A in Skogestad and
19 % Postlethwaite (1996). The model has NT*NC states.
20 %
21 % Inputs: x − states, the NT*NC compositions
22 % reboiler/bottom stage as x(1,i) and condenser
23 % as x(NT,i).
24 % par.LT − reflux L,
25 % par.VB − boilup V,
26 % par.D − top or distillate product flow D,
27 % par.B − bottom product flow B,
28 % par.F − feed rate F,
29 % par.zF − feed composition, zF.
30 % par.qF − feed liquid fraction, qF.
31 % par.NT − number of stages, NT.
32 % par.NF − location of feed stage, NF.
33 % par.alpha − relative volatilities, alpha.
34 % par.NC − number of components,NC.
35 %
36 % Outputs: [residue] = f(x), residue=0 if x is a solution of
37 % the system of nonlinear equations
38
39 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
40
99
100 C.3. The model
46
47 F = par.F; % Feedrate
48 zF = par.zF; % Feed composition
49 qF = par.qF; % Feed liquid fraction
50
56 %Preallocation
57 %y=ones(NT−1,NC−1);
58 dMxdt = ones(NT,NC−1);
59 dMdt = ones(2,1);
60 x=X(1:NT*(NC−1));
61 x=reshape(x,NT,NC−1);
62 % THE MODEL
63
64 % Vapor−liquid equilibria
65 y = (x*diag(alpha(1:NC−1)))./((x*(alpha(1:NC−1) − 1) + 1)*...
66 ones(1,NC−1));
67 % −−−−−−−−−−−−−−−−−−−−Column−−−−−−−−−−−−−−−−−−−−−−−−−−
68 %
69 % Component balances
70 % =============================================
71 % Reboiler (assumed to be an equilibrium stage)
72 i = 1:NC−1;
73 dMxdt(1,i)= (LT+qF*F)*x(2,i) − VB*y(1,i) − B*x(1,i);
74 % Stripping section trays
75 j=2:NF−1;
76 dMxdt(j,i)= (LT+qF*F)*x(j+1,i) − (LT+qF*F)*x(j,i) +...
77 VB*y(j−1,i) − VB*y(j,i);
78 % Feed tray
79 dMxdt(NF,i)= LT*x(NF+1,i) − (LT+qF*F)*x(NF,i) + ...
80 VB*y(NF−1,i) − (VB+(1−qF)*F)*y(NF,i) + F*zF(i)';
81 % Enrichment section trays
82 j=NF+1:NT−1;
100
C.3. The model 101
101
102 C.3. The model
10 % Tb_B=70 *C
11 % Tb_C=100 *C
12 %
13 % author: Tor Anders Marvik
14 % organization: Department of Chemical Engineering, NTNU
15 % contact: [email protected]
16 % input x : condition vektor
17 % par : Parameter struct
18 % Output Tcol1 : Tray temperature vektor column 1
19 % Tcol2 : Tray temperature vektor column 2
20
21 % Temperature function
22 T=@(x)100−x(:,2)*(100−70)−x(:,1)*(100−30);
23
35
36 end
102
C.3. The model 103
8 %column 1
9 par1.F=par.F;
10 par1.zF=par.zF;
11 par1.LT=x(par.NV+1);
12 par1.VB=x(par.NV+2);
13 par1.D=x(par.NV+3);
14 par1.B=x(par.NV+4);
15 ceq_col1=multiCP_ColumnA_ext(x(1:par.NV),par1);
16
17 %column 2
18 par2.F=x(par.NV+4);
19 par2.zF=x([1,par.NT+1,2*par.NT+1]);
20 par2.LT=x(par.NV*2+4+1);
21 par2.VB=x(par.NV*2+4+2);
22 par2.D= x(par.NV*2+4+3);
23 par2.B= x(par.NV*2+4+4);
24 ceq_col2=multiCP_ColumnA_ext(x(par.NV+5:par.NV*2+4),par2);
25
26 %active constraints
27 act(1)=x(par.NV+2)−4.008;% % Max vapour flow col1
28 act(2)=x(2*par.NV+6)−2.405; % Max vapour flow col2
29 act(3)=x(par.NT)−0.95; % Min comp A top col1
30 act(4)=x(par.NV+4+2*par.NT)−0.95; % Min comp B top col2
31 act(5)=x(par.NV+4+2*par.NT+1)−0.95; % Min comp C btm col2
32 active=act(par.actset)'; % Set of acitive const.
33
34
35 if par.flag==0; % No control
36 ceq=[ceq_col1;ceq_col2;active];
37 else % With control
38
39
103
104 C.3. The model
56 %x()/x() controlled
57 if par.flag==3
58 res_dof=x(par.index_u(1, 1))/x(par.index_u(1,2))−dof;
59 ceq=[ceq_col1;ceq_col2;active;res_dof];
60 end
61
62 %x()/F() controlled
63 if par.flag==4
64 res_dof=(x(par.index_u)/par.F)−dof;
65 ceq=[ceq_col1;ceq_col2;active;res_dof];
66 end
67
68 %c= H * T controlled
69 if par.flag==5;
70 [Tcol1,Tcol2] = Temp(x,par);
71 T=[Tcol1;Tcol2];
72 res_dof=par.H*T(par.index_u)−dof;
73 ceq=[ceq_col1;ceq_col2;active;res_dof];
74 end
75
76 end
77 end
104
C.3. The model 105
6 %intial values
7 par.F=1.4; % Feed flow rate
8 par.zF=[0.4 0.2 0.4]'; % Feed composition
9 par.qF=1.0; % Feed liquid fraction
10 par.NC=3; % Number of components
11 par.NT=41; % Number of trays
12 par.NF=21; % Feed tray number
13 par.alpha=[2 1.5 1]'; % Relative volatility
14
32
105
106 C.3. The model
35 %Initial Values
36 x0_col1=[ linspace(0.01,0.99,par.NT)';
37 linspace(0.39,0.005,par.NT)';
38 linspace(0.6,0.005,par.NT)';
39 par.F/2;
40 par.F/2;
41 par.F/2;
42 par.F/2] ;
43 x0_col2=[ linspace(0.00,0.00,par.NT)';
44 linspace(0.01,0.99,par.NT)';
45 linspace(0.99,0.01,par.NT)';
46 par.F/4;
47 par.F/4;
48 par.F/4;
49 par.F/4] ;
50
51 x0=[x0_col1;x0_col2];
52
53
60
71
106
C.3. The model 107
72 %fmincon options
73 options = optimset('TolFun',10e−8,'TolCon',10e−8,...
74 'MaxFunEvals',1e4,'Display','off','Algorithm',...
75 'sqp','Diagnostics','off');
76
77
107