OpenModelica User’s Guide Release v1.19.0-dev-270-g618c742bb2 Open Source Modelica Consortium 2021 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.................... 24 1.4 Running the compiler from command line.............................. 25 2 OMEdit – OpenModelica Connection Editor 27 2.1 Starting OMEdit........................................... 27 2.2 MainWindow & Browsers...................................... 28 2.3 Perspectives............................................. 32 2.4 File Menu............................................... 37 2.5 Edit Menu.............................................. 38 2.6 View Menu.............................................. 38 2.7 Simulation Menu........................................... 38 2.8 Debug Menu............................................. 39 2.9 SSP Menu.............................................. 39 2.10 Sensitivity Optimization Menu.................................... 39 2.11 Tools Menu.............................................. 39 2.12 Help Menu.............................................. 39 2.13 Modeling a Model.......................................... 40 2.14 Simulating a Model......................................... 42 2.15 2D Plotting.............................................. 45 2.16 Re-simulating a Model........................................ 47 2.17 3D Visualization........................................... 47 2.18 Animation of Realtime FMUs.................................... 50 2.19 Interactive Simulation........................................ 51 2.20 How to Create User Defined Shapes – Icons............................. 51 2.21 Global head section in documentation................................ 52 2.22 Options................................................ 53 2.23 __OpenModelica_commandLineOptions Annotation........................ 60 2.24 __OpenModelica_simulationFlags Annotation........................... 60 2.25 Global and Local Flags........................................ 61 2.26 Debugger............................................... 61 2.27 Editing Modelica Standard Library................................. 61 2.28 State Machines............................................ 62 2.29 Using OMEdit as Text Editor.................................... 65 2.30 Temporary Directory, Log Files and Working Directory...................... 66 2.31 High DPI Settings.......................................... 67 3 2D Plotting 73 3.1 Example............................................... 73 3.2 Plot Command Interface....................................... 75 4 Solving Modelica Models 77 i 4.1 Integration Methods......................................... 77 4.2 DAE Mode Simulation........................................ 79 4.3 Initialization............................................. 79 4.4 Algebraic Solvers.......................................... 83 5 Debugging 85 5.1 The Equation-based Debugger.................................... 85 5.2 The Algorithmic Debugger...................................... 88 6 Porting Modelica libraries to OpenModelica 93 6.1 Mapping of the library on the file system.............................. 93 6.2 Modifiers for arrays......................................... 93 6.3 Access to conditional components.................................. 94 6.4 Access to classes defined in partial packages............................ 95 6.5 Equality operator in algorithms................................... 96 6.6 Public non-input non-output variables in functions......................... 96 6.7 Subscripting of expressions..................................... 97 6.8 Incomplete specification of initial conditions............................ 97 6.9 Modelica_LinearSystems2 Library................................. 98 7 Generating Graph Representations for Models 99 8 FMI and TLM-Based Simulation and Co-simulation of External Models 101 8.1 Functional Mock-up Interface - FMI................................. 101 8.2 Transmission Line Modeling (TLM) Based Co-Simulation..................... 104 8.3 Composite Model Editing of External Models............................ 104 9 OMSimulator 119 9.1 Introduction............................................. 119 9.2 OMSimulator............................................. 119 9.3 OMSimulatorLib........................................... 121 9.4 OMSimulatorLua........................................... 136 9.5 OMSimulatorPython......................................... 150 9.6 OpenModelicaScripting....................................... 165 9.7 Graphical Modelling......................................... 180 9.8 SSP Support............................................. 184 10 System Identification 191 10.1 Examples............................................... 191 10.2 Python and C API.......................................... 193 11 OpenModelica Encryption 201 11.1 Encrypting the Library........................................ 201 11.2 Loading an Encrypted Library.................................... 201 11.3 Notes................................................. 201 12 OMNotebook with DrModelica and DrControl 203 12.1 Interactive Notebooks with Literate Programming......................... 203 12.2 DrModelica Tutoring System – an Application of OMNotebook.................. 204 12.3 DrControl Tutorial for Teaching Control Theory.......................... 210 12.4 OpenModelica Notebook Commands................................ 220 12.5 References.............................................. 225 13 Optimization with OpenModelica 227 13.1 Builtin Dynamic Optimization with OpenModelica and IpOpt................... 227 13.2 Compiling the Modelica code.................................... 227 13.3 An Example............................................. 228 13.4 Different Options for the Optimizer IPOPT............................. 230 13.5 Dynamic Optimization with OpenModelica and CasADi...................... 230 13.6 Parameter Sweep Optimization using OMOptim.......................... 235 ii 14 Parameter Sensitivities with OpenModelica 243 14.1 Single Parameter sensitivities with IDA/Sundials.......................... 243 14.2 Single and Multi-parameter sensitivities with OMSens....................... 245 15 PDEModelica1 259 15.1 PDEModelica1 language elements.................................. 259 15.2 Limitations.............................................. 260 15.3 Viewing results............................................ 260 16 MDT – The OpenModelica Development Tooling Eclipse Plugin 261 16.1 Introduction............................................. 261 16.2 Installation.............................................. 261 16.3 Getting Started............................................ 262 17 MDT Debugger for Algorithmic Modelica 277 17.1 The Eclipse-based Debugger for Algorithmic Modelica....................... 277 18 Modelica Performance Analyzer 285 18.1 Profiling information for ProfilingTest................................ 286 18.2 Genenerated JSON for the Example................................. 288 18.3 Using the Profiler from OMEdit................................... 289 19 Simulation in Web Browser 291 20 Interoperability – C and Python 293 20.1 Calling External C functions..................................... 293 20.2 Calling external Python Code from a Modelica model....................... 294 20.3 Calling OpenModelica from Python Code.............................. 296 21 OpenModelica Python Interface and PySimulator 299 21.1 OMPython – OpenModelica Python Interface............................ 299 21.2 Enhanced OMPython Features.................................... 302 21.3 PySimulator............................................. 306 22 OMMatlab – OpenModelica Matlab Interface 307 22.1 Features of OMMatlab........................................ 307 22.2 Test Commands........................................... 307 22.3 WorkDirectory............................................ 309 22.4 BuildModel.............................................. 309 22.5 Standard get methods........................................ 309 22.6 Usage of getMethods......................................... 309 22.7 Standard set methods......................................... 311 22.8 Usage of setMethods......................................... 312 22.9 Advanced Simulation........................................ 312 22.10 Linearization............................................. 313 22.11 Usage of Linearization methods................................... 313 23 OMJulia – OpenModelica Julia Scripting 315 23.1 Features of OMJulia......................................... 315 23.2 Test Commands........................................... 315 23.3 WorkDirectory............................................ 317 23.4 BuildModel.............................................. 317 23.5 Standard get methods........................................ 317 23.6 Usage of getMethods......................................... 317 23.7 Standard set methods......................................... 319 23.8 Usage of setMethods......................................... 319 23.9 Advanced Simulation........................................ 319 23.10 Linearization............................................. 320 23.11 Usage of Linearization methods................................... 320 23.12 Sensitivity Analysis......................................... 320 iii 23.13 Usage................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages517 Page
-
File Size-