JModelica.org
User Guide

Version 1.9.1

2013-05-16


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.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 or Mac OS
3. Run an example
4. Check 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 compilation example
2.2. Simple JMU compilation example
2.3. Simple FMUX compilation example
2.4. Compiling from libraries
2.5. Compiler settings
2.5.1. compile_fmu parameters
2.5.2. Compiler options
2.6. Compile in separate process
2.7. Compilation in more detail
2.7.1. Create a compiler
2.7.2. Source tree generation and flattening
2.7.3. Code generation
3. Loading models
3.1. The FMU
3.2. The JMU
3.3. The FMUX
3.4. Loading an FMU
3.5. Loading a JMU
3.6. Loading an FMUX
4. Changing model parameters
4.1. Setting and getting parameters
5. Debugging models
5.1. Compiler info in system output
5.2. Getting HTML diagnostics
5.3. Debugging nonlinear systems
5. Initialization
1. Solving DAE initialization problems
2. How JModelica.org creates the initialization system of equations
3. Initialization algorithms
3.1. Initialization using IPOPT
3.2. Initialization using KInitSolveAlg
3.2.1. The use of constraints
3.2.2. Verbosity of KINSOL
6. Simulation
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 JMUModel
3.2.3. Options for FMUModelME1
3.2.4. Options for FMUModelCS1
3.3. Return argument
4. Examples
4.1. Simulation with inputs
4.2. Simulation of a discontinuous system
4.3. Simulation of a high-index model
4.4. Simulation and parameter sweeps
4.5. Simulation with sensitivities
4.6. Simulation using the native FMI interface
4.6.1. Implementation
4.7. Simulation of Co-Simulation FMUs
7. Optimization
1. Introduction
2. A first example
3. Solving optimization problems
4. Scaling
5. Dynamic optimization of DAEs using direct collocation with JMUs
5.1. Examples
5.1.1. Optimal control
5.1.2. Minimum time problems
5.1.3. Parameter optimization
6. Dynamic optimization of DAEs using direct collocation with CasADi
6.1. Algorithm overview
6.2. Examples
6.2.1. Optimal control
7. Optimization of ODEs using Pseduo-Spectral methods
7.1. CasADi
7.2. Options
7.3. Examples
7.3.1. Van der Pol oscillator
7.3.2. Hohmann Transfer
7.4. Limitations
8. Derivative-Free Model Calibration of FMUs
8. Graphical User Interface for Visualization of Results
1. Plot GUI
1.1. Introduction
1.2. Edit Options
1.3. View Options
1.4. Example
9. Hand Guided Tearing
1. Options flags
2. Identification of equations
2.1. Syntax
2.2. Example
3. Specification of hand guided tearing
3.1. Bias the automatic tearing algorithm
3.1.1. Specify an equation as residual equation
3.1.2. Specify a variable as iteration variable
3.2. Direct specification of tearing pairs
3.2.1. Specify tearing pairs on component level
3.2.2. Specify tearing pairs on system level
10. 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
11. 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
12. Limitations
13. Release notes
1. Release notes for JModelica.org version 1.9.1
2. Release notes for JModelica.org version 1.9
2.1. Highlights
2.2. Compilers
2.2.1. Improved Modelica compliance
2.2.2. Support for MSL CombiTables
2.2.3. Support for hand guided tearing
2.2.4. Improved function inlining
2.2.5. Memory and execution time improvements in the compiler
2.3. Python
2.3.1. Compile in separate process
2.4. Simulation
2.4.1. Simulation of co-simulation FMUs
2.5. Optimization
2.5.1. Improvements to CasADi-based collocation algorithm
2.6. Contributors
2.6.1. Previous contributors
3. Release notes for JModelica.org version 1.8.1
4. Release notes for JModelica.org version 1.8
4.1. Highlights
4.2. Compilers
4.2.1. Improved Modelica compliance
4.2.2. Function inlining
4.2.3. New state selection algorithm
4.3. Python
4.3.1. Simplified compiling with libraries
4.4. Optimization
4.4.1. Improvements to CasADi-based collocation algorithm
4.5. Contributors
4.5.1. Previous contributors
5. Release notes for JModelica.org version 1.7
5.1. Highlights
5.2. Compilers
5.2.1. Support for mixed systems of equations
5.2.2. Support for tearing
5.2.3. Improved Modelica compliance
5.2.4. Function inlining
5.3. Python
5.3.1. New package structure
5.3.2. Support for shared libraries in FMUs
5.4. Simulation
5.4.1. Simulation of hybrid systems
5.5. Optimization
5.5.1. A novel CasADi-based collocation algorithm
5.6. Contributors
5.6.1. Previous contributors
6. Release notes for JModelica.org version 1.6
6.1. Highlights
6.2. Compilers
6.2.1. Index reduction
6.2.2. Modelica compliance
6.3. Python
6.3.1. Graphical user interface for visualization of simulation and optimization results
6.3.2. Simulation with function inputs
6.3.3. Compilation of XML models
6.3.4. Python version upgrade
6.4. Optimization
6.4.1. Derivative- free optimization of FMUs
6.4.2. Pseudo spectral methods for dynamic optimization
6.5. Eclipse Modelica plugin
6.6. Contributors
6.6.1. Previous contributors
7. Release notes for JModelica.org version 1.5
7.1. Highlights
7.2. Compilers
7.2.1. When clauses
7.2.2. Equation sorting
7.2.3. Connections
7.2.4. Eclipse IDE
7.2.5. Miscellaneous
7.3. Simulation
7.3.1. FMU export
7.3.2. Simulation of ODEs
7.3.3. Simulation of hybrid and sampled systems
7.4. Initialization of DAEs
7.5. Optimization
7.6. Contributors
7.6.1. Previous contributors
8. Release notes for JModelica.org version 1.4
8.1. Highlights
8.2. Compilers
8.2.1. Enumerations
8.2.2. Miscellaneous
8.2.3. Improved reporting of structural singularities
8.2.4. Automatic addition of initial equations
8.3. Python interface
8.3.1. Models
8.3.2. Compiling
8.3.3. initialize, simulate and optimize
8.3.4. Result object
8.4. Simulation
8.4.1. Input trajectories
8.4.2. Sensitivity calculations
8.4.3. Write scaled simulation result to file
8.5. Contributors
8.5.1. Previous contributors
9. Release notes for JModelica.org version 1.3
9.1. Highlights
9.2. Compilers
9.2.1. The Modelica compiler
9.2.2. The Optimica compiler
9.3. JModelica.org Model Interface (JMI)
9.3.1. The collocation optimization algorithm
9.4. Assimulo
9.5. FMI compliance
9.6. XML model export
9.6.1. noEvent operator
9.6.2. static attribute
9.7. Python integration
9.7.1. High-level functions
9.7.2. File I/O
9.8. Contributors
9.8.1. Previous contributors
10. Release notes for JModelica.org version 1.2
10.1. Highlights
10.2. Compilers
10.2.1. The Modelica compiler
10.2.2. The Optimica Compiler
10.3. The JModelica.org Model Interface (JMI)
10.3.1. General
10.4. The collocation optimization algorithm
10.4.1. Piecewise constant control signals
10.4.2. Free initial conditions allowed
10.4.3. Dens output of optimization result
10.5. New simulation package: Assimulo
10.6. FMI compliance
10.7. XML model export
10.8. Python integration
10.8.1. New high-level functions for optimization and simulation
10.9. Contributors
10.9.1. Previous contributors
Bibliography
Index

