Modelon Ab · OMXSTO:MODEL

Modelon Ab — Technical Presentation (October 2022)

41 slides from Modelon Ab's technical presentation, Oct 20, 2022

  1. Slide 1: Dynamic Optimization

    Dynamic Optimization Innovate 2022 Day 2 – October 20th , Stockholm ©2022 Modelon. All Rights Reserved.

  2. Slide 2: Stéphane Velut

    Stéphane Velut Industry Director, Energy At Modelon since 2009 PhD in Controls from Lund University, Sweden (2005) M. Sc. E.E, Grenoble Institute of Technology, France (1999) ©2022 Modelon. All Rights Reserved.

  3. Slide 3: Optimization versus Simulation

    Optimization versus Simulation What question to ask your model? Simulation Optimization What if… ? What is best ? • The valve is closed • In terms of equipment and controls • The valve is made smaller • With regard to some criteria • The upstream pressure is increased • And operational constraints •

  4. Slide 4: Optimization approaches with Modelon Impact

    Optimization approaches with Modelon Impact • FMU-based • Both derivative-free and gradient-based • directional derivatives can be provided by Modelon Impact compiler • Works for almost any Modelica model but limited number of degrees of freedom • Workflow in Python using PyFMI, OCT API and any opti

  5. Slide 5: Advanced Training

    Advanced Training • 1 full day of training • 3 lectures and 3 workshops covering • Basics • Applications • Modelling ©2022 Modelon. All Rights Reserved.

  6. Slide 6: Outline

    Outline • A first example • Under the hood • Optimization friendly modelling • Application examples • Energy • Aerospace • Automotive ©2022 Modelon. All Rights Reserved.

  7. Slide 7: A first example!

    A first example! Optimal control of the double tank process ©2022 Modelon. All Rights Reserved.

  8. Slide 8: Optimal control of the double tank

    DEMO Optimal control of the double tank Plant model Optimization objective Use the pump in order to • Take the level of the lower tank to 2m as quick as possible • Without getting any spill over in the upper tank of height 1m • Flow limited to 30 kg/s • After 10min, the upper tank should be back at

  9. Slide 9: Under the hood

    Under the hood • Problem formulation • Numerical approach • Initialization • Packaging & deployment ©2022 Modelon. All Rights Reserved.

  10. Slide 10: Formulation of the optimization problem

    Formulation of the optimization problem Convenient formulation using optimization specific blocks & Modelica code (min/max attributes) 600 min න tank2. level(t) − 2 2 𝑑𝑡 tank. level t < 1 𝑢 𝑡 < 30 𝑢 𝑡 0 ©2022 Modelon. All Rights Reserved.

  11. Slide 11: Formulation in Optimica

    Formulation in Optimica Plant model Optimization formulation Optimica language 1000 min න tank2. level(t) − 2 2 𝑑𝑡 𝑢 𝑡 0 𝑢 𝑡 < 30 TwoTanks.mo 𝑡𝑎𝑛𝑘. 𝑙𝑒𝑣𝑒𝑙 𝑡 < 1.5 𝑡𝑎𝑛𝑘. 𝑙𝑒𝑣𝑒𝑙 0 = 𝑡𝑎𝑛𝑘. 𝑙𝑒𝑣𝑒𝑙(1000) OptimicaFormulation.mop ©2022 Modelon. All Rights Reserved.

  12. Slide 12: Numerical approach at a glance

    Numerical approach at a glance Continuous Discrete Nonlinear Compiler Collocation Solution problem problem solver https://web.casadi.org/ https://coin-or.github.io/Ipopt/ From Optimica Algorithmic Trajectories as Solution in Large and sparse Interior point method continuous time to CasADi differenti

  13. Slide 13: Initialization of the optimization

    Guess for control and design Initialization of the optimization Initialization The nonlinear program requires a reasonable guess for all model simulation variables over the entire time horizon. Guess for all system variables 1. Construct a reasonable initial guess of the degrees of freedom • Paramet

  14. Slide 14: Overall workflow package as a custom function

    Overall workflow package as a custom function Initialization Plant Model Objective function & OPTIMAL constraints design/ plan Data ©2022 Modelon. All Rights Reserved.

  15. Slide 15: Python implementation

    Python implementation Import methods for compilation and fmu loading Compilation & loading of the model for initialization Initial simulation Compilation of the optimica code Optimization options Optimization ©2022 Modelon. All Rights Reserved.

  16. Slide 16: Optimization workflow deployment

    OPTIMIZATION WORKFLOW DEPLOYMENT Notebook for workflow design Model-centric view to test the workflow on new models Web-app for deployment ©2022 Modelon. All Rights Reserved.

  17. Slide 17: Model predictive control

    MODEL PREDICTIVE CONTROL • The dynamic optimization framework computes optimal open- loop trajectories • Feedback is necessary to handle • Model-plant mismatch • Disturbances • Model predictive control is a framework for introducing feedback: • In each sample point, compute optimal control for the c

  18. Slide 18: Optimization-Friendly Modelling

    Optimization-Friendly Modelling • Basic requirements • Fundamental limitations • Building new models ©2022 Modelon. All Rights Reserved.

  19. Slide 19: Smoothness requirements

    Smoothness requirements • Equation expressions must be twice continuously differentiable, 𝐶 2 , with respect to all optimization variables (𝑥,ሶ 𝑥, 𝑦, 𝑢, 𝑝) • Consequences: • No discrete variables and equations (except parameters) • No event-generating expressions • Smooth equations • If…

  20. Slide 20: Smoothness checker

    Smoothness checker • Compiler options to check that smoothness requirements are satisfied: • allow_discrete_variables: Set to False to detect discrete, non-parametric variables • allow_when_clauses: Set to False to detect when clauses • allow_discrete_switches: Set to False to detect event-generatin

  21. Slide 21: Smoothing techniques

    SMOOTHING TECHNIQUES • Typical non-smooth functions that need smooth approximations: • Max • Min • Saturation • Step • … • Activation point and region to be specified (see Figure to the right) • Inputs should be shifted and scaled: 𝑦smooth = stepC2(𝑥−𝑥Δ𝑠ℎ𝑖𝑓𝑡 ) • Analytic differentiability is…

  22. Slide 22: Limitations

    LIMITATIONS • CasADi Interface supports a large (but incomplete) set of the Modelica language • Two categories of limitations: • Fundamental limitations: Some constructs are inherently discrete and should never be used for gradient-based optimization (pre(), edge(), reinit()…) • Compiler limitations

  23. Slide 23: Optimization friendly packages

    Optimization friendly packages Three packages inside Thermal Power have been derived for dynamic optimization Additional content to describe boilers can be provided on demand Good starting point for deriving new models ©2022 Modelon. All Rights Reserved.

  24. Slide 24: Recommended workflow for system modelling

    Recommended workflow for system modelling • When building models, start small and add complexity as you go along • Test each step! Starting with a large, complex, broken model will be very difficult to debug • Testing steps: • FMU compilation, with smoothness check • Dynamic simulation, result verif

  25. Slide 25: Applications

    Applications • Energy • Aerospace • Automotive ©2022 Modelon. All Rights Reserved.

  26. Slide 26: Energy

    DEMO Energy • Microgrid design & operation • Model Predictive Control for boiler start-up ©2022 Modelon. All Rights Reserved.

  27. Slide 27: Examples of applications

    Examples of applications District Heating Power plant Micro-grid CO2 capture • Production planning • Start-up optimization • Optimal design & operation • Optimal operation • Network aggregation • Thermal & mechanical stress • Forecast for weather, electricity • DOF: reboiler duty and circulation rat

  28. Slide 28: Selected references

    SELECTED REFERENCES • Dietl et al. (2018) Start up optimization of Combined Cycle Power Plants: Controller development and real plant test results, CoDIT • Schweiger et al., (2017) District heating and cooling systems – Framework for Modelica-based simulation and dynamic optimization, In Energy • Ma

  29. Slide 29: Aerospace

    Aerospace Drone sizing and control ©2022 Modelon. All Rights Reserved.

  30. Slide 30: Building

    Building The drone architecture is composed of: 1. Four fixed pitch propellers 2. Four out-runner brushless motors 3. Four electronic speed controllers (ESC) mainly made from MOSFET inverters 4. One battery based on Li-Ion cells 5. One mechanical structure (frame) consisting of four arms and one cen

  31. Slide 31: Power requirements Component

    We want to maximize the number of flights, hence our objective is to minimize the energy consumption per flight. Height End ? Power Component Drone trajectory is a degree of freedom requirements sizings Start Time Total mass ©2022 Modelon. All Rights Reserved.

  32. Slide 32: Objective, trajectory optimization, constraints

    We want to maximize the number of flights, hence our objective is to minimize the energy consumption per flight. Optimica model including Height • Objective End • Trajectory optimization • Constraints ? Power Component Drone trajectory is a degree of freedom requirements sizings Modelica Drone model

  33. Slide 33: SizingAndTrajectoryOptim optimization code

    optimization SizingAndTrajectoryOptim ( … objective=M_total(startTime), DimensionlessRatio n_norm(start=1, fixed=true)=n/n_hover; finalTime(free=true, min=1, max=10, start=5)) // Minimize the total drone mass and relax the final simulation time within bounds. DimensionlessRatio N_norm(min=-1, max=1,

  34. Slide 34: ©2022 Modelon. All Rights Reserved.

    ©2022 Modelon. All Rights Reserved.

  35. Slide 35: Automotive

    Automotive Trajectory optimization of a racing car ©2022 Modelon. All Rights Reserved.

  36. Slide 36: Two-track vehicle model with combined slip and relaxation dynamics

    Two-track vehicle model with combined slip and relaxation dynamics (not multibody based) 𝑝𝑧,𝑟𝑒𝑙 - Vehicle direction relative s to track 𝑝𝑧,𝑡𝑟𝑎𝑐𝑘 - Global track direction 𝑟𝑡 - Current lateral position in 𝑟𝑡 track coordinates 𝑟𝑠 𝑟𝑠 - Current longitudinal Local track coordinate…

  37. Slide 37: Oval track

    Oval track ©2022 Modelon. All Rights Reserved.

  38. Slide 38: Example of variable track width

    Example of variable track width ©2022 Modelon. All Rights Reserved.

  39. Slide 39: Friction usage Tire forces

    Friction usage Tire forces Rear inside wheel is first to be limited by grip ©2022 Modelon. All Rights Reserved.

  40. Slide 40: Road course

    Road course ©2022 Modelon. All Rights Reserved.

  41. Slide 41: Conclusion

    Conclusion • Modelon Impact offers powerful dynamic optimization methods • They set some requirements on the models • Smooth • No discrete dynamics • Recent integration of the workflow into the main GUI • Ideally for optimal control & scheduling problems • Relatively easy to apply in feasibility stu

Modelon — Technical Presentation (October 2022) on 6ix