You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenModelica doesn't follow the grammar here and gives a syntax error for the empty enumeration. But I guess that just confirms that there shouldn't be any issue with making enum-list required.
As I recall one issue with enumerations was sub/super-typing, and there were some discussions about being able to add enumeration members later. That was then restricted to just using enumeration(:) as constraining type - and one guess would be that enumeration() was an early variant of that.
I realized that with replaceable enumerations there might be a use-case:
model M
replaceable type E=enumeration(:);
Real x[E](each start=0);
equation
der(x)=ones(size(x,1))-x;
end M;
M m1(redeclare type E=enumeration());
M m2(redeclare type E=enumeration(A, B));
For examples, if someone wants to have trace-products with names it might make sense to allow none as well.
For some reason Dymola generates 0 as minimum for the missing enumeration.
The grammar allows an enumeration to not have any literals (by making the
enum-list
optional), but why?As long as it is allowed we have a problem with models like this, where the greatest value of the enumeration is needed:
The text was updated successfully, but these errors were encountered: