JModelica.org
User Guide

Version 1.17

2015-12-08


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.

Table of Contents

1. Introduction
1. About JModelica.org
2. Mission Statement
3. Technology
4. Architecture
5. Extensibility
2. Installation
1. Supported platforms
2. Installation on Windows
2.1. Dependencies
2.2. Installation
2.3. Verifying the installation
2.4. Compilation from sources
3. Installation on Linux systems
3.1. Prerequisites
3.1.1. Installing pre-compiled packages
3.1.2. Compiling Ipopt
3.1.3. Installing JModelica.org with WORHP (optional)
3.2. Compiling
3.3. Testing JModelica.org
3. Getting started
1. The JModelica.org Python packages
2. Starting a Python session
2.1. Windows
2.2. Linux
3. Running an example
4. Checking your installation
5. Redefining the JModelica.org environment
5.1. Example redefining IPOPT_HOME
6. The JModelica.org user forum
4. Working with Models
1. Introduction to models
1.1. The different model objects in JModelica.org
2. Compilation
2.1. Simple FMU-ME compilation example
2.2. Simple FMU-CS compilation example
2.3. Compiling from libraries
2.4. Compiler settings
2.4.1. compile_fmu arguments
2.4.2. Compiler options
2.5. Compiling in a separate process
2.6. Compilation in more detail
2.6.1. Creating a compiler
2.6.2. Source tree generation and flattening
2.6.3. Code generation
3. Loading models
3.1. The FMU
3.2. Loading an FMU
3.3. Transferring an OptimizationProblem
4. Changing model parameters
4.1. Setting and getting parameters
5. Debugging models
5.1. Compiler logging
5.2. Runtime logging
5.2.1. Setting log level
5.2.2. Interpreting logs from FMUs produced by JModelica.org
5.3. Getting HTML diagnostics
5. Simulation of FMUs
1. Introduction
2. A first example
3. Simulation of Models
3.1. Convenience method, load_fmu
3.2. Arguments
3.2.1. Input
3.2.2. Options for FMUModelME1 and FMUModelME2
3.2.3. Options for FMUModelCS1 and FMUModelCS2
3.3. Return argument
4. Examples
4.1. Simulation of a high-index model
4.2. Simulation and parameter sweeps
4.3. Simulation of an Engine model with inputs
4.4. Simulation using the native FMI interface
4.4.1. Implementation
4.5. Simulation of Co-Simulation FMUs
6. Optimization
1. Introduction
2. A first example
3. Solving optimization problems
4. Scaling
5. Dynamic optimization of DAEs using direct collocation with CasADi
5.1. Algorithm overview
5.1.1. Reusing the same discretization for several optimization solutions
5.1.2. Warm starting
5.2. Examples
5.2.1. Optimal control
5.2.2. Minimum time problems
5.2.3. Optimization under delay constraints
5.2.4. Parameter estimation
5.3. Investigating optimization progress
5.3.1. Collocation
5.3.2. Inspecting residuals
5.3.3. Inspecting the constraint Jacobian
5.3.4. Inspecting dual variables
5.3.5. Inspecting low level information about NLP solver progress
6. Derivative-Free Model Calibration of FMUs
7. Graphical User Interface for Visualization of Results
1. Plot GUI
1.1. Introduction
1.2. Edit Options
1.3. View Options
1.4. Example
8. Optimica
1. A new specialized class: optimization
2. Attributes for the built in class Real
3. A Function for accessing instant values of a variable
4. Class attributes
5. Constraints
9. Abstract syntax tree access
1. Tutorial on Abstract Syntax Trees (ASTs)
1.1. About Abstract Syntax Trees
1.2. Load the Modelica standard library
1.3. Count the number of classes in the Modelica standard library
1.4. Dump the instance AST
1.5. Flattening of the filter model
10. Limitations
A. Compiler options
1. List of options that can be set in compiler
B. Release notes
1. Release notes for JModelica.org version 1.17
1.1. Highlights
1.2. Compiler
1.2.1. Compliance
2. Release notes for JModelica.org version 1.16
2.1. Highlights
2.2. Compiler
2.2.1. Compliance
2.2.2. Support for dynamic state select
2.3. Optimization
3. Release notes for JModelica.org version 1.15
3.1. Highlights
3.2. Compiler
3.2.1. Compliance
3.2.2. Support for over-constrained initialization systems
3.2.3. FMU 2.0 export
3.2.4. Improved numerical algorithms in FMU runtime
3.2.5. CasADi 2.0 support in Optimization
3.3. Simulation
4. Release notes for JModelica.org version 1.14
4.1. Highlights
4.2. Compiler
4.2.1. Compliance
4.2.2. New compiler API
4.2.3. FMI 2.0 RC2 export
4.3. Simulation
4.4. Optimization
5. Release notes for JModelica.org version 1.13
5.1. Highlights
5.2. Compilers
5.2.1. FMI 2.0 RC1 export
5.2.2. Compliance
5.3. Simulation
5.3.1. In-lined switches
5.4. Optimization
5.4.1. New CasADi tool chain
6. Release notes for JModelica.org version 1.12
6.1. Highlights
6.2. Compilers
6.3. Simulation
6.4. Contributors
6.4.1. Previous contributors
7. Release notes for JModelica.org version 1.11
7.1. Highlights
7.2. Compilers
7.3. Simulation
7.3.1. Runtime logging
7.3.2. Support for ModelicaError and assert
7.4. Contributors
7.4.1. Previous contributors
8. Release notes for JModelica.org version 1.10
8.1. Highlights
8.2. Compilers
8.2.1. Export of FMUs for Co-Simulation
8.3. Python
8.3.1. Improved result data access
8.3.2. Improved error handling
8.3.3. Parsing of FMU log files
8.4. Simulation
8.4.1. Support for FMU version 2.0b4
8.4.2. Result filter
8.4.3. Improved solver support
8.5. Optimization
8.5.1. Improved variable scaling
8.5.2. Improved handling of measurement data
8.6. Contributors
8.6.1. Previous contributors
9. Release notes for JModelica.org version 1.9.1
10. Release notes for JModelica.org version 1.9
10.1. Highlights
10.2. Compilers
10.2.1. Improved Modelica compliance
10.2.2. Support for MSL CombiTables
10.2.3. Support for hand guided tearing
10.2.4. Improved function inlining
10.2.5. Memory and execution time improvements in the compiler
10.3. Python
10.3.1. Compile in separate process
10.4. Simulation
10.4.1. Simulation of co-simulation FMUs
10.5. Optimization
10.5.1. Improvements to CasADi-based collocation algorithm
10.6. Contributors
10.6.1. Previous contributors
11. Release notes for JModelica.org version 1.8.1
12. Release notes for JModelica.org version 1.8
12.1. Highlights
12.2. Compilers
12.2.1. Improved Modelica compliance
12.2.2. Function inlining
12.2.3. New state selection algorithm
12.3. Python
12.3.1. Simplified compiling with libraries
12.4. Optimization
12.4.1. Improvements to CasADi-based collocation algorithm
12.5. Contributors
12.5.1. Previous contributors
13. Release notes for JModelica.org version 1.7
13.1. Highlights
13.2. Compilers
13.2.1. Support for mixed systems of equations
13.2.2. Support for tearing
13.2.3. Improved Modelica compliance
13.2.4. Function inlining
13.3. Python
13.3.1. New package structure
13.3.2. Support for shared libraries in FMUs
13.4. Simulation
13.4.1. Simulation of hybrid systems
13.5. Optimization
13.5.1. A novel CasADi-based collocation algorithm
13.6. Contributors
13.6.1. Previous contributors
14. Release notes for JModelica.org version 1.6
14.1. Highlights
14.2. Compilers
14.2.1. Index reduction
14.2.2. Modelica compliance
14.3. Python
14.3.1. Graphical user interface for visualization of simulation and optimization results
14.3.2. Simulation with function inputs
14.3.3. Compilation of XML models
14.3.4. Python version upgrade
14.4. Optimization
14.4.1. Derivative- free optimization of FMUs
14.4.2. Pseudo spectral methods for dynamic optimization
14.5. Eclipse Modelica plugin
14.6. Contributors
14.6.1. Previous contributors
15. Release notes for JModelica.org version 1.5
15.1. Highlights
15.2. Compilers
15.2.1. When clauses
15.2.2. Equation sorting
15.2.3. Connections
15.2.4. Eclipse IDE
15.2.5. Miscellaneous
15.3. Simulation
15.3.1. FMU export
15.3.2. Simulation of ODEs
15.3.3. Simulation of hybrid and sampled systems
15.4. Initialization of DAEs
15.5. Optimization
15.6. Contributors
15.6.1. Previous contributors
16. Release notes for JModelica.org version 1.4
16.1. Highlights
16.2. Compilers
16.2.1. Enumerations
16.2.2. Miscellaneous
16.2.3. Improved reporting of structural singularities
16.2.4. Automatic addition of initial equations
16.3. Python interface
16.3.1. Models
16.3.2. Compiling
16.3.3. initialize, simulate and optimize
16.3.4. Result object
16.4. Simulation
16.4.1. Input trajectories
16.4.2. Sensitivity calculations
16.4.3. Write scaled simulation result to file
16.5. Contributors
16.5.1. Previous contributors
17. Release notes for JModelica.org version 1.3
17.1. Highlights
17.2. Compilers
17.2.1. The Modelica compiler
17.2.2. The Optimica compiler
17.3. JModelica.org Model Interface (JMI)
17.3.1. The collocation optimization algorithm
17.4. Assimulo
17.5. FMI compliance
17.6. XML model export
17.6.1. noEvent operator
17.6.2. static attribute
17.7. Python integration
17.7.1. High-level functions
17.7.2. File I/O
17.8. Contributors
17.8.1. Previous contributors
18. Release notes for JModelica.org version 1.2
18.1. Highlights
18.2. Compilers
18.2.1. The Modelica compiler
18.2.2. The Optimica Compiler
18.3. The JModelica.org Model Interface (JMI)
18.3.1. General
18.4. The collocation optimization algorithm
18.4.1. Piecewise constant control signals
18.4.2. Free initial conditions allowed
18.4.3. Dens output of optimization result
18.5. New simulation package: Assimulo
18.6. FMI compliance
18.7. XML model export
18.8. Python integration
18.8.1. New high-level functions for optimization and simulation
18.9. Contributors
18.9.1. Previous contributors
C. Initialization and simulation of JMUs (Deprecated in JModelica.org 1.15)
1. Introduction
2. Initialization of JMUs
2.1. Solving DAE initialization problems
2.2. How JModelica.org creates the initialization system of equations
2.3. Initialization algorithms
2.3.1. Initialization using IPOPT
2.3.2. Initialization using KInitSolveAlg
3. Simulation of JMUs
3.1. The simulate function
3.1.1. Input
3.1.2. Options for JMUModel
3.1.3. Return argument
3.2. Examples
3.2.1. Simulation with inputs
3.2.2. Simulation of a discontinuous system
3.2.3. Simulation with sensitivities
D. Dynamic optimization of DAEs using direct collocation with JMUs (Deprecated in JModelica.org 1.15)
1. Dynamic optimization of DAEs using direct collocation with JMUs
1.1. Examples
1.1.1. Optimal control
1.1.2. Minimum time problems
1.1.3. Parameter optimization
Bibliography

