Opened 4 years ago

Closed 4 years ago

#6442 closed defect (invalid)

Support array indexing by enumerations in the NF

Reported by: Francesco Casella Owned by: Per Östlund
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 by Francesco Casella, 4 years ago

Version: 1.16.21.18.0-dev

comment:2 by Francesco Casella, 4 years ago

Cc: matejak.marek@… added

comment:3 by Per Östlund, 4 years ago

Resolution: invalid
Status: newclosed

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.