Modelica.Media.R134a Error

496 views Asked by At

In the Modelica Standard Library 3.2.1 a model for the refrigerant R134a was included, but it seems not to work properly with Modelica.Fluid. In a simple example with one DynamicPipe, it results in the following error:

A calculation of two-phase properties with input of pressure and temperature is not possible.
Please use setState_dTX or setState_phX instead.
The stack of functions is:
setState_pTX_Unique15
setState_pTX_Unique15(101325, 293.15, {1.0}, 0)

use_T_start is false. What is the problem here? How can it be solved?

TIA

Update:

The selected states are h and p, as it should be. The parameters of the pTX call seem to be the default values for the chosen medium.

PartialStaggeredFlowModel uses Medium.density_pTX and Medium.setState_pTX, but changing these to the respective phX-functions does not solve the problem.

2

There are 2 answers

0
0xy On BEST ANSWER

The solution is already in my update. PartialStaggeredFlowModel uses Medium.density_pTX and Medium.setState_pTX. Replacing these with Medium.density_phX and Medium.setState_phX avoids the pT-problem. The reason why it did not work at first was one reference to the unmodified class I forgot to change.

Other Modelica.Fluid-components have the same problem, e.g. the pump-models are based on PartialPump, which also uses Medium.density_pTX.

Thank you for your contributions.

1
Michael Tiller On

The issue here is your choice of thermodynamic states. As the message indicates, you cannot use a two-phase medium with pressure and temperature as the thermodynamic states.

As a simple example, consider water/ice. If you measure the temperature as it is freezing, you'll see that when the mixture is "slushy" (contains both liquid and solid), the temperature will remain constant. So knowing the temperature is not sufficient to know the true (thermodynamic) state of the system because we cannot compute the relative fractions of liquid and solid with that information. The solution is to use pressure and enthalpy (as the error message suggests) as the thermodynamic states.

I don't know enough about the Modelica.Media and Modelica.Fluid libraries to tell you how to change your selection of thermodynamic states. But I suspect you'll find the answer in the documentation of one of those libraries.