0% found this document useful (0 votes)
35 views

Main Document

This master's thesis examines the control structure design for two distillation columns in sequence. The document outlines a systematic procedure for finding the optimal control structure by identifying active constraint regions and self-optimizing variables. As a case study, the procedure is applied to a system of two distillation columns to map how the active constraints change with variations in steam price and feed flow. Two active constraint regions are studied in depth to identify variables that can be controlled to keep the system close to optimal.

Uploaded by

hamzahkhan8977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Main Document

This master's thesis examines the control structure design for two distillation columns in sequence. The document outlines a systematic procedure for finding the optimal control structure by identifying active constraint regions and self-optimizing variables. As a case study, the procedure is applied to a system of two distillation columns to map how the active constraints change with variations in steam price and feed flow. Two active constraint regions are studied in depth to identify variables that can be controlled to keep the system close to optimal.

Uploaded by

hamzahkhan8977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 129

Department of Chemical Engineering

TKP5900

Master Thesis
Control structure design for two
distillation columns in sequence

Written by:

Tor Anders M ARVIK


[email protected]

MTKJ

Supervisor: Sigurd Skogestad


Co-supervisors: Johannes Jäschke
Vladimiros Minasidis

January 15, 2014


ii

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

Selv for relativt små systemer, for eksempel et system av to destillasjonskolonner


koblet i serie, kan kontrollproblemet være komplisert. Dette prosjektet skisserer
en generell prosedyre for å finne den optimale kontrollstrukturen. Prosedyren
prøver å finne den optimale kontrollstrukturen gjennom å identifisere aktive be-
grensningsregioner og selvoptimaliserende variable.
I denne hovedoppgaven har optimal kontrollstruktur av to destillasjonskolonner i
serie blitt studert. For å oppnå optimal kontroll, må de aktive kontrollvariablene
i systemet bli identifisert og kontrollert stramt. Hvilke kontrollvariable som er
aktive, avhenger av ytre betingelser. Dette prosjektet har kartlagt hvordan de
aktive variablene endres mot variasjoner i damppris og fødestrøm.
To av de aktive begrensningsregionene er studert videre. En grunding analyse
ble gjennomført med systemet i stasjonær tilstand, for å finne variabler, som ved
konstant verdi, vil drive systemet mot optimaltilstanden. Variabler med disse
egenskapene sies å være selvoptimaliserende. Både kontrollvariabler bestående
av en enkelt måling og kombinasjoner av målinger, har blitt vurdert. I begrens-
ingsregionen med billig damp, ble det funnet optimalt å styre en trinntemperatur
i den øvre delen av kolonne to. I den andre regionen som ble studert, var kun
produktspesifikasjonen til det verdifulle produktet aktivt. Tre trinntemperaturer
som vil holde systemet nært det optimale punktet ble identifisert.

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

I declare that this is an independent work according to the exam regulations of


the Norwegian University of Science and Technology (NTNU).

Trondheim, January 14. 2014

————————————————

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

3 A systematic procedure to search for the primary controlled vari-


ables 15
3.1 Initial steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.1 Defining the cost function . . . . . . . . . . . . . . . . 16
3.1.2 Developing a mathematical model . . . . . . . . . . . . 18
3.1.3 Identifying the degrees of freedom . . . . . . . . . . . . 18
3.1.4 Identifying important disturbances . . . . . . . . . . . . 18

ix
x Contents

3.2 Finding the active constraint regions . . . . . . . . . . . . . . . 19


3.3 Searching for self-optimizing variables . . . . . . . . . . . . . . 19
3.4 Other considerations . . . . . . . . . . . . . . . . . . . . . . . 21

4 Active constraint regions for a system of two distillation columns in


sequence 23
4.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.1 Tray temperature estimation . . . . . . . . . . . . . . . 24
4.2 The optimization problem . . . . . . . . . . . . . . . . . . . . . 25
4.2.1 Possible number of active constraint regions . . . . . . . 26
4.2.2 Active constraint regions in the disturbance space . . . . 27
4.3 Discussion of the constraint region map . . . . . . . . . . . . . 31

5 Case study: Self optimizing variables in region I and VI 33


5.1 Potential variables to control . . . . . . . . . . . . . . . . . . . 34
5.2 Disturbances considered . . . . . . . . . . . . . . . . . . . . . 34
5.3 Case 1: Selection of controlled variables in constraint region VI 35
5.3.1 The boundaries of the region with respect to the reflux L1 35
5.3.2 Direct evaluation of loss . . . . . . . . . . . . . . . . . 39
5.3.3 Global direct evaluation of loss controlling a tray in col-
umn 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.3.4 Discussion of global evaluation of loss . . . . . . . . . . 43
5.3.5 Global direct evaluation of loss controlling selected vari-
ables from both columns . . . . . . . . . . . . . . . . . 44
5.3.6 Gain and optimal sensitivity in constraint region VI . . . 46
5.3.7 The "Exact local method" with single measurement as
controlled variable . . . . . . . . . . . . . . . . . . . . 49
5.3.8 Combinations of tray temperature measurements . . . . 51
5.3.9 Discussion measurement combinations . . . . . . . . . 52
5.3.10 Direct evaluations of loss for combinations of tray tem-
peratures . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.4 Case 2: Selection of controlled variables in constraint region I . 56
5.4.1 Optimal control using single temperature measurements 56
5.4.2 Discussion optimal control in constraint region I . . . . 57

6 Discussion 59
6.1 Systematic procedure . . . . . . . . . . . . . . . . . . . . . . . 59

x
Contents xi

6.2 Active constraint regions . . . . . . . . . . . . . . . . . . . . . 60


6.3 Case studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.3.1 Use of combination measurements . . . . . . . . . . . . 63

7 Conclusion 65
7.1 Suggestions for future work . . . . . . . . . . . . . . . . . . . . 66

Appendices 71

A Linearizion of the model using finite differences 73

B Validation of the linearizion 77


B.1 Optimal sensitivity . . . . . . . . . . . . . . . . . . . . . . . . 77
B.2 Validating Juu and Jud in region I . . . . . . . . . . . . . . . . . 78

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

2.2.1 A distillation column modeled as a sequence of connected


equilibrium stages. The light gray is the vapor phase, V , and
the dark is the liquid phase, L. Where, y, denotes the com-
position in the vapor and, x, denotes the composition in the
liquid [4]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4.1 Typical control hierarchy of a chemical plant by time scale
deviation [6]. . . . . . . . . . . . . . . . . . . . . . . . . . 7
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.3 Control structure diagram, when selection the controlled vari-
ables, c, from the measurements, y, with a selection matrix,
H. d denotes disturbances and n denotes the implementation
error. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.4 Illustration of loss while controlling c1 or c2 at there optimal
values in d ∗ [6]. . . . . . . . . . . . . . . . . . . . . . . . . 10

3.0.1 Main steps in a general procedure to search for the optimal


primary controlled variables. . . . . . . . . . . . . . . . . . 17
3.3.1 Methods to calculate loss when controlling a set of variables
and exposing the system to disturbances. The controlled vari-
ables are selected from available measurements, either single
measurement or a combination of measurements. . . . . . . 20

4.1.1 Illustration of two distillation columns in sequence. . . . . . 24

xiii
xiv List of Figures

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. 29

5.3.1 Values of product specifications as a function of the reflux L1


