multiple shooting with collocation: an efficient approach ... · contents 1. motivation1....

21
OpenModelica Annual Workshop 2012 Linköping , February 6, 2012 Multiple Shooting with Collocation: An Efficient Approach to Dynamic Efficient Approach to Dynamic Optimization, with Possibilities for Integration in OpenModelica Integration in OpenModelica Ines Mynttinen Jasem Tamimi Pu Li Ines Mynttinen, Jasem Tamimi, Pu Li Simulation and Optimal Processes Group (SOP) Institute of Automation and Systems Engineering Institute of Automation and Systems Engineering Ilmenau University of Technology Page 1

Upload: others

Post on 01-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

OpenModelica Annual Workshop 2012Linköping , February 6, 2012

Multiple Shooting with Collocation: An Efficient Approach to DynamicEfficient Approach to Dynamic

Optimization, with Possibilities forIntegration in OpenModelicaIntegration in OpenModelica

Ines Mynttinen Jasem Tamimi Pu LiInes Mynttinen, Jasem Tamimi, Pu Li

Simulation and Optimal Processes Group (SOP)Institute of Automation and Systems EngineeringInstitute of Automation and Systems Engineering

Ilmenau University of Technology

Page 1

Page 2: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Contents

1. Motivation1. Motivation

2. Multiple Shooting

3. Collocation on Finite Elements

4. A Case Study

5 Classification and Implementation5. Classification and Implementation

6. Conclusions

Page 2

Page 3: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Motivation: NMPC using multiple shootingMotivation: NMPC using multiple shootingwith collocation

NMPC is superior to traditional control in many cases

Critical issues:A• Accuracy

• Problem size - computational effort• Safety specifications – path constraints

Fast algorithm is needed

Page 4: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Nonlinear optimal control problem

ft⎧ ⎫⎪ ⎪

Nonlinear optimal control problem

( ) ( ) ( ) ( )( )0

, , , , , ,f

f f ft

J x y t p L x t y t u t p dt⎧ ⎫⎪ ⎪= Φ +⎨ ⎬⎪ ⎪⎩ ⎭

∫( ) ( ) ( ), , ,min

u t x t y t p

( ) ( ) ( ) ( )( )( ) ( ) ( )( )

, , , ,

0

x t f x t y t u t t p

g x t y t u t t p

= ( )0 0x t x=

t t t⎡ ⎤∈ ⎣ ⎦

s.t.

( ) ( ) ( )( )( ) ( ) ( )( )( ) ( )( )

0 , , , ,

0 , , , ,

g x t y t u t t p

h x t y t u t t p

=

0 , ft t t⎡ ⎤∈ ⎣ ⎦

( ) ( )( )( ) ( )( )

0 , ,

0 , ,e i i

i i i

r x t y t p

r x t y t p

=

Bounds of state variables, controls and parameters

Page 4

Page 5: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Multiple shootingMultiple shooting

blNMPC blproblemtransformation

NMPCproblem

problemsolution

• discretization

• parametrization

• initial guess

• objective functionp

• initial value problem (IVP)

j

• simulation

• continuity equations • continuity

• path constraints

Page 5

Page 6: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Multiple shooting – control parametrizationMultiple shooting control parametrization

v v 1N Nv v −=

( )u t( )u t

2v

0v1v2

0t 1t 2t Ntt

Page 6

Page 7: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Multiple shooting – state parametrization( )2 3 2 2; ,xx t s v

Multiple shooting state parametrization

,upper upperx u

x

( ), 0i ih s v ≥0 0 0xs x− =

v v v v

1xs 2

xs 3xs

,lower lowerx u

0v 1v 2v 3v

0t 1t 2t 3t 4 ft t=

Page 7

Page 8: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Finite dimensional NLP problemFinite dimensional NLP problem

1N −⎧ ⎫( )1

0, , ( , , )

N

N N i ii

J s p t L s v p=

⎧ ⎫= Φ +⎨ ⎬⎩ ⎭

∑0 10 1

,...,,...,

minNN

v vs s

−−

0 00 s x= −s.t.

( )( )1 10 , , ,

0 , ,i i i i i

i i

s x s v p t

g s v p+ += −

= 0,1,...,i N=

0,1,..., 1i N= −

( )( )

0 , ,

0 ,i i

e N

h s v p

r s p

=

( )0 ,i Nr s p≤

Page 8

Page 9: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Multiple shooting

( )f t

Problem formulation

( ) [ ] ( )( )

, ,

i i

x f x u t

x t x

=

=( ) [ ]

( )1, ,i i i

i i

u t t t t v

x t s+∈ →

[ ]1,i it t t +∈(0) (0)v s

( )0...i N=

,i iv s

Simulator(0) (0),i iv s

( )( ) ( )1,k k

i ix v t +

( ) ( ),k ki iv s

O ti i ( ) ( )( ) /k kij idx t ds* *,i iv s

Optimizer ( ) ( )( ) /k kij idx t dv

Page 9

Page 10: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Multiple shooting - problem solutionMultiple shooting problem solution

( ) ( )*; 0x xs x t s v− =

,upper upperx u

( ) ( )3 2 3 2 2; , 0s x t s v =

( )*

*0v *

3v( )*2

xs( )*3

xs

( ), 0i ih s v ≥0 0 0xs x− = 0

*1v

*2v

3

( )*1xs

,lower lowerx u1

0t 1t 2t 3t 4 ft t=

Page 10

Page 11: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Collocation on finite elementsCollocation on finite elements

x( 1)2ix −

( 1)2x

1it −Δ itΔ 1it +Δ

1ix2ix

( 1)1ix +

( 1)2ix +

( 1)1ix −( 1)1ix +

t t

( 1)0ix − ( 1) 0i M ix x− = ( 1)0iM ix x +=

0t ft

Page 11

Page 12: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Collocation on finite elements

( ) ( )K

Collocation on finite elements

( )K

jτ τ−( ) ( )

0ik k

kx t x l τ

=

= ∑d d d

( )0

jk

k j k j

lτ τ

ττ τ≠ =

= ∏−

ddt

d dd dt

ττ

( )

[ ]1,i i

i i

t t tt t hτ

+∈

= +

( ) ( )0

1=

= ∑K

kik

ki

lx t x

h dττ

( ) ( ),x t f x t=

( ) ( )K

kdlx h f x t

τ=∑ ( )

0,ik i

kx h f x t

dτ=

=∑

Page 12

Page 13: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Advantages ofcollocation on finite elements

• Single-step method smooth profiles requiredonly within the finite elements, discontinuity ofcontrol profiles at possible

• High-order implicit method provides accurate, 1,...,it i N=

g p pprofiles with relatively few finite elements, i.e. reduces problem sizep

• No stability limitations on element size for stiffsystemssystems

• Path constraints can be held inside the elements

Page 14: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Case study - CSTR

( ) 2 ( ) 2i ( ) ( )f x u

t N Nref ref d∑ ∑∫

Case study CSTR

0

( ) 2 ( ) 2

, 1 1min ( ) ( )ref ref

i i i i i ix u i it

w x x w u u dt= =

− + −∑ ∑∫t d l tis.t.  model equations

variable bounds

Using 50 subintervals,g ,IPOPT 3.4.0 optimizer.CPU time is 0.953 sec.

Page 14

Page 15: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Case study - CSTRCase study CSTR

mol

/l)

el x

1 (m

)

atio

nx2

(m

Tank

leve

r co

ncen

trM

olar

Time (min)

Page 15

Page 16: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Case study - CSTRCase study CSTR

l/min

)

u2 (K

)

wra

te u

1 (l

mpr

atur

eu

Out

letf

low

oola

ntte

m

O C

Time (min)

Page 16

Page 17: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Classification of methods – consequencesqfor the optimization framework

Single shooting

Multiple shooting

Simultaneousapproach

Optimizationvariables 0,..., 1

ivi N= −

,0,..., 1

i iv si N= −

,0,...,

i iv xi N K= ×

Problem size small intermediate large

Simulation 1 IVP N  IVP`s None

Path constraints

nonefulfilled at fulfilled at

, 0,...,it i N K= × , 0,...,it i N K= ×

Page 17

Page 18: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Implementation in OpenModelicaWh t i d d?What is needed?

Model Optimization problem

objectiveDiscretizerequations init

objectiveopt. variablesconstraints

Interface: f, gradient,

Simulator ( ) ( ),k ki iv s

f, gradient,g, Jacobian• Collocation

• Sensitivityyequations Optimizer

Page 18

Page 19: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

SummarySummary

Collocation method: fast accurate simulator

Multiple shoothing: reduced problem size, path constraintsMultiple shoothing: reduced problem size, path constraints incorporated

Multiple shooting with collocation: high accuracy and reduced computational effortp

Structure of the algorithm: reveals what is needed forStructure of the algorithm: reveals what is needed for implementation in OpenModelica

Page 19

Page 20: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

Many thanksMany thanksfor your attention!

Page 20

Page 21: Multiple Shooting with Collocation: An Efficient Approach ... · Contents 1. Motivation1. Motivation 2. Multiple Shooting 3. Collocation on Finite Elements 4. A Case Study 5. Classification

References[1] J. Tamimi, P. Li, A combined approach to nonlinear model predictive control of fast systems Journal of Process Control 20

References

predictive control of fast systems, Journal of Process Control, 20 (2010), 1092‐1102. [2] B. A. Finlayson, The method of weighted residuals and [ ] y , gvariational principles, Academic Press 5th edition (1972).[3] L. T. Biegler, Solution of dynamic optimization problem by successive quadratic programming and orthogonal collocation, Computers and Chemical Engineering 8  (1984), 243‐248.[4] D B Leineweber H G Bock J P Schlöder An efficient[4] D. B. Leineweber, H. G. Bock, J. P. Schlöder, An efficient multiple shooting based reduced SQP strategy for large‐scale dynamic process optimization, Computers and Chemical y p p , pEngineering 27(2), (2003), 157‐166.

Page 21