Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

error in variable content of array of records

error in variable content of array of records

Hello,
with the following model below, OpenModelica generates an error. It seems that OpenModelica is not compliant with modelia language 3.5 with regards to array of records with variable length content (chapter 10):
« An array of records may contain scalar record values whose elements differ in their dimension sizes, but apart from that they must be of the same type. »

The example below defines a record with an array inside.
then, the model «oo» instantiates 2 records with arrays of different sizes. Then these records are grouped into an array of record.
depending on the order of instantiation, the flattener throw out an error or not. When it does not generates an error, the flattened code is wrong.

is it so that OpenModelica is not implementing modelica language v3.5 for this specific part ? Or did I missinterpet the language spec ?




Code:


package test
//record definition
  record rec
    Real[:,:] tab = fill(0.0,2,2) ;
  end rec;

  // model
  model oo
    // define 2 tables with different sizes
    parameter Real[:,:] tab1 = [0,0 ; 1,1] ;
    parameter Real[:,:] tab2 = [5,5,5,5 ; 6,6,6,6 ; 7,7,7,7 ; 8,8,8,8] ;
   
    // set records
    parameter rec r1(tab = tab1);
    parameter rec r2(tab = tab2);
   
    //define vector of records
    parameter rec[2] alpha = {r1, r2};
    parameter rec[2] beta = {r2, r1};
  end oo;
end test;

Re: error in variable content of array of records

It seems to be a bug.
Ticket #7717 has been opened.

There are 0 guests and 0 other users also viewing this topic
You are here: