Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection of different state variables (ph, pt, dT) for a CoolProp 2-phase medium #87

Open
ferrucci-franco opened this issue Jul 14, 2023 · 1 comment

Comments

@ferrucci-franco
Copy link

Hi there,

I'm trying to understand how the selection of different state variables affects the resulting system of equations and I've encountered a possible inconsistency:

Looking at the CO2 CoolProp medium example, it says:
package CO2CoolProp "CoolProp model of CO2"
extends ExternalMedia.Media.CoolPropMedium(
mediumName = "CarbonDioxide",
substanceNames = {"CO2"},
ThermoStates = Modelica.Media.Interfaces.Choices.IndependentVariables.ph,
SpecificEnthalpy(start=2e5));
end CO2CoolProp;

However, I think there is should be:
package CO2CoolProp "CoolProp model of CO2"
extends ExternalMedia.Media.CoolPropMedium(
mediumName = "CarbonDioxide",
substanceNames = {"CO2"},
ThermoStates = Modelica.Media.Interfaces.Choices.IndependentVariables.ph, // this doesn't affect the variable selection
inputChoice = ExternalMedia.Common.InputChoice.ph, // this DOES!
SpecificEnthalpy(start=2e5));
end CO2CoolProp;

I think that the constant named ThermoStates (defined in partial package PartialMedium) is not used in ExternalMedia, but instead you have created a parameter called basePropertiesInputChoice (defined in the re-declaration of BaseProperties model inside ExternalTwoPhaseMedium.mo).
The parameter basePropertiesInputChoice is of type ExternalMedia.Common.InputChoice and not of type Modelica.Media.Interfaces.Choices.IndependentVariables.

Note that, for instance, the enumerator type Modelica.Media.Interfaces.Choices.IndependentVariables does NOT include InputChoice.dT (density and temperature...is that a MSL bug?)...I guess that this is why you had to define a new enumerator type ExternalMedia.Common.InputChoice.

In any case, does anyone have an example of a dynamical system using a CoolProp medium, in which the state variables are changed from 'ph' to 'dT' or to 'pT', and the simulation runs correctly in both cases (with possibly a change in the number of non-linear equations)?

Thank you!

@ferrucci-franco ferrucci-franco changed the title InputChoice.dT option does not exist in Modelica.Media.Interfaces.Choices.IndependentVariables Selection of different state variables (ph, pt, dT) for a CoolProp 2-phase medium Jul 14, 2023
@casella
Copy link
Collaborator

casella commented Jul 20, 2023

@ferrucci-franco I don't have such an example, but for sure this should be cleaned up. We'll look at it after the summer break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants