efficient symbolical and numerical algorithms for
play

Efficient Symbolical and Numerical Algorithms for nonlinear model - PowerPoint PPT Presentation

Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann Department of Engineering and Mathematics University of Applied Sciences Bielefeld A Modelica-based Tool Chain (Johan


  1. Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann Department of Engineering and Mathematics University of Applied Sciences Bielefeld

  2. A Modelica-based Tool Chain (Johan Åkesson) Symbolic maniulation Flattening of Modelica Index reduction Unstructured source code Analytic solution of Flat DAE Compiler front-end simple equations Code generation Transformed C code Residual equations flat ODE Analytic Jacobians (index 1 system) Numerical solvers Result Solution NLP algorithms Post processing Integrators profiles Visualization

  3. Outline 1. Excerpt of OpenModelica’s symbolic machinery 2. Symbolically derived Jacobians i. Directional derivatives ii. Sparsity pattern iii. Coloring of the Jacobian 3. Nonlinear Optimal Control Problem i. General Discretization Scheme ii. Multiple Shooting/Collocation iii. Total Collocation iv. Applications 4. Lessons learned & Outlook 3 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  4. Symbolic Machinery of OpenModelica General representation of DAEs (continuous signals):    0 f t x t , ( ), ( ), ( ), ( ), x t y t u t p t time x t ( ) vector of differentiated state variables x t ( ) vector of state variables y t ( ) vector of algebraic variables u (t) vector of input variables p v ector of parameters and/or constants 4 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  5. Basic Transformation Steps Transformation to explicit state-space representation:   x t ( )          z t ( ) g t x t u t , ( ), ( ), p 0 f t x t x t , ( ), ( ), ( ), ( ), y t u t p y t ( )         x t ( )      x t ( ) h t x t u t , ( ), ( ), p 0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t y t ( )      y t ( ) k t x t u t , ( ), ( ), p Implicit function theorem: Necessary condition for the existence of the transformation is that the following matrix is regular at the point of interest:         det f t z t , ( ), ( ), ( ), x t u t p 0    z 5 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  6. Symbolic Transformation Algorithmic Steps    0 f t x t x t , ( ), ( ), ( ), ( ), y t u t p DAEs and bipartite graph representation  – Structural representation of the equation system   x t ( )       0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t The matching problem  y t ( )   – Assign to each variable exact one equation – Same number of equations and unknowns   x t ( )       z t ( ) g t x t u t , ( ), ( ), p Construct a directed graph  y t ( )   – Find sinks, sources and strong components – Sorting the equation system    x t ( ) h t x t u t , ( ), ( ), p Adjacence Matrix and structural regularity     – Block-lower triangular form y t ( ) k t x t u t , ( ), ( ), p (BLT-Transformation) 6 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  7. DAEs and Bipartite Graph Representation     x t ( )     Example of a regular DAE : 0 f t z t , ( ), ( ), ( ), x t u t p , ( ) z t y t ( )   f 1 (z 3 ,z 4 ) = 0 Bipartite graph f 2 (z 2 ) = 0 f 3 (z 2 ,z 3 ,z 5 ) = 0 f 4 (z 1 ,z 2 ) = 0 f 1 z 1 f 5 (z 1 ,z 3 ,z 5 ) = 0 f 2 z 2 Adjacence matrix z 1 z 2 z 3 z 4 z 5 f 3 z 3 f 1 0 0 1 1 0 f 2 0 1 0 0 0 f 3 f 4 z 4 0 1 1 0 1 f 4 1 1 0 0 0 f 5 1 0 1 0 1 f 5 z 5 7 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  8. Solve the Matching Problem Example of a regular DAE: Bipartite graph f 1 (z 3 ,z 4 ) = 0 f 2 (z 2 ) = 0 f 1 z 1 f 3 (z 2 ,z 3 ,z 5 ) = 0 f 4 (z 1 ,z 2 ) = 0 f 2 z 2 f 5 (z 1 ,z 3 ,z 5 ) = 0 f 3 z 3 f 4 z 4 f 5 z 5 8 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  9. Construct a Directed Graph f 1 z 1 f 2 z 2 f 3 z 3 f 4 z 4 f 5 z 5 9 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  10. Construct a Directed Graph f 1 z 1 f 2 z 2 f 3 z 3 f 4 z 4 f 5 z 5 10 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  11. Construct a Directed Graph f 1 |z 4 z 1 f 2 z 2 f 3 z 3 f 4 f 5 z 5 11 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  12. Construct a Directed Graph f 1 |z 4 f 5 |z 3 z 1 f 2 z 2 f 3 f 4 z 5 12 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  13. Construct a Directed Graph f 1 |z 4 f 5 |z 3 f 4 |z 1 f 2 z 2 f 3 z 5 13 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  14. Construct a Directed Graph f 1 |z 4 f 5 |z 3 f 4 |z 1 f 3 |z 5 f 2 z 2 14 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  15. Construct a Directed Graph f 1 |z 4 f 5 |z 3 f 4 |z 1 sink f 3 |z 5 f 2 |z 2 source z 2 z 1 z 3 z 5 z 4 f 2 (z 2 ) strong component = 0 f 2 1 0 0 0 0 f 4 (z 1 ,z 2 ) = 0 f 4 1 1 0 0 0 = 0 f 3 (z 2 ,z 3 ,z 5 ) f 3 1 0 1 1 0 = 0 f 5 (z 1 ,z 3 ,z 5 ) f 5 0 1 1 1 0 Tarjan’s algorithm = 0 f 1 0 0 1 0 1 f 1 (z 3 ,z 4 ) 15 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  16. Further Efficiency Issues - Dummy-Derivative Method Matching algorithm fails • – System is structurally singular – Find minimal subset of equations • more equations than unknown variables – Singularity is due to equations, constraining states Differentiate subset of equations • – Static state selection during compile time • choose one state and corresponding derivative as purely algebraic variable o so-called dummy state and dummy derivative • by differentiation introduced variables are algebraic • continue matching algorithm • check initial conditions – Dynamic state selection during simulation time • store information on constrained states • make selection dynamically based on stability criteria • new state selection triggers an event (re-initialize states) 16 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  17. Further Efficiency Issues – Algebraic Loops Solution of linear equation systems • – Advanced solver packages (e.g. LAPACK) are used – Calculate LU-Decomposition for constant matrices • Small systems are inverted symbolically Solution of nonlinear systems • – Advanced solver packages are used Performance is depending on good starting values • – Analytical Jacobian is provided symbolically Tearing systems of equations • – Reducing the iteration variables dramatically Analytical Jacobians of the overall system • – Minimize simulation/integration time needed 17 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  18. Outline 1. Excerpt of OpenModelica’s symbolic machinery 2. Symbolically derived Jacobians i. Directional derivatives ii. Sparsity pattern iii. Coloring of the Jacobian 3. Nonlinear Optimal Control Problem i. General Discretization Scheme ii. Multiple Shooting/Collocation iii. Total Collocation iv. Applications 4. Lessons learned & Outlook 18 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  19. Fast Simulation of Fluid Models with Colored Jacobians Willi Braun, Bernhard Bachmann Department of Engineering and Mathematics University of Applied Sciences Bielefeld Stephanie Gallardo Yances, Kilian Link Siemens AG, Energy Section Erlangen (see 9th International Modelica Conference) 19 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  20. Symbolically Generation of Jacobians 20 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  21. Symbolically Generation of Jacobians 21 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  22. Symbolically Generation of Jacobians 22 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

  23. Symbolically Generation of Jacobians 23 Efficient Symbolical and Numerical Algorithms for nonlinear model predictive control with OpenModelica Bernhard Bachmann, et. al.

Recommend


More recommend