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

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.

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)

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.

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.

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 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.

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.

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.

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_mp`

c for an example.

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.

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.

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.

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.

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.

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.

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.