Openmodelica User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
OpenModelica User’s Guide Release v1.13.2 Open Source Modelica Consortium Jan 31, 2019 CONTENTS 1 Introduction 3 1.1 System Overview...........................................4 1.2 Interactive Session with Examples..................................5 1.3 Summary of Commands for the Interactive Session Handler.................... 23 1.4 Running the compiler from command line.............................. 24 2 OMEdit – OpenModelica Connection Editor 27 2.1 Starting OMEdit........................................... 27 2.2 MainWindow & Browsers...................................... 28 2.3 Perspectives............................................. 33 2.4 Modeling a Model.......................................... 37 2.5 Simulating a Model......................................... 39 2.6 Plotting the Simulation Results................................... 41 2.7 Re-simulating a Model........................................ 42 2.8 3D Visualization........................................... 42 2.9 Animation of Realtime FMUs.................................... 45 2.10 Interactive Simulation........................................ 45 2.11 How to Create User Defined Shapes – Icons............................. 47 2.12 Global head section in documentation................................ 48 2.13 Settings................................................ 49 2.14 __OpenModelica_commandLineOptions Annotation........................ 54 2.15 __OpenModelica_simulationFlags Annotation........................... 55 2.16 Debugger............................................... 55 2.17 Editing Modelica Standard Library................................. 55 2.18 State Machines............................................ 56 3 2D Plotting 59 3.1 Example............................................... 59 3.2 Plot Command Interface....................................... 61 4 Solving Modelica Models 63 4.1 Integration Methods......................................... 63 4.2 DAE Mode Simulation........................................ 64 5 Debugging 65 5.1 The Equation-based Debugger.................................... 65 5.2 The Algorithmic Debugger...................................... 67 6 Generating Graph Representations for Models 73 7 FMI and TLM-Based Simulation and Co-simulation of External Models 75 7.1 Functional Mock-up Interface - FMI................................. 75 7.2 Transmission Line Modeling (TLM) Based Co-Simulation..................... 77 7.3 Composite Model Editing of External Models............................ 77 i 8 OMSimulator 93 9 OpenModelica Encryption 95 9.1 Encrypting the Library........................................ 95 9.2 Loading an Encrypted Library.................................... 95 9.3 Notes................................................. 95 10 OMNotebook with DrModelica and DrControl 97 10.1 Interactive Notebooks with Literate Programming......................... 97 10.2 DrModelica Tutoring System – an Application of OMNotebook.................. 97 10.3 DrControl Tutorial for Teaching Control Theory.......................... 103 10.4 OpenModelica Notebook Commands................................ 114 10.5 References.............................................. 119 11 Optimization with OpenModelica 121 11.1 Builtin Dynamic Optimization with OpenModelica and IpOpt................... 121 11.2 Compiling the Modelica code.................................... 121 11.3 An Example............................................. 121 11.4 Different Options for the Optimizer IPOPT............................. 124 11.5 Dynamic Optimization with OpenModelica and CasADi...................... 124 11.6 Parameter Sweep Optimization using OMOptim.......................... 129 12 Parameter Sensitivities with OpenModelica 137 12.1 Background.............................................. 137 12.2 An Example............................................. 137 13 PDEModelica1 141 13.1 PDEModelica1 language elements.................................. 141 13.2 Limitations.............................................. 142 13.3 Viewing results............................................ 142 14 MDT – The OpenModelica Development Tooling Eclipse Plugin 143 14.1 Introduction............................................. 143 14.2 Installation.............................................. 143 14.3 Getting Started............................................ 144 15 MDT Debugger for Algorithmic Modelica 157 15.1 The Eclipse-based Debugger for Algorithmic Modelica....................... 157 16 Modelica Performance Analyzer 165 16.1 Profiling information for ProfilingTest................................ 166 16.2 Genenerated JSON for the Example................................. 169 16.3 Using the Profiler from OMEdit................................... 169 17 Simulation in Web Browser 171 18 Interoperability – C and Python 173 18.1 Calling External C functions..................................... 173 18.2 Calling external Python Code from a Modelica model....................... 174 18.3 Calling OpenModelica from Python Code.............................. 176 19 OpenModelica Python Interface and PySimulator 179 19.1 OMPython – OpenModelica Python Interface............................ 179 19.2 Enhanced OMPython Features.................................... 182 19.3 PySimulator............................................. 185 20 OMMatlab – OpenModelica Matlab Interface 187 20.1 Current Prototype.......................................... 187 20.2 Test Commands........................................... 187 20.3 List of Planned API support..................................... 188 ii 21 OMJulia – OpenModelica Julia Scripting 189 21.1 Features of OMJulia......................................... 189 21.2 Test Commands........................................... 189 21.3 Standard get methods........................................ 190 21.4 Usage of getMethods......................................... 191 21.5 Standard set methods......................................... 192 21.6 Usage of setMethods......................................... 192 21.7 Advanced Simulation........................................ 192 21.8 Linearization............................................. 193 21.9 Usage of Linearization methods................................... 193 21.10 Sensitivity Analysis......................................... 193 21.11 Usage................................................. 194 22 Scripting API 195 22.1 OpenModelica Scripting Commands................................ 195 22.2 Simulation Parameter Sweep..................................... 250 22.3 Examples............................................... 251 23 OpenModelica Compiler Flags 257 23.1 Options................................................ 257 23.2 Debug flags.............................................. 272 23.3 Flags for Optimization Modules................................... 278 24 Small Overview of Simulation Flags 279 24.1 OpenModelica (C-runtime) Simulation Flags............................ 279 25 Technical Details 287 25.1 The MATv4 Result File Format................................... 287 26 Frequently Asked Questions (FAQ) 289 26.1 OpenModelica General........................................ 289 26.2 OMNotebook............................................. 289 26.3 OMDev - OpenModelica Development Environment........................ 290 27 Major OpenModelica Releases 291 27.1 Release Notes for OpenModelica 1.14.0............................... 291 27.2 Release Notes for OpenModelica 1.13.0............................... 291 27.3 Release Notes for OpenModelica 1.12.0............................... 291 27.4 Release Notes for OpenModelica 1.11.0............................... 293 27.5 Release Notes for OpenModelica 1.10.0............................... 295 27.6 Release Notes for OpenModelica 1.9.4............................... 296 27.7 Release Notes for OpenModelica 1.9.3............................... 297 27.8 Release Notes for OpenModelica 1.9.2............................... 298 27.9 Release Notes for OpenModelica 1.9.1............................... 300 27.10 Release Notes for OpenModelica 1.9.0............................... 302 27.11 Release Notes for OpenModelica 1.8.1............................... 304 27.12 OpenModelica 1.8.0, November 2011................................ 305 27.13 OpenModelica 1.7.0, April 2011................................... 307 27.14 OpenModelica 1.6.0, November 2010................................ 308 27.15 OpenModelica 1.5.0, July 2010................................... 308 27.16 OpenModelica 1.4.5, January 2009................................. 309 27.17 OpenModelica 1.4.4, Feb 2008................................... 310 27.18 OpenModelica 1.4.3, June 2007................................... 310 27.19 OpenModelica 1.4.2, October 2006................................. 311 27.20 OpenModelica 1.4.1, June 2006................................... 312 27.21 OpenModelica 1.4.0, May 2006................................... 313 27.22 OpenModelica 1.3.1, November 2005................................ 313 28 Contributors to OpenModelica 315 iii 28.1 OpenModelica Contributors 2015.................................. 315 28.2 OpenModelica Contributors 2014.................................. 317 28.3 OpenModelica Contributors 2013.................................. 318 28.4 OpenModelica Contributors 2012.................................. 320 28.5 OpenModelica Contributors 2011.................................. 322 28.6 OpenModelica Contributors 2010.................................. 324 28.7 OpenModelica