Hi Tom,

Right now OpenModelica handles this only if idx is parameter or constant.

The Modelica spec does not mention any such restriction, so this might be a missing feature.

--
Martin Sjölund

On 2010-10-17 04:22 , Tom Short wrote:
Hi, I'm trying to convert a three-year old Modelica/Dymola library.
One feature it uses is indexing one array with another. Here is an
example that does not work in OpenModelica:

class ArrayTest
   Real a[4];
   Integer idx[2] = {2,4};
equation
   a[{1,3}] = {1,3};
//  a[{2,4}] = {2,4};
   a[idx] = {2,4};
end ArrayTest;

The error I get is given below. I get the same type of error for
single- and two-dimensional arrays.

Error: Index out of bounds. Adressing position: idx[1] and position
idx[2], while array length is: 4
Error: Error occured while flattening model ArrayTest

I'm not sure if this is a bug or a feature not yet added or something
that's outside the Modelica spec.

- Tom

Reply via email to