in constraint region VI. . . . . . . . . . . . . . . . . . . . . 37
5.3.2 The highest and lowest possible values of L1 before a con-
straint is breached at different feed rates. . . . . . . . . . . . 37
5.3.3 The value of L1 when selected tray temperatures are kept con-
stant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3.4 The value of L1 when flow related variables are kept constant. 38
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.6 Loss when controlling a tray temperature and varying the
feed concentration of component A at the expense of compo-
nent B. The white area outside the "red line" is infeasible[$/s]. 43
5.3.7 Loss when controlling a tray temperature and varying the
feed concentration of component B at the expense of com-
ponent C. The white area outside the "red line" is infeasible.
The solver had convergence problems at the right side of the
plot [$/s]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
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
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.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 col-
umn 1 (left) or column 2 (right). . . . . . . . . . . . . . . . 47
5.3.11 The optimal sensitivity in the nominal point, feed= 1.4 mol/s
and steam price 0.01 $/mol. . . . . . . . . . . . . . . . . . 48

xiv
List of Figures xv

5.3.12 Loss when controlling a tray temperature in column 1, based


on "exact local method". . . . . . . . . . . . . . . . . . . . 50
5.3.13 Loss when controlling a tray temperature in column 2, based
on "exact local method". . . . . . . . . . . . . . . . . . . . 51
5.3.14 Lowest loss when controlling a specified numbers of tray
temperatures for either column 1 or column 2, respectively. . 52
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 fig-
ures show the disturbance gain with respect tray temperature
in column 1 (left) and column 2 (right) . . . . . . . . . . . . 57
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 composition change between component A
and B and iii) feed composition change between composition
B and C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

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

B.1.1 The optimal sensitivity of the temperature with respect to


three disturbances in contraint region IV. The individual points
marked by dots were calculated using equation B.1.1, and the
solid lines were calculated directly by perturbing the distur-
bances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
B.1.2 The optimal sensitivity of the temperature with respect to
three disturbances in contraint region I. The individual points
marked by dots were calculated using equation B.1.1, and the
solid lines were calculated directly by perturbing the distur-
bances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

xv
xvi List of Figures

xvi
List of Tables

4.1.1 Boiling point of the pure components in the modeled system. 25


4.2.1 Parameter values . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.2 All combinations of active constraints . . . . . . . . . . . . 28
4.2.3 Optimal values for selected data . . . . . . . . . . . . . . . 30

5.2.1 Disturbances considered . . . . . . . . . . . . . . . . . . . 35


5.3.1 Table of loss for selected controlled variable candidates . . . 40
5.3.2 Optimal values for the controlled variable candidates . . . . 41
5.3.3 Magnitude of expected disturbance and noise . . . . . . . . 49
5.3.4 Optimally controlled tray when calculating average- and worst
case loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.3.5 Optimal tray combinations selected from column 1, based on
exact local method . . . . . . . . . . . . . . . . . . . . . . . 53
5.3.6 Optimal tray combinations selected from column 2, based on
exact local method . . . . . . . . . . . . . . . . . . . . . . . 53
5.3.7 Table of loss when controlling the optimal combination of
tray temperatures from table 5.3.5 . . . . . . . . . . . . . . 54
5.3.8 Table of loss when controlling the optimal combination of
tray temperatures from from table 5.3.6 . . . . . . . . . . . 54
5.4.1 Tray numbers for optimal control of the system in region I
according to average loss and worst case loss calculations . . 56

C.0.1 Overview of the scripts used in the thesis . . . . . . . . . . . 82

xvii
xviii List of Tables

xviii
List of symbols

Symbol Unit Description


α Relative volatility
∆ Difference operator
ε Equality constrains
σ̄ Maximum singular value operator
A Component A
B Component B
B mol/s Bottom product flow
c Constraint
c Controlled variables
c∗ Nominal controlled variables
cs Set-point to the controlled variables
C Component C
C◦ Degrees Celsius
Col. Column
d Disturbance
d∗ Nominal disturbance
D mol/s Distillate flow
F Subscript denoting the frobenius norm
F mol/s Feed flow
Gy Process gain matrix
Gyd Disturbance gain matrix
h Step in forward and backward differences
H Selection matrix

xix
xx

Symbol Unit Description


I Inequality constrains
J $/s Cost
Jopt $/s Cost at optimal
L $/s Loss
L mol/s Reflux flow
n Measurement error
nc Number of constraints
nd.o. f Degrees of freedom
M Matrix used in calculation of loss
pF $/mol Price feed
pA $/mol Price distillate column 1
pB $/mol Price bottom product column 1
pC $/mol Price distillate column 2
pV $/mol Price steam
qF mol fraction Liquid fraction feed
T ◦C Temperature
Tb,A ◦C Boiling temperature pure component A
Tb,B ◦C Boiling temperature pure component B
Tb,C ◦C Boiling temperature pure component C
TC Temperature controller
u Input variables to the system
V mol/s Vapor flow
Vmax mol/s Maximum vapor flow
Wd Diagonal matrix giving the expected magnitude
of each disturbance
Wny Diagonal matrix with the expected magnitude
of noise for each measurement
x mol fraction Concentration in liquid phase
x State of the system
xA mol fraction Constraint variable component A distillate col. 1
xA,min mol fraction Product specification component A distillate col. 1
xB mol fraction Constraint variable B distillate col. 2
xB,min mol fraction Product specification component B distillate col. 2

xx
xxi

Symbol Unit Description


xC mol fraction Constraint component C bottom product col. 2
xC,min mol fraction Product specification component C bottom col. 2
y Output variables (measured variables)
y mol fraction Concentration in vapor phase
Y Matrix used in the "exact local method"
zF Feed composition vector

xxi
xxii

xxii
Chapter 1

Introduction

Distillation is one of the most frequently used separation techniques in chemical


industry [1]. In many cases distillation is a highly energy demanding process,
and low energy consumption depends on optimal operation. Optimizing a distil-
lation column deals with the state of the process that best fit a given set of criteria
for optimal operation. When the system is exposed to a disturbance, the state of
the system changes. How the system responds, depends on the control structure
of the system. If the system drifts far from the optimal point, re-optimization is
needed. The objective of this thesis is to identify a control structure that keeps
the system close to the optimal point when exposed to disturbances, without the
need to re-optimize.

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].

1.1 Aim of the thesis

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

subject to ci (x, u, d) ≤ 0, i ∈ I (2.1.1)

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.

2.2 Distillation theory

Distillation is a common separation technique in chemical industry. The method


utilizes the fact that for a liquid-vapor mixture at equilibrium, the lightest of two
components has a higher concentration in the vapor than in the liquid. Each
separation event of vapor and liquid approaching equilibrium, is called a flash.
Distillation can be described as a counter-current multistage flash. From each
tray in the column the vapor flows to the tray above, while the liquid flows to the
tray below. By repeated separation of the vapor and liquid the mixture becomes
increasingly purer. The basic principle in a distillation column is illustrated in
figure 2.2.1.

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

Figure 2.2.1: A distillation column modeled as a sequence of connected equilibrium


stages. The light gray is the vapor phase, V , and the dark is the liquid
phase, L. Where, y, denotes the composition in the vapor and, x, denotes
the composition in the liquid [4].

2.3 Constraint curve and and active constraint regions

A constraint is said to be active if the constraint variable in the optimal state of


the system has the same value as the constraint. Identifying active constraints
and finding the active constraint regions are important parts of the search for
optimal plant operation. As the terms "constraint curve" and "active constraint
region" are not trivial, they need to be defined. The definition is given below [3]:

Definition 1 Constraint curve:


The constraint curve corresponding to a constraint, c, is the line separating the
region where c is optimally active from the region where c is optimally inactive.

5
6 2.4. Plantwide control by time scale separation

Definition 2 Active constraint region:


The active constraint region is defined as the part of the disturbance space that is
bounded by constraint curves, and thus have the same set of active constraints.

2.4 Plantwide control by time scale separation

The control system of a chemical plant can be hierarchically decomposed into


several layers, each operating at different time scales. Typically, the layers
include scheduling (weeks), site-wide optimization (days), local optimization
(hours), supervisory control (minutes) and stabilizing and regulatory control
(seconds) [6]. The higher layers control the layers below by providing the set-
points to the subsequent layer. A sketch of a typical control hierarchy of a chem-
ical plant is given in figure 2.4.1

When the system is exposed to disturbances, the lower layers operating on a


shorter time scale would be the first to respond, trying to correct the system.
The better the lower layers are to drive the system to the new optimal state,
the more optimal would the whole structure be, as the system would spend less
time in a non-optimal state. The core principles of self-optimizing control is to
find controlled variables in the supervisory control layer, that drives the system
to the new optimum when the system is exposed to disturbances, without the
need for re-optimization. Variables that have these characteristics are called self-
optimizing variables.

2.4.1 Self-optimizing variables

For a system to be fully specified, it is necessary to control as many variables as


there are degrees of freedom. From an economic point of view it is always best
to keep the system at the active constraints (for definition of active constraints

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

self-optimizing variables, with the following definition [6]:

"Self-optimizing control is when acceptable operation under all


conditions is achieved with constant setpoints for the controlled vari-
ables."

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:

L(u, d) = J(u, d) − J(uopt , d ∗ ) (2.4.1)

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

The selection of controlled variables, c, from the measurements, y, can be done


using a selection matrix, H:

c = Hy (2.4.2)

A simplified sketch of the control problem using the selection matrix, H, is


shown i figure 2.4.3.

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

Figure 2.4.4: Illustration of loss while controlling c1 or c2 at there optimal values in


d ∗ [6].

2.4.2 Exact local method

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:

• Steady state cost, J(u, d)

• Quadratic cost approximation

• A linear model

The cost function is approximated by a Taylor expansion, neglecting higher than


second order terms:
" # " #T " #" #
∆u ∆u ∗
Juu ∗
Jud ∆u

J(u, d) = J(u , d b
∗) + [Ju∗ Jd∗ ] + 1/2 ∗ ∗
(2.4.3)
∆d ∆d Juu Jdd ∆d

10
2.4. Plantwide control by time scale separation 11

Here ∆u = u − u∗ and ∆d = d − d ∗ are deviations from the optimum, where


the optimal nominal values are marked with an asterisk. Ju and Jd are the first
derivatives of the cost function. As the function is approximated around the
optimal point, first order derivatives would be zero. To simplify notation further,
the optimal point is shifted such that the nominal point (u∗ , d ∗ ) is zero. The same
is done for the measurement, y, in the following paragraph.

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

are assumed to be normal distributed.


" #
d
∈ N(0, 1) (2.4.6)
ny

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

The optimal sensitivity, F, can be obtained directly from the definition or by


using equation 2.4.12.

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)

2.5 Degrees of freedom

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.

2.6 Mathematical tools

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.

2.7 The "branch and bound" algorithm

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

A systematic procedure to search


for the primary controlled vari-
ables

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

In the subsequent chapters, chapter 4 and chapter 5, this procedure is used to


study optimal control for a system of two distillations columns in sequence.

The main steps in the procedure are illustrated in a flow diagram in figure 3.0.1.

3.1 Initial steps

There are four main initial steps that need to be carried out before the search for
the active constraint regions can begin. These are:

• Define the cost function and the constraints

• Develop a mathematical model

• Identify the degrees of freedom in the system

• Identify important disturbances

The sequence of these four initial steps are irrelevant is not important.

3.1.1 Defining the cost function

The problem has to be structured mathematically as a constraint optimization


problem according to equation 2.1.1. The cost function in the optimization prob-
lem measures the quality of the control structure and provides the decision crite-
ria in the search for the optimal controlled variables. Typically, the objective is
economically motivated. The optimum is thus the state that is most profitable in
economic terms. Mathematically the cost, J, would be negative with respect to
the profit, P (C = −P). Only variables that affects the steady state of the system
should be included in the cost function. A typical cost function is the sum of
utilities and feed, subtracted the income from the products.

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.

3.1.2 Developing a mathematical model

Any optimization is depending on a reliable mathematical description of the sys-


tem model. The search for the primary controlled variables that is outlined in this
procedure assumes a steady state model of the system. The "exact local method"
would in addition require the model to be linearized around the nominal point
studied.

3.1.3 Identifying the degrees of freedom

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.

3.1.4 Identifying important disturbances

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

3.2 Finding the active constraint regions

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.

3.3 Searching for self-optimizing variables

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

reduce the number of evaluations, engineering insight could be used.

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.

3.4 Other considerations

The selection of controlled variables should not be based on minimization of


loss alone [6]. The controlled variables should in addition be easy to measure
and control accurately. A process that is difficult to control would spend longer
time away from set-point, and maybe even be unstable. An offset form the set-
point usually imply a loss. Keeping the process at the set-point is a prerequisite
for the evaluation of loss analysis.

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

Active constraint regions for a sys-


tem of two distillation columns in
sequence

A system of two distillation columns in sequence was studied, with reference to


the PhD thesis of Jackobsen [3]. In order to identify the optimal control struc-
ture, the active constraint regions were mapped, and the map was subsequently
compared with the one found by Jacobsen [3]. Optimal control structure in two
of the regions was explored further in order to find self-optimizing variables, see
chapter 5.

4.1 Model

The system studied consists of two distillation columns in sequence, separating


three components A, B and C, where A is the most and C the least volatile com-
ponent. The column model is based on a steady-state version of the Column A

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.

Figure 4.1.1: Illustration of two distillation columns in sequence.

4.1.1 Tray temperature estimation

The boiling temperature of a mixture is a function of the composition [4]. The


temperature on each tray is estimated using the function:

T = Tb,A − (Tb,A − Tb,B )xB − (Tb,A − Tb,C )xC (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

4.2 The optimization problem

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.

min J(u, d) = pF F + pV (V1 +V2 ) − pA D1 − pB D2 − pC B2


u

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].

Table 4.2.1: Parameter values

Parameters Values Units


F Variable mol/s
αAC 2
αBC 1.5
zF [0.4 0.2 0.4]T molfrac.
qF 1
pF 1 $/mol
pV Variable $/mol
pA 1 $/mol
pB 2 $/mol
pC 1 $/mol
Constraints
xA,min 0.95 molfrac.
xB,min 0.95 molfrac.
xC,min 0.95 molfrac.
V1,max 4.008 mol/s
V1,max 2.405 mol/s

4.2.1 Possible number of active constraint regions

An active constraint region is defined as an area in the disturbance space which


has the same combination of active constrains, see section 2.3.

According to Jacobsen [3] the maximum number of active constraints regions


are 2nc . Where nc is the number of constraints. All possible combinations are
presented in Table 4.2.2. In a real system, not all active constraint regions exist.

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.

Generally, if the number of independent constraints, nc , is smaller or equal to the


degrees of freedom, the number of possible constraint regions would be limited
by the number of constraints. In this case the number of possible active con-
straint regions would be 2nc . On the other hand, if the number of constraints
are larger than the degrees of freedom, the degrees of freedom would be limit-
ing. The number of possible constraint regions would then be reduced by the
number of combinations that have more active constraints then there are degrees
of freedom. A general expression for possible number of active constraint re-
gions is presented in equation 4.2.2. The equation requires the constraint lines
not to cross each other more than ones. Without this requirement the number of
possible active constraint regions would be unlimited.


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.

4.2.2 Active constraint regions in the disturbance space

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

Table 4.2.2: All combinations of active constraints

Number V1 V2 XA XB XC Region name


