Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
An overview
OPTIMICA COMPILER TOOLKIT
 OPTIMICA Compiler Toolkit
• Overview
• Transient time domain
• Steady state time domain
 JModelica.org
OUTLINE
MODEL-BASED DEVELOPMENT WITH MODELON
Model
libraries
Model
authoring
Model
compiler
Solvers
Deployment &
toolchain
integra...
 Scope
• Modelica and FMI-based computation platform for physical
modeling and systems design
• Dynamic simulation and op...
OCT FUNCTIONALITY OVERVIEW
Simulation Optimization
Dynamic
• Transient analysis in Python
using Assimulo solver
package
• ...
COMPILER: FROM MODELICA TO FMU
Flattening of Modelica
source code
Compiler front-end
Unstructured
Flat DAE
Symbolic manipu...
OCT from a software perspective:
 Contains a modular Modelica compiler written in
Java/JastAdd
 Custom integration of Mo...
 OPTIMICA Compiler Toolkit
• Overview
• Transient time domain
• Steady state time domain
 JModelica.org
OUTLINE
 Before you have built your system, find answers to
• What are the limits of performance?
• What are the bottlenecks?
• W...
DYNAMIC OPTIMIZATION
• Many algorithms
 Applicability highly model-dependent (ODE, DAE, PDE,
hybrid)
Calculus of variatio...
OPTIMIZATION WITH MODELICA
• Modelica has strong support for modeling
• Missing optimization elements
 Cost function
 Co...
 Several EU research projects (Siemens, Vattenfall)
 Minimize the start-up time, limit thermal stress in critical
compon...
 Perform transition between polyethylene grades such that
• Profit is maximized
• Off-specification material is minimized...
 OPTIMICA Compiler Toolkit
• Overview
• Transient time domain
• Steady state time domain
 JModelica.org
OUTLINE
Convenient to run steady state instead of dynamic simulations in
many cases as
 dynamics may not be important, and thus
•...
 OPTIMICA Compiler Toolkit contains a suite of functionality
for steady-state model execution from MATLAB.
• Modelica Com...
 Solving large non-linear systems of equations is hard
• Computationally expensive
• Poor initial guesses gives poor conv...
MODELICA COMPILER INTERFACE
• Same compiler for steady-state as for dynamic models
 Set compiler options to expose iterat...
STEADY-STATE SOLVER INTERFACE
Solving a steady-state problem using OPTIMICA Compiler
Toolkit in MATLAB follows three basic...
CLASSES FOR SOLVING A SYSTEM
• Problem
 Intended use by subclass, for example FMUProblem that comes with
OCT
 FMUProblem...
FMU AGGREGATION INTERFACE
• Enabling coupled simulation of steady-state Modelica
models compiled by OPTIMICA Compiler
• Au...
 OPTIMICA compiled steady state Modelica models exposes
• Iteration variables and residuals
• Cost function
• Optimizatio...
 OPTIMICA Compiler Toolkit
• Overview
• Transient time domain
• Steady state time domain
 JModelica.org
OUTLINE
 JModelica.org
• Base of OPTIMICA Compiler Toolkit
• Open source license (GPL)
• Base-line Modelica and FMI support
• Com...
Upcoming SlideShare
Loading in …5
×

Optimica Compiler Toolkit - Overview

5,365 views

Published on

Overview - OPTIMICA Compiler Toolkit by Modelon, 2016

Published in: Technology

