
OpenModelica User’s Guide Release v1.19.0-dev-221-g797491b1c42 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..................... 105 8.3 Composite Model Editing of External Models............................ 105 9 OMSimulator 121 9.1 Introduction............................................. 121 9.2 OMSimulator............................................. 121 9.3 OMSimulatorLib........................................... 123 9.4 OMSimulatorLua........................................... 138 9.5 OMSimulatorPython......................................... 152 9.6 OpenModelicaScripting....................................... 167 9.7 Graphical Modelling......................................... 182 9.8 SSP Support............................................. 186 10 System Identification 193 10.1 Examples............................................... 193 10.2 Python and C API.......................................... 195 11 OpenModelica Encryption 203 11.1 Encrypting the Library........................................ 203 11.2 Loading an Encrypted Library.................................... 203 11.3 Notes................................................. 203 12 OMNotebook with DrModelica and DrControl 205 12.1 Interactive Notebooks with Literate Programming......................... 205 12.2 DrModelica Tutoring System – an Application of OMNotebook.................. 206 12.3 DrControl Tutorial for Teaching Control Theory.......................... 212 12.4 OpenModelica Notebook Commands................................ 222 12.5 References.............................................. 227 13 Optimization with OpenModelica 229 13.1 Builtin Dynamic Optimization with OpenModelica and IpOpt................... 229 13.2 Compiling the Modelica code.................................... 229 13.3 An Example............................................. 230 13.4 Different Options for the Optimizer IPOPT............................. 232 13.5 Dynamic Optimization with OpenModelica and CasADi...................... 232 13.6 Parameter Sweep Optimization using OMOptim.......................... 237 ii 14 Parameter Sensitivities with OpenModelica 245 14.1 Single Parameter sensitivities with IDA/Sundials.......................... 245 14.2 Single and Multi-parameter sensitivities with OMSens....................... 247 15 PDEModelica1 261 15.1 PDEModelica1 language elements.................................. 261 15.2 Limitations.............................................. 262 15.3 Viewing results............................................ 262 16 MDT – The OpenModelica Development Tooling Eclipse Plugin 263 16.1 Introduction............................................. 263 16.2 Installation.............................................. 263 16.3 Getting Started............................................ 264 17 MDT Debugger for Algorithmic Modelica 279 17.1 The Eclipse-based Debugger for Algorithmic Modelica....................... 279 18 Modelica Performance Analyzer 287 18.1 Profiling information for ProfilingTest................................ 288 18.2 Genenerated JSON for the Example................................. 290 18.3 Using the Profiler from OMEdit................................... 291 19 Simulation in Web Browser 293 20 Interoperability – C and Python 295 20.1 Calling External C functions..................................... 295 20.2 Calling external Python Code from a Modelica model....................... 296 20.3 Calling OpenModelica from Python Code.............................. 298 21 OpenModelica Python Interface and PySimulator 301 21.1 OMPython – OpenModelica Python Interface............................ 301 21.2 Enhanced OMPython Features.................................... 304 21.3 PySimulator............................................. 308 22 OMMatlab – OpenModelica Matlab Interface 309 22.1 Features of OMMatlab........................................ 309 22.2 Test Commands........................................... 309 22.3 WorkDirectory............................................ 311 22.4 BuildModel.............................................. 311 22.5 Standard get methods........................................ 311 22.6 Usage of getMethods......................................... 311 22.7 Standard set methods......................................... 313 22.8 Usage of setMethods......................................... 314 22.9 Advanced Simulation........................................ 314 22.10 Linearization............................................. 315 22.11 Usage of Linearization methods................................... 315 23 OMJulia – OpenModelica Julia Scripting 317 23.1 Features of OMJulia......................................... 317 23.2 Test Commands........................................... 317 23.3 WorkDirectory............................................ 319 23.4 BuildModel.............................................. 319 23.5 Standard get methods........................................ 319 23.6 Usage of getMethods......................................... 319 23.7 Standard set methods......................................... 321 23.8 Usage of setMethods......................................... 321 23.9 Advanced Simulation........................................ 321 23.10 Linearization............................................. 322 23.11 Usage of Linearization methods................................... 322 23.12 Sensitivity Analysis......................................... 322 iii 23.13 Usage................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages519 Page
-
File Size-