Upload
others
View
5
Download
1
Embed Size (px)
Citation preview
Optimization of Differential-Algebraic Equation Systems
L. T. BieglerChemical Engineering Department
Carnegie Mellon UniversityPittsburgh, PA
2
I IntroductionProcess Examples
II ParametricOptimization- Gradient Methods
• Perturbation• Direct - Sensitivity Equations• Adjoint Equations
III Optimal ControlProblems- Optimality Conditions- Model Algorithms
• Sequential Methods• Multiple Shooting• Indirect Methods
IV SimultaneousSolutionStrategies- Formulation and Properties- Process Case Studies- Software Demonstration
DAE Optimization Outline
3
tf, final timeu, control variablesp, time independent parameters
t, timez, differential variablesy, algebraic variables
Dynamic Optimization Dynamic Optimization ProblemProblem
( )ftp,u(t),y(t),z(t), min Φ
( )pttutytzfdt
tdz,),(),(),(
)( =
( ) 0,),(),(),( =pttutytzg
ul
ul
ul
ul
o
ppp
utuu
ytyy
ztzz
zz
dd
dd
dd
dd
)(
)(
)(
)0(
s.t.
4
DAE Models in Process Engineering
Differential Equations•Conservation Laws (Mass, Energy, Momentum)
Algebraic Equations•Constitutive Equations, Equilibrium (physical properties, hydraulics, rate laws)•Semi-explicit form•Assume to be index one (i.e., algebraic variables can be solved uniquely by algebraic equations)•If not, DAE can be reformulated to index one (see Ascher and Petzold)
Characteristics•Large-scale models – not easily scaled•Sparse but no regular structure•Direct linear solvers widely used•Coarse-grained decomposition of linear algebra
5
Catalytic Cracking of Gasoil (Tjoa, 1991)
number of states and ODEs: 2number of parameters:3no control profilesconstraints: pL � p � pU
Objective Function: Ordinary Least Squares
(p1, p2, p3)0 = (6, 4, 1)(p1, p2, p3)* = (11.95, 7.99, 2.02)(p1, p2, p3)true = (12, 8, 2)
1.00.80.60.40.20.0
0.0
0.2
0.4
0.6
0.8
1.0
YA_data
YQ_data
YA_estimate
YQ_estimate
t
Yi
Parameter Estimation
0)0( ,1)0(
)(
, ,
22
1
231
321
==−−=
+−=→→→
qa
qpapq
appa
SASQQA ppp
�
�
6
Batch Distillation Multi-product Operating Policies
5XQ�EHWZHHQ�GLVWLOODWLRQ�EDWFKHV7UHDW�DV�ERXQGDU\�YDOXH�RSWLPL]DWLRQ�SUREOHP
:KHQ�WR�VZLWFK�IURP�$�WR�RIIFXW WR�%"+RZ�PXFK�RIIFXW WR�UHF\FOH"5HIOX["%RLOXS 5DWH"2SHUDWLQJ�7LPH"
$ %
7
Nonlinear Model Predictive Control (NMPC)
Process
NMPC Controller
d : disturbancesz : differential statesy : algebraic states
u : manipulatedvariables
ysp : set points
( )( )dpuyzG
dpuyzFz
,,,,0
,,,,
==′
NMPC Estimation and Control
sConstraintOther
sConstraint Bound
)()),(),(),((0
)),(),(),(()(..
||))||||)(||min
init
1sp
ztztttytzG
tttytzFtzts
yty uy Q
kk
Q
==
=′
−+−∑ ∑ −
u
u
u(tu(tu
NMPC Subproblem
Why NMPC?
� Track a profile
� Severe nonlinear dynamics (e.g, sign changes in gains)
� Operate process over wide range (e.g., startup and shutdown)
Model Updater( )( )dpuyzG
dpuyzFz
,,,,0
,,,,
==′
8
Optimization of dynamic batch process operation resulting from reactor and distillation column
DAE models:z’ = f(z, y, u, p)g(z, y, u, p) = 0
number of states and DAEs: nz + nyparameters for equipment design (reactor, column)nu control profiles for optimal operation
Constraints: uL � u(t) � uU zL � z(t) � zU
yL � y(t) � yU pL � p � pU
Objective Function: amortized economic function at end of cycle time tf
zi,I0 zi,II
0zi,III0 zi,IV
0
zi,IVf
zi,If zi,II
f zi,IIIf
Bi
A+B→C
C+B→P+E
P+C→G
5
10
15
20
25
580
590
600
610
620
630
640
0 0.5 1 1.5 2 2.50 0.25 0.5 0.75 1 1.25Tim e (h r.)
Dyn a mic
C o nsta nt
Dyn a mic
C o nsta nt
optimal reactor temperature policy optimal column reflux ratio
Batch Process Optimization
9
FexitC H2 4
Texit ≤ 1180K
C2H CH
6 32→ • CH CH CH CH
3 2 6 4 2 5•+ → + •
C2H CH H
5 2 4•→ + •H CH H CH•+ → + •
2 6 2 2 52C
2H CH
5 4 10•→C
2H CH CH CH
5 2 4 3 6 3•+ → + •
H CH CH•+ → •2 4 2 5
0
1
2
3
4
5
6
0 2 4 6 8 10
Length m
Flo
w r
ate
mol
/s
0
500
1000
1500
2000
2500
Hea
t flu
x kJ
/m2s
C2H4 C2H6 log(H2)+12 q
Reactor Design ExamplePlug Flow Reactor Optimization
The cracking furnace is an important example in the olefin production industry, where various hydrocarbon feedstocks react. Consider a simplified model for ethane cracking (Chen et al., 1996). The objective is to find an optimal profile for the heat flux along the reactor in order to maximize the production of ethylene.
Max s.t. DAE
The reaction system includes six molecules, three free radicals, and seven reactions. The model also includes the heat balance and the pressure drop equation. This gives a total of eleven differential equations.
Concentration and Heat Addition Profile
10
Dynamic Optimization Approaches
DAE Optimization Problem
Sequential Approach
Vassiliadis(1994)Discretize controls
Variational Approach
Pontryagin(1962)
Inefficient for constrained problems
Apply a NLP solver
Efficient for constrained problems
11
Sequential Approaches - Parameter Optimization
Consider a simpler problem without control profiles:
e.g., equipment design with DAE models - reactors, absorbers, heat exchangers
Min Φ (z(tf))
z’ = f(z, p), z (0) = z0
g(z(tf)) � 0, h(z(tf)) = 0
By treating the ODE model as a "black-box" a sequential algorithm can be constructed that can be treated as a nonlinear program.
Task: How are gradients calculated for optimizer?
NLPSolver
ODEModel
GradientCalculation
P
φ,g,h
z (t)
12
Gradient Calculation
Perturbation
Sensitivity Equations
Adjoint Equations
Perturbation
Calculate approximate gradient by solving ODE model (np + 1) times
Let ψ = Φ, g and h (at t = tf)
dψ/dpi = {ψ (pi + ̈ pi) - ψ (pi)}/ ¨pi
Very simple to set up
Leads to poor performance of optimizer and poor detection of optimum unless roundoff error (O(1/¨pi) and truncation error (O(¨pi)) are small.
Work is proportional to np (expensive)
13
Direct Sensitivity
From ODE model:
(nz x np sensitivity equations)
• z and si , i = 1,…np, an be integrated forward simultaneously.
• for implicit ODE solvers, si(t) can be carried forward in time after converging on z
• linear sensitivity equations exploited in ODESSA, DASSAC, DASPK, DSL48s and a number of other DAE solvers
Sensitivity equations are efficient for problems with many more constraints than parameters (1 + ng + nh > np)
{ }
iii
T
iii
ii
p
zss
z
f
p
fs
dt
ds
ip
tzts
pzztpzfzp
∂∂=
∂∂+
∂∂==′
=∂
∂=
==′∂∂
)0()0( ,)(
...np 1, )(
)( define
)()0(),,,( 0
14
Example: Sensitivity Equations
0)0(,0
22
1)0(,0
22
2,1,/)()(,/)()(
)0(,5
2,1,
1,1,22,112,
2,21,11,
2,1,
1,1,22,12,
2,21,11,
,,
21
1212
22
211
==
+++=′
+=′
==
++=′
+=′
=∂∂=∂∂===
+=′+=′
bb
bbbbb
bbb
aa
baaaa
aaa
bjjbajja
a
b
ss
psszszzs
szszs
ss
psszszs
szszs
jptztsptzts
pzz
pzzzz
zzz
15
Adjoint Sensitivity
Adjoint or Dual approach to sensitivity
Adjoin model to objective function orconstraint
(ψ = Φ,g or h)
(λ(t)) serve as multipliers on ODE’s)
Now, integrate by parts
and find dψ/dp subject to feasibility of ODE’s
Now, set all terms notin dp to zero.
∫ −′−=ft
Tf dttpzfzt
0
)),,(()( λψψ
∫ +′+−+=ft
TTf
Tf
Tf dttpzFztztpzt
0
0 )),,()()()()0()( λλλλψψ
00
∫
∂∂+
∂∂+′+
∂
∂+
−
∂∂
=ft TTT
fff
f dtdpp
ftz
z
fdp
p
pztzt
tz
tzd
0
0 )()0()(
)()()(
))((λδλλλδλ
ψψ
16
Adjoint System
Integrate model equations forward
Integrate adjoint equations backward and evaluate integral and sensitivities.
Notes:
nz (ng + nh + 1) adjoint equations must be solved backward (one for each objective and constraint function)
for implicit ODE solvers, profiles (and even matrices) can be stored and carried backward after solving forward for z as in DASPK/Adjoint (Li and Petzold)
more efficient on problems where: np > 1 + ng + nh
∫
∂∂+
∂∂=
∂∂
=∂∂−=′
ft
f
ff
dttp
f
p
pz
dp
d
tz
tztt
z
f
0
0 )()0()(
)(
))(()( ),(
λλψ
ψλλλ
17
Example: Adjoint Equations
dttztdp
td
dp
td
tz
ttzz
tz
ttpzz
dttp
f
p
pz
dp
d
tz
tztt
z
f
pzzzzztpzf
pzz
pzzzz
zzz
f
f
t
b
f
a
f
f
ff
f
ffb
t
f
ff
bT
a
b
)()()(
)0()(
)(
)()( ,2
)(
)()( ),(2
:becomesthen
)()0()(
)(
))(()( ),(
)()(),,( Form
)0(,5
1
0
2
1
2212212
1122111
0
0
121222
211
21
1211
22
211
∫
∫
=
=
∂∂
=−−=′
∂∂
=+−−=′
∂∂+
∂∂=
∂∂
=∂∂−=′
+++=
==
+=′+=′
λψ
λψ
ψλλλλ
ψλλλλ
λλψ
ψλλλ
λλλ
18
A + 3B --> C + 3D
L
T s
T R
T P
3:1 B/A
383 K
TP = specified product temperatureTR = reactor inlet, reference temperatureL = reactor lengthTs = steam sink temperatureq(t) = reactor conversion profileT(t) = normalized reactor temperature profile
Cases considered:• Hot Spot - no state variable constraints• Hot Spot with T(t) � 1.45
Example: Hot Spot Reactor
Roo
P
Pproducto
Rfeed
RS
L
RSTLTT
C/T C, T(L) T
, T(L)) (THC) -,(T+
Tdt
dqTTtT
dt
dT
qtTtqdt
dqts
dtTTtTLMinSRP
101120
0110
1)0( ,3/2)/)((5.1
0)0( )],(/2020exp[))(1(3.0 ..
)/)(( 0
,,,
+==
=∆
=+−−=
=−−=
−−=Φ ∫
19
1.51.00.50.0
0.0
0.2
0.4
0.6
0.8
1.0
1.2
Normalized Length
Con
vers
ion,
q
1.51.00.50.0
1.0
1.1
1.2
1.3
1.4
1.5
1.6
Normalized Length
Nor
mal
ized
Tem
pera
ture
Method: SQP (perturbation derivatives)
L(norm) TR(K) TS(K) TP(K)Initial: 1.0 462.23 425.26 250Optimal: 1.25 500 470.1 188.413 SQP iterations / 2.67 CPU min. (µVax II)
Constrained Temperature Case: could not be solved with sequential method
Hot Spot Reactor: Unconstrained Case
20
Variable Final Time(Miele, 1980)
Define t = pn+1 τ, 0 ≤ τ ≤ 1, pn+1 = tf
Let dz/dt = (1/ pn+1) dz/dτ = f(z, p) ⇒ dz/dτ = (pn+1) f(z, p)
Converting Path Constraints to Final Time
Define measure of infeasibility as a new variable, znz+1(t) (Sargent & Sullivan, 1977):
Tricks to generalize classes of problems
)degenerate is constraint (however, )( Enforce
0)0( , ))(),((,0max()(
))(),((,0max()(
1
12
1
0
21
ε≤
==
=
+
++
+
∑
∑∫
fnz
nzj
jnz
j
t
jfnz
tz
ztutzgtzor
dttutzgtzf
�
21
Profile Optimization - (Optimal Control)
Optimal Feed Strategy (Schedule) in Batch Reactor
Optimal Startup and Shutdown Policy
Optimal Control of Transients and Upsets
Sequential Approach: Approximate control profile as through parameters (piecewise constant, linear, polynomial, etc.)
Apply NLP to discretization as with parametric optimization
Obtain gradients through adjoints (Hasdorff; Sargent and Sullivan; Goh and Teo) or sensitivity equations (Vassiliadis, Pantelides and Sargent; Gill, Petzold et al.)
Variational (Indirect) approach: Apply optimality conditions and solve as boundary value problem
22
Optimality Conditions(Bound constraints on u(t))
Min φ(z(tf))s.t. dz/dt = f(z, u), z (0) = z0
g (z(tf)) � 0h (z(tf)) = 0a � u(t) � b
Form Lagrange function - adjoin objective function and constraints:
Derivation of Variational Conditions Indirect Approach
dtbtutuauzfz
tztzvtzhtzgt
dtbtutuauzfz
vtzhtzgt
Tb
t Ta
TT
ffTTT
fT
ff
Tb
t Ta
T
Tf
Tff
f
f
))(())((),(
)()()0()0())(())(()(
:partsby Integrate
))(())(()),((
))(())(()(
0
0
−+−+++
−+++=
−+−+−−
++=
∫
∫
ααλλ
λλµφφ
ααλ
µφφ
�
�
23
λ ft( )=∂φ∂z
+∂g
∂zµ +
∂h
∂zγ
ft=t
∂f
∂uλ =
∂H
∂u= 0
∂ H
∂u= α a − α b
α aT (a − u(t))
α bT (u(t) − b)
ua ≤ u(t) ≤ ub
α a ≥ 0,α b ≥ 0
∂H
∂u= −α b ≤ 0
∂H
∂u= α a ≥ 0
At optimum, δφ ≥0. Since u is the control variable, let all other terms vanish.⇒ δ z(tf):
δz(0): λ(0) = 0 (if z(0) is not specified)δz(t):
Define Hamiltonian, H = λTf(z,u)For u notat bound:
For u atbounds:
Upper bound, u(t) = b, Lower bound, u(t) = a,
Derivation of Variational Conditions
λλz
f
z
H
∂∂−=
∂∂−=�
0 )(),(
)(),(
)0()0()(
0≥
−+
∂∂+
∂∂++
+
−
∂∂+
∂∂+
∂∂=
∫ dttuu
uzftz
z
uzf
ztzvz
h
z
g
z
ftT
ab
T
Tf
T
δααλδλλ
δλδλµφδφ
�
24
Car ProblemTravel a fixed distance (rest-to-rest) in minimum time.
0)(’,0)0(’
)(,0)0(
)(
" ..
==
==≤≤
=
f
f
f
txx
Ltxx
btua
uxts
tMin
0)(,0)0(
)(,0)0(
)(
1’
’
’ ..
22
11
3
2
21
3
==
==≤≤
===
f
f
f
txx
Ltxx
btua
x
ux
xxts
)(tMin x
s
f
f
f
f
f
tt
auctt
buctctttcc
u
H
tt
ttcct
ct
uxH
==
=>==>+=
−+==∂∂
====>=
−+===>−=
===>=
++=
at occurs )0(Crossover
,0,
,0,0)(
1)( ,1)(0
)()(
)(0 :Adjoints
:n Hamiltonia
2
2
21122
333
12212
111
3221
λ
λ
λλλ
λλλλλ
λλλ
�
�
�
25
t f
u(t)
b
a
t s
1 / 2 bt2,t < ts
1 / 2 bts2 - a ts - tf( )2( ), t ≥ ts
bt, t < ts
bts + a t - ts( ), t ≥ ts
2L
b 1- b / a( )
1/2
(1− b / a)2L
b 1 - b / a( )
1/2
Optimal Profile
From state equations:
x1(t) =
x2 (t) =
Apply boundary conditions at t = tf:x1(tf) = 1/2 (b ts
2 - a (ts - tf)2) = L
x2(tf) = bts + a (tf - ts) = 0⇒ ts =
tf =
•Problem is linear in u(t). Frequently these problems have "bang-bang" character.•For nonlinear and larger problems, the variational conditions can be solved numerically as boundary value problems.
Car ProblemAnalytic Variational Solution
26
A B
C
u
u /22
u(T(t))
Example: Batch reactor - temperature profile
Maximize yield of B after one hour’s operation by manipulating a transformed temperature, u(t).
⇒ Minimize -zB(1.0)s.t.
z’A = -(u+u2/2) zA
z’B = u zA
zA(0) = 1zB(0) = 00 � u(t) � 5
Adjoint Equations:H = -λA(u+u2/2) zA + λB u zA
∂H/∂u = λA (1+u) zA + λB zAλ’A = λA(u+u2/2) - λB u, λA(1.0) = 0λ’B = 0, λB(1.0) = -1
Cases Considered1. NLP Approach- piecewise constant and linear profiles.2. Control Vector Iteration
27
Batch Reactor Optimal Temperature Program Piecewise Constant
Op
tim
al P
rofile
, u
(t)
0. 0.2 0.4 0.6 0.8 1.0
2
4
6
Time, h
ResultsPiecewise Constant Approximation with Variable Time ElementsOptimum B/A: 0.57105
28
Op
tim
al P
rofile
, u
(t)
0. 0.2 0.4 0.6 0.8 1.0
2
4
6
Time, h
Results:Piecewise Linear Approximation with Variable Time ElementsOptimum B/A: 0.5726Equivalent # of ODE solutions: 32
Batch Reactor Optimal Temperature Program Piecewise Linear
29
Op
tim
al P
rofile
, u
(t)
0. 0.2 0.4 0.6 0.8 1.0
2
4
6
Time, h
Results:Control Vector Iteration with Conjugate GradientsOptimum (B/A): 0.5732Equivalent # of ODE solutions: 58
Batch Reactor Optimal Temperature Program
Indirect Approach
30
Dynamic Optimization - Sequential Strategies
Small NLP problem, O(np+nu) (large-scale NLP solver not required) • Use NPSOL, NLPQL, etc. • Second derivatives difficult to get
Repeated solution of DAE model and sensitivity/adjoint equations, scales with nz and np
• Dominant computational cost• May fail at intermediate points
Sequential optimization is not recommended for unstable systems. State variables blow up at intermediate iterations for control variables and parameters.
Discretize control profiles to parameters (at what level?)
Path constraints are difficult to handle exactly for NLP approach
31
Instabilities in DAE ModelsThis example cannot be solved with sequential methods (Bock, 1983):
dy1/dt = y2
dy2/dt = τ2 y1 + (π2 − τ2) sin (π t)
The characteristic solution to these equations is given by:
y1(t) = sin (π t) + c1 exp(-τ t) + c2 exp(τ t)
y2 (t) = πcos (π t) - c1 τ exp(-τ t) + c2 τ exp(τ t)
Both c1 and c2 can be set to zero by either of the following equivalent conditions:
IVP y1(0) = 0, y2 (0) = π
BVP y1(0) = 0, y1(1) = 0
32
IVP SolutionIf we now add roundoff errors e1 and e2 to the IVP and BVP conditions, we see significant differences in the sensitivities of the solutions.
For the IVP case, the sensitivity to the analytic solution profile is seen by large changes in the profiles y1(t) and y2(t) given by:
y1(t) = sin (π t) + (e1 - e2/τ) exp(-τ t)/2
+(e1 + e2/τ) exp(τ t)/2
y2 (t) = πcos (π t) - (τ e1 - e2) exp(-τ t)/2
+ (τ e1 + e2) exp(τ t)/2
Therefore, even if e1 and e2 are at the level of machine precision (< 10-13), a large value of τ and t will lead to unbounded solution profiles.
33
BVP Solution
On the other hand, for the boundary value problem, the errors affect the analytic solution profiles in the following way:
y1(t) = sin (π t) + [e1 exp(τ)- e2] exp(-τ t)/[exp(τ) - exp(-τ)]
+ [e1 exp(-τ) - e2] exp(τ t)/[exp(τ) - exp(-τ)]
y2(t) = πcos (π t) – τ [e1 exp(τ)- e2] exp(-τ t)/[exp(τ) - exp(-τ)]
+ τ [e1 exp(-τ) - e2] exp(τ t)/[exp(τ) - exp(-τ)]
Errors in these profiles never exceed t (e1 + e2), and as a result a solution to the BVP is readily obtained.
34
BVP and IVP Profiles
e1, e2 = 10-9
Linear BVP solves easily
IVP blows up before midpoint
35
Dynamic Optimization Dynamic Optimization ApproachesApproaches
DAE Optimization Problem
Multiple Shooting
Sequential Approach
Vassiliadis(1994)
Can not handle instabilities properlySmall NLP
Handles instabilities Larger NLP
Discretize some state variables
Discretize controls
Variational Approach
Pontryagin(1962)
Inefficient for constrained problems
Apply a NLP solver
Efficient for constrained problems
36
Multiple Shooting for Dynamic OptimizationDivide time domain into separate regions
Integrate DAEs state equations over each region
Evaluate sensitivities in each region as in sequential approach wrt uij, p and zj
Impose matching constraints in NLP for state variables over each region
Variables in NLP are due to control profiles as well as initial conditions in each region
37
Multiple ShootingNonlinear Programming Problem
uL
x
xxx
xc
xfn
≤≤
=
ℜ∈
0)(s.t
)(min
( ))(),( min,,
ffpu
tytzji
ψ
( ) z)z(tpuyzfdt
dzjjji ==
,,,, ,
( ) 0,ji, =pz,y,ug
ul
uiji
li
ukkjij
lk
ukkjij
lk
jjjij
ppp
uuu
ytpuzyy
ztpuzzz
ztpuzz
≤≤
≤≤
≤≤
≤≤
=− ++
,
,
,
11,
),,,(
),,,(
0),,,(s.t.
(0)0 zzo = Solved Implicitly
38
BVP Problem Decomposition
Consider: Jacobian of Constraint Matrix for NLP
• bound unstable modes with boundary conditions (dichotomy)
• can be done implicitly by determining stable pivot sequences in multiple shooting constraints approach
• well-conditioned problem implies dichotomy in BVP problem (deHoog and Mattheij)
Bock Problem (with t = 50)
• Sequential approach blows up (starting within 10-9 of optimum)
• Multiple Shooting optimization requires 4 SQP iterations
B1 A1
A2
A3
A4
AN
B2
B3
B4
BN
IC
FC
39
Dynamic Optimization – Multiple Shooting Strategies
Larger NLP problem O(np+nu+NE nz) • Use SNOPT, MINOS, etc.• Second derivatives difficult to get
Repeated solution of DAE model and sensitivity/adjoint equations, scales with nz and np
• Dominant computational cost• May fail at intermediate points
Multiple shooting can deal with unstable systems with sufficient time elements.
Discretize control profiles to parameters (at what level?)
Path constraints are difficult to handle exactly for NLP approach
Block elements for each element are dense!
Extensive developments and applications by Bock and coworkers using MUSCOD code
40
Dynamic Optimization Dynamic Optimization ApproachesApproaches
DAE Optimization Problem
Simultaneous Approach
Sequential Approach
Vassiliadis(1994)
Can not handle instabilities properlySmall NLP
Handles instabilities Large NLP
Discretize all state variables
Discretize controls
Variational Approach
Pontryagin(1962)
Inefficient for constrained problems
Apply a NLP solver
Efficient for constrained problems
41
Nonlinear DynamicOptimization Problem
Collocation onfinite Elements
Continuous variablesContinuous variables
Nonlinear ProgrammingProblem (NLP)
Discretized variablesDiscretized variables
Nonlinear Programming Formulation
42
Discretization of Differential Equations Orthogonal Collocation
Given:dz/dt = f(z, u, p), z(0)=given
Approximate z and u by Lagrange interpolation polynomials (order K+1 and K, respectively) with interpolation points, tk
kkNjk
jK
kjj
k
K
kkkK
kkNjk
jK
kjj
k
K
kkkK
ututt
ttttutu
ztztt
ttttztz
===>−−
∏==
===>−−
∏==
≠==
+
≠==
+
∑
∑
)()(
)()(,)()(
)()(
)()(,)()(
11
100
1
""
""
Substitute zN+1 and uN into ODE and apply equations at tk.
Kkuzftztr kk
K
jkjjk ,...1 ,0),()()(
0
==−= ∑=
"�
43
Collocation Example
kkNjk
jK
kjj
k
K
kkkK ztz
tt
ttttztz ===>
−−
∏== +
≠==
+ ∑ )()(
)()(,)()( 1
001 ""
2
210
22
221
22
2222211200
12
121
12
1122111100
0
2
22
11
02
0
210
76303053371
706073840319029100
2334786
23
2346412098572
23
0
0023
4641203924 ,464102196252
391644836 ,4483621958
613 ,61
7886802113200
t. t - . z(t)
). (. ), z. (. , z z
) z - z z z.(-
z - z) (t z) (t z) (tz
) z - z z. z.(
z - z) (t z) (t z) (tz
z
) , z( z - zSolve z’
.t - . (t) t. - t. (t)
t. - . (t) t. t. -(t)
/ - t/(t) )/ - t (t(t)
. , t. , t t
=
===+=+
+=++
+=+
+=++
===>=+=
==
=+=
=+=
===
"�"�"�
"�"�"�
"�"
"�"
"�"
44
z(t)
z N+1(t)
Sta
te P
rofile
t ft 1 t 2 t 3
r(t)
t 1 t 2 t 3
Min φ(z(tf))s.t. z’ = f(z, u, p), z(0)=z0
g(z(t), u(t), p) � 0h(z(t), u(t), p) = 0
to Nonlinear Program
How accurate is approximation
Converted Optimal Control Problem
Using Collocation
0)1(
,...1
0
0
z(0) ,0),()(
0
00
=−
=
=≤
==−
∑
∑
=
=
f
K
jjj
kk
kk
kk
K
jkjj
f
zz
Kk
),uh(z
),ug(z
zuzftz
)(z Min
"
"�
φ
45
Results of Optimal Temperature Program Batch Reactor (Revisited)
Results- NLP with Orthogonal CollocationOptimum B/A - 0.5728# of ODE Solutions - 0.7(Equivalent)
46
to tf
u u u u
Collocation points
• ••• •
•• •
•••
•
Polynomials
u uu u
•
Finite element, i
ti
Mesh points
hi
u u u u
∑=
=K
qiqq(t) zz(t)
0
"
u uu
uelement i
q = 1q = 1
q = 2 q = 2
uuuuContinuous Differential variables
Discontinuous Algebraic and Control variables
u
u
u u
Collocation on Finite ElementsCollocation on Finite Elements
∑=
=K
qiqq(t) yy(t)
1
" ∑=
=K
qiqq(t) uu(t)
1
"
τd
dz
hdt
dz
i
1=
),( uzfhd
dzi=
τ
NE 1,.. i 1,..K,k ,0),,())(()(0
===−= ∑=
K
jikikikjijik puzfhztr τ"�
]1,0[,1
1’’ ∈+= ∑
−
=
ττ ji
i
iiij hht
47
Nonlinear Programming ProblemNonlinear Programming Problem
uL
x
xxx
xc
xfn
≤≤
=
ℜ∈
0)(s.t
)(min( )fzψ min
( ) 0,, ,,, =p,uyzg kikiki
ul
ujiji
lji
uji
lji
ul
ppp
uuu
yyy
zzz
≤≤
≤≤
≤≤
≤≤
,,,
,ji,,
ji, ji,ji,
s.t. ∑=
=−K
jikikikjij puzfhz
0
0),,())(( τ"�
)0( ,0))1((
,..2 ,0))1((
100
,
00,1
zzzz
NEizz
K
jfjjNE
K
jijji
==−
==−
∑
∑
=
=−
"
"
Finite elements,hi, can also be variable to determine break points for u(t).
Add hu � hi � 0, Σ hi=tf
Can add constraints g(h, z, u) � ε for approximation error
48
A + 3B --> C + 3D
L
T s
T R
T P
3:1 B/A
383 K
TP = specified product temperatureTR = reactor inlet, reference temperatureL = reactor lengthTs = steam sink temperatureq(t) = reactor conversion profileT(t) = normalized reactor temperature profile
Cases considered:• Hot Spot - no state variable constraints• Hot Spot with T(t) � 1.45
Hot Spot Reactor Revisited
Roo
P
Pproducto
Rfeed
RS
L
RSTLTT
C/T C, T(L) T
, T(L)) (THC) -,(T+
Tdt
dqTTtT
dt
dT
qtTtqdt
dqts
dtTTtTLMinSRP
101120
0110
1)0( ,3/2)/)((5.1
0)0( )],(/2020exp[))(1(3.0 ..
)/)(( 0
,,,
+==
=∆
=+−−=
=−−=
−−=Φ ∫
49
1.21.00.80.60.40.20.00
1
2
integrated profile
collocation
Normalized Length
Con
vers
ion
1.21.00.80.60.40.20.01.0
1.2
1.4
1.6
1.8
integrated profile
collocation
Normalized Length
Tem
pera
ture
Base Case SimulationMethod: OCFE at initial point with 6 equally spaced elements
L(norm) TR(K) TS(K) TP(K)Base Case: 1.0 462.23 425.26 250
50
1.51.00.50.0
0.0
0.2
0.4
0.6
0.8
1.0
1.2
Normalized Length
Con
vers
ion,
q
1.51.00.50.01.0
1.1
1.2
1.3
1.4
1.5
1.6
Normalized Length
Nor
mal
ized
Tem
pera
ture
Unconstrained CaseMethod: OCFE combined formulation with rSQP
identical to integrated profiles at optimum L(norm) TR(K) TS(K) TP(K)
Initial: 1.0 462.23 425.26 250Optimal: 1.25 500 470.1 188.4
123 CPU s. (µVax II)φ∗ = -171.5
51
1.51.00.50.0
0.0
0.2
0.4
0.6
0.8
1.0
1.2
Normalized Length
Con
vers
ion
1.51.00.50.01.0
1.1
1.2
1.3
1.4
1.5
Normalized Length
Tem
pera
ture
Temperature Constrained CaseT(t) � 1.45
Method: OCFE combined formulation with rSQP, identical to integrated profiles at optimum
L(norm) TR(K) TS(K) TP(K)Initial: 1.0 462.23 425.26 250Optimal: 1.25 500 450.5 232.1
57 CPU s. (µVax II), φ∗ = -148.5
52
Theoretical Properties of Simultaneous Method
A. Stability and Accuracy of Orthogonal Collocation
• Equivalent to performing a fully implicit Runge-Kutta integration of the DAE models at Gaussian (Radau) points
• 2K order (2K-1) method which uses K collocation points• Algebraically stable (i.e., possesses A, B, AN and BN stability)
B. Analysis of the Optimality Conditions
• An equivalence has been established between the Kuhn-Tucker conditions of NLP and the variational necessary conditions
• Rates of convergence have been established for the NLP method
53
Case Studies• Reactor - Based Flowsheets• Fed-Batch Penicillin Fermenter• Temperature Profiles for Batch Reactors• Parameter Estimation of Batch Data• Synthesis of Reactor Networks• Batch Crystallization Temperature Profiles• Grade Transition for LDPE Process• Ramping for Continuous Columns• Reflux Profiles for Batch Distillation and Column Design• Source Detection for Municipal Water Networks• Air Traffic Conflict Resolution• Satellite Trajectories in Astronautics• Batch Process Integration• Optimization of Simulated Moving Beds
Simultaneous DAE Optimization
54
Production of High Impact Polystyrene (HIPS)Startup and Transition Policies (Flores et al., 2005a)
Catalyst
Monomer, Transfer/Term. agents
Coolant
Polymer
55
Upper Steady−State
Bifurcation Parameter
System State
Lower Steady−State
Medium Steady−State
Phase Diagram of Steady States
Transitions considered among all steady state pairs
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
300
350
400
450
500
550
600
N1
N2
N3
A1
A4
A2
A3
A5
Cooling water flowrate (L/s)
Te
mp
era
ture
(K
)
1: Qi = 0.00152: Qi = 0.00253: Qi = 0.0040
3
2
1
0 0.02 0.04 0.06 0.08 0.1 0.12
300
350
400
450
500
550
600
650
Initiator flowrate (L/s)
Te
mp
era
ture
(K
)
1: Qcw = 102: Qcw = 1.03: Qcw = 0.1
32 1
3
2
1
N2
B1 B2 B3
C1C2
56
0 0.5 1 1.5 20
0.5
1x 10
−3
Time [h]
Initi
ator
Con
c. [m
ol/l]
0 0.5 1 1.5 24
6
8
10
Time [h]
Mon
omer
Con
c. [m
ol/l]
0 0.5 1 1.5 2300
350
400
Time [h]
Rea
ctor
Tem
p. [
K]
0 0.5 1 1.5 2290
300
310
320
Time [h]
Jack
et T
emp.
[K
]
0 20 40 60 80 1000
0.5
1
1.5x 10
−3
Time [h]
Initi
ator
Flo
w. [
l/sec
]
0 0.5 1 1.5 20
0.5
1
Time [h]Coo
ling
wat
er F
low
. [l/s
ec]
0 0.5 1 1.5 20
1
2
3
Time [h]
Fee
drat
e F
low
. [l/s
ec]
• 926 variables• 476 constraints• 36 iters. / 0.95 CPU s (P4)
Startup to Unstable Steady State
57
HIPS Process Plant (Flores et al., 2005b)
•Many grade transitions considered with stable/unstable pairs
•1-6 CPU min (P4) with IPOPT
•Study shows benefit for sequence of grade changes to achieve wide range of grade transitions.
58
Batch Distillation – Optimization Case Study - 1
D(t), x d
V(t)
R(t)
xb
[ ]
[ ]
1+R
V-=
dt
dS
x-xS
V=
dt
dx
x-yH
V=
dt
dx
i,0i,i,0
i,i,cond
di,
d
dN
*DXJH�HIIHFW�RI�FROXPQ�KROGXSV�2YHUDOO�SURILW�PD[LPL]DWLRQ0DNH�7UD\�&RXQW�&RQWLQXRXV
59
2SWLPL]DWLRQ�&DVH�6WXG\�� �0RGHOLQJ�$VVXPSWLRQV,GHDO�7KHUPRG\QDPLFV1R�/LTXLG�7UD\�+ROGXS1R�9DSRU�+ROGXS)RXU�FRPSRQHQW�PL[WXUH��α �����������������6KRUWFXW�VWHDG\�VWDWH�WUD\�PRGHO��)HQVNH�8QGHUZRRG�*LOOLODQG�
&DQ�EH�VXEVWLWXWHG�E\�PRUH�GHWDLOHG�VWHDG\�VWDWH�PRGHOV�)UHGHQVOXQG DQG�*DOLQGH]���������$OND\D�������
2SWLPL]DWLRQ�3UREOHPV�&RQVLGHUHG(IIHFW�RI�&ROXPQ�+ROGXS��+FRQG�7RWDO�3URILW�0D[LPL]DWLRQ
60
0.0 0.2 0.4 0.6 0.8 1.0
0
10
20
30
With Holdup
No Holdup
Time ( hours )
Re
flu
x R
atio
0.0 0.2 0.4 0.6 0.8 1.0
0.91
0.92
0.93
0.94
0.95
0.96
0.97
0.98
With Holdup
No Holdup
Time ( hours )
Dis
tilla
te C
om
po
sitio
n
0D[LPXP�'LVWLOODWH�3UREOHP�
&RPSDULVRQ�RI�RSWLPDO�UHIOX[�SURILOHV�ZLWK�DQG�ZLWKRXW�KROGXS��+FRQG��
&RPSDULVRQ�RI�GLVWLOODWH�SURILOHV�ZLWK�DQG�ZLWKRXW�KROGXS��+FRQG��DW�������RYHUDOO�SXULW\�
61
0 1 2 3 4
0
10
20
30
N = 20
N = 33.7
Time ( hours )
Re
flu
x R
atio
%DWFK�'LVWLOODWLRQ�3URILW�0D[LPL]DWLRQMax {Net Sales(D, S0)/(tf +Tset) – TAC(N, V)}
N = 20 trays, Tsetup= 1 hourxd = 0.98, xfeed= 0.50, α = 2Cprod/Cfeed= 4.1V = 120 moles/hr, S0 = 100 moles.
62
%DWFK�'LVWLOODWLRQ� 2SWLPL]DWLRQ�&DVH�6WXG\�� �
D(t), x d
V(t)
R(t)
xb
Ideal Equilibrium Equationsyi,p = Ki,p xi,p
Binary Column (55/45, Cyclohexane, Toluene)S0 = 200, V = 120, Hp = 1, N = 10, ~8000 variables, < 2 CPU hrs. (Vaxstation 3200)
dx1,N+1
dt=
VH N+1
y1,N - x1,N+1[ ]dx1,p
dt=
V
Hp
y1, p-1- y1,p +R
R+1x1,p+1- x1,p
[ ], p = 1,...,N
dx1,0
dt=
V
Sx1,0 - y1,0 + R
R+1x1,1 - x1,0
[ ]
dDdt
=V
R +1
xi,p1
C∑ = 1.0 yi,p
1
C∑ =1.0
S0x i,00 = S0 - Hp
p=1
N+1∑
x i,0 + Hp
p=1
N+1∑ x i,p
63
2SWLPL]DWLRQ�&DVH�6WXG\�� �
&DVHV�&RQVLGHUHG&RQVWDQW�&RPSRVLWLRQ�RYHU�7LPH6SHFLILHG�&RPSRVLWLRQ�DW�)LQDO�7LPH%HVW�&RQVWDQW�5HIOX[�3ROLF\3LHFHZLVH�&RQVWDQW�5HIOX[�3ROLF\
0RGHOLQJ�$VVXPSWLRQV,GHDO�7KHUPRG\QDPLFV&RQVWDQW�7UD\�+ROGXS1R�9DSRU�+ROGXS%LQDU\�0L[WXUH�����WROXHQH����F\FORKH[DQH���KRXU�RSHUDWLRQ7RWDO�5HIOX[�,QLWLDO�&RQGLWLRQ
64
1.00.80.60.40.20.00
1
2
3
4
5
6
0.000
0.001
0.002
0.003
0.004
0.005
0.006
Reflux
Purity
Time (hrs.)
Ref
lux
Pol
icy
Top
Pla
te P
urity
, (1-
x)
1.00.80.60.40.20.00
2
4
6
8
0.000
0.002
0.004
0.006
0.008
0.010
Reflux
Purity
Time (hrs.)
Ref
lux
Pol
icy
Dis
tilla
te P
urit
y, (
1-x)
5HIOX[�2SWLPL]DWLRQ�&DVHV
2YHUDOO�'LVWLOODWH�3XULW\∫[G�W��9��5����GW���'�WI���� �����
' �WI�� ������6KRUWFXW�&RPSDULVRQ
' �WI�� ������
&RQVWDQW�3XULW\�RYHU�7LPH[��W��� �����' �WI�� ������
65
5HIOX[�2SWLPL]DWLRQ�&DVHV
3LHFHZLVH�&RQVWDQW�5HIOX[�RYHU�7LPH∫[G�W��9��5����GW���'�WI���� �����
' �WI�� ������
&RQVWDQW�5HIOX[�RYHU�7LPH[G�W��9��5����GW���'�WI���� �����' �WI�� �����
1.00.80.60.40.20.00.20
0.22
0.24
0.26
0.28
0.30
0.000
0.001
0.002
0.003
0.004
Reflux
Purity
Time (hrs.)
Ref
lux
Pol
icy
Dis
tilla
te P
urit
y, (
1-x)
1.00.80.60.40.20.00.000
0.002
0.004
0.006
0.008
0.010
0
1
2
3
4
5
6
Purity
Reflux
Time (hrs.)
Ref
lux
Pol
icy
Dis
tilla
te P
urit
y, (
1-x)
66
Batch Reactive Distillation – Case Study 3
max Ddtt f
0
1=∫max Ddtt f
0
1=∫
s.t. DAE
xDEster ≥ 0 4600.xD
Ester ≥ 0 4600.
Reversible reaction between acetic acid and ethanolReversible reaction between acetic acid and ethanol
CH3COOH + CH3CH2OH l CH3COOCH2CH3 + H2O
t = 0, x = 0.25for all components
Wajde & Reklaitis (1995)
D(t), x d
V(t)
R(t)
xb
67
2SWLPL]DWLRQ�&DVH�6WXG\�� �
&DVHV�&RQVLGHUHG6SHFLILHG�&RPSRVLWLRQ�DW�)LQDO�7LPH2SWLPXP�5HIOX[�3ROLF\9DULRXV�7UD\V�&RQVLGHUHG��������������KRXU�RSHUDWLRQ
0RGHOLQJ�$VVXPSWLRQV,GHDO�7KHUPRG\QDPLFV&RQVWDQW�7UD\�+ROGXS1R�9DSRU�+ROGXS7HUWLDU\�0L[WXUH��(W2+��+2$F��(7$F��+�2�&ROG�6WDUW�,QLWLDO�&RQGLWLRQ
68
Batch Reactive Distillation
Distillate Composition
0.25
0.35
0.45
0.0 0.2 0.4 0.6 0.8 1.0time (hr)
Eth
yl A
ceta
te
8 trays 15 trays 25 trays
Optimal Reflux Profiles
0
20
40
60
80
100
0.0 0.2 0.4 0.6 0.8 1.0
time (hr)
Ref
lux
Rat
io
8 trays 15 trays 25 trays
0.0 0.2 0.4 0.6 0.8 1.0
0.00
0.10
0.20
0.30
0.40
0.50
M. f
ract
ion
time(hr)
Condenser Composition (8 trays)
Ester Eth. Wat. A. A.
�������YDULDEOHV������'$(V���GHJUHHV�RI�IUHHGRP���ILQLWH�HOHPHQWV�����,3237�LWHUDWLRQV�����&38�PLQXWHV
69
CPU Decomposition Time
1
6
11
16
21
90 130 170 210 250
DAEs
CP
U(s
)/ite
r
DiscretizedVariables
Iterations CPU (s)
3048
1788
245.732
DAEsTrays
168
8 98
15
56.414
4678 1083.24525825
207.5
37.2
659.3
Global Elemental
Batch Reactive Distillation
70
Nonlinear Model Predictive Control (NMPC)
Process
NMPC Controller
d : disturbancesz : differential statesy : algebraic states
u : manipulatedvariables
ysp : set points
( )( )dpuyzG
dpuyzFz
,,,,0
,,,,
==′
NMPC Estimation and Control
sConstraintOther
sConstraint Bound
)()),(),(),((0
)),(),(),(()(..
||))||||)(||min
init
1sp
ztztttytzG
tttytzFtzts
yty uy Q
kk
Q
==
=′
−+−∑ ∑ −
u
u
u(tu(tu
NMPC Subproblem
Why NMPC?
� Track a profile
� Severe nonlinear dynamics (e.g, sign changes in gains)
� Operate process over wide range (e.g., startup and shutdown)
Model Updater( )( )dpuyzG
dpuyzFz
,,,,0
,,,,
==′
71
Dynamic optimization in a MATLAB Framework
Dynamic Optimization Problem
Process Model
Inequality Constraints
Initial Conditions
Constraints at Final Time
Objective Function
( ) 0puyxxf =′ t,,,,,
( ) 0=t,,,, puyxg
0),,,,,( ≤′ tpuyxxh
0xx =)( 0t
( ) 0,,,)(,)(,)(,)( 0 =′ fffff ttttt pxuyxxϕ
( )ffft
tttf
,,),(t,)(,)( P 0f,,(t),
min0
xpuyxxpu
NLP Optimization Problem
Process Model
Inequality Constraints
Constraints at Final Time
Objective Function
( ) 0xpuyxf 0 =,,,ˆ,ˆ,ˆˆft
( ) 0puyxg =ft,,ˆ,ˆ,ˆˆ
0),,ˆ,ˆ,ˆ(ˆ ≤ftpuyxh
( ) 0,,,, =fNNN tttt
puyxϕ
( )fNNN tttt
,,,, Pmin puyx
Full Discretization of State and
Control Variables
Discretization Method
No. of Time Elements
Collocation Order
Saturator-System
copy ofDesign
WärmeschaltplanNr. -F Ref T - Erlangen, 13.Oct.1999
SIEMENS AGF Ref T In Bearbeitung
P..Druck..bar
M..Massenstrom..kg/s
PHI..Luft-Feuchte..%
H..Enthalpie..kJ/kg
T..Temperatur..°C
bar kJ/kgkg/s °C (X)
JOBKENNUNG : C:\Krawal-modular\IGCC\IGCC_Puertol lano_komplett.gek
Alle Drücke sind absolut
Dynamic Process
72
Tennessee Eastman Process
Unstable Reactor
11 Controls; Product, Purge streams
Model extended with energy balances
73
Tennessee Eastman Challenge Process
Method of Full Discretization of State and Control Variables
Large-scale Sparse block-diagonal NLP
11Difference (control variables)
141Number of algebraic equations
152Number of algebraic variables
30Number of differential equations
DAE Model
14700Number of nonzeros in Hessian
49230Number of nonzeros in Jacobian
540Number of upper bounds
780Number of lower bounds
10260Number of constraints
109200
Number of variablesof which are fixed
NLP Optimization problem
74
Setpoint change studies
Setpoint changes for the base case [Downs & Vogel]
+2%Make a step change so that the composition of component B in the gas purge changes from 13.82 to 15.82%
StepPurge gas composition of component B change
-60 kPaMake a step change so that the reactor operating pressure changes from 2805 to 2745 kPa
StepReactor operating pressure change
-15%Make a step change to the variable(s) used to set the process production rate so that the product flow leaving the stripper column base changes from 14,228 to 12,094 kg h-1
StepProduction rate change
MagnitudeTypeProcess variable
75
Case Study:Change Reactor pressure by 60 kPa
Control profiles
All profiles return to their base case values
Same production rate
Same product quality
Same control profile
Lower pressure – leads to larger gas phase (reactor) volume
Less compressor load
76
TE Case Study – Results I
Shift in TE process
Same production rate
More volume for reaction
Same reactor temperature
Initially less cooling water flow (more evaporation)
77
Case Study- Results II
Shift in TE process
Shift in reactor effluent to more condensables
Increase cooling water flow
Increase stripper steam to ensure same purity
Less compressor work
78
Case Study: Change Reactor Pressure by 60 kPa
Optimization with IPOPT
1000 Optimization Cycles
5-7 CPU seconds
11-14 Iterations
Optimization with SNOPT
Often failed due to poor conditioning
Could not be solved within sampling times
> 100 Iterations
79
+ Directly handles interactions, multiple conditions+ Trade-offs unambiguous, quantitative
- Larger problems to solve - Need to consider a diverse process models
Research Questions
How should diverse models be integrated?Is further algorithmic development needed?
Optimization as a Framework for IntegrationOptimization as a Framework for Integration
80
:KDW�DUH�WKH�,QWHUDFWLRQV�EHWZHHQ�'HVLJQ�DQG�'\QDPLFV�DQG�3ODQQLQJ"
:KDW�DUH�WKH�GLIIHUHQFHV�EHWZHHQ�6HTXHQWLDO�DQG�6LPXOWDQHRXV�6WUDWHJLHV"
(VSHFLDOO\�,PSRUWDQW�LQ�%DWFK�6\VWHPV
Batch Integration Case Study
Production PlanningStage 1
Stage 2
A
A B
B C
C
Plant Design
TR
Time Time
Dynamic Processing
81
GLVFUHWL]H �'$(V���VWDWH�DQG�FRQWURO�SURILOHVODUJH�VFDOH�RSWLPL]DWLRQ�SUREOHPKDQGOHV�SURILOH�FRQVWUDLQWV�GLUHFWO\LQFRUSRUDWHV�HTXLSPHQW�YDULDEOHV�GLUHFWO\�'$(�PRGHO�VROYHG�RQO\�RQFHFRQYHUJHV�IRU�XQVWDEOH�V\VWHPV
6LPXOWDQHRXV�'\QDPLF�2SWLPL]DWLRQ
Best transient Best constant
Higher conversion in same time
T
Time
Con
v.
Time
Fewer product batches
TSame conversion in reduced time
Time
Con
v.
Time
Shorter processing times
Dynamic Processing
Production PlanningStage 1
Stage 2
A
A B
B C
C
Shorter Planning Horizon
82
Scheduling Formulation
VHTXHQFLQJ�RI�WDVNV��SURGXFWV�HTXLSPHQWH[SHQVLYH�GLVFUHWH�FRPELQDWRULDO�RSWLPL]DWLRQFRQVLGHU�LGHDO�WUDQVIHU�SROLFLHV��8,6�DQG�=:�FORVHG�IRUP�UHODWLRQV��%LUHZDU DQG�*URVVPDQQ�������
A B Nstage I
stage 2
stage I
stage 2
A B N
=HUR�:DLW��=:��,PPHGLDWH�WUDQVIHU�UHTXLUHG6ODFN�WLPHV�GHSHQGHQW�RQ�SDLU/RQJHU�SURGXFWLRQ�F\FOH�UHTXLUHG
8QOLPLWHG�,QW��6WRUDJH�8,6�6KRUW�SURGXFWLRQ�F\FOH&\FOH�WLPH�LQGHSHQGHQW�RI�VHTXHQFH
83
Case Study ExampleCase Study Example
z i ,I0 zi ,II
0z i ,III
0 zi ,IV0
z i ,IVf
zi ,If z i ,II
f z i ,IIIf
Bi
A + B → C
C + B → P + E
P + C → G
4 stages, 3 products of different purity Dynamic reactor - temperature profileDynamic column - reflux profile
Process Optimization Cases
SQ - Sequential Design - Scheduling - DynamicsSM - Simultaneous Design and Scheduling
Dynamics with endpoints fixed . SM* - Simultaneous Design, Scheduling and Dynamics
84
5
10
15
20
25
580
590
600
610
620
630
640
0 0.5 1 1.5 2 2.50 0.25 0.5 0.75 1 1.25Tim e (h r.)
Dyn a mic
C o nsta nt
Dyn a mic
C o nsta nt
&RPSDULVRQ�RI�'\QDPLF�YV��%HVW�&RQVWDQW�3URILOHV5��� EHVW�FRQVWDQW�WHPSHUDWXUH�SURILOH5��� RSWLPDO�WHPSHUDWXUH�SROLF\&��� EHVW�FRQVWDQW�UHIOX[�UDWLR&��� RSWLPDO�UHIOX[�UDWLR
6FHQDULRV�LQ�&DVH�6WXG\
85
Results for Simultaneous Cases
R0/R1 best constant / optimal temperature
C0/C1best constant / optimal reflux ratio
0
5 0 0 0
1 0 0 0 0
1 5 0 0 0
2 0 0 0 0
Pro
fit (
$)
R 0 C 0 R 1 C 0 R 0 C 1 R 1 C 1
C a s e s
S Im u lt a n e o u s w it h F R E E s t a t e s
S im u lt a n e o u s w it h F I X E D s t a t e sS e q u e n t ia l
I
I I
I I I
I V
I
I I
I I I
I V
I
I I
I I I
I V
- ZW schedule becomes tighter
- less dependent on product sequences
64
60
60
86
SummarySequential Approaches- Parameter Optimization
• Gradients by: Direct and Adjoint Sensitivity Equations- Optimal Control (Profile Optimization)
• Variational Methods• NLP-Based Methods
- Require Repeated Solution of Model- State Constraints are Difficult to Handle
Simultaneous Approach- Discretize ODE's using orthogonal collocation on finite elements (solve larger optimization problem)- Accurate approximation of states, location of control discontinuities through element placement.- Straightforward addition of state constraints.- Deals with unstable systems
Simultaneous Strategies are Effective- Directly enforce constraints- Solve model only once- Avoid difficulties at intermediate points
Large-Scale Extensions- Exploit structure of DAE discretization through decomposition- Large problems solved efficiently with IPOPT
87
ReferencesBryson, A.E. and Y.C. Ho, Applied Optimal Control, Ginn/Blaisdell, (1968).Himmelblau, D.M., T.F. Edgar and L. Lasdon, Optimization of Chemical Processes, McGraw-Hill, (2001).Ray. W.H., Advanced Process Control, McGraw-Hill, (1981).
Software• Dynamic Optimization CodesACM – Aspen Custom ModelerDynoPC - simultaneous optimization code (CMU)COOPT - sequential optimization code (Petzold)gOPT - sequential code integrated into gProms (PSE)MUSCOD - multiple shooting optimization (Bock)NOVA - SQP and collocation code (DOT Products)• Sensitivity Codes for DAEsDASOLV - staggered direct method (PSE)DASPK 3.0 - various methods (Petzold)SDASAC - staggered direct method (sparse)DDASAC - staggered direct method (dense)
DAE Optimization Resources
88
Interface of DynoPC
Outputs/Graphic & TextsModel in FORTRAN
F2c/C++
ADOL_C
Preprocessor
DDASSL
COLDAE
Data/Config.
Simulator/Discretizer
F/DF
Starting Point Linearization
Optimal Solution
FILTER
Redued SQP
F/DFLine Search
Calc. of independent variable move
Interior PointFor QP
Decomposition
DynoPC – Windows Implementation
89
A B C1 2
da
atk
E
RTa= − − ⋅1
1exp( )
db
atk
E
RTa k
E
RTb= − ⋅ − − ⋅1
12
2exp( ) exp( )
a + b + c = 1
..
)(
ts
tbMax f
T
Example: Batch Reactor Temperature
90
Example: Car Problem
Min tfs.t. z1’ = z2
z2’ = uz2 � zmax
-2 � u � 1
subroutine model(nz,ny,nu,np,t,z,dmz,y,u,p,f)double precision t, z(nz),dmz(nz), y(ny),u(nu),p(np)
double precision f(nz+ny)
f(1) = p(1)*z(2) - dmz(1)f(2) = p(1)*u(1) - dmz(2)
returnend403020100
-3
-2
-1
0
1
2
0
2
4
6
8
10
12
Acceleration
Velocity
Time
Acc
eler
atio
n, u
(t)
Vel
ocit
y
91
Example: Crystallizer Temperature
Steam
Cooling water
TT TC
Control variable = Tjacket = f(t)?
Maximize crystal sizeat final time
0.0E+00
5.0E-04
1.0E-03
1.5E-03
2.0E-03
2.5E-03
3.0E-03
3.5E-03
4.0E-03
4.5E-03
0 5 10 15 20
Time (hr)
Cry
stal
siz
e
0
10
20
30
40
50
60
T ja
cket
(C)
Crystal Size T jacket
SUBROUTINE model(nz,ny,nu,np,x,z,dmz,y,u,p,f)implicit double precision (a-h,o-z)double precision f(nz+ny),z(nz),dmz(nz),Y(ny),yp(4),u(1)double precision kgr, ln0, ls0, kc, ke, kex, lau, deltT, alphadimension a(0:3), b(0:3)data alpha/1.d-4/,a/-66.4309d0, 2.8604d0, -.022579d0, 6.7117d-5/,+ b/16.08852d0, -2.708263d0, .0670694d0, -3.5685d-4/, kgr/ 4.18d-3/,+ en / 1.1d0/, ln0/ 5.d-5/, Bn / 3.85d2/, em / 5.72/, ws0/ 2.d0/,+ Ls0/ 5.d-4 /, Kc / 35.d0 /, Kex/ 65.d0/, are/ 5.8d0 /,+ amt/ 60.d0 /, V0 / 1500.d0/, cw0/ 80.d0/,cw1/ 45.d0/,v1 /200.d0/,+ tm1/ 55.d0/,x6r/0.d0/, tem/ 0.15d0/,clau/ 1580.d0/,lau/1.35d0/,+ cp/ 0.4d0 /,cbata/ 1.2d0/, calfa/ .2d0 /, cwt/ 10.d0/
ke = kex*area x7i = cw0*lau/(100.d0-cw0)v = (1.d0 - cw0/100.d0)*v0 w = lau*v0 yp(1) = (deltT + dsqrt(deltT**2 + alpha**2))*0.5d0yp(2) = (a(0) + a(1)*yp(4) + a(2)*yp(4)**2 + a(3)*yp(4)**3)yp(3) = (b(0) + b(1)*yp(4) + b(2)*yp(4)**2 + b(3)*yp(4)**3)deltT = yp(2) - z(8) yp(4) = 100.d0*z(7)/(lau+z(7))
f(1) = Kgr*z(1)**0.5*yp(1)**en - dmz(1)f(2) = Bn*yp(1)**em*1.d-6 - dmz(2)f(3) = ((z(2)*dmz(1) + dmz(2) * Ln0)*1.d+6*1.d-4) -dmz(3)f(4) = (2.d0*cbata*z(3)*1.d+4*dmz(1)+dmz(2)*Ln0**2*1.d+6)-dmz(4)f(5) = (3.d0*calfa*z(4)*dmz(1)+dmz(2)*Ln0**3*1.d+6) - dmz(5)f(6) = (3.d0*Ws0/(Ls0**3)*z(1)**2*dmz(1)+clau*V*dmz(5))-dmz(6)f(7) = -dmz(6)/V - dmz(7)f(8) = (Kc*dmz(6) - Ke*(z(8) - u(1)))/(w*cp) - dmz(8)f(9) = y(1)+YP(3)- u(1) returnend