1
2 XC
3 XB I
4 XB XC
5 XA
6 XA XC
7 XA XB II
8 XA XB XC IV
9 V2
10 V2 XC
11 V2 XB
12 V2 XB XC
13 V2 XA
14 V2 XA XC
15 V2 XA XB
16 V2 XA XB XC
17 V1
18 V1 XC
19 V1 XB III
20 V1 XB XC
21 V1 XA
22 V1 XA XC
23 V1 XA XB V
24 V1 XA XB XC VII
25 V1 V2
26 V1 V2 XC
27 V1 V2 XB VI
28 V1 V2 XB XC
29 V1 V2 XA
30 V1 V2 XA XC
31 V1 V2 XA XB VIII
32 V1 V2 XA XB XC Infeasible

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

Active contraint regions

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

Region I II III IV V VI VII VIII IX


Column 1
F 1.350 1.400 1.400 1.400 1.470 1.400 1.450 1.480 1.400
pV 0.030 0.100 0.025 0.025 0.100 0.010 0.180 0.010 0.160
V1 3.853 3.870 4.008 4.008 4.008 4.008 4.008 4.008 3.892
L1 3.300 3.290 3.436 3.436 3.400 3.437 3.408 3.396 3.312
D1 0.553 0.580 0.572 0.572 0.608 0.571 0.601 0.612 0.580
B1 0.797 0.820 0.828 0.828 0.862 0.829 0.850 0.868 0.820
XA,D1 0.960 0.950 0.961 0.961 0.950 0.962 0.950 0.950 0.950
XB,D1 0.041 0.050 0.039 0.039 0.050 0.038 0.050 0.050 0.050
XC,D1 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
XA,B1 0.012 0.011 0.012 0.012 0.012 0.013 0.011 0.013 0.011
30

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

4.2. The optimization problem


D2 0.253 0.243 0.264 0.264 0.258 0.265 0.242 0.268 0.233
B2 0.544 0.577 0.564 0.564 0.604 0.563 0.608 0.600 0.587
XA,D2 0.038 0.038 0.038 0.038 0.041 0.039 0.039 0.041 0.038
XB,D2 0.950 0.950 0.950 0.950 0.950 0.950 0.950 0.950 0.950
XC,D2 0.013 0.012 0.012 0.012 0.009 0.011 0.011 0.009 0.012
XA,B2 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
XB,B2 0.014 0.035 0.012 0.012 0.030 0.011 0.050 0.018 0.050
XC,B2 0.986 0.965 0.988 0.988 0.970 0.989 0.950 0.982 0.950
J [$/s] -0.071 0.345 -0.105 -0.105 0.364 -0.201 0.841 -0.204 0.695
4.3. Discussion of the constraint region map 31

4.3 Discussion of the constraint region map

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

Case study: Self optimizing vari-


ables in region I and VI

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:

• Their optimal value should be insensitive to disturbances.

• They should be easy to measure and control.

• Their value should be sensitive to changes in the manipulated variable.

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.

5.1 Potential variables to control

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:

• 41 tray temperatures and compositions

• 8 flows: D1 , B1 ,V1 , L1 , D2 , B2 ,V2 , L2

The variable to be controlled has to be connected with one of the variables


amenable to manipulation, which in this case are the flow variables only:

• 7 flows: D1 ,V1 , L1 , D2 , B2 ,V2 , L2

In this project only LV column structure is considered. LV structure denotes the


case where the flows L and V , are used to manipulate the primary controlled vari-
ables. Causing the level in the reflux drum and the re-boiler drum to be controlled
by the flows D and B, respectively. The primary controlled variables denote the
controlled variables that eliminate the steady-state degrees of freedom.

5.2 Disturbances considered

All uncontrolled variables should be considered as disturbances. In this system,


the feed is the only uncontrolled variable effecting the system, thus assumed
to be the source of the dominating disturbances. Examples include changes in

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

5.3 Case 1: Selection of controlled variables in constraint


region VI

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".

5.3.1 The boundaries of the region with respect to the reflux L1

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 .

Describing how L1 changes when a variable is controlled might give a good


indication of what variables would be useful for controlling the system. The
ideal variable should be such that L1 is kept at the optimal line. The value of L1
as a function of the feed flow when a selected tray temperature is controlled to
a constant value, is presented in figure 5.3.3. Correspondingly, the value of L1
as a function of the feed flow when L1 , L1 /F and D1 /F, respectively, are kept
constant, is presented in figure 5.3.4.

36
5.3. Case 1: Selection of controlled variables in constraint region VI 37

Values of the product constraint


1
xA
xB
0.99 XC

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

Figure 5.3.1: Values of product specifications as a function of the reflux L1 in constraint


region VI.

Limits on the reflux in region IV


3.47
Upper L1, xC=0.95
Optimal
3.46
Lower L1, XA=0.95

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

Limits on the reflux in region IV


3.47
Upper L , x =0.95
1 c
Optimal
3.46
Lower L1, XA=0.95
c=T1,col1
3.45 c=T10,col1
c=T20,col1
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.3: The value of L1 when selected tray temperatures are kept constant.

Limits on the reflux in region IV


3.47
Upper L1, xc=0.95
Optimal
3.46
Lower L1, XA=0.95
c=L1
3.45 c=L1/F
c=D1/F
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.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.

5.3.2 Direct evaluation of loss

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

Controlled variable F = 1.41 F = 1.39 zF = zF = zF = zF = Average


Candidates 0.39] 0.41] 0.40] 0.40]
[10−3 $/s] 0.21, 0.19, 0.19, 0.21,
0.40] 0.40] 0.41] 0.39]
Variables from column 1

5.3. Case 1: Selection of controlled variables in constraint region VI


L1 Inf 0.0850 0.2695 Inf 0.0176 0.2805 Inf
D1 Inf 1.8425 Inf Inf 0.1520 0.2805 Inf
xA,b1 0.0028 0.0023 0.0148 0.0374 0.4029 0.2587 0.1198
xA,d1 0.4422 0.2197 0.3997 0.2591 0.6611 3.2566 0.8731
Tbtm , col1 0.0643 0.0453 Inf Inf Inf Inf Inf
T10 col1 0.0378 0.0285 0.0315 0.0159 0.6059 0.3816 0.1835
T20 , col1 0.1728 0.1055 5.9639 1.0073 0.0011 0.0025 1.2088
40

T30 , col1 0.3004 0.1641 1.4796 0.6025 0.6636 3.3786 1.0981


Ttop , col1 0.4424 0.2198 0.3992 0.2589 0.6608 3.2535 0.8724
Optimal tray from column1 10 10 9 9 21 21
T 1opt 0.0378 0.0285 0.0016 0.000 0.0000 0.0002
D1 /F Inf 1.8425 Inf Inf 0.1520 0.2805 Inf
L1 /F Inf 0.0850 0.2695 Inf 0.0176 0.2805 Inf
L1 /D1 Inf 0.5164 1.7265 Inf 0.0937 0.2805 Inf
Variables from column 2
Tbtm , col2 0.0203 0.0181 0.2124 0.1382 0.0333 0.0328 0.0758
T10 , col2 0.0127 0.0115 0.2193 0.1413 0.0797 0.0856 0.0917
T20 , col2 0.0012 0.0012 0.2297 0.1481 0.2873 0.3547 0.1704
T30 , col2 0.0000 0.0000 0.0051 0.0030 0.0213 0.0256 0.0092
Ttop , col2 0.0002 0.0002 0.0577 0.0393 0.0001 0.0000 0.0162
Optimal tray from column 2 26 27 28 28 41 41
Topt , col2 0.0000 0.0000 0.0002 0.0000 0.0513 0.0393 0.0151
5.3. Case 1: Selection of controlled variables in constraint region VI 41

Table 5.3.2: Optimal values for the 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

5.3.3 Global direct evaluation of loss controlling a tray in column 1

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.

Loss with temperature control in region VI


0.01
40

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

