﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5558	Specific Heat Issue	anonymous	Adeel Asghar	"Hello, everyone!

I need to calculate the specific heat capacity of R134a on the transition to gas (quality = 1). Here it follows a simple code that represents what I`m trying to do (note that here I vary the pressure as sin wave with respect to time)
model Test

  package Medium = AixLib.Media.Refrigerants.R134a.R134a_IIR_P1_395_T233_455_Horner;

  
  parameter Modelica.SIunits.AbsolutePressure p = 1e5;
  Modelica.SIunits.AbsolutePressure p_in;
  Modelica.SIunits.SpecificHeatCapacityAtConstantPressure C_pv;
  Modelica.SIunits.SpecificEnthalpy h_dew;
  Medium.ThermodynamicState state_ph;
  Medium.SaturationProperties sat_p;

equation
  
  p_in = p*sin(time) + p;
  
  C_pv = Medium.specificHeatCapacityCp(state_ph);
  state_ph = Medium.setState_ph(p_in, h_dew);
  sat_p = Medium.setSat_p(p_in);
  h_dew = Medium.dewEnthalpy(sat_p);

end Test;


The problem is that for some instants of time the cp value is being calculated as if it were inside the two-phase region (which results in an nearly infinite value of about 10^60). This would be right if I wanted its value inside the two-phase region (were temperature is constant for a fiven pressure and cp is almost infinite), but I want it to be calculated in the gas phase boundary for quality = 1, which should return me a value around 800 - 1000 J/kg.k

**For most of the simulation time, the calculation is correct, but for a few instants the error listed above happens. What can I do to assure that cp is calculated only for quality = 1 at all instants of time?   "	defect	closed	high	Future	OMEdit	v1.13.2	invalid	SpecificHeat	
