Dynamic Real-Time Optimization - HD-MPC - HD-MPC Real-Time Optimization Wolfgang Marquardt, Holger...
Transcript of Dynamic Real-Time Optimization - HD-MPC - HD-MPC Real-Time Optimization Wolfgang Marquardt, Holger...
Dynamic Real-TimeOptimization
Wolfgang Marquardt, Holger ScheuAVT – Process Systems Engineering
RWTH Aachen University
HD-MPC Industrial WorkshopJune 24, 2011Leuven, Belgium
HD-MPC Industrial Workshop, Leuven 2011 2
Two „Optimisation Strategies“
Feed B
“Exact” solution (Srinivasan et al., 2003)
What is the best feed rate B?
Feed B
Strategy 1:
• Determine optimal and feasiblefeed rate by trial and error
• Study various trajectories bydynamic simulation scenarios
• Unsystematic approach, high human effort
Simulation
Strategy 2:
• Determine optimal and feasiblefeed rate by means of dynamicoptimisation
• Dynamic optimiser systematicallysearches for the best trajectory
• Systematic and efficient approach
Optimisation
HD-MPC Industrial Workshop, Leuven 2011 3
Two „Optimisation Strategies“
Feed B
“Exact” solution (Srinivasan et al., 2003)
What is the best feed rate B?
Feed B
Strategy 1:
• Determine optimal and feasiblefeed rate by trial and error
• Study various trajectories bydynamic simulation scenarios
• Unsystematic approach, high human effort
Simulation
Strategy 2:
• Determine optimal and feasiblefeed rate by means of dynamicoptimisation
• Dynamic optimiser systematicallysearches for the best trajectory
• Systematic and efficient approach
Optimisation
Replace human effort by numerical algorithms!
Solve the inverse problem directly !
HD-MPC Industrial Workshop, Leuven 2011 4
Outline
Problem formulation for economically optimal control problemsEfficient solution methods for optimal control problems• adaptive grid refinement• structure detection• software realization
Optimal control online – Dynamic Real-Time Optimization (DRTO)• hierarchical MPC – time-scale decomposition• suboptimal NMPC – Neighboring Extremal Updates• software realization
Distributed MPC – a new approach for DRTO
HD-MPC Industrial Workshop, Leuven 2011 5
Outline
Problem formulation for economically optimal control problemsEfficient solution methods for optimal control problems• adaptive grid refinement• structure detection• software realization
Optimal control online – Dynamic Real-Time Optimization (DRTO)• hierarchical MPC – time-scale decomposition• suboptimal NMPC – Neighboring Extremal Updates• software realization
Distributed MPC – a new approach for DRTO
HD-MPC Industrial Workshop, Leuven 2011 6
Large-scale industrial process (Shell):• How fast can an intermediate chemicals plant be moved from operating point A to B ?
Some Sample Problems
Olefine polymerization process (Novolen):• Can we decide on a production schedule and optimize grade transitions simultaneously ?
Membrane bioreactor for waste water treatment (Koch Membrane Systems):• Can we minimize energy demand and reduce membrane stress in real time?
Styrene-butylacrylate co-polymerization (BASF):• Is real-time optimization ready for use in thechemical industries to increase productivity andimprove process operability?
HD-MPC Industrial Workshop, Leuven 2011 7
decision variables: u(t) time-variant control variables
p time-invariant parameters
tf final time
Mathematical Problem Formulation
))((min,),( ftptu
txf
Φ objective function (e.g. economics)
endpoint constraints (e.g. specs.)))((0
,],[),,,,(0,)(0
,],[),,,,(
0
00
0
f
f
f
txE
ttttpuxPxtx
ttttpuxFxM
≥
∈≥−=
∈=&DAE system (process model)
path constraints (e.g. temp. bound)
HD-MPC Industrial Workshop, Leuven 2011 8
Sequential Solution Strategy
Control vector parameterization
∑Λ∈
≈ik
kikii tctu )()( ,, φ
)(, tkiφ parameterizationfunctions
kic , parameterst
ui(t)
φi,k(t)ci,k
Reformulation as nonlinear programming problem (NLP)
)),,((min,, ftpc
tpcxf
Φ
))((0,),,,,(0
f
ii
txEttpcxP
≥Τ∈∀≥s.t.
DAE system solved byunderlying numericalintegration
Gradients for NLP solver typically obtained by integration of sensitivity systems
How to keep number of sensitivity integrations low?
HD-MPC Industrial Workshop, Leuven 2011 9
Outline
Problem formulation for economically optimal control problemsEfficient solution methods for optimal control problems• adaptive grid refinement• structure detection• software realization
Optimal control online – Dynamic Real-Time Optimization (DRTO)• hierarchical MPC – time-scale decomposition• suboptimal NMPC – Neighboring Extremal Updates• software realization
Distributed MPC – a new approach for DRTO
HD-MPC Industrial Workshop, Leuven 2011 11
Adaptive Refinement of Control Parameterization
refine
• Concepts from signal analysis
• Grid point elimination
• Grid point insertion
Mesh analysis
coarse initial mesh
eliminate refinewavelet
analysis
re-solve optimization
until stopping criterion met.
re-solve optimization
…
(Schlegel and Marquardt, 2005)
HD-MPC Industrial Workshop, Leuven 2011 12
A typical input trajectory …
0 50 100 150 200 2500
0.2
0.4
0.6
0.8
1 x 10-3
0 50 100 150 200 2500
0.2
0.4
0.6
0.8
1 x 10-3
piecewiseconstant sol.
piecewiselinear sol.
analytical sol. (Srinivasan et al.,
2003) Is there a way to detect switching structure from numerical solution?
Obvious open issues•how to capture switching points?• how to avoid over-parameterization?
HD-MPC Industrial Workshop, Leuven 2011 13
Switching Structure Detection
1. Solve coarsely discretized single-stage problem (SSP)
2. Determine the switching structure from NCO of NLP
3. Reformulate as a multi-stage problem (MSP) according to switching structure
(Schlegel and Marquardt, 2006)
usens
umin
umax
umax
umin
usens
MSP (black): 6 parameters!Conventional SSP (blue): 25 parameters!
8 parameters
HD-MPC Industrial Workshop, Leuven 2011 14
• complex reaction mechanism• large-scale model (~ 2000 equations)• 3 input variables, 6 path constraints
process operation tasks:• optimal load change• optimal grade change
Does it Work? – Let’s Try …
separation
cooling water
TC
Polymer
CV 2: viscosityCV 1: conversion [%]
MV 3: recycle monomer [kg/h]
LC
buffertank
monomercatalyst
MV 2: catalyst [kg/h]
MV 1: fresh monomer [kg/h]
post processing
reactor
Continuous Polymerization Process (Bayer AG, Dünnebier et al., 2004)
HD-MPC Industrial Workshop, Leuven 2011 15
Illustration of Adaptation Strategy
0 0.5 1-11 3 5 7 9
0 0.5 10
0.5
1
t/tref
0 0.5 1-11 3 5 7 9
0 0.5 10
0.5
1
t/tref
0 0.5 1-11 3 5 7 9
0 0.5 10
0.5
1
t/tref
MV 1: monomer feed MV 2: catalyst feed MV 3: recycle flowrate
Iteration 1
HD-MPC Industrial Workshop, Leuven 2011 16
Illustration of Adaptation Strategy
0 0.5 1-11 3 5 7 9
0 0.5 1 0
0.5
1
t/tref
0 0.5 1-11 3 5 7 9
0 0.5 1 0
0.5
1
t/tref
0 0.5 1-11 3 5 7 9
0 0.5 1 0
0.5
1
t/tref
MV 1: monomer feed MV 2: catalyst feed MV 3: recycle flowrate
Iteration 3
HD-MPC Industrial Workshop, Leuven 2011 17
Illustration of Adaptation Strategy
0 0.5 1-11 3 5 7 9
0 0.5 10
0.5
1
t/tref
0 0.5 1-11 3 5 7 9
0 0.5 10
0.5
1
t/tref
0 0.5 1-11 3 5 7 9
0 0.5 10
0.5
1
t/tref
MV 1: monomer feed MV 2: catalyst feed MV 3: recycle flowrate
Iteration 6
HD-MPC Industrial Workshop, Leuven 2011 18
0 0 .25 0.5 0 .75 1 0
0 .5
1
t/tre f
y 1
0 0 .25 0.5 0 .75 1 0
0 .5
1
t/tre f
u 3
0 0 .25 0.5 0 .75 1 0
0 .5
1
t/tre f
u 1
0 0 .25 0.5 0 .75 1
0 .75
1
t/tre f
y 2
Non-adaptive Algorithm
MV 1:fresh monomer
constraint 1:reactor outlet
constraint 2: buffer tank volume
MV 3: recycle flowrate
HD-MPC Industrial Workshop, Leuven 2011 19
0 0 .25 0.5 0 .75 1 0
0 .5
1
t/tre f
y 1
0 0 .25 0.5 0 .75 1 0
0 .5
1
um in
upath
upathupathum ax
t/tre f
u 1
0 0 .25 0.5 0 .75 1 0
0 .5
1
upath
upath
upathum in upath
t/tre f
u 30 0 .25 0.5 0 .75 1
0 .75
1
t/tre f
y 2
Adaptive Algorithm with Structure Detection
MV 1:fresh monomer
constraint 1:reactor outlet
constraint 2: buffer tank volume
MV 3: recycle flowrate
HD-MPC Industrial Workshop, Leuven 2011 20
DyOS – Dynamic Optimization System
DyOS yes
no
optimal trajectory
gridrefinement
DAEintegrator
stopping criterion
ESO
u(t)
u(t)
u(t)
u(t)
NLPsolver
initial trajectory
DyOS
SetVariables
ESO
model server(e.g. gPROMS)
processmodel
ESO
CAPE-OPEN compliantsoftwareinterface
CORBA Object Bus
GetResiduals
gPROMS(PSE Ltd.)
AC-SAMMM (joint work with Uwe Naumann, RWTH Aachen):Structured Automatic Manipulation of Mathematical Models (Poster Session)
Modelica: Open sourceobject-oriented modeling language
Modelica-model
Transl.
Modelica-modelModelica
Modelica-modelModelica-modelC-+
DCC
Modelica-modelModelica-modelDLL
ESO
http://wiki.stce.rwth-aachen.de/bin/view/Projects/ERS/WebHome
HD-MPC Industrial Workshop, Leuven 2011 25
Outline
Problem formulation for economically optimal control problemsEfficient solution methods for optimal control problems• adaptive grid refinement• structure detection• software realization
Optimal control online – Dynamic Real-Time Optimization (DRTO)• hierarchical MPC – time-scale decomposition• suboptimal NMPC – Neighboring Extremal Updates• software realization
Distributed MPC – a new approach for DRTO
HD-MPC Industrial Workshop, Leuven 2011 26
Dynamic Real-Time Optimization
dynamicdata recon-
ciliation
decisionmaker
optimal control
processincluding
base control
cδ)(tuc
)(td
)(tdr
)( cr tx
cδ
)(tη
h,Φoptimizing feedbackcontrol system
process includingbase layer control
• economical objectives & constraints
• optimal output feedback
• solution of optimization problemsat sampling frequency
• computationally demanding, limitedby model complexity
timecontrol
predictionreconciliation
manipulated variables
statesmeasurements
HD-MPC Industrial Workshop, Leuven 2011 27
decisionmaker
trackingcontroller
processincluding
base control
h,Φ
cδ)()()( tututu cc Δ+=
)(td
)(0 td)(0 ctx
cδ
optimal trajectory
design
long time scaledynamic datareconciliation
short time scaledynamic datareconciliation
time scaleseparator
)(tdΔ)(0 ctx
)(),(),( tutytx ccc
)(0 tη
)(tηΔ
0δ0δ Ψ
Time-Scale Decomposition
optimizing feedback control system
fast time-scale• measurement andprocess noise …
• trajectory trackingsatisfying controlbounds and qualityconstraints!
slow time-scale• changing environment,process variations …
• most economicaltrajectory satisfyingsafety or equipmentconstraints!
How can we achieve economic optimality on the fastertime-scale? Fast Updates
HD-MPC Industrial Workshop, Leuven 2011 29
Fast Neighboring Extremal Updates
θ
parameterize uncertainty exploit sensitivity information of previously solved optimization problem to generate an approximation of the optimal update
⎥⎦
⎤⎢⎣
⎡
⋅
⋅−=⎥
⎦
⎤⎢⎣
⎡
⎥⎥⎦
⎤⋅−
⎢⎢⎣
⎡
⋅
⋅
)(
)(
0
)(
)(
)( ,
,θ
θ
θ
θ
λ g
Lpgg
L pTa
pTa
p
pp
0)(:
)()(:
)()(:
0
00
00
=−=Δ
Δ=−=Δ
Δ=−=Δ
inainaina
aaaa
pppp
λθλλ
θθλλθλλ
θθθ
θ
θ
Sensitivity system (Fiacco, 1983), invariant active set L: Lagrange functionf: objective functiong: constraintsp: discretized controls: uncertain param.
refrefrefp
refTp
refp
Trefpp
T
z
ggpg
pfpLpLp
+Δ−≥Δ
Δ+ΔΔ+ΔΔΔ
θ
θ
θ
θ
s.t.
5.0min ,
Changing active set (Ganesh & Biegler, 1987)
• compute first- and second-order derivatives
• solve QP for fast update• re-iterate if necessary
(Kadam & Marquardt, 2004;Würth et al., 2009)
θθ ggfLL ppppp ,,,,
HD-MPC Industrial Workshop, Leuven 2011 30
Efficient Computation of 2nd order Sensitivities
Superposition principlefor the linear adjoint system: only one 2nd order adjoint system
0.00
1.00
2.00
3.00
4.00
5.00
6.00
7.00
8.00
9.00
0 100 200 300 400 500
Number of parameters np
Cpu
(s)
JacobianHessian
Hessianevaluationscales !
Williams-Otto benchmark problem
finite differences and 2nd order forward sensitivities (Vassiliadis et al., 1999) scale O(np
2) adjoint sensitivity analysisfor problems without path constraints (Cao et al., 2003, Özyurt et al., 2005)
2nd order adjoint sensitivityanalysis for path-constrainedproblems (Hannemann & M.,2007, 2010) NIXE
HD-MPC Industrial Workshop, Leuven 2011 31
Software Realization – DRTO Toolbox (1)
standalone OPC Server
State Estimator
DRTO Module
MPC module
plant simulation
Use plant simulator for development of advanced MPC control methodsTest communication, data exchange and alert management offline
Develop algorithms in Matlab, gPROMS, C++, ... OPC Clients
OPC data access
...
HD-MPC Industrial Workshop, Leuven 2011 32
Software Realization – DRTO Toolbox (2)
(Data structure in plant simulation should be the same as in PCS)
standalone OPC Server
PlantProcess control system
Connect the control methods to the real control process through the plant’s control system
integrated OPC Server
State Estimator
DRTO Module
MPC module
plant simulation
OPC Clients
OPC data access
...
Name der Präsentation, 20.03.2008 33HD-MPC Industrial Workshop, Leuven 2011 33
Software Realization – DRTO Toolbox (3)
HD-MPC Industrial Workshop, Leuven 2011 34
Case Study – Continuous Polymerization Process (1)
Large-scale industrial process (Bayer AG, Dünnebier et al., 2004)• ~ 200 (dynamic) state variables• ~ 2000 algebraic variables• 3 manipulated variables• Task: Set point change from polymer A to B
• Disturbance: Ratio of monomer 1 and monomer 2
d
HD-MPC Industrial Workshop, Leuven 2011 35
Case Study – Continuous Polymerization Process (2)
Reference control strategy• Objective value: 0.59• Constraint violations: 1.6
Delayed Single-Layer DRTO• Objective value: 1.18• Constraint violations: 16.2
Single Layer: NeigboringExtremal Updates (NEU)
• Objective value: 0.74• Constraint violations: 2.0
Two-Layer (DRTO and NEU)• Objective value: 0.61• Constraint violations: 2.1
(Würth et al., 2011)
HD-MPC Industrial Workshop, Leuven 2011 39
On-Site and Software Implementation
Inca OPC-Server(IPCOS)
Process control system/Process
Dynamic optimization(DyOS, Matlab)
Sampling rate 120 s
MPC-Controller(Matlab)
Sampling rate 10 s
(Matlab)Sampling rate 10 s
State estimation
Measurements
States,
Controls
Controls
States,Measurements
Controls,States
How can we overcome limitations in the size of the process considered?
Distributed MPC
HD-MPC Industrial Workshop, Leuven 2011 40
Outline
Problem formulation for economically optimal control problemsEfficient solution methods for optimal control problems• adaptive grid refinement• structure detection• software realization
Optimal control online – Dynamic Real-Time Optimization (DRTO)• hierarchical MPC – time-scale decomposition• suboptimal NMPC – Neighboring Extremal Updates• software realization
Distributed MPC – a new approach for DRTO
HD-MPC Industrial Workshop, Leuven 2011 41
Parellization via Problem Decomposition
Applications can usually naturally be decomposed into subsystems• connected via interconnecting
variables• local inputs• local outputs P1
P2
P3 P4 P5
P1 P2 P3 P4 P5
Pu1 u2 u3 u4 u5
y1 y2 y3 y4 y5
HD-MPC Industrial Workshop, Leuven 2011 42
Decomposition of Optimization Problem
separable objective function∑=
Φ=ΦN
ifiifptu
txtx1),(
))(())((min
separable endpoint constraints
separable DAE system
separable path constraints
),(0
],,[),,,,(0,)(0
],,[),,,,(
0
0,0
0
fi
fiiii
ii
fiiiiii
tE
ttttpuxPxtx
ttttpuxFxM
≥
∈≥
−=
∈=&
additional nonseparableinteractions (here eq. constr.)
TTTii uxHm ],[0 −=
},...,2,1{ Ni∈
HD-MPC Industrial Workshop, Leuven 2011 43
Solution Strategies for Decomposed Problems (1)
Reformulation as set of NLPs
s.t.DAE system solved byunderlying independentnumerical integration
)),,((min, iiiiipc
pmcxii
Φ},...,2,1{ Ni∈
,,),,,(0
)),((0,),,,,(0
1
Tttmcxh
txETttpcxP
k
N
ikiiii
fii
kkiiii
∈∀=
≥∈∀≥
∑=
nonseparableinteractions
Primal decomposition (Silverman 1972)
s.t.,),,,,( Tttmcxh kkiiiii ∈∀=γ
M
)),,((min, iiiiipc
pmcxii
Φ
resource allocation s.t. ∑=
=N
ii
10 γ
Dual decomposition (Lasdon 1970)
s.t.
)),,,((min,,
λiiiiimpcpmcxL
iii
(...)(...))),,,(( iT
iiiiii hpmcxL λλ +Φ=
M
price coordination s.t. ∑=
=N
iih
1
0
HD-MPC Industrial Workshop, Leuven 2011 44
Solution Strategies for Decomposed Problems (2)
Sensitivity-Driven Distributed Model-Predictive Control (S-DMPC) (Scheu, Marquardt, 2011)
Application of the linearized partial goal-interaction operator (Mesarovic et al.1970)
linearized information of nonlocal objective functionscopy of the local objective function
Cost function of the distributed controllers
HD-MPC Industrial Workshop, Leuven 2011 45
Alkylation of Benzene Process
(J. Liu et al. 2010)
SubsystemsInputs
HD-MPC Industrial Workshop, Leuven 2011 46
Mathematical model
For each subsystem:Mass balances for each species and energy balance
For CSTRs:reaction kinetics
For flash separator:phase equilibrium descriptions
Medium scale DAE system:- 25 differential equations- ~100 algebraic equations
HD-MPC Industrial Workshop, Leuven 2011 48
Results
S-DMPC provides the same controller performance as a centralized MPC
Solve 5 small QP in parallel instead of 1 large QP
faster computation possible
(Scheu and Marquardt, 2011)
HD-MPC Industrial Workshop, Leuven 2011 49
Algorithms for dynamic optimization are continuously maturing• basis for DRTO, reduce computing time• still many challenges ahead, e.g. discontinuous and mixed integer
problems
Hierarchical and distributed MPC are enabling technologies for real-time applications
Hierarchical MPC Methods already successfully applied to large-scale industrial processes (simulation and experiments)
Distributed MPC is a key technology to apply DRTO to even larger plants• methods are maturing• have to be integrated into DRTO toolbox
Conclusions & Future Perspectives
HD-MPC Industrial Workshop, Leuven 2011 50
Acknowledgements
PhD students• Jan Busch, Bayer Technology Services• Ralf Hannemann, AVT.PT• Arndt Hartwich, Bayer Technology Services• Jitendra Kadam, Exxon Chemicals• Jan Oldenburg, BASF• Adrian Prata, Bayer Technology Services• Martin Schlegel, BASF• Lynn Würth, Bayer Technology Services
Funding• BASF• Shell Global Solutions• German Research Foundation• European Union