Loss with temperature control in region VI


0.01
40

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].

5.3.4 Discussion of global evaluation of loss

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

Loss with temperature control in region VI


0.01
40

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].

in the feed concentration of component B at the expense of component C behaves


similarly. To get the smallest loss in this case, the temperature of tray 20 or below
should be controlled. As there are no tray that would give a small loss for these
three disturbances, a combination of measurements might be necessary.

5.3.5 Global direct evaluation of loss controlling selected variables


from both columns

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.

−4 Loss controlling a single varaible in col1


x 10
2
c: T ,col
btm 1
c: T10,col1
c: T20,col1
c: T30,col1
c: Ttop,col1
c: xA,btm, col1
Loss [$/s]

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

−4 Loss controlling a single varaible in col2


x 10
2
c: Tbtm,col2
c: T10,col2
c: T20,col2
c: T30,col2
c: Ttop,col2
Loss [$/s]

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.

5.3.6 Gain and optimal sensitivity in constraint region VI

Controlling tray temperature is a common way of controlling a distillation col-


umn. According to Skogestad [1] the gain should be large and the optimal sen-
sitivity to disturbances small. The gain and the sensitivity in constraint region
VI have been calculated when the feed is at 1.4 mol/s and the steam price is
0.01 $/mol, using finite differences. The reflux in column 1, L1 , was used as
the manipulated variable, assessing disturbances in feed and feed composition
according to table 5.2.1. The temperature process gain with respect to the input
variables and the disturbances is shown in figure 5.3.10. The optimal sensitivity,
F, was found for the same nominal point and is shown in figure 5.3.11.

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

Optimal sensitivety F, column 1 Optimal sensitivety F, column 2


60 60 opt
dT /dFeed
dTopt/dzF
A
40 40
dTopt/dzFB

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

5.3.7 The "Exact local method" with single measurement as con-


trolled variable

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.

Table 5.3.3: Magnitude of expected disturbance and noise

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

When a single controlled variable is to be selected, the matrix, M, in the defini-


tions of worst case as well as average loss (equation 2.4.5 and 2.4.6), would be
reduced to a vector. For a vector, the maximum singular value and the Frobenius
norm have the same value. Thus, the worst case loss and the average loss would
be the same.

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.

−3 Loss controlling a tray temperature from column 1


x 10
3

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".

The optimal tray temperature to control in column 1 or column 2, based on the


"exact local method", are presented in table 5.3.4.

Table 5.3.4: Optimally controlled tray when calculating average- and worst case loss

Optimal loss Controlled tray Average-/worst case loss [$/s]


Tray from column 1 13 1.17 · 10−3
Tray from column 2, 29 9.35 · 10−4

50
5.3. Case 1: Selection of controlled variables in constraint region VI 51

−3 Loss controlling a tray temperature from column 2


x 10
3
Combination of all disturbances
Disturbance in feed flow
2.5 Disturbance in zFA on the expense of zFB
Disturbance in zFB on the expense of zFC

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".

5.3.8 Combinations of tray temperature measurements

In many cases combinations of measurements to control a variable might lead to


smaller loss than using a single measurement. The "branch and bound" algorithm
from Kariwala and Cao [10], was used to find the optimal combination of tray
temperatures selected from either of the two columns separately. The algorithm
calculates the optimal subset of measurements based on either the worst case or
the average loss criteria. As only a single controlled variable is to be found, the
worst case and the average loss would be the same (see section 5.3.7). Figure
5.3.14 shows the lowest possible loss when controlling a specified number of
tray temperatures. The corresponding optimal tray and the respective value of

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.

−3 Controlling combinations of temperatures


x 10
1.2
Temperatures from column 1 only
Temperatures from column 2 only
1

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.

5.3.9 Discussion measurement combinations

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

ny Optimal trays to control Worst case-/


average loss
[10−3 $/s]
1 13 1.1775
2 12 13 0.7817
3 10 11 31 0.5964
4 10 11 12 32 0.5059
5 9 10 11 12 31 0.4577
6 8 9 10 11 31 32 0.4155
7 8 9 10 11 31 32 33 0.3894
8 7 8 9 10 11 31 32 33 0.3660
9 6 7 8 9 10 11 31 32 33 0.3498
10 6 7 8 9 10 11 31 32 33 34 0.3343

Table 5.3.6: Optimal tray combinations selected from column 2, based on exact local
method

ny Optimal trays to control Worst case-/


average loss
[10−3 $/s]
1 29 0.0938
2 29 30 0.0624
3 29 30 31 0.0515
4 29 30 31 32 0.0461
5 29 30 31 32 33 0.0432
6 28 29 30 31 32 33 0.0408
7 28 29 30 31 32 33 34 0.0394
8 10 28 29 30 31 32 33 34 0.0385
9 11 21 28 29 30 31 32 33 34 0.0372
10 10 11 21 28 29 30 31 32 33 34 0.0362

5.3.10 Direct evaluations of loss for combinations of tray tempera-


tures

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

ny F = 1.41 F = 1.39 zF = zF = zF = zF = Average


0.39] 0.41] 0.40] 0.40] [10−3 $/s]
0.21, 0.19, 0.19, 0.21,
0.40] 0.40] 0.41] 0.39]
1 0.0435 0.0323 0.2770 0.1568 0.1520 0.1338 0.1326
2 0.0419 0.0312 0.2210 0.1282 0.1899 0.1600 0.1287
3 0.0813 0.0564 0.1926 0.1156 0.0308 0.0246 0.0836
4 0.0743 0.0521 0.1907 0.1146 0.0466 0.0384 0.0861
5 0.0748 0.0525 0.1683 0.1011 0.0596 0.0486 0.0842
6 0.0928 0.0634 0.1371 0.0831 0.0377 0.0277 0.0736
7 0.0882 0.0606 0.1397 0.0852 0.0440 0.0330 0.0751
8 0.1029 0.0693 0.1154 0.0700 0.0341 0.0234 0.0692
9 0.1086 0.0727 0.0976 0.0586 0.0382 0.0256 0.0669
10 0.1128 0.0751 0.0951 0.0573 0.0323 0.0207 0.0655

Table 5.3.8: Table of loss when controlling the optimal combination of tray tempera-
tures from from table 5.3.6

ny F = 1.41 F = 1.39 zF = zF = zF = zF = Average


0.39] 0.41] 0.40] 0.40] [10−3 $/s]
0.21, 0.19, 0.19, 0.21,
0.40] 0.40] 0.41] 0.39]
1 0.0002 0.0001 0.0194 0.0100 0.2824 0.3405 0.1088
2 0.0002 0.0002 0.0328 0.0182 0.2475 0.2977 0.0994
3 0.0003 0.0002 0.0473 0.0273 0.2192 0.2629 0.0929
4 0.0003 0.0003 0.0611 0.0361 0.1973 0.2361 0.0885
5 0.0004 0.0003 0.0730 0.0437 0.1812 0.2163 0.0858
6 0.0003 0.0003 0.0560 0.0326 0.2055 0.2456 0.0900
7 0.0004 0.0003 0.0645 0.0380 0.1930 0.2301 0.0877
8 0.0000 0.0000 0.0413 0.0248 0.2001 0.2377 0.0840
9 0.0000 0.0000 0.0557 0.0357 0.1623 0.1920 0.0743
10 0.0000 0.0000 0.0422 0.0282 0.1584 0.1866 0.0692

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

5.4 Case 2: Selection of controlled variables in constraint


region I

In active constraint region I, only the concentration constraint of the valuable


product is active. Thus, there are 3 degrees of freedom that must be controlled.
The input gain, the disturbance gain and the optimal sensitivity, F,were all de-
termined for the nominal point when feed were set to 1.35 mol/s and the steam
price were 0.03 $/mol. The gain is shown in figure 5.4.1 and the sensitivity
in figure 5.4.2. Reflux to column 1, L1 , and the two boil-ups, V1 and V2 , were
chosen as manipulated variables.