List of Figures

1.1. JModelica platform architecture.
2.1. Selecting Python packages in the Choose components window.
6.1. Simulation result of the Van der Pol oscillator.
6.2. A schematic picture of the quadruple tank process.
6.3. Tank levels
6.4. Input trajectories
6.5. Electric Circuit
6.6. Simulation result
6.7. Modelica.Mechanics.Rotational.First connection diagram
6.8. Simulation result for Modelica.Mechanics.Rotational.Examples.First
6.9. Simulation result-phase plane
6.10. Sensitivity results.
6.11. Simulation result
6.12. Simulation result
7.1. Optimal profiles for the VDP oscillator
7.2. Optimal profiles for the CSTR problem.
7.3. Optimal control profiles and simulated trajectories corresponding to the optimal control input.
7.4. Minimum time profiles for the Van der Pol Oscillator.
7.5. A schematic picture of the quadruple tank process.
7.6. Measured state profiles.
7.7. Control inputs used in the identification experiment.
7.8. Simulation result for the nominal model.
7.9. State profiles corresponding to estimated values of a1 and a2.
7.10. State profiles corresponding to estimated values of a1, a2, a3 and a4.
7.11. Handling of discontinuities.
7.12. The Van der Pol oscillator optimized using Gauss PseudoSpectral method.
7.13. Hohmann Transfer
7.14. The Furuta pendulum.
7.15. Measurements of Measurements of and for the Furuta pendulum. and Measurements of and for the Furuta pendulum. for the Furuta pendulum.
7.16. 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.
7.17. 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.
8.1. Overview of JModelica.org Plot GUI
8.2. A result file has been loaded.
8.3. Plotting a trajectory.
8.4. Figure Options.
8.5. Figure Axis and Labels Options.
8.6. Figure Lines and Legends options.
8.7. An additional plot has been added.
8.8. Moving Plot Figure.
8.9. GUI after moving the plot window.
8.10. Complex Figure Layout.
8.11. Figure View Options.
8.12. Multiple figure example.
10.1. Optimization result

List of Tables

2.1. Package versions for Ubuntu
4.1. Compiler options
4.2. Example of an iteration in nle_solver_log.csv for a block. This example shows iteration 1 of block 2 of a system, this particular block has two IVs and residuals
5.1. Options for the collocation-based optimization algorithm
5.2. Options for KInitSolveAlg
5.3. Options for KINSOL contained in the KINSOL_options dictionary
5.4. Values allowed in the constraints array
5.5. Verbosity levels in KINSOL
6.1. General options for AssimuloAlg.
6.2. Selection of solver arguments for CVode
6.3. Selection of solver arguments for IDA
6.4. General options for AssimuloFMIAlg.
6.5. Selection of solver arguments for CVode
6.6. General options for FMICSAlg.
6.7. Result Object
7.1. Options for the JMU and collocation-based optimization algorithm
7.2. Parameters for the quadruple tank process.
7.3. Options for the CasADi and collocation-based optimization algorithm
7.4. Options for the Pseudospectral optimization algorithms.