Beispiel #1
0
        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");
        }
 string ICoolProp.get_global_param_string(string ParamName)
 {
     return(CoolProp.get_global_param_string(ParamName));
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            double T, h, p, D;

            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");

            Console.Write(" " + "\n");
            Console.Write("************ USING EOS *************" + "\n");
            Console.Write(" " + "\n");
            Console.Write("FLUID STATE INDEPENDENT INPUTS" + "\n");
            Console.Write("Critical Density Propane: " + CoolProp.Props1("Propane", "rhocrit") + "kg/m^3" + "\n");
            Console.Write("TWO PHASE INPUTS (Pressure)" + "\n");
            Console.Write("Density of saturated liquid Propane at 101.325 kPa: " + CoolProp.Props("D", 'P', 101.325, 'Q', 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 101.325 kPa: " + CoolProp.Props("D", 'P', 101.325, 'Q', 1, "R290") + " kg/m^3" + "\n");
            Console.Write("TWO PHASE INPUTS (Temperature)" + "\n");
            Console.Write("Density of saturated liquid Propane at 300 K: " + CoolProp.Props("D", 'T', 300, 'Q', 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 300 K: " + CoolProp.Props("D", 'T', 300, 'Q', 1, "R290") + " kg/m^3" + "\n");
            Console.Write("SINGLE PHASE CYCLE (propane)" + "\n");
            p = CoolProp.Props("P", 'T', 300, 'D', 1, "Propane");
            h = CoolProp.Props("H", 'T', 300, 'D', 1, "Propane");
            Console.Write("T,D -> P,H " + 300 + "," + 1 + " --> " + p + ',' + h + "\n");
            T = CoolProp.Props("T", 'P', p, 'H', h, "Propane");
            D = CoolProp.Props("D", 'P', p, 'H', h, "Propane");
            Console.Write("P,H -> T,D " + p + ',' + h + " --> " + T + ',' + D + "\n");

            Console.Write(" " + "\n");
            Console.Write("************ USING TTSE ***************" + "\n");
            Console.Write(" " + "\n");
            CoolProp.enable_TTSE_LUT("Propane");
            Console.Write("TWO PHASE INPUTS (Pressure)" + "\n");
            Console.Write("Density of saturated liquid Propane at 101.325 kPa: " + CoolProp.Props("D", 'P', 101.325, 'Q', 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 101.325 kPa: " + CoolProp.Props("D", 'P', 101.325, 'Q', 1, "R290") + " kg/m^3" + "\n");
            Console.Write("TWO PHASE INPUTS (Temperature)" + "\n");
            Console.Write("Density of saturated liquid Propane at 300 K: " + CoolProp.Props("D", 'T', 300, 'Q', 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 300 K: " + CoolProp.Props("D", 'T', 300, 'Q', 1, "R290") + " kg/m^3" + "\n");
            Console.Write("SINGLE PHASE CYCLE (propane)" + "\n");
            p = CoolProp.Props("P", 'T', 300, 'D', 1, "Propane");
            h = CoolProp.Props("H", 'T', 300, 'D', 1, "Propane");
            Console.Write("T,D -> P,H " + 300 + "," + 1 + " --> " + p + ',' + h + "\n");
            T = CoolProp.Props("T", 'P', p, 'H', h, "Propane");
            D = CoolProp.Props("D", 'P', p, 'H', h, "Propane");
            Console.Write("P,H -> T,D " + p + ',' + h + " --> " + T + ',' + D + "\n");
            CoolProp.disable_TTSE_LUT("Propane");

            try
            {
                Console.Write(" " + "\n");
                Console.Write("************ USING REFPROP ***************" + "\n");
                Console.Write(" " + "\n");
                Console.Write("TWO PHASE INPUTS (Pressure)" + "\n");
                Console.Write("Density of saturated liquid Propane at 101.325 kPa: " + CoolProp.Props("D", 'P', 101.325, 'Q', 0, "Propane") + " kg/m^3" + "\n");
                Console.Write("Density of saturated vapor R290 at 101.325 kPa: " + CoolProp.Props("D", 'P', 101.325, 'Q', 1, "R290") + " kg/m^3" + "\n");
                Console.Write("TWO PHASE INPUTS (Temperature)" + "\n");
                Console.Write("Density of saturated liquid Propane at 300 K: " + CoolProp.Props("D", 'T', 300, 'Q', 0, "Propane") + " kg/m^3" + "\n");
                Console.Write("Density of saturated vapor R290 at 300 K: " + CoolProp.Props("D", 'T', 300, 'Q', 1, "R290") + " kg/m^3" + "\n");
                Console.Write("SINGLE PHASE CYCLE (propane)" + "\n");
                p = CoolProp.Props("P", 'T', 300, 'D', 1, "Propane");
                h = CoolProp.Props("H", 'T', 300, 'D', 1, "Propane");
                Console.Write("T,D -> P,H " + 300 + "," + 1 + " --> " + p + ',' + h + "\n");
                T = CoolProp.Props("T", 'P', p, 'H', h, "Propane");
                D = CoolProp.Props("D", 'P', p, 'H', h, "Propane");
                Console.Write("P,H -> T,D " + p + ',' + h + " --> " + T + ',' + D + "\n");
            }
            catch
            {
                Console.Write(" " + "\n");
                Console.Write("************ CANT USE REFPROP ************" + "\n");
                Console.Write(" " + "\n");
            }

            Console.Write(" " + "\n");
            Console.Write("************ CHANGE UNIT SYSTEM (default is kSI) *************" + "\n");
            Console.Write(" " + "\n");
            int SI  = (int)unit_systems.UNIT_SYSTEM_SI;
            int kSI = (int)unit_systems.UNIT_SYSTEM_KSI;

            CoolProp.set_standard_unit_system(SI);
            Console.Write("Vapor pressure of water at 373.15 K in SI units (Pa): " + CoolProp.Props("P", 'T', 373.15, 'Q', 0, "Water") + "\n");
            CoolProp.set_standard_unit_system(kSI);
            Console.Write("Vapor pressure of water at 373.15 K in kSI units (kPa): " + CoolProp.Props("P", 'T', 373.15, 'Q', 0, "Water") + "\n");

            Console.Write(" " + "\n");
            Console.Write("************ BRINES AND SECONDARY WORKING FLUIDS *************" + "\n");
            Console.Write(" " + "\n");
            Console.Write("Density of 50% (mass) ethylene glycol/water at 300 K, 101.325 kPa: " + CoolProp.Props("D", 'T', 300, 'P', 101.325, "EG-50%") + "kg/m^3" + "\n");
            Console.Write("Viscosity of Therminol D12 at 350 K, 101.325 kPa: " + CoolProp.Props("V", 'T', 350, 'P', 101.325, "TD12") + "Pa-s" + "\n");

            Console.Write(" " + "\n");
            Console.Write("************ HUMID AIR PROPERTIES *************" + "\n");
            Console.Write(" " + "\n");
            Console.Write("Humidity ratio of 50% rel. hum. air at 300 K, 101.325 kPa: " + CoolProp.HAProps("W", "T", 300, "P", 101.325, "R", 0.5) + " kg_w/kg_da" + "\n");
            Console.Write("Relative humidity from last calculation: " + CoolProp.HAProps("R", "T", 300, "P", 101.325, "W", CoolProp.HAProps("W", "T", 300, "P", 101.325, "R", 0.5)) + "(fractional)" + "\n");

            //Console.Write("Enter to quit");
            //Console.ReadLine();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            double T, h, p, D;

            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");

            Console.Write(" " + "\n");
            Console.Write("************ USING EOS *************" + "\n");
            Console.Write(" " + "\n");
            Console.Write("FLUID STATE INDEPENDENT INPUTS" + "\n");
            Console.Write("Critical Density Propane: " + CoolProp.Props1("Propane", "rhocrit") + " kg/m^3" + "\n");
            Console.Write("TWO PHASE INPUTS (Pressure)" + "\n");
            Console.Write("Density of saturated liquid Propane at 101325 Pa: " + CoolProp.PropsSI("D", "P", 101325, "Q", 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 101325 Pa: " + CoolProp.PropsSI("D", "P", 101325, "Q", 1, "R290") + " kg/m^3" + "\n");
            Console.Write("TWO PHASE INPUTS (Temperature)" + "\n");
            Console.Write("Density of saturated liquid Propane at 300 K: " + CoolProp.PropsSI("D", "T", 300, "Q", 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 300 K: " + CoolProp.PropsSI("D", "T", 300, "Q", 1, "R290") + " kg/m^3" + "\n");
            Console.Write("SINGLE PHASE CYCLE (propane)" + "\n");
            p = CoolProp.PropsSI("P", "T", 300, "D", 1, "Propane");
            h = CoolProp.PropsSI("H", "T", 300, "D", 1, "Propane");
            Console.Write("T,D -> P,H " + 300 + "," + 1 + " --> " + p + "," + h + "\n");
            T = CoolProp.PropsSI("T", "P", p, "H", h, "Propane");
            D = CoolProp.PropsSI("D", "P", p, "H", h, "Propane");
            Console.Write("P,H -> T,D " + p + "," + h + " --> " + T + "," + D + "\n");

            Console.Write(" " + "\n");
            Console.Write("************ USING TTSE ***************" + "\n");
            Console.Write(" " + "\n");
            CoolProp.enable_TTSE_LUT("Propane");
            Console.Write("TWO PHASE INPUTS (Pressure)" + "\n");
            Console.Write("Density of saturated liquid Propane at 101325 Pa: " + CoolProp.PropsSI("D", "P", 101325, "Q", 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 101325 Pa: " + CoolProp.PropsSI("D", "P", 101325, "Q", 1, "R290") + " kg/m^3" + "\n");
            Console.Write("TWO PHASE INPUTS (Temperature)" + "\n");
            Console.Write("Density of saturated liquid Propane at 300 K: " + CoolProp.PropsSI("D", "T", 300, "Q", 0, "Propane") + " kg/m^3" + "\n");
            Console.Write("Density of saturated vapor R290 at 300 K: " + CoolProp.PropsSI("D", "T", 300, "Q", 1, "R290") + " kg/m^3" + "\n");
            Console.Write("SINGLE PHASE CYCLE (propane)" + "\n");
            p = CoolProp.PropsSI("P", "T", 300, "D", 1, "Propane");
            h = CoolProp.PropsSI("H", "T", 300, "D", 1, "Propane");
            Console.Write("T,D -> P,H " + 300 + "," + 1 + " --> " + p + "," + h + "\n");
            T = CoolProp.PropsSI("T", "P", p, "H", h, "Propane");
            D = CoolProp.PropsSI("D", "P", p, "H", h, "Propane");
            Console.Write("P,H -> T,D " + p + "," + h + " --> " + T + "," + D + "\n");
            CoolProp.disable_TTSE_LUT("Propane");

            try
            {
                Console.Write(" " + "\n");
                Console.Write("************ USING REFPROP ***************" + "\n");
                Console.Write(" " + "\n");
                Console.Write("TWO PHASE INPUTS (Pressure)" + "\n");
                Console.Write("Density of saturated liquid Propane at 101325 Pa: " + CoolProp.PropsSI("D", "P", 101325, "Q", 0, "Propane") + " kg/m^3" + "\n");
                Console.Write("Density of saturated vapor R290 at 101325 Pa: " + CoolProp.PropsSI("D", "P", 101325, "Q", 1, "R290") + " kg/m^3" + "\n");
                Console.Write("TWO PHASE INPUTS (Temperature)" + "\n");
                Console.Write("Density of saturated liquid Propane at 300 K: " + CoolProp.PropsSI("D", "T", 300, "Q", 0, "Propane") + " kg/m^3" + "\n");
                Console.Write("Density of saturated vapor R290 at 300 K: " + CoolProp.PropsSI("D", "T", 300, "Q", 1, "R290") + " kg/m^3" + "\n");
                Console.Write("SINGLE PHASE CYCLE (propane)" + "\n");
                p = CoolProp.PropsSI("P", "T", 300, "D", 1, "Propane");
                h = CoolProp.PropsSI("H", "T", 300, "D", 1, "Propane");
                Console.Write("T,D -> P,H " + 300 + "," + 1 + " --> " + p + "," + h + "\n");
                T = CoolProp.PropsSI("T", "P", p, "H", h, "Propane");
                D = CoolProp.PropsSI("D", "P", p, "H", h, "Propane");
                Console.Write("P,H -> T,D " + p + "," + h + " --> " + T + "," + D + "\n");
            }
            catch
            {
                Console.Write(" " + "\n");
                Console.Write("************ CANT USE REFPROP ************" + "\n");
                Console.Write(" " + "\n");
            }

            Console.Write(" " + "\n");
            Console.Write("************ BRINES AND SECONDARY WORKING FLUIDS *************" + "\n");
            Console.Write(" " + "\n");
            Console.Write("Density of 50% (mass) ethylene glycol/water at 300 K, 101325 Pa: " + CoolProp.PropsSI("D", "T", 300, "P", 101325, "EG-50%") + "kg/m^3" + "\n");
            Console.Write("Viscosity of Therminol D12 at 350 K, 101325 kPa: " + CoolProp.PropsSI("V", "T", 350, "P", 101325, "TD12") + "Pa-s" + "\n");

            Console.Write(" " + "\n");
            Console.Write("************ HUMID AIR PROPERTIES *************" + "\n");
            Console.Write(" " + "\n");
            Console.Write("Humidity ratio of 50% rel. hum. air at 300 K, 101.325 kPa: " + CoolProp.HAProps("W", "T", 300, "P", 101.325, "R", 0.5) + " kg_w/kg_da" + "\n");
            Console.Write("Relative humidity from last calculation: " + CoolProp.HAProps("R", "T", 300, "P", 101.325, "W", CoolProp.HAProps("W", "T", 300, "P", 101.325, "R", 0.5)) + "(fractional)" + "\n");

            //Console.Write("Enter to quit");
            //Console.ReadLine();
        }