Optimica Compiler Toolkit - Overview

  1. 1. An overview OPTIMICA COMPILER TOOLKIT
  2. 2.  OPTIMICA Compiler Toolkit • Overview • Transient time domain • Steady state time domain  JModelica.org OUTLINE
  3. 3. MODEL-BASED DEVELOPMENT WITH MODELON Model libraries Model authoring Model compiler Solvers Deployment & toolchain integration Maintenance & Testing Automation, scripting, presentation Technologies Domain expertise Software Compiler technology Numerics and algorithms Software Engineering Modelica FMI, C, C++, Java, Python Python, MATLAB Modelon Libraries GUI OPTIMICA Testing Toolkit OPTIMICA Compiler Toolkit and FMI tools Toolboxes Modelon Toolchain Elements – MBD workflow Requirements, input data, ... Analysis results, system design, tools, ... Modeling and physics Customer
  4. 4.  Scope • Modelica and FMI-based computation platform for physical modeling and systems design • Dynamic simulation and optimization • Steady state simulation and optimization  Key Features • Based on Modelica and FMI standard • Simulation and transient response analysis • Framework for steady state simulation and analysis • Optimization (offline/online, design, parameter estimation) • User friendly scripting APIs and vizualization in Matlab® and Python  Benefits • Rapid development of model-driven applications • Open model interfaces for easy integration and extension • Model protection through encrypted libraries OPTIMICA COMPILER TOOLKIT
  5. 5. OCT FUNCTIONALITY OVERVIEW Simulation Optimization Dynamic • Transient analysis in Python using Assimulo solver package • Transient analysis in MATLAB using Modelica Toolbox • State estimation • Parameter sensitivity analysis • Offline dynamic optimization • Online nonlinear model predictive control • State estimation • Parameter calibration • Design optimization Steadystate • Simulation using handguided and automatic tearing • Aggregation of multiple FMUs • Continuation solver for batch simulations • Equation smoothness checker • System and component design optimization • Control setpoint optimization • Parameter calibration
  6. 6. COMPILER: FROM MODELICA TO FMU Flattening of Modelica source code Compiler front-end Unstructured Flat DAE Symbolic manipulation Index reduction Analytic solution of simple equations Transformed flat DAE Code generation Residual equations Analytic Jacobians C code + XML code = FMU 1.0/2.0RC1 Numerical solvers NLP algorithms Integrators Solution profiles Results Post processing Visualization
  7. 7. OCT from a software perspective:  Contains a modular Modelica compiler written in Java/JastAdd  Custom integration of Modelica technology into your tools  Reusable software components  Attention to interfaces and interoperability OPTIMICA COMPILER TOOLKIT
  8. 8.  OPTIMICA Compiler Toolkit • Overview • Transient time domain • Steady state time domain  JModelica.org OUTLINE
  9. 9.  Before you have built your system, find answers to • What are the limits of performance? • What are the bottlenecks? • What control structure should be used? • What design changes can/should be made?  Several types of dynamic optimizations in OCT • Offline trajectory optimization • Nonlinear Model Predictive Control • State estimation • Parameter optimization/Model Calibration • Design optimization and sizing WHY DYNAMIC OPTIMIZATION?
  10. 10. DYNAMIC OPTIMIZATION • Many algorithms  Applicability highly model-dependent (ODE, DAE, PDE, hybrid) Calculus of variations, Single/Multiple shooting, Simultaneous methods, Simulation-based methods (GA, simulated annealing) • Analogy with different simulation algorithms  Heavy burden to use numerical algorithms  Fortran, C, (AMPL) • Engineering need for high-level descriptions  Heavy burden to use numerical algorithms Shift focus from encoding to formulation of optimization problem
  11. 11. OPTIMIZATION WITH MODELICA • Modelica has strong support for modeling • Missing optimization elements  Cost function  Constraints  What to optimize  Initial guesses • Optimica  Small extension of Modelica that OPTIMICA compiler can utilize  Enable high-level formulation of optimization problems
  12. 12.  Several EU research projects (Siemens, Vattenfall)  Minimize the start-up time, limit thermal stress in critical components  Method: • Development of dynamic models in Dymola Detailed steam system (evaporator, re-heater, superheater, turbine) • Drive the boiler or gas turbine to full load in minimum time Stress monitored in header and evaporator drum  Result: Faster start-up and limited stress in critical components USE CASE: OPTIMAL START-UP OF POWER PLANTS
  13. 13.  Perform transition between polyethylene grades such that • Profit is maximized • Off-specification material is minimized  Dynamic Modelica model of • Gas-phase reactor • Two super-critical propane slurry reactors • Recovery system of three columns • All raw material flows, flare and one colum offgas available for optimization (15 inputs)  Result: Optimal transitions where the most profiable grade is prioritized, off-specification material minimized, and offgas/flare used at appropriate times for fast transition USE CASE: GRADE CHANGES FOR POLYETHYLENE PRODUCTION
  14. 14.  OPTIMICA Compiler Toolkit • Overview • Transient time domain • Steady state time domain  JModelica.org OUTLINE
  15. 15. Convenient to run steady state instead of dynamic simulations in many cases as  dynamics may not be important, and thus • no need to wait for slow transients • no need for complex integration of possibly stiff systems  performance measures may be sensitive to time horizon in dynamic simulation  there is no need to set a specific initial condition of your system  system modellers do not need to choose a time horizon  in most cases it is • fast to go through a range of operating conditions • possible to run a more detailed model than in the dynamic case WHY STEADY STATE? “Modelica needs to be more than dynamic simulation […]. Steady state and optimization will also be important” Clas Jacobson, United Technologies
  16. 16.  OPTIMICA Compiler Toolkit contains a suite of functionality for steady-state model execution from MATLAB. • Modelica Compiler Interface • Steady-state Solver Interface • Interactive Continuation Solver • FMU Aggregation Interface • Smoothness Checker OPTIMICA COMPILER TOOLKIT - STEADY STATE The base for solid steady-state functionality is • efficient tearing of nonlinear equation systems, and • an effective nonlinear equation solver
  17. 17.  Solving large non-linear systems of equations is hard • Computationally expensive • Poor initial guesses gives poor convergence • Poor scaling of variables/residuals degrades performance  Mixed symbolic and numeric algorithms are used to exploit the structure of the equations  Modelica models are large but… • Sparse • Many trivial equations  Decompose the original problem into a sequence of smaller systems of equations  Use tearing to reduce the number of iteration variables in the decomposed systems of equations WHAT IS TEARING ABOUT?
  18. 18. MODELICA COMPILER INTERFACE • Same compiler for steady-state as for dynamic models  Set compiler options to expose iteration variables and residual variables marked by annotations  Example of compilation modelName = 'ExampleModels.SimpleSteadyState'; compiler = 'OCT_Modelica'; opt = {'interactive_fmu', true, expose_scalar_equation_blocks_in_interactive_fmu', true}; fmuName = compileFMU(modelName, compiler, 'options', opt); fmu = FMUModelME1(fmuName);
  19. 19. STEADY-STATE SOLVER INTERFACE Solving a steady-state problem using OPTIMICA Compiler Toolkit in MATLAB follows three basic steps 1. Generating a problem based on an FMU 2. Solving the problem 3. Reading the solver log, both during the solver process but also saved logs after the equation system been solved. The main classes in OCT for these steps are • Problem • Solver • LogViewer
  20. 20. CLASSES FOR SOLVING A SYSTEM • Problem  Intended use by subclass, for example FMUProblem that comes with OCT  FMUProblem uses FMUs that expose iteration variables as inputs and residual equations as outputs.  FMUProblem supports handling of initial guesses for iteration variables through start-attributes of variables. • Solver  Takes a Problem-instance at instantiation and represents the problem to be solved  Main functionalities are communication with solver regarding solver options as well as invoking the solver. • LogViewer  Provides an API for retreiveing information from solver logs  Several different log level  Information on iteration variables, residuals, scaling factors, Jacobians, Kinsol output, plot variables as function of solver iteration, ...  Crucial at non-convergence
  21. 21. FMU AGGREGATION INTERFACE • Enabling coupled simulation of steady-state Modelica models compiled by OPTIMICA Compiler • Automatically detects execution order of FMUs • Utilizes a connection map between FMUs • Example of use cases:  System model developed by several parties  no need to recompile full system when minor changes FMU A FMU Z Aggregated FMU
  22. 22.  OPTIMICA compiled steady state Modelica models exposes • Iteration variables and residuals • Cost function • Optimization variables (free variables)  Interface to numerical optimization routine IPOPT available  Optimization use cases • Component design/sizing • Set-point optimization • Parameter estimation STEADY-STATE OPTIMIZATION
  23. 23.  OPTIMICA Compiler Toolkit • Overview • Transient time domain • Steady state time domain  JModelica.org OUTLINE
  24. 24.  JModelica.org • Base of OPTIMICA Compiler Toolkit • Open source license (GPL) • Base-line Modelica and FMI support • Community support • Python scripting MODELICA COMPILER OFFERINGS ”[We are] applying the platform to Mitsubishi Electric Problems Scott Bortoff, Mitsubishi Electric Research Laboraties

×