JModelica.org
User Guide

Version 1.7

2012-02-21


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. Prerequisites
2.1. Java
2.2. Python
3. Binary distribution
3.1. Windows
3.1.1. Bundled tools, libraries and Python packages
3.1.2. Installing JModelica.org with Windows installer
3.2. Linux
3.3. Mac OS X
4. Software Development Kit
4.1. Prerequisites
4.2. Installing the JModelica.org SDK
4.2.1. Bundled tools, libraries and Python packages
4.2.2. Step-by-step instructions
4.3. Changing Ipopt solver
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 JMU compilation example
2.2. Simple FMU compilation example
2.3. Simple FMUX compilation example
2.4. Compiling from libraries
2.5. Compiler settings
2.5.1. compile_jmu parameters
2.5.2. compile_fmu parameters
2.5.3. compile_fmux parameters
2.5.4. Compiler options
2.5.5. Compiler targets for compile_jmu
2.5.6. Compiler targets for compile_fmu
2.5.7. Compiler targets for compile_fmux
2.6. Compilation in more detail
2.6.1. Create a compiler
2.6.2. Source tree generation and flattening
2.6.3. Code generation
3. Loading models
3.1. The JMU
3.2. The FMU
3.3. The FMUX
3.4. Loading a JMU
3.5. Loading an FMU
3.6. Loading an FMUX
4. Variable and parameter manipulation
4.1. Model variable XML files
4.2. Setting and getting variables
4.3. Loading and saving parameters
4.3.1. Loading XML values file
4.3.2. Writing to XML values file
5. Debugging models
5. FMI Interface
1. Overview of JModelica.org FMI Python package
2. Example
2.1. Simulation using the native FMI interface
2.1.1. Implementation
6. 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. Initilization using KInitSolveAlg
3.2.1. The use of constraints
3.2.2. Verbosity of KINSOL
7. Simulation
1. Introduction
2. A first example
3. Simulation of Models
3.1. Arguments
3.1.1. Input
3.1.2. Options for JMUModel
3.1.3. Options for FMUModel
3.2. 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 of an FMU
8. 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. Examples
6.1.1. Optimal control
6.1.2. Limitations
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
9. Graphical User Interface for Visualization of Results
1. Plot GUI
1.1. Introduction
1.2. Edit Options
1.3. View Options
1.4. Example
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.7
1.1. Highlights
1.2. Compilers
1.2.1. Support for mixed systems of equations
1.2.2. Support for tearing
1.2.3. Improved Modelica compliance
1.2.4. Function inlining
1.3. Python
1.3.1. New package structure
1.3.2. Support for shared libraries in FMUs
1.4. Simulation
1.4.1. Simulation of hybrid systems
1.5. Optimization
1.5.1. A novel CasADi-based collocation algorithm
1.6. Contributors
1.6.1. Previous contributors
2. Release notes for JModelica.org version 1.6
2.1. Highlights
2.2. Compilers
2.2.1. Index reduction
2.2.2. Modelica compliance
2.3. Python
2.3.1. Graphical user interface for visualization of simulation and optimization results
2.3.2. Simulation with function inputs
2.3.3. Compilation of XML models
2.3.4. Python version upgrade
2.4. Optimization
2.4.1. Derivative- free optimization of FMUs
2.4.2. Pseudo spectral methods for dynamic optimization
2.5. Eclipse Modelica plugin
2.6. Contributors
2.6.1. Previous contributors
3. Release notes for JModelica.org version 1.5
3.1. Highlights
3.2. Compilers
3.2.1. When clauses
3.2.2. Equation sorting
3.2.3. Connections
3.2.4. Eclipse IDE
3.2.5. Miscellaneous
3.3. Simulation
3.3.1. FMU export
3.3.2. Simulation of ODEs
3.3.3. Simulation of hybrid and sampled systems
3.4. Initialization of DAEs
3.5. Optimization
3.6. Contributors
3.6.1. Previous contributors
4. Release notes for JModelica.org version 1.4
4.1. Highlights
4.2. Compilers
4.2.1. Enumerations
4.2.2. Miscellaneous
4.2.3. Improved reporting of structural singularities
4.2.4. Automatic addition of initial equations
4.3. Python interface
4.3.1. Models
4.3.2. Compiling
4.3.3. initialize, simulate and optimize
4.3.4. Result object
4.4. Simulation
4.4.1. Input trajectories
4.4.2. Sensitivity calculations
4.4.3. Write scaled simulation result to file
4.5. Contributors
4.5.1. Previous contributors
5. Release notes for JModelica.org version 1.3
5.1. Highlights
5.2. Compilers
5.2.1. The Modelica compiler
5.2.2. The Optimica compiler
5.3. JModelica.org Model Interface (JMI)
5.3.1. The collocation optimization algorithm
5.4. Assimulo
5.5. FMI compliance
5.6. XML model export
5.6.1. noEvent operator
5.6.2. static attribute
5.7. Python integration
5.7.1. High-level functions
5.7.2. File I/O
5.8. Contributors
5.8.1. Previous contributors
6. Release notes for JModelica.org version 1.2
6.1. Highlights
6.2. Compilers
6.2.1. The Modelica compiler
6.2.2. The Optimica Compiler
6.3. The JModelica.org Model Interface (JMI)
6.3.1. General
6.4. The collocation optimization algorithm
6.4.1. Piecewise constant control signals
6.4.2. Free initial conditions allowed
6.4.3. Dens output of optimization result
6.5. New simulation package: Assimulo
6.6. FMI compliance
6.7. XML model export
6.8. Python integration
6.8.1. New high-level functions for optimization and simulation
6.9. Contributors
6.9.1. Previous contributors
Bibliography
Index

