OCPID-DAE1 Optimal Control and Parameter Identification with Differential-Algebraic Equations of Index 1



Similar documents
The Transport Equation

Chapter 7. Response of First-Order RL and RC Circuits

Mathematics in Pharmacokinetics What and Why (A second attempt to make it clearer)

Differential Equations. Solving for Impulse Response. Linear systems are often described using differential equations.

Stochastic Optimal Control Problem for Life Insurance

AP Calculus BC 2010 Scoring Guidelines

AP Calculus AB 2013 Scoring Guidelines

Inductance and Transient Circuits

A Note on Using the Svensson procedure to estimate the risk free rate in corporate valuation

Economics Honors Exam 2008 Solutions Question 5

Multiprocessor Systems-on-Chips

11/6/2013. Chapter 14: Dynamic AD-AS. Introduction. Introduction. Keeping track of time. The model s elements

Optimal Control Formulation using Calculus of Variations

RC (Resistor-Capacitor) Circuits. AP Physics C

Differential Equations and Linear Superposition

Term Structure of Prices of Asian Options

Random Walk in 1-D. 3 possible paths x vs n. -5 For our random walk, we assume the probabilities p,q do not depend on time (n) - stationary

Capacitors and inductors

MTH6121 Introduction to Mathematical Finance Lesson 5

9. Capacitor and Resistor Circuits

17 Laplace transform. Solving linear ODE with piecewise continuous right hand sides

cooking trajectory boiling water B (t) microwave time t (mins)

ANALYSIS AND COMPARISONS OF SOME SOLUTION CONCEPTS FOR STOCHASTIC PROGRAMMING PROBLEMS

Signal Processing and Linear Systems I

Steps for D.C Analysis of MOSFET Circuits

Technical Appendix to Risk, Return, and Dividends

Appendix A: Area. 1 Find the radius of a circle that has circumference 12 inches.

AP Calculus AB 2010 Scoring Guidelines

DYNAMIC MODELS FOR VALUATION OF WRONGFUL DEATH PAYMENTS

CHARGE AND DISCHARGE OF A CAPACITOR

Module 4. Single-phase AC circuits. Version 2 EE IIT, Kharagpur

Miguel Jerez Sonia Sotoca José Casals. Universidad Complutense de Madrid

Name: Algebra II Review for Quiz #13 Exponential and Logarithmic Functions including Modeling

Task is a schedulable entity, i.e., a thread

The Application of Multi Shifts and Break Windows in Employees Scheduling

PROFIT TEST MODELLING IN LIFE ASSURANCE USING SPREADSHEETS PART ONE

INTEREST RATE FUTURES AND THEIR OPTIONS: SOME PRICING APPROACHES

Chapter 5. Aggregate Planning

Chapter 8: Regression with Lagged Explanatory Variables

Strategic Optimization of a Transportation Distribution Network

TEMPORAL PATTERN IDENTIFICATION OF TIME SERIES DATA USING PATTERN WAVELETS AND GENETIC ALGORITHMS

Hedging with Forwards and Futures

Volume Weighted Average Price Optimal Execution

E0 370 Statistical Learning Theory Lecture 20 (Nov 17, 2011)

Part II Converter Dynamics and Control

Vector Autoregressions (VARs): Operational Perspectives

Real-time Particle Filters

A Probability Density Function for Google s stocks

Network Discovery: An Estimation Based Approach

adaptive control; stochastic systems; certainty equivalence principle; long-term

Monte Carlo Observer for a Stochastic Model of Bioreactors

AP Calculus AB 2007 Scoring Guidelines

Answer, Key Homework 2 David McIntyre Mar 25,

Optimal Stock Selling/Buying Strategy with reference to the Ultimate Average

The naive method discussed in Lecture 1 uses the most recent observations to forecast future values. That is, Y ˆ t + 1

Verification Theorems for Models of Optimal Consumption and Investment with Retirement and Constrained Borrowing

Why Did the Demand for Cash Decrease Recently in Korea?

Cointegration: The Engle and Granger approach

A Simple Introduction to Dynamic Programming in Macroeconomic Models

Transient Analysis of First Order RC and RL circuits

Gene Regulatory Network Discovery from Time-Series Gene Expression Data A Computational Intelligence Approach

Pulse-Width Modulation Inverters

Risk Modelling of Collateralised Lending

1. y 5y + 6y = 2e t Solution: Characteristic equation is r 2 5r +6 = 0, therefore r 1 = 2, r 2 = 3, and y 1 (t) = e 2t,

Dynamic programming models and algorithms for the mutual fund cash balance problem

