Opened 3 years ago

Closed 3 years ago

#6442 closed defect (invalid)

Support array indexing by enumerations in the NF

Reported by: casella Owned by: perost
Priority: high Milestone: 1.18.0
Component: New Instantiation Version: 1.18.0-dev
Keywords: Cc: matejak.marek@…

Description

The latest commit to the PhysioLibrary caused some regressions, see, e.g., Physiolibrary.Fluid.Examples.AirWaterSaturation due to the use of enumerations as indeces for arrays, see, e.g., line 5810.

I understand this is allowed, see Section 10.5.1 and it's a feature that's been around at least since Modelica 3.4.

@perost, how hard it is to implement?

Change History (3)

comment:1 Changed 3 years ago by casella

  • Version changed from 1.16.2 to 1.18.0-dev

comment:2 Changed 3 years ago by casella

  • Cc matejak.marek@… added

comment:3 Changed 3 years ago by perost

  • Resolution set to invalid
  • Status changed from new to closed

Enumeration indices are already supported, but the specification says:

Arrays can be indexed using values of enumeration types or the Boolean type, not only by Integer. The type of the index should correspond to the type used for declaring the dimension of the array.

This is not the case here, the array in question has an Integer dimension but is indexed with an enumeration expression. So the enumeration expression would need to be converted to an Integer in this case:

upperRespiratoryTract.substances[Integer(Air.S.H2O)]
Note: See TracTickets for help on using tickets.