1
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
2
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
≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤
≤≤≤≤≤≤≤≤====
)(
)(
)(
)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
3
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.00.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
•Run between distillation batches•Treat as boundary value optimization problem
•When to switch from A to offcut to B?•How much offcut to recycle?•Reflux?•Boilup Rate?•Operating Time?
A B
4
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?
n Track a profile
n Severe nonlinear dynamics (e.g, sign changes in gains)
n 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.25Time (h r.)
Dyn a m ic
C o nsta nt
Dyn a mic
C o nsta nt
optimal reactor temperature policy optimal column reflux ratio
Batch Process Optimization
5
9
FexitC H2 4
Texit ≤ 1180K
C2H CH
6 32→ • CH CH CH C H
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 C H CH CH
5 2 4 3 6 3•+ → + •
H CH C H•+ → •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
6
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)
7
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
8
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
Take variations 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) and CVODES (Serban and Hindmarsh)
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()(
)(
))(()( ),(
λλψ
ψλλλ
9
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
2
2212212
1122111
0
0
121222
211
21
1211
22
211
∫
∫
=
=
∂∂
=−−=′
∂∂
=+−−=′
∂∂+
∂∂=
∂∂
=∂∂−=′
+++=
==
+=′+=′
λψ
λψ
ψλλλλ
ψλλλλ
λλψ
ψλλλ
λλλ
18
A + 3B --> C + 3D
L
Ts
TR
TP
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∆H
Tdt
dqTTtT
dt
dT
qtTtqdt
dqts
dtTTtTLMinSRP
101120
0110
1)0( ,3/2)/)((5.1
0)0( )],(/2020exp[))(1(3.0 ..
)/)(( 0
,,,
+==
=∆
=+−−=
=−−=
−−=Φ ∫
10
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 LengthN
orm
aliz
ed T
empe
ratu
re
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 (T ≤ 1.45): 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
&
11
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; Sargentand 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
dt)b)t(u())t(ua()u,z(fz
)t(z)t()(z)(v))t(z(h))t(z(g)t(
dt)b)t(u())t(ua()z)u,z(f(
v))t(z(h))t(z(g)t(
Tb
tTa
TT
ffTTT
fT
ff
Tb
tTa
T
Tf
Tff
f
f
00
:partsby Integrate
0
0
−+−+++
−+++=
−+−+−+
++=
∫
∫
ααλλ
λλµφφ
ααλ
µφφ
&
&
12
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
ff
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
λ
λ
λλλ
λλλλλ
λλλ
&
&
&
13
25
t f
u(t)
b
a
t s
1 / 2 bt2, t < ts
1 / 2 bts2 - a ts - t f( )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) = Lx2(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).
⇒
Optimality conditions:
Cases Considered1. NLP Approach- piecewise constant and linear profiles.2. Indirect Approach
50
00
10 2
1 2
≤≤==
=+−=
−
)t(u
)(b,ua'b
)(a,a)/uu('a.t.s
)(bMin
10 0
00 2
050 00
1
2
2
50
50
2
−===−+=
≥−⊥≤≥⊥≤−=++−=∂∂
++−=
)(,'
)(,u)/uu('
)u(,u
aa)u(u/H
uaa)/uu(H
bb
abaa
ba
ba
λλλλλλ
ααααλλ
λλ
14
27
Batch Reactor Optimal Temperature Program Piecewise Constant
Opt
imal
Pro
file,
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
Opt
imal
Pro
file,
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
15
29
Opt
imal
Pro
file,
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
16
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.
17
33
BVP Solution
On the other hand, for the boundary value problem, the errors affect the analyticsolution 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 τ (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
18
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 Optimization
Divide 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
19
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 zz o = 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 τ = 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
20
39
Dynamic Optimization – Multiple Shooting Strategies
Larger NLP problem O(np+NE (nu+nz)) • Use SNOPT, MINOS, etc.• Second derivatives difficult to get
Repeated solution of DAE model and sensitivity/adjoint equations, scales with nzand 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
21
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 zand u by Lagrange interpolation polynomials (order K+1 and K, respectively) with interpolation points, tk
kkKjk
jK
kjj
k
K
kkkK
kkKjk
jK
kjj
k
K
kkkK
ututt
ttttutu
ztztt
ttttztz
===>−−
∏==
===>−−
∏==
≠==
+
≠==
+
∑
∑
)()(
)()(,)()(
)()(
)()(,)()(
11
100
1
ll
ll
Substitute zN+1 and uN into ODE and apply equations at tk.
Kkuzftztr kk
K
jkjjk ,...1 ,0),()()(
0
==−=∑=
l&
22
43
Collocation Example
kkNjk
jK
kjj
k
K
kkkK ztz
tt
ttttztz ===>
−−
∏== +
≠==
+ ∑ )()(
)()(,)()( 1
001 ll
2
210
22
221
22
2222211200
12
121
12
1122111100
0
2
22
2
12
1
02
0
210
76303053371
706073840319029100
2334786
23
2346412098572
23
0
0023
464103924 46410196252
391644836 448361958
612 166
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 - z z' Solve
.t - . (t) ,t. - t. (t)
t. - . (t) ,t. t. -(t)
t - (t) ,t - t (t)
. , t. , t t
=
===+=+
+=++
+=+
+=++
===>=+=
==
=+=
=+=
===
l&l&l&
l&l&l&
l&l
l&l
l&l
44
z(t)
zN+1 (t)
Sta
te P
rofil
e
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
l
l&
φ
23
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
×××× ×××× ×××× ××××
Collocation points
• ••• •
•• •
•••
•
Polynomials
×××× ×××××××× ××××
•
Finite element, i
ti
Mesh points
hi
×××× ×××× ×××× ××××
∑=
=K
qiqq(t) zz(t)
0
l
×××× ××××××××
××××element i
q = 1q = 1
q = 2 q = 2
××××××××××××××××Continuous Differential variables
Discontinuous Algebraic and Control variables
××××
××××
×××× ××××
Collocation on Finite ElementsCollocation on Finite Elements
∑=
=K
qiqq(t) yy(t)
1
l ∑=
=K
qiqq(t) uu(t)
1
l
τd
dz
hdt
dz
i
1=
),( uzfhd
dzi=
τ
NE 1,.. i 1,..K,k ,0),,())(()(0
===−=∑=
K
jikikikjijik puzfhztr τl&
]1,0[,1
1'' ∈+=∑
−
=
ττ ji
i
iiij hht
24
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),,())(( τl&
)0( ,0))1((
,..2 ,0))1((
100
,
00,1
zzzz
NEizz
K
jfjjNE
K
jijji
==−
==−
∑
∑
=
=−
l
l
Finite elements,hi, can also be variable to determine break points for u(t).
Add hu ≥ hi ≥ 0, Σ hi=t f
Can add constraints g(h, z, u) ≤ ε for approximation error
48
A + 3B --> C + 3D
L
Ts
TR
TP
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∆H
Tdt
dqTTtT
dt
dT
qtTtqdt
dqts
dtTTtTLMinSRP
101120
0110
1)0( ,3/2)/)((5.1
0)0( )],(/2020exp[))(1(3.0 ..
)/)(( 0
,,,
+==
=∆
=+−−=
=−−=
−−=Φ ∫
25
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 LengthT
empe
ratu
re
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
26
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
27
53
Dynamic Optimization Engines
Evolution of NLP Solvers:
� for dynamic optimization, control and estimation
E.g., NPSOL and Sequential Dynamic Optimization - over 100 variables and constraints E.g, SNOPT and Multiple Shooting - over 100 d.f.s but over 105 variables and constraintsE.g., IPOPT - Simultaneous dynamic optimizationover 1 000 000 variables and constraints
SQP rSQP Full-spaceBarrier
Object Oriented Codes tailored to structure, sparse linearalgebra and computer architecture (e.g., IPOPT 3.2)
54
Hierarchy of Nonlinear Programming for Dynamic Optimization Formulations
Variables/Constraints102 104 106
Black Box
Direct Sensitivities
Single Shooting
Multiple Shooting
Adjoint Sensitivity
Simultaneous Full Space Formulation
100
SQPSQP
rSQPrSQP
Interior PointInterior Point
DFODFO
Com
putational Efficiency
28
55
Comparison of Computational Complexity(α ∈ [2, 3], β ∈ [1, 2], nw, nu - assume Nm = O(N))
((nu + nw)N)------Backsolve
((nu + nw)N)β(nu N)α(nu N)αStep Determination
---nw3 N---NLP Decomposition
N (nu + nw)(nw N) (nu + nw)2(nw N) (nu N)2Exact Hessian
N (nu + nw)(nw N) (nu + nw)(nw N) (nu N)Sensitivity
---nwβ Nnw
β NDAE Integration
SimultaneousMultiple Shooting
Single Shooting
O((nuN)α + N2nwnu
+ N3nwnu2)
O((nuN)α + N nw3
+ N nw (nw +nu)2)
O((nu + nw)N)β
56
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
29
57
Production of High Impact Polystyrene (HIPS)Startup and Transition Policies (Flores et al., 2005a)
Catalyst
Monomer, Transfer/Term. agents
Coolant
Polymer
58
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
30
59
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 100
0
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
60
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.
31
61
Cyclic Steady StateStep
Liquid Flow
FeedDesorbent
Extract Raffinate
1
Liquid Flow
FeedDesorbent
Extract Raffinate
2
Liquid Flow
FeedDesorbent
Extract Raffinate
3
Liquid Flow
FeedDesorbent
Extract Raffinate
4
Liquid Flow
FeedDesorbent
Extract Raffinate
5
Liquid Flow
FeedDesorbent
Extract Raffinate
6
Liquid Flow
FeedDesorbent
ExtractRaffinate
7
Liquid Flow
FeedDesorbent
ExtractRaffinate
8
Liquid Flow
FeedDesorbent
ExtractRaffinate
9
Liquid Flow
FeedDesorbent
ExtractRaffinate
10
Liquid Flow
Feed Desorbent
ExtractRaffinate
11
Liquid Flow
Feed Desorbent
ExtractRaffinate
12
Liquid Flow
Feed Desorbent
ExtractRaffinate
13
Liquid Flow
Feed Desorbent
ExtractRaffinate
14
Liquid Flow
Feed Desorbent
Extract Raffinate
15
Liquid Flow
Feed Desorbent
Extract Raffinate
16
Liquid Flow
FeedDesorbent
Extract Raffinate
17
SMB Applications
• Petrochemical (Xylene isomers)
• Sugars (Fructose/glucose separation) � High fructose corn syrup
• Pharmaceuticals (Enantiomeric separation)Separate ‘good’ from ‘bad’ compounds based on chirality
62
Simulated Moving Bed
Direction of liquid flowand valve switching
Feed
Raffinate
Desorbent
ExtractRepeats exactly
the same operation
(Symmetric)
Feed Raffinate
DesorbentExtract
Operating parameters:
4 Zone velocities
+
Step time
Zone 4 Zone 2
Zone 3
Zone 1
Feed
RaffinateDesorbent
Extract
32
63
Formulation of Optimization Problem
Zone velocities Step time
(Maximize average feed velocity)
Bounds on liquid velocities
Product requirements
CSS constraintSMB model
64
Treatment of PDEs: Single Discretization
t
x
1. PDE is discretized only in x ( turn a PDE into ODEs)
2. Set of ODEs are Integrated
ODE (Handled by integrator)PDE
C(xi,t)
t
Step size determined as integration proceeds
33
65
Treatment of PDEs: Simultaneous Approach
t
x
(Orthogonal Collocation on Finite Elements)
k=1
k=2k=3
Algebraic equations PDE
Step size is determined a priori
tHuge number of variables (handled by optimizer)
C(xi,t)
66
Comparison of two approaches
CPU Time*
Shooting Approach 111.8 min
1.53 minSimultaneous Approach
# of iteration
49
47
0 1 2 3 4 5 6 7 8−0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
x [m]
Nor
mal
ized
Con
cenr
atio
n, C
i(x,t st
ep)/
CF
,i
Comp.1 Single discretizationComp.2 Single discretizationComp.1 Full discretizationComp.2 Full discretization Shooting and Simultaneous
methods find the same optimal solution
# of variables
33999
644Implemented on gPROMS, solved using SRQPD
Implemented on AMPL, solved using IPOPT
*On Pentium IV 2.8GHz
(89% spent by integrator)
(Linear isotherm, fructose/glucose separation)
Initial feed velocity: 0.01 m/h
Optimal feed velocity: 0.52 m/h
Optimization
34
67
Superstructure for Zone Configuration
uD1
uF1
uE1
uE2
uR1
uF2
uE3
uR2
uF3
uE4
uR3
uF4
uE5
uR4
uF5
uE6
uR5
uR6
All velocities are constant
8 columns, multiple streams
Repeat exactly same stream policies for each step
Constraints:
68
Allows straightforward zone configuration optimizatio n
2-2-2-2
5 6
2 1
Feed Raffinate
DesorbentExtract
3
4 7
8
Superstructure configuration AVOIDS enumerating all configurations
CPU Time*: 1.73 min
Optimal feed velocity: 1.158 m/h*On Xeon 3.2GHz
Optimal :1-3-3-1
3
4
8
2
5 6 7
1
Feed Raffinate
DesorbentExtract
Optimal feed velocity: 0.906 m/h
4
5
8
3
6 7
1
Feed Raffinate
Extract
2
Desorbent
1-4-2-1
1.052 m/h
8
4
6 7
3
Feed Raffinate
Extract Desorbent2 1
5
0.957 m/h
3-2-2-1
# of columns 8 10 12 14
# of zone configurations 35 84 165 286
Too many configurations to enumerate!
35
69
� Standard SMB
Nonstandard SMB: Addressed by Extended Superstructure NLP
� Three Zone
(Circulation loop is cut open)
� VARICOL
(Asynchronous switching)
70
0 2 4 6 80
0.5
1
x [m]
Ci(x
,t)/C
F,i →
8.000 m/h
⇓u
D1 =8.000m/h
t/tstep
= 0.142
→8.000 m/h
t/tstep
= 0.142
→8.000 m/h
⇓uR3 =8.000m/h
t/tstep
= 0.142
→8.000 m/h
⇓u
D4 =8.000m/h
⇓uE4=8.000m/h
t/tstep
= 0.142
0 2 4 6 80
0.5
1
x [m]
Ci(x
,t)/C
F,i →
7.916 m/h
⇓u
D1 =7.916m/h
t/tstep
= 0.334
→7.916 m/h
t/tstep
= 0.334
→7.916 m/h
⇓uR3 =7.916m/h
t/tstep
= 0.334
→8.000 m/h
⇓u
D4 =8.000m/h
⇓uE4=8.000m/h
t/tstep
= 0.334
0 2 4 6 80
0.5
1
x [m]
Ci(x
,t)/C
F,i →
8.000 m/h
⇓u
D1 =8.000m/h
t/tstep
= 0.434
→8.000 m/h
t/tstep
= 0.434
→8.000 m/h
t/tstep
= 0.434
→8.000 m/h
⇓uE4=8.000m/h
t/tstep
= 0.434
0 2 4 6 80
0.5
1
x [m]
Ci(x
,t)/C
F,i →
6.332 m/h
⇓u
D1 =6.332m/h
t/tstep
= 0.800
→6.332 m/h
t/tstep
= 0.800
→8.000 m/h
⇓u
F3=1.668m/h
t/tstep
= 0.800
→8.000 m/h
⇓uE4=8.000m/h
t/tstep
= 0.800
0 2 4 6 80
0.5
1
x [m]
Ci(x
,t)/C
F,i →
8.000 m/h
⇓u
D1 =8.000m/h
⇓uE1=3.757m/h
t/tstep
= 1.000
→4.243 m/h
t/tstep
= 1.000
→8.000 m/h
⇓u
F3=3.757m/h
t/tstep
= 1.000
→8.000 m/h
⇓uR4 =8.000m/h
t/tstep
= 1.000
Optimal Operating Scheme:Result of Superstructure Optimization
Standard SMB
PowerFeed Super -Structure
00.10.20.30.40.50.60.70.80.9
11.11.21.31.4
Op
tim
al T
hro
ug
hp
ut
[m/h
]
CPU Time for optimization: 9.03 min*
34098 variables, 34013 equations *on Xeon 3.2 GHz
36
71
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?
n Track a profile
n Severe nonlinear dynamics (e.g, sign changes in gains)
n Operate process over wide range (e.g., startup and shutdown)
Model Updater( )
( )dpuyzG
dpuyzFz
,,,,0
,,,,
==′
72
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.Oc t.1999
SIEM ENS AGF Ref T In Bearbeitung
P..Druck ..bar
M..Massens trom..kg/s
PHI..Luft-Feuchte..%
H..Enthalpie..kJ /kg
T..Temperatur..°C
bar kJ /kgkg/s °C (X)
JOBKENNUNG : C:\Krawal-modular\IGCC\IGCC_Puertollano_komplett.gek
Alle Drücke s ind absolut
Dynamic Process
37
73
Tennessee Eastman Process
Unstable Reactor
11 Controls; Product, Purge streams
Model extended with energy balances
74
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
38
75
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
76
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
39
77
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)
78
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
40
79
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
80
Parameter/State Estimation
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
initztzttutytzG
ttutytzFtzts
uuyty uy Q
kk
Q
==
=′
−+−∑ ∑
p
p
p
Parameter Estimation Subproblem
Moving Horizon Estimation?
n Estimate a finite number of states and model parameters (unmeasured disturbances, rate constants, transport parameters)
n Compensate for process drifts and slowly changing conditions
n Allow better controller performance
Model Updater( )
( )dpuyzG
dpuyzFz
,,,,0
,,,,
==′
41
81
Early Warning Detection System Municipal Water Networks
•Installed sensors provide an early warning of contamination
•System provides only a coarse measure of contamination time and location
•Desired: Accurate and fast time & location information
82
Optimization ProblemNode Concentrations &
Injection Terms Only
Pipe Boundary Concentrations
Injection Terms Only
Only Constraints with Spatial Dependence
42
83
Collapsed Node Models
Plug Flow
Complete Mixing
No Reaction
Known Sources Contaminant Free
Time Dependent Mass Injections at All Nodes (Negligible Flow rates)
Decoupled Hydraulics and Water Quality Calculations
Water Quality Model
Pipes, Valves, Pumps
Storage Tanks, Junctions
84
Modeling Water Distribution Systems
43
85
Existing Simulation Techniques
Eulerian
Discretize in time and space
Track concentration at fixed points or volumes
Local process for simulation, but global treatment needed for simultaneous optimization
Lagrangian
Discretize in time alone
Track concentration of elements as they move
Algorithmic in nature
Review of these methods by Rossman and Boulos, 1996.
Same as our Discretization
Too Many Constraints
No Straightforward Representation
Derivative Calculations?
86
Origin Tracking Algorithm
Known Hydraulics – Function of Time
Pipe Network PDEs Linear in Concentration
Pipe by Pipe PDEs
• Efficient for Large Networks
• Convert PDEs to DAEs with variable time delays
Removes Need to Discretize in Space
44
87
Water network demands known.
Linear PDEs for concentration
Convert to delay-differential equations
Apply implicit R-K formulation
Source Inversion Formulation
HydraulicSimulator(EPANET)
FormulationToolFlow
demands
88
Municipal Source Detection Example
Algorithm successful on over 1000 numerical tests with real municipal water networks
Solution time < 2 CPU minutes for ~ 250,000 variables, ~45,000 degrees of freedom
• Effective in a real time setting
Formulation tool links to existing water network software
Can impose unique solutions through an extended MIQP formulation (post-processing phase)
0
5
10
15
20
25
30
35
40
0 1 2 3 4 5 6 7 8 9 10 11 12
Time (hrs)
Sca
led
Inje
cted
Mas
s
A
B
45
89
Goal: Bridge between planning, logistics (linear, discrete problems) and detailed process models (nonlinear, spatial, dynamic)
Planning and Scheduling• Many Discrete Decisions• Few Nonlinearities
Planning
Scheduling
Site-wide Optimization
Real-time Optimization
Model Predictive Control
Regulatory Control
Fea
sibi
lity
Per
form
ance
Decision Pyramid for Process Operations
90
Real-time Optimization and Advanced Process Control• Fewer discrete decisions• Many nonlinearities• Frequent, “on-line” time-critical solutions• Higher level decisions must be feasible• Performance communicated for higher level decisions
Planning
Scheduling
Site-wide Optimization
Real-time Optimization
Model Predictive Control
Regulatory Control
Fea
sibi
lity
Per
form
ance
Decision Pyramid for Process Operations
APCMPC ⊂
Off-line (open loop)
On-line (closed loop)
46
Steady-state On-line Optimization: Components
Plant
DR-PEc(x, u, p) = 0
RTOc(x, u, p) = 0
APC
y
p
u
w
•Data reconciliation – identify gross errors and inconsistency in data•Periodic update of process model identification •Usually requires APC loops (MPC, DMC, etc.)•RTO/APC interactions: Assume decomposition of time scales
•APC to handle disturbances and fast dynamics•RTO to handle static operations
•Typical cycle: 1-2 hours, closed loop
•What if steady state and dynamic models are inconsistent? 6
92
Dynamic Real-time Optimization Integrate On-line Optimization/Control with Off-line Planning• Consistent, first-principle models• Consistent, long-range, multi-stage planning• Increase in computational complexity • Time-critical calculations
Applications• Batch processes• Grade transitions• Cyclic reactors (coking, regeneration…)• Cyclic processes (PSA, SMB…)
Continuous processes are never in steady state:
• Feed changes• Nonstandard operations
• Optimal disturbance rejections
Simulation environments (e.g., ACM, gPROMS) and first principle dynamic models are widely used for off-line studies
8
47
Some DRTO Case Studies• Integrated grade transitions
– MINLP of scheduling with dynamics (Flores & Grossmann, 2006, Prata et al., 2007)
– Significant reduction in transition times
• Dynamic Predictive Scheduling– Processes and supply chains need to optimally
respond to disturbances through dynamic models – Reduction in energy cost by factor of two
• Cyclic Process Optimization– Decoking scheduling– SMB optimization– PSA optimization– Productivity increases by factor of 2-3
9
94
•What are the Interactions between Design and Dynamics and Planning?
•What are the differences between Sequential and Simultaneous Strategies?
•Especially Important in Batch Systems
Batch Integration Case Study
Production PlanningStage 1
Stage 2
A
A B
B C
C
Plant Design
TR
Time Time
Dynamic Processing
48
95
• discretize (DAEs), state and control profiles• large-scale optimization problem• handles profile constraints directly• incorporates equipment variables directly • DAE model solved only once• converges for unstable systems
Simultaneous Dynamic OptimizationSimultaneous Dynamic OptimizationSimultaneous Dynamic OptimizationSimultaneous Dynamic Optimization
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
96
Scheduling Formulation• sequencing of tasks, products equipment• expensive discrete combinatorial optimization• consider ideal transfer policies (UIS and ZW)• closed form relations (Birewar and Grossmann, 1989)A B N
stage I
stage 2
stage I
stage 2
A B N
Zero Wait (ZW) Immediate transfer requiredSlack times dependent on pairLonger production cycle requiredUnlimited Int. Storage(UIS)Short production cycleCycle time independent of sequence
49
97
Case Study ExampleCase Study Example
zi ,I0 zi ,II
0zi ,III
0 zi ,IV0
zi ,IVf
zi ,If zi ,II
f zi ,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
98
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 m ic
C o nsta nt
Dyn a mic
C o nsta nt
Comparison of Dynamic vs. Best Constant Profiles
R0 - best constant temperature profileR1 - optimal temperature policy
C0 - best constant reflux ratioC1 - optimal reflux ratio
Scenarios in Case Study
50
99
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 II I I
I V
I
I II I I
I V
II II I I
I V
- ZW schedule becomes tighter
- less dependent on product sequences
SQ
SM*
SM
100
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
51
101
ReferencesBetts, J. T., ., Practical Methods for Optimal Control Using Nonlinear Programming, SIAM, (2001)Bryson, 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
ReferencesF. Allgöwer and A. Zheng (eds.), Nonlinear Model Predictive Control, Birkhaeuser, Basel (2000)
R. D. Bartusiak, “NLMPC: A platform for optimal control of feed- or product-flexible manufacturing,” in Nonlinear Model Predictive Control 05, Allgower, Findeisen, Biegler (eds.), Springer, to appear
Biegler Homepage: http://dynopt.cheme.cmu.edu/papers.htm
Forbes, J. F. and Marlin, T. E.. Model Accuracy for Economic Optimizing Controllers: The Bias Update Case. Ind.Eng.Chem.Res. 33, 1919-1929. 1994
Forbes, J. F. and Marlin, T. E.. “Design Cost: A Systematic Approach to Technology Selection for Model-Based Real-Time Optimization Systems,” Computers Chem.Engng. 20[6/7], 717-734. 1996
Grossmann Homepage: http://egon.cheme.cmu.edu/papers.html
M. Grötschel, S. Krumke, J. Rambau (eds.), Online Optimization of Large Systems, Springer, Berlin (2001)
K. Naidoo, J. Guiver, P. Turner, M. Keenan, M. Harmse “Experiences with Nonlinear MPC in Polymer Manufacturing,” in Nonlinear Model Predictive Control 05, Allgower, Findeisen, Biegler (eds.), Springer, to appear
Yip, W. S. and Marlin, T. E. “Multiple Data Sets for Model Updating in Real-Time Operations Optimization,” Computers Chem.Engng. 26[10], 1345-1362. 2002.
42
52
References – Some DRTO Case Studies
Busch, J.; Oldenburg, J.; Santos, M.; Cruse, A.; Marquardt, W. Dynamicpredictive scheduling of operational strategies for continuous processes using mixed-logic dynamic optimization, Comput. Chem. Eng., 2007, 31, 574-587.
Flores-Tlacuahuac, A.; Grossmann, I.E. Simultaneous cyclic scheduling andcontrol of a multiproduct CSTR, Ind. Eng. Chem. Res., 2006, 27, 6698-6712.
Kadam, J.; Srinivasan, B., Bonvin, D., Marquardt, W. Optimal grade transition in industrial polymerization processes via NCO tracking. AIChE J., 2007, 53, 3, 627-639.
Oldenburg, J.; Marquardt, W.; Heinz D.; Leineweber, D. B., Mixed-logic dynamic optimization applied to batch distillation process design, AIChE J. 2003, 48(11), 2900- 2917.
E Perea, B E Ydstie and I E Grossmann, A model predictive control strategy for supply chain optimization, Comput. Chem. Eng., 2003, 27, 1201-1218.
M. Liepelt, K Schittkowski, Optimal control of distributed systems with breakpoints, p. 271 in M. Grötschel, S. Krumke, J. Rambau (eds.), Online Optimization of Large Systems, Springer, Berlin (2001)
See also Biegler homepage
43
104
Interface of DynoPC
Output/Graphics & TextsModel in FORTRAN
F2c/C++
ADOL_C
Preprocessor
DDASSL
COLDAE
Data/Config.
Simulator/Discretizer
F/DF
Starting Point Linearization
Optimal Solution
FILTER
Reduced Space IPOPT
F/DFLine Search
Calc. of independent variable move
Interior PointNewton Step
Decomposition
DynoPC – Windows Implementation
53
105
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
106
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
54
107
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