List of Figures

1.1. JModelica.org platform architecture.
2.1. Selecting Python packages in the Choose components window.
5.1. Simulation result of the Van der Pol oscillator.
5.2. Modelica.Mechanics.Rotational.First connection diagram
5.3. Simulation result for Modelica.Mechanics.Rotational.Examples.First
5.4. Simulation result-phase plane
5.5. Overview of the Engine model
5.6. Resulting trajectories for the engine model.
5.7. Simulation result
5.8. Simulation result
6.1. Optimal profiles for the VDP oscillator
6.2. Optimal profiles for the CSTR problem.
6.3. Optimal control profiles and simulated trajectories corresponding to the optimal control input.
6.4. Minimum time profiles for the Van der Pol Oscillator.
6.5. Optimization result for delayed feedback example.
6.6. A schematic picture of the quadruple tank process.
6.7. Measured state profiles.
6.8. Control inputs used in the identification experiment.
6.9. Simulation result for the nominal model.
6.10. State profiles corresponding to estimated values of a1 and a2.
6.11. The Furuta pendulum.
6.12. Measurements of Measurements of and for the Furuta pendulum. and Measurements of and for the Furuta pendulum. for the Furuta pendulum.
6.13. Measurements and model simulation result for Measurements and model simulation result for and when using nominal parameter values in the Furuta pendulum model. and Measurements and model simulation result for and when using nominal parameter values in the Furuta pendulum model. when using nominal parameter values in the Furuta pendulum model.
6.14. Measurements and model simulation results for Measurements and model simulation results for and with nominal and optimal parameters in the model of the Furuta pendulum. and Measurements and model simulation results for and with nominal and optimal parameters in the model of the Furuta pendulum. with nominal and optimal parameters in the model of the Furuta pendulum.
7.1. Overview of JModelica.org Plot GUI
7.2. A result file has been loaded.
7.3. Plotting a trajectory.
7.4. Figure Options.
7.5. Figure Axis and Labels Options.
7.6. Figure Lines and Legends options.
7.7. An additional plot has been added.
7.8. Moving Plot Figure.
7.9. GUI after moving the plot window.
7.10. Complex Figure Layout.
7.11. Figure View Options.
7.12. Multiple figure example.
8.1. Optimization result
C.1. A schematic picture of the quadruple tank process.
C.2. Tank levels
C.3. Input trajectories
C.4. Electric Circuit
C.5. Simulation result
C.6. Sensitivity results.
D.1. Optimal profiles for the CSTR problem.
D.2. Optimal control profiles and simulated trajectories corresponding to the optimal control input.
D.3. Minimum time profiles for the Van der Pol Oscillator.
D.4. A schematic picture of the quadruple tank process.
D.5. Measured state profiles.
D.6. Control inputs used in the identification experiment.
D.7. Simulation result for the nominal model.
D.8. State profiles corresponding to estimated values of a1 and a2.
D.9. State profiles corresponding to estimated values of a1, a2, a3 and a4.

List of Tables

2.1. Package versions for Ubuntu
5.1. General options for AssimuloFMIAlg.
5.2. Selection of solver arguments for CVode
5.3. General options for FMICSAlg.
5.4. Result Object
6.1. Standard options for the CasADi- and collocation-based optimization algorithm
6.2. Experimental and debugging options for the CasADi- and collocation-based optimization algorithm
6.3. Parameters for the quadruple tank process.
A.1. Compiler options
C.1. Options for the collocation-based optimization algorithm
C.2. Options for KInitSolveAlg
C.3. Options for KINSOL contained in the KINSOL_options dictionary
C.4. Values allowed in the constraints array
C.5. Verbosity levels in KINSOL
C.6. General options for AssimuloAlg.
C.7. Selection of solver arguments for CVode
C.8. Selection of solver arguments for IDA
C.9. Result Object
D.1. Options for the JMU and collocation-based optimization algorithm
D.2. Parameters for the quadruple tank process.