I have a model of algebraic equations, partial and ordinary differentials. I did the discretization of partial differential equations by the finite difference method, as in example 6.9 of Tiller, Introduction to PhysicaL Modeling with Modelica book.

The initial condition of my model is then an array for all the different points discretized at time zero. And in my model is an input:

initializing array

The problem is that I need to setting this array outside the model and the following error appears: 'FMUException: The length of valueref and values are inconsistent.'

error

Does anyone know what is causing this error and how it can be resolved? Can someone provide me with an example or piece of code that shows how this could be implemented in JModelica?

Thank you, Karinne

1

There are 1 best solutions below

2
On

In FMI 1.0 and 2.0 there are no arrays, there is only a structured naming convention. So x0[1], x0[2] ... x[50] are all individual scalar variables. An FMI importing tool could still support some array actions with the structured naming convention. However, this does not seem to be supported in jModelica, which leads t the error.

So you jou have to treat the inputs as several scalar variables.

Arrays will be avialable in FMI 3.0, see https://fmi-standard.org/docs/3.0-dev/#definition-of-model-variables