コード例 #1
0
ファイル: Example.cs プロジェクト: Kevogich/with-dll
        static void Main(string[] args)
        {
            Console.Write("**************** INFORMATION ***************" + "\n");
            Console.Write("This example was auto-generated by the language-agnostic dev/scripts/example_generator.py script written by Ian Bell" + "\n");
            Console.Write("CoolProp version:" + " " + CoolProp.get_global_param_string("version") + "\n");
            Console.Write("CoolProp gitrevision:" + " " + CoolProp.get_global_param_string("gitrevision") + "\n");
            Console.Write("CoolProp Fluids:" + " " + CoolProp.get_global_param_string("FluidsList") + "\n");
            // See http://www.coolprop.org/coolprop/HighLevelAPI.html#table-of-string-inputs-to-propssi-function for a list of inputs to high-level interface;
            Console.Write("*********** HIGH LEVEL INTERFACE *****************" + "\n");
            Console.Write("Critical temperature of water:" + " " + CoolProp.Props1SI("Water", "Tcrit") + " " + "K" + "\n");
            Console.Write("Boiling temperature of water at 101325 Pa:" + " " + CoolProp.PropsSI("T", "P", 101325, "Q", 0, "Water") + " " + "K" + "\n");
            Console.Write("Phase of water at 101325 Pa and 300 K:" + " " + CoolProp.PhaseSI("P", 101325, "T", 300, "Water") + "\n");
            Console.Write("c_p of water at 101325 Pa and 300 K:" + " " + CoolProp.PropsSI("C", "P", 101325, "T", 300, "Water") + " " + "J/kg/K" + "\n");
            Console.Write("c_p of water (using derivatives) at 101325 Pa and 300 K:" + " " + CoolProp.PropsSI("d(H)/d(T)|P", "P", 101325, "T", 300, "Water") + " " + "J/kg/K" + "\n");
            Console.Write("*********** HUMID AIR PROPERTIES *****************" + "\n");
            Console.Write("Humidity ratio of 50% rel. hum. air at 300 K, 101325 Pa:" + " " + CoolProp.HAPropsSI("W", "T", 300, "P", 101325, "R", 0.5) + " " + "kg_w/kg_da" + "\n");
            Console.Write("Relative humidity from last calculation:" + " " + CoolProp.HAPropsSI("R", "T", 300, "P", 101325, "W", CoolProp.HAPropsSI("W", "T", 300, "P", 101325, "R", 0.5)) + " " + "(fractional)" + "\n");
            Console.Write("*********** INCOMPRESSIBLE FLUID AND BRINES *****************" + "\n");
            Console.Write("Density of 50% (mass) ethylene glycol/water at 300 K, 101325 Pa:" + " " + CoolProp.PropsSI("D", "T", 300, "P", 101325, "INCOMP::MEG-50%") + " " + "kg/m^3" + "\n");
            Console.Write("Viscosity of Therminol D12 at 350 K, 101325 Pa:" + " " + CoolProp.PropsSI("V", "T", 350, "P", 101325, "INCOMP::TD12") + " " + "Pa-s" + "\n");
            // If you don't have REFPROP installed, disable the following lines;
            Console.Write("*********** REFPROP *****************" + "\n");
            Console.Write("REFPROP version:" + " " + CoolProp.get_global_param_string("REFPROP_version") + "\n");
            Console.Write("Critical temperature of water:" + " " + CoolProp.Props1SI("REFPROP::WATER", "Tcrit") + " " + "K" + "\n");
            Console.Write("Boiling temperature of water at 101325 Pa:" + " " + CoolProp.PropsSI("T", "P", 101325, "Q", 0, "REFPROP::WATER") + " " + "K" + "\n");
            Console.Write("c_p of water at 101325 Pa and 300 K:" + " " + CoolProp.PropsSI("C", "P", 101325, "T", 300, "REFPROP::WATER") + " " + "J/kg/K" + "\n");
            Console.Write("*********** TABULAR BACKENDS *****************" + "\n");
            AbstractState TAB = AbstractState.factory("BICUBIC&HEOS", "R245fa");

            TAB.update(input_pairs.PT_INPUTS, 101325, 300);
            Console.Write("Mass density of refrigerant R245fa at 300 K, 101325 Pa:" + " " + TAB.rhomass() + " " + "kg/m^3" + "\n");
            Console.Write("*********** SATURATION DERIVATIVES (LOW-LEVEL INTERFACE) ***************" + "\n");
            AbstractState AS_SAT = AbstractState.factory("HEOS", "R245fa");

            AS_SAT.update(input_pairs.PQ_INPUTS, 101325, 0);
            Console.Write("First saturation derivative:" + " " + AS_SAT.first_saturation_deriv(parameters.iP, parameters.iT) + " " + "Pa/K" + "\n");
            Console.Write("*********** LOW-LEVEL INTERFACE *****************" + "\n");
            AbstractState AS = AbstractState.factory("HEOS", "Water&Ethanol");
            DoubleVector  z  = new DoubleVector(new double[] { 0.5, 0.5 });

            AS.set_mole_fractions(z);
            AS.update(input_pairs.PQ_INPUTS, 101325, 1);
            Console.Write("Normal boiling point temperature of water and ethanol:" + " " + AS.T() + " " + "K" + "\n");
            // If you don't have REFPROP installed, disable the following block;
            Console.Write("*********** LOW-LEVEL INTERFACE (REFPROP) *****************" + "\n");
            AbstractState AS2 = AbstractState.factory("REFPROP", "METHANE&ETHANE");
            DoubleVector  z2  = new DoubleVector(new double[] { 0.2, 0.8 });

            AS2.set_mole_fractions(z2);
            AS2.update(input_pairs.QT_INPUTS, 1, 120);
            Console.Write("Vapor molar density:" + " " + AS2.keyed_output(parameters.iDmolar) + " " + "mol/m^3" + "\n");
        }
コード例 #2
0
 string ICoolProp.PhaseSI(string Name1, double Prop1, string Name2, double Prop2, string FluidName)
 {
     return(CoolProp.PhaseSI(Name1, Prop1, Name2, Prop2, FluidName));
 }