APPLICATION OF THE KALMAN FILTER FOR ESTIMATING CONTINUOUS TIME TERM STRUCTURE MODELS: THE CASE OF UK AND GERMANY. January, 2005

OPERATION MANUAL. Indoor unit for air to water heat pump system and options EKHBRD011ABV1 EKHBRD014ABV1 EKHBRD016ABV1

Supplementary Appendix for Depression Babies: Do Macroeconomic Experiences Affect Risk-Taking?

Duration and Convexity ( ) 20 = Bond B has a maturity of 5 years and also has a required rate of return of 10%. Its price is $613.

Permutations and Combinations

Adaptive Optics PSF reconstruction at ALFA

arxiv:math/ v1 [math.co] 30 Nov 2001

A Curriculum Module for AP Calculus BC Curriculum Module

Lectures # 5 and 6: The Prime Number Theorem.

Bayesian Filtering with Online Gaussian Process Latent Variable Models

Making a Faster Cryptanalytic Time-Memory Trade-Off

A Generalized Bivariate Ornstein-Uhlenbeck Model for Financial Assets

PRESSURE BUILDUP. Figure 1: Schematic of an ideal buildup test

Full-wave rectification, bulk capacitor calculations Chris Basso January 2009

Credit Index Options: the no-armageddon pricing measure and the role of correlation after the subprime crisis

Behavior Analysis of a Biscuit Making Plant using Markov Regenerative Modeling

Present Value Methodology

Single-machine Scheduling with Periodic Maintenance and both Preemptive and. Non-preemptive jobs in Remanufacturing System 1

Time Series Analysis Using SAS R Part I The Augmented Dickey-Fuller (ADF) Test

Dependent Interest and Transition Rates in Life Insurance

Transcription:

Tuorial OCPID-DAE1 Opimal Conrol and Parameer Idenificaion wih Differenial-Algebraic Equaions of Index 1 May 16, 213 Address of he Auhor: Prof. Dr. Mahias Gerds Insiu für Mahemaik und Rechneranwendung Fakulä für Luf- und Raumfahrechnik Universiä der Bundeswehr München Werner-Heisenberg-Weg 39, 85577 Neubiberg, Germany Email : mahias.gerds@unibw.de WWW : www.unibw.de/lr1/gerds Copyrigh c 213 by Mahias Gerds

1 Problem Formulaion The package OCPID-DAE1 wih a Forran 9 inerface is designed for he numerical soluion of opimal conrol problems and parameer idenificaion problems of he subsequen form. Le [, f ] R be a non-empy and bounded inerval wih fixed ime poins < f. Le ϕ : R nx R nx R R np R, F : [, f ] R nx R nx R nu R np R nx, f : [, f ] R nx R nu R np R nx, H : [, f ] R nx R nu R np R, ψ : R R R nx R nx R nu R nu R np R n ψ, g : [, f ] R nx R nu R np R ng, M : [, f ] R nx R nu R np R nx nx be mappings. We consider Problem 1 (Opimal Conrol Problem (OCP)) Find a sae variable x( ) : [, f ] R nx, an essenially bounded conrol variable u( ) : [, f ] R nu, and a parameer vecor p R np such ha he objecive funcion L ϕ(x( ), x( f ), f, p) + H(ξ i, x(ξ i ), u(ξ i ), p) (1) i=1 is minimized subjec o he implici differenial equaion (DAE) = F (, x(), ẋ(), u(), p), a.e. in [, f ], (2) he boundary condiions ψ ψ(, f, x( ), x( f ), u( ), u( f ), p) ψ, (3) he sae consrains g g(, x(), u(), p) g, a.e. in [, f ], (4) and he box consrains and u u() u, a.e. in [, f ] (5) p p p. (6) Herein, ξ i [, f ], i = 1,..., L, L N, are opionally given ime poins, which may denoe ime poins a which measuremens of he dynamic process are available. The funcion H can be used o model parameer idenificaion problems.

