Ejemplo n.º 1
0
    public static double h_given_vt(double v, double t)
    {
        double ret_val;

        try
        {
            ret_val = IAPWS95.IAPWS95_enthalpy(1f / v, t) * 1000f; //UNIT CONVERSION UNTESTED!
            return(ret_val);
        }
        catch (Exception ex)
        {
            Debug.Log(String.Format("Got an exception: {0}\nReturning {1}", ex.Message, h_neutral));
            got_error = true;
            return(h_neutral);
        }
        //return IAPWS95.IAPWS95_enthalpy(1f/v,t)*1000f; //UNIT CONVERSION UNTESTED!
    }
Ejemplo n.º 2
0
    }                                                             //x already is a percent

    //rule of naming for consistency: prefer lexical ordering "p < v < t < u < s < h < q", ie "p_given_vt" rather than "p_given_tv"
    //note- where it says "UNIT CONVERSION UNTESTED", that measn I haven't yet verified that it performs the correct translation of units between APIs (ie, one may be expecting KPa, and another just Pa). I have learned to not trust the documentation of either API (IAPWS95 or IF97)

    public static double p_given_vt(double v, double t)
    {
        double ret_val;

        try
        {
            ret_val = IAPWS95.IAPWS95_pressure(1.0 / v, t) * 1000.0; //expects:Kg/M^3,K returns KPa
            return(ret_val);
        }
        catch (Exception ex)
        {
            Debug.Log(String.Format("Got an exception: {0}\nReturning {1}", ex.Message, p_neutral));
            got_error = true;
            return(p_neutral);
        }
        //return IAPWS95.IAPWS95_pressure(1.0/v,t)*1000.0; //expects:Kg/M^3,K returns KPa
    }