List of Figures

1.1. JModelica platform architecture.
2.1. Selecting Python packages in the Choose components window.
5.1. Simulation result
7.1. Simulation result of the Van der Pol oscillator.
7.2. A schematic picture of the quadruple tank process.
7.3. Tank levels
7.4. Input trajectories
7.5. Electric Circuit
7.6. Simulation result
7.7. Modelica.Mechanics.Rotational.First connection diagram
7.8. Simulation result for Mecahnics.Rotational.Examples.First
7.9. Simulation result-phase plane
7.10. Sensitivity results.
7.11. Full Robot
7.12. Robot Results
7.13. Comparison with Dymola
8.1. Optimal profiles for the VDP oscillator
8.2. Optimal profiles for the CSTR problem.
8.3. Optimal control profiles and simulated trajectories corresponding to the optimal control input.
8.4. Minimum time profiles for the Van der Pol Oscillator.
8.5. A schematic picture of the quadruple tank process.
8.6. Measured state profiles.
8.7. Control inputs used in the identification experiment.
8.8. Simulation result for the nominal model.
8.9. State profiles corresponding to estimated values of a1 and a2.
8.10. State profiles corresponding to estimated values of a1, a2, a3 and a4.
8.11. Handling of discontinuities.
8.12. The Van der Pol oscillator optimized using Gauss PseudoSpectral method.
8.13. Hohmann Transfer
8.14. The Furuta pendulum.
8.15. Measurements of Measurements of and for the Furuta pendulum. and Measurements of and for the Furuta pendulum. for the Furuta pendulum.
8.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.
8.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.
9.1. Overview of JModelica.org Plot GUI
9.2. A result file has been loaded.
9.3. Plotting a trajectory.
9.4. Figure Options.
9.5. Figure Axis and Labels Options.
9.6. Figure Lines and Legends options.
9.7. An additional plot has been added.
9.8. Moving Plot Figure.
9.9. GUI after moving the plot window.
9.10. Complex Figure Layout.
9.11. Figure View Options.
9.12. Multiple figure example.
10.1. Optimization result

List of Tables

2.1. Required Python packages
2.2. IPython dependencies on Windows
4.1. Compiler options
5.1. Conversion table.
6.1. Options for the collocation-based optimization algorithm
6.2. Options for KInitSolveAlg
6.3. Options for KINSOL contained in the KINSOL_options dictionary
6.4. Values allowed in the constraints array
6.5. Verbosity levels in KINSOL
7.1. General options for AssimuloAlg.
7.2. Selection of solver arguments for CVode
7.3. Selection of solver arguments for IDA
7.4. General options for AssimuloFMIAlg.
7.5. Selection of solver arguments for CVode
7.6. Result Object
8.1. Options for the JMU and collocation-based optimization algorithm
8.2. Parameters for the quadruple tank process.
8.3. Options for the CasADi and collocation-based optimization algorithm
8.4. Options for the Pseudospectral optimization algorithms.