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

Enumeration problem

Enumeration problem

I’m not sure about if it is a bug or a normal behaviour, but it is affecting the use of at least the HelmholtzMedia package. When using a constant enumeration inside a package it is impossible, but only in certain circumstances, to change its value while inheriting. The problem is shown in the attached file: models EnumerationTest1 and EnumerationTest3 run, but not EnumerationTest2. The problem is that media models are normally used as in EnumerationTest2. The problem doesn’t appear if the definition of the enumeration is outside the package.

Re: Enumeration problem

That is because you have

Code:

package Enu=EnumerationBase1(option=Options.B);

. Options is not available in the scope of ModelicaTests2.EnumerationTest2. It works if you have it as option=EnumerationBase1.Options.B

Re: Enumeration problem

Thanks, and yes it works. I didn’t expect that option were inside the scope and Options not, as both are at root level inside the same package.

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