The algorihm is paricularly designed for he following wo subclasses of he general DAE (2): ODEs: = M(, x(), u(), p) ẋ() f(, x(), u(), p), a.e. in [, f ], (7) wih non-singular marix M( ). Index-1 DAEs: = F (, x d (), y(), ẋ d (), u(), p) a.e. in [, f ], (8) where he sae x = (x d, y) R nx is separaed ino differenial variables x d R nx ny and algebraic variables y R ny. The marix [ F y F ẋ ] d is assumed o be non-singular a.e. in [, f ]. In his case, he DAE (8) has differenial index 1. Noice, ha no derivaives of he algebraic variables y occur. 2 Seing up he Minimum Energy Problem in ODE Formulaion The minimum energy problem reads as Problem 2 (Minimum Energy, ODE Formulaion) Minimize subjec o he consrains 1 2 1 u() 2 d ẋ 1 () = x 2 (), x 1 () =, x 1 (1) =, ẋ 2 () = u(), x 2 () = 1, x 2 (1) = 1, x 1 () 1 9 In order o fi he problem ino problem class 1, we inroduce a new sae x 3 wih Noe ha x 3 (1) = 1 2 1 ẋ 3 () = 1 2 u()2, x 3 () =. u() 2 d and hus we can rewrie Problem 2 as

Problem 3 (Minimum Energy, ODE Formulaion) Minimize x 3 (1) } L ϕ(x( ), x( f ), f, p) + H(ξ i, x(ξ i ), u(ξ i ), p) i=1 subjec o he consrains ẋ 1 () = x 2 () ẋ 2 () = u() ẋ 3 () = 1 2 u()2 x 1 () 1 x 2 () 1 x 3 () x 1 (1) 1 x 2 (1) 1 x 1 () 1 9 u() } } M(, x(), u(), p)ẋ() = f(, x(), u(), p) ψ ψ(, f, x( ), x( f ), u( ), u( f ), p) ψ g g(, x(), u(), p) g u u() u Problem 3 fis ino he forma of Problem 1 wih x = (x 1, x 2, x 3 ), =, f = 1, ϕ(x( ), x( f )) = x 3 (1), H(ξ, x, u, p) =, M(, x, u, p) = I 3 3, f(, x, u, p) = (x 2, u, 1 2 u2 ), ψ = (, 1,,, 1), ψ = (, 1,,, 1), ψ(, f, x( ), x( f ), u( ), u( f ), p) = (x 1 (), x 2 (), x 3 (), x 1 (1), x 2 (1)), g =, g = 1 9, g(, x, u, p) = x 1, u =, u =, and p is no presen in his problem. Wih his, we can now sar o ener he daa in OCPID-DAE1. We use he emplae file ProblemTemplae.f9. Below only he relevan enries for Problem 3 are described.

Define dimensions of he problem: DIM(1) = 3! number NX of saes DIM(2) = 1! number NU of conrols DIM(3) =! number NP of opimizaion parameers DIM(4) = 1! number NG of sae consrains DIM(5) = 2! number NBC of boundary condiions in BDCOND DIM(6) = 28! number NGITU of conrol grid poins DIM(7) = 1! number NGITX of shooing nodes! (one for single shooing, >1 for muliple shooing) DIM(8) =! number NROOT of swiching funcions! (zero for sandard opimal conrol problems) DIM(9) =! number NY of algebraic variables in x DIM(1) =! number NMEASURE of measure poins xi_i in funcion H! (zero for sandard opimal conrol problems) Noe ha DIM(5)=2, because we will merely ener he erminal consrains x 1 (1) and 1 x 2 (1) 1 in he subrouine BDCOND, which conains he funcion ψ. The remaining boundary condiions, which fix he iniial sae, will be enered direcly in he arrays XL and XU, in which lower and upper bounds for he iniial sae are provided. This is more convenien han defining he laer as nonlinear consrains hrough he subrouine BDCOND, which would be possible as well. Nex, we define conrol parameers of he opimal conrol algorihm: INFO(1) =! flag equidisan grids (=) or non-equidisan grids (=1) INFO(2) = 11! inegraor (11=classic RK), see user s guide for a lis INFO(3) = 2! conrol approximaion by B-splines! (1=piecewise consan, 2=coninuous, piecewise linear,...) INFO(4) = 1! = inegraion mode (no opimizaion)! > = opimizaion mode INFO(5) = 1! mehod for gradien calculaion (1= sensiiviy DAE) INFO(6) =! srucure of marix F _{x } and M, respecively! ( = consan and diagonal) INFO(7) =! flag for ieraion marix (no relevan for his problem) INFO(8) =! flag for jacobian of sae consrains! ( = approximaion by finie differences,! 1 = provide jacobian marix in subrouine JACNLC by user) INFO(9) = 6! oupu will be prined o oupu file wih his number (6=screen) INFO(1)= 1! flag for finie differences! (1 = forward differences are used,! = cenral finie differences are used,! -1 = backward differences are used)

INFO(11)=! compuaion of consisen iniial values for index-1 DAEs! (no relevan for his problem) Nex we can conrol how he iniial guess will be provided and how he resuls will be sored: IINMODE =! = iniial guess for saes a shooing nodes are provided! in subrouine INESTX, iniial guess for conrols is provided in subrouine INESTU! <> = iniial guess is provided in array SOL IOUTMODE = 3! 1 = oupu of soluion will be wrien o files! 2 = oupu of soluion will be wrien o arrays! TIME,STATE,CONTROL,PARAMETERS,SCONSTRAINTS,DSOLREALTIME! 3 = oupu of soluion will be wrien o boh, files and variables If we like o perform a parameric sensiiviy analysis w.r.. o some model parameers, which are sored in USER(IUSER(I)) for I=1,...,NREALTIME, we could se appropriae daa hrough IREALTIME, NREALTIME, HREALTIME, bu in his example, we don do ha and se IREALTIME = NREALTIME = 2 HREALTIME = 1.D-3 We swich on adjoin esimaion by seing IADJOINT = 1 Nex we define he iniial ime = and he lengh of he ime inerval f = 1: T() =.D! provide iniial ime of opimal conrol problem T(1) = 1.D! provide lengh f- of opimal conrol problem Now we ener he lower and upper bounds for he inial sae x():

! provide lower and upper bounds for iniial sae x() XL(,1) =.D XL(,2) = 1.D XL(,3) =.D XU(,1) =.D XU(,2) = 1.D XU(,3) =.D! provide lower and upper bounds for saes a muliple shooing nodes in (,f) XL(1,1:DIM(1)) = -1.D+2 XU(1,1:DIM(1)) = 1.D+2 Noe ha XL(,.) and XU(,.) refer o he lower and upper bounds a and XL(1,.) and XU(1,.) refer o lower and upper bounds for he sae a he shooing nodes. The laer only become relevan if DIM(7)>1. Nex we define u and u a, < < f and f :! provide lower and upper bounds for iniial conrol u() UL(-1,1:DIM(2)) = -1.D+2 UU(-1,1:DIM(2)) = 1.D+2! provide lower and upper bounds for conrols u(), <<f UL(,1:DIM(2)) = -1.D+2 UU(,1:DIM(2)) = 1.D+2! provide lower and upper bounds for erminal conrol u(f) UL( 1,1:DIM(2)) = -1.D+2 UU( 1,1:DIM(2)) = 1.D+2 Lower and upper bounds g and g are defined by: G(,1) = -1.D+2! lower bound g_l for sae consrain g_l <= g(,x(),u(),p) <= g_u G(1,1) = 1.D/9.D! upper bound g_u for sae consrain g_l <= g(,x(),u(),p) <= g_u Likewise, lower and upper bounds ψ and ψ are defined by he following. Please noe ha we merely ener he erminal consrains x 1 (1) and 1 x 2 (1) 1 in he subrouine BDCOND, which conains he funcion ψ. Only for hese consrains he lower and upper bounds are defined below. The remaining iniial condiions have been considered in XL and XU.

BC(,1) =.D! lower bound in <= x_1(1) <= BC(,2) = -1.D! lower bound in -1 <= x_2(1) <= -1 BC(1,1) =.D! upper bound in <= x_1(1) <= BC(1,2) = -1.D! upper bound in -1 <= x_2(1) <= -1 This complees he enries for he saic componens in he opimal conrol problem. Now we need o define he dynamic componens. We sar wih he objecive funcion ϕ: SUBROUTINE OBJ( X, XF, TF, P, V, IUSER, USER ) DOUBLEPRECISION, DIMENSION(*), INTENT(IN) :: X,XF,P :: TF DOUBLEPRECISION, INTENT(OUT) :: V V = XF(3) END SUBROUTINE OBJ The funcion H is no presen in he minimum energy problem, hence we se: SUBROUTINE HFUNC( I,T,X,U,P,HVAL,IUSER,USER ) INTEGER, INTENT(IN) :: I DOUBLEPRECISION, DIMENSION(*), INTENT(IN) :: X,U,P :: T DOUBLEPRECISION, INTENT(OUT) :: HVAL HVAL =.D END SUBROUTINE HFUNC The righ handside f is defined in DAE as follows: SUBROUTINE DAE( T, X, XP, U, P, F, IFLAG, IUSER, USER )

INTEGER, INTENT(IN) :: IFLAG DOUBLEPRECISION, DIMENSION(*), INTENT(IN) :: X,XP,U,P :: T DOUBLEPRECISION, DIMENSION(*), INTENT(OUT) :: F F(1) = X(2) F(2) = U(1) F(3) =.5D*U(1)**2 END SUBROUTINE DAE The funcion g is defined in NLCSTR as follows: SUBROUTINE NLCSTR( T, X, U, P, G, IUSER, USER ) DOUBLEPRECISION, DIMENSION(*), INTENT(IN) :: X,U,P :: T DOUBLEPRECISION, DIMENSION(*), INTENT(OUT) :: G G(1) = X(1) END SUBROUTINE NLCSTR The boundary condiions ψ are provided hrough BDCOND: SUBROUTINE BDCOND( T,TF,X,XF,U,UF,P,PSI,IUSER,USER ) DOUBLEPRECISION, DIMENSION(*), INTENT(IN) :: X,XF,U,UF,P :: T,TF DOUBLEPRECISION, DIMENSION(*), INTENT(OUT) :: PSI PSI(1) = XF(1) PSI(2) = XF(2) END SUBROUTINE BDCOND

An iniial guess for he iniial sae x() can be provided in INESTX. In our case his is no relevan since he iniial sae is fixed. Bu if he iniial sae conains free componens, hen an iniial guess has o be provided. SUBROUTINE INESTX( T, X, IUSER, USER ) :: T DOUBLEPRECISION, DIMENSION(*), INTENT(OUT) :: X X(1) =.D X(2) = 1.D X(3) =.D END SUBROUTINE INESTX Likewise an iniial guess for he conrol u() needs o be provided in INESTU. Noe ha INESTU will be called a each grid poin, so a ime dependen iniial guess can be provided if appropriae. SUBROUTINE INESTU( T, U, IBOOR, IUSER, USER ) INTEGER, INTENT(IN) :: IBOOR :: T DOUBLEPRECISION, DIMENSION(*), INTENT(OUT) :: U U(1)= -2.D END SUBROUTINE INESTU Finally, we need o define he mass marix M, which in our case is he ideniy marix. The srucure of M was defined by INFO(6). SUBROUTINE MASS( NX,T,X,XP,U,P,MMASS,IUSER,USER ) INTEGER, INTENT(IN) :: NX DOUBLEPRECISION, DIMENSION(*), INTENT(IN) :: X,XP,U,P :: T

DOUBLEPRECISION, DIMENSION(NX,*), INTENT(OUT) :: MMASS MMASS(1:NX,1)=1.D END SUBROUTINE MASS We have compleed enering he relevan daa o solve he minimum energy problem. The remaining funcions ITMAT,ROOT,DJUMP,JACNLC are no relevan for our problem and need o be assigned. Compiling wih gforran ProblemTemplae.f9 libocpiddae1.a libfgssqp.a -o minen and execuing (don forge o copy param sqp.x o he local direcory)./minen will solve he problem and creaes among ohers he daa file OCODE1, which conains he soluion in he following forma: Each line of OCODE1 conains in he firs column he ime and in he subsequen columns he sae vecor x(), he conrol vecor u(), he parameer vecor p, and he sae consrains g(, x(), u(), p). If he adjoin esimaion opion was chosen (IADJOINT = 1), hen he file ADJOINT conains adjoin esimaes for he soluion in he following forma: Each line of ADJOINT conains in he firs column he ime and in he subsequen columns he sae vecor x(), he adjoin esimaes λ(), and he Lagrange mulipliers for he discreized sae consrain. Posscrip files of he soluion will be generaed by gnuplo OCPIDDAE1.gnu..12 Sae 1 vs ime 1 Sae 2 vs ime 4.5 Sae 3 vs ime.1.8.5 4 3.5 3 sae 1.6 sae 2 sae 3 2.5 2.4.2 -.5 1.5 1.5.2.4.6.8 1-1.2.4.6.8 1.2.4.6.8 1 2 Adjoin 1 vs ime 6 Adjoin 2 vs ime 1.1 Adjoin 3 vs ime adjoin 1 15 1 5-5 -1-15 adjoin 2 5 4 3 2 1 adjoin 3 1.5 1.995.99-2.2.4.6.8 1-1.2.4.6.8 1.985.2.4.6.8 1

conrol 1 Conrol 1 vs ime 1-1 -2-3 -4-5 -6.2.4.6.8 1 muliplier 1 Muliplier 1 vs ime 18 16 14 12 1 8 6 4 2.2.4.6.8 1 Noe for advanced users: In addiion o he files OCODE1 and ADJOINT, he file OCODE2 will be creaed and i conains he sensiiviy marices S() of he sae x(; z) wih respec o he vecor z of opimizaion variables of he discreized opimal conrol problem, ha is S() = x(;z) z. Each line of OCODE2 conains in he firs column he ime and in he subsequen columns he marix S(), which is sored columnwise.