5.4.1 Optimal control using single temperature measurements

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

Optimal temperature control Column 1 Column 2 Loss


Average loss 32 12, 30 1.10 · 10−3
Worst case loss 33 8, 27 2.77 · 10−4

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)

5.4.2 Discussion optimal control in constraint region I

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

Optimal sensitivety F, column 1 Optimal sensitivety F, column 2


60 40
dTopt/dFeed dTopt/dFeed
opt 30 opt
40 dT /dzFA dT /dzFA

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).

6.1 Systematic procedure

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

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.

6.3 Case studies

Constraint region VI was studied in detail to find good self-optimizing variables


to control the remaining degrees of freedom. The two main approaches were
the "direct evaluation of loss" and the "exact local method". The system was in
some cases also studied over a selected segment in the disturbance space ("global
direct evaluation"). All approaches indicate that the best alternative would be to
control a single tray temperature in the top part of the second column. This would
keep the system close to optimum and the loss would be insignificant. From
figure 5.3.10 and figure 5.3.11 it can be seen that optimal sensitivity is small
while the the steady state gain is large. This is in accordance with Skogestad [1],
stating that the optimal sensitivity should be small and that the gain from the
manipulated to the controlled variables should be large.

In section VI, only reflux, L1 , and distillate flow, D2 , in the first column, are

61
62 6.3. Case studies

in practice the only variables amenable to manipulation. The substantial physi-


cal distance between the manipulated variables and the location of the possible
controlled variable would make the response slow and control difficult. Thus, if
a tray in the top of the second column should be used a direct coupling would
make the control slow and hard to use in practice. However, this problem could
be overcome using a cascade. Figure 6.3.1 show a outline of how this could be
implemented.

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

would be when the flow D2 is at its maximum value. D2 would be at maximum


when the ratio between component A and C in top of the second column are
constant. This ratio is highly dependent on the temperature in the top part of the
second column as well as on the concentration of A leaving the first column. This
wold would explain way these two variables were found to be good controlled
variables.

6.3.1 Use of combination measurements

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.

A systematic procedure to find the optimal control structure is outlined in the


thesis. The procedure is designed to illustrate the main steps needed to develop
a automated computer program for this part to column optimization.

7.1 Suggestions for future work

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.

In an active constraint region it is optimal to control the active constraints. To


achieve this, the control structure needs to be changed when moving into another
region. Further study should be conducted to develop methods for detecting
when the system has made such change.

66
7.1. Suggestions for future work 67

It is desirable to have as simple control structure as possible. It might be possible


to find a control structure that give acceptable loss over several disturbance re-
gions. This could be studied using any of the methods to calculate loss addressed
in this thesis.

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.

[2] Larsson T, Skogestad S. Plantwide control - a review and a new design


procedure. Modeling, Identification and Control. 2000;21(4):209–240.

[3] Jacobsen MG. Active constraint regions for optimal operation of chemical
processes [dissertation]. NTNU. Trondheim; 2011.

[4] Halvorsen IJ. Minimum energy requirements in complex distillation ar-


rangements [dissertation]. NTNU. Trondheim; 2010.

[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.

[7] Yelchuru R, Skogestad S. Convex formulations for optimal selection of


controlled variables and measurements using Mixed Integer Quadratic Pro-
gramming. Journal of Process Control. 2012;22(6):995–1007.

[8] Alstad V, Skogestad S, Hori ES. Optimal measurement combinations as


controlled variables. Journal of Process Control. 2009;19(1):138–148.

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.

[12] Downs JJ, Skogestad S. An industrial and academic perspective on


plantwide control. Annual Reviews in Control. 2011;35(1):99–110.

[13] Skogestad S, Morari M. Understanding the dynamic behavior of dis-


tillation columns. Industrial and Engineering Chemistry Research®.
1988;27(10):1848–1862.

[14] Abramowitz, Stegun. Handbook of mathematical functions. 1st ed. New


York (USA): National Bureau of Standards - U.S. Government Printing
Office.; 1972. p.884.

[15] Skogestad S. Distillation column A [homepage on the Internet]; [cited 2013


Des 26]. Available from: http://www.nt.ntnu.no/users/skoge/
book/matlab_m/cola/cola.html.

70
Appendices

71
Appendix A

Linearizion of the model using fi-


nite differences

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

Validation of the linearizion

B.1 Optimal sensitivity

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

Optimal sensitivety F, column 1 Optimal sensitivety F, column 2


60 60
dTopt/dFeed
dTopt/dzFA
40 40
dTopt/dzFB

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

Optimal sensitivety F, column 1 Optimal sensitivety F, column 2


60 40
dTopt/dFeed dTopt/dFeed
30
40 dTopt/dzFA dTopt/dzFA
20 dTopt/dzFB
dTopt/dzFB
20 10

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

B.2 Validating Juu and Jud in region I

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)
 

−4.0768 4.1746 0.1630

 
−256.9845 −4.0602
248.8970
Juubackwards = −256.9845 265.3887 4.1928  (B.2.2)
 

−4.0602 4.1928 0.1630

 
128.9938 332.2961 33.8723
Jud f orward = −131.9673 −339.4311 −34.8896 (B.2.3)
 

−2.2638 −4.8811 −0.7721

 
128.0086 328.2654 33.6873
Judbackwards = −132.3138 −338.8721 −35.0375 (B.2.4)
 

−2.2594 −4.8522 −0.7717

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

Table C.0.1: Overview of the scripts used in the thesis

Script name Description

Active constraint region map


constraintplot.m Finds the active constraint region maps
binary.m Marks the active set as a binary number
Direct evaluation
brute_force.m Direct evaluation of loss
global_direct_evaluation.m Global direct evaluation of loss
Exact local method
Run_exact_local_metod.m Uses the "exact local method" to find the optimal
combination of measurements
exact_local_method.m Calculates the matrix H based on the
analytical expression of the "exact local
method".
Model
multiCP_ColumnA_ext.m Steady state model of column A
Temp.m Approximates temperature based on composition
nonlcon.m Nonlinear constraints in the system
init_nominal.m Initial condition to the model and optimization
Gain and optimal sensitivity
linerize.m Calculates Gy , Gyd , Juu and Jud
Fmat.m Calculates the optimal sensitivity by direct pertur-
bation

C.1 Search for the active constraint region active con-


straint 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

28 % Calculating optimal point


29 par.flag=0; % No control
30 par.actset=[]; % No active constraints
31

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

46 % Resolution on x and y axis


47 n_x=20; % Resolution on the x axsis
48 n_y=20; % Resolution on the y axsis
49

50 % Choose disturbance space


51 x_grid=linspace(1.35,1.495,n_x);% Grid disturbance on x axis
52 y_grid=linspace(0.01,0.19,n_y); % Grid disturbance on y axis
53

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

63 exitflag=1; % Convergence flag


64 k=0; % Count progression
65 time=0; % Monitor time
66

67 for i=1:n_x % Loop x axis


68 par.F=x_grid(i); % Variable x axis
69

70 for j=1:n_y % Loop Y axis


71 tic % start time

84
C.1. Search for the active constraint region active constraint region 85

72 k=k+1; % point number


73

74 price.steam=y_grid(j); % Variable X axis


75

76 %run fmincon
77 [x,fval,exitflag]=fmincon(@(x)costfunction(...
78 x,price,par),x0,[],[],[],[],lb,ub,...
79 @(X)nonlcon(X,par),options);
80

81 % Constraint valus at optimum


82 c=[x(par.NV+2),x(2*par.NV+6),x(par.NT),...
83 x(par.NV+4+2*par.NT),x(par.NV+4+2*par.NT+1)];
84

85 if exitflag == 1 % Warm start


86 x0=x;
87 end
88

89 bin= binary(c,c_s,tol); % Marke active set as bin num


90

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

97 %save date for other functions


98 x_mat(k,:)=x';
99 fval_mat(k,:)=fval;
100 points(i,j,:)=[x;fval;x_grid(i);y_grid(j);exitflag];
101

102 end
103 end
104

105 % save data for other funtions


106 data.n_x=n_x;
107 data.n_y=n_y;
108 data.val=val;

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

112 time; % Total time


113

114 % Plot contourplot


115 figure(1)
116 hold on
117

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

1 function [bin] = binary (c,c_s,tol)


2 %% binary.m
3 % Summary: Compare the state of the system with the
4 % constraints c_s and mark the active set a
5 % binary number.
6 % author: Tor Anders Marvik
7 % organization: Department of Chemical Engineering, NTNU,
8 % contact: [email protected]
9 % Input c : constrait variable at optimal poit
10 % c_s : constraint values
11 % tol : Toleranse, active constr. if c−c_s <tol
12 % Output bin : Binary number that marks the active set

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

C.2 Self optimizing variables

C.2.1 Direct evaluation

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

15 init_nominal % initial values for the optimization


16 load('xopt_F14_pV001')
17 % −−−−−−−−−−−−−−−− Optimize in nominal point −−−−−−−−−−−−−−−−−
18 par.actset=[]; % No active constraints
19 par.flag=0; % No control
20 [x_opt,fval_opt,exitflag]=fmincon(@(x) ...
21 costfunction(x,price,par),x0,[],[],[],[],...
22 lb,ub,@(X)nonlcon(X,par),options);
23 [Toptcol1,Toptcol2] = Temp(x_opt,par);
24 T_opt=[Toptcol1;Toptcol2];
25 x0=x_opt;
26

27 % −−−−−−−−−−−−− Initial loss vectors −−−−−−−−−−−−−−−−−−−−−−−−


28 Loss_T=zeros(1,41); % Loss vektor, temp from col1 const.
29 Loss_T_col2=zeros(1,41);% Loss vektor, temp from col2 const.
30 Loss_x=zeros(1,4); % Loss vektor, a variable in x const.
31 Loss_F=zeros(1,2); % Loss vektor when a ratio with F const.
32 Loss_comb=zeros(1,1); % Loss when L1/D1 constant
33

34 %−−−−−−−−−−−−−−− Insert the disturbance−−−−−−−−−−−−−−−−−−−−−−−


35 k=1; % For global direct evaluation
36 par.F=1.4;
37 par.zF=[0.4 0.2 4]';
38 par.qF=1.0;
39 price.pD1=1.0;
40

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

50 % −−−−−−−−− Calculation the loss −−−−−−−−−−−−−−−−−−−−−−−−−−−−


51 % Flag = 1: x() controlled

88
C.2. Self optimizing variables 89

52 % Flag = 2: A temperature in column 1 controlled


53 % Flag = 3 x1()/x2() controlled
54 % Flag = 4 x()/F() controlled
55

56 par.flag=1; %Keeping variable in x constant


57 par.actset=[]; % No active constraints
58

59 index_x=[ par.NV+1;... % L1 % coordinate in x for CV used


60 par.NV+3;... % D1
61 1;... % xb_A
62 41]; % xd_A
63

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

76 par.flag=2; % Keeping variable in T constant


77 par.actset=[]; % No active constraints
78

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

92 par.flag=3; % Keeping variable in T constant


93 par.actset=[]; % No active constraints
94 index_comb=[ par.NV+1,par.NV+3 ]; % [L1 D1]
95

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

108 par.flag=4; %Keeping variable in T constant


109 par.actset=[]; % no active constraints
110 index_F= [par.NV+3;... % D1/F
111 par.NV+1]; % L1/F
112

113 for i=1:length(index_F)


114 par.index_u=index_F(i);
115 par.dof=x_opt(par.index_u)/par.F; % s.p. for the CV
116 [x,fval,exitflag]=fmincon(@(x)costfunction(x,price,par),...
117 x0,[],[],[],[],lb,ub,@(X)nonlcon(X,par),options);
118 if exitflag<0 % no solutions found, infeasible?
119 Loss_F(k,i)=inf
120 else
121 Loss_F(k,i)=fval−fval_reopt(k,:) % The loss
122 end
123 end
124

125 % Temperature column 2

90
C.2. Self optimizing variables 91

126 par.flag=2; % Keeping variable in T constant


127 par.actset=[]; % No active constraints
128

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

143 % Selected loss velues [Loss*1000]


144 Loss_selction=[Loss_x(1,:)';Loss_T([1,10,20,30,41])';...
145 Loss_F';Loss_comb';Loss_T_col2([1,10,20,30,41])']*1000
146

147 %Reoptimised cv values


148 CV_opt=[x_reopt(index_x);Treoptcol1([1,10,20,30,41]);...
149 x_reopt(par.NV+3)/par.F;x_reopt(par.NV+1)/par.F;...
150 x_reopt(par.NV+1)/x_reopt(par.NV+3);...
151 Treoptcol2([1,10,20,30,41])]

C.2.2 Global direct evaluation of loss

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

4 % disturbance from nominal


5 % author: Tor Anders Marvik
6 % organization: Department of Chemical Engineering, NTNU, Norway
7 % contact: [email protected]
8

9 clc
10 clear all
11

12 init_nominal % initial values


13

14 %Nominal point
15 par.F=1.4;
16 price.steam=0.01;
17

18 %calculating nominal optimum


19 par.flag=0; % No control
20 par.actset=[]; % No active constraints
21

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

28 zF=[]; % Initiate compostition vector


29 F=[]; % Initiate feed vektor
30

31

32 par.flag=2; %0= no cont., 1 = cont. varaible in x, 2 = cont. T


33 par.actset=[1;2;4]; % Index of active constraints
34 par.index_u=41+41; % Index controlled varaible
35 par.dof=T_opt(par.index_u);
36

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

72 %reset initial conditoins


73 par.dof=T_opt(par.index_u);
74 exitflag=1;
75 par.F=1.4;
76 par.zF=[0.4,0.2,0.4]';
77 price.steam=0.01;

93
94 C.2. Self optimizing variables

78

79 while par.F<1.5 && exitflag>=0


80 par.F=par.F+0.001; % disturbance step
81

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

104 F=F(2:end−1); %first and last element is infeasible


105 zF=zF(:,2:end−1); %first and last element is infeasible
106 x=x(:,2:end−1); %first and last element is infeasible
107 fval=fval(2:end−1);
108 x_reopt=x_reopt(:,2:end−1);
109 fval_reopt=fval_reopt(2:end−1);
110 steam=steam(2:end−1);
111 Loss=fval−fval_reopt;
112

113

114 %save()

94
C.2. Self optimizing variables 95

C.2.3 The "exact local method"

Run_exact_local_metod.m

2 % Summary: Linerize the model and find the optimal


3 % control variables base on exact local methode.
4 % author: Tor Anders Marvik
5 % organization: Department of Chemical Engineering, NTNU,
6 % contact: [email protected]
7

8 init_nominal; % Initialize nominal conditoions


9

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

18 du=[0.00001]; % Pertubation step in manipulated variables


19 dd=[0.00001]; % Pertubation step in disturbances
20

21 % Linerize model
22 [G1,Gd,Juu,Jud,exitflag]=linerize(...
23 index_u,actset,du,dd,Feed,steam);
24

25 % Measurement and implementation error


26 Wd=diag([0.01,;0.01;0.01]);% Magnitude of expected disturbance
27 Wn=diag(ones(82,1)*0.5); % Meassurement error ny*ny
28

29 % Run a version of the brance and bound:


30 % − Single meassurements: b3av or b3wc
31 % − Combinations of meassurements: pb3av or pb3av

95
96 C.2. Self optimizing variables

32

33 % Running b3av and b3wc


34 G_comb=[G1.dTcol1du;G1.dTcol2du]; % Process model
35 Gd1=[Gd.dTcol1dd;Gd.dTcol2dd]; % Disturbance model
36

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

49 % Use exact local methode directly −−−−−−−−−−−−−−−−−−−−


50

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

11 % started Oktober 2012


12

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

17 %select a subset of G1,Gd,Juu,Jud


18 G1_ss=G_comb(sset(1,:),:);
19 Gd_ss=Gd1(sset(1,:),:);
20 Wd_ss=Wd; % Magnitude disturbance
21 Wn_ss=Wn(sset(1,:),sset(1,:)); % Weighting of the noise
22

23 ny=length(sset); % Number of meassurements


24 nd=3; % Number of disturbances
25 F_ss=−G1_ss*(Juu)^−1*Jud+Gd_ss;
26 Y=[F_ss*Wd_ss' Wn_ss];
27

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

35 %worst case loss alternative


36 G=G1_ss*inv(sqrtm(Juu));
37 Y2=Y*Y';
38 X=chol(Y2)'\G;
39 lambda=eig(X'*X);
40 Loss_wc2=0.5./min(lambda);
41

42 %average loss alternative, uniform distribution


43 G=G1_ss*inv(sqrtm(Juu));
44 Y2=Y*Y';
45 X=chol(Y2)'\G;
46 lambda=eig(X'*X);
47 loss_wc_cao=0.5./min(lambda);

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

C.3 The model

The model is a steady state version of column A [15], handling multiple compo-
nents.

The script multiCP_ColumnA_ext.m is a model of a single column. The model


is implemented in the optimization problem as nonlinear equality constraints in
the script nonlcon.m. The tray temperatures are given by the function Temp.m
and the initial condition is provided by init_nominal.m

C.3.1 Steady state model of column A

multiCP_ColumnA_ext.m

1 function [ residue] = multiCP_ColumnA_ext( X,par )


2 %
3 % This is a nonlinear steady state model of a
4 % multicomponent distillation column with
5 % NT−1 theoretical stages including a reboiler
6 % (stage 1) plus a total condenser ("stage" NT).
7 %
8 % Model assumptions:

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

41 % Inputs and disturbances


42 LT = par.LT; % Reflux
43 VB = par.VB; % Boilup
44 D = par.D; % Distillate
45 B = par.B; % Bottoms

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

51 NT = par.NT; % Number of stages


52 NF = par.NF; % Location of feed stage
53 alpha = par.alpha; % Relative volatility
54 NC = par.NC; % Number of components
55

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

83 dMxdt(j,i)= (LT)*x(j+1,i) − LT*x(j,i) + (VB+(1−qF)*F)*y(j−1,i)...


84 −(VB+(1−qF)*F)*y(j,i);
85 % Total condenser (no equilibrium stage)
86 dMxdt(NT,i)= (VB+(1−qF)*F)*y(NT−1,i) − LT*x(NT,i) − D*x(NT,i);
87 %===============================================
88 % Mass balances
89 %===============================================
90 % Reboiler
91 dMdt(1) = LT+qF*F − VB − B;
92 % Condenser
93 dMdt(2) = VB+(1−qF)*F − LT − D;
94 % ==============================================
95 % Summation Balances
96 % ==============================================
97 Xs=reshape(X,NT,NC);
98 sumXs=1−Xs*ones(NC,1);
99 %
100 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
101 %
102 %
103 % Output
104 residue=[dMxdt(:); dMdt; sumXs(:)];

C.3.2 Temperature estimator

1 function [Tcol1,Tcol2] = Temp(x,par)


2 %% Temp.m
3 % Summary:
4 % Tray temperature estimator for column 1 and column 2
5 % The temperature is based on a linear relation between the
6 % boiling points of the pure components.
7 %
8 % Boiling point assumtions
9 % Tb_A=30 *C

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

24 % Tray compositoin matrices


25 xcol1=[x(1:par.NT),...
26 x(par.NT+1:2*par.NT),...
27 x(2*par.NT+1:3*par.NT)];
28 xcol2=[x(par.NV+5:par.NV+4+par.NT),...
29 x(par.NV+5+par.NT:par.NV+4+2*par.NT),...
30 x(par.NV+5+2*par.NT:par.NV+4+3*par.NT)];
31

32 Tcol1=T(xcol1); % Tray temperatures column 1


33 Tcol2=T(xcol2); % Tray temperatures column 2
34

35

36 end

C.3.3 The nonlinear constraints

1 function [ c, ceq ] = nonlcon( x, par )


2

3 c=[]; %inequality constraints


4

102
C.3. The model 103

5 par1=par; %reseting struct parameters for col1


6 par2=par; %reseting struct parameters for col1
7

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

40 dof=par.dof; % Setpoint contr. var.


41

103
104 C.3. The model

42 %value in x vektor controlled


43 if par.flag==1
44 res_dof=x(par.index_u)−dof;
45 ceq=[ceq_col1;ceq_col2;active;res_dof];
46 end
47

48 %Tray temp controlled controlled


49 if par.flag==2
50 [Tcol1,Tcol2] = Temp(x,par);
51 T=[Tcol1;Tcol2];
52 res_dof=T(par.index_u)−dof;
53 ceq=[ceq_col1;ceq_col2;active;res_dof];
54 end
55

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

C.3.4 Initial condition for a nominal point

1 % Initial conditions for the optimization problem


2 % defalt nominal point is F=1.4 and steam 0.01
3

4 %This script contains inital values


5

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

15 %Prices for the cost funciton


16 price.pF1=1; % Feed price col. 1
17 price.pD1=1; % Top product price col. 1
18 price.pD2=2; % Top product price col. 2
19 price.pB2=1; % Btm product price col. 2
20 price.steam=0.01; % vapour cost
21

22 %Number of decision variables


23 par.NV=par.NT*par.NC; % Number cons. decition var
24

25 %Define the constraint limits


26 V1max=4.008; % Max vapour flow col1
27 V2max=2.405; % Max vapour flow col2
28 Xd1Amin=0.95; % Min comp A top col1
29 Xd2Bmin=0.95; % Min comp B top col2
30 Xb2Cmin=0.95; % Max vapour flow col2
31

32

33 c_s=[V1max V2max Xd1Amin Xd2Bmin Xb2Cmin]; %constraints


34

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

54 %Define the lower and upper bounds


55 lb_col1=zeros((par.NV+4),1);
56 ub_col1=[ones(par.NV,1); [20 20 20 20]'];
57 lb_col2=zeros((par.NV+4),1);
58 ub_col2=[ones(par.NV,1); [20 20 20 20]'];
59

60

61 %Define constraints through lower and upper bounds


62 lb_col1(par.NT)=Xd1Amin; % Min comp A top col1
63 lb_col2(2*par.NT)=Xd2Bmin; % Min comp B top col2
64 lb_col2(2*par.NT+1)=Xb2Cmin; % Min comp C btm col2
65 ub_col1(par.NV+2)=V1max; % Max vapour flow col1
66 ub_col2(par.NV+2)=V2max; % Max vapour flow col2
67

68 lb=[lb_col1;lb_col2 ]; % Lower bounds


69 ub=[ub_col1;ub_col2 ]; % Upper bounds
70

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

78 T=@(x)100−x(:,2)*(100−70)−x(:,1)*(100−30); % Temp. estimator

107

You might also like