This function calculates the density and temperature of R1234yf from absolute pressure and specific enthalpy in one-phase region. The function calls the fundamental helmholtz equation of Richter et al (2011) which is requiring density and temperature for input. Thus, a newton iteration is performed to determine density and temperature. The newton iteration stops if the inputs for pressure difference delp and specific enthalpy difference delh are larger than the actual differences derived from the newton iteration.
function dtofpsOnePhase extends Modelica.Icons.Function; input AbsolutePressure p "pressure"; input SpecificEntropy s "specific entropy"; input AbsolutePressure delp "iteration accuracy"; input SpecificEntropy dels "iteration accuracy"; output Density d "density"; output Temperature T "temperature (K)"; output Integer error "error flag: trouble if different from 0"; end dtofpsOnePhase;