JModelica.org
User Guide

Version 2.0

2017-05-10


Acknowledgements

This document is produced with DocBook 5 using XMLMind XML Editor for authoring, Norman Walsh's XSL stylesheets and a GNOME xsltproc + Apache fop toolchain. Math contents is converted from LaTeX using the TeX/LaTeX to MathML Online Translator by the Ontario Research Centre for Computer Algebra and processed by JEuclid.

1. Introduction
1.1. About JModelica.org
1.2. Mission Statement
1.3. Technology
2. Installation
2.1. Supported platforms
2.2. Installation on Windows
2.2.1. Dependencies
2.2.2. Installation
2.2.3. Verifying the installation
2.2.4. Compilation from sources
2.3. Installation on Linux systems
2.3.1. Prerequisites
2.3.1.1. Installing pre-compiled packages
2.3.1.2. Compiling Ipopt
2.3.1.3. Installing JModelica.org with WORHP (optional)
2.3.2. Compiling
2.3.3. Testing JModelica.org
3. Getting started
3.1. The JModelica.org Python packages
3.2. Starting a Python session
3.2.1. Windows
3.2.2. Linux
3.3. Running an example
3.4. Redefining the JModelica.org environment
3.4.1. Example redefining IPOPT_HOME
3.5. The JModelica.org user forum
4. Working with Models in Python
4.1. Introduction to models
4.1.1. The different model objects in JModelica.org
4.2. Compilation
4.2.1. Simple FMU-ME compilation example
4.2.2. Simple FMU-CS compilation example
4.2.3. Compiling from libraries
4.2.4. Compiler settings
4.2.4.1. compile_fmu arguments
4.2.4.2. Compiler options
4.2.5. Compiling in a separate process
4.2.6. Compilation in more detail
4.2.6.1. Creating a compiler
4.2.6.2. Source tree generation and flattening
4.2.6.3. Code generation
4.3. Loading models
4.3.1. The FMU
4.3.2. Loading an FMU
4.3.3. Transferring an OptimizationProblem
4.4. Changing model parameters
4.4.1. Setting and getting parameters
4.5. Debugging models
4.5.1. Compiler logging
4.5.2. Getting HTML diagnostics
4.5.3. Runtime logging
4.5.3.1. Setting log level
4.5.3.2. Interpreting logs from FMUs produced by JModelica.org
5. Simulation of FMUs in Python
5.1. Introduction
5.2. A first example
5.3. Simulation of Models
5.3.1. Convenience method, load_fmu
5.3.2. Arguments
5.3.2.1. Input
5.3.2.2. Options for FMUModelME1 and FMUModelME2
5.3.2.3. Options for FMUModelCS1 and FMUModelCS2
5.3.3. Return argument
5.4. Examples
5.4.1. Simulation of a high-index model
5.4.2. Simulation and parameter sweeps
5.4.3. Simulation of an Engine model with inputs
5.4.4. Simulation using the native FMI interface
5.4.4.1. Implementation
5.4.5. Simulation of Co-Simulation FMUs
6. Dynamic Optimization in Python
6.1. Introduction
6.2. A first example
6.3. Solving optimization problems
6.4. Scaling
6.5. Dynamic optimization of DAEs using direct collocation with CasADi
6.5.1. Algorithm overview
6.5.1.1. Reusing the same discretization for several optimization solutions
6.5.1.2. Warm starting
6.5.2. Examples
6.5.2.1. Optimal control
6.5.2.2. Minimum time problems
6.5.2.3. Optimization under delay constraints
6.5.2.4. Parameter estimation
6.5.3. Investigating optimization progress
6.5.3.1. Collocation
6.5.3.2. Inspecting residuals
6.5.3.3. Inspecting the constraint Jacobian
6.5.3.4. Inspecting dual variables
6.5.3.5. Inspecting low level information about NLP solver progress
6.5.4. Eliminating algebraic variables
6.5.4.1. Basic use
6.5.4.2. Small example
6.5.4.3. The many colors of symbolic elimination
6.5.4.4. Tearing
6.5.4.5. Available options
6.6. Derivative-Free Model Calibration of FMUs
7. Graphical User Interface for Visualization of Results
7.1. Plot GUI
7.1.1. Introduction
7.1.2. Edit Options
7.1.3. View Options
7.1.4. Example
8. The Optimica Language Extension
8.1. A new specialized class: optimization
8.2. Attributes for the built in class Real
8.3. A Function for accessing instant values of a variable
8.4. Class attributes
8.5. Constraints
9. FMI Interface
9.1. Overview of JModelica.org FMI Python package
10. High-level functions: initialize, simulate and optimize
10.1. Overview
10.1.1. Importing the high-level functions
10.1.2. Default arguments
10.1.2.1. Function arguments
10.1.2.2. Algorithm argument alg_args
10.1.2.3. Algorithm argument solver_args
10.1.3. Result object
10.1.4. Algorithms
10.1.5. Short simulation example
11. Limitations
A. Compiler options
A.1. List of options that can be set in compiler
B. Using External Functions in Modelica
B.1. Introduction
B.2. LibraryDirectory
B.3. GCC
C. Release Notes
C.1. Release notes for JModelica.org version 2.0
C.1.1. Highlights
C.1.2. Compiler
C.1.2.1. Compliance
C.1.3. A novel co-simulation algorithm
C.1.4. Simulation
C.1.5. HTML Diagnostics
C.2. Release notes for JModelica.org version 1.17
C.2.1. Highlights
C.2.2. Compiler
C.2.2.1. Compliance
C.3. Release notes for JModelica.org version 1.16
C.3.1. Highlights
C.3.2. Compiler
C.3.2.1. Compliance
C.3.2.2. Support for dynamic state select
C.3.3. Optimization
C.4. Release notes for JModelica.org version 1.15
C.4.1. Highlights
C.4.2. Compiler
C.4.2.1. Compliance
C.4.2.2. Support for over-constrained initialization systems
C.4.2.3. FMU 2.0 export
C.4.2.4. Improved numerical algorithms in FMU runtime
C.4.2.5. CasADi 2.0 support in Optimization
C.4.3. Simulation
C.5. Release notes for JModelica.org version 1.14
C.5.1. Highlights
C.5.2. Compiler
C.5.2.1. Compliance
C.5.2.2. New compiler API
C.5.2.3. FMI 2.0 RC2 export
C.5.3. Simulation
C.5.4. Optimization
C.6. Release notes for JModelica.org version 1.13
C.6.1. Highlights
C.6.2. Compilers
C.6.2.1. FMI 2.0 RC1 export
C.6.2.2. Compliance
C.6.3. Simulation
C.6.3.1. In-lined switches
C.6.4. Optimization
C.6.4.1. New CasADi tool chain
C.7. Release notes for JModelica.org version 1.12
C.7.1. Highlights
C.7.2. Compilers
C.7.3. Simulation
C.7.4. Contributors
C.7.4.1. Previous contributors
C.8. Release notes for JModelica.org version 1.11
C.8.1. Highlights
C.8.2. Compilers
C.8.3. Simulation
C.8.3.1. Runtime logging
C.8.3.2. Support for ModelicaError and assert
C.8.4. Contributors
C.8.4.1. Previous contributors
C.9. Release notes for JModelica.org version 1.10
C.9.1. Highlights
C.9.2. Compilers
C.9.2.1. Export of FMUs for Co-Simulation
C.9.3. Python
C.9.3.1. Improved result data access
C.9.3.2. Improved error handling
C.9.3.3. Parsing of FMU log files
C.9.4. Simulation
C.9.4.1. Support for FMU version 2.0b4
C.9.4.2. Result filter
C.9.4.3. Improved solver support
C.9.5. Optimization
C.9.5.1. Improved variable scaling
C.9.5.2. Improved handling of measurement data
C.9.6. Contributors
C.9.6.1. Previous contributors
C.10. Release notes for JModelica.org version 1.9.1
C.11. Release notes for JModelica.org version 1.9
C.11.1. Highlights
C.11.2. Compilers
C.11.2.1. Improved Modelica compliance
C.11.2.2. Support for MSL CombiTables
C.11.2.3. Support for hand guided tearing
C.11.2.4. Improved function inlining
C.11.2.5. Memory and execution time improvements in the compiler
C.11.3. Python
C.11.3.1. Compile in separate process
C.11.4. Simulation
C.11.4.1. Simulation of co-simulation FMUs
C.11.5. Optimization
C.11.5.1. Improvements to CasADi-based collocation algorithm
C.11.6. Contributors
C.11.6.1. Previous contributors
C.12. Release notes for JModelica.org version 1.8.1
C.13. Release notes for JModelica.org version 1.8
C.13.1. Highlights
C.13.2. Compilers
C.13.2.1. Improved Modelica compliance
C.13.2.2. Function inlining
C.13.2.3. New state selection algorithm
C.13.3. Python
C.13.3.1. Simplified compiling with libraries
C.13.4. Optimization
C.13.4.1. Improvements to CasADi-based collocation algorithm
C.13.5. Contributors
C.13.5.1. Previous contributors
C.14. Release notes for JModelica.org version 1.7
C.14.1. Highlights
C.14.2. Compilers
C.14.2.1. Support for mixed systems of equations
C.14.2.2. Support for tearing
C.14.2.3. Improved Modelica compliance
C.14.2.4. Function inlining
C.14.3. Python
C.14.3.1. New package structure
C.14.3.2. Support for shared libraries in FMUs
C.14.4. Simulation
C.14.4.1. Simulation of hybrid systems
C.14.5. Optimization
C.14.5.1. A novel CasADi-based collocation algorithm
C.14.6. Contributors
C.14.6.1. Previous contributors
C.15. Release notes for JModelica.org version 1.6
C.15.1. Highlights
C.15.2. Compilers
C.15.2.1. Index reduction
C.15.2.2. Modelica compliance
C.15.3. Python
C.15.3.1. Graphical user interface for visualization of simulation and optimization results
C.15.3.2. Simulation with function inputs
C.15.3.3. Compilation of XML models
C.15.3.4. Python version upgrade
C.15.4. Optimization
C.15.4.1. Derivative- free optimization of FMUs
C.15.4.2. Pseudo spectral methods for dynamic optimization
C.15.5. Eclipse Modelica plugin
C.15.6. Contributors
C.15.6.1. Previous contributors
C.16. Release notes for JModelica.org version 1.5
C.16.1. Highlights
C.16.2. Compilers
C.16.2.1. When clauses
C.16.2.2. Equation sorting
C.16.2.3. Connections
C.16.2.4. Eclipse IDE
C.16.2.5. Miscellaneous
C.16.3. Simulation
C.16.3.1. FMU export
C.16.3.2. Simulation of ODEs
C.16.3.3. Simulation of hybrid and sampled systems
C.16.4. Initialization of DAEs
C.16.5. Optimization
C.16.6. Contributors
C.16.6.1. Previous contributors
C.17. Release notes for JModelica.org version 1.4
C.17.1. Highlights
C.17.2. Compilers
C.17.2.1. Enumerations
C.17.2.2. Miscellaneous
C.17.2.3. Improved reporting of structural singularities
C.17.2.4. Automatic addition of initial equations
C.17.3. Python interface
C.17.3.1. Models
C.17.3.2. Compiling
C.17.3.3. initialize, simulate and optimize
C.17.3.4. Result object
C.17.4. Simulation
C.17.4.1. Input trajectories
C.17.4.2. Sensitivity calculations
C.17.4.3. Write scaled simulation result to file
C.17.5. Contributors
C.17.5.1. Previous contributors
C.18. Release notes for JModelica.org version 1.3
C.18.1. Highlights
C.18.2. Compilers
C.18.2.1. The Modelica compiler
C.18.2.2. The Optimica compiler
C.18.3. JModelica.org Model Interface (JMI)
C.18.3.1. The collocation optimization algorithm
C.18.4. Assimulo
C.18.5. FMI compliance
C.18.6. XML model export
C.18.6.1. noEvent operator
C.18.6.2. static attribute
C.18.7. Python integration
C.18.7.1. High-level functions
C.18.7.2. File I/O
C.18.8. Contributors
C.18.8.1. Previous contributors
C.19. Release notes for JModelica.org version 1.2
C.19.1. Highlights
C.19.2. Compilers
C.19.2.1. The Modelica compiler
C.19.2.2. The Optimica Compiler
C.19.3. The JModelica.org Model Interface (JMI)
C.19.3.1. General
C.19.4. The collocation optimization algorithm
C.19.4.1. Piecewise constant control signals
C.19.4.2. Free initial conditions allowed
C.19.4.3. Dens output of optimization result
C.19.5. New simulation package: Assimulo
C.19.6. FMI compliance
C.19.7. XML model export
C.19.8. Python integration
C.19.8.1. New high-level functions for optimization and simulation
C.19.9. Contributors
C.19.9.1. Previous contributors
Bibliography