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

Variability of costant array in a record

Variability of costant array in a record

Hi,

I use in my model the following record:

record BaseGas "Base record for gas definitions"
  constant Boolean fixedMixingRatio
    "Treat medium as pseudo pure in Modelica if it is a mixture"
    annotation (HideResult=true);
  constant Integer nc_propertyCalculation(min=1)
    "Number of components for fluid property calculations"
    annotation (HideResult=true);
  final constant Integer nc=if fixedMixingRatio then 1 else
      nc_propertyCalculation "Number of components in Modelica models"
    annotation (Evaluate=true, HideResult=true);
  constant Internals.GasName[nc_propertyCalculation] gasNames
    "Array of gas names" annotation (choices);
  constant Real[nc_propertyCalculation] mixingRatio_propertyCalculation;
  constant Real[nc] defaultMixingRatio=if fixedMixingRatio then {1} else
      mixingRatio_propertyCalculation ;
  constant Real xi_default[nc - 1]=defaultMixingRatio[1:end - 1]/sum(
      defaultMixingRatio) "Default mass fractions" annotation (HideResult=true);
end BaseGas;

I noticed that OpenModelica assumes that the variability of the expression "defaultMixingRatio[1:end - 1]/sum(
      defaultMixingRatio)" as "variable" instead of "constant".  Is the variability of this expression really variable? If yes, it is possible to convert the variability in Modelica to "constant" so I can suscessfully compile and use this record in my models?

Best Regards,
Erick

By the way, I am using OpenModelica version 1.9.0 Beta 4 release

Edited by: eosilva - Apr-29-13 19:04:01
There are 0 guests and 0 other users also viewing this topic
You are here: