14. Release notes for JModelica.org version 1.2

14.1. Highlights

  • Vectors and user defined functions are supported by the Modelica and Optimica compilers

  • New Python functions for easy initialization, simulation and optimization

  • A new Python simulation package, Assimulo, has been integrated to provide increased flexibility and performance

14.2. Compilers

14.2.1. The Modelica compiler

Arrays

Arrays are now almost fully supported. This includes all arithmetic operations and use of arrays in all places allowed in the language specification. The only exception is slice operations, that are only supported for the last component in an access.

Function-like operators

Most function-like operators are now supported. The following list contains the function-like operators that are *not* supported:

  • sign(v)

  • Integer(e)

  • String(...)

  • div(x,y)

  • mod(x,y)

  • rem(x,y)

  • ceil(x)

  • floor(x)

  • integer(x)

  • delay(...)

  • cardinality()

  • semiLinear()

  • Subtask.decouple(v)

  • initial()

  • terminal()

  • smooth(p, expr)

  • sample(start, interval)

  • pre(y)

  • edge(b)

  • reinit(x, expr)

  • scalar(A)

  • vector(A)

  • matrix(A)

  • diagonal(v)

  • product(...)

  • outerProduct(v1, v2)

  • symmetric(A)

  • skew(x)

Functions and algorithms

Both algorithms and pure Modelica functions are supported, with a few exceptions:

  • Use of control structures (if, for, etc.) with test or loop expressions with variability that is higher than parameter is not supported when compiling for CppAD.

  • Indexes to arrays of records with variability that is higher than parameter is not supported when compiling for CppAD.

  • Support for inputs to functions with one or more dimensions declared with ":" is only partial.

External functions are not supported.

Miscellaneous
  • Record constructors are now supported.

  • Limited support for constructs generating events. If expressions are supported.

  • The noEvent operator is supported.

  • The error checking has been expanded to cover more errors.

  • Modelica compliance errors are reported for legal but unsupported language constructs.

14.2.2. The Optimica Compiler

All support mentioned for the Modelica compiler applies to the Optimica compiler as well.

14.3. The JModelica.org Model Interface (JMI)

14.3.1. General

Automatic scaling based on the nominal attribute

The Modelica attribute nominal can be used to scale variables. This is particularly important when solving optimization problems where poorly scaled systems may result in lack of convergence. Automatic scaling is turned off by default since it introduces a slight computational overhead: setting the compiler option enable_variable_scaling to true enables this feature.

Support for event indicator functions

Support for event indicator functions and switching functions are now provided. These features are used by the new simulation package Assimulo to simulate systems with events. Notice that limitations in the compiler front-end applies, see above.

Integer and boolean parameters

Support for event indicator functions and switching functions are now provided. These features are used by the new simulation package Assimulo to simulate systems with events. Notice that limitations in the compiler front-end applies, see above.

Linearization

A function for linearization of DAE models is provided. The linearized models are computed using automatic differentiation which gives results at machine precision. Also, for index-1 systems, linearized DAEs can be converted into linear ODE form suitable for e.g., control design.

14.4. The collocation optimization algorithm

14.4.1. Piecewise constant control signals

In control applications, in particular model predictive control, it is common to assume piecewise constant control variables, sometimes referred to as blocking factors. Blocking factors are now supported by the collocation-based optimization algorithm, see jmodelica.examples.cstr_mpc for an example.

14.4.2. Free initial conditions allowed

The restriction that all state initial conditions should be fixed has been relaxed in the optimization algorithm. This enables more flexible formulation of optimization problems.

14.4.3. Dens output of optimization result

Functions for retrieving the optimization result from the collocation-based algorithm in a dense format are now provided. Two options are available: either a user defined mesh is provided or the result is given for a user defined number of points inside each finite element. Interpolation of the collocation polynomials are used to obtain the dense output.

14.5. New simulation package: Assimulo

The simulation based on pySundials have been removed and replaced by the Assimulo package which is also using the Sundials solvers. The main difference between the two is that Assimulo is using Cython to connect to Sundials. This has substantially improved the simulation speed. For more info regarding Assimulo and its features, see: http://www.jmodelica.org/assimulo.

14.6. FMI compliance

The Functional Mockup Interface (FMI) standard is partially supported. FMI compliant model meta data XML document can be exported, support for the FMI C model execution interface is not yet supported.

14.7. XML model export

Models are now exported in XML format. The XML documents contain information on the set of variables, the equations, the user defined functions and for the Optimica´s optimization problems definition of the flattened model. Documents can be validated by a schema designed as an extension of the FMI XML schema.

14.8. Python integration

  • The order of the non-named arguments for the ModelicaCompiler and OptimicaCompiler function compile_model has changed. In previous versions the arguments came in the order (model_file_name, model_class_name, target = "model") and is now (model_class_name, model_file_name, target = "model").

  • The functions setparameter and getparameter in jmi.Model have been removed. Instead the functions set_value and get_value (also in jmi.Model) should be used.

  • Caching has been implemented in the xmlparser module to improve execution time for working with jmi.Model objects, which should be noticeable for large models.

14.8.1. New high-level functions for optimization and simulation

New high-level functions for problem initialization, optimization and simulation have been added which wrap the compilation of a model, creation of a model object, setup and running of an initialization/optimization/simulation and returning of a result in one function call. For each function there is an algorithm implemented which will be used by default but there is also the possibility to add custom algorithms. All examples in the example package have been updated to use the high-level functions.

14.9. Contributors

Christian Andersson

Tove Bergdahl

Magnus Gäfvert

Jesper Mattsson

Philip Nilsson

Roberto Parrotto

Philip Reuterswärd

Johan Åkesson

14.9.1. Previous contributors

Jens Rantil